From: Peter Penz Date: Sun, 1 Mar 2009 12:42:51 +0000 (+0000) Subject: SVN_SILENT: minor coding style cleanups X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/0d4306596a84c04f78a8a1fc827265c307fbb2b8?ds=inline SVN_SILENT: minor coding style cleanups svn path=/trunk/KDE/kdebase/apps/; revision=933598 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 9e344f1c4..7029e9bc9 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -362,7 +362,7 @@ void DolphinMainWindow::openNewTab(const KUrl& url) void DolphinMainWindow::activateNextTab() { - if (m_viewTab.count() == 1 || m_tabBar->count() < 2) { + if ((m_viewTab.count() == 1) || (m_tabBar->count() < 2)) { return; } @@ -372,7 +372,7 @@ void DolphinMainWindow::activateNextTab() void DolphinMainWindow::activatePrevTab() { - if (m_viewTab.count() == 1 || m_tabBar->count() < 2) { + if ((m_viewTab.count() == 1) || (m_tabBar->count() < 2)) { return; } @@ -500,21 +500,21 @@ void DolphinMainWindow::slotUndoAvailable(bool available) void DolphinMainWindow::restoreClosedTab(QAction* action) { - //The Clear Recently Closed Tabs List QAction, has it's data set to true, so we can detect it in here, as it's an exception. - if (action->data().toBool() == true) { - // Lets preserve the separator, and the clear action within this menu. - QList actionlist = m_recentTabsMenu->menu()->actions(); - for (int i = 2; i < actionlist.size(); i++) { - m_recentTabsMenu->menu()->removeAction(actionlist.at(i)); + if (action->data().toBool()) { + // clear all actions except the "Empty Recently Closed Tabs" + // action and the separator + QList actions = m_recentTabsMenu->menu()->actions(); + const int count = actions.size(); + for (int i = 2; i < count; i++) { + m_recentTabsMenu->menu()->removeAction(actions.at(i)); } } else { const ClosedTab closedTab = action->data().value(); - openNewTab(closedTab.primaryUrl); m_tabBar->setCurrentIndex(m_viewTab.count() - 1); if (closedTab.isSplit) { - //Create secondary view. + // create secondary view toggleSplitView(); m_viewTab[m_tabIndex].secondaryView->setUrl(closedTab.secondaryUrl); } @@ -794,7 +794,7 @@ void DolphinMainWindow::closeTab(int index) Q_ASSERT(index >= 0); Q_ASSERT(index < m_viewTab.count()); if (m_viewTab.count() == 1) { - // the last tab may never get closed + // the last tab may never get closed return; } @@ -804,7 +804,8 @@ void DolphinMainWindow::closeTab(int index) m_tabBar->setCurrentIndex((index > 0) ? index - 1 : 1); } rememberClosedTab(index); - //Delete this tab. + + // delete tab m_viewTab[index].primaryView->deleteLater(); if (m_viewTab[index].secondaryView != 0) { m_viewTab[index].secondaryView->deleteLater(); @@ -883,7 +884,6 @@ void DolphinMainWindow::searchItems(const KUrl& url) m_activeViewContainer->setUrl(url); } - void DolphinMainWindow::init() { DolphinSettings& settings = DolphinSettings::instance(); @@ -1341,11 +1341,11 @@ void DolphinMainWindow::rememberClosedTab(int index) action->setData(QVariant::fromValue(closedTab)); action->setIcon(KIcon(iconName)); - //Add our action after the separator and the clear list actions + // add the closed tab menu entry after the separator and + // "Empty Recently Closed Tabs" entry if (tabsMenu->actions().size() == 2) { tabsMenu->addAction(action); } else { - tabsMenu->insertAction(tabsMenu->actions().at(2), action); } actionCollection()->action("closed_tabs")->setEnabled(true); diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index ccf433ffe..5b91b99ce 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -454,7 +454,6 @@ private: QPointer m_settingsDialog; }; - inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const { return m_activeViewContainer;