-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewentrydialog.cpp
69 lines (51 loc) · 1.52 KB
/
viewentrydialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "viewentrydialog.h"
#include "ui_viewentrydialog.h"
#include "editdialog.h"
#include <QClipboard>
#include <QThread>
viewEntryDialog::viewEntryDialog(QWidget *parent, int id, QString website, QString uname, QString password, QString comment, QString keyX) :
QDialog(parent),
ui(new Ui::viewEntryDialog)
{
key = keyX;
Pass = password;
this->uname = uname;
ed = new editDialog(this,id, website, uname, password, comment,key);
ui->setupUi(this);
ui->website->setText(website);
ui->uname->setText(uname);
ui->password->setText(password);
ui->comment->setText(comment);
}
viewEntryDialog::~viewEntryDialog()
{
delete ui;
}
void viewEntryDialog::on_editBtn_clicked()
{
ed->setModal(true);
this->hide();
ed->exec();
}
void viewEntryDialog::on_cpyPass_clicked()
{
QClipboard* clipboard = QApplication::clipboard();
clipboard->setText(Pass, QClipboard::Clipboard);
if (clipboard->supportsSelection()) {
clipboard->setText(Pass, QClipboard::Selection);
}
#if defined(Q_OS_LINUX)
QThread::msleep(1); //workaround for copied text not being available...
#endif
}
void viewEntryDialog::on_cpyUname_clicked()
{
QClipboard* clipboard = QApplication::clipboard();
clipboard->setText(uname, QClipboard::Clipboard);
if (clipboard->supportsSelection()) {
clipboard->setText(uname, QClipboard::Selection);
}
#if defined(Q_OS_LINUX)
QThread::msleep(1); //workaround for copied text not being available...
#endif
}