author | drw <drw> | 2005-02-23 17:35:32 (UTC) |
---|---|---|
committer | drw <drw> | 2005-02-23 17:35:32 (UTC) |
commit | 9e2e6d962e1e2d3e5c17641d9a9b21a5906bd262 (patch) (side-by-side diff) | |
tree | a0fc4cdf1afdb5a75377a61f738286da0ac27594 | |
parent | 62010b750741307bf56d4db289dcf22f4a6eeb0d (diff) | |
download | opie-9e2e6d962e1e2d3e5c17641d9a9b21a5906bd262.zip opie-9e2e6d962e1e2d3e5c17641d9a9b21a5906bd262.tar.gz opie-9e2e6d962e1e2d3e5c17641d9a9b21a5906bd262.tar.bz2 |
Disable full backup option for Opie 1.2, since it might not work correctly due to memory constraints
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 47 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestorebase.ui | 53 |
2 files changed, 24 insertions, 76 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 180980a..5a4e284 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp @@ -1,87 +1,87 @@ /* - This file is part of the Opie Project + This file is part of the Opie Project =. - .=l. Copyright (c) 2002-2004 The Opie Team <opie-devel@handhelds.org> - .>+-= - _;:, .> :=|. This file is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This file is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General -..}^=.= = ; Public License for more details. -++= -. .` .: - : = ...= . :.=- You should have received a copy of the GNU - -. .:....=;==+<; General Public License along with this file; - -_. . . )=. = see the file COPYING. If not, write to the - -- :-=` Free Software Foundation, Inc., + .=l. Copyright (c) 2002-2004 The Opie Team <opie-devel@handhelds.org> + .>+-= +_;:, .> :=|. This file is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This file is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General +..}^=.= = ; Public License for more details. +++= -. .` .: +: = ...= . :.=- You should have received a copy of the GNU +-. .:....=;==+<; General Public License along with this file; + -_. . . )=. = see the file COPYING. If not, write to the + -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "backuprestore.h" #include "errordialog.h" /* OPIE */ #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> #include <opie2/odebug.h> #include <opie2/odevice.h> #include <opie2/ostorageinfo.h> #include <opie2/ofiledialog.h> #include <opie2/owait.h> using namespace Opie::Core; using namespace Opie::Ui; /* QT */ #include <qapplication.h> #include <qmultilineedit.h> #include <qdir.h> #include <qfile.h> #include <qfileinfo.h> #include <qlistview.h> #include <qpushbutton.h> #include <qradiobutton.h> #include <qheader.h> #include <qmessagebox.h> #include <qcombobox.h> #include <qlist.h> #include <qregexp.h> #include <qtextstream.h> #include <qtextview.h> #include <qlineedit.h> #include <qstringlist.h> /* STD */ #include <errno.h> #include <stdlib.h> #include <unistd.h> #include <sys/stat.h> #include <dirent.h> #define HEADER_NAME 0 #define HEADER_BACKUP 1 #define BACKUP_LOCATION 2 #define EXTENSION ".bck" const QString tempFileName = "/tmp/backup.err"; BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) : BackupAndRestoreBase(parent, name, fl) { backupList->header()->hide(); restoreList->header()->hide(); locationList->header()->hide(); connect( backupButton, SIGNAL( clicked() ), this, SLOT( backup() ) ); connect( restoreButton, SIGNAL( clicked() ), this, SLOT( restore() ) ); connect( backupList, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectItem( QListViewItem* ) ) ); connect( restoreSource, SIGNAL( activated( int ) ), this, SLOT( sourceDirChanged( int ) ) ); @@ -209,132 +209,133 @@ void BackupAndRestore::refreshBackupLocations() } } QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list) { while(item) { if(item->childCount() > 0) getAllItems(item->firstChild(), list); list.append(item); item = item->nextSibling(); } return list; } /** * Selects and unselects the item by setting the HEADER_BACKUP to B or !. * and changing the icon to match * @param currentItem the item to swich the selection choice. */ void BackupAndRestore::selectItem(QListViewItem *currentItem) { if(!currentItem) return; if(currentItem->text(HEADER_BACKUP) == "B") { currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/null")); currentItem->setText(HEADER_BACKUP, ""); } else { currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/check")); currentItem->setText(HEADER_BACKUP, "B"); } } void BackupAndRestore::scanForApplicationSettings() { QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); const QFileInfoList *list = d.entryInfoList(); QFileInfoListIterator it( *list ); QFileInfo *fi; while ( (fi=it.current()) ) { //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) { QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); selectItem(newItem); } ++it; } } /** * The "Backup" button has been pressed. Get a list of all of the files that * should be backed up. If there are no files, emit and error and exit. * Determine the file name to store the backup in. Backup the file(s) using * tar and gzip --best. Report failure or success */ void BackupAndRestore::backup() { - if ( cb_type_userdata->isChecked() ) + backupUserData(); +/* if ( cb_type_userdata->isChecked() ) backupUserData(); else - backupRootFs(); + backupRootFs();*/ } void BackupAndRestore::backupRootFs() { if ( ( ODevice::inst()->model() != Model_Zaurus_SL5000 ) && ( ODevice::inst()->model() != Model_Zaurus_SL5500 ) ) { QMessageBox::critical( this, "Not yet implemented!", "<qt>Sorry, support for this model is not yet done.</qt>", "Ok" ); return; } if ( !QFile::exists( "/usr/bin/mkfs.jffs2" ) && !QFile::exists( "/usr/sbin/mkfs.jffs2" ) ) { QMessageBox::critical( this, "Can't find utility!", "<qt>Can't find mkfs.jffs2 - Install mtd-utils.</qt>", "Ok" ); return; } // call 'mount' and parse its output to gather the device on which the root partition is mounted FILE* mountp = popen( "mount", "r" ); QString device; QString mountpoint; { QTextStream mounto( mountp, IO_ReadOnly ); QString on; QString type; QString filesystem; QString options; while ( !mounto.atEnd() ) { mounto >> device >> on >> mountpoint >> type >> filesystem >> options; if ( mountpoint == "/" ) break; } odebug << device << " is formatted w/ '" << filesystem << "' and mounted on '" << mountpoint << "'" << oendl; if ( !device.startsWith( "/dev/mtdblock" ) ) { QMessageBox::critical( this, "Can't backup!", QString( "<qt>unsupported root device '%1' - needs to be /dev/mtdblockN</qt>").arg( device ), "Ok" ); return; } } // at this point, the QTextStream has been destroy and we can close the FILE* pclose( mountp ); #if 1 int rootmtd = device.right( 1 ).toInt(); #else int rootmtd = 0; #endif odebug << "root mtdblock seems to be '" << rootmtd << "'" << oendl; // scan /proc/mtd to gather the size and erasesize of the root mtdblock QFile procmtdf( "/proc/mtd" ); if ( !procmtdf.open( IO_ReadOnly ) ) { QMessageBox::critical( this, "Can't backup!", "<qt>Can't open /proc/mtd</qt>", "Ok" ); return; } QTextStream procmtd( &procmtdf ); for ( int i = 0; i <= rootmtd; ++i ) procmtd.readLine(); // skip uninteresting things QString dev; QString size; QString erasesize; QString devname; procmtd >> dev >> size >> erasesize >> devname; diff --git a/noncore/settings/backup/backuprestorebase.ui b/noncore/settings/backup/backuprestorebase.ui index c91f292..f2b7d75 100644 --- a/noncore/settings/backup/backuprestorebase.ui +++ b/noncore/settings/backup/backuprestorebase.ui @@ -69,181 +69,128 @@ <class>QComboBox</class> <property stdset="1"> <name>name</name> <cstring>storeToLocation</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>1</vsizetype> </sizepolicy> </property> </widget> <widget row="1" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>labelDestination</cstring> </property> <property stdset="1"> <name>text</name> <string>Destination</string> </property> </widget> <widget row="3" column="0" rowspan="1" colspan="2" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>backupButton</cstring> </property> <property stdset="1"> <name>text</name> <string>&Backup</string> </property> </widget> <widget row="2" column="0" rowspan="1" colspan="2" > <class>QListView</class> <column> <property> <name>text</name> <string>Applications</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <property stdset="1"> <name>name</name> <cstring>backupList</cstring> </property> <property stdset="1"> <name>allColumnsShowFocus</name> <bool>true</bool> </property> <property stdset="1"> <name>rootIsDecorated</name> <bool>true</bool> </property> </widget> - <widget row="0" column="0" rowspan="1" colspan="2" > - <class>QButtonGroup</class> - <property stdset="1"> - <name>name</name> - <cstring>frame_type</cstring> - </property> - <property stdset="1"> - <name>title</name> - <string>Type</string> - </property> - <property> - <name>layoutMargin</name> - </property> - <property> - <name>layoutSpacing</name> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>6</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>2</number> - </property> - <widget row="1" column="0" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>cb_type_fullbackup</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Full Backup (Root File System)</string> - </property> - </widget> - <widget row="0" column="0" > - <class>QRadioButton</class> - <property stdset="1"> - <name>name</name> - <cstring>cb_type_userdata</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>User Data (Configuration + PIM)</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - </widget> - </grid> - </widget> </grid> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>Widget3</cstring> </property> <attribute> <name>title</name> <string>Restore</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>4</number> </property> <property stdset="1"> <name>spacing</name> <number>2</number> </property> <widget row="0" column="1" > <class>QComboBox</class> <property stdset="1"> <name>name</name> <cstring>restoreSource</cstring> </property> </widget> <widget row="2" column="0" rowspan="1" colspan="2" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>restoreButton</cstring> </property> <property stdset="1"> <name>text</name> <string>&Restore</string> </property> </widget> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>destinationLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>Select Source</string> </property> </widget> <widget row="1" column="0" rowspan="1" colspan="2" > <class>QListView</class> <column> <property> <name>text</name> <string>Column 1</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> |