summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/confedit/mainwindow.cpp6
-rw-r--r--noncore/apps/confedit/opie-confedit.control10
2 files changed, 14 insertions, 2 deletions
diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp
index 17a5058..fc403d2 100644
--- a/noncore/apps/confedit/mainwindow.cpp
+++ b/noncore/apps/confedit/mainwindow.cpp
@@ -29,153 +29,155 @@
#include <qlineedit.h>
#include "listviewconfdir.h"
#include "listviewitemconf.h"
#include "listviewitemconfigentry.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0)
{
setCaption( tr("Conf File Editor") );
QWidget *mainWidget = new QWidget(this);
setCentralWidget( mainWidget);
QGridLayout *mainLayout = new QGridLayout( mainWidget );
mainLayout->setSpacing( 3 );
mainLayout->setMargin( 3 );
qDebug("settingList");
settingList = new ListViewConfDir( "/root/Settings/", this, "settingslist");
settingList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding));//, sizePolicy().hasHeightForWidth() ) );
mainLayout->addWidget( settingList, 0, 0 );
qDebug("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 );
makeMenu();
qDebug("connect");
connect(settingList, SIGNAL( pressed(QListViewItem*) ),
this, SLOT(setCurrent(QListViewItem*)));
connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ),
SLOT( groupChanged(const QString&) ) );
connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ),
SLOT( keyChanged(const QString&) ) );
connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ),
SLOT( valueChanged(const QString&) ) );
// qDebug("editor->hide()");
// editor->hide();
qDebug("connect");
connect( settingList, SIGNAL( clicked( QListViewItem* ) ),
this, SLOT( stopTimer( QListViewItem* ) ) );
+ setCurrent(0);
}
void MainWindow::makeMenu()
{
qDebug("MainWindow::makeMenu()");
popupTimer = new QTimer(this);
popupMenuFile = new QPopupMenu(this);
popupMenuEntry = new QPopupMenu(this);
qDebug("Save");
popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 );
popupActionSave->addTo( popupMenuFile );
// popupActionSave->addTo( popupMenuEntry );
connect( popupActionSave, SIGNAL( activated() ),
this , SLOT( saveConfFile() ) );
qDebug("Revert");
popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 );
popupActionRevert->addTo( popupMenuFile );
popupActionRevert->addTo( popupMenuEntry );
connect( popupActionRevert, SIGNAL( activated() ),
this , SLOT( revertConfFile() ) );
qDebug("Delete");
popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 );
popupActionDelete->addTo( popupMenuFile );
popupActionDelete->addTo( popupMenuEntry );
connect( popupActionDelete, SIGNAL( activated() ),
this , SLOT( removeConfFile() ) );
qDebug("connect");
connect( popupTimer, SIGNAL(timeout()),
this, SLOT(showPopup()) );
qDebug("connect");
}
MainWindow::~MainWindow()
{
}
void MainWindow::setCurrent(QListViewItem *item)
{
+ editor->hide();
if (!item) return;
_item = (ListViewItemConf*) item;
if (!_item) return;
popupTimer->start( 750, true );
if (_item->getType() == ListViewItemConf::File)
{
- editor->hide();
updateGeometry();
_currentItem=0;
_fileItem = (ListViewItemConfFile*)item;
return;
- }else editor->show();
+ }
+ editor->show();
_fileItem = 0;
_currentItem = (ListViewItemConfigEntry*)item;
if (!_currentItem) return;
QString file = _currentItem->getFile();
QString group = _currentItem->getGroup();
QString key = _currentItem->getKey();
QString val = _currentItem->getValue();
editor->TextFileName->setText(file);
editor->LineEditGroup->setText(group);
if (!key.isEmpty())
{
editor->isKey(true);
editor->LineEditKey->setText(key);
editor->LineEditValue->setText(val);
}else{
editor->isKey(false);
}
updateGeometry();
editor->updateGeometry();
settingList->updateGeometry();
}
void MainWindow::groupChanged(const QString &g)
{
if (!_currentItem) return;
_currentItem->setGroup(g);
}
void MainWindow::keyChanged(const QString &k)
{
if (!_currentItem) return;
_currentItem->keyChanged(k);
}
void MainWindow::valueChanged(const QString &v)
{
if (!_currentItem) return;
_currentItem->valueChanged(v);
}
void MainWindow::stopTimer( QListViewItem* )
{
popupTimer->stop();
}
void MainWindow::saveConfFile()
diff --git a/noncore/apps/confedit/opie-confedit.control b/noncore/apps/confedit/opie-confedit.control
new file mode 100644
index 0000000..a5491f8
--- a/dev/null
+++ b/noncore/apps/confedit/opie-confedit.control
@@ -0,0 +1,10 @@
+Packagename: opie-confeditor
+Files: bin/confedit apps/Settings/confedit.desktop pics/confedit/confedit.png
+Priority: optional
+Section: opie/
+Maintainer: Patrick S. Vogt <tille@handhelds.org>
+Architecture: arm
+Version: $QPE_VERSION-$SUB_VERSION
+Depends: opie-base ($QPE_VERSION)
+Description: An enditor for the ~/Settings/*.conf files
+