diff --git a/src/PwmConfig.cpp b/src/PwmConfig.cpp index 3adba6c..6e0676b 100755 --- a/src/PwmConfig.cpp +++ b/src/PwmConfig.cpp @@ -163,7 +163,7 @@ if(count > lst.size()){ for(int i=lst.size(); i #include #include #include @@ -32,14 +32,28 @@ KeepassEntryView::KeepassEntryView(QWidget* parent):QTreeWidget(parent){ +AutoResizeColumns=true; +int sum=0; +for(int i=0;isetResizeMode(QHeaderView::Interactive); header()->setStretchLastSection(false); +connect(header(),SIGNAL(sectionResized(int,int,int)),this,SLOT(OnColumnResized(int,int,int))); ContextMenu=new QMenu(this); } +KeepassEntryView::~KeepassEntryView(){ +for(int i=0;ipos())){ @@ -69,7 +83,7 @@ ContextMenu->popup(e->globalPos()); } void KeepassEntryView::resizeEvent(QResizeEvent* e){ - +resizeColumns(); e->accept(); } @@ -198,8 +212,81 @@ if(config.Columns[8]){ if(config.Columns[9]){ cols << trUtf8("Anhang");} setHeaderLabels(cols); +resizeColumns(); +} + +void KeepassEntryView::resizeColumns(){ + +AutoResizeColumns=false; + +for(int i=0;iwidth(); +int wx=0; int j=0; + + +for(int i=0;iresizeSection(j++,NewWidth); + //add rounding difference (w-wx) to the last column + if(j==header()->count()){ + header()->resizeSection(j-1,header()->sectionSize(j-1)+(w-wx)); + } } +AutoResizeColumns=true; + +} + + +void KeepassEntryView::OnColumnResized(int index,int Old, int New){ +if(!AutoResizeColumns)return; + +int i=0; int c=-1; +for(i;iwidth(); +float div=(float)(New-Old)/(float)w; + +if(((ColumnSizes[j]-div)*w > 2)){ + ColumnSizes[j]-=div; + ColumnSizes[i]+=div; +} +resizeColumns(); +} + + + void KeepassEntryView::paintEvent(QPaintEvent * event){ QTreeWidget::paintEvent(event); } diff --git a/src/lib/EntryView.h b/src/lib/EntryView.h index b8f704b..803da88 100644 --- a/src/lib/EntryView.h +++ b/src/lib/EntryView.h @@ -23,13 +23,19 @@ #include #include #include +#include #include "../PwManager.h" +#define NUM_COLUMNS 10 + class EntryViewItem; + class KeepassEntryView:public QTreeWidget{ +Q_OBJECT public: KeepassEntryView(QWidget* parent=0); + ~KeepassEntryView(); void updateItems(unsigned int group); void refreshItems(); void updateColumns(); @@ -41,10 +47,14 @@ private: void setEntry(CEntry* entry); int CurrentGroup; QListColumnSizes; + void resizeColumns(); + bool AutoResizeColumns; protected: virtual void contextMenuEvent(QContextMenuEvent *event); virtual void paintEvent(QPaintEvent* event); virtual void resizeEvent(QResizeEvent* event); +public slots: + void OnColumnResized(int index,int OldSize, int NewSize); }; diff --git a/src/main.cpp b/src/main.cpp index bff4557..064929a 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -129,6 +129,7 @@ SecString::generateSessionKey(); KeepassMainWindow *mainWin = new KeepassMainWindow(); mainWin->show(); int r=app->exec(); +delete mainWin; if(!config.saveToIni(IniFilename)) QMessageBox::warning(NULL,QObject::tr("Warnung"),QObject::trUtf8("Die Konfigurationsdatei konnte nicht gespeichert werden.Stellen Sie sicher, dass\nSie Schreibrechte im Verzeichnis ~/.keepass besitzen."),QObject::tr("OK"),"","",0.0); delete app; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index cadbecd..1434955 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include "lib/random.h" #include "lib/IniReader.h" @@ -71,6 +72,11 @@ KeepassMainWindow::KeepassMainWindow(QWidget *parent, Qt::WFlags flags):QMainWin setupConnections(); FileOpen=false; Clipboard=QApplication::clipboard(); + setStatusBar(new QStatusBar(this)); + StatusBarGeneral=new QLabel(tr("Bereit"),statusBar()); + StatusBarSelection=new QLabel(statusBar()); + statusBar()->addWidget(StatusBarGeneral,30); + statusBar()->addWidget(StatusBarSelection,70); } void KeepassMainWindow::setupConnections(){ diff --git a/src/mainwindow.h b/src/mainwindow.h index d35af5e..5a518ae 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -113,6 +113,8 @@ private: inline CGroup* currentGroup(); inline CEntry* currentEntry(); QLineEdit* QuickSearchEdit; + QLabel* StatusBarGeneral; + QLabel* StatusBarSelection; protected: void closeEvent(QCloseEvent* event); diff --git a/src/src.pro b/src/src.pro index 738f0cd..2730bfe 100755 --- a/src/src.pro +++ b/src/src.pro @@ -1,110 +1,109 @@ -# Diese Datei wurde mit dem qmake-Manager von KDevelop erstellt. -# ------------------------------------------- -# Unterordner relativ zum Projektordner: ./src -# Das Target ist eine Anwendung: ../bin/keepass - -INSTALLS += Share -Share.files += ../share/keepass/* -FORMS += forms/EditGroupDlg.ui \ - forms/SearchDlg.ui \ - forms/AboutDlg.ui \ - forms/LanguageDlg.ui \ - forms/SettingsDlg.ui \ - forms/ChangeKeyDlg.ui \ - forms/MainWindow.ui \ - forms/SimplePasswordDlg.ui \ - forms/DatabaseSettingsDlg.ui \ - forms/PasswordDlg.ui \ - forms/EditEntryDlg.ui \ - forms/PasswordGenDlg.ui -TRANSLATIONS += translations/english.ts \ - translations/russian.ts -HEADERS += lib/IniReader.h \ - lib/UrlLabel.h \ - mainwindow.h \ - PwManager.h \ - crypto/rijndael.h \ - lib/SecString.h \ - crypto/sha256.h \ - crypto/twoclass.h \ - crypto/twofish.h \ - import/Import_PwManager.h \ - crypto/blowfish.h \ - crypto/sha1.h \ - import/Import_KWalletXml.h \ - PwmConfig.h \ - dialogs/AboutDlg.h \ - dialogs/EditGroupDlg.h \ - dialogs/SearchDlg.h \ - dialogs/ChangeKeyDlg.h \ - dialogs/LanguageDlg.h \ - dialogs/SettingsDlg.h \ - dialogs/DatabaseSettingsDlg.h \ - dialogs/PasswordDlg.h \ - dialogs/SimplePasswordDlg.h \ - dialogs/EditEntryDlg.h \ - dialogs/PasswordGenDlg.h \ - lib/random.h \ - Database.h \ - lib/KdePlugin.h \ - global.h \ - main.h \ - lib/GroupView.h \ - lib/EntryView.h \ - crypto/arcfour.h \ - lib/KpFileIconProvider.h -SOURCES += lib/IniReader.cpp \ - lib/UrlLabel.cpp \ - main.cpp \ - mainwindow.cpp \ - PwManager.cpp \ - crypto/rijndael.cpp \ - lib/SecString.cpp \ - crypto/sha256.c \ - crypto/twoclass.cpp \ - crypto/twofish.cpp \ - import/Import_PwManager.cpp \ - crypto/blowfish.cpp \ - crypto/sha1.cpp \ - import/Import_KWalletXml.cpp \ - PwmConfig.cpp \ - dialogs/AboutDlg.cpp \ - dialogs/EditGroupDlg.cpp \ - dialogs/SearchDlg.cpp \ - dialogs/ChangeKeyDlg.cpp \ - dialogs/LanguageDlg.cpp \ - dialogs/SettingsDlg.cpp \ - dialogs/DatabaseSettingsDlg.cpp \ - dialogs/PasswordDlg.cpp \ - dialogs/SimplePasswordDlg.cpp \ - dialogs/EditEntryDlg.cpp \ - dialogs/PasswordGenDlg.cpp \ - lib/random.cpp \ - Database.cpp \ - lib/KdePlugin.cpp \ - lib/GroupView.cpp \ - lib/EntryView.cpp \ - crypto/arcfour.cpp \ - lib/KpFileIconProvider.cpp -QT += xml \ -qt3support -MOC_DIR = ../build/moc -UI_DIR = ../build/ui -OBJECTS_DIR = ../build/ -TARGET = ../bin/keepass -INCLUDEPATH += ./ -CONFIG += debug \ -warn_off \ -qt \ -thread \ -exceptions \ -stl -TEMPLATE = app -unix{ - target.path = /usr/local/bin - Share.path = /usr/local/share/keepass -} -macx{ - target.path = /Applications - Share.path = /Applications/keepass.app/Contents/share/keepass -} +# Diese Datei wurde mit dem qmake-Manager von KDevelop erstellt. +# ------------------------------------------- +# Unterordner relativ zum Projektordner: ./src +# Das Target ist eine Anwendung: ../bin/keepass + +INSTALLS += target \ + Share +Share.files += ../share/keepass/* +unix{ target.path = /usr/local/bin + Share.path = /usr/local/share/keepass +} +macx{ target.path = /Applications + Share.path = /Applications/keepass.app/Contents/share/keepass +} +FORMS += forms/EditGroupDlg.ui \ + forms/SearchDlg.ui \ + forms/AboutDlg.ui \ + forms/LanguageDlg.ui \ + forms/SettingsDlg.ui \ + forms/ChangeKeyDlg.ui \ + forms/MainWindow.ui \ + forms/SimplePasswordDlg.ui \ + forms/DatabaseSettingsDlg.ui \ + forms/PasswordDlg.ui \ + forms/EditEntryDlg.ui \ + forms/PasswordGenDlg.ui +TRANSLATIONS += translations/english.ts \ + translations/russian.ts +HEADERS += lib/IniReader.h \ + lib/UrlLabel.h \ + mainwindow.h \ + PwManager.h \ + crypto/rijndael.h \ + lib/SecString.h \ + crypto/sha256.h \ + crypto/twoclass.h \ + crypto/twofish.h \ + import/Import_PwManager.h \ + crypto/blowfish.h \ + crypto/sha1.h \ + import/Import_KWalletXml.h \ + PwmConfig.h \ + dialogs/AboutDlg.h \ + dialogs/EditGroupDlg.h \ + dialogs/SearchDlg.h \ + dialogs/ChangeKeyDlg.h \ + dialogs/LanguageDlg.h \ + dialogs/SettingsDlg.h \ + dialogs/DatabaseSettingsDlg.h \ + dialogs/PasswordDlg.h \ + dialogs/SimplePasswordDlg.h \ + dialogs/EditEntryDlg.h \ + dialogs/PasswordGenDlg.h \ + lib/random.h \ + Database.h \ + lib/KdePlugin.h \ + global.h \ + main.h \ + lib/GroupView.h \ + lib/EntryView.h \ + crypto/arcfour.h \ + lib/KpFileIconProvider.h +SOURCES += lib/IniReader.cpp \ + lib/UrlLabel.cpp \ + main.cpp \ + mainwindow.cpp \ + PwManager.cpp \ + crypto/rijndael.cpp \ + lib/SecString.cpp \ + crypto/sha256.c \ + crypto/twoclass.cpp \ + crypto/twofish.cpp \ + import/Import_PwManager.cpp \ + crypto/blowfish.cpp \ + crypto/sha1.cpp \ + import/Import_KWalletXml.cpp \ + PwmConfig.cpp \ + dialogs/AboutDlg.cpp \ + dialogs/EditGroupDlg.cpp \ + dialogs/SearchDlg.cpp \ + dialogs/ChangeKeyDlg.cpp \ + dialogs/LanguageDlg.cpp \ + dialogs/SettingsDlg.cpp \ + dialogs/DatabaseSettingsDlg.cpp \ + dialogs/PasswordDlg.cpp \ + dialogs/SimplePasswordDlg.cpp \ + dialogs/EditEntryDlg.cpp \ + dialogs/PasswordGenDlg.cpp \ + lib/random.cpp \ + Database.cpp \ + lib/KdePlugin.cpp \ + lib/GroupView.cpp \ + lib/EntryView.cpp \ + crypto/arcfour.cpp \ + lib/KpFileIconProvider.cpp +QT += xml \ +qt3support +MOC_DIR = ../build/moc +UI_DIR = ../build/ui +OBJECTS_DIR = ../build/ +TARGET = ../bin/keepass +INCLUDEPATH += ./ +CONFIG += debug \ +warn_off \ +qt \ +thread \ +exceptions \ +stl +TEMPLATE = app \ No newline at end of file