Move (broken) action "Edit/Properties" to dolphinpart and made it work there.

Pass parent widget to all KPropertiesDialog instances.

svn path=/trunk/KDE/kdebase/apps/; revision=752542
This commit is contained in:
David Faure 2007-12-24 19:07:32 +00:00
parent 728ecea4a1
commit 8eed64171c
5 changed files with 27 additions and 6 deletions

View file

@ -261,7 +261,7 @@ void DolphinContextMenu::openViewportContextMenu()
QAction* action = popup->exec(QCursor::pos()); QAction* action = popup->exec(QCursor::pos());
if (action == propertiesAction) { if (action == propertiesAction) {
const KUrl& url = m_mainWindow->activeViewContainer()->url(); const KUrl& url = m_mainWindow->activeViewContainer()->url();
KPropertiesDialog dialog(url); KPropertiesDialog dialog(url, m_mainWindow);
dialog.exec(); dialog.exec();
} else if (action == addToPlacesAction) { } else if (action == addToPlacesAction) {
const KUrl& url = m_mainWindow->activeViewContainer()->url(); const KUrl& url = m_mainWindow->activeViewContainer()->url();

View file

@ -18,6 +18,7 @@
*/ */
#include "dolphinpart.h" #include "dolphinpart.h"
#include <kpropertiesdialog.h>
#include <kglobalsettings.h> #include <kglobalsettings.h>
#include "dolphinsortfilterproxymodel.h" #include "dolphinsortfilterproxymodel.h"
#include "dolphinview.h" #include "dolphinview.h"
@ -131,9 +132,14 @@ void DolphinPart::createActions()
connect(deleteAction, SIGNAL(triggered()), m_view, SLOT(deleteSelectedItems())); connect(deleteAction, SIGNAL(triggered()), m_view, SLOT(deleteSelectedItems()));
KAction *editMimeTypeAction = actionCollection()->addAction( "editMimeType" ); KAction *editMimeTypeAction = actionCollection()->addAction( "editMimeType" );
editMimeTypeAction->setText( i18n( "&Edit File Type..." ) ); editMimeTypeAction->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) );
connect(editMimeTypeAction, SIGNAL(triggered()), SLOT(slotEditMimeType())); 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()));
// This action doesn't appear in the GUI, it's for the shortcut only. // This action doesn't appear in the GUI, it's for the shortcut only.
// KNewMenu takes care of the GUI stuff. // KNewMenu takes care of the GUI stuff.
KAction* newDirAction = actionCollection()->addAction( "create_dir" ); KAction* newDirAction = actionCollection()->addAction( "create_dir" );
@ -192,7 +198,7 @@ void DolphinPart::slotSelectionChanged(const KFileItemList& selection)
} }
QStringList actions; QStringList actions;
actions << "rename" << "move_to_trash" << "delete" << "editMimeType"; actions << "rename" << "move_to_trash" << "delete" << "editMimeType" << "properties";
foreach(const QString& actionName, actions) { foreach(const QString& actionName, actions) {
QAction* action = actionCollection()->action(actionName); QAction* action = actionCollection()->action(actionName);
Q_ASSERT(action); Q_ASSERT(action);
@ -411,4 +417,13 @@ void DolphinPart::slotEditMimeType()
} }
} }
void DolphinPart::slotProperties()
{
const KFileItemList items = m_view->selectedItems();
if (!items.isEmpty()) {
KPropertiesDialog dialog(items.first().url(), m_view);
dialog.exec();
}
}
#include "dolphinpart.moc" #include "dolphinpart.moc"

View file

@ -130,6 +130,11 @@ private Q_SLOTS:
*/ */
void slotEditMimeType(); void slotEditMimeType();
/**
* Connected to the "properties" action
*/
void slotProperties();
private: private:
void createActions(); void createActions();
void createGoAction(const char* name, const char* iconName, void createGoAction(const char* name, const char* iconName,

View file

@ -1,11 +1,12 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="dolphinpart" version="5" > <kpartgui name="dolphinpart" version="6" >
<MenuBar> <MenuBar>
<Menu name="edit"> <Menu name="edit">
<Action name="rename"/> <Action name="rename"/>
<Action name="move_to_trash" /> <Action name="move_to_trash" />
<Action name="delete"/> <Action name="delete"/>
<Action name="editMimeType"/> <Action name="editMimeType"/>
<Action name="properties"/>
<Separator /> <Separator />
<Action name="select_all" /> <Action name="select_all" />
<Action name="invert_selection" /> <Action name="invert_selection" />

View file

@ -164,7 +164,7 @@ void TreeViewContextMenu::deleteItem()
void TreeViewContextMenu::showProperties() void TreeViewContextMenu::showProperties()
{ {
KPropertiesDialog dialog(m_fileInfo.url()); KPropertiesDialog dialog(m_fileInfo.url(), m_parent);
dialog.exec(); dialog.exec();
} }