Restore "Close To Tray" functionality
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@362 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
0d44be7a68
commit
dbf4dbfef0
|
@ -70,6 +70,7 @@ public:
|
||||||
QString lastKeyLocation(){return settings.value("Options/LastKeyLocation").toString();}
|
QString lastKeyLocation(){return settings.value("Options/LastKeyLocation").toString();}
|
||||||
tKeyType lastKeyType(){return stringToKeyType(settings.value("Options/LastKeyType").toString());}
|
tKeyType lastKeyType(){return stringToKeyType(settings.value("Options/LastKeyType").toString());}
|
||||||
QByteArray mainWindowGeometry();
|
QByteArray mainWindowGeometry();
|
||||||
|
bool minimizeToTray(){return settings.value("Options/MinimizeToTray",false).toBool();}
|
||||||
bool minimizeTray(){return settings.value("Options/MinimizeTray",false).toBool();}
|
bool minimizeTray(){return settings.value("Options/MinimizeTray",false).toBool();}
|
||||||
bool startMinimized(){return settings.value("Options/StartMinimized",false).toBool();}
|
bool startMinimized(){return settings.value("Options/StartMinimized",false).toBool();}
|
||||||
bool startLocked(){return settings.value("Options/StartLocked",false).toBool();}
|
bool startLocked(){return settings.value("Options/StartLocked",false).toBool();}
|
||||||
|
@ -142,6 +143,7 @@ public:
|
||||||
void setLastKeyLocation(const QString& value){settings.setValue("Options/LastKeyLocation",value);}
|
void setLastKeyLocation(const QString& value){settings.setValue("Options/LastKeyLocation",value);}
|
||||||
void setLastKeyType(tKeyType value){settings.setValue("Options/LastKeyType",keyTypeToString(value));}
|
void setLastKeyType(tKeyType value){settings.setValue("Options/LastKeyType",keyTypeToString(value));}
|
||||||
void setMainWindowGeometry(const QByteArray& value){settings.setValue("UI/MainWindowGeometry",value);}
|
void setMainWindowGeometry(const QByteArray& value){settings.setValue("UI/MainWindowGeometry",value);}
|
||||||
|
void setMinimizeToTray(bool value){settings.setValue("Options/MinimizeToTray",value);}
|
||||||
void setMinimizeTray(bool value){settings.setValue("Options/MinimizeTray",value);}
|
void setMinimizeTray(bool value){settings.setValue("Options/MinimizeTray",value);}
|
||||||
void setStartMinimized(bool value){settings.setValue("Options/StartMinimized",value);}
|
void setStartMinimized(bool value){settings.setValue("Options/StartMinimized",value);}
|
||||||
void setStartLocked(bool value){settings.setValue("Options/StartLocked",value);}
|
void setStartLocked(bool value){settings.setValue("Options/StartLocked",value);}
|
||||||
|
|
|
@ -34,6 +34,7 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
|
||||||
connect(DialogButtons, SIGNAL( rejected() ), this, SLOT( OnCancel() ) );
|
connect(DialogButtons, SIGNAL( rejected() ), this, SLOT( OnCancel() ) );
|
||||||
connect(DialogButtons, SIGNAL( clicked(QAbstractButton*)), this, SLOT(OnOtherButton(QAbstractButton*)));
|
connect(DialogButtons, SIGNAL( clicked(QAbstractButton*)), this, SLOT(OnOtherButton(QAbstractButton*)));
|
||||||
|
|
||||||
|
connect(CheckBox_ShowSysTrayIcon, SIGNAL( toggled(bool) ), CheckBox_CloseToTray, SLOT( setEnabled(bool) ) );
|
||||||
connect(CheckBox_ShowSysTrayIcon, SIGNAL( toggled(bool) ), CheckBox_MinimizeTray, SLOT( setEnabled(bool) ) );
|
connect(CheckBox_ShowSysTrayIcon, SIGNAL( toggled(bool) ), CheckBox_MinimizeTray, SLOT( setEnabled(bool) ) );
|
||||||
connect(CheckBox_OpenLast, SIGNAL( toggled(bool) ), CheckBox_RememberLastKey, SLOT( setEnabled(bool) ) );
|
connect(CheckBox_OpenLast, SIGNAL( toggled(bool) ), CheckBox_RememberLastKey, SLOT( setEnabled(bool) ) );
|
||||||
connect(CheckBox_OpenLast, SIGNAL( toggled(bool) ), CheckBox_StartMinimized, SLOT( setEnabled(bool) ) );
|
connect(CheckBox_OpenLast, SIGNAL( toggled(bool) ), CheckBox_StartMinimized, SLOT( setEnabled(bool) ) );
|
||||||
|
@ -84,6 +85,7 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
|
||||||
CheckBox_OpenLast->setChecked(config->openLastFile());
|
CheckBox_OpenLast->setChecked(config->openLastFile());
|
||||||
CheckBox_RememberLastKey->setChecked(config->rememberLastKey());
|
CheckBox_RememberLastKey->setChecked(config->rememberLastKey());
|
||||||
CheckBox_ShowSysTrayIcon->setChecked(config->showSysTrayIcon());
|
CheckBox_ShowSysTrayIcon->setChecked(config->showSysTrayIcon());
|
||||||
|
CheckBox_CloseToTray->setChecked(config->minimizeToTray());
|
||||||
CheckBox_MinimizeTray->setChecked(config->minimizeTray());
|
CheckBox_MinimizeTray->setChecked(config->minimizeTray());
|
||||||
CheckBox_StartMinimized->setChecked(config->startMinimized());
|
CheckBox_StartMinimized->setChecked(config->startMinimized());
|
||||||
CheckBox_StartLocked->setChecked(config->startLocked());
|
CheckBox_StartLocked->setChecked(config->startLocked());
|
||||||
|
@ -237,6 +239,7 @@ void CSettingsDlg::apply(){
|
||||||
|
|
||||||
//General (1)
|
//General (1)
|
||||||
config->setShowSysTrayIcon(CheckBox_ShowSysTrayIcon->isChecked());
|
config->setShowSysTrayIcon(CheckBox_ShowSysTrayIcon->isChecked());
|
||||||
|
config->setMinimizeToTray(CheckBox_CloseToTray->isChecked());
|
||||||
config->setMinimizeTray(CheckBox_MinimizeTray->isChecked());
|
config->setMinimizeTray(CheckBox_MinimizeTray->isChecked());
|
||||||
config->setStartMinimized(CheckBox_StartMinimized->isChecked());
|
config->setStartMinimized(CheckBox_StartMinimized->isChecked());
|
||||||
config->setStartLocked(CheckBox_StartLocked->isChecked());
|
config->setStartLocked(CheckBox_StartLocked->isChecked());
|
||||||
|
|
|
@ -146,6 +146,36 @@ QListView::item {
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>25</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="CheckBox_CloseToTray">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Minimize to tray when clicking the main window's close button</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="_18">
|
<layout class="QVBoxLayout" name="_18">
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -50,6 +50,7 @@ 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::WFlags flags) :QMainWindow(parent,flags){
|
||||||
|
ShutingDown=false;
|
||||||
IsLocked=false;
|
IsLocked=false;
|
||||||
EventOccurred=true;
|
EventOccurred=true;
|
||||||
inactivityCounter=0;
|
inactivityCounter=0;
|
||||||
|
@ -978,6 +979,7 @@ void KeepassMainWindow::OnFileChangeKey(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassMainWindow::OnFileExit(){
|
void KeepassMainWindow::OnFileExit(){
|
||||||
|
ShutingDown = true;
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1070,7 +1072,16 @@ void KeepassMainWindow::OnFileModified(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassMainWindow::closeEvent(QCloseEvent* e){
|
void KeepassMainWindow::closeEvent(QCloseEvent* e){
|
||||||
|
if (!ShutingDown && config->showSysTrayIcon() && config->minimizeToTray()){
|
||||||
|
e->ignore();
|
||||||
|
if (config->lockOnMinimize() && !IsLocked && FileOpen)
|
||||||
|
OnUnLockWorkspace();
|
||||||
|
hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(FileOpen && !closeDatabase()){
|
if(FileOpen && !closeDatabase()){
|
||||||
|
ShutingDown = false;
|
||||||
e->ignore();
|
e->ignore();
|
||||||
if (!isVisible())
|
if (!isVisible())
|
||||||
show();
|
show();
|
||||||
|
@ -1406,6 +1417,8 @@ void KeepassMainWindow::OnInactivityTimer(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassMainWindow::OnShutdown(QSessionManager& manager) {
|
void KeepassMainWindow::OnShutdown(QSessionManager& manager) {
|
||||||
|
ShutingDown = true;
|
||||||
|
|
||||||
/* QApplication::commitData() only closes visible windows,
|
/* QApplication::commitData() only closes visible windows,
|
||||||
so we need to manually close mainwindow if it's hidden */
|
so we need to manually close mainwindow if it's hidden */
|
||||||
if (manager.allowsInteraction() && !isVisible()) {
|
if (manager.allowsInteraction() && !isVisible()) {
|
||||||
|
|
|
@ -136,6 +136,7 @@ class KeepassMainWindow : public QMainWindow, private Ui_MainWindow{
|
||||||
QWidget* NormalCentralWidget;
|
QWidget* NormalCentralWidget;
|
||||||
QWidget* LockedCentralWidget;
|
QWidget* LockedCentralWidget;
|
||||||
Ui_WorkspaceLockedWidget WorkspaceLockedWidget;
|
Ui_WorkspaceLockedWidget WorkspaceLockedWidget;
|
||||||
|
bool ShutingDown;
|
||||||
bool InUnLock;
|
bool InUnLock;
|
||||||
QList<int> lockGroup;
|
QList<int> lockGroup;
|
||||||
QDialog* unlockDlg;
|
QDialog* unlockDlg;
|
||||||
|
|
Loading…
Reference in New Issue