-rw-r--r-- | noncore/apps/confedit/mainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp index e7db86a..45dbcb4 100644 --- a/noncore/apps/confedit/mainwindow.cpp +++ b/noncore/apps/confedit/mainwindow.cpp | |||
@@ -1,116 +1,116 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | 10 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> |
11 | 11 | ||
12 | 12 | ||
13 | #include "mainwindow.h" | 13 | #include "mainwindow.h" |
14 | 14 | ||
15 | #include <qpe/qpemenubar.h> | 15 | #include <qpe/qpemenubar.h> |
16 | #include <qpe/qpemessagebox.h> | 16 | #include <qpe/qpemessagebox.h> |
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qpe/qpetoolbar.h> | 19 | #include <qpe/qpetoolbar.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qaction.h> | 21 | #include <qaction.h> |
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
24 | #include <qtoolbutton.h> | 24 | #include <qtoolbutton.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | 31 | ||
32 | #include "listviewconfdir.h" | 32 | #include "listviewconfdir.h" |
33 | #include "listviewitemconf.h" | 33 | #include "listviewitemconf.h" |
34 | #include "listviewitemconfigentry.h" | 34 | #include "listviewitemconfigentry.h" |
35 | 35 | ||
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 38 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
39 | QDialog( parent, name, f ), _currentItem(0), _fileItem(0) | 39 | QDialog( parent, name, f ), _currentItem(0), _fileItem(0) |
40 | { | 40 | { |
41 | setCaption( tr("Conf File Editor") ); | 41 | setCaption( tr("Conf File Editor") ); |
42 | 42 | ||
43 | //setBaseSize( qApp->globalStrut() ); | 43 | //setBaseSize( qApp->globalStrut() ); |
44 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); | 44 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); |
45 | 45 | ||
46 | mainLayout = new QVBoxLayout( this ); | 46 | mainLayout = new QVBoxLayout( this ); |
47 | mainLayout->setSpacing( 0 ); | 47 | mainLayout->setSpacing( 0 ); |
48 | mainLayout->setMargin( 0 ); | 48 | mainLayout->setMargin( 0 ); |
49 | 49 | ||
50 | 50 | ||
51 | qDebug("creating settingList"); | 51 | qDebug("creating settingList"); |
52 | settingList = new ListViewConfDir( QString(getenv("HOME")) + "/Settings", this, "settingslist"); | 52 | settingList = new ListViewConfDir( QDir::homeDirPath() + "/Settings", this, "settingslist"); |
53 | settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); | 53 | settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); |
54 | mainLayout->addWidget( settingList, 0); | 54 | mainLayout->addWidget( settingList, 0); |
55 | 55 | ||
56 | qDebug("creating editor"); | 56 | qDebug("creating editor"); |
57 | editor = new EditWidget(this); | 57 | editor = new EditWidget(this); |
58 | editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) ); | 58 | editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) ); |
59 | mainLayout->addWidget( editor, 1 ); | 59 | mainLayout->addWidget( editor, 1 ); |
60 | editor->layoutType( ListViewItemConf::File ); | 60 | editor->layoutType( ListViewItemConf::File ); |
61 | 61 | ||
62 | makeMenu(); | 62 | makeMenu(); |
63 | 63 | ||
64 | connect(settingList, SIGNAL( pressed(QListViewItem*) ), | 64 | connect(settingList, SIGNAL( pressed(QListViewItem*) ), |
65 | this, SLOT(setCurrent(QListViewItem*))); | 65 | this, SLOT(setCurrent(QListViewItem*))); |
66 | connect( settingList, SIGNAL( clicked( QListViewItem* ) ), | 66 | connect( settingList, SIGNAL( clicked( QListViewItem* ) ), |
67 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 67 | this, SLOT( stopTimer( QListViewItem* ) ) ); |
68 | 68 | ||
69 | connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), | 69 | connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), |
70 | SLOT( groupChanged(const QString&) ) ); | 70 | SLOT( groupChanged(const QString&) ) ); |
71 | connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ), | 71 | connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ), |
72 | SLOT( keyChanged(const QString&) ) ); | 72 | SLOT( keyChanged(const QString&) ) ); |
73 | connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), | 73 | connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), |
74 | SLOT( valueChanged(const QString&) ) ); | 74 | SLOT( valueChanged(const QString&) ) ); |
75 | 75 | ||
76 | setCurrent(0); | 76 | setCurrent(0); |
77 | editor->layoutType(EditWidget::File); | 77 | editor->layoutType(EditWidget::File); |
78 | } | 78 | } |
79 | 79 | ||
80 | void MainWindow::makeMenu() | 80 | void MainWindow::makeMenu() |
81 | { | 81 | { |
82 | popupTimer = new QTimer(this); | 82 | popupTimer = new QTimer(this); |
83 | popupMenuFile = new QPopupMenu(this); | 83 | popupMenuFile = new QPopupMenu(this); |
84 | popupMenuEntry = new QPopupMenu(this); | 84 | popupMenuEntry = new QPopupMenu(this); |
85 | 85 | ||
86 | popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 ); | 86 | popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 ); |
87 | popupActionSave->addTo( popupMenuFile ); | 87 | popupActionSave->addTo( popupMenuFile ); |
88 | // popupActionSave->addTo( popupMenuEntry ); | 88 | // popupActionSave->addTo( popupMenuEntry ); |
89 | connect( popupActionSave, SIGNAL( activated() ), | 89 | connect( popupActionSave, SIGNAL( activated() ), |
90 | this , SLOT( saveConfFile() ) ); | 90 | this , SLOT( saveConfFile() ) ); |
91 | 91 | ||
92 | popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 ); | 92 | popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 ); |
93 | popupActionRevert->addTo( popupMenuFile ); | 93 | popupActionRevert->addTo( popupMenuFile ); |
94 | popupActionRevert->addTo( popupMenuEntry ); | 94 | popupActionRevert->addTo( popupMenuEntry ); |
95 | connect( popupActionRevert, SIGNAL( activated() ), | 95 | connect( popupActionRevert, SIGNAL( activated() ), |
96 | this , SLOT( revertConfFile() ) ); | 96 | this , SLOT( revertConfFile() ) ); |
97 | 97 | ||
98 | popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 ); | 98 | popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 ); |
99 | popupActionDelete->addTo( popupMenuFile ); | 99 | popupActionDelete->addTo( popupMenuFile ); |
100 | popupActionDelete->addTo( popupMenuEntry ); | 100 | popupActionDelete->addTo( popupMenuEntry ); |
101 | connect( popupActionDelete, SIGNAL( activated() ), | 101 | connect( popupActionDelete, SIGNAL( activated() ), |
102 | this , SLOT( removeConfFile() ) ); | 102 | this , SLOT( removeConfFile() ) ); |
103 | 103 | ||
104 | connect( popupTimer, SIGNAL(timeout()), | 104 | connect( popupTimer, SIGNAL(timeout()), |
105 | this, SLOT(showPopup()) ); | 105 | this, SLOT(showPopup()) ); |
106 | } | 106 | } |
107 | 107 | ||
108 | MainWindow::~MainWindow() | 108 | MainWindow::~MainWindow() |
109 | { | 109 | { |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | void MainWindow::setCurrent(QListViewItem *item) | 114 | void MainWindow::setCurrent(QListViewItem *item) |
115 | { | 115 | { |
116 | //qDebug("MainWindow::setCurrent"); | 116 | //qDebug("MainWindow::setCurrent"); |