• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

  • tdeui
tdemainwindow.cpp
1 /* This file is part of the KDE libraries
2 Copyright
3 (C) 2000 Reginald Stadlbauer (reggie@kde.org)
4 (C) 1997 Stephan Kulow (coolo@kde.org)
5 (C) 1997-2000 Sven Radej (radej@kde.org)
6 (C) 1997-2000 Matthias Ettrich (ettrich@kde.org)
7 (C) 1999 Chris Schlaeger (cs@kde.org)
8 (C) 2002 Joseph Wenninger (jowenn@kde.org)
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Library General Public
12 License version 2 as published by the Free Software Foundation.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA.
23 */
24#include "config.h"
25
26#include "tdemainwindow.h"
27#include "tdemainwindowiface.h"
28#include "tdetoolbarhandler.h"
29#include "kwhatsthismanager_p.h"
30#include <tqsessionmanager.h>
31#include <tqobjectlist.h>
32#include <tqstyle.h>
33#include <tqlayout.h>
34#include <tqwidgetlist.h>
35#include <tqtimer.h>
36
37#include <tdeaccel.h>
38#include <tdeaction.h>
39#include <tdeapplication.h>
40#include <tdeconfig.h>
41#include <kdebug.h>
42#include <khelpmenu.h>
43#include <tdemenubar.h>
44#include <kstatusbar.h>
45#include <twin.h>
46#include <kedittoolbar.h>
47#include <tdemainwindow.h>
48
49#include <tdelocale.h>
50#include <tdestandarddirs.h>
51#include <kstaticdeleter.h>
52#if defined TQ_WS_X11
53#include <netwm.h>
54#endif
55
56#include <stdlib.h>
57#include <ctype.h>
58#include <assert.h>
59
60class TDEMainWindowPrivate {
61public:
62 bool showHelpMenu:1;
63
64 bool autoSaveSettings:1;
65 bool settingsDirty:1;
66 bool autoSaveWindowSize:1;
67 bool care_about_geometry:1;
68 bool shuttingDown:1;
69 bool newStyleRefCounting:1;
70 TQString autoSaveGroup;
71 TDEAccel * tdeaccel;
72 TDEMainWindowInterface *m_interface;
73 KDEPrivate::ToolBarHandler *toolBarHandler;
74 TQTimer* settingsTimer;
75 TDEToggleAction *showStatusBarAction;
76 TQRect defaultWindowSize;
77 TQPtrList<TQDockWindow> hiddenDockWindows;
78};
79
80TQPtrList<TDEMainWindow>* TDEMainWindow::memberList = 0L;
81static bool no_query_exit = false;
82static KMWSessionManaged* ksm = 0;
83static KStaticDeleter<KMWSessionManaged> ksmd;
84
85class KMWSessionManaged : public KSessionManaged
86{
87public:
88 KMWSessionManaged()
89 {
90 }
91 ~KMWSessionManaged()
92 {
93 }
94 bool saveState( TQSessionManager& )
95 {
96 TDEConfig* config = tdeApp->sessionConfig();
97 if ( TDEMainWindow::memberList->first() ){
98 // According to Jochen Wilhelmy <digisnap@cs.tu-berlin.de>, this
99 // hook is useful for better document orientation
100 TDEMainWindow::memberList->first()->saveGlobalProperties(config);
101 }
102
103 TQPtrListIterator<TDEMainWindow> it(*TDEMainWindow::memberList);
104 int n = 0;
105 for (it.toFirst(); it.current(); ++it){
106 n++;
107 it.current()->savePropertiesInternal(config, n);
108 }
109 config->setGroup(TQString::fromLatin1("Number"));
110 config->writeEntry(TQString::fromLatin1("NumberOfWindows"), n );
111 return true;
112 }
113
114 bool commitData( TQSessionManager& sm )
115 {
116 // not really a fast method but the only compatible one
117 if ( sm.allowsInteraction() ) {
118 bool canceled = false;
119 TQPtrListIterator<TDEMainWindow> it(*TDEMainWindow::memberList);
120 ::no_query_exit = true;
121 for (it.toFirst(); it.current() && !canceled;){
122 TDEMainWindow *window = *it;
123 ++it; // Update now, the current window might get deleted
124 if ( !window->testWState( TQt::WState_ForceHide ) ) {
125 TQCloseEvent e;
126 TQApplication::sendEvent( window, &e );
127 canceled = !e.isAccepted();
128 /* Don't even think_about deleting widgets with
129 TQt::WDestructiveClose flag set at this point. We
130 are faking a close event, but we are *not*_
131 closing the window. The purpose of the faked
132 close event is to prepare the application so it
133 can safely be quit without the user losing data
134 (possibly showing a message box "do you want to
135 save this or that?"). It is possible that the
136 session manager quits the application later
137 (emitting TQApplication::aboutToQuit() when this
138 happens), but it is also possible that the user
139 cancels the shutdown, so the application will
140 continue to run.
141 */
142 }
143 }
144 ::no_query_exit = false;
145 if (canceled)
146 return false;
147
148 TDEMainWindow* last = 0;
149 for (it.toFirst(); it.current() && !canceled; ++it){
150 TDEMainWindow *window = *it;
151 if ( !window->testWState( TQt::WState_ForceHide ) ) {
152 last = window;
153 }
154 }
155 if ( last )
156 return last->queryExit();
157 // else
158 return true;
159 }
160
161 // the user wants it, the user gets it
162 return true;
163 }
164};
165
166static bool being_first = true;
167
168TDEMainWindow::TDEMainWindow( TQWidget* parent, const char *name, WFlags f )
169 : TQMainWindow( parent, name, f ), KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )
170{
171 initTDEMainWindow(name, 0);
172}
173
174TDEMainWindow::TDEMainWindow( int cflags, TQWidget* parent, const char *name, WFlags f )
175 : TQMainWindow( parent, name, f ), KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )
176{
177 initTDEMainWindow(name, cflags);
178}
179
180void TDEMainWindow::initTDEMainWindow(const char *name, int cflags)
181{
182 KWhatsThisManager::init ();
183 setDockMenuEnabled( false );
184 mHelpMenu = 0;
185 tdeApp->setTopWidget( this );
186 actionCollection()->setWidget( this );
187 connect(tdeApp, TQ_SIGNAL(shutDown()), this, TQ_SLOT(shuttingDown()));
188 if( !memberList )
189 memberList = new TQPtrList<TDEMainWindow>;
190
191 if ( !ksm )
192 ksm = ksmd.setObject(ksm, new KMWSessionManaged());
193 // set a unique object name. Required by session management.
194 TQCString objname;
195 TQCString s;
196 int unusedNumber;
197 if ( !name )
198 { // no name given
199 objname = tdeApp->instanceName() + "-mainwindow#";
200 s = objname + '1'; // start adding number immediately
201 unusedNumber = 1;
202 }
203 else if( name[0] != '\0' && name[ strlen( name ) - 1 ] == '#' )
204 { // trailing # - always add a number
205 objname = name;
206 s = objname + '1'; // start adding number immediately
207 unusedNumber = 1;
208 }
209 else
210 {
211 objname = name;
212 s = objname;
213 unusedNumber = 0; // add numbers only when needed
214 }
215 for(;;) {
216 TQWidgetList* list = tdeApp->topLevelWidgets();
217 TQWidgetListIt it( *list );
218 bool found = false;
219 for( TQWidget* w = it.current();
220 w != NULL;
221 ++it, w = it.current())
222 if( w != this && w->name() == s )
223 {
224 found = true;
225 break;
226 }
227 delete list;
228 if( !found )
229 break;
230 s.setNum( ++unusedNumber );
231 s = objname + s;
232 }
233 setName( s );
234
235 memberList->append( this );
236
237 d = new TDEMainWindowPrivate;
238 d->showHelpMenu = true;
239 d->settingsDirty = false;
240 d->autoSaveSettings = false;
241 d->autoSaveWindowSize = true; // for compatibility
242 d->tdeaccel = actionCollection()->tdeaccel();
243 d->toolBarHandler = 0;
244 d->settingsTimer = 0;
245 d->showStatusBarAction = NULL;
246 d->shuttingDown = false;
247 if ((d->care_about_geometry = being_first)) {
248 being_first = false;
249 if ( tdeApp->geometryArgument().isNull() ) // if there is no geometry, it doesn't matter
250 d->care_about_geometry = false;
251 else
252 parseGeometry(false);
253 }
254
255 setCaption( tdeApp->caption() );
256 if ( cflags & NoDCOPObject)
257 d->m_interface = 0;
258 else
259 d->m_interface = new TDEMainWindowInterface(this);
260
261 if ( cflags & NewRefCountMode ) {
262 d->newStyleRefCounting = true;
263 tdeApp->ref();
264 }
265 else {
266 d->newStyleRefCounting = false;
267 }
268
269 if (!tdeApp->authorize("movable_toolbars"))
270 setDockWindowsMovable(false);
271}
272
273TDEAction *TDEMainWindow::toolBarMenuAction()
274{
275 if ( !d->toolBarHandler )
276 return 0;
277
278 return d->toolBarHandler->toolBarMenuAction();
279}
280
281
282void TDEMainWindow::setupToolbarMenuActions()
283{
284 if ( d->toolBarHandler )
285 d->toolBarHandler->setupActions();
286}
287
288void TDEMainWindow::parseGeometry(bool parsewidth)
289{
290 assert ( !tdeApp->geometryArgument().isNull() );
291 assert ( d->care_about_geometry );
292
293#if defined TQ_WS_X11
294 int x, y;
295 int w, h;
296 int m = XParseGeometry( tdeApp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h);
297 if (parsewidth) {
298 TQSize minSize = minimumSize();
299 TQSize maxSize = maximumSize();
300 if ( !(m & WidthValue) )
301 w = width();
302 if ( !(m & HeightValue) )
303 h = height();
304 w = TQMIN(w,maxSize.width());
305 h = TQMIN(h,maxSize.height());
306 w = TQMAX(w,minSize.width());
307 h = TQMAX(h,minSize.height());
308 resize(w, h);
309 } else {
310 if ( parsewidth && !(m & XValue) )
311 x = geometry().x();
312 if ( parsewidth && !(m & YValue) )
313 y = geometry().y();
314 if ( (m & XNegative) )
315 x = TDEApplication::desktop()->width() + x - w;
316 if ( (m & YNegative) )
317 y = TDEApplication::desktop()->height() + y - h;
318 move(x, y);
319 }
320#endif
321}
322
323TDEMainWindow::~TDEMainWindow()
324{
325 delete d->settingsTimer;
326 TQMenuBar* mb = internalMenuBar();
327 delete mb;
328 delete d->m_interface;
329 delete d;
330 memberList->remove( this );
331}
332
333TDEPopupMenu* TDEMainWindow::helpMenu( const TQString &aboutAppText, bool showWhatsThis )
334{
335 if( !mHelpMenu ) {
336 if ( aboutAppText.isEmpty() )
337 mHelpMenu = new KHelpMenu( this, instance()->aboutData(), showWhatsThis);
338 else
339 mHelpMenu = new KHelpMenu( this, aboutAppText, showWhatsThis );
340
341 if ( !mHelpMenu )
342 return 0;
343 connect( mHelpMenu, TQ_SIGNAL( showAboutApplication() ),
344 this, TQ_SLOT( showAboutApplication() ) );
345 }
346
347 return mHelpMenu->menu();
348}
349
350TDEPopupMenu* TDEMainWindow::customHelpMenu( bool showWhatsThis )
351{
352 if( !mHelpMenu ) {
353 mHelpMenu = new KHelpMenu( this, TQString::null, showWhatsThis );
354 connect( mHelpMenu, TQ_SIGNAL( showAboutApplication() ),
355 this, TQ_SLOT( showAboutApplication() ) );
356 }
357
358 return mHelpMenu->menu();
359}
360
361bool TDEMainWindow::canBeRestored( int number )
362{
363 if ( !tdeApp->isRestored() )
364 return false;
365 TDEConfig *config = tdeApp->sessionConfig();
366 if ( !config )
367 return false;
368 config->setGroup( TQString::fromLatin1("Number") );
369 int n = config->readNumEntry( TQString::fromLatin1("NumberOfWindows") , 1 );
370 return number >= 1 && number <= n;
371}
372
373const TQString TDEMainWindow::classNameOfToplevel( int number )
374{
375 if ( !tdeApp->isRestored() )
376 return TQString::null;
377 TDEConfig *config = tdeApp->sessionConfig();
378 if ( !config )
379 return TQString::null;
380 TQString s;
381 s.setNum( number );
382 s.prepend( TQString::fromLatin1("WindowProperties") );
383 config->setGroup( s );
384 if ( !config->hasKey( TQString::fromLatin1("ClassName") ) )
385 return TQString::null;
386 else
387 return config->readEntry( TQString::fromLatin1("ClassName") );
388}
389
390void TDEMainWindow::show()
391{
392 TQMainWindow::show();
393
394 for ( TQPtrListIterator<TQDockWindow> it( d->hiddenDockWindows ); it.current(); ++it )
395 it.current()->show();
396
397 d->hiddenDockWindows.clear();
398}
399
400void TDEMainWindow::hide()
401{
402 if ( isVisible() ) {
403
404 d->hiddenDockWindows.clear();
405
406 TQObjectList *list = queryList( "TQDockWindow" );
407 for( TQObjectListIt it( *list ); it.current(); ++it ) {
408 TQDockWindow *dw = (TQDockWindow*)it.current();
409 if ( dw->isTopLevel() && dw->isVisible() ) {
410 d->hiddenDockWindows.append( dw );
411 dw->hide();
412 }
413 }
414 delete list;
415 }
416
417 TQWidget::hide();
418}
419
420bool TDEMainWindow::restore( int number, bool show )
421{
422 if ( !canBeRestored( number ) )
423 return false;
424 TDEConfig *config = tdeApp->sessionConfig();
425 if ( readPropertiesInternal( config, number ) ){
426 if ( show )
427 TDEMainWindow::show();
428 return false;
429 }
430 return false;
431}
432
433KXMLGUIFactory *TDEMainWindow::guiFactory()
434{
435 if ( !factory_ )
436 factory_ = new KXMLGUIFactory( this, this, "guifactory" );
437 return factory_;
438}
439
440int TDEMainWindow::configureToolbars()
441{
442 saveMainWindowSettings(TDEGlobal::config());
443 KEditToolbar dlg(actionCollection(), xmlFile(), true, this);
444 connect(&dlg, TQ_SIGNAL(newToolbarConfig()), TQ_SLOT(saveNewToolbarConfig()));
445 return dlg.exec();
446}
447
448void TDEMainWindow::saveNewToolbarConfig()
449{
450 createGUI(xmlFile());
451 applyMainWindowSettings( TDEGlobal::config() );
452}
453
454void TDEMainWindow::setupGUI( int options, const TQString & xmlfile ) {
455 setupGUI(TQSize(), options, xmlfile);
456}
457
458void TDEMainWindow::setupGUI( TQSize defaultSize, int options, const TQString & xmlfile ) {
459 if( options & Keys ){
460 KStdAction::keyBindings(guiFactory(),
461 TQ_SLOT(configureShortcuts()), actionCollection());
462 }
463
464 if( (options & StatusBar) && internalStatusBar() ){
465 createStandardStatusBarAction();
466 }
467
468 if( options & ToolBar ){
469 setStandardToolBarMenuEnabled( true );
470 KStdAction::configureToolbars(this,
471 TQ_SLOT(configureToolbars() ), actionCollection());
472 }
473
474 if( options & Create ){
475 createGUI(xmlfile,false);
476 }
477
478 if( options & Save ){
479 // setupGUI() is typically called in the constructor before show(),
480 // so the default window size will be incorrect unless the application
481 // hard coded the size which they should try not to do (i.e. use
482 // size hints).
483 if(initialGeometrySet())
484 {
485 // Do nothing...
486 }
487 else if(defaultSize.isValid())
488 {
489 resize(defaultSize);
490 }
491 else if(!isShown())
492 {
493 adjustSize();
494 }
495 setAutoSaveSettings();
496 }
497
498}
499
500void TDEMainWindow::createGUI( const TQString &xmlfile, bool _conserveMemory )
501{
502 // disabling the updates prevents unnecessary redraws
503 setUpdatesEnabled( false );
504
505 // just in case we are rebuilding, let's remove our old client
506 guiFactory()->removeClient( this );
507
508 // make sure to have an empty GUI
509 TQMenuBar* mb = internalMenuBar();
510 if ( mb )
511 mb->clear();
512
513 (void)toolBarIterator(); // make sure toolbarList is most-up-to-date
514 toolbarList.setAutoDelete( true );
515 toolbarList.clear();
516 toolbarList.setAutoDelete( false );
517
518 // don't build a help menu unless the user ask for it
519 if (d->showHelpMenu) {
520 // we always want a help menu
521 if (!helpMenu2)
522 helpMenu2 = new KHelpMenu(this, instance()->aboutData(), true,
523 actionCollection());
524 }
525
526 // we always want to load in our global standards file
527 setXMLFile( locate( "config", "ui/ui_standards.rc", instance() ) );
528
529 // now, merge in our local xml file. if this is null, then that
530 // means that we will be only using the global file
531 if ( !xmlfile.isNull() ) {
532 setXMLFile( xmlfile, true );
533 } else {
534 TQString auto_file(instance()->instanceName() + "ui.rc");
535 setXMLFile( auto_file, true );
536 }
537
538 // make sure we don't have any state saved already
539 setXMLGUIBuildDocument( TQDomDocument() );
540
541 // do the actual GUI building
542 guiFactory()->addClient( this );
543
544 // try and get back *some* of our memory
545 if ( _conserveMemory )
546 {
547 // before freeing the memory allocated by the DOM document we also
548 // free all memory allocated internally in the KXMLGUIFactory for
549 // the menubar and the toolbars . This however implies that we
550 // have to take care of deleting those widgets ourselves. For
551 // destruction this is no problem, but when rebuilding we have
552 // to take care of that (and we want to rebuild the GUI when
553 // using stuff like the toolbar editor ).
554 // In addition we have to take care of not removing containers
555 // like popupmenus, defined in the XML document.
556 // this code should probably go into a separate method in TDEMainWindow.
557 // there's just one problem: I'm bad in finding names ;-) , so
558 // I skipped this ;-)
559
560 TQDomDocument doc = domDocument();
561
562 for( TQDomNode n = doc.documentElement().firstChild();
563 !n.isNull(); n = n.nextSibling())
564 {
565 TQDomElement e = n.toElement();
566
567 if ( e.tagName().lower() == "toolbar" )
568 factory_->resetContainer( e.attribute( "name" ) );
569 else if ( e.tagName().lower() == "menubar" )
570 factory_->resetContainer( e.tagName(), true );
571 }
572
573 conserveMemory();
574 }
575
576 setUpdatesEnabled( true );
577 updateGeometry();
578}
579
580void TDEMainWindow::setHelpMenuEnabled(bool showHelpMenu)
581{
582 d->showHelpMenu = showHelpMenu;
583}
584
585bool TDEMainWindow::isHelpMenuEnabled()
586{
587 return d->showHelpMenu;
588}
589
590void TDEMainWindow::setCaption( const TQString &caption )
591{
592 setPlainCaption( tdeApp->makeStdCaption(caption) );
593}
594
595void TDEMainWindow::setCaption( const TQString &caption, bool modified )
596{
597 setPlainCaption( tdeApp->makeStdCaption(caption, true, modified) );
598}
599
600void TDEMainWindow::setPlainCaption( const TQString &caption )
601{
602 TQMainWindow::setCaption( caption );
603#if defined TQ_WS_X11
604 NETWinInfo info( tqt_xdisplay(), winId(), tqt_xrootwin(), 0 );
605 info.setName( caption.utf8().data() );
606#endif
607}
608
609void TDEMainWindow::appHelpActivated( void )
610{
611 if( !mHelpMenu ) {
612 mHelpMenu = new KHelpMenu( this );
613 if ( !mHelpMenu )
614 return;
615 }
616 mHelpMenu->appHelpActivated();
617}
618
619void TDEMainWindow::slotStateChanged(const TQString &newstate)
620{
621 stateChanged(newstate, KXMLGUIClient::StateNoReverse);
622}
623
624/*
625 * Get rid of this for KDE 4.0
626 */
627void TDEMainWindow::slotStateChanged(const TQString &newstate,
628 KXMLGUIClient::ReverseStateChange reverse)
629{
630 stateChanged(newstate, reverse);
631}
632
633/*
634 * Enable this for KDE 4.0
635 */
636// void TDEMainWindow::slotStateChanged(const TQString &newstate,
637// bool reverse)
638// {
639// stateChanged(newstate,
640// reverse ? KXMLGUIClient::StateReverse : KXMLGUIClient::StateNoReverse);
641// }
642
643void TDEMainWindow::closeEvent ( TQCloseEvent *e )
644{
645 // Save settings if auto-save is enabled, and settings have changed
646 if (d->settingsDirty && d->autoSaveSettings)
647 saveAutoSaveSettings();
648
649 if (queryClose()) {
650 e->accept();
651
652 int not_withdrawn = 0;
653 TQPtrListIterator<TDEMainWindow> it(*TDEMainWindow::memberList);
654 for (it.toFirst(); it.current(); ++it){
655 if ( !it.current()->isHidden() && it.current()->isTopLevel() && it.current() != this )
656 not_withdrawn++;
657 }
658
659 if ( !no_query_exit && not_withdrawn <= 0 ) { // last window close accepted?
660 if ( queryExit() && !tdeApp->sessionSaving() && !d->shuttingDown ) { // Yes, Quit app?
661 // don't call queryExit() twice
662 disconnect(tdeApp, TQ_SIGNAL(shutDown()), this, TQ_SLOT(shuttingDown()));
663 d->shuttingDown = true;
664 tdeApp->deref(); // ...and quit application.
665 } else {
666 // cancel closing, it's stupid to end up with no windows at all....
667 e->ignore();
668 }
669 }
670 }
671}
672
673bool TDEMainWindow::queryExit()
674{
675 return true;
676}
677
678bool TDEMainWindow::queryClose()
679{
680 return true;
681}
682
683void TDEMainWindow::saveGlobalProperties( TDEConfig* )
684{
685}
686
687void TDEMainWindow::readGlobalProperties( TDEConfig* )
688{
689}
690
691#if defined(KDE_COMPAT)
692void TDEMainWindow::updateRects()
693{
694}
695#endif
696
697void TDEMainWindow::showAboutApplication()
698{
699}
700
701void TDEMainWindow::savePropertiesInternal( TDEConfig *config, int number )
702{
703 bool oldASWS = d->autoSaveWindowSize;
704 d->autoSaveWindowSize = true; // make saveMainWindowSettings save the window size
705
706 TQString s;
707 s.setNum(number);
708 s.prepend(TQString::fromLatin1("WindowProperties"));
709 config->setGroup(s);
710
711 // store objectName, className, Width and Height for later restoring
712 // (Only useful for session management)
713 config->writeEntry(TQString::fromLatin1("ObjectName"), name());
714 config->writeEntry(TQString::fromLatin1("ClassName"), className());
715
716 saveMainWindowSettings(config); // Menubar, statusbar and Toolbar settings.
717
718 s.setNum(number);
719 config->setGroup(s);
720 saveProperties(config);
721
722 d->autoSaveWindowSize = oldASWS;
723}
724
725void TDEMainWindow::saveMainWindowSettings(TDEConfig *config, const TQString &configGroup)
726{
727 kdDebug(200) << "TDEMainWindow::saveMainWindowSettings " << configGroup << endl;
728 TQString oldGroup;
729
730 if (!configGroup.isEmpty())
731 {
732 oldGroup = config->group();
733 config->setGroup(configGroup);
734 }
735
736 // Called by session management - or if we want to save the window size anyway
737 if ( d->autoSaveWindowSize )
738 saveWindowSize( config );
739
740 TQStatusBar* sb = internalStatusBar();
741 if (sb) {
742 if(!config->hasDefault("StatusBar") && !sb->isHidden() )
743 config->revertToDefault("StatusBar");
744 else
745 config->writeEntry("StatusBar", sb->isHidden() ? "Disabled" : "Enabled");
746 }
747
748 TQMenuBar* mb = internalMenuBar();
749 if (mb) {
750 TQString MenuBar = TQString::fromLatin1("MenuBar");
751 if(!config->hasDefault("MenuBar") && !mb->isHidden() )
752 config->revertToDefault("MenuBar");
753 else
754 config->writeEntry("MenuBar", mb->isHidden() ? "Disabled" : "Enabled");
755 }
756
757 int n = 1; // Toolbar counter. toolbars are counted from 1,
758 TDEToolBar *toolbar = 0;
759 TQPtrListIterator<TDEToolBar> it( toolBarIterator() );
760 while ( ( toolbar = it.current() ) ) {
761 ++it;
762 TQString group;
763 if (!configGroup.isEmpty())
764 {
765 // Give a number to the toolbar, but prefer a name if there is one,
766 // because there's no real guarantee on the ordering of toolbars
767 group = (!::qstrcmp(toolbar->name(), "unnamed") ? TQString::number(n) : TQString(" ")+toolbar->name());
768 group.prepend(" Toolbar");
769 group.prepend(configGroup);
770 }
771 toolbar->saveSettings(config, group);
772 n++;
773 }
774 if (!configGroup.isEmpty())
775 config->setGroup(oldGroup);
776}
777
778void TDEMainWindow::setStandardToolBarMenuEnabled( bool enable )
779{
780 if ( enable ) {
781 if ( d->toolBarHandler )
782 return;
783
784 d->toolBarHandler = new KDEPrivate::ToolBarHandler( this );
785
786 if ( factory() )
787 factory()->addClient( d->toolBarHandler );
788 } else {
789 if ( !d->toolBarHandler )
790 return;
791
792 if ( factory() )
793 factory()->removeClient( d->toolBarHandler );
794
795 delete d->toolBarHandler;
796 d->toolBarHandler = 0;
797 }
798}
799
800bool TDEMainWindow::isStandardToolBarMenuEnabled() const
801{
802 return ( d->toolBarHandler );
803}
804
805void TDEMainWindow::createStandardStatusBarAction(){
806 if(!d->showStatusBarAction){
807 d->showStatusBarAction = KStdAction::showStatusbar(this, TQ_SLOT(setSettingsDirty()), actionCollection());
808 KStatusBar *sb = statusBar(); // Creates statusbar if it doesn't exist already.
809 connect(d->showStatusBarAction, TQ_SIGNAL(toggled(bool)), sb, TQ_SLOT(setShown(bool)));
810 d->showStatusBarAction->setChecked(sb->isHidden());
811 }
812}
813
814bool TDEMainWindow::readPropertiesInternal( TDEConfig *config, int number )
815{
816 if ( number == 1 )
817 readGlobalProperties( config );
818
819 // in order they are in toolbar list
820 TQString s;
821 s.setNum(number);
822 s.prepend(TQString::fromLatin1("WindowProperties"));
823
824 config->setGroup(s);
825
826 // restore the object name (window role)
827 if ( config->hasKey(TQString::fromLatin1("ObjectName" )) )
828 setName( config->readEntry(TQString::fromLatin1("ObjectName")).latin1()); // latin1 is right here
829
830 applyMainWindowSettings(config); // Menubar, statusbar and toolbar settings.
831
832 s.setNum(number);
833 config->setGroup(s);
834 readProperties(config);
835 return true;
836}
837
838void TDEMainWindow::applyMainWindowSettings(TDEConfig *config, const TQString &configGroup)
839{
840 return applyMainWindowSettings(config,configGroup,false);
841}
842
843void TDEMainWindow::applyMainWindowSettings(TDEConfig *config, const TQString &configGroup,bool force)
844{
845 kdDebug(200) << "TDEMainWindow::applyMainWindowSettings" << endl;
846
847 TDEConfigGroupSaver saver( config, configGroup.isEmpty() ? config->group() : configGroup );
848
849 restoreWindowSize(config);
850
851 TQStatusBar* sb = internalStatusBar();
852 if (sb) {
853 TQString entry = config->readEntry("StatusBar", "Enabled");
854 if ( entry == "Disabled" )
855 sb->hide();
856 else
857 sb->show();
858 if(d->showStatusBarAction)
859 d->showStatusBarAction->setChecked(!sb->isHidden());
860 }
861
862 TQMenuBar* mb = internalMenuBar();
863 if (mb) {
864 TQString entry = config->readEntry ("MenuBar", "Enabled");
865 if ( entry == "Disabled" )
866 mb->hide();
867 else
868 mb->show();
869 }
870
871 int n = 1; // Toolbar counter. toolbars are counted from 1,
872 TDEToolBar *toolbar;
873 TQPtrListIterator<TDEToolBar> it( toolBarIterator() ); // must use own iterator
874
875 for ( ; it.current(); ++it) {
876 toolbar= it.current();
877 TQString group;
878 if (!configGroup.isEmpty())
879 {
880 // Give a number to the toolbar, but prefer a name if there is one,
881 // because there's no real guarantee on the ordering of toolbars
882 group = (!::qstrcmp(toolbar->name(), "unnamed") ? TQString::number(n) : TQString(" ")+toolbar->name());
883 group.prepend(" Toolbar");
884 group.prepend(configGroup);
885 }
886 toolbar->applySettings(config, group, force);
887 n++;
888 }
889
890 finalizeGUI( true );
891}
892
893void TDEMainWindow::finalizeGUI( bool force )
894{
895 //kdDebug(200) << "TDEMainWindow::finalizeGUI force=" << force << endl;
896 // The whole reason for this is that moveToolBar relies on the indexes
897 // of the other toolbars, so in theory it should be called only once per
898 // toolbar, but in increasing order of indexes.
899 // Since we can't do that immediately, we move them, and _then_
900 // we call positionYourself again for each of them, but this time
901 // the toolbariterator should give them in the proper order.
902 // Both the XMLGUI and applySettings call this, hence "force" for the latter.
903 TQPtrListIterator<TDEToolBar> it( toolBarIterator() );
904 for ( ; it.current() ; ++it ) {
905 it.current()->positionYourself( force );
906 }
907
908 d->settingsDirty = false;
909}
910
911void TDEMainWindow::saveWindowSize( TDEConfig * config ) const
912{
913 int scnum = TQApplication::desktop()->screenNumber(parentWidget());
914 TQRect desk = TQApplication::desktop()->screenGeometry(scnum);
915 int w, h;
916#if defined TQ_WS_X11
917 // save maximalization as desktop size + 1 in that direction
918 KWin::WindowInfo info = KWin::windowInfo( winId(), NET::WMState );
919 w = info.state() & NET::MaxHoriz ? desk.width() + 1 : width();
920 h = info.state() & NET::MaxVert ? desk.height() + 1 : height();
921#else
922 if (isMaximized()) {
923 w = desk.width() + 1;
924 h = desk.height() + 1;
925 }
926 //TODO: add "Maximized" property instead "+1" hack
927#endif
928 TQRect size( desk.width(), w, desk.height(), h );
929 bool defaultSize = (size == d->defaultWindowSize);
930 TQString widthString = TQString::fromLatin1("Width %1").arg(desk.width());
931 TQString heightString = TQString::fromLatin1("Height %1").arg(desk.height());
932 if (!config->hasDefault(widthString) && defaultSize)
933 config->revertToDefault(widthString);
934 else
935 config->writeEntry(widthString, w );
936
937 if (!config->hasDefault(heightString) && defaultSize)
938 config->revertToDefault(heightString);
939 else
940 config->writeEntry(heightString, h );
941}
942
943void TDEMainWindow::restoreWindowSize( TDEConfig * config )
944{
945 if (d->care_about_geometry) {
946 parseGeometry(true);
947 } else {
948 // restore the size
949 int scnum = TQApplication::desktop()->screenNumber(parentWidget());
950 TQRect desk = TQApplication::desktop()->screenGeometry(scnum);
951 if ( d->defaultWindowSize.isNull() ) // only once
952 d->defaultWindowSize = TQRect(desk.width(), width(), desk.height(), height()); // store default values
953 TQSize size( config->readNumEntry( TQString::fromLatin1("Width %1").arg(desk.width()), 0 ),
954 config->readNumEntry( TQString::fromLatin1("Height %1").arg(desk.height()), 0 ) );
955 if (size.isEmpty()) {
956 // try the KDE 2.0 way
957 size = TQSize( config->readNumEntry( TQString::fromLatin1("Width"), 0 ),
958 config->readNumEntry( TQString::fromLatin1("Height"), 0 ) );
959 if (!size.isEmpty()) {
960 // make sure the other resolutions don't get old settings
961 config->writeEntry( TQString::fromLatin1("Width"), 0 );
962 config->writeEntry( TQString::fromLatin1("Height"), 0 );
963 }
964 }
965 if ( !size.isEmpty() ) {
966#ifdef TQ_WS_X11
967 int state = 0;
968 if (size.width() > desk.width()) {
969 state = state | NET::MaxHoriz;
970 }
971 if (size.height() > desk.height()) {
972 state = state | NET::MaxVert;
973 }
974
975 if (( state & NET::Max ) == NET::Max ) {
976 resize( desk.width(), desk.height());
977 }
978 else if(( state & NET::MaxHoriz ) == NET::MaxHoriz ) {
979 resize( width(), size.height());
980 }
981 else if(( state & NET::MaxVert ) == NET::MaxVert ) {
982 resize( size.width(), height());
983 }
984 else {
985 resize( size );
986 }
987 // TQWidget::showMaximized() is both insufficient and broken
988 KWin::setState( winId(), state );
989#else
990 if (size.width() > desk.width() || size.height() > desk.height())
991 setWindowState( WindowMaximized );
992 else
993 resize( size );
994#endif
995 }
996 }
997}
998
999bool TDEMainWindow::initialGeometrySet() const
1000{
1001 return d->care_about_geometry;
1002}
1003
1004void TDEMainWindow::ignoreInitialGeometry()
1005{
1006 d->care_about_geometry = false;
1007}
1008
1009void TDEMainWindow::setSettingsDirty()
1010{
1011 //kdDebug(200) << "TDEMainWindow::setSettingsDirty" << endl;
1012 d->settingsDirty = true;
1013 if ( d->autoSaveSettings )
1014 {
1015 // Use a timer to save "immediately" user-wise, but not too immediately
1016 // (to compress calls and save only once, in case of multiple changes)
1017 if ( !d->settingsTimer )
1018 {
1019 d->settingsTimer = new TQTimer( this );
1020 connect( d->settingsTimer, TQ_SIGNAL( timeout() ), TQ_SLOT( saveAutoSaveSettings() ) );
1021 }
1022 d->settingsTimer->start( 500, true );
1023 }
1024}
1025
1026bool TDEMainWindow::settingsDirty() const
1027{
1028 return d->settingsDirty;
1029}
1030
1031TQString TDEMainWindow::settingsGroup() const
1032{
1033 return d->autoSaveGroup;
1034}
1035
1036void TDEMainWindow::setAutoSaveSettings( const TQString & groupName, bool saveWindowSize )
1037{
1038 d->autoSaveSettings = true;
1039 d->autoSaveGroup = groupName;
1040 d->autoSaveWindowSize = saveWindowSize;
1041 // Get notified when the user moves a toolbar around
1042 disconnect( this, TQ_SIGNAL( dockWindowPositionChanged( TQDockWindow * ) ),
1043 this, TQ_SLOT( setSettingsDirty() ) );
1044 connect( this, TQ_SIGNAL( dockWindowPositionChanged( TQDockWindow * ) ),
1045 this, TQ_SLOT( setSettingsDirty() ) );
1046
1047 // Now read the previously saved settings
1048 applyMainWindowSettings( TDEGlobal::config(), groupName );
1049}
1050
1051void TDEMainWindow::resetAutoSaveSettings()
1052{
1053 d->autoSaveSettings = false;
1054 if ( d->settingsTimer )
1055 d->settingsTimer->stop();
1056}
1057
1058bool TDEMainWindow::autoSaveSettings() const
1059{
1060 return d->autoSaveSettings;
1061}
1062
1063TQString TDEMainWindow::autoSaveGroup() const
1064{
1065 return d->autoSaveGroup;
1066}
1067
1068void TDEMainWindow::saveAutoSaveSettings()
1069{
1070 Q_ASSERT( d->autoSaveSettings );
1071 //kdDebug(200) << "TDEMainWindow::saveAutoSaveSettings -> saving settings" << endl;
1072 saveMainWindowSettings( TDEGlobal::config(), d->autoSaveGroup );
1073 TDEGlobal::config()->sync();
1074 d->settingsDirty = false;
1075 if ( d->settingsTimer )
1076 d->settingsTimer->stop();
1077}
1078
1079void TDEMainWindow::resizeEvent( TQResizeEvent * )
1080{
1081 if ( d->autoSaveWindowSize )
1082 setSettingsDirty();
1083}
1084
1085bool TDEMainWindow::hasMenuBar()
1086{
1087 return (internalMenuBar());
1088}
1089
1090KMenuBar *TDEMainWindow::menuBar()
1091{
1092 KMenuBar * mb = internalMenuBar();
1093 if ( !mb ) {
1094 mb = new KMenuBar( this );
1095 // trigger a re-layout and trigger a call to the private
1096 // setMenuBar method.
1097 TQMainWindow::menuBar();
1098 }
1099 return mb;
1100}
1101
1102KStatusBar *TDEMainWindow::statusBar()
1103{
1104 KStatusBar * sb = internalStatusBar();
1105 if ( !sb ) {
1106 sb = new KStatusBar( this );
1107 // trigger a re-layout and trigger a call to the private
1108 // setStatusBar method.
1109 TQMainWindow::statusBar();
1110 }
1111 return sb;
1112}
1113
1114void TDEMainWindow::shuttingDown()
1115{
1116 // Needed for Qt <= 3.0.3 at least to prevent reentrancy
1117 // when queryExit() shows a dialog. Check before removing!
1118 static bool reentrancy_protection = false;
1119 if (!reentrancy_protection)
1120 {
1121 reentrancy_protection = true;
1122 // call the virtual queryExit
1123 queryExit();
1124 reentrancy_protection = false;
1125 }
1126
1127}
1128
1129KMenuBar *TDEMainWindow::internalMenuBar()
1130{
1131 TQObjectList *l = queryList( "KMenuBar", 0, false, false );
1132 if ( !l || !l->first() ) {
1133 delete l;
1134 return 0;
1135 }
1136
1137 KMenuBar *m = (KMenuBar*)l->first();
1138 delete l;
1139 return m;
1140}
1141
1142KStatusBar *TDEMainWindow::internalStatusBar()
1143{
1144 TQObjectList *l = queryList( "KStatusBar", 0, false, false );
1145 if ( !l || !l->first() ) {
1146 delete l;
1147 return 0;
1148 }
1149
1150 KStatusBar *s = (KStatusBar*)l->first();
1151 delete l;
1152 return s;
1153}
1154
1155void TDEMainWindow::childEvent( TQChildEvent* e)
1156{
1157 TQMainWindow::childEvent( e );
1158}
1159
1160TDEToolBar *TDEMainWindow::toolBar( const char * name )
1161{
1162 if (!name)
1163 name = "mainToolBar";
1164 TDEToolBar *tb = (TDEToolBar*)child( name, "TDEToolBar" );
1165 if ( tb )
1166 return tb;
1167 bool honor_mode = (!strcmp(name, "mainToolBar"));
1168
1169 if ( builderClient() )
1170 return new TDEToolBar(this, name, honor_mode); // XMLGUI constructor
1171 else
1172 return new TDEToolBar(this, DockTop, false, name, honor_mode ); // non-XMLGUI
1173}
1174
1175TQPtrListIterator<TDEToolBar> TDEMainWindow::toolBarIterator()
1176{
1177 toolbarList.clear();
1178 TQPtrList<TQToolBar> lst;
1179 for ( int i = (int)TQMainWindow::DockUnmanaged; i <= (int)DockMinimized; ++i ) {
1180 lst = toolBars( (ToolBarDock)i );
1181 for ( TQToolBar *tb = lst.first(); tb; tb = lst.next() ) {
1182 if ( !tb->inherits( "TDEToolBar" ) )
1183 continue;
1184 toolbarList.append( (TDEToolBar*)tb );
1185 }
1186 }
1187 return TQPtrListIterator<TDEToolBar>( toolbarList );
1188}
1189
1190TDEAccel * TDEMainWindow::accel()
1191{
1192 if ( !d->tdeaccel )
1193 d->tdeaccel = new TDEAccel( this, "kmw-tdeaccel" );
1194 return d->tdeaccel;
1195}
1196
1197void TDEMainWindow::paintEvent( TQPaintEvent * pe )
1198{
1199 TQMainWindow::paintEvent(pe); //Upcall to handle SH_MainWindow_SpaceBelowMenuBar rendering
1200}
1201
1202TQSize TDEMainWindow::sizeForCentralWidgetSize(TQSize size)
1203{
1204 TDEToolBar *tb = (TDEToolBar*)child( "mainToolBar", "TDEToolBar" );
1205 if (tb && !tb->isHidden()) {
1206 switch( tb->barPos() )
1207 {
1208 case TDEToolBar::Top:
1209 case TDEToolBar::Bottom:
1210 size += TQSize(0, tb->sizeHint().height());
1211 break;
1212
1213 case TDEToolBar::Left:
1214 case TDEToolBar::Right:
1215 size += TQSize(toolBar()->sizeHint().width(), 0);
1216 break;
1217
1218 case TDEToolBar::Flat:
1219 size += TQSize(0, 3+tdeApp->style().pixelMetric( TQStyle::PM_DockWindowHandleExtent ));
1220 break;
1221
1222 default:
1223 break;
1224 }
1225 }
1226 KMenuBar *mb = internalMenuBar();
1227 if (mb && !mb->isHidden()) {
1228 size += TQSize(0,mb->heightForWidth(size.width()));
1229 if (style().styleHint(TQStyle::SH_MainWindow_SpaceBelowMenuBar, this))
1230 size += TQSize( 0, dockWindowsMovable() ? 1 : 2);
1231 }
1232 TQStatusBar *sb = internalStatusBar();
1233 if( sb && !sb->isHidden() )
1234 size += TQSize(0, sb->sizeHint().height());
1235
1236 return size;
1237}
1238
1239#if KDE_IS_VERSION( 3, 9, 0 )
1240#ifdef __GNUC__
1241#warning Remove, should be in Qt
1242#endif
1243#endif
1244void TDEMainWindow::setIcon( const TQPixmap& p )
1245{
1246 TQMainWindow::setIcon( p );
1247#ifdef TQ_WS_X11
1248 // Qt3 doesn't support _NET_WM_ICON, but TDEApplication::setTopWidget(), which
1249 // is used by TDEMainWindow, sets it
1250 KWin::setIcons( winId(), p, TQPixmap());
1251#endif
1252}
1253
1254TQPtrList<TDEMainWindow>* TDEMainWindow::getMemberList() { return memberList; }
1255
1256// why do we support old gcc versions? using KXMLGUIBuilder::finalizeGUI;
1257// DF: because they compile KDE much faster :)
1258void TDEMainWindow::finalizeGUI( KXMLGUIClient *client )
1259{ KXMLGUIBuilder::finalizeGUI( client ); }
1260
1261void TDEMainWindow::virtual_hook( int id, void* data )
1262{ KXMLGUIBuilder::virtual_hook( id, data );
1263 KXMLGUIClient::virtual_hook( id, data ); }
1264
1265
1266
1267#include "tdemainwindow.moc"
1268
KDEPrivate::ToolBarHandler
Definition: tdetoolbarhandler.h:35
KEditToolbar
A dialog used to customize or configure toolbars.
Definition: kedittoolbar.h:110
KHelpMenu
Standard KDE help menu with dialog boxes.
Definition: khelpmenu.h:132
KHelpMenu::appHelpActivated
void appHelpActivated()
Opens the help page for the application.
Definition: khelpmenu.cpp:187
KHelpMenu::menu
TDEPopupMenu * menu()
Returns a popup menu you can use in the menu bar or where you need it.
Definition: khelpmenu.cpp:112
KMenuBar
KDE Style-able menubar.
Definition: tdemenubar.h:43
KSessionManaged
KSessionManaged::saveState
virtual bool saveState(TQSessionManager &sm)
KSessionManaged::commitData
virtual bool commitData(TQSessionManager &sm)
KStaticDeleter
KStatusBar
KDE statusbar widget
Definition: kstatusbar.h:88
KWin::WindowInfo
KWin::WindowInfo::state
unsigned long state() const
KWin::windowInfo
static WindowInfo windowInfo(WId win, unsigned long properties=0, unsigned long properties2=0)
KWin::setState
static void setState(WId win, unsigned long state)
KWin::setIcons
static void setIcons(WId win, const TQPixmap &icon, const TQPixmap &miniIcon)
KXMLGUIBuilder
Abstract interface for a "GUI builder", used by the GUIFactory This interface is implemented by TDEMa...
Definition: kxmlguibuilder.h:40
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document,...
Definition: kxmlguiclient.h:44
KXMLGUIClient::xmlFile
virtual TQString xmlFile() const
This will return the name of the XML file as set by setXMLFile().
Definition: kxmlguiclient.cpp:133
KXMLGUIClient::instance
virtual TDEInstance * instance() const
Definition: kxmlguiclient.cpp:123
KXMLGUIClient::setXMLGUIBuildDocument
void setXMLGUIBuildDocument(const TQDomDocument &doc)
Definition: kxmlguiclient.cpp:540
KXMLGUIClient::setXMLFile
virtual void setXMLFile(const TQString &file, bool merge=false, bool setXMLDoc=true)
Sets the name of the rc file containing the XML for the part.
Definition: kxmlguiclient.cpp:165
KXMLGUIClient::factory
KXMLGUIFactory * factory() const
Retrieves a pointer to the KXMLGUIFactory this client is associated with (will return 0L if the clien...
Definition: kxmlguiclient.cpp:555
KXMLGUIClient::conserveMemory
virtual void conserveMemory()
This function will attempt to give up some memory after the GUI is built.
Definition: kxmlguiclient.cpp:534
KXMLGUIClient::stateChanged
virtual void stateChanged(const TQString &newstate, ReverseStateChange reverse=StateNoReverse)
Actions can collectively be assigned a "State".
Definition: kxmlguiclient.cpp:899
KXMLGUIClient::actionCollection
virtual TDEActionCollection * actionCollection() const
Retrieves the entire action collection for the GUI client.
Definition: kxmlguiclient.cpp:107
KXMLGUIClient::domDocument
virtual TQDomDocument domDocument() const
Definition: kxmlguiclient.cpp:128
KXMLGUIFactory
KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create a GUI of container widgets...
Definition: kxmlguifactory.h:62
KXMLGUIFactory::removeClient
void removeClient(KXMLGUIClient *client)
Removes the GUI described by the client, by unplugging all provided actions and removing all owned co...
Definition: kxmlguifactory.cpp:321
KXMLGUIFactory::addClient
void addClient(KXMLGUIClient *client)
Creates the GUI described by the TQDomDocument of the client, using the client's actions,...
Definition: kxmlguifactory.cpp:224
KXMLGUIFactory::resetContainer
void resetContainer(const TQString &containerName, bool useTagName=false)
Use this method to free all memory allocated by the KXMLGUIFactory for a specific container,...
Definition: kxmlguifactory.cpp:413
TDEAccel
TDEActionCollection::tdeaccel
TDEAccel * tdeaccel()
Returns the TDEAccel object of the most recently set widget.
Definition: tdeactioncollection.cpp:282
TDEActionCollection::setWidget
virtual void setWidget(TQWidget *widget)
This sets the widget to which the keyboard shortcuts should be attached.
Definition: tdeactioncollection.cpp:152
TDEAction
Class to encapsulate user-driven action or event.
Definition: tdeaction.h:203
TDEConfigBase::hasDefault
bool hasDefault(const TQString &key) const
TDEConfigBase::readEntry
TQString readEntry(const TQString &pKey, const TQString &aDefault=TQString::null) const
TDEConfigBase::revertToDefault
void revertToDefault(const TQString &key)
TDEConfigBase::readNumEntry
int readNumEntry(const TQString &pKey, int nDefault=0) const
TDEConfigBase::group
TQString group() const
TDEConfigBase::sync
virtual void sync()
TDEConfigBase::hasKey
bool hasKey(const TQString &key) const
TDEConfigBase::writeEntry
void writeEntry(const TQString &pKey, const TQString &pValue, bool bPersistent=true, bool bGlobal=false, bool bNLS=false)
TDEConfigBase::setGroup
void setGroup(const TQString &group)
TDEConfigGroupSaver
TDEConfig
TDEGlobal::config
static TDEConfig * config()
TDEMainWindowInterface
DCOP interface to TDEMainWindow.
Definition: tdemainwindowiface.h:41
TDEMainWindow
KDE top level main window
Definition: tdemainwindow.h:99
TDEMainWindow::readProperties
virtual void readProperties(TDEConfig *)
Read your instance-specific properties.
Definition: tdemainwindow.h:890
TDEMainWindow::showAboutApplication
virtual void showAboutApplication()
This slot does nothing.
Definition: tdemainwindow.cpp:697
TDEMainWindow::customHelpMenu
TDEPopupMenu * customHelpMenu(bool showWhatsThis=true)
Returns the help menu.
Definition: tdemainwindow.cpp:350
TDEMainWindow::restore
bool restore(int number, bool show=true)
Restore the session specified by number.
Definition: tdemainwindow.cpp:420
TDEMainWindow::appHelpActivated
void appHelpActivated(void)
Open the help page for the application.
Definition: tdemainwindow.cpp:609
TDEMainWindow::createStandardStatusBarAction
void createStandardStatusBarAction()
Sets whether TDEMainWindow should provide a menu that allows showing/hiding of the statusbar ( using ...
Definition: tdemainwindow.cpp:805
TDEMainWindow::setHelpMenuEnabled
void setHelpMenuEnabled(bool showHelpMenu=true)
Enables the build of a standard help menu when calling createGUI().
Definition: tdemainwindow.cpp:580
TDEMainWindow::menuBar
KMenuBar * menuBar()
Returns a pointer to the menu bar.
Definition: tdemainwindow.cpp:1090
TDEMainWindow::toolBar
TDEToolBar * toolBar(const char *name=0)
Returns a pointer to the toolbar with the specified name.
Definition: tdemainwindow.cpp:1160
TDEMainWindow::setIcon
virtual void setIcon(const TQPixmap &)
Definition: tdemainwindow.cpp:1244
TDEMainWindow::finalizeGUI
virtual void finalizeGUI(KXMLGUIClient *client)
Definition: tdemainwindow.cpp:1258
TDEMainWindow::queryClose
virtual bool queryClose()
Called before the window is closed, either by the user or indirectly by the session manager.
Definition: tdemainwindow.cpp:678
TDEMainWindow::setupToolbarMenuActions
void setupToolbarMenuActions()
Definition: tdemainwindow.cpp:282
TDEMainWindow::hide
virtual void hide()
Reimplementation of TQMainWindow::hide()
Definition: tdemainwindow.cpp:400
TDEMainWindow::classNameOfToplevel
static const TQString classNameOfToplevel(int number)
Returns the className() of the number of the toplevel window which should be restored.
Definition: tdemainwindow.cpp:373
TDEMainWindow::setupGUI
void setupGUI(int options=ToolBar|Keys|StatusBar|Save|Create, const TQString &xmlfile=TQString::null)
Configures the current windows and its actions in the typical KDE fashion.
Definition: tdemainwindow.cpp:454
TDEMainWindow::statusBar
KStatusBar * statusBar()
Returns a pointer to the status bar.
Definition: tdemainwindow.cpp:1102
TDEMainWindow::accel
TDEAccel * accel()
Definition: tdemainwindow.cpp:1190
TDEMainWindow::setStandardToolBarMenuEnabled
void setStandardToolBarMenuEnabled(bool enable)
Sets whether TDEMainWindow should provide a menu that allows showing/hiding the available toolbars ( ...
Definition: tdemainwindow.cpp:778
TDEMainWindow::setCaption
virtual void setCaption(const TQString &caption)
Makes a KDE compliant caption.
Definition: tdemainwindow.cpp:590
TDEMainWindow::initialGeometrySet
bool initialGeometrySet() const
Definition: tdemainwindow.cpp:999
TDEMainWindow::toolBarMenuAction
TDEAction * toolBarMenuAction()
Returns a pointer to the mainwindows action responsible for the toolbars menu.
Definition: tdemainwindow.cpp:273
TDEMainWindow::setSettingsDirty
void setSettingsDirty()
Apply a state change.
Definition: tdemainwindow.cpp:1009
TDEMainWindow::helpMenu
TDEPopupMenu * helpMenu(const TQString &aboutAppText=TQString::null, bool showWhatsThis=true)
Retrieve the standard help menu.
Definition: tdemainwindow.cpp:333
TDEMainWindow::saveNewToolbarConfig
void saveNewToolbarConfig()
Rebuilds the GUI after KEditToolbar changed the toolbar layout.
Definition: tdemainwindow.cpp:448
TDEMainWindow::~TDEMainWindow
virtual ~TDEMainWindow()
Destructor.
Definition: tdemainwindow.cpp:323
TDEMainWindow::readGlobalProperties
virtual void readGlobalProperties(TDEConfig *sessionConfig)
The counterpart of saveGlobalProperties().
Definition: tdemainwindow.cpp:687
TDEMainWindow::getMemberList
static TQPtrList< TDEMainWindow > * getMemberList()
List of members of TDEMainWindow class.
Definition: tdemainwindow.cpp:1254
TDEMainWindow::saveMainWindowSettings
void saveMainWindowSettings(TDEConfig *config, const TQString &groupName=TQString::null)
Save settings for statusbar, menubar and toolbar to their respective groups in the config file config...
Definition: tdemainwindow.cpp:725
TDEMainWindow::resetAutoSaveSettings
void resetAutoSaveSettings()
Disable the auto-save-settings feature.
Definition: tdemainwindow.cpp:1051
TDEMainWindow::canBeRestored
static bool canBeRestored(int number)
Session Management
Definition: tdemainwindow.cpp:361
TDEMainWindow::parseGeometry
void parseGeometry(bool parsewidth)
parse the geometry from the geometry command line argument
Definition: tdemainwindow.cpp:288
TDEMainWindow::sizeForCentralWidgetSize
TQSize sizeForCentralWidgetSize(TQSize size) TDE_DEPRECATED
Definition: tdemainwindow.cpp:1202
TDEMainWindow::Create
@ Create
calls createGUI() once ToolBar, Keys and Statusbar have been taken care of.
Definition: tdemainwindow.h:591
TDEMainWindow::Save
@ Save
auto-saves (and loads) the toolbar/menubar/statusbar settings and window size using the default name.
Definition: tdemainwindow.h:585
TDEMainWindow::ToolBar
@ ToolBar
adds action to show/hide the toolbar(s) and adds action to configure the toolbar(s).
Definition: tdemainwindow.h:562
TDEMainWindow::StatusBar
@ StatusBar
adds action to show/hide the statusbar if the statusbar exists.
Definition: tdemainwindow.h:573
TDEMainWindow::Keys
@ Keys
adds action to show the key configure action.
Definition: tdemainwindow.h:567
TDEMainWindow::saveWindowSize
void saveWindowSize(TDEConfig *config) const
For inherited classes Note that the group must be set before calling.
Definition: tdemainwindow.cpp:911
TDEMainWindow::autoSaveSettings
bool autoSaveSettings() const
Definition: tdemainwindow.cpp:1058
TDEMainWindow::memberList
static TQPtrList< TDEMainWindow > * memberList
List of members of TDEMainWindow class.
Definition: tdemainwindow.h:394
TDEMainWindow::closeEvent
virtual void closeEvent(TQCloseEvent *)
Reimplemented to call the queryClose() and queryExit() handlers.
Definition: tdemainwindow.cpp:643
TDEMainWindow::settingsDirty
bool settingsDirty() const
For inherited classes.
Definition: tdemainwindow.cpp:1026
TDEMainWindow::queryExit
virtual bool queryExit()
Definition: tdemainwindow.cpp:673
TDEMainWindow::configureToolbars
int configureToolbars()
Show a standard configure toolbar dialog.
Definition: tdemainwindow.cpp:440
TDEMainWindow::restoreWindowSize
void restoreWindowSize(TDEConfig *config)
For inherited classes Note that the group must be set before calling, and that a -geometry on the com...
Definition: tdemainwindow.cpp:943
TDEMainWindow::ignoreInitialGeometry
void ignoreInitialGeometry()
Definition: tdemainwindow.cpp:1004
TDEMainWindow::isHelpMenuEnabled
bool isHelpMenuEnabled()
Return true when the help menu is enabled.
Definition: tdemainwindow.cpp:585
TDEMainWindow::saveGlobalProperties
virtual void saveGlobalProperties(TDEConfig *sessionConfig)
Save your application-wide properties.
Definition: tdemainwindow.cpp:683
TDEMainWindow::setAutoSaveSettings
void setAutoSaveSettings(const TQString &groupName=TQString::fromLatin1("MainWindow"), bool saveWindowSize=true)
Call this to enable "auto-save" of toolbar/menubar/statusbar settings (and optionally window size).
Definition: tdemainwindow.cpp:1036
TDEMainWindow::applyMainWindowSettings
void applyMainWindowSettings(TDEConfig *config, const TQString &groupName, bool force)
Read settings for statusbar, menubar and toolbar from their respective groups in the config file and ...
Definition: tdemainwindow.cpp:843
TDEMainWindow::isStandardToolBarMenuEnabled
bool isStandardToolBarMenuEnabled() const
Definition: tdemainwindow.cpp:800
TDEMainWindow::toolBarIterator
TQPtrListIterator< TDEToolBar > toolBarIterator()
Definition: tdemainwindow.cpp:1175
TDEMainWindow::settingsGroup
TQString settingsGroup() const
For inherited classes.
Definition: tdemainwindow.cpp:1031
TDEMainWindow::saveProperties
virtual void saveProperties(TDEConfig *)
Save your instance-specific properties.
Definition: tdemainwindow.h:885
TDEMainWindow::TDEMainWindow
TDEMainWindow(TQWidget *parent=0, const char *name=0, WFlags f=(WFlags)(WType_TopLevel|WDestructiveClose))
Construct a main window.
Definition: tdemainwindow.cpp:168
TDEMainWindow::slotStateChanged
virtual void slotStateChanged(const TQString &newstate)
Apply a state change.
Definition: tdemainwindow.cpp:619
TDEMainWindow::saveAutoSaveSettings
void saveAutoSaveSettings()
This slot should only be called in case you reimplement closeEvent() and if you are using the "auto-s...
Definition: tdemainwindow.cpp:1068
TDEMainWindow::show
virtual void show()
Reimplementation of TQMainWindow::show()
Definition: tdemainwindow.cpp:390
TDEMainWindow::setPlainCaption
virtual void setPlainCaption(const TQString &caption)
Make a plain caption without any modifications.
Definition: tdemainwindow.cpp:600
TDEMainWindow::hasMenuBar
bool hasMenuBar()
Returns true, if there is a menubar.
Definition: tdemainwindow.cpp:1085
TDEMainWindow::autoSaveGroup
TQString autoSaveGroup() const
Definition: tdemainwindow.cpp:1063
TDEMainWindow::createGUI
void createGUI(const TQString &xmlfile=TQString::null, bool _conserveMemory=true)
Create a GUI given a local XML file.
Definition: tdemainwindow.cpp:500
TDEPopupMenu
A menu with title items.
Definition: tdepopupmenu.h:123
TDEToggleAction
Checkbox like action.
Definition: tdeactionclasses.h:69
TDEToolBar
Floatable toolbar with auto resize.
Definition: tdetoolbar.h:105
TDEToolBar::applySettings
void applySettings(TDEConfig *config, const TQString &configGroup, bool force)
Read the toolbar settings from group configGroup in config and apply them.
Definition: tdetoolbar.cpp:1645
TDEToolBar::saveSettings
void saveSettings(TDEConfig *config, const TQString &configGroup)
Save the toolbar settings to group configGroup in config.
Definition: tdetoolbar.cpp:1043
TDEToolBar::barPos
BarPosition barPos() const
Returns the toolbar position.
Definition: tdetoolbar.cpp:771
endl
kndbgstream & endl(kndbgstream &s)
kdDebug
kdbgstream kdDebug(int area=0)
locate
TQString locate(const char *type, const TQString &filename, const TDEInstance *instance=TDEGlobal::instance())
KStdAction::configureToolbars
TDEAction * configureToolbars(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name)
The Customize Toolbar dialog.
Definition: kstdaction.cpp:302
KStdAction::showStatusbar
TDEToggleAction * showStatusbar(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *_name)
Show/Hide the statusbar.
Definition: kstdaction.cpp:270
KStdAction::keyBindings
TDEAction * keyBindings(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name)
Display the configure key bindings dialog.
Definition: kstdaction.cpp:298
TDEStdAccel::name
TQString name(StdAccel id)
tdelocale.h

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.