mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 12:34:19 +00:00
- Implemented cut/copy/paste actions on right click in search field
- Added icons for menu actions
This commit is contained in:
parent
4dfd1f229b
commit
c877c9c412
BIN
src/Icons/oxygen/edit-clear.png
Normal file
BIN
src/Icons/oxygen/edit-clear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
BIN
src/Icons/oxygen/edit-copy.png
Normal file
BIN
src/Icons/oxygen/edit-copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 860 B |
BIN
src/Icons/oxygen/edit-cut.png
Normal file
BIN
src/Icons/oxygen/edit-cut.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 892 B |
BIN
src/Icons/oxygen/edit-paste.png
Normal file
BIN
src/Icons/oxygen/edit-paste.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 937 B |
@ -49,6 +49,10 @@
|
||||
<file>Icons/oxygen/configure.png</file>
|
||||
<file>Icons/oxygen/connection.png</file>
|
||||
<file>Icons/oxygen/download.png</file>
|
||||
<file>Icons/oxygen/edit-clear.png</file>
|
||||
<file>Icons/oxygen/edit-copy.png</file>
|
||||
<file>Icons/oxygen/edit-cut.png</file>
|
||||
<file>Icons/oxygen/edit-paste.png</file>
|
||||
<file>Icons/oxygen/edit_clear.png</file>
|
||||
<file>Icons/oxygen/encrypted.png</file>
|
||||
<file>Icons/oxygen/file.png</file>
|
||||
|
@ -40,6 +40,8 @@
|
||||
#include <QTimer>
|
||||
#include <QDir>
|
||||
#include <QMenu>
|
||||
#include <QClipboard>
|
||||
#include <QMimeData>
|
||||
|
||||
#include "searchEngine.h"
|
||||
#include "bittorrent.h"
|
||||
@ -101,14 +103,42 @@ SearchEngine::~SearchEngine(){
|
||||
|
||||
void SearchEngine::displayPatternContextMenu(QPoint) {
|
||||
QMenu myMenu(this);
|
||||
QAction PasteAct(tr("Paste"), &myMenu);
|
||||
QAction clearHistoryAct(tr("Clear completion history"), &myMenu);
|
||||
QAction cutAct(QIcon(":/Icons/oxygen/edit-cut.png"), tr("Cut"), &myMenu);
|
||||
QAction copyAct(QIcon(":/Icons/oxygen/edit-copy.png"), tr("Copy"), &myMenu);
|
||||
QAction pasteAct(QIcon(":/Icons/oxygen/edit-paste.png"), tr("Paste"), &myMenu);
|
||||
QAction clearAct(QIcon(":/Icons/oxygen/edit_clear.png"), tr("Clear field"), &myMenu);
|
||||
QAction clearHistoryAct(QIcon(":/Icons/oxygen/edit-clear.png"), tr("Clear completion history"), &myMenu);
|
||||
bool hasCopyAct = false;
|
||||
if(search_pattern->hasSelectedText()) {
|
||||
myMenu.addAction(&cutAct);
|
||||
myMenu.addAction(©Act);
|
||||
hasCopyAct = true;
|
||||
}
|
||||
if(qApp->clipboard()->mimeData()->hasText()) {
|
||||
myMenu.addAction(&pasteAct);
|
||||
hasCopyAct = true;
|
||||
}
|
||||
if(hasCopyAct)
|
||||
myMenu.addSeparator();
|
||||
myMenu.addAction(&clearHistoryAct);
|
||||
myMenu.addAction(&clearAct);
|
||||
QAction *act = myMenu.exec(QCursor::pos());
|
||||
if(act != 0) {
|
||||
if(act == &clearHistoryAct) {
|
||||
searchHistory.clear();
|
||||
createCompleter();
|
||||
} else if (act == &pasteAct) {
|
||||
} else if (act == &pasteAct) {
|
||||
search_pattern->paste();
|
||||
}
|
||||
else if (act == &cutAct) {
|
||||
search_pattern->cut();
|
||||
}
|
||||
else if (act == ©Act) {
|
||||
search_pattern->copy();
|
||||
}
|
||||
else if (act == &clearAct) {
|
||||
search_pattern->clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user