1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge remote-tracking branch 'Impyy/fix-friend-rm-dialog'

This commit is contained in:
agilob 2015-09-23 19:20:27 +01:00
commit dcfc0d7bc7
No known key found for this signature in database
GPG Key ID: 296F0B764741106C
3 changed files with 8 additions and 23 deletions

View File

@ -7,9 +7,15 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>300</width> <width>300</width>
<height>180</height> <height>110</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>300</width>
<height>110</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Remove friend</string> <string>Remove friend</string>
</property> </property>
@ -27,19 +33,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLineEdit" name="yes">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="placeholderText">
<string>YES</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="removeHistory"> <widget class="QCheckBox" name="removeHistory">
<property name="text"> <property name="text">

View File

@ -10,9 +10,8 @@ RemoveFriendDialog::RemoveFriendDialog(QWidget *parent, const Friend *f)
ui.setupUi(this); ui.setupUi(this);
ui.label->setText(ui.label->text().replace("&lt;name&gt;", f->getDisplayedName())); ui.label->setText(ui.label->text().replace("&lt;name&gt;", f->getDisplayedName()));
auto removeButton = ui.buttonBox->button(QDialogButtonBox::Ok); auto removeButton = ui.buttonBox->button(QDialogButtonBox::Ok);
removeButton->setEnabled(false);
removeButton->setText(tr("Remove")); removeButton->setText(tr("Remove"));
connect(ui.yes, &QLineEdit::textChanged, this, &RemoveFriendDialog::onTextChanged); adjustSize();
connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &RemoveFriendDialog::onAccepted); connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &RemoveFriendDialog::onAccepted);
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &RemoveFriendDialog::close); connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &RemoveFriendDialog::close);
setFocus(); setFocus();
@ -23,9 +22,3 @@ void RemoveFriendDialog::onAccepted()
_accepted = true; _accepted = true;
close(); close();
} }
void RemoveFriendDialog::onTextChanged(QString text)
{
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(text == ui.yes->placeholderText());
}

View File

@ -25,7 +25,6 @@ public:
public slots: public slots:
void onAccepted(); void onAccepted();
void onTextChanged(QString text);
protected: protected:
Ui_RemoveFriendDialog ui; Ui_RemoveFriendDialog ui;