Fix layout
[kdepim.git] / akonadiconsole / mainwindow.cpp
blob3e67ece6bac295a8683459947e8f348927362819
1 /*
2 This file is part of Akonadi.
4 Copyright (c) 2006 Tobias Koenig <tokoe@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 USA.
22 #include "mainwindow.h"
24 #include <Libkdepim/UiStateSaver>
26 #include <KActionCollection>
27 #include <KConfigGroup>
28 #include <KLocalizedString>
29 #include <KMessageBox>
30 #include <KStandardAction>
32 #include <KSharedConfig>
34 MainWindow::MainWindow(QWidget *parent)
35 : KXmlGuiWindow(parent)
37 mMain = new MainWidget(this);
38 setCentralWidget(mMain);
40 KStandardAction::quit(qApp, SLOT(quit()), actionCollection());
42 setupGUI(Keys /*| ToolBar | StatusBar*/ | Save | Create, QStringLiteral("akonadiconsoleui.rc"));
44 KPIM::UiStateSaver::restoreState(this, KConfigGroup(KSharedConfig::openConfig(), "UiState"));
46 KMessageBox::information(this, QStringLiteral("<p>Akonadi Console is purely a development tool. "
47 "It allows you to view and change internal data structures of Akonadi. "
48 "You should only change data in here if you know what you are doing, otherwise "
49 "you risk damaging or losing your personal information management data.<br/>"
50 "<b>Use at your own risk!</b></p>"),
51 QString(), QStringLiteral("UseAtYourOwnRiskWarning"));
54 MainWindow::~MainWindow()
56 delete mMain;
59 void MainWindow::closeEvent(QCloseEvent *event)
61 KConfigGroup config(KSharedConfig::openConfig(), "UiState");
62 KPIM::UiStateSaver::saveState(this, config);
63 KSharedConfig::openConfig()->sync();
64 KXmlGuiWindow::closeEvent(event);