Akonadi

renamefavoritedialog.cpp
1/*
2 SPDX-FileCopyrightText: 2011-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "renamefavoritedialog_p.h"
8
9#include <KLocalizedString>
10
11#include <QPushButton>
12
13using namespace Akonadi;
14
15RenameFavoriteDialog::RenameFavoriteDialog(const QString &value, const QString &defaultName, QWidget *parent)
16 : QDialog(parent)
17 , m_defaultName(defaultName)
18{
19 ui.setupUi(this);
20
21 connect(ui.lineEdit, &QLineEdit::textChanged, this, [this](const QString &text) {
22 ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.trimmed().isEmpty());
23 });
24 connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &RenameFavoriteDialog::accept);
25 connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &RenameFavoriteDialog::reject);
26 connect(ui.buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, [this]() {
27 ui.lineEdit->setText(m_defaultName);
28 });
29
30 ui.lineEdit->setText(value);
31}
32
33QString RenameFavoriteDialog::newName() const
34{
35 return ui.lineEdit->text();
36}
37
38#include "moc_renamefavoritedialog_p.cpp"
Helper integration between Akonadi and Qt.
void clicked(bool checked)
void textChanged(const QString &text)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
void setupUi(QWidget *widget)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.