/**
* Get friendly name.
- * @return @see title or path name if title is not available yet.
+ * @return @see title or path name if title is not available yet.
*/
QString name() const;
connect(read, SIGNAL(clicked()), this, SLOT(onRead()));
connect(remove, SIGNAL(clicked()), this, SLOT(onRemove()));
addButton(read, QDialogButtonBox::ActionRole);
- addButton(remove, QDialogButtonBox::ActionRole);
+ addButton(remove, QDialogButtonBox::DestructiveRole);
}
void BookmarkInfoDialog::onRead()
void BookmarkInfoDialog::onRemove()
{
- done(Delete);
+ if (QMessageBox::Yes ==
+ QMessageBox::question(this, tr("Delete bookmark"),
+ tr("Delete bookmark?"),
+ QMessageBox::Yes | QMessageBox::No)) {
+ done(Delete);
+ }
}
#ifndef Q_WS_MAEMO_5
QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Vertical);
- QPushButton *goButton = new QPushButton(tr("Go"), this);
+ QPushButton *goButton = new QPushButton(tr("Go to"), this);
buttonBox->addButton(goButton, QDialogButtonBox::ActionRole);
connect(goButton, SIGNAL(clicked()), this, SLOT(onGo()));
- QPushButton *closeButton = new QPushButton(tr("Close"), this);
- buttonBox->addButton(closeButton, QDialogButtonBox::AcceptRole);
+ QPushButton *closeButton = buttonBox->addButton(QDialogButtonBox::Close);
connect(closeButton, SIGNAL(clicked()), this, SLOT(onClose()));
QPushButton *addButton = new QPushButton(tr("Add"), this);
onGo();
break;
case BookmarkInfoDialog::Delete:
- onDelete();
+ onDelete(true);
break;
default:
;
close();
}
-void BookmarksDialog::onDelete()
+void BookmarksDialog::onDelete(bool really)
{
- if (!list->selectedItems().isEmpty()) {
- QListWidgetItem *item = list->selectedItems()[0];
- int row = list->row(item);
- book->deleteBookmark(row);
- delete item;
+ if (list->selectedItems().isEmpty()) {
+ return;
+ }
+ if (!really) {
+ if (QMessageBox::Yes !=
+ QMessageBox::question(this, tr("Delete bookmark"),
+ tr("Delete bookmark?"),
+ QMessageBox::Yes | QMessageBox::No)) {
+ return;
+ }
}
+ QListWidgetItem *item = list->selectedItems()[0];
+ int row = list->row(item);
+ book->deleteBookmark(row);
+ delete item;
}
void BookmarksDialog::closeEvent(QCloseEvent *event)
void onAdd();
void onItemActivated(QListWidgetItem *);
void onClose();
- void onDelete();
+ void onDelete(bool really = false);
protected:
void closeEvent(QCloseEvent *e);
{
buttonBox->addButton(button, role);
}
+
+QPushButton *Dialog::addButton(QDialogButtonBox::StandardButton button)
+{
+ return buttonBox->addButton(button);
+}
void addButton(QPushButton *button,
QDialogButtonBox::ButtonRole role = QDialogButtonBox::AcceptRole);
+ /** Add standard button to the dialog button box. */
+ QPushButton *addButton(QDialogButtonBox::StandardButton button);
+
protected:
QScrollArea *scroller;
QWidget *content;
connect(read, SIGNAL(clicked()), this, SLOT(onReadBook()));
connect(remove, SIGNAL(clicked()), this, SLOT(onRemoveBook()));
addButton(read, QDialogButtonBox::ActionRole);
- addButton(remove, QDialogButtonBox::ActionRole);
+ addButton(remove, QDialogButtonBox::DestructiveRole);
}
void InfoDialog::onReadBook()