]>
cloud.milkyroute.net Git - dolphin.git/blob - src/search/searchoptiondialogbox.cpp
1 /*****************************************************************************
2 * Copyright (C) 2010 by Laurent Montel <montel@kde.org> *
4 * This library is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Library General Public *
6 * License version 2 as published by the Free Software Foundation. *
8 * This library is distributed in the hope that it will be useful, *
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
11 * Library General Public License for more details. *
13 * You should have received a copy of the GNU Library General Public License *
14 * along with this library; see the file COPYING.LIB. If not, write to *
15 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
16 * Boston, MA 02110-1301, USA. *
17 *****************************************************************************/
19 #include "searchoptiondialogbox.h"
21 #include <KConfigGroup>
25 #include <QHBoxLayout>
27 SearchOptionDialogBox::SearchOptionDialogBox(QWidget
* parent
) :
28 KDialog(parent
, Qt::Dialog
)
30 QWidget
* container
= new QWidget(this);
32 QLabel
* label
= new QLabel(i18nc("@label", "Name:"), container
);
33 mLineEdit
= new KLineEdit(container
);
34 mLineEdit
->setMinimumWidth(250);
35 mLineEdit
->setClearButtonShown(true);
37 connect(mLineEdit
, SIGNAL(textChanged(const QString
&)), SLOT(slotTextChanged(const QString
&)));
38 QHBoxLayout
* layout
= new QHBoxLayout(container
);
39 layout
->addWidget(label
, Qt::AlignRight
);
40 layout
->addWidget(mLineEdit
);
42 setMainWidget(container
);
43 setCaption(i18nc("@title:window", "Save Search Options"));
44 setButtons(KDialog::Ok
| KDialog::Cancel
);
45 setDefaultButton(KDialog::Ok
);
46 setButtonText(KDialog::Ok
, i18nc("@action:button", "Save"));
48 KConfigGroup
dialogConfig(KSharedConfig::openConfig("dolphinrc"),
49 "SaveSearchOptionsDialog");
50 restoreDialogSize(dialogConfig
);
51 enableButtonOk(false);
54 SearchOptionDialogBox::~SearchOptionDialogBox()
56 KConfigGroup
dialogConfig(KSharedConfig::openConfig("dolphinrc"),
57 "SaveSearchOptionsDialog");
58 saveDialogSize(dialogConfig
);
61 QString
SearchOptionDialogBox::text() const
63 return mLineEdit
->text();
66 void SearchOptionDialogBox::slotTextChanged(const QString
& text
)
68 enableButtonOk(!text
.isEmpty());
71 #include "searchoptiondialogbox.moc"