Changeset View
Changeset View
Standalone View
Standalone View
krusader/Search/krsearchdialog.cpp
Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Line(s) | 144 | { | |||
---|---|---|---|---|---|
155 | 155 | | |||
156 | QHBoxLayout* buttonsLayout = new QHBoxLayout(); | 156 | QHBoxLayout* buttonsLayout = new QHBoxLayout(); | ||
157 | buttonsLayout->setSpacing(6); | 157 | buttonsLayout->setSpacing(6); | ||
158 | buttonsLayout->setContentsMargins(0, 0, 0, 0); | 158 | buttonsLayout->setContentsMargins(0, 0, 0, 0); | ||
159 | 159 | | |||
160 | profileManager = new ProfileManager("SearcherProfile", this); | 160 | profileManager = new ProfileManager("SearcherProfile", this); | ||
161 | buttonsLayout->addWidget(profileManager); | 161 | buttonsLayout->addWidget(profileManager); | ||
162 | 162 | | |||
163 | searchTextToClipboard = new QCheckBox(this); | ||||
164 | searchTextToClipboard->setText(i18n("Query to clipboard")); | ||||
165 | searchTextToClipboard->setToolTip(i18n("Place search text to clipboard when a found file is opened.")); | ||||
166 | searchTextToClipboard->setCheckState(static_cast<Qt::CheckState>(group.readEntry("QueryToClipboard", 0))); | ||||
167 | connect(searchTextToClipboard, &QCheckBox::stateChanged, this, [=](int state) { | ||||
168 | KConfigGroup group(krConfig, "Search"); | ||||
169 | group.writeEntry("QueryToClipboard", state); | ||||
170 | }); | ||||
171 | buttonsLayout->addWidget(searchTextToClipboard); | ||||
172 | | ||||
163 | QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); | 173 | QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); | ||
164 | buttonsLayout->addItem(spacer); | 174 | buttonsLayout->addItem(spacer); | ||
165 | 175 | | |||
166 | mainFeedToListBoxBtn = new QPushButton(this); | 176 | mainFeedToListBoxBtn = new QPushButton(this); | ||
167 | mainFeedToListBoxBtn->setText(i18n("Feed to listbox")); | 177 | mainFeedToListBoxBtn->setText(i18n("Feed to listbox")); | ||
168 | mainFeedToListBoxBtn->setIcon(QIcon::fromTheme("list-add")); | 178 | mainFeedToListBoxBtn->setIcon(QIcon::fromTheme("list-add")); | ||
169 | mainFeedToListBoxBtn->setEnabled(false); | 179 | mainFeedToListBoxBtn->setEnabled(false); | ||
170 | buttonsLayout->addWidget(mainFeedToListBoxBtn); | 180 | buttonsLayout->addWidget(mainFeedToListBoxBtn); | ||
▲ Show 20 Lines • Show All 347 Lines • ▼ Show 20 Line(s) | 525 | { | |||
518 | if (isBusy && e->key() == Qt::Key_Escape) { /* at searching we must not close the window */ | 528 | if (isBusy && e->key() == Qt::Key_Escape) { /* at searching we must not close the window */ | ||
519 | stopSearch(); /* so we simply stop searching */ | 529 | stopSearch(); /* so we simply stop searching */ | ||
520 | return; | 530 | return; | ||
521 | } | 531 | } | ||
522 | if (resultView->widget()->hasFocus()) { | 532 | if (resultView->widget()->hasFocus()) { | ||
523 | if ((e->key() | e->modifiers()) == (Qt::CTRL | Qt::Key_I)) { | 533 | if ((e->key() | e->modifiers()) == (Qt::CTRL | Qt::Key_I)) { | ||
524 | searchBar->showBar(KrSearchBar::MODE_FILTER); | 534 | searchBar->showBar(KrSearchBar::MODE_FILTER); | ||
525 | } else if (e->key() == Qt::Key_F4) { | 535 | } else if (e->key() == Qt::Key_F4) { | ||
526 | if (!generalFilter->containsText->currentText().isEmpty() && QApplication::clipboard()->text() != generalFilter->containsText->currentText()) | 536 | tryPlaceSearchQueryToClipboard(); | ||
527 | QApplication::clipboard()->setText(generalFilter->containsText->currentText()); | | |||
528 | editCurrent(); | 537 | editCurrent(); | ||
529 | return; | 538 | return; | ||
530 | } else if (e->key() == Qt::Key_F3) { | 539 | } else if (e->key() == Qt::Key_F3) { | ||
531 | if (!generalFilter->containsText->currentText().isEmpty() && QApplication::clipboard()->text() != generalFilter->containsText->currentText()) | 540 | tryPlaceSearchQueryToClipboard(); | ||
532 | QApplication::clipboard()->setText(generalFilter->containsText->currentText()); | | |||
533 | viewCurrent(); | 541 | viewCurrent(); | ||
534 | return; | 542 | return; | ||
535 | } else if (e->key() == Qt::Key_F10) { | 543 | } else if (e->key() == Qt::Key_F10) { | ||
536 | compareByContent(); | 544 | compareByContent(); | ||
537 | return; | 545 | return; | ||
538 | } else if (KrGlobal::copyShortcut == QKeySequence(e->key() | e->modifiers())) { | 546 | } else if (KrGlobal::copyShortcut == QKeySequence(e->key() | e->modifiers())) { | ||
539 | copyToClipBoard(); | 547 | copyToClipBoard(); | ||
540 | return; | 548 | return; | ||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | 657 | { | |||
656 | 664 | | |||
657 | QMimeData *mimeData = new QMimeData; | 665 | QMimeData *mimeData = new QMimeData; | ||
658 | mimeData->setImageData(FL_LOADICON("file")); | 666 | mimeData->setImageData(FL_LOADICON("file")); | ||
659 | mimeData->setUrls(urls); | 667 | mimeData->setUrls(urls); | ||
660 | 668 | | |||
661 | QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard); | 669 | QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard); | ||
662 | } | 670 | } | ||
663 | 671 | | |||
672 | void KrSearchDialog::tryPlaceSearchQueryToClipboard() | ||||
673 | { | ||||
674 | if (searchTextToClipboard->isChecked() | ||||
675 | && !generalFilter->containsText->currentText().isEmpty() | ||||
676 | && QApplication::clipboard()->text() != generalFilter->containsText->currentText()) { | ||||
677 | QApplication::clipboard()->setText(generalFilter->containsText->currentText()); | ||||
678 | } | ||||
679 | } |