From 8409e57be154138fa60d06d46d6aa27690032d6e Mon Sep 17 00:00:00 2001 From: tariq Date: Wed, 25 Jan 2006 15:10:23 +0000 Subject: [PATCH] copy to clipboard (qt4), tool buttons git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@26 b624d157-de02-0410-bad0-e51aec6abb33 --- .../icons/nuvola/32x32/actions/identity.png | Bin 0 -> 1820 bytes .../icons/nuvola/32x32/actions/kgpg_info.png | Bin 1997 -> 0 bytes .../nuvola/32x32/actions/klipper_dock.png | Bin 0 -> 2658 bytes src/main.cpp | 17 +++++++- src/main.h | 5 +++ src/mainwindow.cpp | 39 +++++++++++++++++- src/mainwindow.h | 9 +++- 7 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 share/keepass/icons/nuvola/32x32/actions/identity.png delete mode 100644 share/keepass/icons/nuvola/32x32/actions/kgpg_info.png create mode 100644 share/keepass/icons/nuvola/32x32/actions/klipper_dock.png diff --git a/share/keepass/icons/nuvola/32x32/actions/identity.png b/share/keepass/icons/nuvola/32x32/actions/identity.png new file mode 100644 index 0000000000000000000000000000000000000000..b38168a2fb8c3a9faa0204d7f56ca8e931b8c97d GIT binary patch literal 1820 zcmZWqYgAKb7X1?P0xl#FR=EL%C^jn6dI?Vlh9n3GUB#mH0oK8r$U~6ILmW~H+&t_B zB^I>UVyjIUm`=xO6|Jo}(k2jr@)GM~)PZFP0xp&)7ljf?a_^+S=f^pFoj>Qt-uvux zB4hhDFOL8Z0DxCoYSK;@3jZh$%hiuoRxY@JkuOV^0dV=(80N_t*DNSc&MbewIIp}y zUX}}FImL=xVcLiC{M?FdSK**2iCIcl0fhoa0Z;1o5~x5x z2^%o(sN#T7#Tugl+AaE8-Kl%xM~|~cGaqMWlFodGU9Ub(3nbaMAT*laI1Ij_%mv5e z6IbiJ-sk2-h{MShr+(Q!V*K#($gUsV7`#U`olbXSadBRQ_J3@a2%4MEos$)*06h-Cv(zuu)Cpn{ ztDCFAJ{l&Lr-NAAeXLwO%?_r7D16kQo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! zr;yGO*14%}+quI*u85G2KO+b4zzce7ueJet&qC$eUOf$NZ>Nb?849D(Z#ki2@wWqr zI5jOa!ol1}Qo(J7+Mbv;CZVVOTngR^k*I%siIp7D#=3GIeK2onFmWsuL_D%ixKDOz z8uW`3FM8!=G=^)$8W)YdR=XxfB9NtDH9|ucQv4lbo<^@L qHGG@`Xp!UJEB^oWM2>p{4g%_D+TGt0kbKvB18K?IlP)Eqn*RZsH#C+2 literal 0 HcmV?d00001 diff --git a/share/keepass/icons/nuvola/32x32/actions/kgpg_info.png b/share/keepass/icons/nuvola/32x32/actions/kgpg_info.png deleted file mode 100644 index dc9599228f104d165b75adef7b887ab745932060..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1997 zcmXAqYgCfy7RO(B0a0E7vlKK1#f*xIOBYQY@P0W~WUi!|lZXL1r_##Pbm0Vu!%&vp zZ1Pwq$!_X6#*8)Dh005rJNpWeeO#K*GjO#pd;>46Ip`_89qXFQ)aU=T7d)J+uA1}z?o-4`!GV8Dy zh~Aqk5>t~8WJ$$o;;g;L54DOT0l+OYIW9W=*lW=|408=Uqyi{8|HMrSs1nn4yA=pGBm)64^+5AMg^5T^%%KyYFEVhk-YI)5B zRJWTu6v#c6_2<}|rt-^g0f|I{Nzf)P1ExXF1PiJ@-w*jI*VCc~di(PZ0 zt6l%pel4hWhM=mv8U-4*9>n|{WixesHn$;DkTM+9|EB3|Ap^71W5VvRjZxs)@oYAK z2u#IO6=wWwi(Yt}-lFf;BbLmz>UG&HT&!uT4thB=nr&*LtAaYFeL?VBq^e<DOdjBRtI8Tth8tDe$&F2? z+RWq{{Ly6~j-sk4rW;y%Z6qghwRF%doOL^^hN-g@QP2hmSzTQX6%-Ws7;l0^UY?t^ zj$>*yD$L@z{gpMUZNh0ufiT!B2oz6E>TIES81~gm0A0+{|sQ> zw-zz!RpadIeg8Teo%*8C^1qi&#LVE`XBG!j)l>=%#Pw{@g8Yf7k0h)gA`A`+mlX1f zpGHVW)0UTj=$c5VVo@ZNdm}2F=)G4o+tr17NDMHOc|uSG$K9XnFp02Hwg z!F96xWVXOkd=D-`GGG=K)(<Z{#yrog_Bslm=mXIp^eyyEM3fQVBcC=Xg7cwwD!dCjd5PbdsH?PY5At6^hey6u41g9_-VuWOj0U7P-=3%2ZQ}c z%5~m7SD~c^5N`Pq<_LH2x&HRzc5_B)r*-TlLE9&%W3C*9$)(Z5|8~YQX-E$5mfPGiVs<=nlthm$_^V}yLNy)<`$n@dKH|Pe9+b+I zmy*q|&RMv$Gr3tem1fSfI{Htbt1CJxOnb+AGEWDq>W9WCf``;8YavF5zFKwqD=!At!`%xJit!STI|hAe zWos|WV2aNsqCt-yZi3BkNl`ArYS4-PqL+9628}6~)zbZSk&50-Dwx^0&~7bq5K=4# z#q&W813P|+N&&%$Z}ww}JVAiIt)u4~fsxu)g=5TQQmZk1tj3+i)@XoO^F~_AQrf)} zm;s`4)96^{NRG>yx=lc-&+W&rh&e#$+@LL2{c_C7p0}XyDl_G*>d&X%lEOW$lWgH; z&;>0GudntOK2Luv@=?WBp~1B@9RzpdlizD4S2RSNN(<1K9;EM^xnSA>%}PuPXz~bF z00j}|sLE}~>2-YT@WUt2weru!nl#h~ZE5MvyDT=R!GY>1(DP>e9~TeabzR)<-oMm|usty$eAq<=@)3r^0zdBcl7npAhDXp##OeB+??@8HCho@Ctv zci7O8m=h0v^lMEL9@x=&Wb~@qt{(~o_3h{J(xq-x4HxC?jCqF;qKq{0vYUp<(d3jlAtAw_~JDRK(usdG@PeE Z06D4B)s1fe*!3R+$?;p_YGZ^2{|A>+Y)}9I diff --git a/share/keepass/icons/nuvola/32x32/actions/klipper_dock.png b/share/keepass/icons/nuvola/32x32/actions/klipper_dock.png new file mode 100644 index 0000000000000000000000000000000000000000..4759626022ccd338c8fc0fe4ebcc8317f42c1a0a GIT binary patch literal 2658 zcmWlbX;f2p6UJ{6hykxGisS;;1OjR`N&;H6EJ;`tw8&Dlv|6%Az}jlUqDBO6LNv08 zx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M_(~uz>pyut=)C{{ literal 0 HcmV?d00001 diff --git a/src/main.cpp b/src/main.cpp index 2839db7..ad6644a 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -51,6 +51,10 @@ QIcon *Icon_FileSaveAs; QIcon *Icon_Exit; QIcon *Icon_File_Export; QIcon *Icon_EditDelete; +QIcon *Icon_EditAdd; +QIcon *Icon_EditEdit; +QIcon *Icon_EditUsernameToCb; +QIcon *Icon_EditPasswordToCb; QString DateTimeFormat("no-format-string"); @@ -256,7 +260,18 @@ Icon_Exit=new QIcon(tmpImg); //-------------------------- loadImg(ThemeDir+"/actions/editdelete.png",tmpImg); Icon_EditDelete=new QIcon(tmpImg); - +//-------------------------- +loadImg(ThemeDir+"/actions/edit_add.png",tmpImg); +Icon_EditAdd=new QIcon(tmpImg); +//-------------------------- +loadImg(ThemeDir+"/actions/edit.png",tmpImg); +Icon_EditEdit=new QIcon(tmpImg); +//-------------------------- +loadImg(ThemeDir+"/actions/identity.png",tmpImg); +Icon_EditUsernameToCb=new QIcon(tmpImg); +//-------------------------- +loadImg(ThemeDir+"/actions/klipper_dock.png",tmpImg); +Icon_EditPasswordToCb=new QIcon(tmpImg); } diff --git a/src/main.h b/src/main.h index da51362..e7c6172 100644 --- a/src/main.h +++ b/src/main.h @@ -51,6 +51,11 @@ extern QIcon *Icon_FileSaveAs; extern QIcon *Icon_Exit; extern QIcon *Icon_File_Export; extern QIcon *Icon_EditDelete; +extern QIcon *Icon_EditAdd; +extern QIcon *Icon_EditEdit; +extern QIcon *Icon_EditDelete; +extern QIcon *Icon_EditUsernameToCb; +extern QIcon *Icon_EditPasswordToCb; extern QString DateTimeFormat; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bf5a6fe..f179faf 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -65,6 +65,7 @@ KeepassMainWindow::KeepassMainWindow(QWidget *parent, Qt::WFlags flags):QMainWin setupToolbar(); setStateFileOpen(false); FileOpen=false; + Clipboard=QApplication::clipboard(); } void KeepassMainWindow::setupConnections(){ @@ -86,7 +87,10 @@ void KeepassMainWindow::setupConnections(){ connect(EditEditEntryAction, SIGNAL(triggered()), this, SLOT(OnEditEditEntry())); connect(EditCloneEntryAction, SIGNAL(triggered()), this, SLOT(OnEditCloneEntry())); connect(EditDeleteEntryAction, SIGNAL(triggered()), this, SLOT(OnEditDeleteEntry())); + connect(EditUsernameToClipboardAction, SIGNAL(triggered()), this, SLOT(OnEditUsernameToClipboard())); + connect(EditPasswordToClipboardAction, SIGNAL(triggered()), this, SLOT(OnEditPasswordToClipboard())); + connect(&ClipboardTimer, SIGNAL(timeout()), this, SLOT(OnClipboardTimeOut())); connect(GroupView,SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),this, SLOT(OnCurrentGroupChanged(QTreeWidgetItem*,QTreeWidgetItem*))); connect(EntryView,SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),this, @@ -100,7 +104,12 @@ toolBar->addAction(FileNewAction); toolBar->addAction(FileOpenAction); toolBar->addAction(FileSaveAction); toolBar->addSeparator(); - +toolBar->addAction(EditNewEntryAction); +toolBar->addAction(EditEditEntryAction); +toolBar->addAction(EditDeleteEntryAction); +toolBar->addSeparator(); +toolBar->addAction(EditPasswordToClipboardAction); +toolBar->addAction(EditUsernameToClipboardAction); } void KeepassMainWindow::setupIcons(){ @@ -110,6 +119,11 @@ FileSaveAction->setIcon(*Icon_FileSave); FileSaveAsAction->setIcon(*Icon_FileSaveAs); FileCloseAction->setIcon(*Icon_FileClose); FileExitAction->setIcon(*Icon_Exit); +EditNewEntryAction->setIcon(*Icon_EditAdd); +EditEditEntryAction->setIcon(*Icon_EditEdit); +EditDeleteEntryAction->setIcon(*Icon_EditDelete); +EditPasswordToClipboardAction->setIcon(*Icon_EditPasswordToCb); +EditUsernameToClipboardAction->setIcon(*Icon_EditUsernameToCb); } @@ -456,7 +470,30 @@ setStateFileModified(true); EntryView->updateItems(); } +void KeepassMainWindow::OnEditUsernameToClipboard(){ +Clipboard->setText(currentEntry()->UserName, QClipboard::Clipboard); +ClipboardTimer.start(config.ClipboardTimeOut*1000,true); +} + +void KeepassMainWindow::OnEditPasswordToClipboard(){ +Clipboard->setText(currentEntry()->Password.getString(),QClipboard::Clipboard); +ClipboardTimer.start(config.ClipboardTimeOut*1000,true); +currentEntry()->Password.delRef(); + +} + +void KeepassMainWindow::OnClipboardTimeOut(){ +Clipboard->clear(QClipboard::Clipboard); +qDebug("Clipper cleared."); +} + + CGroup* KeepassMainWindow::currentGroup(){ Q_ASSERT(GroupView->selectedItems().size()); return static_cast(GroupView->selectedItems()[0])->pGroup; +} + +CEntry* KeepassMainWindow::currentEntry(){ +Q_ASSERT(EntryView->selectedItems().size()==1); +return static_cast(EntryView->selectedItems()[0])->pEntry; } \ No newline at end of file diff --git a/src/mainwindow.h b/src/mainwindow.h index f849d06..c3c9b95 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -34,7 +34,8 @@ #include #include #include - +#include +#include #include "PwManager.h" #include "PwmConfig.h" @@ -68,16 +69,21 @@ private slots: void OnEditEditEntry(); void OnEditCloneEntry(); void OnEditDeleteEntry(); + void OnEditUsernameToClipboard(); + void OnEditPasswordToClipboard(); void OnCurrentGroupChanged(QTreeWidgetItem*,QTreeWidgetItem*); void OnEntryItemDoubleClicked(QTreeWidgetItem* item,int column); void OnEntrySelectionChanged(); void OnGroupSelectionChanged(); + void OnClipboardTimeOut(); private: enum SelectionState{NONE,SINGLE,MULTIPLE}; SelectionState GroupSelection, EntrySelection; bool FileOpen; bool ModFlag; + QClipboard* Clipboard; + QTimer ClipboardTimer; inline void setupToolbar(); inline void setupIcons(); inline void setupConnections(); @@ -89,6 +95,7 @@ private: bool closeDatabase(); void editEntry(CEntry* pEntry); inline CGroup* currentGroup(); + inline CEntry* currentEntry();