Add feature to handle references, resolves #75

- Create popup for clone options
  - Add ability to resolve references for autotype/http/copying
This commit is contained in:
Ryan Matthews
2017-02-27 20:25:56 -05:00
parent 6bd342f63a
commit 1fe75f9420
11 changed files with 264 additions and 29 deletions

View File

@@ -41,6 +41,7 @@
#include "format/KeePass2Reader.h"
#include "gui/ChangeMasterKeyWidget.h"
#include "gui/Clipboard.h"
#include "gui/CloneDialog.h"
#include "gui/DatabaseOpenWidget.h"
#include "gui/DatabaseSettingsWidget.h"
#include "gui/KeePass1OpenWidget.h"
@@ -320,11 +321,9 @@ void DatabaseWidget::cloneEntry()
return;
}
Entry* entry = currentEntry->clone(Entry::CloneNewUuid | Entry::CloneResetTimeInfo | Entry::CloneRenameTitle);
entry->setGroup(currentEntry->group());
refreshSearch();
m_entryView->setFocus();
m_entryView->setCurrentEntry(entry);
CloneDialog* cloneDialog = new CloneDialog(this, m_db, currentEntry);
cloneDialog->show();
return;
}
void DatabaseWidget::deleteEntries()
@@ -408,7 +407,7 @@ void DatabaseWidget::copyTitle()
return;
}
setClipboardTextAndMinimize(currentEntry->title());
setClipboardTextAndMinimize(currentEntry->resolvePlaceholder(currentEntry->title()));
}
void DatabaseWidget::copyUsername()
@@ -419,7 +418,7 @@ void DatabaseWidget::copyUsername()
return;
}
setClipboardTextAndMinimize(currentEntry->username());
setClipboardTextAndMinimize(currentEntry->resolvePlaceholder(currentEntry->username()));
}
void DatabaseWidget::copyPassword()
@@ -430,7 +429,7 @@ void DatabaseWidget::copyPassword()
return;
}
setClipboardTextAndMinimize(currentEntry->password());
setClipboardTextAndMinimize(currentEntry->resolvePlaceholder(currentEntry->password()));
}
void DatabaseWidget::copyURL()
@@ -441,7 +440,7 @@ void DatabaseWidget::copyURL()
return;
}
setClipboardTextAndMinimize(currentEntry->url());
setClipboardTextAndMinimize(currentEntry->resolvePlaceholder(currentEntry->url()));
}
void DatabaseWidget::copyNotes()
@@ -452,7 +451,7 @@ void DatabaseWidget::copyNotes()
return;
}
setClipboardTextAndMinimize(currentEntry->notes());
setClipboardTextAndMinimize(currentEntry->resolvePlaceholder(currentEntry->notes()));
}
void DatabaseWidget::copyAttribute(QAction* action)
@@ -1172,7 +1171,7 @@ bool DatabaseWidget::currentEntryHasUsername()
Q_ASSERT(false);
return false;
}
return !currentEntry->username().isEmpty();
return !currentEntry->resolvePlaceholder(currentEntry->username()).isEmpty();
}
bool DatabaseWidget::currentEntryHasPassword()
@@ -1182,7 +1181,7 @@ bool DatabaseWidget::currentEntryHasPassword()
Q_ASSERT(false);
return false;
}
return !currentEntry->password().isEmpty();
return !currentEntry->resolvePlaceholder(currentEntry->password()).isEmpty();
}
bool DatabaseWidget::currentEntryHasUrl()
@@ -1192,7 +1191,7 @@ bool DatabaseWidget::currentEntryHasUrl()
Q_ASSERT(false);
return false;
}
return !currentEntry->url().isEmpty();
return !currentEntry->resolvePlaceholder(currentEntry->url()).isEmpty();
}
bool DatabaseWidget::currentEntryHasNotes()
@@ -1202,7 +1201,7 @@ bool DatabaseWidget::currentEntryHasNotes()
Q_ASSERT(false);
return false;
}
return !currentEntry->notes().isEmpty();
return !currentEntry->resolvePlaceholder(currentEntry->notes()).isEmpty();
}
GroupView* DatabaseWidget::groupView() {