From 91c9d1d940bf4d31e598524058e62f1dd3829c47 Mon Sep 17 00:00:00 2001 From: tarek_saidi Date: Sat, 30 Jun 2007 00:07:17 +0000 Subject: [PATCH] Added missing files for broken rev 133. git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@134 b624d157-de02-0410-bad0-e51aec6abb33 --- share/keepass/icons/restore.png | Bin 0 -> 1462 bytes share/keepass/icons/trashcan.png | Bin 0 -> 2844 bytes src/dialogs/TrashCanDlg.cpp | 92 ++++++++++++++++++++++ src/dialogs/TrashCanDlg.h | 51 ++++++++++++ src/forms/TrashCanDlg.ui | 128 +++++++++++++++++++++++++++++++ 5 files changed, 271 insertions(+) create mode 100644 share/keepass/icons/restore.png create mode 100644 share/keepass/icons/trashcan.png create mode 100644 src/dialogs/TrashCanDlg.cpp create mode 100644 src/dialogs/TrashCanDlg.h create mode 100644 src/forms/TrashCanDlg.ui diff --git a/share/keepass/icons/restore.png b/share/keepass/icons/restore.png new file mode 100644 index 0000000000000000000000000000000000000000..fe16aa762f4558d24d378e7334d9f90154de60ad GIT binary patch literal 1462 zcmV;n1xfmeP)WASDI+hZv)X;UNYzv5*LfG*J;65HUmn z6G@O)Ad09lu~8!OFf9QRL6joV3Zb!~2sFy0&;l*Uw!3}YyLaXs|JY5j3N0%iV>uIV1YypkwKK3};sOv80Kg*;06;__ChR?V0Q-*aM{V(Wcr`5$ zwkQ-*tTYj?s!ISWWRGHx3$0%M(eHn;3d4I11u?Y>8m87U01y*A(jX=ruKWc>8@Izb z9jljqxza?uO`QTzA^R0_X=CQp-dP)#tbrvhXwq#&iEnmobel0TLmQ2+OTNXqk52&1 z#X^ZWCgL@82;d8+daU?22-q0vWUh11M5Kd*p&GOF+!1sQLq* z@siWQ@N^u;Bo?7I$*D*_J)Hp3Ix!|gV2{yK7J*wCi?QK{*`d02^8f%PGptV_kw5Oe zr!g~U8h$)=7!6I)HUNt!&u{&p>c%DfRd)`jE}lVkZO#7x*ds*uTmieZo*MOA9RVcV z$h7h~&g+7cdS$Fzwgv}JmEhvF>Q;b?O{Fj~4PgoRhh-oZ{dl z0ODsG(Ogy^W0yw4a8-u@Nr-G1{>ttX81cd9t8q12hhHm?!Eqf_Y$^q{m_6*#Hlf65 z2=P1{9u}O`3-1;zL)G7x@ZFK!a2s8)M}THD?70kRUQA79!yTQ5)S%0REpxpq&i18K z3UIon5_!2Z5z5F)2JjVjXd5+|rPQd$K-0L`!MdYMrxf5^-38=7Hy2jm=Fj>1rvX4d zfIz1U5*f5!69L8Hc>{TC`7ZViOl6s-KD*U9mWY+n;mgPIiUS{V&-sHnG`k;XzVHx> zfMQ{boGw*FGQ-M|Y3gENY>4eXDYpY?jTNaXGJN?s&fmF+L$mvF*2{fag?%j3)T&Nb zL;yfBeGI@D_e^ZNsrSmrrIPkyrC(03Tzec&+`-7~#}f8r*#M9Wz}IO9{%tdW2LWW> zK}EGf_4M(U-wHYW>Htn1A7+`RY5?@O8-UJLJ?Yl(;dul3nawjeIJGy6fMQ5I(&;Ja zY7@37sNYeI+#xwoVILp>;gh4g4ZuXa!(cA?Xy>QsKV$%8iUOn<+-(2=Ae7h`-F+F8 z$4*Q*Akep40Zhc(O-;J~r;|ru_3*XkrfvgBTmnS#iM?g;j|c(+>D>+>q$qYyHo$to z4={#xcrm#j(;!k6+&>%9rA&BFT(CrW%kc;RT<&%UlDlC#d1flNP&t73KeZ28T43U> Qod5s;07*qoM6N<$g5SP`@&Et; literal 0 HcmV?d00001 diff --git a/share/keepass/icons/trashcan.png b/share/keepass/icons/trashcan.png new file mode 100644 index 0000000000000000000000000000000000000000..f19899dd8003724be482f238052947253d787da4 GIT binary patch literal 2844 zcmWlbc~lek7RM*sunn7l%m}h5iarqosUnp!2^E(bQ4wpb3X?#f9+gF@K#e3339=}l zvZz6*wbu8fg3Ci~DVZ?HF5pp1TrnWqb4e&$LMF*e|M=Z|e&^hC|M=eD{d|A<+oLwx z+b*yL0Kk6pruEU5?DNmD1}*XEk3UXX5-2E?IDbUamyV^kL0EAOi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UJ zwGlxf*WLiol1;lP!S7eyBPg{9+{AWywW{__l%J�#YNFEq>`f_T2Kl1vW=Ut-lq4 Go%}xqR5RHC literal 0 HcmV?d00001 diff --git a/src/dialogs/TrashCanDlg.cpp b/src/dialogs/TrashCanDlg.cpp new file mode 100644 index 0000000..4c1f5db --- /dev/null +++ b/src/dialogs/TrashCanDlg.cpp @@ -0,0 +1,92 @@ +/*************************************************************************** + * Copyright (C) 2007 by Tarek Saidi * + * tarek.saidi@arcor.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include "main.h" +#include "TrashCanDlg.h" + +TrashCanDialog::TrashCanDialog(QWidget* parent,IDatabase* database,const QList& TrashItems):QDialog(parent){ + setupUi(this); + Entries=TrashItems; + for(int i=0;isetData(0,Qt::UserRole,i); + item->setText(0,Entries[i]->group()->title()); + item->setText(1,Entries[i]->title()); + item->setText(2,Entries[i]->username()); + item->setText(3,Entries[i]->expire().dateToString(Qt::LocalDate)); + item->setIcon(0,database->icon(Entries[i]->group()->image())); + item->setIcon(1,database->icon(Entries[i]->image())); + + } + connect(treeWidget,SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),this,SLOT(OnItemDoubleClicked(QTreeWidgetItem*,int))); + connect(treeWidget,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(OnContextMenu(const QPoint&))); + ContextMenu=new QMenu(this); + ContextMenu->addAction(getIcon("restore"),"Restore"); + ContextMenu->addAction(getIcon("deleteentry"),"Delete"); +} + + +void TrashCanDialog::paintEvent(QPaintEvent* event){ + QDialog::paintEvent(event); + QPainter painter(this); + painter.setClipRegion(event->region()); + painter.drawPixmap(QPoint(0,0),BannerPixmap); +} + +void TrashCanDialog::resizeEvent(QResizeEvent* event){ + createBanner(&BannerPixmap,getPixmap("trashcan"),tr("Recycle Bin"),width()); + QDialog::resizeEvent(event); +} + +void TrashCanDialog::OnItemDoubleClicked(QTreeWidgetItem* item, int column){ + SelectedEntry=Entries[item->data(0,Qt::UserRole).toInt()]; + accept(); +} + +void TrashCanDialog::OnContextMenu(const QPoint& pos){ + if(treeWidget->itemAt(pos)){ + QTreeWidgetItem* item=treeWidget->itemAt(pos); + if(treeWidget->selectedItems().size()==0){ + treeWidget->setItemSelected(item,true); + } + else{ + if(!treeWidget->isItemSelected(item)){ + while(treeWidget->selectedItems().size()){ + treeWidget->setItemSelected(treeWidget->selectedItems()[0],false); + } + treeWidget->setItemSelected(item,true); + } + } + } + else + { + while(treeWidget->selectedItems().size()) + treeWidget->setItemSelected(treeWidget->selectedItems()[0],false); + } + ContextMenu->popup(treeWidget->viewport()->mapToGlobal(pos)); +} + + + +///TODO 0.2.3 locale aware string/date compare for correct sorting diff --git a/src/dialogs/TrashCanDlg.h b/src/dialogs/TrashCanDlg.h new file mode 100644 index 0000000..8fbb70c --- /dev/null +++ b/src/dialogs/TrashCanDlg.h @@ -0,0 +1,51 @@ +/*************************************************************************** + * Copyright (C) 2007 by Tarek Saidi * + * tarek.saidi@arcor.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _TRASH_CAN_DLG_ +#define _TRASH_CAN_DLG_ + +#include +#include +#include +#include +#include "ui_TrashCanDlg.h" +#include "Database.h" + +class TrashCanDialog:public QDialog, public Ui_TrashCanDialog{ + Q_OBJECT + public: + TrashCanDialog(QWidget* parent,IDatabase* database,const QList& Entries); + IEntryHandle* SelectedEntry; + private: + QList Entries; + QPixmap BannerPixmap; + QMenu* ContextMenu; + virtual void paintEvent(QPaintEvent*); + virtual void resizeEvent(QResizeEvent *); + + private slots: + void OnItemDoubleClicked(QTreeWidgetItem*,int); + void OnContextMenu(const QPoint&); + + +}; + + +#endif diff --git a/src/forms/TrashCanDlg.ui b/src/forms/TrashCanDlg.ui new file mode 100644 index 0000000..b1e1eef --- /dev/null +++ b/src/forms/TrashCanDlg.ui @@ -0,0 +1,128 @@ + + TrashCanDialog + + + + 0 + 0 + 588 + 408 + + + + + 9 + + + 6 + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 50 + + + + + + + + Double click on an entry to restore it. + + + + + + + Qt::CustomContextMenu + + + QAbstractItemView::ExtendedSelection + + + false + + + true + + + false + + + true + + + true + + + + Group + + + + + Title + + + + + Username + + + + + Expired + + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Empty Recycle Bin + + + + + + + Close + + + + + + + + + +