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.cpp97
1 files changed, 47 insertions, 50 deletions
diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp
index fa678f2..bac0db8 100644
--- a/microkde/kdeui/kmainwindow.cpp
+++ b/microkde/kdeui/kmainwindow.cpp
@@ -20,14 +20,20 @@
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 <qobject.h>
#include <qstringlist.h>
#include <qtimer.h>
#include <qmenubar.h>
#include <qstatusbar.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QChildEvent>
+#include <Q3PtrList>
#include "kdebug.h"
#include "kmainwindow.h"
@@ -53,9 +59,9 @@ public:
static bool no_query_exit = false;
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 )*/
+ : Q3MainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/
{
mQToolBar = 0;
initKMainWindow(name);
}
@@ -275,9 +281,9 @@ void KMainWindow::setCaption( const QString &caption, bool modified )
}
void KMainWindow::setPlainCaption( const QString &caption )
{
- QMainWindow::setCaption( caption );
+ Q3MainWindow::setCaption( caption );
#ifndef Q_WS_QWS
//US the following is disabled for the embedded version
//US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 );
//US info.setName( caption.utf8().data() );
@@ -420,12 +426,12 @@ void KMainWindow::createStandardStatusBarAction(){
d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden());
}
}
-QToolBar *KMainWindow::tBar( )
+Q3ToolBar *KMainWindow::tBar( )
{
if ( ! mQToolBar )
- mQToolBar = new QToolBar( this );
+ mQToolBar = new Q3ToolBar( this );
return mQToolBar;
}
KToolBar *KMainWindow::toolBar( const char * name )
@@ -442,24 +448,25 @@ KToolBar *KMainWindow::toolBar( const char * name )
if ( builderClient() )
return new KToolBar(this, name, honor_mode); // XMLGUI constructor
else
*/
- return new KToolBar(this, Top, false, name, honor_mode ); // non-XMLGUI
+ return new KToolBar(this, Qt::Top, false, name, honor_mode ); // non-XMLGUI
}
-QPtrListIterator<KToolBar> KMainWindow::toolBarIterator()
+Q3PtrListIterator<KToolBar> KMainWindow::toolBarIterator()
{
toolbarList.clear();
- QPtrList<QToolBar> lst;
- for ( int i = (int)QMainWindow::Unmanaged; i <= (int)Minimized; ++i ) {
- lst = toolBars( (ToolBarDock)i );
- for ( QToolBar *tb = lst.first(); tb; tb = lst.next() ) {
+ QList<Q3ToolBar*> lst;
+ for ( int i = (int)Qt::Unmanaged; i <= (int)Qt::Minimized; ++i ) {
+ lst = toolBars( (Qt::ToolBarDock)i );
+ for(QList<Q3ToolBar*>::iterator i=lst.begin();i!=lst.end();++i) {
+ Q3ToolBar *tb = *i;
if ( !tb->inherits( "KToolBar" ) )
continue;
toolbarList.append( (KToolBar*)tb );
}
}
- return QPtrListIterator<KToolBar>( toolbarList );
+ return Q3PtrListIterator<KToolBar>( toolbarList );
}
void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize )
{
@@ -468,9 +475,9 @@ void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindo
d->autoSaveWindowSize = saveWindowSize;
// Get notified when the user moves a toolbar around
//US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ),
//US this, SLOT( setSettingsDirty() ) );
- connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ),
+ connect( this, SIGNAL( toolBarPositionChanged(Q3ToolBar *) ),
this, SLOT( setSettingsDirty() ) );
// Get default values
@@ -502,9 +509,9 @@ QString KMainWindow::autoSaveGroup() const
}
void KMainWindow::saveAutoSaveSettings()
{
- ASSERT( d->autoSaveSettings );
+ Q_ASSERT( d->autoSaveSettings );
//kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl;
saveMainWindowSettings( KGlobal::config(), d->autoSaveGroup );
KGlobal::config()->sync();
d->settingsDirty = false;
@@ -638,9 +645,9 @@ void KMainWindow::saveMainWindowSettings(KConfig *config, const QString &configG
}
int n = 1; // Toolbar counter. toolbars are counted from 1,
KToolBar *toolbar = 0;
- QPtrListIterator<KToolBar> it( toolBarIterator() );
+ Q3PtrListIterator<KToolBar> it( toolBarIterator() );
while ( ( toolbar = it.current() ) ) {
++it;
QString group;
if (!configGroup.isEmpty())
@@ -713,21 +720,23 @@ void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &config
if (mb) {
entryList.clear();
//US i = config->readListEntry (QString::fromLatin1("MenuBar"), entryList, ';');
entryList = config->readListEntry (QString::fromLatin1("MenuBar"));
- entry = entryList.first();
- if (entry==QString::fromLatin1("Disabled"))
- {
- mb->hide();
- } else
- {
- mb->show();
- }
+ if(!entryList.empty()) {
+ entry = entryList.first();
+ if (entry==QString::fromLatin1("Disabled"))
+ {
+ mb->hide();
+ } else
+ {
+ mb->show();
+ }
+ }
}
int n = 1; // Toolbar counter. toolbars are counted from 1,
KToolBar *toolbar;
- QPtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator
+ Q3PtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator
for ( ; it.current(); ++it) {
toolbar= it.current();
QString group;
@@ -755,9 +764,9 @@ void KMainWindow::finalizeGUI( bool force )
// Since we can't do that immediately, we move them, and _then_
// we call positionYourself again for each of them, but this time
// the toolbariterator should give them in the proper order.
// Both the XMLGUI and applySettings call this, hence "force" for the latter.
- QPtrListIterator<KToolBar> it( toolBarIterator() );
+ Q3PtrListIterator<KToolBar> it( toolBarIterator() );
for ( ; it.current() ; ++ it )
it.current()->positionYourself( force );
d->settingsDirty = false;
@@ -850,9 +859,9 @@ QString KMainWindow::settingsGroup() const
void KMainWindow::resizeEvent( QResizeEvent * e)
{
if ( d->autoSaveWindowSize )
setSettingsDirty();
- QMainWindow::resizeEvent( e );
+ Q3MainWindow::resizeEvent( e );
}
bool KMainWindow::hasMenuBar()
{
@@ -868,9 +877,9 @@ QMenuBar *KMainWindow::menuBar()
//US mb = new KMenuBar( this );
mb = new QMenuBar( this );
// trigger a re-layout and trigger a call to the private
// setMenuBar method.
- QMainWindow::menuBar();
+ Q3MainWindow::menuBar();
}
return mb;
}
@@ -883,9 +892,9 @@ QStatusBar *KMainWindow::statusBar()
//US sb = new KStatusBar( this );
sb = new QStatusBar( this );
// trigger a re-layout and trigger a call to the private
// setStatusBar method.
- QMainWindow::statusBar();
+ Q3MainWindow::statusBar();
}
return sb;
}
@@ -907,44 +916,32 @@ void KMainWindow::shuttingDown()
//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;
+ QObjectList l = queryList( "QMenuBar", 0, false, false );
+ if(l.empty())
+ return 0;
+ return (QMenuBar*)l.front();
}
//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;
+ QObjectList l = queryList( "QStatusBar", 0, false, false );
+ if(l.empty())
+ return 0;
+ return (QStatusBar*)l.front();
}
void KMainWindow::childEvent( QChildEvent* e)
{
- QMainWindow::childEvent( e );
+ Q3MainWindow::childEvent( e );
}
void KMainWindow::paintEvent( QPaintEvent * e)
{
- QMainWindow::paintEvent( e );
+ Q3MainWindow::paintEvent( e );
}
QSize KMainWindow::sizeForCentralWidgetSize(QSize size)
{