Commit 3425d290 authored by Laurent Montel's avatar Laurent Montel 😁

Minor optimization

parent 86f23452
...@@ -238,8 +238,7 @@ CompletionOrderWidget::CompletionOrderWidget(QWidget *parent) ...@@ -238,8 +238,7 @@ CompletionOrderWidget::CompletionOrderWidget(QWidget *parent)
new CompletionOrderEditorAdaptor(this); new CompletionOrderEditorAdaptor(this);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/"), this, QDBusConnection::ExportAdaptors); QDBusConnection::sessionBus().registerObject(QStringLiteral("/"), this, QDBusConnection::ExportAdaptors);
QHBoxLayout *hbox = new QHBoxLayout; QHBoxLayout *hbox = new QHBoxLayout(this);
setLayout(hbox);
QWidget *page = new QWidget(this); QWidget *page = new QWidget(this);
QHBoxLayout *pageHBoxLayout = new QHBoxLayout(page); QHBoxLayout *pageHBoxLayout = new QHBoxLayout(page);
......
...@@ -83,7 +83,7 @@ RecentAddressWidget::~RecentAddressWidget() ...@@ -83,7 +83,7 @@ RecentAddressWidget::~RecentAddressWidget()
void RecentAddressWidget::slotTypedSomething(const QString &text) void RecentAddressWidget::slotTypedSomething(const QString &text)
{ {
if (mListView->currentItem()) { if (mListView->currentItem()) {
if (mListView->currentItem()->text() != mLineEdit->text() && !mLineEdit->text().isEmpty()) { if (!mLineEdit->text().isEmpty() && mListView->currentItem()->text() != mLineEdit->text()) {
// IMHO changeItem() shouldn't do anything with the value // IMHO changeItem() shouldn't do anything with the value
// of currentItem() ... like changing it or emitting signals ... // of currentItem() ... like changing it or emitting signals ...
// but TT disagree with me on this one (it's been that way since ages ... grrr) // but TT disagree with me on this one (it's been that way since ages ... grrr)
...@@ -136,8 +136,9 @@ void RecentAddressWidget::updateButtonState() ...@@ -136,8 +136,9 @@ void RecentAddressWidget::updateButtonState()
QList<QListWidgetItem *> selectedItems = mListView->selectedItems(); QList<QListWidgetItem *> selectedItems = mListView->selectedItems();
const int numberOfElementSelected(selectedItems.count()); const int numberOfElementSelected(selectedItems.count());
mRemoveButton->setEnabled(numberOfElementSelected); mRemoveButton->setEnabled(numberOfElementSelected);
mNewButton->setEnabled(numberOfElementSelected <= 1); bool enableElement = (numberOfElementSelected <= 1);
mLineEdit->setEnabled(numberOfElementSelected <= 1); mNewButton->setEnabled(enableElement);
mLineEdit->setEnabled(enableElement);
if (numberOfElementSelected == 1) { if (numberOfElementSelected == 1) {
const QString text = mListView->currentItem()->text(); const QString text = mListView->currentItem()->text();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment