summaryrefslogtreecommitdiffstats
path: root/konq-plugins/fsview/main.cpp
blob: 1f6f268069793fd2c283f12ff80cdf76f5f18932 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*****************************************************
 * FSView, a simple TreeMap application
 *
 * (C) 2002, Josef Weidendorfer
 */

#include <tdeapplication.h>
#include <tdecmdlineargs.h>
#include <tdeaboutdata.h>
#include <tdelocale.h>
#include <tdeglobal.h>
#include <tdeconfig.h>

#include "fsview.h"


static TDECmdLineOptions options[] =
{
  { "+[folder]", I18N_NOOP("View filesystem starting from this folder"), 0 },
  TDECmdLineLastOption // End of options.
};

int main(int argc, char* argv[])
{
  // KDE compliant startup
  TDEAboutData aboutData("fsview", I18N_NOOP("FSView"), "0.1",
                       I18N_NOOP("Filesystem Viewer"),
                       TDEAboutData::License_GPL,
                       I18N_NOOP("(c) 2002, Josef Weidendorfer"));
  TDECmdLineArgs::init(argc, argv, &aboutData);
  TDECmdLineArgs::addCmdLineOptions(options);
  TDEApplication a;

  TDEConfigGroup gconfig(TDEGlobal::config(), TQCString("General"));
  TQString path = gconfig.readPathEntry("Path", ".");

  TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
  if (args->count()>0) path = args->arg(0);

  // TreeMap Widget as toplevel window
  FSView w(new Inode());

  TQObject::connect(&w,TQT_SIGNAL(clicked(TreeMapItem*)),
                   &w,TQT_SLOT(selected(TreeMapItem*)));
  TQObject::connect(&w,TQT_SIGNAL(returnPressed(TreeMapItem*)),
                   &w,TQT_SLOT(selected(TreeMapItem*)));
  TQObject::connect(&w,
                   TQT_SIGNAL(contextMenuRequested(TreeMapItem*,const TQPoint&)),
                   &w,TQT_SLOT(contextMenu(TreeMapItem*, const TQPoint&)));

  w.setPath(path);
  w.show();

  a.connect( &a, TQT_SIGNAL( lastWindowClosed() ), &w, TQT_SLOT( quit() ) );
  return a.exec();
}