30 #include "libkdepim/misc/broadcaststatus.h"
31 #include "libkdepim/progresswidget/progressdialog.h"
32 #include "libkdepim/progresswidget/statusbarprogresswidget.h"
35 #include <KActionCollection>
36 #include <KApplication>
38 #include <KEditToolBar>
40 #include <KLocalizedString>
41 #include <KMessageBox>
43 #include <KSqueezedTextLabel>
45 #include <KShortcutsDialog>
46 #include <KStandardAction>
48 #include <KStandardDirs>
49 #include <KTemporaryFile>
51 using namespace Akregator;
56 setObjectName(QLatin1String(name));
65 , m_statusLabel( new KSqueezedTextLabel( this ) )
67 setPluginLoadingMode( DoNotLoadPlugins );
70 setXMLFile(QLatin1String(
"akregator_shell.rc"));
72 KStandardAction::keyBindings(
this, SLOT(optionsConfigureKeys()), actionCollection());
73 KStandardAction::configureToolbars(
this, SLOT(optionsConfigureToolbars()), actionCollection());
78 int statH=fontMetrics().height()+2;
79 m_statusLabel->setTextFormat(Qt::RichText);
80 m_statusLabel->setSizePolicy(QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed ));
81 m_statusLabel->setMinimumWidth( 0 );
82 m_statusLabel->setFixedHeight( statH );
83 statusBar()->addWidget( m_statusLabel, 1 );
85 KStandardAction::quit(kapp, SLOT(quit()), actionCollection());
86 KStandardAction::showMenubar( menuBar(), SLOT(setVisible(
bool)), actionCollection());
87 setStandardToolBarMenuEnabled(
true);
88 createStandardStatusBarAction();
90 connect( KPIM::BroadcastStatus::instance(), SIGNAL(statusMsg(QString)),
101 KPluginLoader loader(QLatin1String(
"akregatorpart"));
102 KPluginFactory*
const factory = loader.factory();
104 KMessageBox::error(
this, i18n(
"Could not find the Akregator part; please check your installation.\n%1", loader.errorString()) );
108 m_part =
static_cast<Akregator::Part*
>( factory->create<KParts::ReadOnlyPart>(
this) );
113 m_part->setObjectName(QLatin1String(
"akregator_part"));
114 setCentralWidget(m_part->widget());
116 connect(m_part, SIGNAL(setWindowCaption(QString)),
this, SLOT(setCaption(QString)) );
119 browserExtension(m_part)->setBrowserInterface(m_browserIface);
120 setAutoSaveSettings();
126 KPIM::ProgressDialog *progressDialog =
new KPIM::ProgressDialog( statusBar(),
this );
127 progressDialog->raise();
128 progressDialog->hide();
129 m_progressBar =
new KPIM::StatusbarProgressWidget( progressDialog, statusBar() );
130 m_progressBar->show();
131 statusBar()->addPermanentWidget( m_progressBar, 0 );
143 m_part->saveProperties(config);
144 config.writeEntry(
"docked", isHidden());
151 m_part->readProperties(config);
156 void MainWindow::optionsConfigureKeys()
158 KShortcutsDialog dlg( KShortcutsEditor::AllActions,
159 KShortcutsEditor::LetterShortcutsAllowed,
this );
161 dlg.addCollection(actionCollection());
163 dlg.addCollection(m_part->actionCollection());
169 void MainWindow::optionsConfigureToolbars()
171 saveMainWindowSettings(KGlobal::config().data()->group( autoSaveGroup()) );
172 KEditToolBar dlg(factory());
173 connect(&dlg, SIGNAL(newToolBarConfig()),
174 this, SLOT(applyNewToolbarConfig()));
179 void MainWindow::applyNewToolbarConfig()
181 applyMainWindowSettings(KGlobal::config()->group( autoSaveGroup()) );
184 KParts::BrowserExtension *MainWindow::browserExtension(KParts::ReadOnlyPart *p)
186 return KParts::BrowserExtension::childObject( p );
191 if ( !kapp->sessionSaving() )
195 return KMainWindow::queryExit();
213 m_statusLabel->setText(QString());
218 m_statusLabel->setText(text);
221 #include "mainwindow.moc"
void setupProgressWidgets()
Creates the progress widget in the status bar and the ProgressDialog and connects them...
This is a RSS Aggregator "Part".
static bool showTrayIcon()
Get Show tray icon.
void readProperties(const KConfigGroup &)
This method is called when this app is restored.
void slotSetStatusBarText(const QString &c)
bool queryClose()
Reimplemented to say if app will be running in system tray if necessary.
void slotClearStatusText()
bool loadPart()
Loads the part.
static TrayIcon * getInstance()
This is the application "Shell".
bool queryExit()
Reimplemented to save settings.
void saveProperties(KConfigGroup &)
This method is called when it is time for the app to save its properties for session management purpo...
BrowserInterface(Akregator::MainWindow *shell, const char *name)
MainWindow(QWidget *parent=0, Qt::WindowFlags f=KDE_DEFAULT_WINDOWFLAGS)