summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/kmainwindow.cpp
Side-by-side diff
Diffstat (limited to 'microkde/kdeui/kmainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/kmainwindow.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp
index 3ae4c87..fa678f2 100644
--- a/microkde/kdeui/kmainwindow.cpp
+++ b/microkde/kdeui/kmainwindow.cpp
@@ -8,97 +8,97 @@
(C) 2002 Joseph Wenninger (jowenn@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qobjectlist.h>
#include <qstringlist.h>
#include <qtimer.h>
#include <qmenubar.h>
#include <qstatusbar.h>
#include <qapplication.h>
#include "kdebug.h"
#include "kmainwindow.h"
#include "kglobalsettings.h"
#include "kactioncollection.h"
class KMainWindowPrivate {
public:
//US bool showHelpMenu:1;
bool autoSaveSettings:1;
bool settingsDirty:1;
bool autoSaveWindowSize:1;
bool care_about_geometry:1;
QString autoSaveGroup;
//US KAccel * kaccel;
//US KMainWindowInterface *m_interface;
KDEPrivate::ToolBarHandler *toolBarHandler;
QTimer* settingsTimer;
KToggleAction *showStatusBarAction;
QRect defaultWindowSize;
};
static bool no_query_exit = false;
-KMainWindow::KMainWindow( QWidget* parent, const char *name, WFlags f )
+KMainWindow::KMainWindow( QWidget* parent, const char *name )
: QMainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/
{
mQToolBar = 0;
initKMainWindow(name);
}
void KMainWindow::parseGeometry(bool parsewidth)
{
//US the following code is not getting used in the embedded version !! So disable it for now
/*US
assert ( !kapp->geometryArgument().isNull() );
assert ( d->care_about_geometry );
#ifndef Q_WS_QWS
// FIXME: (E) Implement something similar for Qt Embedded (or decide we don't need it)
int x, y;
int w, h;
int m = XParseGeometry( kapp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h);
if (parsewidth) {
QSize minSize = minimumSize();
QSize maxSize = maximumSize();
if ( (m & WidthValue) == 0 )
w = width();
if ( (m & HeightValue) == 0 )
h = height();
w = QMIN(w,maxSize.width());
h = QMIN(h,maxSize.height());
w = QMAX(w,minSize.width());
h = QMAX(h,minSize.height());
resize(w, h);
} else {
if ( parsewidth && (m & XValue) == 0 )
x = geometry().x();
if ( parsewidth && (m & YValue) == 0 )
y = geometry().y();
if ( (m & XNegative) )
x = KApplication::desktop()->width() + x - w;
if ( (m & YNegative) )
y = KApplication::desktop()->height() + y - h;
move(x, y);
}
#endif
*/
}
KMainWindow::~KMainWindow()
{
@@ -802,192 +802,193 @@ void KMainWindow::restoreWindowSize( KConfig * config )
if (!size.isEmpty()) {
// make sure the other resolutions don't get old settings
config->writeEntry( QString::fromLatin1("Width"), 0 );
config->writeEntry( QString::fromLatin1("Height"), 0 );
}
}
if ( !size.isEmpty() )
resize( size );
}
}
bool KMainWindow::initialGeometrySet() const
{
return d->care_about_geometry;
}
void KMainWindow::ignoreInitialGeometry()
{
d->care_about_geometry = false;
}
void KMainWindow::setSettingsDirty()
{
//kdDebug(200) << "KMainWindow::setSettingsDirty" << endl;
d->settingsDirty = true;
if ( d->autoSaveSettings )
{
// Use a timer to save "immediately" user-wise, but not too immediately
// (to compress calls and save only once, in case of multiple changes)
if ( !d->settingsTimer )
{
d->settingsTimer = new QTimer( this );
connect( d->settingsTimer, SIGNAL( timeout() ), SLOT( saveAutoSaveSettings() ) );
}
d->settingsTimer->start( 500, true );
}
}
bool KMainWindow::settingsDirty() const
{
return d->settingsDirty;
}
QString KMainWindow::settingsGroup() const
{
return d->autoSaveGroup;
}
-void KMainWindow::resizeEvent( QResizeEvent * )
+void KMainWindow::resizeEvent( QResizeEvent * e)
{
if ( d->autoSaveWindowSize )
- setSettingsDirty();
+ setSettingsDirty();
+ QMainWindow::resizeEvent( e );
}
bool KMainWindow::hasMenuBar()
{
return (internalMenuBar());
}
//US KMenuBar *KMainWindow::menuBar()
QMenuBar *KMainWindow::menuBar()
{
//US KMenuBar * mb = internalMenuBar();
QMenuBar * mb = internalMenuBar();
if ( !mb ) {
//US mb = new KMenuBar( this );
mb = new QMenuBar( this );
// trigger a re-layout and trigger a call to the private
// setMenuBar method.
QMainWindow::menuBar();
}
return mb;
}
//US KStatusBar *KMainWindow::statusBar()
QStatusBar *KMainWindow::statusBar()
{
//US KStatusBar * sb = internalStatusBar();
QStatusBar * sb = internalStatusBar();
if ( !sb ) {
//US sb = new KStatusBar( this );
sb = new QStatusBar( this );
// trigger a re-layout and trigger a call to the private
// setStatusBar method.
QMainWindow::statusBar();
}
return sb;
}
void KMainWindow::shuttingDown()
{
// Needed for Qt <= 3.0.3 at least to prevent reentrancy
// when queryExit() shows a dialog. Check before removing!
static bool reentrancy_protection = false;
if (!reentrancy_protection)
{
reentrancy_protection = true;
// call the virtual queryExit
queryExit();
reentrancy_protection = false;
}
}
//US KMenuBar *KMainWindow::internalMenuBar()
QMenuBar *KMainWindow::internalMenuBar()
{
//US QObjectList *l = queryList( "KMenuBar", 0, false, false );
QObjectList *l = queryList( "QMenuBar", 0, false, false );
if ( !l || !l->first() ) {
delete l;
return 0;
}
//US KMenuBar *m = (KMenuBar*)l->first();
QMenuBar *m = (QMenuBar*)l->first();
delete l;
return m;
}
//US KStatusBar *KMainWindow::internalStatusBar()
QStatusBar *KMainWindow::internalStatusBar()
{
//US QObjectList *l = queryList( "KStatusBar", 0, false, false );
QObjectList *l = queryList( "QStatusBar", 0, false, false );
if ( !l || !l->first() ) {
delete l;
return 0;
}
//US KStatusBar *s = (KStatusBar*)l->first();
QStatusBar *s = (QStatusBar*)l->first();
delete l;
return s;
}
void KMainWindow::childEvent( QChildEvent* e)
{
QMainWindow::childEvent( e );
}
-void KMainWindow::paintEvent( QPaintEvent * )
+void KMainWindow::paintEvent( QPaintEvent * e)
{
- // do nothing
+ QMainWindow::paintEvent( e );
}
QSize KMainWindow::sizeForCentralWidgetSize(QSize size)
{
KToolBar *tb = (KToolBar*)child( "mainToolBar", "KToolBar" );
if (tb && !tb->isHidden()) {
switch( tb->barPos() )
{
case KToolBar::Top:
case KToolBar::Bottom:
size += QSize(0, tb->sizeHint().height());
break;
case KToolBar::Left:
case KToolBar::Right:
size += QSize(toolBar()->sizeHint().width(), 0);
break;
case KToolBar::Flat:
//US size += QSize(0, 3+kapp->style().pixelMetric( QStyle::PM_DockWindowHandleExtent ));
size += QSize(0, tb->sizeHint().height());
break;
default:
break;
}
}
//US KMenuBar *mb = menuBar();
QMenuBar *mb = menuBar();
if (!mb->isHidden()) {
size += QSize(0,mb->heightForWidth(size.width()));
/*US if (style().styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, this))
size += QSize( 0, dockWindowsMovable() ? 1 : 2);
*/
size += QSize( 0, 2);
}
QStatusBar *sb = internalStatusBar();
if( sb && !sb->isHidden() )
size += QSize(0, sb->sizeHint().height());
return size;
}
// why do we support old gcc versions? using KXMLGUIBuilder::finalizeGUI;
void KMainWindow::finalizeGUI( KXMLGUIClient *client )
{ /*US KXMLGUIBuilder::finalizeGUI( client );*/ }
void KMainWindow::virtual_hook( int id, void* data )