52
52
KMenu* popup = new KMenu(m_parent);
54
if (!m_fileInfo.isNull()) {
55
KFileItemListProperties capabilities(KFileItemList() << m_fileInfo);
54
if (!m_fileItem.isNull()) {
55
KFileItemListProperties capabilities(KFileItemList() << m_fileItem);
57
57
// insert 'Cut', 'Copy' and 'Paste'
58
58
QAction* cutAction = new QAction(KIcon("edit-cut"), i18nc("@action:inmenu", "Cut"), this);
85
85
KConfigGroup configGroup(globalConfig, "KDE");
86
86
bool showDeleteCommand = configGroup.readEntry("ShowDeleteCommand", false);
88
const KUrl url = m_fileInfo.url();
88
const KUrl url = m_fileItem.url();
89
89
if (url.isLocalFile()) {
90
90
QAction* moveToTrashAction = new QAction(KIcon("user-trash"),
91
91
i18nc("@action:inmenu", "Move to Trash"), this);
107
107
popup->addSeparator();
109
// insert 'Properties' entry
110
QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this);
111
propertiesAction->setIcon(KIcon("document-properties"));
112
connect(propertiesAction, SIGNAL(triggered()), this, SLOT(showProperties()));
113
popup->addAction(propertiesAction);
115
popup->addSeparator();
110
// insert 'Show Hidden Files'
118
111
QAction* showHiddenFilesAction = new QAction(i18nc("@action:inmenu", "Show Hidden Files"), this);
119
112
showHiddenFilesAction->setCheckable(true);
120
113
showHiddenFilesAction->setChecked(m_parent->showHiddenFiles());
121
114
popup->addAction(showHiddenFilesAction);
122
115
connect(showHiddenFilesAction, SIGNAL(toggled(bool)), this, SLOT(setShowHiddenFiles(bool)));
117
// insert 'Automatic Scrolling'
124
118
QAction* autoScrollingAction = new QAction(i18nc("@action:inmenu", "Automatic Scrolling"), this);
125
119
autoScrollingAction->setCheckable(true);
126
120
autoScrollingAction->setChecked(m_parent->autoScrolling());
127
popup->addAction(autoScrollingAction);
121
// TODO: Temporary disabled. Horizontal autoscrolling will be implemented later either
122
// in KItemViews or manually as part of the FoldersPanel
123
//popup->addAction(autoScrollingAction);
128
124
connect(autoScrollingAction, SIGNAL(toggled(bool)), this, SLOT(setAutoScrolling(bool)));
130
popup->addSeparator();
131
foreach (QAction* action, m_parent->customContextMenuActions()) {
132
popup->addAction(action);
126
if (!m_fileItem.isNull()) {
127
// insert 'Properties' entry
128
QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this);
129
propertiesAction->setIcon(KIcon("document-properties"));
130
connect(propertiesAction, SIGNAL(triggered()), this, SLOT(showProperties()));
131
popup->addAction(propertiesAction);
134
QList<QAction*> customActions = m_parent->customContextMenuActions();
135
if (!customActions.isEmpty()) {
136
popup->addSeparator();
137
foreach (QAction* action, customActions) {
138
popup->addAction(action);
142
QWeakPointer<KMenu> popupPtr = popup;
135
143
popup->exec(QCursor::pos());
136
popup->deleteLater();
144
if (popupPtr.data()) {
145
popupPtr.data()->deleteLater();
139
149
void TreeViewContextMenu::populateMimeData(QMimeData* mimeData, bool cut)
141
151
KUrl::List kdeUrls;
142
kdeUrls.append(m_fileInfo.url());
152
kdeUrls.append(m_fileItem.url());
143
153
KUrl::List mostLocalUrls;
145
mostLocalUrls.append(m_fileInfo.mostLocalUrl(dummy));
155
mostLocalUrls.append(m_fileItem.mostLocalUrl(dummy));
146
156
KonqMimeData::populateMimeData(mimeData, kdeUrls, mostLocalUrls, cut);
178
188
void TreeViewContextMenu::rename()
180
m_parent->rename(m_fileInfo);
190
m_parent->rename(m_fileItem);
183
193
void TreeViewContextMenu::moveToTrash()
185
KonqOperations::del(m_parent, KonqOperations::TRASH, m_fileInfo.url());
195
KonqOperations::del(m_parent, KonqOperations::TRASH, m_fileItem.url());
188
198
void TreeViewContextMenu::deleteItem()
190
KonqOperations::del(m_parent, KonqOperations::DEL, m_fileInfo.url());
200
KonqOperations::del(m_parent, KonqOperations::DEL, m_fileItem.url());
193
203
void TreeViewContextMenu::showProperties()
195
KPropertiesDialog* dialog = new KPropertiesDialog(m_fileInfo.url(), m_parent);
205
KPropertiesDialog* dialog = new KPropertiesDialog(m_fileItem.url(), m_parent);
196
206
dialog->setAttribute(Qt::WA_DeleteOnClose);