1/*
2 * kdf.cpp - KDiskFree
3 *
4 * Copyright 1998-2001 by Michael Kropfberger <michael.kropfberger@gmx.net>
5 *
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.
10 *
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.
15 *
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, USA.
19 *
20 */
21
22#include "kdf.h"
23
24#include <kapplication.h>
25#include <kcmdlineargs.h>
26#include <kaboutdata.h>
27#include <kxmlguifactory.h>
28
29#include <kmenu.h>
30#include <kdebug.h>
31#include <kmenubar.h>
32#include <kaction.h>
33#include <kstandardshortcut.h>
34#include <kstandardaction.h>
35#include <kactioncollection.h>
36
37static const char description[] =
38 I18N_NOOP("KDE free disk space utility");
39
40static const char version[] = "v0.15";
41
42
43/***************************************************************/
44KDFTopLevel::KDFTopLevel(QWidget *)
45 : KXmlGuiWindow(0)
46{
47 kdf = new KDFWidget(this,false);
48 Q_CHECK_PTR(kdf);
49 QAction *action = actionCollection()->addAction( QLatin1String( "updatedf" ));
50 action->setText( i18nc( "Update action", "&Update" ) );
51 connect(action, SIGNAL(triggered(bool)), kdf, SLOT(updateDF()));
52
53 KStandardAction::quit(this, SLOT(close()), actionCollection());
54 KStandardAction::preferences(kdf, SLOT(settingsBtnClicked()), actionCollection());
55 KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()),
56 actionCollection());
57 setCentralWidget(kdf);
58 // kdf->setMinimumSize(kdf->sizeHint());
59 kdf->resize(kdf->sizeHint());
60 setupGUI(KXmlGuiWindow::Keys | StatusBar | Save | Create);
61}
62
63
64void KDFTopLevel::closeEvent(QCloseEvent *event)
65{
66 kdf->applySettings();
67 KXmlGuiWindow::closeEvent(event);
68}
69
70
71/***************************************************************/
72int main(int argc, char **argv)
73{
74 KAboutData aboutData( "kdf", 0, ki18n("KDiskFree"),
75 version, ki18n(description), KAboutData::License_GPL,
76 ki18n("(c) 1998-2001, Michael Kropfberger"), KLocalizedString(),
77 "http://utils.kde.org/projects/kdf");
78 aboutData.addAuthor(ki18n("Michael Kropfberger"),KLocalizedString(), "michael.kropfberger@gmx.net");
79 KCmdLineArgs::init( argc, argv, &aboutData );
80
81 KApplication app;
82
83 if( app.isSessionRestored() ) //SessionManagement
84 {
85 for( int n=1; KDFTopLevel::canBeRestored(n); n++ )
86 {
87 KDFTopLevel *ktl = new KDFTopLevel();
88 Q_CHECK_PTR(ktl);
89 ktl->restore(n);
90 }
91 }
92 else
93 {
94 KDFTopLevel *ktl = new KDFTopLevel();
95 Q_CHECK_PTR(ktl);
96 ktl->show();
97 }
98
99 return app.exec();
100}
101
102#include "kdf.moc"
103
104