3
Copyright 2014 Adam Reichold
5
This file is part of qpdfview.
7
qpdfview is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 2 of the License, or
10
(at your option) any later version.
12
qpdfview is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with qpdfview. If not, see <http://www.gnu.org/licenses/>.
22
#include "bookmarkdialog.h"
25
#include <QDialogButtonBox>
26
#include <QFormLayout>
31
#include "bookmarkmodel.h"
36
BookmarkDialog::BookmarkDialog(BookmarkItem& bookmark, QWidget* parent) : QDialog(parent),
39
setWindowTitle(tr("Bookmark"));
41
QFormLayout* formLayout = new QFormLayout(this);
42
setLayout(formLayout);
44
m_pageEdit = new QLineEdit(this);
45
m_pageEdit->setReadOnly(true);
46
m_pageEdit->setText(QString::number(m_bookmark.page));
48
formLayout->addRow(tr("Page:"), m_pageEdit);
50
m_labelEdit = new QLineEdit(this);
51
m_labelEdit->setText(m_bookmark.label);
53
formLayout->addRow(tr("Label:"), m_labelEdit);
55
m_commentEdit = new QTextEdit(this);
56
m_commentEdit->setPlainText(m_bookmark.comment);
58
formLayout->addRow(tr("Comment:"), m_commentEdit);
60
m_modifiedEdit = new QLineEdit(this);
61
m_modifiedEdit->setReadOnly(true);
62
m_modifiedEdit->setText(m_bookmark.modified.toString(Qt::SystemLocaleLongDate));
64
formLayout->addRow(tr("Modified:"), m_modifiedEdit);
66
m_dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
67
connect(m_dialogButtonBox, SIGNAL(accepted()), SLOT(accept()));
68
connect(m_dialogButtonBox, SIGNAL(rejected()), SLOT(reject()));
70
formLayout->addWidget(m_dialogButtonBox);
73
void BookmarkDialog::accept()
77
m_bookmark.label = m_labelEdit->text();
78
m_bookmark.comment = m_commentEdit->toPlainText();
80
m_bookmark.modified = QDateTime::currentDateTime();
83
void BookmarkDialog::showEvent(QShowEvent*)
85
m_labelEdit->setFocus();