Skip to content
Permalink
Browse files

Added 'Copy username' & 'Copy password' in right-click menu

Fixes #10
  • Loading branch information...
Nichlas Severinsen
Nichlas Severinsen committed Dec 28, 2017
1 parent 0f94847 commit b2f7e0d768a94cb99d205b653e6755d5306900a6
Showing with 36 additions and 0 deletions.
  1. +34 −0 qtclient/accountactionbar.cpp
  2. +2 −0 qtclient/accountactionbar.h
@@ -100,6 +100,8 @@ void AccountActionBar::defaultAction(esdbEntry *entry)
QAction *loginAction = menu->addAction("Login");
QAction *usernameAction = menu->addAction("Username");
QAction *passwordAction = menu->addAction("Password");
QAction *copyUsernameAction = menu->addAction("Copy username");
QAction *copyPasswordAction = menu->addAction("Copy password");
menu->addSeparator();
QAction *openAction = menu->addAction("Open");
QAction *deleteAction = menu->addAction("Delete");
@@ -110,6 +112,8 @@ void AccountActionBar::defaultAction(esdbEntry *entry)
connect(passwordAction, SIGNAL(triggered(bool)), this, SLOT(typeAccountPassUI()));
connect(openAction, SIGNAL(triggered(bool)), this, SLOT(openAccountUI()));
connect(deleteAction, SIGNAL(triggered(bool)), this, SLOT(deleteAccountUI()));
connect(copyUsernameAction, SIGNAL(triggered(bool)), this, SLOT(copyUsername()));
connect(copyPasswordAction, SIGNAL(triggered(bool)), this, SLOT(copyPassword()));
switch (m_quickTypeState) {
case QUICKTYPE_STATE_INITIAL:
menu->setActiveAction(browseAction);
@@ -229,6 +233,36 @@ void AccountActionBar::deleteAccountFinished(int code)
m_parent->finishTask();
}

void AccountActionBar::copyUsername()
{
account *acct = (account *)selectedEntry();
int id = acct->id;
m_buttonWaitDialog = new ButtonWaitDialog(
"Copy username",
"Copy username \"" + acct->acctName + "\"",
m_parent);
connect(m_buttonWaitDialog, SIGNAL(finished(int)), this, SLOT(openAccountFinished(int)));
m_buttonWaitDialog->show();
m_accessUsername = true;
m_accessPassword = false;
m_parent->beginIDTask(id, LoggedInWidget::ID_TASK_READ, COPY_DATA, this);
}

void AccountActionBar::copyPassword()
{
account *acct = (account *)selectedEntry();
int id = acct->id;
m_buttonWaitDialog = new ButtonWaitDialog(
"Copy password",
"Copy password \"" + acct->acctName + "\"",
m_parent);
connect(m_buttonWaitDialog, SIGNAL(finished(int)), this, SLOT(openAccountFinished(int)));
m_buttonWaitDialog->show();
m_accessUsername = false;
m_accessPassword = true;
m_parent->beginIDTask(id, LoggedInWidget::ID_TASK_READ, COPY_DATA, this);
}

void AccountActionBar::openAccount(account *acct)
{
int id = acct->id;
@@ -70,6 +70,8 @@ public slots:
void accessAccountFinished(int);
void openAccountFinished(int);
void deleteAccountFinished(int);
void copyUsername();
void copyPassword();
};

#endif // ACCOUNTACTIONBAR_H

0 comments on commit b2f7e0d

Please sign in to comment.
You can’t perform that action at this time.