Size of the EntryEdit dialog is saved

Some small GUI improvements

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@157 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 17 years ago
parent 619eaa1552
commit 8b08b321a5
  1. 21
      src/KpxConfig.cpp
  2. 3
      src/KpxConfig.h
  3. 5
      src/dialogs/AboutDlg.cpp
  4. 8
      src/dialogs/AboutDlg.h
  5. 22
      src/dialogs/EditEntryDlg.cpp
  6. 7
      src/dialogs/EditEntryDlg.h
  7. 3
      src/dialogs/PasswordDlg.cpp
  8. 7
      src/dialogs/SettingsDlg.cpp
  9. 3
      src/dialogs/SettingsDlg.h
  10. 4
      src/forms/AboutDlg.ui
  11. 93
      src/forms/DatabaseSettingsDlg.ui
  12. 180
      src/forms/EditEntryDlg.ui
  13. 2
      src/lib/EntryView.cpp

@ -25,6 +25,7 @@
#include <QApplication>
#include <QSettings>
#include <QDir>
#include <QLayout>
KpxConfig::KpxConfig(const QString& filePath) : settings(filePath,QSettings::IniFormat){
configFile=filePath;
@ -214,6 +215,26 @@ QString KpxConfig::keyTypeToString(tKeyType keyType){
return res;
}
QRect KpxConfig::dialogGeometry(const QWidget* widget){
Q_ASSERT(widget->parentWidget()!=NULL && widget->parentWidget()->window()!=NULL);
QSize size = settings.value(QString("UI/%1Size").arg(widget->objectName()),widget->size()).toSize();
QSize minSize = widget->minimumSize();
if (size.width() < minSize.width() || size.height() < minSize.height())
size = minSize;
if (minSize.isNull() && widget->layout()!=NULL){
minSize = widget->layout()->minimumSize();
if (size.width() < minSize.width() || size.height() < minSize.height())
size = minSize;
}
QRect rect(QPoint(), size);
rect.moveCenter( widget->parentWidget()->window()->geometry().center() );
return rect;
}
void KpxConfig::setDialogGeometry(const QWidget* widget){
settings.setValue(QString("UI/%1Size").arg(widget->objectName()),widget->size());
}
QString KpxConfig::detailViewTemplate(){
if (settings.contains("UI/DetailsView")){

@ -166,6 +166,9 @@ public:
unsigned fileDlgHistorySize();
void clearFileDlgHistory(){settings.remove("FileDlgHistory");};
QRect dialogGeometry(const QWidget* widget);
void setDialogGeometry(const QWidget* widget);
QString detailViewTemplate();
QString defaultDetailViewTemplate();
void setDetailViewTemplate(const QString& value);

@ -71,11 +71,6 @@ void AboutDialog::paintEvent(QPaintEvent *event){
painter.drawPixmap(QPoint(0,0),BannerPixmap);
}
void AboutDialog::OnClose()
{
close();
}
void AboutDialog::loadLicFromFile(){
QString filename;
filename = AppDir+"/../share/keepass/license.html";

@ -26,19 +26,17 @@
#include "main.h"
class AboutDialog : public QDialog, public Ui_AboutDlg
{
Q_OBJECT
public:
AboutDialog(QWidget* parent);
public slots:
virtual void OnClose();
private slots:
void OnHomepageClicked();
void OnEMailClicked();
private:
QPixmap BannerPixmap;
inline void loadLicFromFile();

@ -41,17 +41,20 @@
CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent, bool modal, Qt::WFlags fl)
: QDialog(parent,fl)
CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent, bool modal, bool newEntry)
: QDialog(parent)
{
Q_ASSERT(_db);
Q_ASSERT(_entry);
entry=_entry;
db=_db;
pNewEntry=newEntry;
setupUi(this);
ModFlag=false;
QMenu *ExpirePresetsMenu=new QMenu();
setGeometry( config->dialogGeometry(this) );
connect(Edit_Title, SIGNAL(textChanged(const QString&)), this, SLOT( OnTitleTextChanged(const QString&)));
connect(Edit_Password_w, SIGNAL(editingFinished()), this, SLOT(OnPasswordwLostFocus()));
connect(Edit_Password_w, SIGNAL(textChanged(const QString&)), this, SLOT( OnPasswordwTextChanged()));
@ -67,6 +70,7 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
connect(Button_Icons,SIGNAL(clicked()),this,SLOT(OnButtonIcons()));
connect(ExpirePresetsMenu,SIGNAL(triggered(QAction*)),this,SLOT(OnExpirePreset(QAction*)));
connect(ButtonExpirePresets,SIGNAL(triggered(QAction*)),this,SLOT(OnCalendar()));
connect(this, SIGNAL(finished(int)), this, SLOT(OnClose()));
// QAction::data() contains the time until expiration in days.
ExpirePresetsMenu->addAction(tr("Today"))->setData(0);
@ -144,17 +148,8 @@ CEditEntryDlg::~CEditEntryDlg()
}
void CEditEntryDlg::showEvent(QShowEvent *event){
if(event->spontaneous()==false){
}
}
void CEditEntryDlg::resizeEvent(QResizeEvent *event){
createBanner(&BannerPixmap,getPixmap("keepassx_large"),tr("Edit Entry"),width());
createBanner(&BannerPixmap,getPixmap("keepassx_large"),pNewEntry?tr("New Entry"):tr("Edit Entry"),width());
QDialog::resizeEvent(event);
}
@ -434,3 +429,6 @@ void CEditEntryDlg::OnCalendar(){
}
}
void CEditEntryDlg::OnClose(){
config->setDialogGeometry(this);
}

@ -30,7 +30,7 @@ class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog
{
Q_OBJECT
public:
CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0);
CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent = 0, bool modal = FALSE, bool newEntry = FALSE);
~CEditEntryDlg();
void InitGroupComboBox();
/* MX-TO-DO: Remove this declaration
@ -45,7 +45,7 @@ class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog
QList<IGroupHandle*> groups;
QPixmap BannerPixmap;
public slots:
private slots:
void OnTitleTextChanged(const QString&);
void OnPasswordwLostFocus();
void OnPasswordwTextChanged();
@ -61,13 +61,14 @@ class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog
void OnButtonOK();
void OnExpirePreset(QAction*);
void OnCalendar();
void OnClose();
private:
virtual void showEvent(QShowEvent *);
virtual void paintEvent(QPaintEvent*);
virtual void resizeEvent(QResizeEvent *);
int IconIndex;
bool pNewEntry;
};
#endif

@ -44,6 +44,9 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,QString filename,IDatabase* DB,
Button_Bookmarks->setIcon(getIcon("bookmark"));
db=DB;
LastFile=filename;
if (ChangeKeyMode)
setWindowTitle(tr("Change Master Key"));
else
setWindowTitle(LastFile);
QString mountDir=config->mountDir();
QDir media(mountDir);

@ -70,8 +70,6 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
connect(this,SIGNAL(rejected()),SLOT(resetGlobalShortcut()));
#endif
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width());
//General
CheckBox_OpenLast->setChecked(config->openLastFile());
CheckBox_RememberLastKey->setChecked(config->rememberLastKey());
@ -178,6 +176,11 @@ void CSettingsDlg::paintEvent(QPaintEvent *event){
painter.drawPixmap(QPoint(0,0),BannerPixmap);
}
void CSettingsDlg::resizeEvent(QResizeEvent* event){
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width());
QDialog::resizeEvent(event);
}
void CSettingsDlg::OnOK()
{
apply();

@ -36,7 +36,7 @@ class CSettingsDlg : public QDialog, public Ui_SettingsDialog
CSettingsDlg(QWidget* parent);
~CSettingsDlg();
public slots:
private slots:
virtual void OnCancel();
virtual void OnOK();
virtual void OnTextColor();
@ -58,6 +58,7 @@ class CSettingsDlg : public QDialog, public Ui_SettingsDialog
private:
virtual void paintEvent(QPaintEvent*);
virtual void resizeEvent(QResizeEvent*);
void apply();
QColor color1,color2,textcolor;
QPixmap BannerPixmap;

@ -24,7 +24,7 @@
<property name="maximumSize" >
<size>
<width>419</width>
<height>309</height>
<height>305</height>
</size>
</property>
<property name="windowTitle" >
@ -196,7 +196,7 @@
<item>
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Copyright (C) 2005 - 2007 KeePassX Team
<string>Copyright (C) 2005 - 2008 KeePassX Team
KeePassX is distributed under the terms of the
General Public License (GPL) version 2.</string>
</property>

@ -30,84 +30,65 @@
<property name="windowTitle" >
<string>Database Settings</string>
</property>
<widget class="QGroupBox" name="groupBox1" >
<property name="geometry" >
<rect>
<x>10</x>
<y>60</y>
<width>420</width>
<height>110</height>
</rect>
<layout class="QVBoxLayout" >
<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="QGroupBox" name="groupBox1" >
<property name="title" >
<string>Encryption</string>
</property>
<widget class="QLabel" name="textLabel2" >
<property name="geometry" >
<rect>
<x>10</x>
<y>30</y>
<width>90</width>
<height>20</height>
</rect>
<layout class="QGridLayout" >
<property name="horizontalSpacing" >
<number>15</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="textLabel2" >
<property name="text" >
<string>Algorithm:</string>
</property>
</widget>
<widget class="QComboBox" name="ComboAlgo" >
<property name="geometry" >
<rect>
<x>109</x>
<y>30</y>
<width>300</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditRounds" >
<property name="geometry" >
<rect>
<x>180</x>
<y>70</y>
<width>230</width>
<height>21</height>
</rect>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="ComboAlgo" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="textLabel3" >
<property name="geometry" >
<rect>
<x>10</x>
<y>70</y>
<width>150</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>Encryption Rounds:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="EditRounds" />
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="ButtonBox" >
<property name="geometry" >
<rect>
<x>12</x>
<y>180</y>
<width>411</width>
<height>27</height>
</rect>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<tabstops>
<tabstop>ComboAlgo</tabstop>
<tabstop>EditRounds</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

@ -10,26 +10,6 @@
<height>526</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>500</width>
<height>526</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle" >
<string>Edit Entry</string>
</property>
@ -40,26 +20,48 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item rowspan="2" row="5" column="1" >
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="spacing" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="1" column="1" >
<widget class="QToolButton" name="ButtonGenPw" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -86,16 +88,8 @@
</item>
<item row="0" column="1" >
<widget class="QToolButton" name="ButtonEchoMode" >
<property name="iconSize" >
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -112,6 +106,12 @@
<height>23</height>
</size>
</property>
<property name="iconSize" >
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0" >
@ -122,9 +122,7 @@
<item row="7" column="0" >
<widget class="QLabel" name="textLabel9" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -137,9 +135,7 @@
<item row="10" column="0" >
<widget class="QLabel" name="textLabel12" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -152,9 +148,7 @@
<item row="2" column="0" >
<widget class="QLabel" name="textLabel4" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -167,9 +161,7 @@
<item row="3" column="0" >
<widget class="QLabel" name="textLabel5" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -182,9 +174,7 @@
<item row="8" column="0" >
<widget class="QLabel" name="textLabel10" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -204,9 +194,7 @@
<item row="4" column="0" >
<widget class="QLabel" name="textLabel7" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -219,9 +207,7 @@
<item row="1" column="0" >
<widget class="QLabel" name="textLabel3" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -240,9 +226,7 @@
<item row="6" column="0" >
<widget class="QLabel" name="textLabel8" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -255,9 +239,7 @@
<item row="5" column="0" >
<widget class="QLabel" name="textLabel6" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -270,9 +252,7 @@
<item row="9" column="0" >
<widget class="QLabel" name="textLabel11" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -304,21 +284,28 @@
</item>
<item row="10" column="1" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="Edit_Attachment" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -377,12 +364,21 @@
</item>
<item row="9" column="1" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QDateTimeEdit" name="DateTime_Expire" />
</item>
@ -413,12 +409,21 @@
</item>
<item row="7" column="1" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QProgressBar" name="Progress_Quali" >
<property name="minimumSize" >
@ -458,18 +463,25 @@
</item>
<item row="1" column="1" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="Combo_Group" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>

@ -239,7 +239,7 @@ void KeepassEntryView::OnNewEntry(){
}
else
NewEntry=db->newEntry(CurrentGroup);
CEditEntryDlg dlg(db,NewEntry,this,true);
CEditEntryDlg dlg(db,NewEntry,this,true,true);
if(!dlg.exec()){
db->deleteLastEntry();
}