Skip to content

Commit

Permalink
#2789 deck: allow using of selected text as title
Browse files Browse the repository at this point in the history
  • Loading branch information
pbek committed Jul 9, 2023
1 parent 2bffc9e commit dcb1bf0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# QOwnNotes Changelog

## 23.7.0
- when you now select text in a note that text will be used as title when you
open the **Nextcloud Deck** dialog (for [#2789](https://github.com/pbek/QOwnNotes/issues/2789))

## 23.6.6
- some menu text was adapted to be more readable
- added more German, Arabic, Korean, Dutch, Ukrainian translation (thank you sdicke,
Expand Down
4 changes: 4 additions & 0 deletions src/dialogs/nextclouddeckdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,7 @@ void NextcloudDeckDialog::on_titleLineEdit_textChanged(const QString &arg1) {
void NextcloudDeckDialog::on_dueDateTimeCheckBox_toggled(bool checked) {
ui->dueDateTimeEdit->setEnabled(checked);
}

void NextcloudDeckDialog::setTitle(const QString& title) {
ui->titleLineEdit->setText(title);
}
1 change: 1 addition & 0 deletions src/dialogs/nextclouddeckdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class NextcloudDeckDialog : public MasterDialog
public:
explicit NextcloudDeckDialog(QWidget *parent = nullptr);
~NextcloudDeckDialog();
void setTitle(const QString& title);

private slots:
void on_saveButton_clicked();
Expand Down
7 changes: 7 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11617,6 +11617,13 @@ void MainWindow::on_actionInsert_Nextcloud_Deck_card_triggered()
}

auto *dialog = new NextcloudDeckDialog(this);

QOwnNotesMarkdownTextEdit *textEdit = activeNoteTextEdit();
QString selectedText = textEdit->textCursor().selectedText();
if (!selectedText.isEmpty()) {
dialog->setTitle(selectedText);
}

dialog->exec();
}

Expand Down

0 comments on commit dcb1bf0

Please sign in to comment.