Copy to clipboard even if field is empty (Bug: #2889145)

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@354 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 15 years ago
parent cfd3ffe6dd
commit 2275b3351b
  1. 7
      src/lib/EntryView.cpp

@ -427,7 +427,6 @@ void KeepassEntryView::OnEditOpenUrl(){
void KeepassEntryView::OnEditCopyUrl(){
if (selectedItems().size() == 0) return;
QString url = ((EntryViewItem*)selectedItems().first())->EntryHandle->url();
if (url.trimmed().isEmpty()) return;
if (url.startsWith("cmd://") && url.length()>6)
url = url.right(url.length()-6);
@ -440,13 +439,12 @@ void KeepassEntryView::OnEditCopyUrl(){
void KeepassEntryView::OnUsernameToClipboard(){
if (selectedItems().size() == 0) return;
QString username = ((EntryViewItem*)selectedItems().first())->EntryHandle->username();
if (username.trimmed().isEmpty()) return;
Clipboard->setText(username, QClipboard::Clipboard);
if(Clipboard->supportsSelection()){
Clipboard->setText(username, QClipboard::Selection);
}
if (config->clipboardTimeOut()!=0) {
if (config->clipboardTimeOut()!=0 && !username.trimmed().isEmpty()) {
ClipboardTimer.setSingleShot(true);
ClipboardTimer.start(config->clipboardTimeOut()*1000);
}
@ -457,13 +455,12 @@ void KeepassEntryView::OnPasswordToClipboard(){
SecString password;
password=((EntryViewItem*)selectedItems().first())->EntryHandle->password();
password.unlock();
if (password.string().isEmpty()) return;
Clipboard->setText(password.string(), QClipboard::Clipboard);
if(Clipboard->supportsSelection()){
Clipboard->setText(password.string(), QClipboard::Selection);
}
if (config->clipboardTimeOut()!=0) {
if (config->clipboardTimeOut()!=0 && !password.string().isEmpty()) {
ClipboardTimer.setSingleShot(true);
ClipboardTimer.start(config->clipboardTimeOut()*1000);
}