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 <QPushButton>
23 #include <QMessageBox>
24 #include <QVBoxLayout>
34 NLogDialog::NLogDialog(QWidget
*parent
/*=NULL*/)
35 : QDialog(parent
), _toolbox(NULL
)
40 _toolbox
= new QToolBox
;
42 NLogRecent
*recent
= new NLogRecent
;
43 connect(recent
, SIGNAL(selected(QString
)), this, SLOT(selected(QString
)));
45 _toolbox
->addItem(recent
, tr("&Recent"));
49 QDialogButtonBox
*bb
=
50 new QDialogButtonBox(QDialogButtonBox::Ok
51 | QDialogButtonBox::Cancel
52 | QDialogButtonBox::Reset
);
54 connect(bb
, SIGNAL(accepted()), this, SLOT(accept()));
55 connect(bb
, SIGNAL(rejected()), this, SLOT(reject()));
57 connect(bb
->button(QDialogButtonBox::Reset
), SIGNAL(clicked()),
62 QVBoxLayout
*box
= new QVBoxLayout
;
63 box
->addWidget(_toolbox
);
69 setMinimumSize(QSize(500,400));
70 setWindowTitle(tr("Log"));
71 setSizeGripEnabled(true);
76 void NLogDialog::foreachWidget()
78 const int c
= _toolbox
->count();
79 for (int i
=0; i
<c
; ++i
)
81 NLogWidget
*l
= dynamic_cast<NLogWidget
*>(_toolbox
->widget(i
));
86 void NLogDialog::done(int n
)
88 if (n
== QDialog::Accepted
)
90 if (_selected
.isEmpty())
92 _toolbox
->setCurrentIndex(0);
93 info(this, tr("Please select an item from the list"));
101 void NLogDialog::selected(QString s
)
106 QString
NLogDialog::selected() const
111 void NLogDialog::reset()
113 NLogWidget
*l
= dynamic_cast<NLogWidget
*>(_toolbox
->currentWidget());
119 NLogWidget::NLogWidget(QWidget
*parent
/*=NULL*/)
126 /* vim: set ts=2 sw=2 tw=72 expandtab: */