aboutsummaryrefslogtreecommitdiff
path: root/lib/bookmarks/forms
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bookmarks/forms')
-rw-r--r--lib/bookmarks/forms/editbookmarkdialog.cpp70
-rw-r--r--lib/bookmarks/forms/editbookmarkdialog.h44
-rw-r--r--lib/bookmarks/forms/editbookmarkdialog.ui108
3 files changed, 0 insertions, 222 deletions
diff --git a/lib/bookmarks/forms/editbookmarkdialog.cpp b/lib/bookmarks/forms/editbookmarkdialog.cpp
deleted file mode 100644
index 7df90b8..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 "bookmarkitem.h"
-#include "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);
- }
-}
diff --git a/lib/bookmarks/forms/editbookmarkdialog.h b/lib/bookmarks/forms/editbookmarkdialog.h
deleted file mode 100644
index fb53239..0000000
--- a/lib/bookmarks/forms/editbookmarkdialog.h
+++ /dev/null
@@ -1,44 +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
- */
-
-#ifndef SMOLBOTE_EDITBOOKMARKDIALOG_H
-#define SMOLBOTE_EDITBOOKMARKDIALOG_H
-
-#include <QDialog>
-#include <QModelIndex>
-
-namespace Ui
-{
-class EditBookmarkDialog;
-}
-
-class BookmarkModel;
-class EditBookmarkDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit EditBookmarkDialog(BookmarkModel *model, const QModelIndex &index, QWidget *parent = nullptr);
- ~EditBookmarkDialog() override;
-
-public slots:
- void saveChanges();
-
-private:
- Ui::EditBookmarkDialog *ui;
-
- BookmarkModel *m_model;
- QModelIndex m_index;
-
- bool titleChanged = false;
- bool hrefChanged = false;
- bool tagsChanged = false;
- bool descriptionChanged = false;
-};
-
-#endif // SMOLBOTE_EDITBOOKMARKDIALOG_H
diff --git a/lib/bookmarks/forms/editbookmarkdialog.ui b/lib/bookmarks/forms/editbookmarkdialog.ui
deleted file mode 100644
index b988394..0000000
--- a/lib/bookmarks/forms/editbookmarkdialog.ui
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>EditBookmarkDialog</class>
- <widget class="QDialog" name="EditBookmarkDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>320</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Edit Bookmark</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="title_label">
- <property name="text">
- <string>Title</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="title"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="address_label">
- <property name="text">
- <string>Address</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="address"/>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="tags_label">
- <property name="text">
- <string>Tags</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="tags"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="description_label">
- <property name="text">
- <string>Description</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QPlainTextEdit" name="description"/>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>EditBookmarkDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>EditBookmarkDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>