mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-19 00:11:21 +00:00
provide middle-mouse-button support for Konqueror (= create new window or tab)
CCMAIL: faure@kde.org svn path=/trunk/KDE/kdebase/apps/; revision=800298
This commit is contained in:
parent
a593ad0b99
commit
2a4f4c4b9c
|
@ -85,6 +85,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
|
||||||
this, SLOT(slotErrorMessage(QString)));
|
this, SLOT(slotErrorMessage(QString)));
|
||||||
connect(m_view, SIGNAL(itemTriggered(KFileItem)),
|
connect(m_view, SIGNAL(itemTriggered(KFileItem)),
|
||||||
this, SLOT(slotItemTriggered(KFileItem)));
|
this, SLOT(slotItemTriggered(KFileItem)));
|
||||||
|
connect(m_view, SIGNAL(tabRequested(KUrl)),
|
||||||
|
this, SLOT(createNewWindow(KUrl)));
|
||||||
connect(m_view, SIGNAL(requestContextMenu(KFileItem,KUrl)),
|
connect(m_view, SIGNAL(requestContextMenu(KFileItem,KUrl)),
|
||||||
this, SLOT(slotOpenContextMenu(KFileItem,KUrl)));
|
this, SLOT(slotOpenContextMenu(KFileItem,KUrl)));
|
||||||
connect(m_view, SIGNAL(selectionChanged(KFileItemList)),
|
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...
|
// since the idea was not to need BrowserArguments for non-browser stuff...
|
||||||
KParts::BrowserArguments browserArgs;
|
KParts::BrowserArguments browserArgs;
|
||||||
browserArgs.trustedSource = true;
|
browserArgs.trustedSource = true;
|
||||||
|
emit m_extension->openUrlRequest(item.targetUrl(), args, browserArgs);
|
||||||
|
}
|
||||||
|
|
||||||
// MMB click support.
|
void DolphinPart::createNewWindow(const KUrl& url)
|
||||||
// TODO: this doesn't work, mouseButtons() is always 0.
|
{
|
||||||
// Issue N176832 for the missing QAIV signal; task 177399
|
// TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code
|
||||||
kDebug() << QApplication::mouseButtons();
|
// should be moved into DolphinPart::slotItemTriggered()
|
||||||
if (QApplication::mouseButtons() & Qt::MidButton) {
|
KFileItem item(S_IFDIR, (mode_t)-1, url);
|
||||||
kDebug() << "MMB!!" << item.mimetype();
|
Q_ASSERT(item.mimeTypePtr()->is("inode/directory")); // the signal 'tabRequested' is only emitted for dirs
|
||||||
if (item.mimeTypePtr()->is("inode/directory")) {
|
KParts::OpenUrlArguments args;
|
||||||
emit m_extension->createNewWindow(item.url(), args);
|
args.setMimeType(item.mimetype());
|
||||||
} else {
|
emit m_extension->createNewWindow(url, args);
|
||||||
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::slotOpenContextMenu(const KFileItem& _item, const KUrl&)
|
void DolphinPart::slotOpenContextMenu(const KFileItem& _item, const KUrl&)
|
||||||
|
|
|
@ -92,7 +92,7 @@ Q_SIGNALS:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted whenever the current URL is about to be changed.
|
* Emitted whenever the current URL is about to be changed.
|
||||||
*/
|
*/
|
||||||
void aboutToOpenURL();
|
void aboutToOpenURL();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
@ -109,6 +109,10 @@ private Q_SLOTS:
|
||||||
* Handles clicking on an item
|
* Handles clicking on an item
|
||||||
*/
|
*/
|
||||||
void slotItemTriggered(const KFileItem& item);
|
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.
|
* Opens the context menu on the current mouse position.
|
||||||
* @item File item context. If item is 0, the context menu
|
* @item File item context. If item is 0, the context menu
|
||||||
|
|
Loading…
Reference in a new issue