Fix .desktop file path
[keepassx] / src / dialogs / ExpiredEntriesDlg.cpp
1 /***************************************************************************
2  *   Copyright (C) 2007 by Tarek Saidi                                     *
3  *   tarek.saidi@arcor.de                                                  *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; version 2 of the License.               *
8
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20
21
22 #include "ExpiredEntriesDlg.h"
23
24 ExpiredEntriesDialog::ExpiredEntriesDialog(QWidget* parent,IDatabase* database,const QList<IEntryHandle*>& ExpiredEntries):QDialog(parent){
25         setupUi(this);
26         Entries=ExpiredEntries;
27         for(int i=0;i<Entries.size();i++){
28                 QTreeWidgetItem* item=new QTreeWidgetItem(treeWidget);
29                 item->setData(0,Qt::UserRole,i);
30                 item->setText(0,Entries[i]->group()->title());
31                 item->setText(1,Entries[i]->title());
32                 item->setText(2,Entries[i]->username());
33                 item->setText(3,Entries[i]->expire().dateToString(Qt::SystemLocaleDate));
34                 item->setIcon(0,database->icon(Entries[i]->group()->image()));
35                 item->setIcon(1,database->icon(Entries[i]->image()));
36
37         }
38         connect(treeWidget,SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),this,SLOT(OnItemDoubleClicked(QTreeWidgetItem*)));
39 }
40
41
42 void ExpiredEntriesDialog::paintEvent(QPaintEvent* event){
43         QDialog::paintEvent(event);
44         QPainter painter(this);
45         painter.setClipRegion(event->region());
46         painter.drawPixmap(QPoint(0,0),BannerPixmap);
47 }
48
49 void ExpiredEntriesDialog::resizeEvent(QResizeEvent* event){
50         createBanner(&BannerPixmap,getPixmap("alarmclock"),tr("Expired Entries in the Database"),width());
51         QDialog::resizeEvent(event);
52 }
53
54 void ExpiredEntriesDialog::OnItemDoubleClicked(QTreeWidgetItem* item){
55         SelectedEntry=Entries[item->data(0,Qt::UserRole).toInt()];
56         accept();
57 }
58
59 ///TODO 0.2.3 locale aware string/date compare for correct sorting