- // insert 'Cut', 'Copy' and 'Paste'
- QAction* cutAction = new QAction(KIcon("edit-cut"), i18n("Cut"), this);
- connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));
-
- QAction* copyAction = new QAction(KIcon("edit-copy"), i18n("Copy"), this);
- connect(copyAction, SIGNAL(triggered()), this, SLOT(copy()));
-
- QAction* pasteAction = new QAction(KIcon("edit-paste"), i18n("Paste"), this);
- const QMimeData* mimeData = QApplication::clipboard()->mimeData();
- const KUrl::List pasteData = KUrl::List::fromMimeData(mimeData);
- pasteAction->setEnabled(!pasteData.isEmpty());
- connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
-
- popup->addAction(cutAction);
- popup->addAction(copyAction);
- popup->addAction(pasteAction);
- popup->addSeparator();
-
- // insert 'Rename'
- QAction* renameAction = new QAction(i18n("Rename..."), this);
- connect(renameAction, SIGNAL(triggered()), this, SLOT(rename()));
- popup->addAction(renameAction);
-
- // insert 'Move to Trash' and (optionally) 'Delete'
- const KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals);
- const KConfigGroup kdeConfig(globalConfig, "KDE");
- bool showDeleteCommand = kdeConfig.readEntry("ShowDeleteCommand", false);
- const KUrl& url = m_fileInfo->url();
- if (url.isLocalFile()) {
- QAction* moveToTrashAction = new QAction(KIcon("edit-trash"), i18n("Move To Trash"), this);
- connect(moveToTrashAction, SIGNAL(triggered()), this, SLOT(moveToTrash()));
- popup->addAction(moveToTrashAction);
- } else {
- showDeleteCommand = true;
- }
+ if (!m_fileInfo.isNull()) {
+ // insert 'Cut', 'Copy' and 'Paste'
+ QAction* cutAction = new QAction(KIcon("edit-cut"), i18nc("@action:inmenu", "Cut"), this);
+ connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));
+
+ QAction* copyAction = new QAction(KIcon("edit-copy"), i18nc("@action:inmenu", "Copy"), this);
+ connect(copyAction, SIGNAL(triggered()), this, SLOT(copy()));
+
+ QAction* pasteAction = new QAction(KIcon("edit-paste"), i18nc("@action:inmenu", "Paste"), this);
+ const QMimeData* mimeData = QApplication::clipboard()->mimeData();
+ const KUrl::List pasteData = KUrl::List::fromMimeData(mimeData);
+ pasteAction->setEnabled(!pasteData.isEmpty());
+ connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
+
+ popup->addAction(cutAction);
+ popup->addAction(copyAction);
+ popup->addAction(pasteAction);
+ popup->addSeparator();
+
+ // insert 'Rename'
+ QAction* renameAction = new QAction(i18nc("@action:inmenu", "Rename..."), this);
+ connect(renameAction, SIGNAL(triggered()), this, SLOT(rename()));
+ popup->addAction(renameAction);
+
+ // insert 'Move to Trash' and (optionally) 'Delete'
+ KConfigGroup kdeConfig(KGlobal::config(), "KDE");
+ bool showDeleteCommand = kdeConfig.readEntry("ShowDeleteCommand", false);
+ const KUrl& url = m_fileInfo.url();
+ if (url.isLocalFile()) {
+ QAction* moveToTrashAction = new QAction(KIcon("user-trash"),
+ i18nc("@action:inmenu", "Move To Trash"), this);
+ connect(moveToTrashAction, SIGNAL(triggered()), this, SLOT(moveToTrash()));
+ popup->addAction(moveToTrashAction);
+ } else {
+ showDeleteCommand = true;
+ }
+
+ if (showDeleteCommand) {
+ QAction* deleteAction = new QAction(KIcon("edit-delete"), i18nc("@action:inmenu", "Delete"), this);
+ connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteItem()));
+ popup->addAction(deleteAction);
+ }
+
+ popup->addSeparator();