diff --git a/src/Kdb3Database.cpp b/src/Kdb3Database.cpp
index b170cf8..c2875c5 100644
--- a/src/Kdb3Database.cpp
+++ b/src/Kdb3Database.cpp
@@ -821,7 +821,7 @@ bool Kdb3Database::setKey(const QString& password,const QString& keyfile){
return setPasswordKey(password);
if(!keyfile.isEmpty())
return setFileKey(keyfile);
- assert(false);
+ assert(false);
}
bool Kdb3Database::setPasswordKey(const QString& Password){
@@ -860,15 +860,18 @@ bool Kdb3Database::setFileKey(const QString& filename){
if(FileSize == 32){
if(file.read((char*)RawMasterKey,32) != 32){
error=decodeFileError(file.error());
- return false;}
+ return false;
+ }
return true;
}
if(FileSize == 64){
char hex[64];
if(file.read(hex,64) != 64){
error=decodeFileError(file.error());
- return false;}
- if(convHexToBinaryKey(hex,(char*)RawMasterKey))return true;
+ return false;
+ }
+ if (convHexToBinaryKey(hex,(char*)RawMasterKey))
+ return true;
}
SHA256 sha;
unsigned char* buffer = new unsigned char[2048];
diff --git a/src/dialogs/AboutDlg.cpp b/src/dialogs/AboutDlg.cpp
index ceb3e8a..b3acc39 100644
--- a/src/dialogs/AboutDlg.cpp
+++ b/src/dialogs/AboutDlg.cpp
@@ -45,11 +45,11 @@ AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
str+="
";
str+="Tarek Saidi
"+tr("Developer, Project Admin")+"
tarek_saidi@users.sf.net
";
str+="
";
+ str+="Felix Geyer
"+tr("Developer, Project Admin")+"
sniperbeamer@users.sf.net
";
+ str+="
";
str+="Eugen Gorschenin
"+tr("Web Designer")+"
geugen@users.sf.de
";
str+="
";
str+="Juan J González Cárdenas [Jota Jota]
"+tr("Developer")+"
myxelf@users.sf.net
";
- str+="
";
- str+="Felix Geyer
"+tr("Developer")+"
sniperbeamer@users.sf.net
";
str+="
";
str+=""+tr("Thanks To")+"
";
str+="
";
diff --git a/src/dialogs/PasswordDlg.cpp b/src/dialogs/PasswordDlg.cpp
index f3949ed..b070f0a 100644
--- a/src/dialogs/PasswordDlg.cpp
+++ b/src/dialogs/PasswordDlg.cpp
@@ -210,7 +210,7 @@ void PasswordDialog::OnOK(){
return;
}
- if(Check_KeyFile->isChecked()){
+ if(Check_KeyFile->isChecked()){
/* Check wether key path exists and is readable */
QFileInfo fileinfo(KeyFile);
if(!fileinfo.exists()){
@@ -278,7 +278,7 @@ void PasswordDialog::OnOK(){
}
else if(Check_Password->isChecked()){
config->setLastKeyType(PASSWORD);
- config->setLastKeyLocation(QString());
+ config->setLastKeyLocation(QString());
}
else if(Check_KeyFile->isChecked()){
config->setLastKeyType(PASSWORD);
diff --git a/src/forms/EditEntryDlg.ui b/src/forms/EditEntryDlg.ui
index 95272c3..00a5e9b 100644
--- a/src/forms/EditEntryDlg.ui
+++ b/src/forms/EditEntryDlg.ui
@@ -243,6 +243,9 @@
true
+
+ false
+
-
diff --git a/src/forms/MainWindow.ui b/src/forms/MainWindow.ui
index f94259a..205b8b0 100644
--- a/src/forms/MainWindow.ui
+++ b/src/forms/MainWindow.ui
@@ -17,6 +17,14 @@
KeePassX
+
+
+ 0
+ 29
+ 724
+ 439
+
+
-
@@ -112,7 +120,7 @@
0
0
724
- 30
+ 29
diff --git a/src/lib/EntryView.cpp b/src/lib/EntryView.cpp
index 46ede02..116f3b7 100644
--- a/src/lib/EntryView.cpp
+++ b/src/lib/EntryView.cpp
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include "lib/AutoType.h"
#include "lib/EntryView.h"
#include "dialogs/EditEntryDlg.h"
@@ -243,15 +244,19 @@ void KeepassEntryView::OnNewEntry(){
}
void KeepassEntryView::OnEntryActivated(QTreeWidgetItem* item,int Column){
- switch(columnListIndex(Column)){
- case 0: editEntry((EntryViewItem*)item);
- break;
- case 1: OnUsernameToClipboard();
- break;
- case 2: OnEditOpenUrl();
- break;
- case 3: OnPasswordToClipboard();
- break;
+ switch (columnListIndex(Column)){
+ case 0:
+ editEntry((EntryViewItem*)item);
+ break;
+ case 1:
+ OnUsernameToClipboard();
+ break;
+ case 2:
+ OnEditOpenUrl();
+ break;
+ case 3:
+ OnPasswordToClipboard();
+ break;
}
}
@@ -266,14 +271,31 @@ void KeepassEntryView::OnEditOpenUrl(){
openBrowser( ((EntryViewItem*)selectedItems().first())->EntryHandle );
}
+void KeepassEntryView::OnEditCopyUrl(){
+ if (selectedItems().size() == 0) return;
+ QString url = ((EntryViewItem*)selectedItems().first())->EntryHandle->url();
+ if (url.startsWith("cmd://") && url.length()>6)
+ url = url.right(url.length()-6);
+
+ Clipboard->setText(url, QClipboard::Clipboard);
+ if(Clipboard->supportsSelection()){
+ Clipboard->setText(url, QClipboard::Selection);
+ }
+}
+
void KeepassEntryView::OnUsernameToClipboard(){
if (selectedItems().size() == 0) return;
- Clipboard->setText(((EntryViewItem*)selectedItems().first())->EntryHandle->username(), QClipboard::Clipboard);
+ QString username = ((EntryViewItem*)selectedItems().first())->EntryHandle->username();
+ if (username.trimmed().isEmpty()) return;
+ Clipboard->setText(username, QClipboard::Clipboard);
if(Clipboard->supportsSelection()){
- Clipboard->setText(((EntryViewItem*)selectedItems().first())->EntryHandle->username(),QClipboard::Selection);
+ Clipboard->setText(username, QClipboard::Selection);
+ }
+
+ if (config->clipboardTimeOut()!=0) {
+ ClipboardTimer.setSingleShot(true);
+ ClipboardTimer.start(config->clipboardTimeOut()*1000);
}
- ClipboardTimer.setSingleShot(true);
- ClipboardTimer.start(config->clipboardTimeOut()*1000);
}
void KeepassEntryView::OnPasswordToClipboard(){
@@ -281,12 +303,16 @@ void KeepassEntryView::OnPasswordToClipboard(){
SecString password;
password=((EntryViewItem*)selectedItems().first())->EntryHandle->password();
password.unlock();
- Clipboard->setText(password.string(),QClipboard::Clipboard);
+ if (password.string().isEmpty()) return;
+ Clipboard->setText(password.string(), QClipboard::Clipboard);
if(Clipboard->supportsSelection()){
- Clipboard->setText(password.string(),QClipboard::Selection);
+ Clipboard->setText(password.string(), QClipboard::Selection);
+ }
+
+ if (config->clipboardTimeOut()!=0) {
+ ClipboardTimer.setSingleShot(true);
+ ClipboardTimer.start(config->clipboardTimeOut()*1000);
}
- ClipboardTimer.setSingleShot(true);
- ClipboardTimer.start(config->clipboardTimeOut()*1000);
}
void KeepassEntryView::OnClipboardTimeOut(){
@@ -294,6 +320,13 @@ void KeepassEntryView::OnClipboardTimeOut(){
if(Clipboard->supportsSelection()){
Clipboard->clear(QClipboard::Selection);
}
+#ifdef Q_WS_X11
+ static bool clearKlipper = true;
+ if (clearKlipper){
+ if (QProcess::execute("dcop klipper klipper clearClipboardHistory")!=0)
+ clearKlipper = false;
+ }
+#endif
}
@@ -312,9 +345,9 @@ void KeepassEntryView::contextMenuEvent(QContextMenuEvent* e){
}
}
}
- else
- {while(selectedItems().size()){
- setItemSelected(selectedItems().first(),false);}
+ else{
+ while (selectedItems().size())
+ setItemSelected(selectedItems().first(),false);
}
e->accept();
ContextMenu->popup(e->globalPos());
@@ -621,7 +654,7 @@ bool EntryViewItem::operator<(const QTreeWidgetItem& other)const{
KpxDateTime DateThis;
KpxDateTime DateOther;
- switch(ListIndex){
+ switch (ListIndex){
case 5: DateThis=EntryHandle->expire();
DateOther=((EntryViewItem&)other).EntryHandle->expire();
break;
diff --git a/src/lib/EntryView.h b/src/lib/EntryView.h
index e7f18d4..f538569 100644
--- a/src/lib/EntryView.h
+++ b/src/lib/EntryView.h
@@ -69,6 +69,7 @@ class KeepassEntryView:public QTreeWidget{
virtual void resizeEvent(QResizeEvent* event);
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
+
private slots:
void OnColumnResized(int index,int OldSize, int NewSize);
void OnHeaderSectionClicked(int index);
@@ -91,6 +92,8 @@ class KeepassEntryView:public QTreeWidget{
void removeDragItems();
void OnColumnMoved(int LogIndex,int OldVisIndex,int NewVisIndex);
void OnEditOpenUrl();
+ void OnEditCopyUrl();
+
signals:
void fileModified();
void selectionChanged(SelectionState);
diff --git a/src/lib/random.cpp b/src/lib/random.cpp
index 0cdc646..cf0c36a 100644
--- a/src/lib/random.cpp
+++ b/src/lib/random.cpp
@@ -88,9 +88,18 @@ extern void initStdRand(){
stream << QCursor::pos();
stream << QDateTime::currentDateTime().toTime_t();
stream << QTime::currentTime().msec();
+#ifdef Q_WS_WIN
+ stream << GetCurrentProcessId();
+#else
+ stream << getpid();
+#endif
+ /* On a modern OS code, stack and heap base are randomized */
+ quint64 code_value = (quint64)initStdRand;
+ stream << code_value;
+ stream << (quint64)&code_value;
- QByteArray hash = QCryptographicHash::hash(buffer, QCryptographicHash::Md4);
+ QByteArray hash = QCryptographicHash::hash(buffer, QCryptographicHash::Sha1);
- qsrand( (uint) hash.constData() );
+ qsrand( *((uint*) hash.data()) );
initalized = true;
}
diff --git a/src/lib/tools.cpp b/src/lib/tools.cpp
index dbbf0e8..6e328c6 100644
--- a/src/lib/tools.cpp
+++ b/src/lib/tools.cpp
@@ -148,7 +148,7 @@ QString getImageFile(const QString& name){
const QIcon& getIcon(const QString& name){
- static QHashIconCache;
+ static QHashIconCache;
QIcon* CachedIcon=IconCache.value(name);
if(CachedIcon)
return *CachedIcon;
diff --git a/src/main_unix.cpp b/src/main_unix.cpp
index cb2a1a9..c6343da 100644
--- a/src/main_unix.cpp
+++ b/src/main_unix.cpp
@@ -70,5 +70,7 @@ void initAppPaths(int argc,char** argv) {
}
AppDir.truncate(AppDir.lastIndexOf("/"));
DataDir=AppDir+"/../share/keepassx";
+ if (!QFile::exists(DataDir) && QFile::exists(AppDir+"/share"))
+ DataDir=AppDir+"/share";
HomeDir = QDir::homePath()+"/.keepassx";
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 671be77..29f86c0 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -157,6 +157,7 @@ void KeepassMainWindow::setupConnections(){
connect(EditUsernameToClipboardAction, SIGNAL(triggered()), EntryView, SLOT(OnUsernameToClipboard()));
connect(EditPasswordToClipboardAction, SIGNAL(triggered()), EntryView, SLOT(OnPasswordToClipboard()));
connect(EditOpenUrlAction, SIGNAL(triggered()), EntryView, SLOT(OnEditOpenUrl()));
+ connect(EditCopyUrlAction, SIGNAL(triggered()), EntryView, SLOT(OnEditCopyUrl()));
connect(EditSaveAttachmentAction, SIGNAL(triggered()),EntryView, SLOT(OnSaveAttachment()));
connect(EditSearchAction, SIGNAL(triggered()), this, SLOT(OnSearch()));
connect(EditGroupSearchAction, SIGNAL(triggered()), this, SLOT(OnGroupSearch()));
@@ -282,6 +283,7 @@ void KeepassMainWindow::setupMenus(){
EntryView->ContextMenu->addAction(EditUsernameToClipboardAction);
EntryView->ContextMenu->addAction(EditPasswordToClipboardAction);
EntryView->ContextMenu->addAction(EditOpenUrlAction);
+ EntryView->ContextMenu->addAction(EditCopyUrlAction);
EntryView->ContextMenu->addAction(EditSaveAttachmentAction);
#ifdef AUTOTYPE
EntryView->ContextMenu->addAction(EditAutoTypeAction);
@@ -578,6 +580,7 @@ void KeepassMainWindow::setStateFileOpen(bool IsOpen){
EditPasswordToClipboardAction->setEnabled(false);
EditUsernameToClipboardAction->setEnabled(false);
EditOpenUrlAction->setEnabled(false);
+ EditCopyUrlAction->setEnabled(false);
EditSaveAttachmentAction->setEnabled(false);
EditNewEntryAction->setEnabled(false);
EditEditEntryAction->setEnabled(false);
@@ -722,6 +725,7 @@ void KeepassMainWindow::setStateEntrySelected(SelectionState s){
EditPasswordToClipboardAction->setEnabled(false);
EditUsernameToClipboardAction->setEnabled(false);
EditOpenUrlAction->setEnabled(false);
+ EditCopyUrlAction->setEnabled(false);
EditSaveAttachmentAction->setEnabled(false);
EditEditEntryAction->setEnabled(false);
EditCloneEntryAction->setEnabled(false);
@@ -736,6 +740,7 @@ void KeepassMainWindow::setStateEntrySelected(SelectionState s){
EditPasswordToClipboardAction->setEnabled(true);
EditUsernameToClipboardAction->setEnabled(true);
EditOpenUrlAction->setEnabled(true);
+ EditCopyUrlAction->setEnabled(true);
EditSaveAttachmentAction->setEnabled(((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle->binarySize() > 0);
EditEditEntryAction->setEnabled(true);
EditCloneEntryAction->setEnabled(true);
@@ -750,6 +755,7 @@ void KeepassMainWindow::setStateEntrySelected(SelectionState s){
EditPasswordToClipboardAction->setEnabled(false);
EditUsernameToClipboardAction->setEnabled(false);
EditOpenUrlAction->setEnabled(false);
+ EditCopyUrlAction->setEnabled(false);
EditSaveAttachmentAction->setEnabled(false);
EditEditEntryAction->setEnabled(false);
EditCloneEntryAction->setEnabled(true);
@@ -770,6 +776,7 @@ void KeepassMainWindow::setStateEntrySelected(SelectionState s){
EditUsernameToClipboardAction->setEnabled(false);
EditPasswordToClipboardAction->setEnabled(false);
EditOpenUrlAction->setEnabled(false);
+ EditCopyUrlAction->setEnabled(false);
EditSaveAttachmentAction->setEnabled(false);
EditEditEntryAction->setEnabled(false);
EditCloneEntryAction->setEnabled(false);
@@ -784,6 +791,7 @@ void KeepassMainWindow::setStateEntrySelected(SelectionState s){
EditUsernameToClipboardAction->setEnabled(true);
EditPasswordToClipboardAction->setEnabled(true);
EditOpenUrlAction->setEnabled(true);
+ EditCopyUrlAction->setEnabled(true);
EditSaveAttachmentAction->setEnabled(((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle->binarySize() > 0);
EditEditEntryAction->setEnabled(true);
EditCloneEntryAction->setEnabled(false);
@@ -798,6 +806,7 @@ void KeepassMainWindow::setStateEntrySelected(SelectionState s){
EditUsernameToClipboardAction->setEnabled(false);
EditPasswordToClipboardAction->setEnabled(false);
EditOpenUrlAction->setEnabled(false);
+ EditCopyUrlAction->setEnabled(false);
EditSaveAttachmentAction->setEnabled(false);
EditEditEntryAction->setEnabled(false);
EditCloneEntryAction->setEnabled(false);
@@ -833,7 +842,8 @@ bool KeepassMainWindow::OnFileSave(){
bool KeepassMainWindow::OnFileSaveAs(){
QString filename=KpxFileDialogs::saveFile(this,"MainWindow_FileSave",
tr("Save Database..."),QStringList()<
changeFile(filename)){
showErrMsg(QString("%1\n%2").arg(tr("File could not be saved.")).arg(db->getError()));
db->changeFile(QString());
diff --git a/src/res/default-detailview.html b/src/res/default-detailview.html
index 76205b1..9d18414 100644
--- a/src/res/default-detailview.html
+++ b/src/res/default-detailview.html
@@ -41,7 +41,7 @@
Password: |
%password% |
Modification: |
- %creation% |
+ %lastmod% |
Attachment: |