mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
Code factorization: move "properties" action and slot to DolphinViewActionHandler.
svn path=/trunk/KDE/kdebase/apps/; revision=831148
This commit is contained in:
parent
815332af38
commit
b5e97174d0
|
@ -63,7 +63,6 @@
|
|||
#include <kmessagebox.h>
|
||||
#include <konq_fileitemcapabilities.h>
|
||||
#include <konqmimedata.h>
|
||||
#include <kpropertiesdialog.h>
|
||||
#include <kprotocolinfo.h>
|
||||
#include <krun.h>
|
||||
#include <kshell.h>
|
||||
|
@ -353,23 +352,6 @@ void DolphinMainWindow::updateNewMenu()
|
|||
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();
|
||||
|
@ -917,11 +899,6 @@ void DolphinMainWindow::setupActions()
|
|||
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
|
||||
|
|
|
@ -172,13 +172,6 @@ private slots:
|
|||
/** 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.
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpropertiesdialog.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()));
|
||||
|
||||
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
|
||||
|
@ -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);
|
||||
|
|
|
@ -168,11 +168,6 @@ private Q_SLOTS:
|
|||
*/
|
||||
void slotEditMimeType();
|
||||
|
||||
/**
|
||||
* Connected to the "properties" action
|
||||
*/
|
||||
void slotProperties();
|
||||
|
||||
/**
|
||||
* Open a terminal window, starting with the current directory.
|
||||
*/
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <klocale.h>
|
||||
#include <ktoggleaction.h>
|
||||
#include <krun.h>
|
||||
#include <kpropertiesdialog.h>
|
||||
|
||||
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()));
|
||||
|
||||
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);
|
||||
|
@ -506,3 +513,20 @@ void DolphinViewActionHandler::slotFindFile()
|
|||
{
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -178,6 +178,14 @@ private Q_SLOTS:
|
|||
*/
|
||||
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.
|
||||
|
|
Loading…
Reference in a new issue