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
master
tarek_saidi 18 years ago
parent 9dc8f878b5
commit 91c9d1d940
  1. BIN
      share/keepass/icons/restore.png
  2. BIN
      share/keepass/icons/trashcan.png
  3. 92
      src/dialogs/TrashCanDlg.cpp
  4. 51
      src/dialogs/TrashCanDlg.h
  5. 128
      src/forms/TrashCanDlg.ui

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -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 <QTreeWidget>
#include <QPainter>
#include <QPaintEvent>
#include <QResizeEvent>
#include "main.h"
#include "TrashCanDlg.h"
TrashCanDialog::TrashCanDialog(QWidget* parent,IDatabase* database,const QList<IEntryHandle*>& TrashItems):QDialog(parent){
setupUi(this);
Entries=TrashItems;
for(int i=0;i<Entries.size();i++){
QTreeWidgetItem* item=new QTreeWidgetItem(treeWidget);
item->setData(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

@ -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 <QList>
#include <QPixmap>
#include <QPoint>
#include <QMenu>
#include "ui_TrashCanDlg.h"
#include "Database.h"
class TrashCanDialog:public QDialog, public Ui_TrashCanDialog{
Q_OBJECT
public:
TrashCanDialog(QWidget* parent,IDatabase* database,const QList<IEntryHandle*>& Entries);
IEntryHandle* SelectedEntry;
private:
QList<IEntryHandle*> Entries;
QPixmap BannerPixmap;
QMenu* ContextMenu;
virtual void paintEvent(QPaintEvent*);
virtual void resizeEvent(QResizeEvent *);
private slots:
void OnItemDoubleClicked(QTreeWidgetItem*,int);
void OnContextMenu(const QPoint&);
};
#endif

@ -0,0 +1,128 @@
<ui version="4.0" >
<class>TrashCanDialog</class>
<widget class="QDialog" name="TrashCanDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>588</width>
<height>408</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>50</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>Double click on an entry to restore it.</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="treeWidget" >
<property name="contextMenuPolicy" >
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="selectionMode" >
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated" >
<bool>false</bool>
</property>
<property name="uniformRowHeights" >
<bool>true</bool>
</property>
<property name="itemsExpandable" >
<bool>false</bool>
</property>
<property name="sortingEnabled" >
<bool>true</bool>
</property>
<property name="allColumnsShowFocus" >
<bool>true</bool>
</property>
<column>
<property name="text" >
<string>Group</string>
</property>
</column>
<column>
<property name="text" >
<string>Title</string>
</property>
</column>
<column>
<property name="text" >
<string>Username</string>
</property>
</column>
<column>
<property name="text" >
<string>Expired</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Button_Empty" >
<property name="text" >
<string>Empty Recycle Bin</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Button_Close" >
<property name="text" >
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>