16#include "ui_mainwindow.h"
20#include <QDesktopServices>
23#include <QInputDialog>
37 : QMainWindow(parent), ui(new
Ui::
MainWindow), keygen(nullptr),
42 qt_set_sequence_auto_mnemonic(
true);
46 m_qtPass =
new QtPass(
this);
49 new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q),
this, SLOT(close()));
51 new QShortcut(QKeySequence(QKeySequence::StandardKey::Copy),
this,
52 SLOT(copyPasswordFromTreeview()));
54 model.setNameFilters(QStringList() <<
"*.gpg");
55 model.setNameFilterDisables(
false);
66 QModelIndex rootDir = model.setRootPath(passStore);
67 model.fetchMore(rootDir);
70 selectionModel.reset(
new QItemSelectionModel(&proxyModel));
72 ui->treeView->setModel(&proxyModel);
73 ui->treeView->setRootIndex(proxyModel.mapFromSource(rootDir));
74 ui->treeView->setColumnHidden(1,
true);
75 ui->treeView->setColumnHidden(2,
true);
76 ui->treeView->setColumnHidden(3,
true);
77 ui->treeView->setHeaderHidden(
true);
78 ui->treeView->setIndentation(15);
79 ui->treeView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
80 ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);
81 ui->treeView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
82 ui->treeView->sortByColumn(0, Qt::AscendingOrder);
83 connect(ui->treeView, &QWidget::customContextMenuRequested,
this,
84 &MainWindow::showContextMenu);
89 ui->textBrowser->setFont(QFont(QStringLiteral(
"Monospace")));
92 ui->textBrowser->setLineWrapMode(QTextBrowser::NoWrap);
94 ui->textBrowser->setOpenExternalLinks(
true);
95 ui->textBrowser->setContextMenuPolicy(Qt::CustomContextMenu);
96 connect(ui->textBrowser, &QWidget::customContextMenuRequested,
this,
97 &MainWindow::showBrowserContextMenu);
102 clearPanelTimer.setInterval(1000 *
104 clearPanelTimer.setSingleShot(
true);
105 connect(&clearPanelTimer, SIGNAL(timeout()),
this, SLOT(clearPanel()));
107 searchTimer.setInterval(350);
108 searchTimer.setSingleShot(
true);
110 connect(&searchTimer, &QTimer::timeout,
this, &MainWindow::onTimeoutSearch);
112 initToolBarButtons();
115 ui->lineEdit->setClearButtonEnabled(
true);
119 QTimer::singleShot(10,
this, SLOT(focusInput()));
121 ui->lineEdit->setText(searchText);
123 if (!m_qtPass->
init())
125 QApplication::quit();
136void MainWindow::focusInput() {
137 ui->lineEdit->selectAll();
138 ui->lineEdit->setFocus();
146 QWidget::changeEvent(event);
147 if (event->type() == QEvent::ActivationChange) {
148 if (isActiveWindow()) {
157void MainWindow::initToolBarButtons() {
158 connect(ui->actionAddPassword, &QAction::triggered,
this,
159 &MainWindow::addPassword);
160 connect(ui->actionAddFolder, &QAction::triggered,
this,
161 &MainWindow::addFolder);
162 connect(ui->actionEdit, &QAction::triggered,
this, &MainWindow::onEdit);
163 connect(ui->actionDelete, &QAction::triggered,
this, &MainWindow::onDelete);
165 connect(ui->actionUpdate, &QAction::triggered,
this, &MainWindow::onUpdate);
166 connect(ui->actionUsers, &QAction::triggered,
this, &MainWindow::onUsers);
167 connect(ui->actionConfig, &QAction::triggered,
this, &MainWindow::onConfig);
168 connect(ui->actionOtp, &QAction::triggered,
this, &MainWindow::onOtp);
170 ui->actionAddPassword->setIcon(
171 QIcon::fromTheme(
"document-new", QIcon(
":/icons/document-new.svg")));
172 ui->actionAddFolder->setIcon(
173 QIcon::fromTheme(
"folder-new", QIcon(
":/icons/folder-new.svg")));
174 ui->actionEdit->setIcon(QIcon::fromTheme(
175 "document-properties", QIcon(
":/icons/document-properties.svg")));
176 ui->actionDelete->setIcon(
177 QIcon::fromTheme(
"edit-delete", QIcon(
":/icons/edit-delete.svg")));
178 ui->actionPush->setIcon(
179 QIcon::fromTheme(
"go-up", QIcon(
":/icons/go-top.svg")));
180 ui->actionUpdate->setIcon(
181 QIcon::fromTheme(
"go-down", QIcon(
":/icons/go-bottom.svg")));
182 ui->actionUsers->setIcon(QIcon::fromTheme(
183 "x-office-address-book", QIcon(
":/icons/x-office-address-book.svg")));
184 ui->actionConfig->setIcon(QIcon::fromTheme(
185 "applications-system", QIcon(
":/icons/applications-system.svg")));
191void MainWindow::initStatusBar() {
192 ui->statusBar->showMessage(tr(
"Welcome to QtPass %1").arg(VERSION), 2000);
194 QPixmap logo = QPixmap::fromImage(QImage(
":/artwork/icon.svg"))
195 .scaledToHeight(statusBar()->height());
196 QLabel *logoApp =
new QLabel(statusBar());
197 logoApp->setPixmap(logo);
198 statusBar()->addPermanentWidget(logoApp);
202 return ui->treeView->currentIndex();
206 this->keygen->close();
207 this->keygen =
nullptr;
213 ui->textBrowser->setTextColor(Qt::red);
216 QString _text = text;
217 if (!ui->textBrowser->toPlainText().isEmpty())
218 _text = ui->textBrowser->toHtml() + _text;
219 ui->textBrowser->setHtml(_text);
221 ui->textBrowser->setText(text);
222 ui->textBrowser->setTextColor(Qt::black);
242 if (d->result() == QDialog::Accepted) {
245 ui->textBrowser->setFont(QFont(QStringLiteral(
"Monospace")));
247 ui->textBrowser->setFont(QFont());
251 ui->textBrowser->setLineWrapMode(QTextBrowser::NoWrap);
253 ui->textBrowser->setLineWrapMode(QTextBrowser::WidgetWidth);
257 Qt::WindowFlags flags = windowFlags();
258 this->setWindowFlags(flags | Qt::WindowStaysOnTopHint);
260 this->setWindowFlags(Qt::Window);
265 ui->treeView->setRootIndex(proxyModel.mapFromSource(
271 clearPanelTimer.setInterval(1000 *
275 updateGitButtonVisibility();
276 updateOtpButtonVisibility();
291void MainWindow::onUpdate(
bool block) {
292 ui->statusBar->showMessage(tr(
"Updating password-store"), 2000);
304 ui->statusBar->showMessage(tr(
"Updating password-store"), 2000);
316QString MainWindow::getFile(
const QModelIndex &index,
bool forPass) {
317 if (!index.isValid() ||
318 !model.fileInfo(proxyModel.mapToSource(index)).isFile())
320 QString filePath = model.filePath(proxyModel.mapToSource(index));
333 bool cleared = ui->treeView->currentIndex().flags() == Qt::NoItemFlags;
335 Util::getDir(ui->treeView->currentIndex(),
false, model, proxyModel);
338 QString file = getFile(index,
true);
339 ui->passwordName->setText(getFile(index,
true));
340 if (!file.isEmpty() && !cleared) {
344 ui->actionEdit->setEnabled(
false);
345 ui->actionDelete->setEnabled(
true);
354void MainWindow::on_treeView_doubleClicked(
const QModelIndex &index) {
355 QFileInfo fileOrFolder =
356 model.fileInfo(proxyModel.mapToSource(ui->treeView->currentIndex()));
358 if (fileOrFolder.isFile()) {
359 editPassword(getFile(index,
true));
369 ui->treeView->clearSelection();
370 ui->actionEdit->setEnabled(
false);
371 ui->actionDelete->setEnabled(
false);
372 ui->passwordName->setText(
"");
377 clearTemplateWidgets();
378 ui->textBrowser->clear();
380 clearPanelTimer.stop();
390 QString output = p_output;
397 clearTemplateWidgets();
401 output =
"***" + tr(
"Content hidden") +
"***";
403 if (!password.isEmpty()) {
405 addToGridLayout(0, tr(
"Password"), password);
409 for (
int j = 0; j < namedValues.length(); ++j) {
411 addToGridLayout(j + 1, nv.
name, nv.
value);
413 if (ui->gridLayout->count() == 0)
414 ui->verticalLayoutPassword->setSpacing(0);
416 ui->verticalLayoutPassword->setSpacing(6);
422 clearPanelTimer.start();
430 if (!p_output.isEmpty()) {
431 addToGridLayout(ui->gridLayout->count() + 1, tr(
"OTP Code"), p_output);
435 clearPanelTimer.start();
443void MainWindow::clearPanel(
bool notify) {
444 while (ui->gridLayout->count() > 0) {
445 QLayoutItem *item = ui->gridLayout->takeAt(0);
446 delete item->widget();
450 QString output =
"***" + tr(
"Password and Content hidden") +
"***";
451 ui->textBrowser->setHtml(output);
453 ui->textBrowser->setHtml(
"");
463 ui->treeView->setEnabled(state);
464 ui->lineEdit->setEnabled(state);
465 ui->lineEdit->installEventFilter(
this);
466 ui->actionAddPassword->setEnabled(state);
467 ui->actionAddFolder->setEnabled(state);
468 ui->actionUsers->setEnabled(state);
469 ui->actionConfig->setEnabled(state);
471 state &= ui->treeView->currentIndex().isValid();
472 ui->actionDelete->setEnabled(state);
473 ui->actionEdit->setEnabled(state);
474 updateGitButtonVisibility();
475 updateOtpButtonVisibility();
480 restoreGeometry(geometry);
482 restoreState(savestate);
492 Qt::WindowFlags flags = windowFlags();
493 setWindowFlags(flags | Qt::WindowStaysOnTopHint);
501 QTimer::singleShot(10,
this, SLOT(hide()));
511void MainWindow::onConfig() {
config(); }
518void MainWindow::on_lineEdit_textChanged(
const QString &arg1) {
519 ui->statusBar->showMessage(tr(
"Looking for: %1").arg(arg1), 1000);
520 ui->treeView->expandAll();
522 ui->passwordName->setText(
"");
523 ui->actionEdit->setEnabled(
false);
524 ui->actionDelete->setEnabled(
false);
532void MainWindow::onTimeoutSearch() {
533 QString query = ui->lineEdit->text();
535 if (query.isEmpty()) {
536 ui->treeView->collapseAll();
540 query.replace(QStringLiteral(
" "),
".*");
541 QRegularExpression regExp(query, QRegularExpression::CaseInsensitiveOption);
542 proxyModel.setFilterRegularExpression(regExp);
543 ui->treeView->setRootIndex(proxyModel.mapFromSource(
546 if (proxyModel.rowCount() > 0 && !query.isEmpty()) {
549 ui->actionEdit->setEnabled(
false);
550 ui->actionDelete->setEnabled(
false);
559void MainWindow::on_lineEdit_returnPressed() {
561 dbg() <<
"on_lineEdit_returnPressed" << proxyModel.rowCount();
564 if (proxyModel.rowCount() > 0) {
574void MainWindow::selectFirstFile() {
575 QModelIndex index = proxyModel.mapFromSource(
577 index = firstFile(index);
578 ui->treeView->setCurrentIndex(index);
586QModelIndex MainWindow::firstFile(QModelIndex parentIndex) {
587 QModelIndex index = parentIndex;
588 int numRows = proxyModel.rowCount(parentIndex);
589 for (
int row = 0; row < numRows; ++row) {
590 index = proxyModel.index(row, 0, parentIndex);
591 if (model.fileInfo(proxyModel.mapToSource(index)).isFile())
593 if (proxyModel.hasChildren(index))
594 return firstFile(index);
604void MainWindow::setPassword(QString file,
bool isNew) {
608 ui->treeView->setFocus();
616void MainWindow::addPassword() {
619 Util::getDir(ui->treeView->currentIndex(),
true, model, proxyModel);
621 QInputDialog::getText(
this, tr(
"New file"),
622 tr(
"New password file: \n(Will be placed in %1 )")
625 true, model, proxyModel)),
626 QLineEdit::Normal,
"", &ok);
627 if (!ok || file.isEmpty())
637void MainWindow::onDelete() {
638 QModelIndex currentIndex = ui->treeView->currentIndex();
639 if (!currentIndex.isValid()) {
646 QFileInfo fileOrFolder =
647 model.fileInfo(proxyModel.mapToSource(ui->treeView->currentIndex()));
651 if (fileOrFolder.isFile()) {
652 file = getFile(ui->treeView->currentIndex(),
true);
654 file =
Util::getDir(ui->treeView->currentIndex(),
true, model, proxyModel);
658 QString dirMessage = tr(
" and the whole content?");
660 QDirIterator it(model.rootPath() + QDir::separator() + file,
661 QDirIterator::Subdirectories);
663 while (it.hasNext() && okDir) {
665 if (QFileInfo(it.filePath()).isFile()) {
666 if (QFileInfo(it.filePath()).suffix() !=
"gpg") {
668 dirMessage = tr(
" and the whole content? <br><strong>Attention: "
669 "there are unexpected files in the given folder, "
670 "check them before continue.</strong>");
676 if (QMessageBox::question(
677 this, isDir ? tr(
"Delete folder?") : tr(
"Delete password?"),
678 tr(
"Are you sure you want to delete %1%2?")
679 .arg(QDir::separator() + file, isDir ? dirMessage :
"?"),
680 QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
689void MainWindow::onOtp() {
690 QString file = getFile(ui->treeView->currentIndex(),
true);
691 if (!file.isEmpty()) {
700void MainWindow::onEdit() {
701 QString file = getFile(ui->treeView->currentIndex(),
true);
720void MainWindow::onUsers() {
723 ?
Util::getDir(ui->treeView->currentIndex(),
false, model, proxyModel)
728 ui->treeView->setFocus();
737 if (message.isEmpty()) {
740 ui->treeView->expandAll();
741 ui->lineEdit->setText(message);
742 on_lineEdit_returnPressed();
754 keygen = keygenWindow;
762void MainWindow::updateProfileBox() {
763 QHash<QString, QHash<QString, QString>> profiles =
766 if (profiles.isEmpty()) {
767 ui->profileWidget->hide();
769 ui->profileWidget->show();
770 ui->profileBox->setEnabled(profiles.size() > 1);
771 ui->profileBox->clear();
772 QHashIterator<QString, QHash<QString, QString>> i(profiles);
773 while (i.hasNext()) {
775 if (!i.key().isEmpty())
776 ui->profileBox->addItem(i.key());
778 ui->profileBox->model()->sort(0);
782 ui->profileBox->setCurrentIndex(index);
790void MainWindow::on_profileBox_currentIndexChanged(QString name) {
794 ui->lineEdit->clear();
802 ui->statusBar->showMessage(tr(
"Profile changed to %1").arg(name), 2000);
806 ui->treeView->selectionModel()->clear();
807 ui->treeView->setRootIndex(proxyModel.mapFromSource(
810 ui->actionEdit->setEnabled(
false);
811 ui->actionDelete->setEnabled(
false);
819void MainWindow::initTrayIcon() {
823 if (tray ==
nullptr) {
825 dbg() <<
"Allocating tray icon failed.";
837void MainWindow::destroyTrayIcon() {
856 if (!isMaximized()) {
872 if (obj == ui->lineEdit && event->type() == QEvent::KeyPress) {
873 auto *key =
dynamic_cast<QKeyEvent *
>(event);
874 if (key != NULL && key->key() == Qt::Key_Down) {
875 ui->treeView->setFocus();
878 return QObject::eventFilter(obj, event);
886 switch (event->key()) {
892 if (proxyModel.rowCount() > 0)
896 ui->lineEdit->clear();
908void MainWindow::showContextMenu(
const QPoint &pos) {
909 QModelIndex index = ui->treeView->indexAt(pos);
910 bool selected =
true;
911 if (!index.isValid()) {
912 ui->treeView->clearSelection();
913 ui->actionDelete->setEnabled(
false);
914 ui->actionEdit->setEnabled(
false);
919 ui->treeView->setCurrentIndex(index);
921 QPoint globalPos = ui->treeView->viewport()->mapToGlobal(pos);
923 QFileInfo fileOrFolder =
924 model.fileInfo(proxyModel.mapToSource(ui->treeView->currentIndex()));
927 if (!selected || fileOrFolder.isDir()) {
928 QAction *openFolder =
929 contextMenu.addAction(tr(
"Open folder with file manager"));
930 QAction *addFolder = contextMenu.addAction(tr(
"Add folder"));
931 QAction *addPassword = contextMenu.addAction(tr(
"Add password"));
932 QAction *users = contextMenu.addAction(tr(
"Users"));
933 connect(openFolder, &QAction::triggered,
this, &MainWindow::openFolder);
934 connect(addFolder, &QAction::triggered,
this, &MainWindow::addFolder);
935 connect(addPassword, &QAction::triggered,
this, &MainWindow::addPassword);
936 connect(users, &QAction::triggered,
this, &MainWindow::onUsers);
937 }
else if (fileOrFolder.isFile()) {
938 QAction *edit = contextMenu.addAction(tr(
"Edit"));
939 connect(edit, &QAction::triggered,
this, &MainWindow::onEdit);
949 contextMenu.addSeparator();
950 if (fileOrFolder.isDir()) {
951 QAction *renameFolder = contextMenu.addAction(tr(
"Rename folder"));
952 connect(renameFolder, &QAction::triggered,
this,
953 &MainWindow::renameFolder);
954 }
else if (fileOrFolder.isFile()) {
955 QAction *renamePassword = contextMenu.addAction(tr(
"Rename password"));
956 connect(renamePassword, &QAction::triggered,
this,
957 &MainWindow::renamePassword);
959 QAction *deleteItem = contextMenu.addAction(tr(
"Delete"));
960 connect(deleteItem, &QAction::triggered,
this, &MainWindow::onDelete);
962 contextMenu.exec(globalPos);
970void MainWindow::showBrowserContextMenu(
const QPoint &pos) {
971 QMenu *contextMenu = ui->textBrowser->createStandardContextMenu(pos);
972 QPoint globalPos = ui->textBrowser->viewport()->mapToGlobal(pos);
974 contextMenu->exec(globalPos);
981void MainWindow::openFolder() {
983 Util::getDir(ui->treeView->currentIndex(),
false, model, proxyModel);
985 QString path = QDir::toNativeSeparators(dir);
986 QDesktopServices::openUrl(QUrl::fromLocalFile(path));
992void MainWindow::addFolder() {
995 Util::getDir(ui->treeView->currentIndex(),
false, model, proxyModel);
997 QInputDialog::getText(
this, tr(
"New file"),
998 tr(
"New Folder: \n(Will be placed in %1 )")
1001 true, model, proxyModel)),
1002 QLineEdit::Normal,
"", &ok);
1003 if (!ok || newdir.isEmpty())
1005 newdir.prepend(dir);
1007 QDir().mkdir(newdir);
1013void MainWindow::renameFolder() {
1015 QString srcDir = QDir::cleanPath(
1016 Util::getDir(ui->treeView->currentIndex(),
false, model, proxyModel));
1017 QString srcDirName = QDir(srcDir).dirName();
1019 QInputDialog::getText(
this, tr(
"Rename file"), tr(
"Rename Folder To: "),
1020 QLineEdit::Normal, srcDirName, &ok);
1021 if (!ok || newName.isEmpty())
1023 QString destDir = srcDir;
1024 destDir.replace(srcDir.lastIndexOf(srcDirName), srcDirName.length(), newName);
1032void MainWindow::editPassword(
const QString &file) {
1033 if (!file.isEmpty()) {
1036 setPassword(file,
false);
1043void MainWindow::renamePassword() {
1045 QString file = getFile(ui->treeView->currentIndex(),
false);
1046 QString filePath = QFileInfo(file).path();
1047 QString fileName = QFileInfo(file).fileName();
1048 if (fileName.endsWith(
".gpg", Qt::CaseInsensitive))
1052 QInputDialog::getText(
this, tr(
"Rename file"), tr(
"Rename File To: "),
1053 QLineEdit::Normal, fileName, &ok);
1054 if (!ok || newName.isEmpty())
1056 QString newFile = QDir(filePath).filePath(newName);
1064void MainWindow::clearTemplateWidgets() {
1065 while (ui->gridLayout->count() > 0) {
1066 QLayoutItem *item = ui->gridLayout->takeAt(0);
1067 delete item->widget();
1070 ui->verticalLayoutPassword->setSpacing(0);
1073void MainWindow::copyPasswordFromTreeview() {
1074 QFileInfo fileOrFolder =
1075 model.fileInfo(proxyModel.mapToSource(ui->treeView->currentIndex()));
1077 if (fileOrFolder.isFile()) {
1078 QString file = getFile(ui->treeView->currentIndex(),
true);
1080 &MainWindow::passwordFromFileToClipboard);
1085void MainWindow::passwordFromFileToClipboard(
const QString &text) {
1086 QStringList tokens = text.split(
'\n');
1096void MainWindow::addToGridLayout(
int position,
const QString &field,
1097 const QString &value) {
1098 QString trimmedField = field.trimmed();
1099 QString trimmedValue = value.trimmed();
1102 QFrame *frame =
new QFrame();
1103 QLayout *ly =
new QHBoxLayout();
1104 ly->setContentsMargins(5, 2, 2, 2);
1106 frame->setLayout(ly);
1112 fieldLabel->setStyleSheet(
1113 "border-style: none ; background: transparent; padding: 0; margin: 0;");
1114 frame->layout()->addWidget(fieldLabel);
1121 qrbutton->setStyleSheet(
1122 "border-style: none ; background: transparent; padding: 0; margin: 0;");
1123 frame->layout()->addWidget(qrbutton);
1127 const QString lineStyle =
1129 ?
"border-style: none; background: transparent; font-family: "
1131 :
"border-style: none; background: transparent;";
1135 auto *line =
new QLineEdit();
1136 line->setObjectName(trimmedField);
1137 line->setText(trimmedValue);
1138 line->setReadOnly(
true);
1139 line->setStyleSheet(lineStyle);
1140 line->setContentsMargins(0, 0, 0, 0);
1141 line->setEchoMode(QLineEdit::Password);
1144 showButton->setStyleSheet(
1145 "border-style: none ; background: transparent; padding: 0; margin: 0;");
1146 showButton->setContentsMargins(0, 0, 0, 0);
1147 frame->layout()->addWidget(showButton);
1148 frame->layout()->addWidget(line);
1150 auto *line =
new QTextBrowser();
1151 line->setOpenExternalLinks(
true);
1152 line->setOpenLinks(
true);
1153 line->setMaximumHeight(26);
1154 line->setMinimumHeight(26);
1155 line->setSizePolicy(
1156 QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
1157 line->setObjectName(trimmedField);
1159 line->setText(trimmedValue);
1160 line->setReadOnly(true);
1161 line->setStyleSheet(lineStyle);
1162 line->setContentsMargins(0, 0, 0, 0);
1163 frame->layout()->addWidget(line);
1166 frame->setStyleSheet(
1167 ".QFrame{border: 1px solid lightgrey; border-radius: 5px;}");
1170 ui->gridLayout->addWidget(
new QLabel(trimmedField), position, 0);
1171 ui->gridLayout->addWidget(frame, position, 1);
1181 ui->statusBar->showMessage(msg, timeout);
1189 ui->treeView->setDisabled(
true);
1197void MainWindow::updateGitButtonVisibility() {
1201 enableGitButtons(
false);
1203 enableGitButtons(
true);
1207void MainWindow::updateOtpButtonVisibility() {
1208#if defined(Q_OS_WIN) || defined(__APPLE__)
1209 ui->actionOtp->setVisible(
false);
1212 ui->actionOtp->setEnabled(
false);
1214 ui->actionOtp->setEnabled(
true);
1217void MainWindow::enableGitButtons(
const bool &state) {
1219 ui->actionPush->setEnabled(state);
1220 ui->actionUpdate->setEnabled(state);
1229 QMessageBox::critical(
this, title, msg);
The ConfigDialog handles the configuration interface.
void emptyClicked()
emptyClicked event
QString getRemainingDataForDisplay() const
QString getPassword() const
NamedValues getNamedValues() const
static FileContent parse(const QString &fileContent, const QStringList &templateFields, bool allFields)
parse parses the given fileContent in a FileContent object. The password is accessible through getPas...
The MainWindow class does way too much, not only is it a switchboard, configuration handler and more,...
void startReencryptPath()
MainWindow::startReencryptPath disable ui elements and treeview.
void passShowHandler(const QString &)
void endReencryptPath()
MainWindow::endReencryptPath re-enable ui elements.
void executeWrapperStarted()
void showStatusMessage(QString msg, int timeout=2000)
Displays message in status bar.
void closeEvent(QCloseEvent *event)
MainWindow::closeEvent hide or quit.
MainWindow(const QString &searchText=QString(), QWidget *parent=nullptr)
MainWindow::MainWindow handles all of the main functionality and also the main window.
void onPush()
MainWindow::onPush do a git push.
void critical(QString, QString)
MainWindow::critical critical message popup wrapper.
void generateGPGKeyPair(QString batch)
void passOtpHandler(const QString &)
void keyPressEvent(QKeyEvent *event)
MainWindow::keyPressEvent did anyone press return, enter or escape?
bool eventFilter(QObject *obj, QEvent *event)
MainWindow::eventFilter filter out some events and focus the treeview.
const QModelIndex getCurrentTreeViewIndex()
void flashText(const QString &text, const bool isError, const bool isHtml=false)
void setUiElementsEnabled(bool state)
MainWindow::setUiElementsEnabled enable or disable the relevant UI elements.
void changeEvent(QEvent *event)
MainWindow::changeEvent sets focus to the search box.
void deselect()
MainWindow::deselect clear the selection, password and copy buffer.
void on_treeView_clicked(const QModelIndex &index)
MainWindow::on_treeView_clicked read the selected password file.
void generateKeyPair(QString, QDialog *)
MainWindow::generateKeyPair internal gpg keypair generator . .
void userDialog(QString="")
MainWindow::userDialog see MainWindow::onUsers()
void config()
MainWindow::config pops up the configuration screen and handles all inter-window communication.
void messageAvailable(QString message)
MainWindow::messageAvailable we have some text/message/search to do.
void passShowHandlerFinished(QString output)
The NamedValues class is mostly a list of NamedValue but also has a method to take a specific NamedVa...
void finishedShow(const QString &)
virtual void Remove(QString file, bool isDir)=0
virtual void Show(QString file)=0
virtual void GitPull_b()=0
virtual void Move(const QString srcDir, const QString dest, const bool force=false)=0
virtual void OtpGenerate(QString file)=0
void updateEnv()
Pass::updateEnv update the execution environment (used when switching profiles)
PasswordDialog Handles the inserting and editing of passwords.
void clearClipboard()
MainWindow::clearClipboard remove clipboard contents.
bool init()
QtPass::init make sure we are ready to go as soon as possible.
void setFreshStart(const bool &fs)
void setClippedText(const QString &, const QString &p_output=QString())
void copyTextToClipboard(const QString &text)
MainWindow::copyTextToClipboard copies text to your clipboard.
void showTextAsQRCode(const QString &text)
displays the text as qrcode
static void setMaximized(const bool &maximized)
static bool isUseAutoclearPanel(const bool &defaultValue=QVariant().toBool())
static bool isUseTemplate(const bool &defaultValue=QVariant().toBool())
static void setProfile(const QString &profile)
static bool isTemplateAllFields(const bool &defaultValue=QVariant().toBool())
static int getAutoclearPanelSeconds(const int &defaultValue=QVariant().toInt())
static bool isUseOtp(const bool &defaultValue=QVariant().toBool())
static void setPassStore(const QString &passStore)
static bool isUseGit(const bool &defaultValue=QVariant().toBool())
static bool isAlwaysOnTop(const bool &defaultValue=QVariant().toBool())
static QString getPassTemplate(const QString &defaultValue=QVariant().toString())
static QString getProfile(const QString &defaultValue=QVariant().toString())
static bool isHideOnClose(const bool &defaultValue=QVariant().toBool())
static QByteArray getGeometry(const QByteArray &defaultValue=QVariant().toByteArray())
static void setPassSigningKey(const QString &passSigningKey)
static bool isAutoPull(const bool &defaultValue=QVariant().toBool())
static QByteArray getSavestate(const QByteArray &defaultValue=QVariant().toByteArray())
static bool isUseTrayIcon(const bool &defaultValue=QVariant().toBool())
static bool isDisplayAsIs(const bool &defaultValue=QVariant().toBool())
static QHash< QString, QHash< QString, QString > > getProfiles()
static bool isStartMinimized(const bool &defaultValue=QVariant().toBool())
static void setPos(const QPoint &pos)
static Enums::clipBoardType getClipBoardType(const Enums::clipBoardType &defaultvalue=Enums::CLIPBOARD_NEVER)
static void setUsePass(const bool &usePass)
static bool isUseMonospace(const bool &defaultValue=QVariant().toBool())
static bool isUseQrencode(const bool &defaultValue=QVariant().toBool())
static bool isHideContent(const bool &defaultValue=QVariant().toBool())
static QString getPassStore(const QString &defaultValue=QVariant().toString())
static void setSavestate(const QByteArray &saveState)
static bool isNoLineWrapping(const bool &defaultValue=QVariant().toBool())
static QPoint getPos(const QPoint &defaultValue=QVariant().toPoint())
static QSize getSize(const QSize &defaultValue=QVariant().toSize())
static void setSize(const QSize &size)
static bool isMaximized(const bool &defaultValue=QVariant().toBool())
static void setGeometry(const QByteArray &geometry)
static QString getPassExecutable(const QString &defaultValue=QVariant().toString())
static QString getGitExecutable(const QString &defaultValue=QVariant().toString())
static bool isHidePassword(const bool &defaultValue=QVariant().toBool())
void setModelAndStore(QFileSystemModel *sourceModel, QString passStore)
StoreModel::setModelAndStore update the source model and store.
Handles the systemtray icon and menu.
bool getIsAllocated()
TrayIcon::getIsAllocated return if TrayIcon is allocated.
Handles listing and editing of GPG users.
static bool checkConfig()
Util::checkConfig do we have prequisite settings?
static QString findPasswordStore()
Util::findPasswordStore look for common .password-store folder location.
static QString getDir(const QModelIndex &index, bool forPass, const QFileSystemModel &model, const StoreModel &storeModel)
Util::getDir get selectd folder path.
static const QRegularExpression & protocolRegex()
static const QRegularExpression & endsWithGpg()