implemented "Open Url" and "Save Attachement"

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@29 b624d157-de02-0410-bad0-e51aec6abb33
master
tariq 18 years ago
parent 9d2b50b9c3
commit 69f00ee477
  1. BIN
      share/keepass/icons/nuvola/32x32/actions/editcopy.png
  2. BIN
      share/keepass/icons/nuvola/32x32/actions/run.png
  3. 14
      src/dialogs/EditEntryDlg.cpp
  4. 1
      src/dialogs/EditEntryDlg.h
  5. 12
      src/forms/MainWindow.ui
  6. 19
      src/main.cpp
  7. 18
      src/mainwindow.cpp
  8. 2
      src/mainwindow.h

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -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;

@ -56,6 +56,7 @@ bool ModFlag;
void CreateBanner();
void InitGroupComboBox();
void InitIconComboBox();
static void saveAttachment(CEntry* pEntry, QWidget* ParentWidget=NULL);
public slots:

@ -158,7 +158,7 @@
<addaction name="separator" />
<addaction name="EditPasswordToClipboardAction" />
<addaction name="EditUsernameToClipboardAction" />
<addaction name="OpenUrlAction" />
<addaction name="EditOpenUrlAction" />
<addaction name="EditSaveAttachmentAction" />
<addaction name="separator" />
<addaction name="EditNewEntryAction" />
@ -284,7 +284,7 @@
<string>Benutzername in Zwischenablage kopieren</string>
</property>
</action>
<action name="OpenUrlAction" >
<action name="EditOpenUrlAction" >
<property name="text" >
<string>URL öffnen</string>
</property>
@ -328,16 +328,16 @@
<pixmapfunction></pixmapfunction>
<customwidgets>
<customwidget>
<class>KeepassEntryView</class>
<class>KeepassGroupView</class>
<extends>QTreeWidget</extends>
<header>../../src/lib/EntryView.h</header>
<header>../../src/lib/GroupView.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>
<customwidget>
<class>KeepassGroupView</class>
<class>KeepassEntryView</class>
<extends>QTreeWidget</extends>
<header>../../src/lib/GroupView.h</header>
<header>../../src/lib/EntryView.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>

@ -28,6 +28,7 @@
#include <QPainter>
#include <QImage>
#include <QStyleFactory>
#include <QProcess>
#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; i<keys.size(); i++){
cout << keys[i].ascii() << endl;
}
QApplication::setStyle(QStyleFactory::create("slimplastic"));
*/
QApplication* app=new QApplication(argc,argv);
QString ArgFile,ArgCfg,IniFilename;
parseCmdLineArgs(argc,argv,ArgFile,ArgCfg);
@ -137,10 +131,6 @@ return r;
void createBanner(QLabel *Banner,QPixmap* symbol,QString text){
createBanner(Banner,symbol,text,config.BannerColor1
,config.BannerColor2
@ -193,9 +183,10 @@ Banner->setPixmap(*banner_pixmap);
void openBrowser(QString url){
QProcess browser;
QStringList args=QStringList::split(' ',config.OpenUrlCommand.arg(url));
QString cmd=args.takeFirst();
browser.startDetached(cmd,args);
}

@ -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());

@ -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();