diff --git a/share/keepass/icons/nuvola/32x32/actions/editcopy.png b/share/keepass/icons/nuvola/32x32/actions/editcopy.png new file mode 100644 index 0000000..18627b7 Binary files /dev/null and b/share/keepass/icons/nuvola/32x32/actions/editcopy.png differ diff --git a/share/keepass/icons/nuvola/32x32/actions/run.png b/share/keepass/icons/nuvola/32x32/actions/run.png new file mode 100644 index 0000000..db5111a Binary files /dev/null and b/share/keepass/icons/nuvola/32x32/actions/run.png differ diff --git a/src/dialogs/EditEntryDlg.cpp b/src/dialogs/EditEntryDlg.cpp index 510f4cb..970cc61 100755 --- a/src/dialogs/EditEntryDlg.cpp +++ b/src/dialogs/EditEntryDlg.cpp @@ -279,13 +279,17 @@ ButtonSaveAttachment->setEnabled(true); ButtonDeleteAttachment->setEnabled(true); } -void CEditEntryDlg::OnSaveAttachment() +void CEditEntryDlg::OnSaveAttachment(){ +saveAttachment(entry,this); +} + +void CEditEntryDlg::saveAttachment(CEntry* pEntry, QWidget* ParentWidget) { -QString filename=Q3FileDialog::getSaveFileName(QDir::homeDirPath(),"",this,trUtf8("Anhang speichern...")); +QString filename=Q3FileDialog::getSaveFileName(QDir::homeDirPath(),"",ParentWidget,trUtf8("Anhang speichern...")); if(filename=="")return; QFile file(filename); if(file.exists()){ -int r=QMessageBox::warning(this,QString::fromUtf8("Vorhandene Datei überschreiben?"),QString::fromUtf8("Unter dem gewählten Dateinamen existiert bereits eine Datei.\nSoll sie überschrieben werden?"),"Ja","Nein",NULL,1,1); +int r=QMessageBox::warning(ParentWidget,QString::fromUtf8("Vorhandene Datei überschreiben?"),QString::fromUtf8("Unter dem gewählten Dateinamen existiert bereits eine Datei.\nSoll sie überschrieben werden?"),"Ja","Nein",NULL,1,1); if(r==1)return; if(file.remove()==false){ QMessageBox::critical(NULL,"Fehler",QString::fromUtf8("Datei konnte nicht überschrieben werden."),"OK"); @@ -296,13 +300,13 @@ QMessageBox::critical(NULL,"Fehler",QString::fromUtf8("Datei konnte nicht erstel return; } -int r=file.write(entry->BinaryData); +int r=file.write(pEntry->BinaryData); if(r==-1){ file.close(); QMessageBox::critical(NULL,"Fehler",QString::fromUtf8("Beim schreiben in der Datei ist ein Fehler aufgetreten."),"OK"); return; } -if(r!=entry->BinaryData.length()){ +if(r!=pEntry->BinaryData.length()){ file.close(); QMessageBox::critical(NULL,"Fehler",QString::fromUtf8("Die Datei konnte nicht vollständig geschrieben werden."),"OK"); return; diff --git a/src/dialogs/EditEntryDlg.h b/src/dialogs/EditEntryDlg.h index 840d4ad..50bd2a3 100755 --- a/src/dialogs/EditEntryDlg.h +++ b/src/dialogs/EditEntryDlg.h @@ -56,6 +56,7 @@ bool ModFlag; void CreateBanner(); void InitGroupComboBox(); void InitIconComboBox(); +static void saveAttachment(CEntry* pEntry, QWidget* ParentWidget=NULL); public slots: diff --git a/src/forms/MainWindow.ui b/src/forms/MainWindow.ui index 0c0f70c..317fe97 100644 --- a/src/forms/MainWindow.ui +++ b/src/forms/MainWindow.ui @@ -158,7 +158,7 @@ - + @@ -284,7 +284,7 @@ Benutzername in Zwischenablage kopieren - + URL öffnen @@ -328,16 +328,16 @@ - KeepassEntryView + KeepassGroupView QTreeWidget -
../../src/lib/EntryView.h
+
../../src/lib/GroupView.h
0
- KeepassGroupView + KeepassEntryView QTreeWidget -
../../src/lib/GroupView.h
+
../../src/lib/EntryView.h
0
diff --git a/src/main.cpp b/src/main.cpp index ad6644a..5e8ad2c 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "main.h" #include "PwmConfig.h" @@ -64,13 +65,6 @@ inline void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& Arg int main(int argc, char **argv) { -/* -QStringList keys=QStyleFactory::keys(); -for(int i=0; isetPixmap(*banner_pixmap); void openBrowser(QString url){ - - - +QProcess browser; +QStringList args=QStringList::split(' ',config.OpenUrlCommand.arg(url)); +QString cmd=args.takeFirst(); +browser.startDetached(cmd,args); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f179faf..938bee0 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -89,6 +89,8 @@ void KeepassMainWindow::setupConnections(){ connect(EditDeleteEntryAction, SIGNAL(triggered()), this, SLOT(OnEditDeleteEntry())); connect(EditUsernameToClipboardAction, SIGNAL(triggered()), this, SLOT(OnEditUsernameToClipboard())); connect(EditPasswordToClipboardAction, SIGNAL(triggered()), this, SLOT(OnEditPasswordToClipboard())); + connect(EditOpenUrlAction, SIGNAL(triggered()), this, SLOT(OnEditOpenUrl())); + connect(EditSaveAttachmentAction, SIGNAL(triggered()), this, SLOT(OnEditSaveAttachment())); connect(&ClipboardTimer, SIGNAL(timeout()), this, SLOT(OnClipboardTimeOut())); connect(GroupView,SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),this, @@ -234,7 +236,7 @@ if(!IsOpen){ EditDeleteGroupAction->setEnabled(false); EditPasswordToClipboardAction->setEnabled(false); EditUsernameToClipboardAction->setEnabled(false); - OpenUrlAction->setEnabled(false); + EditOpenUrlAction->setEnabled(false); EditSaveAttachmentAction->setEnabled(false); EditNewEntryAction->setEnabled(false); EditEditEntryAction->setEnabled(false); @@ -289,7 +291,7 @@ switch(EntrySelection){ case NONE: EditPasswordToClipboardAction->setEnabled(false); EditUsernameToClipboardAction->setEnabled(false); - OpenUrlAction->setEnabled(false); + EditOpenUrlAction->setEnabled(false); EditSaveAttachmentAction->setEnabled(false); EditEditEntryAction->setEnabled(false); EditCloneEntryAction->setEnabled(false); @@ -300,7 +302,7 @@ switch(EntrySelection){ case SINGLE: EditPasswordToClipboardAction->setEnabled(true); EditUsernameToClipboardAction->setEnabled(true); - OpenUrlAction->setEnabled(true); + EditOpenUrlAction->setEnabled(true); EditSaveAttachmentAction->setEnabled(true); EditEditEntryAction->setEnabled(true); EditCloneEntryAction->setEnabled(true); @@ -311,7 +313,7 @@ switch(EntrySelection){ case MULTIPLE: EditPasswordToClipboardAction->setEnabled(false); EditUsernameToClipboardAction->setEnabled(false); - OpenUrlAction->setEnabled(false); + EditOpenUrlAction->setEnabled(false); EditSaveAttachmentAction->setEnabled(false); EditEditEntryAction->setEnabled(false); EditCloneEntryAction->setEnabled(true); @@ -487,6 +489,14 @@ Clipboard->clear(QClipboard::Clipboard); qDebug("Clipper cleared."); } +void KeepassMainWindow::OnEditSaveAttachment(){ +CEditEntryDlg::saveAttachment(currentEntry(),this); +} + +void KeepassMainWindow::OnEditOpenUrl(){ +openBrowser(currentEntry()->URL); +} + CGroup* KeepassMainWindow::currentGroup(){ Q_ASSERT(GroupView->selectedItems().size()); diff --git a/src/mainwindow.h b/src/mainwindow.h index c3c9b95..3e65b27 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -71,6 +71,8 @@ private slots: void OnEditDeleteEntry(); void OnEditUsernameToClipboard(); void OnEditPasswordToClipboard(); + void OnEditSaveAttachment(); + void OnEditOpenUrl(); void OnCurrentGroupChanged(QTreeWidgetItem*,QTreeWidgetItem*); void OnEntryItemDoubleClicked(QTreeWidgetItem* item,int column); void OnEntrySelectionChanged();