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 <QVBoxLayout>
23 #include <QTextStream>
24 #include <QTreeWidget>
25 #include <QMessageBox>
27 #include <NRecentMutator>
28 #include <NRecentEntry>
33 extern nn::NRecentMutator recent
;
38 NLogRecent::NLogRecent(QWidget
*parent
/*=NULL*/)
39 : NLogWidget(parent
), _treew(NULL
)
44 _treew
= new QTreeWidget
;
45 _treew
->setHeaderLabels(QStringList() << tr("Title") << tr("Added"));
46 _treew
->setColumnCount(2);
48 connect(_treew
, SIGNAL(itemSelectionChanged()), this, SLOT(selected()));
52 QVBoxLayout
*box
= new QVBoxLayout
;
53 box
->addWidget(_treew
);
58 void NLogRecent::read()
64 void NLogRecent::init()
66 recent
.populate(_treew
);
67 _treew
->resizeColumnToContents(0);
68 _treew
->sortByColumn(1);
69 _treew
->setSortingEnabled(true);
72 void NLogRecent::selected()
74 QTreeWidgetItem
*i
= _treew
->selectedItems().first();
75 i
= (i
->childCount() > 0) ? i
->child(0) : i
;
77 emit
selected(i
->text(0));
80 void NLogRecent::reset()
82 if (_treew
->topLevelItemCount() == 0)
85 if (ask(this, tr("All records will be lost permanently. Really clear?"))
97 /* vim: set ts=2 sw=2 tw=72 expandtab: */