]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Code factorization: move "properties" action and slot to DolphinViewActionHandler.
authorDavid Faure <faure@kde.org>
Fri, 11 Jul 2008 23:06:07 +0000 (23:06 +0000)
committerDavid Faure <faure@kde.org>
Fri, 11 Jul 2008 23:06:07 +0000 (23:06 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=831148

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/dolphinpart.cpp
src/dolphinpart.h
src/dolphinviewactionhandler.cpp
src/dolphinviewactionhandler.h

index 37b835622c27ee5c406a9d5d5b3aa88d3dc6d9ce..cebf34e2ad6d7c470e46b465882f0c31289e3f25 100644 (file)
@@ -63,7 +63,6 @@
 #include <kmessagebox.h>
 #include <konq_fileitemcapabilities.h>
 #include <konqmimedata.h>
 #include <kmessagebox.h>
 #include <konq_fileitemcapabilities.h>
 #include <konqmimedata.h>
-#include <kpropertiesdialog.h>
 #include <kprotocolinfo.h>
 #include <krun.h>
 #include <kshell.h>
 #include <kprotocolinfo.h>
 #include <krun.h>
 #include <kshell.h>
@@ -353,23 +352,6 @@ void DolphinMainWindow::updateNewMenu()
     m_newMenu->setPopupFiles(activeViewContainer()->url());
 }
 
     m_newMenu->setPopupFiles(activeViewContainer()->url());
 }
 
-void DolphinMainWindow::properties()
-{
-    KPropertiesDialog* dialog = 0;
-    const KFileItemList list = m_activeViewContainer->view()->selectedItems();
-    if (list.isEmpty()) {
-        const KUrl url = activeViewContainer()->url();
-        dialog = new KPropertiesDialog(url, this);
-    } else {
-        dialog = new KPropertiesDialog(list, this);
-    }
-
-    dialog->setAttribute(Qt::WA_DeleteOnClose);
-    dialog->show();
-    dialog->raise();
-    dialog->activateWindow();
-}
-
 void DolphinMainWindow::quit()
 {
     close();
 void DolphinMainWindow::quit()
 {
     close();
@@ -917,11 +899,6 @@ void DolphinMainWindow::setupActions()
     connect(closeTab, SIGNAL(triggered()), this, SLOT(closeTab()));
     actionCollection()->addAction("close_tab", closeTab);
 
     connect(closeTab, SIGNAL(triggered()), this, SLOT(closeTab()));
     actionCollection()->addAction("close_tab", closeTab);
 
-    KAction* properties = actionCollection()->addAction("properties");
-    properties->setText(i18nc("@action:inmenu File", "Properties"));
-    properties->setShortcut(Qt::ALT | Qt::Key_Return);
-    connect(properties, SIGNAL(triggered()), this, SLOT(properties()));
-
     KStandardAction::quit(this, SLOT(quit()), actionCollection());
 
     // setup 'Edit' menu
     KStandardAction::quit(this, SLOT(quit()), actionCollection());
 
     // setup 'Edit' menu
index ce6dc660632cdd611f36a8ff4cb477482a5d25de..c4c05bf83fa0ec0e316c710c0d6614512c51a59a 100644 (file)
@@ -172,13 +172,6 @@ private slots:
     /** Updates the 'Create New...' sub menu. */
     void updateNewMenu();
 
     /** Updates the 'Create New...' sub menu. */
     void updateNewMenu();
 
-    /**
-     * Opens the properties window for the selected items of the
-     * active view. The properties windows shows information
-     * like name, size and permissions.
-     */
-    void properties();
-
     /**
      * Shows the error information from the places model
      * in the status bar.
     /**
      * Shows the error information from the places model
      * in the status bar.
index 3a94a71070d23f7e6256deb2181b2393215cc5ce..1cdf73f3e2dc5d80265e78f23f267e748abd82dd 100644 (file)
@@ -35,7 +35,6 @@
 #include <klocale.h>
 #include <kmessagebox.h>
 #include <kpluginfactory.h>
 #include <klocale.h>
 #include <kmessagebox.h>
 #include <kpluginfactory.h>
-#include <kpropertiesdialog.h>
 #include <ktoggleaction.h>
 #include <kio/netaccess.h>
 #include <ktoolinvocation.h>
 #include <ktoggleaction.h>
 #include <kio/netaccess.h>
 #include <ktoolinvocation.h>
@@ -142,11 +141,6 @@ void DolphinPart::createActions()
     editMimeTypeAction->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) );
     connect(editMimeTypeAction, SIGNAL(triggered()), SLOT(slotEditMimeType()));
 
     editMimeTypeAction->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) );
     connect(editMimeTypeAction, SIGNAL(triggered()), SLOT(slotEditMimeType()));
 
-    KAction *propertiesAction = actionCollection()->addAction( "properties" );
-    propertiesAction->setText( i18nc("@action:inmenu Edit", "Properties") );
-    propertiesAction->setShortcut(Qt::ALT+Qt::Key_Return);
-    connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties()));
-
     // View menu: all done by DolphinViewActionHandler
 
     // Go menu
     // View menu: all done by DolphinViewActionHandler
 
     // Go menu
@@ -447,23 +441,6 @@ void DolphinPart::slotEditMimeType()
     }
 }
 
     }
 }
 
-void DolphinPart::slotProperties()
-{
-    KPropertiesDialog* dialog = 0;
-    const KFileItemList list = m_view->selectedItems();
-    if (list.isEmpty()) {
-        const KUrl url = m_view->url();
-        dialog = new KPropertiesDialog(url, m_view);
-    } else {
-        dialog = new KPropertiesDialog(list, m_view);
-    }
-
-    dialog->setAttribute(Qt::WA_DeleteOnClose);
-    dialog->show();
-    dialog->raise();
-    dialog->activateWindow();
-}
-
 void DolphinPart::setCurrentViewMode(const QString& viewModeName)
 {
     QAction* action = actionCollection()->action(viewModeName);
 void DolphinPart::setCurrentViewMode(const QString& viewModeName)
 {
     QAction* action = actionCollection()->action(viewModeName);
index 6778bb064da6d8ea1b97ab590220e2f6a45f6278..e21141b1294f70f536ca845fa192aa0a1784611d 100644 (file)
@@ -168,11 +168,6 @@ private Q_SLOTS:
      */
     void slotEditMimeType();
 
      */
     void slotEditMimeType();
 
-    /**
-     * Connected to the "properties" action
-     */
-    void slotProperties();
-
     /**
      * Open a terminal window, starting with the current directory.
      */
     /**
      * Open a terminal window, starting with the current directory.
      */
index d87937bb26fe27d64215d830b04cd92e446bc72e..cd5880c794b7a776a751a2e7f69fc27d6c87460a 100644 (file)
@@ -29,6 +29,7 @@
 #include <klocale.h>
 #include <ktoggleaction.h>
 #include <krun.h>
 #include <klocale.h>
 #include <ktoggleaction.h>
 #include <krun.h>
+#include <kpropertiesdialog.h>
 
 DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection* collection, QObject* parent)
     : QObject(parent),
 
 DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection* collection, QObject* parent)
     : QObject(parent),
@@ -104,6 +105,12 @@ void DolphinViewActionHandler::createActions()
     deleteWithTrashShortcut->setEnabled(false);
     connect(deleteWithTrashShortcut, SIGNAL(triggered()), this, SLOT(slotDeleteItems()));
 
     deleteWithTrashShortcut->setEnabled(false);
     connect(deleteWithTrashShortcut, SIGNAL(triggered()), this, SLOT(slotDeleteItems()));
 
+    KAction *propertiesAction = m_actionCollection->addAction( "properties" );
+    // Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :)
+    propertiesAction->setText( i18nc("@action:inmenu File", "Properties") );
+    propertiesAction->setShortcut(Qt::ALT | Qt::Key_Return);
+    connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties()));
+
     // View menu
 
     QActionGroup* viewModeActions = new QActionGroup(this);
     // View menu
 
     QActionGroup* viewModeActions = new QActionGroup(this);
@@ -506,3 +513,20 @@ void DolphinViewActionHandler::slotFindFile()
 {
     KRun::run("kfind", m_currentView->url(), m_currentView->window());
 }
 {
     KRun::run("kfind", m_currentView->url(), m_currentView->window());
 }
+
+void DolphinViewActionHandler::slotProperties()
+{
+    KPropertiesDialog* dialog = 0;
+    const KFileItemList list = m_currentView->selectedItems();
+    if (list.isEmpty()) {
+        const KUrl url = m_currentView->url();
+        dialog = new KPropertiesDialog(url, m_currentView);
+    } else {
+        dialog = new KPropertiesDialog(list, m_currentView);
+    }
+
+    dialog->setAttribute(Qt::WA_DeleteOnClose);
+    dialog->show();
+    dialog->raise();
+    dialog->activateWindow();
+}
index 5c13299a1b7a5dfd4c3c208b57d4908edaeb64d1..af25cc48cb47af1df1d0d611cafee1edc7a54f6a 100644 (file)
@@ -178,6 +178,14 @@ private Q_SLOTS:
      */
     void slotFindFile();
 
      */
     void slotFindFile();
 
+    /**
+     * Connected to the "properties" action.
+     * Opens the properties dialog for the selected items of the
+     * active view. The properties dialog shows information
+     * like name, size and permissions.
+     */
+    void slotProperties();
+
 private:
     /**
      * Create all the actions.
 private:
     /**
      * Create all the actions.