diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 22f7940bd4..39df8feaed 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -72,11 +72,15 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QStringLi this, SLOT(slotErrorMessage(QString))); connect(m_view, SIGNAL(itemTriggered(KFileItem)), this, SLOT(slotItemTriggered(KFileItem))); - // TODO connect to urlsDropped - // TOOD connect to requestContextMenu - connect(m_view, SIGNAL(selectionChanged(QList)), m_extension, SIGNAL(selectionInfo(QList))); + connect(m_view, SIGNAL(requestContextMenu(KFileItem, const KUrl&)), + this, SLOT(slotOpenContextMenu(KFileItem, const KUrl&))); + connect(m_view, SIGNAL(selectionChanged(QList)), + m_extension, SIGNAL(selectionInfo(QList))); - connect(m_view, SIGNAL(requestItemInfo(KFileItem)), this, SLOT(slotRequestItemInfo(KFileItem))); + connect(m_view, SIGNAL(requestItemInfo(KFileItem)), + this, SLOT(slotRequestItemInfo(KFileItem))); + + // TODO connect to urlsDropped // TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror // (sort of spacial navigation) @@ -101,8 +105,8 @@ KAboutData* DolphinPart::createAboutData() bool DolphinPart::openUrl(const KUrl& url) { const QString prettyUrl = url.pathOrUrl(); - setWindowCaption(prettyUrl); - m_extension->setLocationBarUrl(prettyUrl); + emit setWindowCaption(prettyUrl); + emit m_extension->setLocationBarUrl(prettyUrl); m_view->setUrl(url); if (arguments().reload()) m_view->reload(); @@ -141,4 +145,19 @@ void DolphinPart::slotItemTriggered(const KFileItem& item) emit m_extension->openUrlRequest(item.url()); } +void DolphinPart::slotOpenContextMenu(const KFileItem& item, const KUrl&) +{ + // TODO KonqKfmIconView had if ( !rootItem->isWritable() ) + // popupFlags |= KParts::BrowserExtension::NoDeletion; + + // and when clicking on the viewport: + // KParts::BrowserExtension::PopupFlags popupFlags = KParts::BrowserExtension::ShowNavigationItems | KParts::BrowserExtension::ShowUp; + + + KFileItem* itemCopy = new KFileItem(item); // ugly + KFileItemList items; items.append(itemCopy); + emit m_extension->popupMenu( 0, QCursor::pos(), items ); + delete itemCopy; +} + #include "dolphinpart.moc" diff --git a/src/dolphinpart.h b/src/dolphinpart.h index a9806d595c..3ca066a572 100644 --- a/src/dolphinpart.h +++ b/src/dolphinpart.h @@ -51,8 +51,22 @@ private Q_SLOTS: void slotCanceled(const KUrl& url); void slotInfoMessage(const QString& msg); void slotErrorMessage(const QString& msg); + /** + * Shows the information for the item \a item inside the statusbar. If the + * item is null, the default statusbar information is shown. + */ void slotRequestItemInfo(const KFileItem& item); + /** + * Handles clicking on an item + */ void slotItemTriggered(const KFileItem& item); + /** + * Opens the context menu on the current mouse position. + * @item File item context. If item is 0, the context menu + * should be applied to \a url. + * @url URL which contains \a item. + */ + void slotOpenContextMenu(const KFileItem& item, const KUrl& url); private: DolphinView* m_view; diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index 2e49933161..3c9223f19c 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -177,7 +177,7 @@ private slots: void changeNameFilter(const QString& nameFilter); /** - * Opens the context menu on the current mouse postition. + * Opens the context menu on the current mouse position. * @item File item context. If item is 0, the context menu * should be applied to \a url. * @url URL which contains \a item.