File indexing completed on 2024-04-21 04:57:58
0001 /* 0002 FSView, a simple TreeMap application 0003 0004 SPDX-FileCopyrightText: 2002 Josef Weidendorfer 0005 */ 0006 0007 #include <kaboutdata.h> 0008 #include <kconfig.h> 0009 0010 #include "fsview.h" 0011 #include <kconfiggroup.h> 0012 #include <QCommandLineParser> 0013 #include <QCommandLineOption> 0014 #include <QApplication> 0015 #include <KAboutData> 0016 #include <KLocalizedString> 0017 #include <KSharedConfig> 0018 0019 int main(int argc, char *argv[]) 0020 { 0021 QApplication app(argc, argv); 0022 // KDE compliant startup 0023 KAboutData aboutData(QStringLiteral("fsview"), i18n("FSView"), QStringLiteral("0.1"), 0024 i18n("Filesystem Viewer"), 0025 KAboutLicense::GPL, 0026 i18n("(c) 2002, Josef Weidendorfer")); 0027 QCommandLineParser parser; 0028 KAboutData::setApplicationData(aboutData); 0029 aboutData.setupCommandLine(&parser); 0030 parser.process(app); 0031 aboutData.processCommandLine(&parser); 0032 0033 parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("+[folder]"), i18n("View filesystem starting from this folder"))); 0034 0035 KConfigGroup gconfig(KSharedConfig::openConfig(), "General"); 0036 QString path = gconfig.readPathEntry("Path", QStringLiteral(".")); 0037 0038 if (parser.positionalArguments().count() > 0) { 0039 path = parser.positionalArguments().at(0); 0040 } 0041 0042 // TreeMap Widget as toplevel window 0043 FSView w(new Inode()); 0044 0045 QObject::connect(&w, &TreeMapWidget::clicked, &w, &FSView::selected); 0046 QObject::connect(&w, &TreeMapWidget::returnPressed, &w, &FSView::selected); 0047 QObject::connect(&w, &TreeMapWidget::contextMenuRequested, &w, &FSView::contextMenu); 0048 0049 w.setPath(path); 0050 w.show(); 0051 0052 return app.exec(); 0053 }