|
|
@ -43,7 +43,7 @@ |
|
|
|
#include "dialogs/ManageBookmarksDlg.h" |
|
|
|
#include "dialogs/ManageBookmarksDlg.h" |
|
|
|
#include "dialogs/HelpDlg.h" |
|
|
|
#include "dialogs/HelpDlg.h" |
|
|
|
|
|
|
|
|
|
|
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_MAC) |
|
|
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_OS_MAC) |
|
|
|
#include "lib/HelperMacX.h" |
|
|
|
#include "lib/HelperMacX.h" |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
@ -53,7 +53,7 @@ Import_KWalletXml import_KWalletXml; |
|
|
|
Export_Txt export_Txt; |
|
|
|
Export_Txt export_Txt; |
|
|
|
Export_KeePassX_Xml export_KeePassX_Xml; |
|
|
|
Export_KeePassX_Xml export_KeePassX_Xml; |
|
|
|
|
|
|
|
|
|
|
|
KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,bool ArgMin,bool ArgLock,QWidget *parent, Qt::WFlags flags) :QMainWindow(parent,flags){ |
|
|
|
KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,bool ArgMin,bool ArgLock,QWidget *parent, Qt::WindowFlags flags) :QMainWindow(parent,flags){ |
|
|
|
ShutingDown=false; |
|
|
|
ShutingDown=false; |
|
|
|
IsLocked=false; |
|
|
|
IsLocked=false; |
|
|
|
EventOccurred=true; |
|
|
|
EventOccurred=true; |
|
|
@ -62,7 +62,7 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,bool ArgMin,bool Arg |
|
|
|
unlockDlg=NULL; |
|
|
|
unlockDlg=NULL; |
|
|
|
db=NULL; |
|
|
|
db=NULL; |
|
|
|
setupUi(this); |
|
|
|
setupUi(this); |
|
|
|
#ifdef Q_WS_MAC |
|
|
|
#ifdef Q_OS_MAC |
|
|
|
setUnifiedTitleAndToolBarOnMac(true); |
|
|
|
setUnifiedTitleAndToolBarOnMac(true); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#ifdef AUTOTYPE |
|
|
|
#ifdef AUTOTYPE |
|
|
@ -89,7 +89,7 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,bool ArgMin,bool Arg |
|
|
|
//statusBar()->addWidget(StatusBarSelection,85);
|
|
|
|
//statusBar()->addWidget(StatusBarSelection,85);
|
|
|
|
statusBar()->setVisible(config->showStatusbar()); |
|
|
|
statusBar()->setVisible(config->showStatusbar()); |
|
|
|
setStatusBarMsg(StatusBarReady); |
|
|
|
setStatusBarMsg(StatusBarReady); |
|
|
|
#ifndef Q_WS_MAC |
|
|
|
#ifndef Q_OS_MAC |
|
|
|
if (config->alwaysOnTop()) |
|
|
|
if (config->alwaysOnTop()) |
|
|
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); |
|
|
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -190,7 +190,7 @@ void KeepassMainWindow::setupConnections(){ |
|
|
|
connect(ViewToolButtonSize22Action,SIGNAL(toggled(bool)), this, SLOT(OnViewToolbarIconSize22(bool))); |
|
|
|
connect(ViewToolButtonSize22Action,SIGNAL(toggled(bool)), this, SLOT(OnViewToolbarIconSize22(bool))); |
|
|
|
connect(ViewToolButtonSize28Action,SIGNAL(toggled(bool)), this, SLOT(OnViewToolbarIconSize28(bool))); |
|
|
|
connect(ViewToolButtonSize28Action,SIGNAL(toggled(bool)), this, SLOT(OnViewToolbarIconSize28(bool))); |
|
|
|
connect(ViewShowStatusbarAction,SIGNAL(toggled(bool)),statusBar(),SLOT(setVisible(bool))); |
|
|
|
connect(ViewShowStatusbarAction,SIGNAL(toggled(bool)),statusBar(),SLOT(setVisible(bool))); |
|
|
|
#ifdef Q_WS_MAC |
|
|
|
#ifdef Q_OS_MAC |
|
|
|
connect(ViewMinimizeAction, SIGNAL(triggered()), SLOT(showMinimized())); |
|
|
|
connect(ViewMinimizeAction, SIGNAL(triggered()), SLOT(showMinimized())); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
@ -331,7 +331,7 @@ void KeepassMainWindow::setupMenus(){ |
|
|
|
case 28: ViewToolButtonSize28Action->setChecked(true); break; |
|
|
|
case 28: ViewToolButtonSize28Action->setChecked(true); break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifdef Q_WS_MAC |
|
|
|
#ifdef Q_OS_MAC |
|
|
|
ViewMenu->addSeparator(); |
|
|
|
ViewMenu->addSeparator(); |
|
|
|
ViewMenu->addAction(ViewMinimizeAction); |
|
|
|
ViewMenu->addAction(ViewMinimizeAction); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -382,7 +382,7 @@ void KeepassMainWindow::setupMenus(){ |
|
|
|
#ifdef AUTOTYPE |
|
|
|
#ifdef AUTOTYPE |
|
|
|
EditAutoTypeAction->setShortcut(tr("Ctrl+V")); |
|
|
|
EditAutoTypeAction->setShortcut(tr("Ctrl+V")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#ifdef Q_WS_MAC |
|
|
|
#ifdef Q_OS_MAC |
|
|
|
FileSaveAsAction->setShortcut(tr("Shift+Ctrl+S")); |
|
|
|
FileSaveAsAction->setShortcut(tr("Shift+Ctrl+S")); |
|
|
|
EditGroupSearchAction->setShortcut(tr("Shift+Ctrl+F")); |
|
|
|
EditGroupSearchAction->setShortcut(tr("Shift+Ctrl+F")); |
|
|
|
ViewMinimizeAction->setShortcut(tr("Ctrl+M")); |
|
|
|
ViewMinimizeAction->setShortcut(tr("Ctrl+M")); |
|
|
@ -437,7 +437,7 @@ bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){ |
|
|
|
QPushButton* readOnlyButton = new QPushButton(tr("Open read-only"), &msgBox); |
|
|
|
QPushButton* readOnlyButton = new QPushButton(tr("Open read-only"), &msgBox); |
|
|
|
msgBox.addButton(readOnlyButton, QMessageBox::AcceptRole); |
|
|
|
msgBox.addButton(readOnlyButton, QMessageBox::AcceptRole); |
|
|
|
msgBox.setDefaultButton(readOnlyButton); |
|
|
|
msgBox.setDefaultButton(readOnlyButton); |
|
|
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_MAC) |
|
|
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_OS_MAC) |
|
|
|
// On MacX, QMessageBox is not brought to foreground on exec() when app not already there
|
|
|
|
// On MacX, QMessageBox is not brought to foreground on exec() when app not already there
|
|
|
|
HelperMacX::processToFront(HelperMacX::getKeepassxPID()); |
|
|
|
HelperMacX::processToFront(HelperMacX::getKeepassxPID()); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -462,7 +462,7 @@ bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){ |
|
|
|
dlg.setWindowModality(Qt::WindowModal); |
|
|
|
dlg.setWindowModality(Qt::WindowModal); |
|
|
|
unlockDlg = &dlg; |
|
|
|
unlockDlg = &dlg; |
|
|
|
} |
|
|
|
} |
|
|
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_MAC) |
|
|
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_OS_MAC) |
|
|
|
// On MacX, QMessageBox is not brought to foreground on exec() when app not already there
|
|
|
|
// On MacX, QMessageBox is not brought to foreground on exec() when app not already there
|
|
|
|
HelperMacX::processToFront(HelperMacX::getKeepassxPID()); |
|
|
|
HelperMacX::processToFront(HelperMacX::getKeepassxPID()); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -590,7 +590,7 @@ void KeepassMainWindow::OnFileNewKdb(){ |
|
|
|
IDatabase* db_new=dynamic_cast<IDatabase*>(new Kdb3Database()); |
|
|
|
IDatabase* db_new=dynamic_cast<IDatabase*>(new Kdb3Database()); |
|
|
|
db_new->create(); |
|
|
|
db_new->create(); |
|
|
|
PasswordDialog dlg(this,PasswordDialog::Mode_Set,PasswordDialog::Flag_None,"New Database"); |
|
|
|
PasswordDialog dlg(this,PasswordDialog::Mode_Set,PasswordDialog::Flag_None,"New Database"); |
|
|
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_MAC) |
|
|
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_OS_MAC) |
|
|
|
// On MacX, QMessageBox is not brought to foreground on exec()
|
|
|
|
// On MacX, QMessageBox is not brought to foreground on exec()
|
|
|
|
HelperMacX::processToFront(HelperMacX::getKeepassxPID()); |
|
|
|
HelperMacX::processToFront(HelperMacX::getKeepassxPID()); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -742,27 +742,27 @@ void KeepassMainWindow::updateDetailView(){ |
|
|
|
QString templ=DetailViewTemplate; |
|
|
|
QString templ=DetailViewTemplate; |
|
|
|
IEntryHandle* entry=((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle; |
|
|
|
IEntryHandle* entry=((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle; |
|
|
|
|
|
|
|
|
|
|
|
templ.replace("%group%", Qt::escape(entry->group()->title())); |
|
|
|
templ.replace("%group%", QString(entry->group()->title()).toHtmlEscaped()); |
|
|
|
templ.replace("%title%", Qt::escape(entry->title())); |
|
|
|
templ.replace("%title%", QString(entry->title()).toHtmlEscaped()); |
|
|
|
if (config->hideUsernames()) |
|
|
|
if (config->hideUsernames()) |
|
|
|
templ.replace("%username%","****"); |
|
|
|
templ.replace("%username%","****"); |
|
|
|
else |
|
|
|
else |
|
|
|
templ.replace("%username%", Qt::escape(entry->username())); |
|
|
|
templ.replace("%username%", QString(entry->username()).toHtmlEscaped()); |
|
|
|
if (!config->hidePasswords()) { |
|
|
|
if (!config->hidePasswords()) { |
|
|
|
SecString password=entry->password(); |
|
|
|
SecString password=entry->password(); |
|
|
|
password.unlock(); |
|
|
|
password.unlock(); |
|
|
|
templ.replace("%password%", Qt::escape(password.string())); |
|
|
|
templ.replace("%password%", QString(password.string()).toHtmlEscaped()); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
templ.replace("%password%","****"); |
|
|
|
templ.replace("%password%","****"); |
|
|
|
} |
|
|
|
} |
|
|
|
templ.replace("%url%", Qt::escape(entry->url())); |
|
|
|
templ.replace("%url%", QString(entry->url()).toHtmlEscaped()); |
|
|
|
templ.replace("%creation%", Qt::escape(entry->creation().toString(Qt::SystemLocaleDate))); |
|
|
|
templ.replace("%creation%", QString(entry->creation().toString(Qt::SystemLocaleDate)).toHtmlEscaped()); |
|
|
|
templ.replace("%lastmod%", Qt::escape(entry->lastMod().toString(Qt::SystemLocaleDate))); |
|
|
|
templ.replace("%lastmod%", QString(entry->lastMod().toString(Qt::SystemLocaleDate)).toHtmlEscaped()); |
|
|
|
templ.replace("%lastaccess%", Qt::escape(entry->lastAccess().toString(Qt::SystemLocaleDate))); |
|
|
|
templ.replace("%lastaccess%", QString(entry->lastAccess().toString(Qt::SystemLocaleDate)).toHtmlEscaped()); |
|
|
|
templ.replace("%expire%", Qt::escape(entry->expire().toString(Qt::SystemLocaleDate))); |
|
|
|
templ.replace("%expire%", QString(entry->expire().toString(Qt::SystemLocaleDate)).toHtmlEscaped()); |
|
|
|
templ.replace("%comment%", Qt::escape(entry->comment()).replace("\n","<br/>")); |
|
|
|
templ.replace("%comment%", QString(entry->comment().replace("\n","<br/>")).toHtmlEscaped()); |
|
|
|
templ.replace("%attachment%", Qt::escape(entry->binaryDesc())); |
|
|
|
templ.replace("%attachment%", QString(entry->binaryDesc()).toHtmlEscaped()); |
|
|
|
|
|
|
|
|
|
|
|
if(entry->expire()!=Date_Never){ |
|
|
|
if(entry->expire()!=Date_Never){ |
|
|
|
int secs=QDateTime::currentDateTime().secsTo(entry->expire()); |
|
|
|
int secs=QDateTime::currentDateTime().secsTo(entry->expire()); |
|
|
@ -1128,7 +1128,7 @@ void KeepassMainWindow::hideEvent(QHideEvent* event){ |
|
|
|
if (config->lockOnMinimize() && !IsLocked && FileOpen) |
|
|
|
if (config->lockOnMinimize() && !IsLocked && FileOpen) |
|
|
|
OnUnLockWorkspace(); |
|
|
|
OnUnLockWorkspace(); |
|
|
|
if (config->showSysTrayIcon() && config->minimizeTray()){ |
|
|
|
if (config->showSysTrayIcon() && config->minimizeTray()){ |
|
|
|
#ifdef Q_WS_WIN |
|
|
|
#ifdef Q_OS_WIN32 |
|
|
|
QTimer::singleShot(100, this, SLOT(hide())); |
|
|
|
QTimer::singleShot(100, this, SLOT(hide())); |
|
|
|
#else |
|
|
|
#else |
|
|
|
hide(); |
|
|
|
hide(); |
|
|
@ -1143,7 +1143,7 @@ void KeepassMainWindow::hideEvent(QHideEvent* event){ |
|
|
|
|
|
|
|
|
|
|
|
void KeepassMainWindow::showEvent(QShowEvent* event){ |
|
|
|
void KeepassMainWindow::showEvent(QShowEvent* event){ |
|
|
|
if (IsLocked && !InUnLock && event->spontaneous()){ |
|
|
|
if (IsLocked && !InUnLock && event->spontaneous()){ |
|
|
|
#ifndef Q_WS_MAC |
|
|
|
#ifndef Q_OS_MAC |
|
|
|
showNormal(); // workaround for some graphic glitches
|
|
|
|
showNormal(); // workaround for some graphic glitches
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
OnUnLockWorkspace(); |
|
|
|
OnUnLockWorkspace(); |
|
|
@ -1171,7 +1171,7 @@ void KeepassMainWindow::OnExtrasSettings(){ |
|
|
|
EntryView->setAlternatingRowColors(config->alternatingRowColors()); |
|
|
|
EntryView->setAlternatingRowColors(config->alternatingRowColors()); |
|
|
|
SysTray->setVisible(config->showSysTrayIcon()); |
|
|
|
SysTray->setVisible(config->showSysTrayIcon()); |
|
|
|
menuBookmarks->menuAction()->setVisible(config->featureBookmarks()); |
|
|
|
menuBookmarks->menuAction()->setVisible(config->featureBookmarks()); |
|
|
|
#ifndef Q_WS_MAC |
|
|
|
#ifndef Q_OS_MAC |
|
|
|
if (config->alwaysOnTop() != oldAlwaysOnTop) { |
|
|
|
if (config->alwaysOnTop() != oldAlwaysOnTop) { |
|
|
|
if (config->alwaysOnTop()) |
|
|
|
if (config->alwaysOnTop()) |
|
|
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); |
|
|
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); |
|
|
@ -1271,7 +1271,7 @@ void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason rea |
|
|
|
hide(); |
|
|
|
hide(); |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
else{ |
|
|
|
#ifdef Q_WS_WIN |
|
|
|
#ifdef Q_OS_WIN32 |
|
|
|
QTimer::singleShot(100, this, SLOT(restoreWindow())); |
|
|
|
QTimer::singleShot(100, this, SLOT(restoreWindow())); |
|
|
|
#else |
|
|
|
#else |
|
|
|
restoreWindow(); |
|
|
|
restoreWindow(); |
|
|
@ -1281,7 +1281,7 @@ void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason rea |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void KeepassMainWindow::restoreWindow(){ |
|
|
|
void KeepassMainWindow::restoreWindow(){ |
|
|
|
#ifdef Q_WS_WIN |
|
|
|
#ifdef Q_OS_WIN32 |
|
|
|
if (windowState() & Qt::WindowMaximized) |
|
|
|
if (windowState() & Qt::WindowMaximized) |
|
|
|
showMaximized(); |
|
|
|
showMaximized(); |
|
|
|
else |
|
|
|
else |
|
|
@ -1339,7 +1339,7 @@ void KeepassMainWindow::OnUnLockWorkspace(){ |
|
|
|
if(IsLocked){ |
|
|
|
if(IsLocked){ |
|
|
|
if (InUnLock) return; |
|
|
|
if (InUnLock) return; |
|
|
|
InUnLock = true; |
|
|
|
InUnLock = true; |
|
|
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_MAC) |
|
|
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_OS_MAC) |
|
|
|
// show in case minimized, especially in another Space
|
|
|
|
// show in case minimized, especially in another Space
|
|
|
|
// only needed if invoked from global autotype
|
|
|
|
// only needed if invoked from global autotype
|
|
|
|
show(); |
|
|
|
show(); |
|
|
|