2 * Copyright (C) 2011 Toni Gundogdu <legatvs@gmail.com>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <QCoreApplication>
21 #include <QDialogButtonBox>
22 #include <QMessageBox>
23 #include <QVBoxLayout>
33 NLogDialog::NLogDialog(QWidget
*parent
/*=NULL*/)
34 : QDialog(parent
), _toolbox(NULL
)
39 _toolbox
= new QToolBox
;
41 NLogRecent
*recent
= new NLogRecent
;
42 connect(recent
, SIGNAL(selected(QString
)), this, SLOT(selected(QString
)));
44 _toolbox
->addItem(recent
, tr("&Recent"));
48 QDialogButtonBox
*bb
= new QDialogButtonBox(
49 QDialogButtonBox::Ok
| QDialogButtonBox::Cancel
);
51 connect(bb
, SIGNAL(accepted()), this, SLOT(accept()));
52 connect(bb
, SIGNAL(rejected()), this, SLOT(reject()));
56 QVBoxLayout
*box
= new QVBoxLayout
;
57 box
->addWidget(_toolbox
);
63 setMinimumSize(QSize(500,400));
64 setWindowTitle(tr("Log"));
65 setSizeGripEnabled(true);
70 void NLogDialog::foreachWidget()
72 const int c
= _toolbox
->count();
73 for (int i
=0; i
<c
; ++i
)
75 NLogWidget
*l
= dynamic_cast<NLogWidget
*>(_toolbox
->widget(i
));
83 void NLogDialog::done(int n
)
85 if (n
== QDialog::Accepted
)
87 if (_selected
.isEmpty())
89 _toolbox
->setCurrentIndex(0);
90 info(this, tr("Please select an item from the list"));
98 void NLogDialog::selected(QString s
)
103 QString
NLogDialog::selected() const
110 NLogWidget::NLogWidget(QWidget
*parent
/*=NULL*/)
117 /* vim: set ts=2 sw=2 tw=72 expandtab: */