┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-04-23 20:57:58 +0000
committerPeter Penz <[email protected]>2008-04-23 20:57:58 +0000
commit2a4f4c4b9ca1953f5859898b4e6bfc44cddd02be (patch)
treecb5ab26a7cc9ca6261289fc5060f634c141d5fe4 /src
parenta593ad0b990a639a158908a8be8a645e270f4429 (diff)
provide middle-mouse-button support for Konqueror (= create new window or tab)
CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=800298
Diffstat (limited to 'src')
-rw-r--r--src/dolphinpart.cpp30
-rw-r--r--src/dolphinpart.h6
2 files changed, 18 insertions, 18 deletions
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index deee4af94..41c6ff3a3 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -85,6 +85,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
this, SLOT(slotErrorMessage(QString)));
connect(m_view, SIGNAL(itemTriggered(KFileItem)),
this, SLOT(slotItemTriggered(KFileItem)));
+ connect(m_view, SIGNAL(tabRequested(KUrl)),
+ this, SLOT(createNewWindow(KUrl)));
connect(m_view, SIGNAL(requestContextMenu(KFileItem,KUrl)),
this, SLOT(slotOpenContextMenu(KFileItem,KUrl)));
connect(m_view, SIGNAL(selectionChanged(KFileItemList)),
@@ -263,24 +265,18 @@ void DolphinPart::slotItemTriggered(const KFileItem& item)
// since the idea was not to need BrowserArguments for non-browser stuff...
KParts::BrowserArguments browserArgs;
browserArgs.trustedSource = true;
+ emit m_extension->openUrlRequest(item.targetUrl(), args, browserArgs);
+}
- // MMB click support.
- // TODO: this doesn't work, mouseButtons() is always 0.
- // Issue N176832 for the missing QAIV signal; task 177399
- kDebug() << QApplication::mouseButtons();
- if (QApplication::mouseButtons() & Qt::MidButton) {
- kDebug() << "MMB!!" << item.mimetype();
- if (item.mimeTypePtr()->is("inode/directory")) {
- emit m_extension->createNewWindow(item.url(), args);
- } else {
- kDebug() << "run()";
- item.run();
- }
- } else {
- // Left button. [Right button goes to slotOpenContextMenu before triggered can be emitted]
- kDebug() << "LMB";
- emit m_extension->openUrlRequest(item.targetUrl(), args, browserArgs);
- }
+void DolphinPart::createNewWindow(const KUrl& url)
+{
+ // TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code
+ // should be moved into DolphinPart::slotItemTriggered()
+ KFileItem item(S_IFDIR, (mode_t)-1, url);
+ Q_ASSERT(item.mimeTypePtr()->is("inode/directory")); // the signal 'tabRequested' is only emitted for dirs
+ KParts::OpenUrlArguments args;
+ args.setMimeType(item.mimetype());
+ emit m_extension->createNewWindow(url, args);
}
void DolphinPart::slotOpenContextMenu(const KFileItem& _item, const KUrl&)
diff --git a/src/dolphinpart.h b/src/dolphinpart.h
index eaf9cb74e..3ef654039 100644
--- a/src/dolphinpart.h
+++ b/src/dolphinpart.h
@@ -92,7 +92,7 @@ Q_SIGNALS:
/**
* Emitted whenever the current URL is about to be changed.
- */
+ */
void aboutToOpenURL();
private Q_SLOTS:
@@ -110,6 +110,10 @@ private Q_SLOTS:
*/
void slotItemTriggered(const KFileItem& item);
/**
+ * Creates a new window showing the content of \a url.
+ */
+ void createNewWindow(const KUrl& url);
+ /**
* 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.