added calendar dialog,

added calendar access button in edit entry dialog,
added customize detail view dialog for editing detail view templates,
added 'show expired entries' dialog,
new icon loading mechansim,
added and replaced some icons.

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@130 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
tarek_saidi
2007-03-28 21:24:38 +00:00
parent 88f42dfe6b
commit fbc6febc0c
97 changed files with 2586 additions and 1238 deletions

View File

@@ -22,56 +22,58 @@
#include <qlabel.h>
#include <qdialog.h>
#include <qfile.h>
#include <QPainter>
#include "main.h"
#include "AboutDlg.h"
CAboutDialog::CAboutDialog(QWidget* parent,bool modal, Qt::WFlags fl)
: QDialog(parent,fl)
AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
{
setupUi(this);
createBanner(Banner,Icon_Key32x32,tr("KeePassX %1").arg(KEEPASS_VERSION));
loadLicFromFile();
QString AboutTr=tr("<b>Current Translation: None</b><br><br>","Please replace 'None' with the language of your translation");
if(TrActive){
AboutTr+=tr("<b>Author:</b> %1<br>").arg(tr("$TRANSLATION_AUTHOR"));
QString mail=tr("$TRANSLATION_AUTHOR_EMAIL","Here you can enter your email or homepage if you want.");
if(mail!=QString()){
AboutTr+=mail+"<br>";
setupUi(this);
createBanner(&BannerPixmap,getPixmap("keepassx_large"),tr("KeePassX %1").arg(KEEPASS_VERSION),width());
loadLicFromFile();
QString AboutTr=tr("<b>Current Translation: None</b><br><br>","Please replace 'None' with the language of your translation");
if(TrActive){
AboutTr+=tr("<b>Author:</b> %1<br>").arg(tr("$TRANSLATION_AUTHOR"));
QString mail=tr("$TRANSLATION_AUTHOR_EMAIL","Here you can enter your email or homepage if you want.");
if(mail!=QString()){
AboutTr+=mail+"<br>";
}
AboutTr+="<br>";
}
AboutTr+="<br>";
}
Edit_Translation->setHtml(AboutTr+tr("\
Information on how to translate KeePassX can be found under:\n\
http://keepassx.sourceforge.net/"));
QString str;
str+="<b>"+tr("Team")+"</b><br>";
str+="<div style='margin-left:10px;'>";
str+="<u>"+tr("Tarek Saidi")+"</u><br>"+tr("Developer, Project Admin")+"<br>"+tr("tariq@users.berlios.de")+"<br>";
str+="<br>";
str+="<u>"+tr("Eugen Gorschenin")+"</u><br>"+tr("Web Designer")+"<br>"+tr("geugen@users.berlios.de")+"<br>";
str+="</div><br><div style='margin-left:0px;'>";
str+="<b>"+tr("Thanks To")+"</b>";
str+="</div><div style='margin-left:10px;'>";
str+="<u>"+tr("Matthias Miller")+"</u><br>"+tr("Patches for better MacOS X support")+"<br>"+tr("www.outofhanwell.com")+"<br></div>";
str+="<br>";
str+="</div><div style='margin-left:10px;'>";
str+="<u>"+tr("James Nicholls")+"</u><br>"+tr("Main Application Icon")/*+"<br>"+tr("mailto:???")*/+"<br></div>";
Edit_Thanks->setHtml(str);
Edit_Translation->setHtml(AboutTr+tr("\
Information on how to translate KeePassX can be found under:\n\
http://keepassx.sourceforge.net/"));
QString str;
str+="<b>"+tr("Team")+"</b><br>";
str+="<div style='margin-left:10px;'>";
str+="<u>"+tr("Tarek Saidi")+"</u><br>"+tr("Developer, Project Admin")+"<br>"+tr("tariq@users.berlios.de")+"<br>";
str+="<br>";
str+="<u>"+tr("Eugen Gorschenin")+"</u><br>"+tr("Web Designer")+"<br>"+tr("geugen@users.berlios.de")+"<br>";
str+="</div><br><div style='margin-left:0px;'>";
str+="<b>"+tr("Thanks To")+"</b>";
str+="</div><div style='margin-left:10px;'>";
str+="<u>"+tr("Matthias Miller")+"</u><br>"+tr("Patches for better MacOS X support")+"<br>"+tr("www.outofhanwell.com")+"<br></div>";
str+="<br>";
str+="</div><div style='margin-left:10px;'>";
str+="<u>"+tr("James Nicholls")+"</u><br>"+tr("Main Application Icon")/*+"<br>"+tr("mailto:???")*/+"<br></div>";
Edit_Thanks->setHtml(str);
}
CAboutDialog::~CAboutDialog()
{
void AboutDialog::paintEvent(QPaintEvent *event){
QDialog::paintEvent(event);
QPainter painter(this);
painter.setClipRegion(event->region());
painter.drawPixmap(QPoint(0,0),BannerPixmap);
}
void CAboutDialog::OnClose()
void AboutDialog::OnClose()
{
close();
}
void CAboutDialog::loadLicFromFile(){
void AboutDialog::loadLicFromFile(){
QFile gpl(AppDir+"/../share/keepass/license.html");
if(!gpl.exists()){
@@ -95,11 +97,11 @@ Edit_License->setHtml(QString::fromUtf8(buffer,l));
delete buffer;
}
void CAboutDialog::OnHomepageClicked(){
void AboutDialog::OnHomepageClicked(){
openBrowser(tr("http://keepassx.sf.net"));
}
void CAboutDialog::OnEMailClicked(){
void AboutDialog::OnEMailClicked(){
openBrowser("mailto:keepassx@gmail.com");
}

View File

@@ -1,6 +1,6 @@
/***************************************************************************
* Copyright (C) 2005 by Tarek Saidi *
* tarek@linux *
* Copyright (C) 2005-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 *
@@ -19,25 +19,30 @@
***************************************************************************/
#ifndef _ABOUTDIALOG_H_
#define _ABOUTDIALOG_H_
#include <QPaintEvent>
#include <QPixmap>
#include "ui_AboutDlg.h"
#include "lib/UrlLabel.h"
#include "main.h"
class CAboutDialog : public QDialog, public Ui_AboutDlg
class AboutDialog : public QDialog, public Ui_AboutDlg
{
Q_OBJECT
public:
CAboutDialog(QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~CAboutDialog();
AboutDialog(QWidget* parent);
public slots:
virtual void OnClose();
void OnHomepageClicked();
void OnEMailClicked();
private:
QPixmap BannerPixmap;
inline void loadLicFromFile();
virtual void paintEvent(QPaintEvent*);
};
#endif

View File

@@ -0,0 +1,29 @@
/***************************************************************************
* 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 "main.h"
#include "CalendarDlg.h"
CalendarDialog::CalendarDialog(QWidget* parent, const QDate& Start):QDialog(parent){
setupUi(this);
calendarWidget->setSelectedDate(Start);
setWindowIcon(getIcon("clock"));
setWindowFlags(Qt::Sheet);
}

35
src/dialogs/CalendarDlg.h Normal file
View File

@@ -0,0 +1,35 @@
/***************************************************************************
* 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 _CALENDAR_DLG_H_
#define _CALENDAR_DLG_H_
#include <QDate>
#include "ui_CalendarDlg.h"
class CalendarDialog:public QDialog, public Ui_CalendarDialog{
Q_OBJECT
public:
CalendarDialog(QWidget* parent, const QDate& Start=QDate::currentDate());
};
#endif

View File

@@ -26,7 +26,7 @@
CollectEntropyDlg::CollectEntropyDlg(QWidget* parent):QDialog(parent){
setupUi(this);
createBanner(&BannerPixmap,Icon_Key32x32,tr("Entropy Collection"),width());
createBanner(&BannerPixmap,getPixmap("dice"),tr("Entropy Collection"),width());
KeyEntropyBuffer=new unsigned char[105];
MouseEntropyBuffer=new quint16[210];
KeyCounter=0;

View File

@@ -0,0 +1,217 @@
/***************************************************************************
* Copyright (C) 2005-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 <QTextCursor>
#include <QTextBlockFormat>
#include <QLineEdit>
#include <QPushButton>
#include <QColorDialog>
#include <QPixmap>
#include <QMenu>
#include "main.h"
#include "CustomizeDetailViewDlg.h"
bool DisableButtonSlots=false;
CustomizeDetailViewDialog::CustomizeDetailViewDialog(QWidget* parent):QDialog(parent){
setupUi(this);
BtnBold->setIcon(getIcon("text_bold"));
BtnItalic->setIcon(getIcon("text_italic"));
BtnUnderline->setIcon(getIcon("text_under"));
BtnAlignLeft->setIcon(getIcon("text_left"));
BtnAlignRight->setIcon(getIcon("text_right"));
BtnAlignCenter->setIcon(getIcon("text_center"));
BtnAlignBlock->setIcon(getIcon("text_block"));
BtnTemplates->setIcon(getIcon("templates"));
QMenu* tmplmenu=new QMenu();
tmplmenu->addAction(tr("Group"))->setData("%group%");
tmplmenu->addAction(tr("Title"))->setData("%title%");
tmplmenu->addAction(tr("Username"))->setData("%username%");
tmplmenu->addAction(tr("Password"))->setData("%password%");
tmplmenu->addAction(tr("Url"))->setData("%url%");
tmplmenu->addAction(tr("Comment"))->setData("%comment%");
tmplmenu->addAction(tr("Attachment Name"))->setData("%attachment%");
tmplmenu->addAction(tr("Creation Date"))->setData("%creation%");
tmplmenu->addAction(tr("Last Access Date"))->setData("%lastaccess%");
tmplmenu->addAction(tr("Last Modification Date"))->setData("%lastmod%");
tmplmenu->addAction(tr("Expiration Date"))->setData("%expire%");
tmplmenu->addAction(tr("Time till Expiration"))->setData("%expire-timeleft%");
BtnTemplates->setMenu(tmplmenu);
connect(BtnBold,SIGNAL(toggled(bool)),this,SLOT(OnBtnBold(bool)));
connect(BtnItalic,SIGNAL(toggled(bool)),this,SLOT(OnBtnItalic(bool)));
connect(BtnUnderline,SIGNAL(toggled(bool)),this,SLOT(OnBtnUnderline(bool)));
connect(BtnAlignLeft,SIGNAL(toggled(bool)),this,SLOT(OnBtnAlignLeft(bool)));
connect(BtnAlignRight,SIGNAL(toggled(bool)),this,SLOT(OnBtnAlignRight(bool)));
connect(BtnAlignCenter,SIGNAL(toggled(bool)),this,SLOT(OnBtnAlignCenter(bool)));
connect(BtnAlignBlock,SIGNAL(toggled(bool)),this,SLOT(OnBtnAlignBlock(bool)));
connect(BtnColor,SIGNAL(clicked()),this,SLOT(OnBtnColor()));
connect(ButtonSave,SIGNAL(clicked()),this,SLOT(OnSave()));
connect(ButtonCancel,SIGNAL(clicked()),this,SLOT(OnCancel()));
connect(ButtonRestore,SIGNAL(clicked()),this,SLOT(OnRestoreDefault()));
connect(tmplmenu,SIGNAL(triggered(QAction*)),this,SLOT(OnInsertTemplate(QAction*)));
connect(RichEdit,SIGNAL(cursorPositionChanged()),this,SLOT(OnCursorPositionChanged()));
connect(TabWidget,SIGNAL(currentChanged(int)),this,SLOT(OnTabChanged(int)));
connect(FontSize,SIGNAL(activated(const QString&)),this,SLOT(OnFontSizeChanged(const QString&)));
connect(FontSize->lineEdit(),SIGNAL(returnPressed()),this,SLOT(OnFontSizeChanged()));
RichEdit->setHtml(DetailViewTemplate);
OnCursorPositionChanged();
}
void CustomizeDetailViewDialog::OnTabChanged(int index){
if(index==0){
RichEdit->setHtml(HtmlEdit->toPlainText());
}
if(index==1){
HtmlEdit->setPlainText(RichEdit->toHtml());
}
}
void CustomizeDetailViewDialog::OnFontSizeChanged(const QString& text){
bool ok=false;
int size=text.toInt(&ok);
if(ok && size > 0){
RichEdit->setFontPointSize(size);
}
}
void CustomizeDetailViewDialog::OnCursorPositionChanged(){
DisableButtonSlots=true;
if(RichEdit->fontWeight()==QFont::Bold)BtnBold->setChecked(true);
else BtnBold->setChecked(false);
BtnItalic->setChecked(RichEdit->fontItalic());
BtnUnderline->setChecked(RichEdit->fontUnderline());
switch(RichEdit->alignment()){
case Qt::AlignLeft:
BtnAlignLeft->setChecked(true);
BtnAlignCenter->setChecked(false);
BtnAlignRight->setChecked(false);
BtnAlignBlock->setChecked(false);
break;
case Qt::AlignHCenter:
BtnAlignLeft->setChecked(false);
BtnAlignCenter->setChecked(true);
BtnAlignRight->setChecked(false);
BtnAlignBlock->setChecked(false);
break;
case Qt::AlignRight:
BtnAlignLeft->setChecked(false);
BtnAlignCenter->setChecked(false);
BtnAlignRight->setChecked(true);
BtnAlignBlock->setChecked(false);
break;
case Qt::AlignJustify:
BtnAlignLeft->setChecked(false);
BtnAlignCenter->setChecked(false);
BtnAlignRight->setChecked(false);
BtnAlignBlock->setChecked(true);
break;
}
CurrentColor=RichEdit->textColor();
QPixmap pixmap=QPixmap(16,16);
pixmap.fill(CurrentColor);
BtnColor->setIcon(QIcon(pixmap));
if(RichEdit->fontPointSize()>0)
FontSize->lineEdit()->setText(QString::number((int)RichEdit->fontPointSize()));
else
FontSize->lineEdit()->setText("9");
DisableButtonSlots=false;
}
void CustomizeDetailViewDialog::OnBtnBold(bool toggled){
if(DisableButtonSlots)return;
if(toggled)
RichEdit->setFontWeight(QFont::Bold);
else
RichEdit->setFontWeight(QFont::Normal);
}
void CustomizeDetailViewDialog::OnBtnItalic(bool toggled){
if(DisableButtonSlots)return;
RichEdit->setFontItalic(toggled);
}
void CustomizeDetailViewDialog::OnBtnUnderline(bool toggled){
if(DisableButtonSlots)return;
RichEdit->setFontUnderline(toggled);
}
void CustomizeDetailViewDialog::OnBtnAlignLeft(bool toggled){
if(DisableButtonSlots)return;
RichEdit->setAlignment(Qt::AlignLeft);
OnCursorPositionChanged();
}
void CustomizeDetailViewDialog::OnBtnAlignRight(bool toggled){
if(DisableButtonSlots)return;
RichEdit->setAlignment(Qt::AlignRight);
OnCursorPositionChanged();
}
void CustomizeDetailViewDialog::OnBtnAlignCenter(bool toggled){
if(DisableButtonSlots)return;
RichEdit->setAlignment(Qt::AlignHCenter);
OnCursorPositionChanged();
}
void CustomizeDetailViewDialog::OnBtnAlignBlock(bool toggled){
if(DisableButtonSlots)return;
RichEdit->setAlignment(Qt::AlignJustify);
OnCursorPositionChanged();
}
void CustomizeDetailViewDialog::OnBtnColor(){
CurrentColor=QColorDialog::getColor(CurrentColor,this);
QPixmap pixmap=QPixmap(16,16);
pixmap.fill(CurrentColor);
BtnColor->setIcon(QIcon(pixmap));
RichEdit->setTextColor(CurrentColor);
}
void CustomizeDetailViewDialog::OnInsertTemplate(QAction* action){
RichEdit->insertPlainText(action->data().toString());
}
void CustomizeDetailViewDialog::OnSave(){
if(TabWidget->currentIndex()==0)
DetailViewTemplate=RichEdit->toHtml();
else if(TabWidget->currentIndex()==1)
DetailViewTemplate=HtmlEdit->toPlainText();
done(1);
}
void CustomizeDetailViewDialog::OnCancel(){
done(0);
}
void CustomizeDetailViewDialog::OnRestoreDefault(){
loadDefaultDetailViewTemplate();
HtmlEdit->setPlainText(DetailViewTemplate);
RichEdit->setHtml(DetailViewTemplate);
}

View File

@@ -0,0 +1,55 @@
/***************************************************************************
* Copyright (C) 2005-2006 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 _CUSTOMIZE_DETAIL_VIEW_H_
#define _CUSTOMIZE_DETAIL_VIEW_H_
#include "ui_CustomizeDetailViewDlg.h";
#include <QColor>
#include <QAction>
class CustomizeDetailViewDialog : public QDialog, public Ui_CustomizeDetailViewDialog{
Q_OBJECT
public:
CustomizeDetailViewDialog(QWidget* parent);
private slots:
void OnBtnBold(bool);
void OnBtnItalic(bool);
void OnBtnUnderline(bool);
void OnBtnAlignLeft(bool);
void OnBtnAlignRight(bool);
void OnBtnAlignCenter(bool);
void OnBtnAlignBlock(bool);
void OnBtnColor();
void OnSave();
void OnCancel();
void OnRestoreDefault();
void OnInsertTemplate(QAction*);
void OnCursorPositionChanged();
void OnTabChanged(int index);
void OnFontSizeChanged(const QString& text=QString());
private:
QColor CurrentColor;
};
#endif

View File

@@ -32,7 +32,7 @@ CDbSettingsDlg::CDbSettingsDlg(QWidget* parent,IDatabase* db, bool modal, Qt::W
{
setupUi(this);
database=dynamic_cast<IKdbSettings*>(db);
createBanner(&BannerPixmap,Icon_Settings32x32,tr("Settings"),width());
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width());
ComboAlgo->insertItem(0,tr("AES(Rijndael): 256 Bit (default)"));
ComboAlgo->insertItem(1,tr("Twofish: 256 Bit"));
ComboAlgo->setCurrentIndex(database->cryptAlgorithm()); //Achtung: AlgoID muss gleich dem ComboBox Index sein!
@@ -77,4 +77,4 @@ void CDbSettingsDlg::OnOK()
database->setKeyTransfRounds(rounds);
database->setCryptAlgorithm((CryptAlgorithm)ComboAlgo->currentIndex());
done(1);
}
}

View File

@@ -41,6 +41,7 @@
#include "SelectIconDlg.h"
#include "PasswordGenDlg.h"
#include "EditEntryDlg.h"
#include "CalendarDlg.h"
@@ -52,10 +53,8 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
entry=_entry;
db=_db;
setupUi(this);
//not sure if this createBanner is still needed
createBanner(&BannerPixmap,Icon_Key32x32,tr("Edit Entry"),width());
//end
ModFlag=false;
QMenu *ExpirePresetsMenu=new QMenu();
connect(Edit_Password_w, SIGNAL(editingFinished()), this, SLOT(OnPasswordwLostFocus()));
connect(Edit_Password_w, SIGNAL(textChanged(const QString&)), this, SLOT( OnPasswordwTextChanged(const QString&)));
connect(Edit_Password, SIGNAL(textChanged(const QString&)), this, SLOT( OnPasswordTextChanged(const QString&)));
@@ -68,10 +67,28 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
connect(buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()),this,SLOT(OnButtonOK()));
connect(CheckBox_ExpiresNever,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxExpiresNeverChanged(int)));
connect(Button_CustomIcons,SIGNAL(clicked()),this,SLOT(OnCustomIcons()));
connect(ExpirePresetsMenu,SIGNAL(triggered(QAction*)),this,SLOT(OnExpirePreset(QAction*)));
connect(ButtonExpirePresets,SIGNAL(triggered(QAction*)),this,SLOT(OnCalendar(QAction*)));
ButtonOpenAttachment->setIcon(*Icon_FileOpen);
ButtonDeleteAttachment->setIcon(*Icon_EditDelete);
ButtonSaveAttachment->setIcon(*Icon_FileSave);
// QAction::data() contains the time until expiration in days.
ExpirePresetsMenu->addAction(tr("Today"))->setData(0);
ExpirePresetsMenu->addSeparator();
ExpirePresetsMenu->addAction(tr("1 Week"))->setData(7);
ExpirePresetsMenu->addAction(tr("2 Weeks"))->setData(14);
ExpirePresetsMenu->addAction(tr("3 Weeks"))->setData(21);
ExpirePresetsMenu->addSeparator();
ExpirePresetsMenu->addAction(tr("1 Month"))->setData(30);
ExpirePresetsMenu->addAction(tr("3 Months"))->setData(60);
ExpirePresetsMenu->addAction(tr("6 Months"))->setData(180);
ExpirePresetsMenu->addSeparator();
ExpirePresetsMenu->addAction(tr("1 Year"))->setData(365);
ButtonExpirePresets->setMenu(ExpirePresetsMenu);
ButtonExpirePresets->setDefaultAction(new QAction(tr("Calendar..."),ButtonExpirePresets));
ButtonOpenAttachment->setIcon(getIcon("fileopen"));
ButtonDeleteAttachment->setIcon(getIcon("filedelete"));
ButtonSaveAttachment->setIcon(getIcon("filesave"));
ButtonExpirePresets->setIcon(getIcon("clock"));
setWindowTitle(entry->title());
@@ -136,9 +153,8 @@ if(event->spontaneous()==false){
}
}
//Added resize event
void CEditEntryDlg::resizeEvent(QResizeEvent *event){
createBanner(&BannerPixmap,Icon_Key32x32,tr("Test 2"),width());
createBanner(&BannerPixmap,getPixmap("keepassx_large"),tr("Test 2"),width());
QDialog::resizeEvent(event);
}
@@ -382,23 +398,35 @@ void CEditEntryDlg::OnButtonGenPw()
void CEditEntryDlg::OnCheckBoxExpiresNeverChanged(int state){
if(state==Qt::Unchecked){
DateTime_Expire->setDisabled(false);
}
else
{
DateTime_Expire->setDisabled(true);
}
if(state==Qt::Unchecked)
DateTime_Expire->setDisabled(false);
else
DateTime_Expire->setDisabled(true);
}
void CEditEntryDlg::OnCustomIcons(){
CSelectIconDlg dlg(db,Combo_IconPicker->currentIndex(),this);
int r=dlg.exec();
if(r!=-1){
Combo_IconPicker->clear();
for(int i=0;i<db->numIcons();i++)
Combo_IconPicker->insertItem(i,db->icon(i),"");
Combo_IconPicker->setCurrentIndex(r);
}
CSelectIconDlg dlg(db,Combo_IconPicker->currentIndex(),this);
int r=dlg.exec();
if(r!=-1){
Combo_IconPicker->clear();
for(int i=0;i<db->numIcons();i++)
Combo_IconPicker->insertItem(i,db->icon(i),"");
Combo_IconPicker->setCurrentIndex(r);
}
}
void CEditEntryDlg::OnExpirePreset(QAction* action){
CheckBox_ExpiresNever->setChecked(false);
DateTime_Expire->setDate(QDate::fromJulianDay(QDate::currentDate().toJulianDay()+action->data().toInt()));
DateTime_Expire->setTime(QTime(0,0,0));
}
void CEditEntryDlg::OnCalendar(QAction* action){
CalendarDialog dlg(this);
if(dlg.exec()==QDialog::Accepted){
CheckBox_ExpiresNever->setChecked(false);
DateTime_Expire->setDate(dlg.calendarWidget->selectedDate());
DateTime_Expire->setTime(QTime(0,0,0));
}
}

View File

@@ -1,6 +1,6 @@
/***************************************************************************
* Copyright (C) 2005 by Tarek Saidi *
* tarek@linux *
* Copyright (C) 2005-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 *
@@ -56,14 +56,13 @@ class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog
void OnCheckBoxExpiresNeverChanged(int state);
void OnCustomIcons();
void OnButtonOK();
void OnExpirePreset(QAction*);
void OnCalendar(QAction*);
private:
virtual void showEvent(QShowEvent *);
virtual void paintEvent(QPaintEvent*);
// Added resizeEvent
virtual void resizeEvent(QResizeEvent *);
virtual void resizeEvent(QResizeEvent *);
};

View File

@@ -0,0 +1,63 @@
/***************************************************************************
* 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 "ExpiredEntriesDlg.h"
ExpiredEntriesDialog::ExpiredEntriesDialog(QWidget* parent,IDatabase* database,const QList<IEntryHandle*>& ExpiredEntries):QDialog(parent){
setupUi(this);
Entries=ExpiredEntries;
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)));
}
void ExpiredEntriesDialog::paintEvent(QPaintEvent* event){
QDialog::paintEvent(event);
QPainter painter(this);
painter.setClipRegion(event->region());
painter.drawPixmap(QPoint(0,0),BannerPixmap);
}
void ExpiredEntriesDialog::resizeEvent(QResizeEvent* event){
createBanner(&BannerPixmap,getPixmap("alarmclock"),tr("Expried Entries of the Database"),width());
QDialog::resizeEvent(event);
}
void ExpiredEntriesDialog::OnItemDoubleClicked(QTreeWidgetItem* item, int column){
SelectedEntry=Entries[item->data(0,Qt::UserRole).toInt()];
accept();
}
///TODO 0.2.3 locale aware string/date compare for correct sorting

View File

@@ -0,0 +1,47 @@
/***************************************************************************
* 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 _EXP_ENTRIES_DLG_
#define _EXP_ENTRIES_DLG_
#include <QList>
#include <QPixmap>
#include "ui_ExpiredEntriesDlg.h"
#include "Database.h"
class ExpiredEntriesDialog:public QDialog, public Ui_ExpiredEntriesDialog{
Q_OBJECT
public:
ExpiredEntriesDialog(QWidget* parent,IDatabase* database,const QList<IEntryHandle*>& Entries);
IEntryHandle* SelectedEntry;
private:
QList<IEntryHandle*> Entries;
QPixmap BannerPixmap;
virtual void paintEvent(QPaintEvent*);
virtual void resizeEvent(QResizeEvent *);
private slots:
void OnItemDoubleClicked(QTreeWidgetItem*,int);
};
#endif

View File

@@ -1,6 +1,6 @@
/***************************************************************************
* Copyright (C) 2005-2006 by Tarek Saidi *
* tarek@linux *
* 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 *
@@ -38,7 +38,7 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt
: QDialog(parent)
{
setupUi(this);
createBanner(Banner,Icon_Key32x32,tr("Database Key"));
createBanner(Banner,getPixmap("key"),tr("Database Key"));
db=DB;
QDir media(config.MountDir);
if(media.exists()){

View File

@@ -37,7 +37,7 @@ CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl)
: QDialog(parent,fl)
{
setupUi(this);
createBanner(&BannerPixmap,Icon_Key32x32,tr("Password Generator"),width());
createBanner(&BannerPixmap,getPixmap("dice"),tr("Password Generator"),width());
connect(ButtonGenerate,SIGNAL(clicked()),this,SLOT(OnGeneratePw()));
connect(Radio_1,SIGNAL(toggled(bool)),this,SLOT(OnRadio1StateChanged(bool)));

View File

@@ -23,54 +23,55 @@
#include <QCheckBox>
#include <QRegExp>
#include <QMessageBox>
#include <QPainter>
#include "main.h"
#include "PwmConfig.h"
#include "SearchDlg.h"
CSearchDlg::CSearchDlg(IDatabase* database,IGroupHandle* Group,QWidget* parent, bool modal, Qt::WFlags fl)
: QDialog(parent,fl)
SearchDialog::SearchDialog(IDatabase* database,IGroupHandle* Group,QWidget* parent):QDialog(parent)
{
setupUi(this);
connect( Button_Search, SIGNAL( clicked() ), this, SLOT( OnSearch() ) );
connect( Button_Close, SIGNAL( clicked() ), this, SLOT( OnClose() ) );
db=database;
group=Group;
createBanner(Banner,Icon_Search32x32,tr("Search"));
checkBox_Cs->setChecked(config.SearchOptions[0]);
checkBox_regExp->setChecked(config.SearchOptions[1]);
checkBox_Title->setChecked(config.SearchOptions[2]);
checkBox_Username->setChecked(config.SearchOptions[3]);
checkBox_Password->setChecked(config.SearchOptions[4]);
checkBox_Comment->setChecked(config.SearchOptions[5]);
checkBox_URL->setChecked(config.SearchOptions[6]);
checkBox_Attachment->setChecked(config.SearchOptions[7]);
if(group)
checkBox_Recursive->setChecked(config.SearchOptions[8]);
else{
checkBox_Recursive->setChecked(false);
checkBox_Recursive->setEnabled(false);}
setupUi(this);
connect( Button_Search, SIGNAL( clicked() ), this, SLOT( OnSearch() ) );
connect( Button_Close, SIGNAL( clicked() ), this, SLOT( OnClose() ) );
db=database;
group=Group;
createBanner(&BannerPixmap,getPixmap("search"),tr("Search"),width());
checkBox_Cs->setChecked(config.SearchOptions[0]);
checkBox_regExp->setChecked(config.SearchOptions[1]);
checkBox_Title->setChecked(config.SearchOptions[2]);
checkBox_Username->setChecked(config.SearchOptions[3]);
checkBox_Password->setChecked(config.SearchOptions[4]);
checkBox_Comment->setChecked(config.SearchOptions[5]);
checkBox_URL->setChecked(config.SearchOptions[6]);
checkBox_Attachment->setChecked(config.SearchOptions[7]);
if(group)
checkBox_Recursive->setChecked(config.SearchOptions[8]);
else{
checkBox_Recursive->setChecked(false);
checkBox_Recursive->setEnabled(false);
}
}
CSearchDlg::~CSearchDlg()
SearchDialog::~SearchDialog()
{
config.SearchOptions[0]=checkBox_Cs->isChecked();
config.SearchOptions[1]=checkBox_regExp->isChecked();
config.SearchOptions[2]=checkBox_Title->isChecked();
config.SearchOptions[3]=checkBox_Username->isChecked();
config.SearchOptions[4]=checkBox_Password->isChecked();
config.SearchOptions[5]=checkBox_Comment->isChecked();
config.SearchOptions[6]=checkBox_URL->isChecked();
config.SearchOptions[7]=checkBox_Attachment->isChecked();
if(group) config.SearchOptions[8]=checkBox_Recursive->isChecked();
config.SearchOptions[0]=checkBox_Cs->isChecked();
config.SearchOptions[1]=checkBox_regExp->isChecked();
config.SearchOptions[2]=checkBox_Title->isChecked();
config.SearchOptions[3]=checkBox_Username->isChecked();
config.SearchOptions[4]=checkBox_Password->isChecked();
config.SearchOptions[5]=checkBox_Comment->isChecked();
config.SearchOptions[6]=checkBox_URL->isChecked();
config.SearchOptions[7]=checkBox_Attachment->isChecked();
if(group) config.SearchOptions[8]=checkBox_Recursive->isChecked();
}
void CSearchDlg::OnClose()
void SearchDialog::OnClose()
{
done(0);
}
void CSearchDlg::OnSearch()
void SearchDialog::OnSearch()
{
bool Fields[6];
Fields[0]=checkBox_Title->isChecked();
@@ -83,6 +84,12 @@ void CSearchDlg::OnSearch()
done(1);
}
void SearchDialog::paintEvent(QPaintEvent *event){
QDialog::paintEvent(event);
QPainter painter(this);
painter.setClipRegion(event->region());
painter.drawPixmap(QPoint(0,0),BannerPixmap);
}

View File

@@ -19,25 +19,30 @@
***************************************************************************/
#ifndef SEARCHDLG_H
#define SEARCHDLG_H
#include <QPaintEvent>
#include <QPixmap>
#include "ui_SearchDlg.h"
#include "main.h"
#include "Database.h"
class CSearchDlg : public QDialog, public Ui_Search_Dlg
class SearchDialog : public QDialog, public Ui_Search_Dlg
{
Q_OBJECT
public:
CSearchDlg(IDatabase* database, IGroupHandle* group=NULL,QWidget* parent = 0, bool modal = true, Qt::WFlags fl = 0 );
~CSearchDlg();
QList<IEntryHandle*> Result;
public slots:
virtual void OnClose();
virtual void OnSearch();
private:
IGroupHandle* group;
IDatabase* db;
Q_OBJECT
public:
SearchDialog(IDatabase* database, IGroupHandle* group,QWidget* parent);
~SearchDialog();
QList<IEntryHandle*> Result;
public slots:
virtual void OnClose();
virtual void OnSearch();
private:
QPixmap BannerPixmap;
IGroupHandle* group;
IDatabase* db;
virtual void paintEvent(QPaintEvent*);
};
#endif

View File

@@ -34,8 +34,8 @@ CSelectIconDlg::CSelectIconDlg(IDatabase* database,int CurrentId,QWidget* parent
db=database;
Id=CurrentId;
CtxMenu=new QMenu(this);
ReplaceAction=CtxMenu->addAction(*Icon_Swap,tr("Replace..."));
DeleteAction=CtxMenu->addAction(*Icon_EditDelete,tr("Delete"));
ReplaceAction=CtxMenu->addAction(getIcon("swap"),tr("Replace..."));
DeleteAction=CtxMenu->addAction(getIcon("delete"),tr("Delete"));
connect(Button_AddIcon, SIGNAL(clicked()), this, SLOT(OnAddIcon()));
connect(Button_PickIcon, SIGNAL(clicked()), this, SLOT(OnPickIcon()));
connect(Button_Cancel, SIGNAL(clicked()), this, SLOT(OnCancel()));

View File

@@ -29,6 +29,7 @@
#include <QDir>
#include <QPainter>
#include "SettingsDlg.h"
#include "CustomizeDetailViewDlg.h"
bool CSettingsDlg::PluginsModified=false;
@@ -51,9 +52,10 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
connect(Radio_IntPlugin_Kde,SIGNAL(toggled(bool)),this,SLOT(OnIntPluginKde(bool)));
connect(CheckBox_BrowserDefault,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxBrowserDefaultChanged(int)));
connect(Button_CustomizeEntryDetails,SIGNAL(clicked()),this,SLOT(OnCustomizeEntryDetails()));
createBanner(&BannerPixmap,Icon_Settings32x32,tr("Settings"),width());
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width());
//General
CheckBox_OpenLast->setChecked(settings->value("OpenLastFile",true).toBool());
@@ -161,12 +163,12 @@ void CSettingsDlg::OnCheckBoxBrowserDefaultChanged(int state){
void CSettingsDlg::OnOK()
{
apply();
close();
accept();
}
void CSettingsDlg::OnCancel()
{
close();
reject();
}
void CSettingsDlg::OnOtherButton(QAbstractButton* button){
@@ -227,7 +229,7 @@ void CSettingsDlg::OnTextColor()
px->fill(c);
pixmTextColor->clear();
pixmTextColor->setPixmap(*px);
createBanner(&BannerPixmap,Icon_Settings32x32,tr("Settings"),width(),color1,color2,textcolor);
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width(),color1,color2,textcolor);
}
}
@@ -241,7 +243,7 @@ void CSettingsDlg::OnColor2()
px->fill(c);
pixmColor2->clear();
pixmColor2->setPixmap(*px);
createBanner(&BannerPixmap,Icon_Settings32x32,tr("Settings"),width(),color1,color2,textcolor);
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width(),color1,color2,textcolor);
}
}
@@ -255,7 +257,7 @@ void CSettingsDlg::OnColor1()
px->fill(c);
pixmColor1->clear();
pixmColor1->setPixmap(*px);
createBanner(&BannerPixmap,Icon_Settings32x32,tr("Settings"),width(),color1,color2,textcolor);
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width(),color1,color2,textcolor);
}
}
@@ -286,3 +288,9 @@ void CSettingsDlg::OnIntPluginGnome(bool toggled){
void CSettingsDlg::OnIntPluginKde(bool toggled){
Label_IntPlugin_Info->show();
}
void CSettingsDlg::OnCustomizeEntryDetails(){
CustomizeDetailViewDialog dlg(this);
dlg.exec();
}

View File

@@ -48,6 +48,7 @@ class CSettingsDlg : public QDialog, public Ui_SettingsDialog
void OnCheckBoxOpenLastChanged(int state);
void OnCheckBoxBrowserDefaultChanged(int state);
void OnMountDirBrowse();
void OnCustomizeEntryDetails();
private:
virtual void paintEvent(QPaintEvent*);