save the window state only when the window was visible and the state was loaded

the problem was:
the state of the windows was set to the initial state on close, when it wasn't visible.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3136 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-06-14 20:15:51 +00:00
parent 5b1fae0123
commit f1da09ad93
2 changed files with 9 additions and 0 deletions

View File

@ -36,6 +36,7 @@ RWindow::RWindow(QString name, QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
_name = name;
m_bSaveStateOnClose = false;
}
/** Destructor. */
@ -55,6 +56,11 @@ RWindow::setShortcut(QString shortcut, const char *slot)
void
RWindow::saveWindowState()
{
if (m_bSaveStateOnClose == false) {
// nothing to save
return;
}
#if QT_VERSION >= 0x040200
saveSetting("Geometry", saveGeometry());
#else
@ -67,6 +73,8 @@ RWindow::saveWindowState()
void
RWindow::restoreWindowState()
{
m_bSaveStateOnClose = true; // now we save the window state on close
#if QT_VERSION >= 0x040200
QByteArray geometry = getSetting("Geometry", QByteArray()).toByteArray();
if (geometry.isEmpty())

View File

@ -68,6 +68,7 @@ signals:
private:
QString _name; /**< Name associated with this window. */
bool m_bSaveStateOnClose; // is set to true in restoreWindowState
};
#endif