Improve UI of the deleting confirmation box (#1456)
This commit is contained in:
parent
6924eae5c3
commit
044f7b769a
5 changed files with 16 additions and 5 deletions
|
@ -41,3 +41,7 @@ SyncErrorsDialog QWidget#mainWidget {
|
|||
border : 0;
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
QMessageBox {
|
||||
messagebox-text-interaction-flags: NoTextInteraction;
|
||||
}
|
||||
|
|
|
@ -240,10 +240,10 @@ void MessagePoller::processNotification(const SyncNotification& notification)
|
|||
.arg(match.captured(1)).arg(match.captured(2));
|
||||
}
|
||||
|
||||
QString info = tr("Confirm to bulk delete files in library \"%1\" ?")
|
||||
QString info = tr("Do you want to delete files in library \"%1\" ?")
|
||||
.arg(doc["repo_name"].toString().trimmed());
|
||||
|
||||
if (seafApplet->bulkDeletingMessageBox(text, info)) {
|
||||
if (seafApplet->deletingConfirmationBox(text, info)) {
|
||||
rpc_client_->addDelConfirmation(doc["confirmation_id"].toString(), false);
|
||||
} else {
|
||||
rpc_client_->addDelConfirmation(doc["confirmation_id"].toString(), true);
|
||||
|
|
|
@ -519,6 +519,7 @@ void SeafileApplet::warningBox(const QString& msg, QWidget *parent)
|
|||
box.setWindowTitle(getBrand());
|
||||
box.setIcon(QMessageBox::Warning);
|
||||
box.addButton(tr("OK"), QMessageBox::YesRole);
|
||||
box.setFocusPolicy(Qt::ClickFocus);
|
||||
box.exec();
|
||||
|
||||
if (!parent && main_win_) {
|
||||
|
@ -537,6 +538,7 @@ void SeafileApplet::messageBox(const QString& msg, QWidget *parent)
|
|||
if (!parent) {
|
||||
main_win_->showWindow();
|
||||
}
|
||||
box.setFocusPolicy(Qt::ClickFocus);
|
||||
box.exec();
|
||||
qDebug("%s", msg.toUtf8().data());
|
||||
}
|
||||
|
@ -550,6 +552,7 @@ bool SeafileApplet::yesOrNoBox(const QString& msg, QWidget *parent, bool default
|
|||
QPushButton *yes_btn = box.addButton(tr("Yes"), QMessageBox::YesRole);
|
||||
QPushButton *no_btn = box.addButton(tr("No"), QMessageBox::NoRole);
|
||||
box.setDefaultButton(default_val ? yes_btn: no_btn);
|
||||
box.setFocusPolicy(Qt::ClickFocus);
|
||||
box.exec();
|
||||
|
||||
return box.clickedButton() == yes_btn;
|
||||
|
@ -564,6 +567,7 @@ bool SeafileApplet::yesOrCancelBox(const QString& msg, QWidget *parent, bool def
|
|||
QPushButton *yes_btn = box.addButton(tr("Yes"), QMessageBox::YesRole);
|
||||
QPushButton *cancel_btn = box.addButton(tr("Cancel"), QMessageBox::RejectRole);
|
||||
box.setDefaultButton(default_yes ? yes_btn: cancel_btn);
|
||||
box.setFocusPolicy(Qt::ClickFocus);
|
||||
box.exec();
|
||||
|
||||
return box.clickedButton() == yes_btn;
|
||||
|
@ -580,6 +584,7 @@ SeafileApplet::yesNoCancelBox(const QString& msg, QWidget *parent, QMessageBox::
|
|||
QPushButton *no_btn = box.addButton(tr("No"), QMessageBox::NoRole);
|
||||
box.addButton(tr("Cancel"), QMessageBox::RejectRole);
|
||||
box.setDefaultButton(default_btn);
|
||||
box.setFocusPolicy(Qt::ClickFocus);
|
||||
box.exec();
|
||||
|
||||
QAbstractButton *btn = box.clickedButton();
|
||||
|
@ -608,10 +613,11 @@ bool SeafileApplet::detailedYesOrNoBox(const QString& msg, const QString& detail
|
|||
QGridLayout* layout = (QGridLayout*)msgBox.layout();
|
||||
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
||||
msgBox.setDefaultButton(default_val ? QMessageBox::Yes : QMessageBox::No);
|
||||
msgBox.setFocusPolicy(Qt::ClickFocus);
|
||||
return msgBox.exec() == QMessageBox::Yes;
|
||||
}
|
||||
|
||||
bool SeafileApplet::bulkDeletingMessageBox(const QString& text, const QString& info)
|
||||
bool SeafileApplet::deletingConfirmationBox(const QString& text, const QString& info)
|
||||
{
|
||||
QMessageBox box(main_win_);
|
||||
|
||||
|
@ -627,6 +633,7 @@ bool SeafileApplet::bulkDeletingMessageBox(const QString& text, const QString& i
|
|||
auto settingsButton = box.addButton(tr("Settings"), QMessageBox::NoRole);
|
||||
box.setDefaultButton(noButton);
|
||||
|
||||
box.setFocusPolicy(Qt::ClickFocus);
|
||||
box.exec();
|
||||
|
||||
if (box.clickedButton() == yesButton) {
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
QMessageBox::StandardButton default_btn);
|
||||
bool yesOrCancelBox(const QString& msg, QWidget *parent, bool default_ok);
|
||||
|
||||
bool bulkDeletingMessageBox(const QString& text, const QString& info);
|
||||
bool deletingConfirmationBox(const QString& text, const QString& info);
|
||||
|
||||
QString getText(QWidget *parent,
|
||||
const QString &title,
|
||||
|
|
|
@ -195,7 +195,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Confirm before bulk deleting files more than</string>
|
||||
<string>Confirm before deleting files more than</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue