summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/confedit/editwidget.cpp60
-rw-r--r--noncore/apps/confedit/editwidget.h6
-rw-r--r--noncore/apps/confedit/listviewconfdir.cpp12
-rw-r--r--noncore/apps/confedit/listviewconfdir.h3
-rw-r--r--noncore/apps/confedit/listviewitemconf.h1
-rw-r--r--noncore/apps/confedit/listviewitemconffile.cpp17
-rw-r--r--noncore/apps/confedit/listviewitemconffile.h3
-rw-r--r--noncore/apps/confedit/listviewitemconfigentry.cpp7
-rw-r--r--noncore/apps/confedit/listviewitemconfigentry.h1
-rw-r--r--noncore/apps/confedit/mainwindow.cpp58
-rw-r--r--noncore/apps/confedit/mainwindow.h4
11 files changed, 108 insertions, 64 deletions
diff --git a/noncore/apps/confedit/editwidget.cpp b/noncore/apps/confedit/editwidget.cpp
index 64f968a..f7dc408 100644
--- a/noncore/apps/confedit/editwidget.cpp
+++ b/noncore/apps/confedit/editwidget.cpp
@@ -19,6 +19,7 @@ EditWidget::EditWidget( QWidget* parent, const char* name, WFlags fl )
EditWidgetLayout = new QGridLayout( this );
- EditWidgetLayout->setSpacing( 3 );
- EditWidgetLayout->setMargin( 3 );
+ EditWidgetLayout->setSpacing( 0 );
+ EditWidgetLayout->setMargin( 0 );
+// setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) );
- QLabel *TextLabelFileName = new QLabel( this, "TextLabelFileName" );
+ TextLabelFileName = new QLabel( this, "TextLabelFileName" );
TextLabelFileName->setText( tr( "File Name:" ) );
@@ -28,3 +29,3 @@ EditWidget::EditWidget( QWidget* parent, const char* name, WFlags fl )
- QLabel *TextLabelGroup = new QLabel( this, "TextLabelGroup" );
+ TextLabelGroup = new QLabel( this, "TextLabelGroup" );
TextLabelGroup->setText( tr( "Group:" ) );
@@ -46,2 +47,3 @@ EditWidget::EditWidget( QWidget* parent, const char* name, WFlags fl )
+ // layoutType(Nothing);
}
@@ -54,19 +56,41 @@ EditWidget::~EditWidget()
-void EditWidget::isKey(bool h)
+void EditWidget::layoutType(int t)
{
- if (h)
+ switch (t)
{
- LineEditGroup->setEnabled(false);
- TextLabelKey->show();
- LineEditKey->show();
- TextLabelValue->show();
- LineEditValue->show();
- }else{
- LineEditGroup->setEnabled(true);
- TextLabelKey->hide();
- LineEditKey->hide();
- TextLabelValue->hide();
- LineEditValue->hide();
+ case Entry:
+ LineEditGroup->setEnabled(false);
+ TextLabelKey->show();
+ LineEditKey->show();
+ TextLabelValue->show();
+ LineEditValue->show();
+ TextLabelGroup->show();
+ LineEditGroup->show();
+ TextLabelFileName->show();
+ TextFileName->show();
+ break;
+ case Group:
+ LineEditGroup->setEnabled(true);
+ TextLabelKey->hide();
+ LineEditKey->hide();
+ TextLabelValue->hide();
+ LineEditValue->hide();
+ TextLabelGroup->show();
+ LineEditGroup->show();
+ TextLabelFileName->show();
+ TextFileName->show();
+ break;
+ default:
+ TextLabelKey->hide();
+ LineEditKey->hide();
+ TextLabelValue->hide();
+ LineEditValue->hide();
+ TextLabelGroup->hide();
+ LineEditGroup->hide();
+ TextLabelFileName->hide();
+ TextFileName->hide();
}
- update();
+// update();
+// updateGeometry();
+// adjustSize();
}
diff --git a/noncore/apps/confedit/editwidget.h b/noncore/apps/confedit/editwidget.h
index 673166f..8261c85 100644
--- a/noncore/apps/confedit/editwidget.h
+++ b/noncore/apps/confedit/editwidget.h
@@ -20,2 +20,4 @@ class EditWidget : public QWidget
public:
+ enum{ Entry, Group, File, Nothing};
+
EditWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
@@ -25,2 +27,4 @@ public:
QLabel *TextLabelValue;
+ QLabel *TextLabelGroup;
+ QLabel *TextLabelFileName;
QLabel *TextFileName;
@@ -29,3 +33,3 @@ public:
QLineEdit *LineEditValue;
- void isKey(bool h);
+ void layoutType(int t);
protected:
diff --git a/noncore/apps/confedit/listviewconfdir.cpp b/noncore/apps/confedit/listviewconfdir.cpp
index f466f06..0c2feeb 100644
--- a/noncore/apps/confedit/listviewconfdir.cpp
+++ b/noncore/apps/confedit/listviewconfdir.cpp
@@ -26,2 +26,4 @@ ListViewConfDir::ListViewConfDir(QString settingsPath, QWidget *parent, const ch
readConfFiles();
+
+ connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
}
@@ -49,5 +51,11 @@ void ListViewConfDir::readConfFiles()
fileEntry = new ListViewItemConfFile( fi, this );
-
+ QListViewItem *dummy = new QListViewItem(fileEntry, "dummy");
++it;
}
-} \ No newline at end of file
+}
+
+void ListViewConfDir::expand(QListViewItem *item)
+{
+ ((ListViewItemConf*)item)->expand();
+}
+
diff --git a/noncore/apps/confedit/listviewconfdir.h b/noncore/apps/confedit/listviewconfdir.h
index 3131972..978007b 100644
--- a/noncore/apps/confedit/listviewconfdir.h
+++ b/noncore/apps/confedit/listviewconfdir.h
@@ -25,3 +25,4 @@ public:
~ListViewConfDir();
-
+protected slots:
+ void expand(QListViewItem*);
private:
diff --git a/noncore/apps/confedit/listviewitemconf.h b/noncore/apps/confedit/listviewitemconf.h
index 3c504ed..c005475 100644
--- a/noncore/apps/confedit/listviewitemconf.h
+++ b/noncore/apps/confedit/listviewitemconf.h
@@ -29,2 +29,3 @@ public:
virtual void displayText() = 0;
+ virtual void expand() = 0;
virtual void changed();
diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp
index 228421b..1f85095 100644
--- a/noncore/apps/confedit/listviewitemconffile.cpp
+++ b/noncore/apps/confedit/listviewitemconffile.cpp
@@ -22,3 +22,3 @@ ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent)
confFileInfo = file;
- parseFile();
+// parseFile();
displayText();
@@ -43,2 +43,3 @@ void ListViewItemConfFile::parseFile()
{
+ //qDebug("ListViewItemConfFile::parseFile BEGIN");
QFile confFile(confFileInfo->absFilePath());
@@ -54,3 +55,3 @@ void ListViewItemConfFile::parseFile()
s = t.readLine().stripWhiteSpace();
- // qDebug( "line: >%s<\n", s.latin1() );
+ //qDebug( "line: >%s<\n", s.latin1() );
if (s.contains("<?xml"))
@@ -64,2 +65,3 @@ void ListViewItemConfFile::parseFile()
group = s.mid(1,s.length()-2);
+ if (!groupItem) groupItem = new ListViewItemConfigEntry(this, tr("no group") );
groupItem = new ListViewItemConfigEntry(this, group );
@@ -69,3 +71,4 @@ void ListViewItemConfFile::parseFile()
{
- // qDebug("got key"+s);
+// qDebug("got key"+s);
+ if (!groupItem) qDebug("PANIK NO GROUP! >%s<",group.latin1());
item = new ListViewItemConfigEntry(this, group, s );
@@ -75,4 +78,4 @@ void ListViewItemConfFile::parseFile()
confFile.close();
- unchanged();
setExpandable( _valid );
+// qDebug("ListViewItemConfFile::parseFile END");
}
@@ -142 +145,7 @@ QString ListViewItemConfFile::backupFileName()
}
+
+
+void ListViewItemConfFile::expand()
+{
+ parseFile();
+}
diff --git a/noncore/apps/confedit/listviewitemconffile.h b/noncore/apps/confedit/listviewitemconffile.h
index 679a2ed..18937af 100644
--- a/noncore/apps/confedit/listviewitemconffile.h
+++ b/noncore/apps/confedit/listviewitemconffile.h
@@ -24,3 +24,2 @@ public:
~ListViewItemConfFile();
- void parseFile();
QString fileName();
@@ -31,3 +30,5 @@ public:
virtual void remove();
+ virtual void expand();
QString backupFileName();
+ void parseFile();
protected:
diff --git a/noncore/apps/confedit/listviewitemconfigentry.cpp b/noncore/apps/confedit/listviewitemconfigentry.cpp
index b947514..5ef9f61 100644
--- a/noncore/apps/confedit/listviewitemconfigentry.cpp
+++ b/noncore/apps/confedit/listviewitemconfigentry.cpp
@@ -24,3 +24,2 @@ ListViewItemConfigEntry::ListViewItemConfigEntry(ListViewItemConfFile *parent, Q
_valueOrig = _value;
- _fileItem->unchanged();
}
@@ -145,2 +144,8 @@ void ListViewItemConfigEntry::revert()
displayText();
+}
+
+
+void ListViewItemConfigEntry::expand()
+{
+
} \ No newline at end of file
diff --git a/noncore/apps/confedit/listviewitemconfigentry.h b/noncore/apps/confedit/listviewitemconfigentry.h
index 6b651a6..c5f8737 100644
--- a/noncore/apps/confedit/listviewitemconfigentry.h
+++ b/noncore/apps/confedit/listviewitemconfigentry.h
@@ -37,2 +37,3 @@ public:
virtual void remove();
+ virtual void expand();
void save(QTextStream*);
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
@@ -19,2 +19,3 @@
#include <qpe/qpetoolbar.h>
+#include <qpe/qpeapplication.h>
#include <qaction.h>
@@ -36,3 +37,3 @@
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
- QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0)
+ QDialog( parent, name, f ), _currentItem(0), _fileItem(0)
{
@@ -40,19 +41,20 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
- QWidget *mainWidget = new QWidget(this);
- setCentralWidget( mainWidget);
- QGridLayout *mainLayout = new QGridLayout( mainWidget );
- mainLayout->setSpacing( 3 );
- mainLayout->setMargin( 3 );
+// setBaseSize( qApp->globalStrut() );
+ setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) );
+ mainLayout = new QVBoxLayout( this );
+ mainLayout->setSpacing( 0 );
+ mainLayout->setMargin( 0 );
- qDebug("settingList");
+
+ qDebug("creating settingList");
settingList = new ListViewConfDir( "/root/Settings/", this, "settingslist");
- settingList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding));//, sizePolicy().hasHeightForWidth() ) );
- mainLayout->addWidget( settingList, 0, 0 );
+ settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) );
+ mainLayout->addWidget( settingList, 0);
- qDebug("editor");
+ qDebug("creating editor");
editor = new EditWidget(this);
- editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum));//, sizePolicy().hasHeightForWidth() ) );
-// editor->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3));//, sizePolicy().hasHeightForWidth() ) );
- mainLayout->addWidget( editor, 1, 0 );
+ editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) );
+ mainLayout->addWidget( editor, 1 );
+ editor->layoutType( ListViewItemConf::File );
@@ -60,6 +62,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
- qDebug("connect");
connect(settingList, SIGNAL( pressed(QListViewItem*) ),
this, SLOT(setCurrent(QListViewItem*)));
-
+ connect( settingList, SIGNAL( clicked( QListViewItem* ) ),
+ this, SLOT( stopTimer( QListViewItem* ) ) );
@@ -71,7 +73,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
SLOT( valueChanged(const QString&) ) );
-// qDebug("editor->hide()");
-// editor->hide();
- qDebug("connect");
- connect( settingList, SIGNAL( clicked( QListViewItem* ) ),
- this, SLOT( stopTimer( QListViewItem* ) ) );
+
setCurrent(0);
@@ -81,4 +79,2 @@ void MainWindow::makeMenu()
{
- qDebug("MainWindow::makeMenu()");
-
popupTimer = new QTimer(this);
@@ -87,3 +83,2 @@ void MainWindow::makeMenu()
- qDebug("Save");
popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 );
@@ -94,3 +89,2 @@ void MainWindow::makeMenu()
- qDebug("Revert");
popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 );
@@ -101,3 +95,2 @@ void MainWindow::makeMenu()
- qDebug("Delete");
popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 );
@@ -108,6 +101,4 @@ void MainWindow::makeMenu()
- qDebug("connect");
connect( popupTimer, SIGNAL(timeout()),
this, SLOT(showPopup()) );
- qDebug("connect");
}
@@ -122,3 +113,3 @@ void MainWindow::setCurrent(QListViewItem *item)
{
- editor->hide();
+// qDebug("MainWindow::setCurrent");
if (!item) return;
@@ -129,3 +120,3 @@ void MainWindow::setCurrent(QListViewItem *item)
{
- updateGeometry();
+ editor->layoutType(EditWidget::File);
_currentItem=0;
@@ -134,3 +125,2 @@ void MainWindow::setCurrent(QListViewItem *item)
}
- editor->show();
_fileItem = 0;
@@ -146,3 +136,3 @@ void MainWindow::setCurrent(QListViewItem *item)
{
- editor->isKey(true);
+ editor->layoutType(EditWidget::Entry);
editor->LineEditKey->setText(key);
@@ -150,7 +140,4 @@ void MainWindow::setCurrent(QListViewItem *item)
}else{
- editor->isKey(false);
+ editor->layoutType(EditWidget::Group);
}
- updateGeometry();
- editor->updateGeometry();
- settingList->updateGeometry();
}
@@ -199,2 +186,3 @@ void MainWindow::removeConfFile()
}
+
void MainWindow::showPopup()
diff --git a/noncore/apps/confedit/mainwindow.h b/noncore/apps/confedit/mainwindow.h
index 886b829..5be4a86 100644
--- a/noncore/apps/confedit/mainwindow.h
+++ b/noncore/apps/confedit/mainwindow.h
@@ -15,2 +15,3 @@
#include <qmainwindow.h>
+#include <qdialog.h>
#include <qaction.h>
@@ -25,3 +26,3 @@ class ListViewItemConf;
-class MainWindow : public QMainWindow
+class MainWindow : public QDialog//QMainWindow
{
@@ -49,2 +50,3 @@ private:
EditWidget *editor;
+ QVBoxLayout *mainLayout;
ListViewItemConf *_item;