Added "Tools" button to EditEntryDlg: Window List and Auto-Type sequence
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@228 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
#include "PasswordGenDlg.h"
|
||||
#include "EditEntryDlg.h"
|
||||
#include "CalendarDlg.h"
|
||||
|
||||
#include "TargetWindowDlg.h"
|
||||
|
||||
CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent, bool modal, bool newEntry)
|
||||
: QDialog(parent)
|
||||
@@ -107,10 +107,6 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
||||
Edit_Comment->setPlainText(entry->comment());
|
||||
InitGroupComboBox();
|
||||
|
||||
/* MX-TO-DO: After approval, remove this invokation
|
||||
InitIconComboBox();
|
||||
*/
|
||||
|
||||
if(!entry->binarySize()){
|
||||
ButtonSaveAttachment->setDisabled(true);
|
||||
ButtonDeleteAttachment->setDisabled(true);
|
||||
@@ -126,12 +122,22 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
||||
else{
|
||||
DateTime_Expire->setDateTime(entry->expire());
|
||||
}
|
||||
|
||||
#ifdef AUTOTYPE
|
||||
QToolButton* buttonTools = new QToolButton(buttonBox);
|
||||
buttonTools->setText("Tools");
|
||||
buttonTools->setPopupMode(QToolButton::InstantPopup);
|
||||
QMenu* menuTools = new QMenu(buttonTools);
|
||||
connect(menuTools->addAction("Auto-Type: Customize Sequence"), SIGNAL(triggered(bool)), SLOT(OnCustomizeSequence()));
|
||||
#ifdef GLOBAL_AUTOTYPE
|
||||
connect(menuTools->addAction("Auto-Type: Select target window"), SIGNAL(triggered(bool)), SLOT(OnSelectTarget()));
|
||||
#endif
|
||||
buttonTools->setMenu(menuTools);
|
||||
buttonBox->addButton(buttonTools, QDialogButtonBox::ResetRole); // ResetRole: workaround to display button on the left
|
||||
#endif
|
||||
}
|
||||
|
||||
CEditEntryDlg::~CEditEntryDlg()
|
||||
{
|
||||
|
||||
|
||||
CEditEntryDlg::~CEditEntryDlg(){
|
||||
}
|
||||
|
||||
void CEditEntryDlg::resizeEvent(QResizeEvent *event){
|
||||
@@ -148,16 +154,6 @@ void CEditEntryDlg::paintEvent(QPaintEvent *event){
|
||||
painter.drawPixmap(QPoint(0,0),BannerPixmap);
|
||||
}
|
||||
|
||||
/* MX-TO-DO: After approval, remove this implementation
|
||||
|
||||
void CEditEntryDlg::InitIconComboBox(){
|
||||
for(int i=0;i<db->numIcons();i++){
|
||||
Combo_IconPicker->insertItem(i,db->icon(i),"");
|
||||
}
|
||||
Combo_IconPicker->setCurrentIndex(entry->image());
|
||||
}
|
||||
*/
|
||||
|
||||
void CEditEntryDlg::InitGroupComboBox(){
|
||||
QString Space;
|
||||
groups=db->sortedGroups();
|
||||
@@ -433,3 +429,25 @@ void CEditEntryDlg::OnCalendar(QAction* action){
|
||||
void CEditEntryDlg::OnClose(){
|
||||
config->setDialogGeometry(this);
|
||||
}
|
||||
|
||||
|
||||
void CEditEntryDlg::OnCustomizeSequence(){
|
||||
#ifdef AUTOTYPE
|
||||
QString text = Edit_Comment->toPlainText();
|
||||
if (!text.isEmpty())
|
||||
text.append("\n");
|
||||
Edit_Comment->setPlainText(text.append("Auto-Type: {USERNAME}{TAB}{PASSWORD}{ENTER}"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void CEditEntryDlg::OnSelectTarget(){
|
||||
#ifdef GLOBAL_AUTOTYPE
|
||||
TargetWindowDlg dlg(this);
|
||||
if (dlg.exec() && !dlg.windowTitle().isEmpty()){
|
||||
QString text = Edit_Comment->toPlainText();
|
||||
if (!text.isEmpty())
|
||||
text.append("\n");
|
||||
Edit_Comment->setPlainText(text.append(dlg.windowTitle()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -31,9 +31,6 @@ class CEditEntryDlg : public QDialog, private Ui_EditEntryDialog
|
||||
CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent = 0, bool modal = FALSE, bool newEntry = FALSE);
|
||||
~CEditEntryDlg();
|
||||
void InitGroupComboBox();
|
||||
/* MX-TO-DO: Remove this declaration
|
||||
void InitIconComboBox();
|
||||
*/
|
||||
static void saveAttachment(IEntryHandle* pEntry, QWidget* ParentWidget=NULL);
|
||||
|
||||
IEntryHandle* entry;
|
||||
@@ -60,14 +57,15 @@ class CEditEntryDlg : public QDialog, private Ui_EditEntryDialog
|
||||
void OnExpirePreset(QAction* action);
|
||||
void OnCalendar(QAction* action);
|
||||
void OnClose();
|
||||
void OnCustomizeSequence();
|
||||
void OnSelectTarget();
|
||||
|
||||
private:
|
||||
private:
|
||||
virtual void paintEvent(QPaintEvent*);
|
||||
virtual void resizeEvent(QResizeEvent *);
|
||||
|
||||
|
||||
int IconIndex;
|
||||
bool pNewEntry;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -448,7 +448,6 @@ void CGenPwDialog::generatePasswordInternal(char* buffer, int length){
|
||||
}
|
||||
}
|
||||
else{
|
||||
qDebug("ja");
|
||||
for (int i=0; i<length; i++)
|
||||
buffer[i] = assoctable[randint(num)];
|
||||
}
|
||||
|
||||
37
src/dialogs/TargetWindowDlg.cpp
Normal file
37
src/dialogs/TargetWindowDlg.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Felix Geyer *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; version 2 of the License. *
|
||||
* *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "TargetWindowDlg.h"
|
||||
#include "AutoType.h"
|
||||
|
||||
TargetWindowDlg::TargetWindowDlg(QWidget* parent) : QDialog(parent){
|
||||
setupUi(this);
|
||||
QStringList windowTitles = AutoType::getAllWindowTitles();
|
||||
windowTitles.sort();
|
||||
for (QStringList::const_iterator i = windowTitles.constBegin(); i != windowTitles.constEnd(); ++i)
|
||||
comboWindow->addItem(*i);
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()), SLOT(OnAccept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
||||
}
|
||||
|
||||
void TargetWindowDlg::OnAccept(){
|
||||
pWindowTitle = comboWindow->itemText(comboWindow->currentIndex());
|
||||
accept();
|
||||
}
|
||||
40
src/dialogs/TargetWindowDlg.h
Normal file
40
src/dialogs/TargetWindowDlg.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Felix Geyer *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; version 2 of the License. *
|
||||
* *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef TARGETWINDOWDLG_H
|
||||
#define TARGETWINDOWDLG_H
|
||||
|
||||
#include "ui_TargetWindowDlg.h"
|
||||
|
||||
class TargetWindowDlg : public QDialog, private Ui_TargetWindowDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TargetWindowDlg(QWidget* parent);
|
||||
inline QString windowTitle() { return pWindowTitle; };
|
||||
|
||||
private slots:
|
||||
void OnAccept();
|
||||
|
||||
private:
|
||||
QString pWindowTitle;
|
||||
};
|
||||
|
||||
#endif // TARGETWINDOWDLG_H
|
||||
Reference in New Issue
Block a user