23 #include "kstatusbar.h"
33 #include <KToggleAction>
34 #include <kapplication.h>
36 #include <kedittoolbar.h>
38 #include <kmessagebox.h>
39 #include <kxmlguifactory.h>
40 #include <kstringhandler.h>
41 #include <kstandardaction.h>
48 #include "messagecomposer/sender/messagesender.h"
51 #include "kmmainwin.moc"
58 setObjectName( QLatin1String(
"kmail-mainwindow#") );
61 setAttribute( Qt::WA_GroupLeader );
63 KAction *action =
new KAction( KIcon(QLatin1String(
"window-new")), i18n(
"New &Window"),
this );
64 actionCollection()->addAction( QLatin1String(
"new_mail_client"), action );
65 connect( action, SIGNAL(triggered(
bool)), SLOT(slotNewMailReader()) );
69 mKMMainWidget =
new KMMainWidget(
this,
this, actionCollection() );
70 connect(mKMMainWidget,SIGNAL(recreateGui()),
this,SLOT(
slotUpdateGui()));
71 setCentralWidget( mKMMainWidget );
73 if (
kmkernel->xmlGuiInstance().isValid() )
74 setComponentData(
kmkernel->xmlGuiInstance() );
76 setStandardToolBarMenuEnabled(
true );
81 KStandardAction::keyBindings( guiFactory(), SLOT(configureShortcuts()),
84 mHideMenuBarAction = KStandardAction::showMenubar(
this, SLOT(slotToggleMenubar()), actionCollection() );
86 slotToggleMenubar(
true );
89 KStandardAction::quit(
this, SLOT(
slotQuit()), actionCollection() );
90 createGUI( QLatin1String(
"kmmainwin.rc") );
93 applyMainWindowSettings(
KMKernel::self()->config()->group(
"Main Window") );
98 connect( mKMMainWidget, SIGNAL(captionChangeRequest(QString)),
99 SLOT(setCaption(QString)) );
107 saveMainWindowSettings(
KMKernel::self()->config()->group(
"Main Window") );
113 if ( !statusBar() || !mLittleProgress )
115 const int statusWidth = statusBar()->width() - mLittleProgress->width()
116 - fontMetrics().maxWidth();
118 const QString
text = fontMetrics().elidedText( QLatin1Char(
' ') + aText, Qt::ElideRight,
128 statusBar()->changeItem( text, 1 );
131 void KMMainWin::slotToggleMenubar(
bool dontShowWarning)
134 if ( mHideMenuBarAction->isChecked() ) {
137 if ( !dontShowWarning ) {
138 const QString accel = mHideMenuBarAction->shortcut().toString();
139 KMessageBox::information(
this,
140 i18n(
"<qt>This will hide the menu bar completely."
141 " You can show it again by typing %1.</qt>", accel ),
142 i18n(
"Hide menu bar"), QLatin1String(
"HideMenuBarWarning") );
152 void KMMainWin::slotNewMailReader()
158 d->resize( d->size() );
164 saveMainWindowSettings(
KMKernel::self()->config()->group(
"Main Window") );
165 KEditToolBar dlg(guiFactory(),
this);
166 connect( &dlg, SIGNAL(newToolBarConfig()), SLOT(
slotUpdateGui()) );
177 createGUI(QLatin1String(
"kmmainwin.rc"));
178 applyMainWindowSettings(
KMKernel::self()->config()->group(
"Main Window") );
189 mProgressDialog->hide();
192 mLittleProgress->show();
194 statusBar()->insertItem( i18n(
"Starting..."), 1, 4 );
196 statusBar()->setItemAlignment( 1, Qt::AlignLeft | Qt::AlignVCenter );
198 statusBar()->addPermanentWidget( mLittleProgress );
199 mLittleProgress->show();
214 KConfigGroup config( kapp->sessionConfig(), QString::number( n ) );
215 bool show = !config.readEntry (
"docked",
false );
217 return KMainWindow::restore ( n, show );
224 KMainWindow::saveProperties( config );
225 config.writeEntry(
"docked", isHidden() );
230 if (
kmkernel->shuttingDown() || kapp->sessionSaving() || mReallyClose )
237 KTipDialog::showTip(
this );
QLabel * vacationScriptIndicator() const
static BroadcastStatus * instance()
KMMainWin(QWidget *parent=0)
virtual QByteArray text(quint32 serialNumber) const =0
void slotShowTipOnStart()
void saveProperties(KConfigGroup &)
Reimplemented to save the docked state.
KMail::TagActionManager * tagActionManager() const
static KMKernel * self()
normal control stuff
KSharedConfig::Ptr config()
void clearActions()
Removes all actions from the GUI again.
void initializeFilterActions()
void displayStatusMsg(const QString &)
static GlobalSettings * self()
void clearFilterActions()
Clear and create actions for marked filters.
bool restoreDockedState(int number)
Same as KMMainWin::restore(), except that it also restores the docked state, which we have saved in s...
void createActions()
Creates and plugs all tag actions.