From e281b7c5140ba821bab165a5f1fcfd3ce1f2f997 Mon Sep 17 00:00:00 2001 From: tariq Date: Mon, 10 Apr 2006 10:21:56 +0000 Subject: [PATCH] work on Auto-Type feature, the save attachment file dialog now adopts the entry.BinaryDesc string as default filename git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@74 b624d157-de02-0410-bad0-e51aec6abb33 --- changelog | 4 +++- src/dialogs/EditEntryDlg.cpp | 11 +++++++---- src/lib/AutoType.cpp | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/changelog b/changelog index 7a07c5c..dfe08dc 100644 --- a/changelog +++ b/changelog @@ -1,7 +1,9 @@ --------------- 0.2.1 --------------- - +-Auto-Type +-Custom Icons Extension +-when saving an attachment the original filename is adopted by the file dialog --------------- 0.2.0 --------------- diff --git a/src/dialogs/EditEntryDlg.cpp b/src/dialogs/EditEntryDlg.cpp index 2c49492..6ba1ef6 100755 --- a/src/dialogs/EditEntryDlg.cpp +++ b/src/dialogs/EditEntryDlg.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include //Added by qt3to4: @@ -260,7 +260,7 @@ Edit_Password_w->setPaletteBackgroundColor(QColor(255,255,255)); ///@FIXME Stand void CEditEntryDlg::OnNewAttachment() { -QString filename=Q3FileDialog::getOpenFileName(QDir::homeDirPath(),"",this,QString::fromUtf8("Anhang hinzufügen...")); +QString filename=QFileDialog::getOpenFileName(this,tr("Add Attachment..."),QDir::homeDirPath()); if(filename=="")return; QFile file(filename); if(file.open(QIODevice::ReadOnly)==false){ @@ -294,8 +294,11 @@ saveAttachment(entry,this); void CEditEntryDlg::saveAttachment(CEntry* pEntry, QWidget* ParentWidget) { -QString filename=Q3FileDialog::getSaveFileName(QDir::homeDirPath(),"",ParentWidget,tr("Save Attachment...")); -if(filename=="")return; +QFileDialog FileDlg(ParentWidget,tr("Save Attachment..."),QDir::homeDirPath()); +FileDlg.selectFile(pEntry->BinaryDesc); +FileDlg.setAcceptMode(QFileDialog::AcceptSave); +if(!FileDlg.exec())return; +QString filename=FileDlg.selectedFiles()[0]; QFile file(filename); if(file.exists()){ int r=QMessageBox::warning(ParentWidget,tr("Overwrite?"),tr("A file with this name already exists.\nDo you want to replace it?"),tr("Yes"),tr("No"),NULL,1,1); diff --git a/src/lib/AutoType.cpp b/src/lib/AutoType.cpp index 27a02e0..c9f20ff 100644 --- a/src/lib/AutoType.cpp +++ b/src/lib/AutoType.cpp @@ -79,6 +79,27 @@ if(c==1){ else str="{USERNAME}{TAB}{PASSWORD}{ENTER}"; +/* +KeePass/Win template compatibility: +only supported syntax is:{TEMPLATE-NAME} +%TEMPLATE-NAME% syntax is not supported! +*/ + +str.replace("{TITLE}",entry->Title,Qt::CaseInsensitive); +str.replace("{USERNAME}",entry->UserName,Qt::CaseInsensitive); +entry->Password.unlock(); +str.replace("{PASSWORD}",entry->Password.string(),Qt::CaseInsensitive); +entry->Password.lock(); +str.replace("{URL}",entry->URL,Qt::CaseInsensitive); +str.replace("{SPACE}",QString(" "),Qt::CaseInsensitive); +str.replace("{ADD}",QString("+"),Qt::CaseInsensitive); +str.replace("{SUBTRACT}",QString("-"),Qt::CaseInsensitive); +str.replace("{DIVIDE}",QString("/"),Qt::CaseInsensitive); +str.replace("{MULTIPLY}",QString("*"),Qt::CaseInsensitive); +str.replace("{PLUS}",QString("+"),Qt::CaseInsensitive); + + + QList Keys; for(int i=0;i