mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
Improve mouse middle click path paste behavior: first check selection clipboard, after 'real' clipboard. Before setting new URL, check if it is a path. This prevents a crash. Behavior is now similar to Konqueror KDE 3.
Reviewed by Peter Penz. svn path=/trunk/KDE/kdebase/apps/; revision=825771
This commit is contained in:
parent
c446e29bc3
commit
8677eafd24
|
@ -23,6 +23,7 @@
|
|||
#include <QAbstractProxyModel>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QDir>
|
||||
|
||||
DolphinController::DolphinController(DolphinView* dolphinView) :
|
||||
QObject(dolphinView),
|
||||
|
@ -136,10 +137,14 @@ void DolphinController::handleKeyPressEvent(QKeyEvent* event)
|
|||
|
||||
void DolphinController::replaceUrlByClipboard()
|
||||
{
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
const QMimeData* mimeData = clipboard->mimeData();
|
||||
if (mimeData->hasText()) {
|
||||
const QString text = mimeData->text();
|
||||
const QClipboard* clipboard = QApplication::clipboard();
|
||||
QString text;
|
||||
if (clipboard->mimeData(QClipboard::Selection)->hasText()) {
|
||||
text = clipboard->mimeData(QClipboard::Selection)->text();
|
||||
} else if (clipboard->mimeData(QClipboard::Clipboard)->hasText()) {
|
||||
text = clipboard->mimeData(QClipboard::Clipboard)->text();
|
||||
}
|
||||
if (!text.isEmpty() && QDir::isAbsolutePath(text)) {
|
||||
m_dolphinView->setUrl(KUrl(text));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue