File indexing completed on 2024-11-10 05:13:55
0001 /* 0002 SPDX-FileCopyrightText: 1998-2001 Michael Kropfberger <michael.kropfberger@gmx.net> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #include "kdf.h" 0007 0008 #include "kdf_version.h" 0009 #include <KAboutData> 0010 #include <KXMLGUIFactory> 0011 #include <KStandardShortcut> 0012 #include <KStandardAction> 0013 #include <KActionCollection> 0014 #include <KLocalizedString> 0015 0016 #include <QApplication> 0017 #include <QCommandLineParser> 0018 0019 /***************************************************************/ 0020 KDFTopLevel::KDFTopLevel(QWidget *) 0021 : KXmlGuiWindow(nullptr) 0022 { 0023 kdf = new KDFWidget(this,false); 0024 Q_CHECK_PTR(kdf); 0025 QAction *action = actionCollection()->addAction( QStringLiteral("updatedf")); 0026 action->setText( i18nc( "Update action", "&Update" ) ); 0027 actionCollection()->setDefaultShortcuts(action, KStandardShortcut::reload()); 0028 connect(action, &QAction::triggered, kdf, &KDFWidget::updateDF); 0029 0030 KStandardAction::quit(this, &KDFTopLevel::close, actionCollection()); 0031 KStandardAction::preferences(kdf, &KDFWidget::settingsBtnClicked, actionCollection()); 0032 KStandardAction::keyBindings(guiFactory(), &KXMLGUIFactory::showConfigureShortcutsDialog, actionCollection()); 0033 setCentralWidget(kdf); 0034 // kdf->setMinimumSize(kdf->sizeHint()); 0035 kdf->resize(kdf->sizeHint()); 0036 setupGUI(KXmlGuiWindow::Keys | StatusBar | Save | Create); 0037 } 0038 0039 0040 void KDFTopLevel::closeEvent(QCloseEvent *event) 0041 { 0042 kdf->applySettings(); 0043 KXmlGuiWindow::closeEvent(event); 0044 } 0045 0046 0047 /***************************************************************/ 0048 int main(int argc, char **argv) 0049 { 0050 //Fixes blurry icons with fractional scaling 0051 QApplication app(argc, argv); 0052 0053 KLocalizedString::setApplicationDomain(QByteArrayLiteral("kdf")); 0054 0055 KAboutData aboutData(QStringLiteral("kdf"), 0056 i18n("KDiskFree"), 0057 QStringLiteral(KDF_VERSION_STRING), 0058 i18n("KDE free disk space utility"), 0059 KAboutLicense::GPL, 0060 i18n("(c) 1998-2001, Michael Kropfberger"), 0061 QString(), 0062 QStringLiteral("https://apps.kde.org/kdf"), 0063 QString() 0064 ); 0065 0066 aboutData.addAuthor(i18n("Michael Kropfberger"), 0067 QString(), 0068 QStringLiteral("michael.kropfberger@gmx.net")); 0069 0070 QCommandLineParser parser; 0071 parser.setApplicationDescription(aboutData.shortDescription()); 0072 0073 aboutData.setupCommandLine(&parser); 0074 0075 KAboutData::setApplicationData(aboutData); 0076 QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kdf"))); 0077 0078 // do the command line parsing 0079 parser.process(app); 0080 0081 // handle standard options 0082 aboutData.processCommandLine(&parser); 0083 0084 if( app.isSessionRestored() ) //SessionManagement 0085 { 0086 for( int n=1; KDFTopLevel::canBeRestored(n); n++ ) 0087 { 0088 KDFTopLevel *ktl = new KDFTopLevel(); 0089 Q_CHECK_PTR(ktl); 0090 ktl->restore(n); 0091 } 0092 } 0093 else 0094 { 0095 KDFTopLevel *ktl = new KDFTopLevel(); 0096 Q_CHECK_PTR(ktl); 0097 ktl->show(); 0098 } 0099 0100 return app.exec(); 0101 } 0102 0103 0104 0105 #include "moc_kdf.cpp"