summaryrefslogtreecommitdiff
path: root/noncore/apps
authortille <tille>2002-06-29 20:53:42 (UTC)
committer tille <tille>2002-06-29 20:53:42 (UTC)
commitcbb1662a1c3bca476294100ce5e0d0eeb3655639 (patch) (side-by-side diff)
treee7deb5afdba0d5fa843675669ae3e089c168d022 /noncore/apps
parent5960b3a2823037c63afba09ca83dbcc0943cd082 (diff)
downloadopie-cbb1662a1c3bca476294100ce5e0d0eeb3655639.zip
opie-cbb1662a1c3bca476294100ce5e0d0eeb3655639.tar.gz
opie-cbb1662a1c3bca476294100ce5e0d0eeb3655639.tar.bz2
makes backups, but does not save the file yet
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/confedit/listviewconfdir.cpp2
-rw-r--r--noncore/apps/confedit/listviewitemconffile.cpp25
-rw-r--r--noncore/apps/confedit/listviewitemconffile.h1
-rw-r--r--noncore/apps/confedit/mainwindow.cpp31
4 files changed, 21 insertions, 38 deletions
diff --git a/noncore/apps/confedit/listviewconfdir.cpp b/noncore/apps/confedit/listviewconfdir.cpp
index b76e425..f466f06 100644
--- a/noncore/apps/confedit/listviewconfdir.cpp
+++ b/noncore/apps/confedit/listviewconfdir.cpp
@@ -38,3 +38,3 @@ void ListViewConfDir::readConfFiles()
confDir.setSorting( QDir::Name );
-
+ confDir.setNameFilter("*.conf");
const QFileInfoList *list = confDir.entryInfoList();
diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp
index 5457384..a8fd770 100644
--- a/noncore/apps/confedit/listviewitemconffile.cpp
+++ b/noncore/apps/confedit/listviewitemconffile.cpp
@@ -23,3 +23,2 @@ ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent)
parseFile();
- _changed = false;
displayText();
@@ -34,3 +33,3 @@ void ListViewItemConfFile::displayText()
{
- setText(0,(_changed?"*":"*")+confFileInfo->fileName());
+ setText(0,(_changed?"*":"")+confFileInfo->fileName());
}
@@ -44,6 +43,3 @@ void ListViewItemConfFile::parseFile()
{
- qDebug( confFileInfo->absFilePath() );
QFile confFile(confFileInfo->absFilePath());
- qDebug( confFileInfo->absFilePath() );
- // QString fileName = confFileInfo->fileName();
if(! confFile.open(IO_ReadOnly))
@@ -66,3 +62,3 @@ void ListViewItemConfFile::parseFile()
{
- qDebug("got group"+s);
+ // qDebug("got group"+s);
group = s.mid(1,s.length()-2);
@@ -84,3 +80,18 @@ void ListViewItemConfFile::save()
{
- qDebug("ListViewItemConfFile::save()");
+ if (!_changed) return;
+ QString backup = confFileInfo->absFilePath()+"~";
+ qDebug("make backup to "+backup);
+ QFile conf(confFileInfo->absFilePath());
+ QFile back(backup);
+
+ if (!conf.open(IO_ReadOnly)) return;
+ if (!back.open(IO_WriteOnly)) return;
+
+ #define SIZE 124
+ char buf[SIZE];
+ while (int c = conf.readBlock(buf, SIZE) ) back.writeBlock(buf,c);
+ conf.close();
+ back.close();
+
+
qDebug("no saveing yet...");
diff --git a/noncore/apps/confedit/listviewitemconffile.h b/noncore/apps/confedit/listviewitemconffile.h
index 9208918..d89b19c 100644
--- a/noncore/apps/confedit/listviewitemconffile.h
+++ b/noncore/apps/confedit/listviewitemconffile.h
@@ -27,3 +27,2 @@ public:
virtual void displayText();
- /** No descriptions */
void save();
diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp
index 5eeeb90..30dfdf7 100644
--- a/noncore/apps/confedit/mainwindow.cpp
+++ b/noncore/apps/confedit/mainwindow.cpp
@@ -88,5 +88,3 @@ void MainWindow::setCurrent(QListViewItem *item)
{
- qDebug("MainWindow::setCurrent(");
if (!item) return;
- qDebug("cast ListViewItemConf");
ListViewItemConf *i = (ListViewItemConf*) item;
@@ -95,2 +93,3 @@ void MainWindow::setCurrent(QListViewItem *item)
{
+ qDebug("start timer");
popupTimer->start( 750, true );
@@ -102,3 +101,2 @@ void MainWindow::setCurrent(QListViewItem *item)
}else editor->show();
- qDebug("cast ListViewItemConfigEntry");
_fileItem = 0;
@@ -167,28 +165,3 @@ void MainWindow::showPopup()
-// if ( !activePackage->installed() )
-// {
-// popupMenu->insertItem( tr("Install to"), destsMenu );
-// QStringList dests = settings->getDestinationNames();
-// QString ad = settings->getDestinationName();
-// for (uint i = 0; i < dests.count(); i++ )
-// {
-// popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
-// popupAction->addTo( destsMenu );
-// if ( dests[i] == ad && activePackage->toInstall() )
-// {
-// popupAction->setToggleAction( true );
-// popupAction->setOn(true);
-// };
-// }
-// connect( destsMenu, SIGNAL( activated( int ) ),
-// this, SLOT( changePackageDest( int ) ) );
-// }else{
-// popupAction = new QAction( tr("Remove"),QString::null, 0, this, 0 );
-// popupAction->addTo( popupMenu );
-// connect( popupAction, SIGNAL( activated() ),
-// this , SLOT( toggleProcess() ) );
-// popupAction = new QAction( tr("Reinstall"),QString::null, 0, this, 0 );
-// popupAction->addTo( popupMenu );
-// popupAction->setEnabled( false );
-// }
+
popupMenu->popup( QCursor::pos() );