[klipper] Better track editing from the ClipboardJob

The ClipboardJob does no longer set the result directly when editing
is invoked, but instead connects to a new signal emitted from Klipper.
As soon as editing finished the result gets emitted.

This is useful to block the UI for further editing while an entry
gets edited.
wilder-5.14
Martin Gräßlin 12 years ago
parent f2bfbdcd20
commit a7f11c423e
  1. 12
      klipper/clipboardjob.cpp
  2. 7
      klipper/klipper.cpp
  3. 1
      klipper/klipper.h

@ -57,8 +57,18 @@ void ClipboardJob::start()
m_klipper->history()->remove(item);
setResult(true);
} else if (operation == QLatin1String("edit")) {
connect(m_klipper, &Klipper::editFinished, this,
[this, item](HistoryItemConstPtr editedItem, int result) {
if (item != editedItem) {
// not our item
return;
}
setResult(result);
emitResult();
}
);
m_klipper->editData(item);
setResult(true);
return;
} else if (operation == QLatin1String("barcode")) {
#ifdef HAVE_PRISON
m_klipper->showBarcode(item);

@ -856,7 +856,12 @@ void Klipper::editData(const QSharedPointer< const HistoryItem > &item)
buttons->button(QDialogButtonBox::Ok)->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttons, &QDialogButtonBox::accepted, dlg.data(), &QDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, dlg.data(), &QDialog::reject);
connect(dlg, &QDialog::finished, dlg.data(), &QDialog::deleteLater);
connect(dlg.data(), &QDialog::finished, dlg.data(),
[this, dlg, item](int result) {
emit editFinished(item, result);
dlg->deleteLater();
}
);
KTextEdit *edit = new KTextEdit( dlg );
if (item) {

@ -128,6 +128,7 @@ protected:
Q_SIGNALS:
void passivePopup(const QString& caption, const QString& text);
void editFinished(QSharedPointer< const HistoryItem > item, int result);
public Q_SLOTS:
void slotPopupMenu();

Loading…
Cancel
Save