[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/utils/charm/trunk/Charm
From: Christoph Schleifenbaum <christoph () kdab ! net>
Date: 2009-03-26 23:17:25
Message-ID: 1238109445.114053.17490.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 945145 by cschleifenbaum:
Always restore the most recent closed window when the Mac OS dock icon was clicked
M +22 -2 Application.cpp
M +4 -0 Application.h
M +2 -0 CharmWindow.cpp
--- trunk/playground/utils/charm/trunk/Charm/Application.cpp #945144:945145
@@ -47,6 +47,7 @@
, m_actionImportTasks( this )
, m_actionReporting( this )
, m_idleDetector( 0 )
+ , m_closedWindow( 0 )
, m_windows( QList<CharmWindow*> () << &m_tasksWindow << &m_eventWindow << \
&m_timeTracker ) {
// QApplication setup
@@ -84,6 +85,9 @@
// save the configuration (configuration is managed by the application)
connect( window, SIGNAL(saveConfiguration() ),
SLOT( slotSaveConfiguration() ) );
+
+ connect( window, SIGNAL( visibilityChanged( bool ) ),
+ this, SLOT( slotCharmWindowVisibilityChanged( bool ) ) );
}
// my own signals:
connect(this, SIGNAL(goToState(State)), SLOT(setState(State)),
@@ -172,10 +176,12 @@
m_windowMenu.addAction( &m_actionReporting );
// FIXME ifndef?
-#ifndef Q_WS_MAC
+#ifdef Q_WS_MAC
+#if 0
// FIXME parametrize, handle the same for all windows
SpecialKeysEventFilter* filter = new SpecialKeysEventFilter( this );
installEventFilter( filter );
+#endif
// MIRKO_TEMP_REM
/*
connect( filter, SIGNAL( toggleWindow1Visibility() ),
@@ -184,7 +190,7 @@
&m_timeTracker, SLOT( slotShowHide() ) );
*/
// FIXME fix
- connect( QApplication::instance(), SIGNAL( dockIconClicked() ), this, SLOT( \
show() ) ); + connect( QApplication::instance(), SIGNAL( dockIconClicked() ), \
this, SLOT( slotOpenLastClosedWindow() ) ); #endif
// ^^^
@@ -595,4 +601,18 @@
return m_tasksWindow;
}
+void Application::slotOpenLastClosedWindow()
+{
+ if( m_closedWindow == 0 )
+ return;
+ m_closedWindow->show();
+ m_closedWindow = 0;
+}
+
+void Application::slotCharmWindowVisibilityChanged( bool visible )
+{
+ if( !visible )
+ m_closedWindow = dynamic_cast< CharmWindow* >( sender() );
+}
+
#include "Application.moc"
--- trunk/playground/utils/charm/trunk/Charm/Application.h #945144:945145
@@ -91,6 +91,9 @@
void slotStopAllTasks();
void slotMaybeIdle();
+ void slotOpenLastClosedWindow();
+ void slotCharmWindowVisibilityChanged( bool visibility );
+
signals:
void goToState( State state );
@@ -130,6 +133,7 @@
QAction m_actionReporting;
IdleDetector* m_idleDetector;
+ CharmWindow* m_closedWindow;
const QList<CharmWindow*> m_windows;
// All statics are created as members of Application. This is
--- trunk/playground/utils/charm/trunk/Charm/CharmWindow.cpp #945144:945145
@@ -104,12 +104,14 @@
void CharmWindow::showEvent( QShowEvent* e )
{
m_showHideAction->setText( tr( "Hide %1 Window" ).arg( m_windowName ) );
+ emit visibilityChanged( true );
QMainWindow::showEvent( e );
}
void CharmWindow::hideEvent( QHideEvent* e )
{
m_showHideAction->setText( tr( "Show %1 Window" ).arg( m_windowName ) );
+ emit visibilityChanged( false );
QMainWindow::hideEvent( e );
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic