Restore show mode when opening from tray
This commit is contained in:
parent
2e4f4d7702
commit
0b01047e02
@ -79,7 +79,7 @@ void rwSettings(bool writing)
|
||||
QSettings settings("Recoll.org", "recoll");
|
||||
SETTING_RW(prefs.mainwidth, "/Recoll/geometry/width", Int, 0);
|
||||
SETTING_RW(prefs.mainheight, "/Recoll/geometry/height", Int, 0);
|
||||
SETTING_RW(prefs.maximized, "/Recoll/geometry/maximized", Bool, 0);
|
||||
SETTING_RW(prefs.showmode, "/Recoll/geometry/showmode", Int, 0);
|
||||
SETTING_RW(prefs.pvwidth, "/Recoll/geometry/pvwidth", Int, 0);
|
||||
SETTING_RW(prefs.pvheight, "/Recoll/geometry/pvheight", Int, 0);
|
||||
SETTING_RW(prefs.toolArea, "/Recoll/geometry/toolArea", Int, 0);
|
||||
|
||||
@ -30,11 +30,9 @@ extern RclDynConf *g_dynconf;
|
||||
#include "advshist.h"
|
||||
extern AdvSearchHist *g_advshistory;
|
||||
|
||||
#ifndef NO_NAMESPACES
|
||||
using std::string;
|
||||
using std::list;
|
||||
using std::vector;
|
||||
#endif
|
||||
|
||||
/** Holder for preferences (gets saved to user Qt prefs) */
|
||||
class PrefsPack {
|
||||
@ -68,7 +66,8 @@ class PrefsPack {
|
||||
QString queryStemLang;
|
||||
int mainwidth;
|
||||
int mainheight;
|
||||
bool maximized{false};
|
||||
enum ShowMode {SHOW_NORMAL, SHOW_MAX, SHOW_FULL};
|
||||
int showmode{SHOW_NORMAL};
|
||||
int pvwidth; // Preview window geom
|
||||
int pvheight;
|
||||
int toolArea; // Area for "tools" toolbar
|
||||
|
||||
@ -375,10 +375,10 @@ int main(int argc, char **argv)
|
||||
|
||||
maybeOpenDb(reason);
|
||||
|
||||
if (prefs.maximized) {
|
||||
mainWindow->showMaximized();
|
||||
} else {
|
||||
mainWindow->show();
|
||||
switch (prefs.showmode) {
|
||||
case PrefsPack::SHOW_NORMAL: mainWindow->show(); break;
|
||||
case PrefsPack::SHOW_MAX: mainWindow->showMaximized(); break;
|
||||
case PrefsPack::SHOW_FULL: mainWindow->showFullScreen(); break;
|
||||
}
|
||||
QTimer::singleShot(0, mainWindow, SLOT(initDbOpen()));
|
||||
|
||||
|
||||
@ -643,6 +643,13 @@ void RclMain::showTrayMessage(const QString& text)
|
||||
void RclMain::closeEvent(QCloseEvent *ev)
|
||||
{
|
||||
LOGDEB("RclMain::closeEvent\n");
|
||||
if (isFullScreen()) {
|
||||
prefs.showmode = PrefsPack::SHOW_FULL;
|
||||
} else if (isMaximized()) {
|
||||
prefs.showmode = PrefsPack::SHOW_MAX;
|
||||
} else {
|
||||
prefs.showmode = PrefsPack::SHOW_NORMAL;
|
||||
}
|
||||
if (prefs.closeToTray && m_trayicon && m_trayicon->isVisible()) {
|
||||
hide();
|
||||
ev->ignore();
|
||||
@ -654,6 +661,15 @@ void RclMain::closeEvent(QCloseEvent *ev)
|
||||
void RclMain::fileExit()
|
||||
{
|
||||
LOGDEB("RclMain: fileExit\n");
|
||||
// Have to do this both in closeEvent (for close to tray) and fileExit
|
||||
// (^Q, doesnt go through closeEvent)
|
||||
if (isFullScreen()) {
|
||||
prefs.showmode = PrefsPack::SHOW_FULL;
|
||||
} else if (isMaximized()) {
|
||||
prefs.showmode = PrefsPack::SHOW_MAX;
|
||||
} else {
|
||||
prefs.showmode = PrefsPack::SHOW_NORMAL;
|
||||
}
|
||||
if (m_trayicon) {
|
||||
m_trayicon->setVisible(false);
|
||||
}
|
||||
@ -662,7 +678,6 @@ void RclMain::fileExit()
|
||||
prefs.mainwidth = width();
|
||||
prefs.mainheight = height();
|
||||
}
|
||||
prefs.maximized = isMaximized();
|
||||
|
||||
prefs.toolArea = toolBarArea(m_toolsTB);
|
||||
prefs.resArea = toolBarArea(m_resTB);
|
||||
|
||||
@ -41,7 +41,11 @@ void RclTrayIcon::onRestore()
|
||||
{
|
||||
// Hide and show to restore on current desktop
|
||||
m_mainw->hide();
|
||||
m_mainw->showNormal();
|
||||
switch (prefs.showmode) {
|
||||
case PrefsPack::SHOW_NORMAL: m_mainw->show(); break;
|
||||
case PrefsPack::SHOW_MAX: m_mainw->showMaximized(); break;
|
||||
case PrefsPack::SHOW_FULL: m_mainw->showFullScreen(); break;
|
||||
}
|
||||
}
|
||||
|
||||
void RclTrayIcon::onActivated(QSystemTrayIcon::ActivationReason reason)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user