diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-01-17 13:39:59 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-01-17 13:39:59 +0200 |
commit | 4c73f86fc6cbdaaee90f9f8e40af36c1ab84c374 (patch) | |
tree | 63b42986ffccb3c0fdb3b978f3c78b56ca5a03a8 /lib/bookmarks/forms/editbookmarkdialog.cpp | |
parent | Create default profile when the one set doesn't exist (diff) | |
parent | Parse Tags and Descriptions in FFJson (diff) | |
download | smolbote-4c73f86fc6cbdaaee90f9f8e40af36c1ab84c374.tar.xz |
Merge branch 'firefox-bookmarks-json-importer'
Diffstat (limited to 'lib/bookmarks/forms/editbookmarkdialog.cpp')
-rw-r--r-- | lib/bookmarks/forms/editbookmarkdialog.cpp | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/lib/bookmarks/forms/editbookmarkdialog.cpp b/lib/bookmarks/forms/editbookmarkdialog.cpp deleted file mode 100644 index 9c6efa0..0000000 --- a/lib/bookmarks/forms/editbookmarkdialog.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is part of smolbote. It's copyrighted by the contributors recorded - * in the version control history of the file, available from its original - * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#include "editbookmarkdialog.h" -#include "model/bookmarkitem.h" -#include "model/bookmarkmodel.h" -#include "ui_editbookmarkdialog.h" - -EditBookmarkDialog::EditBookmarkDialog(BookmarkModel *model, const QModelIndex &index, QWidget *parent) - : QDialog(parent) - , ui(new Ui::EditBookmarkDialog) -{ - ui->setupUi(this); - setAttribute(Qt::WA_DeleteOnClose, true); - - Q_CHECK_PTR(model); - m_model = model; - m_index = index; - - ui->title->setText(model->data(index, BookmarkItem::Title, Qt::DisplayRole).toString()); - connect(ui->title, &QLineEdit::editingFinished, this, [this]() { - titleChanged = true; - }); - - ui->address->setText(model->data(index, BookmarkItem::Href, Qt::DisplayRole).toString()); - connect(ui->address, &QLineEdit::editingFinished, this, [this]() { - hrefChanged = true; - }); - - ui->tags->setText(model->data(index, BookmarkItem::Tags, Qt::DisplayRole).toStringList().join(", ")); - connect(ui->tags, &QLineEdit::editingFinished, this, [this]() { - tagsChanged = true; - }); - - ui->description->setPlainText(model->data(index, BookmarkItem::Description, Qt::DisplayRole).toString()); - connect(ui->description, &QPlainTextEdit::textChanged, this, [this]() { - descriptionChanged = true; - }); - - connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &EditBookmarkDialog::saveChanges); -} - -EditBookmarkDialog::~EditBookmarkDialog() -{ - delete ui; -} - -void EditBookmarkDialog::saveChanges() -{ - if(titleChanged) { - m_model->setData(m_index, ui->title->text(), BookmarkItem::Title, Qt::DisplayRole); - } - - if(hrefChanged) { - m_model->setData(m_index, ui->address->text(), BookmarkItem::Href, Qt::DisplayRole); - } - - if(tagsChanged) { - m_model->setData(m_index, ui->tags->text().split(", "), BookmarkItem::Tags, Qt::DisplayRole); - } - - if(descriptionChanged) { - m_model->setData(m_index, ui->description->toPlainText(), BookmarkItem::Description, Qt::DisplayRole); - } -} |