[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/utils/charm/trunk/Charm
From: David Faure <faure () kde ! org>
Date: 2009-05-06 8:37:13
Message-ID: 1241599033.747589.28357.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 964163 by dfaure:
Fix session management on X11
Remove a bit of duplicated code
M +29 -0 Application.cpp
M +3 -0 Application.h
M +1 -5 CharmWindow.cpp
M +0 -34 MainWindow.cpp
M +1 -21 TimeTrackingView.cpp
--- trunk/playground/utils/charm/trunk/Charm/Application.cpp #964162:964163
@@ -22,6 +22,7 @@
#include "ViewHelpers.h"
#include "Data.h"
#include "Application.h"
+#include <QSessionManager>
#include "SpecialKeysEventFilter.h"
#include "ConfigurationDialog.h"
#include "Idle/IdleDetector.h"
@@ -615,4 +616,32 @@
m_closedWindow = dynamic_cast< CharmWindow* >( sender() );
}
+void Application::saveState( QSessionManager & manager )
+{
+ //qDebug() << "saveState(QSessionManager)";
+ if (m_state == Connected) {
+ //QSettings settings;
+ //const QString prefix = manager.sessionId() + '/';
+ //qDebug() << "saveState" << prefix << "tasksWindow:" << m_tasksWindow.geometry();
+ // Visibility is done already. TODO: desktop number?
+ //settings.setValue(prefix + "tasks_window_shown", m_tasksWindow.isVisible());
+ //settings.setValue(prefix + "event_window_shown", m_eventWindow.isVisible());
+ //settings.setValue(prefix + "timetracker_window_shown", m_timeTracker.isVisible());
+ //settings.setValue(prefix + "tasks_window_geometry", m_tasksWindow.geometry());
+
+ m_tasksWindow.saveGuiState();
+ m_eventWindow.saveGuiState();
+ m_timeTracker.saveGuiState();
+ } else {
+ //qDebug() << "ignored";
+ }
+}
+
+void Application::commitData( QSessionManager & manager )
+{
+ // Do nothing here. The default implementation closes all windows,
+ // (just to see if the closeEvent is accepted), and this messes up
+ // our saving of the "visible" state later on in saveData.
+}
+
#include "Application.moc"
--- trunk/playground/utils/charm/trunk/Charm/Application.h #964162:964163
@@ -76,6 +76,9 @@
* It is an internal concept, not a notion for the end user. */
CharmWindow& mainView();
+ /*! \reimp */ void saveState( QSessionManager & manager );
+ /*! \reimp */ void commitData( QSessionManager & manager );
+
public slots:
void setState( State state );
void slotQuitApplication();
--- trunk/playground/utils/charm/trunk/Charm/CharmWindow.cpp #964162:964163
@@ -184,11 +184,7 @@
// restore visibility
if ( settings.contains( MetaKey_MainWindowVisible ) ) {
const bool visible = settings.value( MetaKey_MainWindowVisible ).toBool();
- if ( visible ) {
- show();
- } else {
- hide();
- }
+ setVisible(visible);
}
}
--- trunk/playground/utils/charm/trunk/Charm/MainWindow.cpp #964162:964163
@@ -312,40 +312,6 @@
// dialog.exec();
// }
-// FIXME implement generically for CharnWindow
-// void MainWindow::restoreGuiState()
-// {
-// // restore geometry
-// QSettings settings;
-// if ( settings.contains( MetaKey_MainWindowGeometry ) ) {
-// restoreGeometry( settings.value( MetaKey_MainWindowGeometry ).toByteArray() );
-// }
-// // restore visibility
-// if ( settings.contains( MetaKey_MainWindowVisible ) ) {
-// const bool visible = settings.value( MetaKey_MainWindowVisible ).toBool();
-// if ( visible ) {
-// show();
-// } else {
-// hide();
-// }
-// }
-// // call all the view modes:
-// for_each( m_modes.begin(), m_modes.end(),
-// std::mem_fun( &ViewModeInterface::restoreGuiState ) );
-// }
-
-// FIXME implement generically for CharnWindow
-// void MainWindow::saveGuiState()
-// {
-// QSettings settings;
-// // save geometry
-// settings.setValue( MetaKey_MainWindowGeometry, saveGeometry() );
-// settings.setValue( MetaKey_MainWindowVisible, isVisible() );
-// // call all the view modes:
-// for_each( m_modes.begin(), m_modes.end(),
-// std::mem_fun( &ViewModeInterface::saveGuiState ) );
-// }
-
// void MainWindow::slotConfigurationChanged()
// {
// // for_each( m_modes.begin(), m_modes.end(),
--- trunk/playground/utils/charm/trunk/Charm/TimeTrackingView.cpp #964162:964163
@@ -52,31 +52,11 @@
connect( &Application::instance().timeSpans(), SIGNAL( timeSpansChanged() ),
SLOT( slotSelectTasksToShow() ) );
DATAMODEL->registerAdapter( this );
- // restore Gui state:
- QSettings settings;
- if ( settings.contains( MetaKey_TimeTrackerGeometry ) ) {
- restoreGeometry( settings.value( MetaKey_TimeTrackerGeometry ).toByteArray() );
- }
- // restore visibility
- if ( settings.contains( MetaKey_TimeTrackerVisible ) ) {
- const bool visible = settings.value( MetaKey_TimeTrackerVisible ).toBool();
- if ( visible ) {
- show();
- } else {
- hide();
- }
- }
summaryWidget()->setSummaries( QVector<TimeTrackingSummaryWidget::WeeklySummary>() );
summaryWidget()->handleActiveEvents();
break;
}
- case Disconnecting: {
- // save Gui state:
- QSettings settings;
- settings.setValue( MetaKey_TimeTrackerGeometry, saveGeometry() );
- settings.setValue( MetaKey_TimeTrackerVisible, isVisible() );
- break;
- }
+ case Disconnecting:
case ShuttingDown:
default:
break;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic