Diffstat (limited to 'noncore/apps/confedit/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/confedit/mainwindow.cpp | 58 |
1 files changed, 23 insertions, 35 deletions
diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp index fc403d2..6de8741 100644 --- a/noncore/apps/confedit/mainwindow.cpp +++ b/noncore/apps/confedit/mainwindow.cpp | |||
@@ -18,4 +18,5 @@ | |||
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 <qaction.h> | 21 | #include <qaction.h> |
21 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
@@ -35,32 +36,33 @@ | |||
35 | 36 | ||
36 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 37 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
37 | QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0) | 38 | QDialog( parent, name, f ), _currentItem(0), _fileItem(0) |
38 | { | 39 | { |
39 | setCaption( tr("Conf File Editor") ); | 40 | setCaption( tr("Conf File Editor") ); |
40 | 41 | ||
41 | QWidget *mainWidget = new QWidget(this); | 42 | //setBaseSize( qApp->globalStrut() ); |
42 | setCentralWidget( mainWidget); | 43 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); |
43 | QGridLayout *mainLayout = new QGridLayout( mainWidget ); | ||
44 | mainLayout->setSpacing( 3 ); | ||
45 | mainLayout->setMargin( 3 ); | ||
46 | 44 | ||
45 | mainLayout = new QVBoxLayout( this ); | ||
46 | mainLayout->setSpacing( 0 ); | ||
47 | mainLayout->setMargin( 0 ); | ||
47 | 48 | ||
48 | qDebug("settingList"); | 49 | |
50 | qDebug("creating settingList"); | ||
49 | settingList = new ListViewConfDir( "/root/Settings/", this, "settingslist"); | 51 | settingList = new ListViewConfDir( "/root/Settings/", this, "settingslist"); |
50 | settingList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding));//, sizePolicy().hasHeightForWidth() ) ); | 52 | settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); |
51 | mainLayout->addWidget( settingList, 0, 0 ); | 53 | mainLayout->addWidget( settingList, 0); |
52 | 54 | ||
53 | qDebug("editor"); | 55 | qDebug("creating editor"); |
54 | editor = new EditWidget(this); | 56 | editor = new EditWidget(this); |
55 | editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum));//, sizePolicy().hasHeightForWidth() ) ); | 57 | editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) ); |
56 | // editor->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3));//, sizePolicy().hasHeightForWidth() ) ); | 58 | mainLayout->addWidget( editor, 1 ); |
57 | mainLayout->addWidget( editor, 1, 0 ); | 59 | editor->layoutType( ListViewItemConf::File ); |
58 | 60 | ||
59 | makeMenu(); | 61 | makeMenu(); |
60 | 62 | ||
61 | qDebug("connect"); | ||
62 | connect(settingList, SIGNAL( pressed(QListViewItem*) ), | 63 | connect(settingList, SIGNAL( pressed(QListViewItem*) ), |
63 | this, SLOT(setCurrent(QListViewItem*))); | 64 | this, SLOT(setCurrent(QListViewItem*))); |
64 | 65 | connect( settingList, SIGNAL( clicked( QListViewItem* ) ), | |
66 | this, SLOT( stopTimer( QListViewItem* ) ) ); | ||
65 | 67 | ||
66 | connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), | 68 | connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), |
@@ -70,9 +72,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | |||
70 | connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), | 72 | connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), |
71 | SLOT( valueChanged(const QString&) ) ); | 73 | SLOT( valueChanged(const QString&) ) ); |
72 | // qDebug("editor->hide()"); | 74 | |
73 | // editor->hide(); | ||
74 | qDebug("connect"); | ||
75 | connect( settingList, SIGNAL( clicked( QListViewItem* ) ), | ||
76 | this, SLOT( stopTimer( QListViewItem* ) ) ); | ||
77 | setCurrent(0); | 75 | setCurrent(0); |
78 | } | 76 | } |
@@ -80,11 +78,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | |||
80 | void MainWindow::makeMenu() | 78 | void MainWindow::makeMenu() |
81 | { | 79 | { |
82 | qDebug("MainWindow::makeMenu()"); | ||
83 | |||
84 | popupTimer = new QTimer(this); | 80 | popupTimer = new QTimer(this); |
85 | popupMenuFile = new QPopupMenu(this); | 81 | popupMenuFile = new QPopupMenu(this); |
86 | popupMenuEntry = new QPopupMenu(this); | 82 | popupMenuEntry = new QPopupMenu(this); |
87 | 83 | ||
88 | qDebug("Save"); | ||
89 | popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 ); | 84 | popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 ); |
90 | popupActionSave->addTo( popupMenuFile ); | 85 | popupActionSave->addTo( popupMenuFile ); |
@@ -93,5 +88,4 @@ void MainWindow::makeMenu() | |||
93 | this , SLOT( saveConfFile() ) ); | 88 | this , SLOT( saveConfFile() ) ); |
94 | 89 | ||
95 | qDebug("Revert"); | ||
96 | popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 ); | 90 | popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 ); |
97 | popupActionRevert->addTo( popupMenuFile ); | 91 | popupActionRevert->addTo( popupMenuFile ); |
@@ -100,5 +94,4 @@ void MainWindow::makeMenu() | |||
100 | this , SLOT( revertConfFile() ) ); | 94 | this , SLOT( revertConfFile() ) ); |
101 | 95 | ||
102 | qDebug("Delete"); | ||
103 | popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 ); | 96 | popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 ); |
104 | popupActionDelete->addTo( popupMenuFile ); | 97 | popupActionDelete->addTo( popupMenuFile ); |
@@ -107,8 +100,6 @@ void MainWindow::makeMenu() | |||
107 | this , SLOT( removeConfFile() ) ); | 100 | this , SLOT( removeConfFile() ) ); |
108 | 101 | ||
109 | qDebug("connect"); | ||
110 | connect( popupTimer, SIGNAL(timeout()), | 102 | connect( popupTimer, SIGNAL(timeout()), |
111 | this, SLOT(showPopup()) ); | 103 | this, SLOT(showPopup()) ); |
112 | qDebug("connect"); | ||
113 | } | 104 | } |
114 | 105 | ||
@@ -121,5 +112,5 @@ MainWindow::~MainWindow() | |||
121 | void MainWindow::setCurrent(QListViewItem *item) | 112 | void MainWindow::setCurrent(QListViewItem *item) |
122 | { | 113 | { |
123 | editor->hide(); | 114 | //qDebug("MainWindow::setCurrent"); |
124 | if (!item) return; | 115 | if (!item) return; |
125 | _item = (ListViewItemConf*) item; | 116 | _item = (ListViewItemConf*) item; |
@@ -128,10 +119,9 @@ void MainWindow::setCurrent(QListViewItem *item) | |||
128 | if (_item->getType() == ListViewItemConf::File) | 119 | if (_item->getType() == ListViewItemConf::File) |
129 | { | 120 | { |
130 | updateGeometry(); | 121 | editor->layoutType(EditWidget::File); |
131 | _currentItem=0; | 122 | _currentItem=0; |
132 | _fileItem = (ListViewItemConfFile*)item; | 123 | _fileItem = (ListViewItemConfFile*)item; |
133 | return; | 124 | return; |
134 | } | 125 | } |
135 | editor->show(); | ||
136 | _fileItem = 0; | 126 | _fileItem = 0; |
137 | _currentItem = (ListViewItemConfigEntry*)item; | 127 | _currentItem = (ListViewItemConfigEntry*)item; |
@@ -145,13 +135,10 @@ void MainWindow::setCurrent(QListViewItem *item) | |||
145 | if (!key.isEmpty()) | 135 | if (!key.isEmpty()) |
146 | { | 136 | { |
147 | editor->isKey(true); | 137 | editor->layoutType(EditWidget::Entry); |
148 | editor->LineEditKey->setText(key); | 138 | editor->LineEditKey->setText(key); |
149 | editor->LineEditValue->setText(val); | 139 | editor->LineEditValue->setText(val); |
150 | }else{ | 140 | }else{ |
151 | editor->isKey(false); | 141 | editor->layoutType(EditWidget::Group); |
152 | } | 142 | } |
153 | updateGeometry(); | ||
154 | editor->updateGeometry(); | ||
155 | settingList->updateGeometry(); | ||
156 | } | 143 | } |
157 | 144 | ||
@@ -198,4 +185,5 @@ void MainWindow::removeConfFile() | |||
198 | _item->remove(); | 185 | _item->remove(); |
199 | } | 186 | } |
187 | |||
200 | void MainWindow::showPopup() | 188 | void MainWindow::showPopup() |
201 | { | 189 | { |