]> cloud.milkyroute.net Git - dolphin.git/commitdiff
SVN_SILENT: minor coding style cleanups
authorPeter Penz <peter.penz19@gmail.com>
Sun, 1 Mar 2009 12:42:51 +0000 (12:42 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sun, 1 Mar 2009 12:42:51 +0000 (12:42 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=933598

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h

index 9e344f1c42abe6b449ef2efa5f1d34d74ef1b8b8..7029e9bc95d37f7ddf2343880a9cbeb59d3a4d12 100644 (file)
@@ -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<QAction*> 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<QAction*> 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<ClosedTab>();
-
         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);
index ccf433ffe03f0b59d9508e7d44e4b07d693fe34d..5b91b99ce04ccc384857c0f55905f6e0556ba8c6 100644 (file)
@@ -454,7 +454,6 @@ private:
     QPointer<DolphinSettingsDialog> m_settingsDialog;
 };
 
-
 inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const
 {
     return m_activeViewContainer;