2 This file is part of Akonadi.
4 Copyright (c) 2008 Tobias Koenig <tokoe@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 #include "searchdialog.h"
28 #include <QGridLayout>
29 #include <QDialogButtonBox>
30 #include <KConfigGroup>
31 #include <QPushButton>
32 #include <QVBoxLayout>
34 SearchDialog::SearchDialog(QWidget
*parent
)
37 setWindowTitle(QStringLiteral("Create Search"));
38 QDialogButtonBox
*buttonBox
= new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel
);
39 QVBoxLayout
*mainLayout
= new QVBoxLayout
;
40 setLayout(mainLayout
);
41 QPushButton
*okButton
= buttonBox
->button(QDialogButtonBox::Ok
);
42 okButton
->setDefault(true);
43 okButton
->setShortcut(Qt::CTRL
| Qt::Key_Return
);
44 connect(buttonBox
, &QDialogButtonBox::accepted
, this, &SearchDialog::accept
);
45 connect(buttonBox
, &QDialogButtonBox::rejected
, this, &SearchDialog::reject
);
47 QGridLayout
*layout
= new QGridLayout
;
48 mainLayout
->addLayout(layout
);
49 mainLayout
->addWidget(buttonBox
);
50 mName
= new QLineEdit
;
51 mName
->setText(QStringLiteral("My Search"));
52 mEdit
= new KTextEdit
;
53 mEdit
->setAcceptRichText(false);
54 mEdit
->setWhatsThis(QStringLiteral("Enter a SparQL query here"));
56 layout
->addWidget(new QLabel(QStringLiteral("Search query name:")), 0, 0);
57 layout
->addWidget(mName
, 0, 1);
58 layout
->addWidget(mEdit
, 1, 0, 1, 2);
61 SearchDialog::~SearchDialog()
65 QString
SearchDialog::searchName() const
70 QString
SearchDialog::searchQuery() const
72 return mEdit
->toPlainText();