-rw-r--r-- | noncore/settings/aqpkg/datamgr.cpp | 3 | ||||
-rw-r--r-- | noncore/settings/aqpkg/datamgr.h | 6 | ||||
-rw-r--r-- | noncore/settings/aqpkg/global.h | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 4 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.cpp | 105 | ||||
-rw-r--r-- | noncore/settings/aqpkg/main.cpp | 7 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mem.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/package.cpp | 27 | ||||
-rw-r--r-- | noncore/settings/aqpkg/version.cpp | 19 |
10 files changed, 65 insertions, 116 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index cd0c78f..67f90a3 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp @@ -39,8 +39,11 @@ #include "datamgr.h" #include "global.h" +QString LOCAL_SERVER; +QString LOCAL_IPKGS; + QString DataManager::availableCategories = ""; DataManager::DataManager() : QObject( 0x0, 0x0 ) diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h index 32a1e57..9f8920d 100644 --- a/noncore/settings/aqpkg/datamgr.h +++ b/noncore/settings/aqpkg/datamgr.h @@ -39,10 +39,12 @@ using namespace std; #include "server.h" #include "destination.h" -#define LOCAL_SERVER "Installed Pkgs" -#define LOCAL_IPKGS "local IPKG" +//#define LOCAL_SERVER "Installed Pkgs" +//#define LOCAL_IPKGS "local IPKG" +extern QString LOCAL_SERVER; +extern QString LOCAL_IPKGS; /** *@author Andy Qua */ diff --git a/noncore/settings/aqpkg/global.h b/noncore/settings/aqpkg/global.h index 4fdd51d..0325a59 100644 --- a/noncore/settings/aqpkg/global.h +++ b/noncore/settings/aqpkg/global.h @@ -29,9 +29,9 @@ #ifndef __GLOBAL_H #define __GLOBAL_H -#define VERSION_TEXT "AQPkg Version 1.11" +//extern QString VERSION_TEXT; // Uncomment the below line to run on a Linux box rather than a Zaurus // box this allows you to change where root is, and where to load config files from // #define X86 diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 17f7b08..ea2c47f 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp @@ -393,13 +393,11 @@ void InstallDlgImpl :: displayAvailableSpace( const QString &text ) long div = 1024 / blockSize; if ( !mult ) mult = 1; if ( !div ) div = 1; -// long total = totalBlocks * mult / div; long avail = availBlocks * mult / div; -// long used = total - avail; - space.sprintf( "%ld Kb", avail ); + space = tr( "%1 Kb" ).arg( avail ); } else space = tr( "Unknown" ); diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp index 3df569b..43eaaae 100644 --- a/noncore/settings/aqpkg/ipkg.cpp +++ b/noncore/settings/aqpkg/ipkg.cpp @@ -126,9 +126,9 @@ void Ipkg :: runIpkg() commands << package; if ( package != "" ) - emit outputText( QString( "Dealing with package " ) + package ); + emit outputText( tr( "Dealing with package %1" ).arg( package) ); qApp->processEvents(); // If we are removing, reinstalling or upgrading packages and make links option is selected @@ -137,9 +137,9 @@ void Ipkg :: runIpkg() { createLinks = false; if ( flags & MAKE_LINKS ) { - emit outputText( QString( "Removing symbolic links...\n" ) ); + emit outputText( tr( "Removing symbolic links...\n" ) ); linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); emit outputText( QString( " " ) ); } } @@ -161,9 +161,9 @@ void Ipkg :: createSymLinks() createLinks = true; if ( flags & MAKE_LINKS ) { emit outputText( " " ); - emit outputText( QString( "Creating symbolic links for " )+ package ); + emit outputText( tr( "Creating symbolic links for %1." ).arg( package) ); linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); // link dependant packages that were installed with this release @@ -172,17 +172,17 @@ void Ipkg :: createSymLinks() { if ( *pkg == package ) continue; emit outputText( " " ); - emit outputText( QString( "Creating symbolic links for " )+ (*pkg) ); + emit outputText( tr( "Creating symbolic links for %1" ).arg( *pkg ) ); linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir ); } } } delete dependantPackages; - emit outputText( "Finished" ); + emit outputText( tr("Finished") ); emit outputText( "" ); } void Ipkg :: removeStatusEntry() @@ -194,29 +194,29 @@ void Ipkg :: removeStatusEntry() QString outStatusFile = statusFile; outStatusFile.append( ".tmp" ); emit outputText( "" ); - emit outputText( "Removing status entry..." ); - QString tempstr = "status file - "; + emit outputText( tr("Removing status entry...") ); + QString tempstr = tr("status file - "); tempstr.append( statusFile ); emit outputText( tempstr ); - tempstr = "package - "; + tempstr = tr("package - "); tempstr.append( package ); emit outputText( tempstr ); ifstream in( statusFile ); ofstream out( outStatusFile ); if ( !in.is_open() ) { - tempstr = "Couldn't open status file - "; + tempstr = tr("Couldn't open status file - "); tempstr.append( statusFile ); emit outputText( tempstr ); return; } if ( !out.is_open() ) { - tempstr = "Couldn't create tempory status file - "; + tempstr = tr("Couldn't create tempory status file - "); tempstr.append( outStatusFile ); emit outputText( tempstr ); return; } @@ -314,9 +314,9 @@ int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) // Start the process going finished = false; if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { - emit outputText( QString( "Couldn't start ipkg process" ) ); + emit outputText( tr("Couldn't start ipkg process" ) ); } } void Ipkg::commandStdout(OProcess*, char *buffer, int buflen) @@ -385,74 +385,8 @@ void Ipkg :: abort() aborted = true; } } -/* -int Ipkg :: executeIpkgCommand( QString &cmd, const QString option ) -{ - FILE *fp = NULL; - char line[130]; - QString lineStr, lineStrOld; - int ret = false; - - fp = popen( (const char *) cmd, "r"); - if ( fp == NULL ) - { - QString text; - text.sprintf( "Couldn't execute %s! See stdout for error code", (const char *)cmd ); - emit outputText( text ); - } - else - { - while ( fgets( line, sizeof line, fp) != NULL ) - { - lineStr = line; - lineStr=lineStr.left( lineStr.length()-1 ); - - if ( lineStr != lineStrOld ) - { - //See if we're finished - if ( option == "install" || option == "reinstall" ) - { - // Need to keep track of any dependant packages that get installed - // so that we can create links to them as necessary - if ( lineStr.startsWith( "Installing " ) ) - { - int start = lineStr.find( " " ) + 1; - int end = lineStr.find( " ", start ); - QString *package = new QString( lineStr.mid( start, end-start ) ); - dependantPackages->append( package ); - } - } - - if ( option == "update" ) - { - if (lineStr.contains("Updated list")) - ret = true; - } - else if ( option == "download" ) - { - if (lineStr.contains("Downloaded")) - ret = true; - } - else - { - if (lineStr.contains("Done")) - ret = true; - } - - emit outputText( lineStr ); - } - lineStrOld = lineStr; - qApp->processEvents(); - } - pclose(fp); - } - - return ret; -} -*/ - void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ) { if ( dest == "root" || dest == "/" ) return; @@ -482,9 +416,9 @@ QStringList* Ipkg :: getList( const QString &packageFilename, const QString &des packageFileDir.append( ".list" ); f.setName( packageFileDir ); if ( ! f.open(IO_ReadOnly) ) { - QString tempstr = "Could not open :"; + QString tempstr = tr("Could not open :"); tempstr.append( packageFileDir ); emit outputText( tempstr ); return (QStringList*)0; } @@ -547,9 +481,9 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const { QFileInfo f( linkFile ); if ( !f.exists() ) { - QString tempstr = "Creating directory "; + QString tempstr = tr("Creating directory "); tempstr.append( linkFile ); emit outputText( tempstr ); QDir d; d.mkdir( linkFile, true ); @@ -560,12 +494,11 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const } else { int rc = symlink( sourceFile, linkFile ); - text = (rc == 0 ? "Linked " : "Failed to link "); - text.append( sourceFile ); - text.append( " to " ); - text.append( linkFile ); + text = ( rc == 0 ? tr( "Linked %1 to %2" ) : tr( "Failed to link %1 to %2" ) ). + arg( sourceFile ). + arg( linkFile ); emit outputText( text ); } } else @@ -577,20 +510,18 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const { QFile f( linkFile ); bool rc = f.remove(); - text = (rc ? "Removed " : "Failed to remove "); - text.append( linkFile ); + text = ( rc ? tr( "Removed %1" ) : tr( "Failed to remove %1" ) ).arg( linkFile ); emit outputText( text ); } else if ( f.isDir() ) { QDir d; bool rc = d.rmdir( linkFile, true ); if ( rc ) { - text = (rc ? "Removed " : "Failed to remove "); - text.append( linkFile ); + text = ( rc ? tr( "Removed " ) : tr( "Failed to remove " ) ).arg( linkFile ); emit outputText( text ); } } } diff --git a/noncore/settings/aqpkg/main.cpp b/noncore/settings/aqpkg/main.cpp index 066d79f..b7f8b7b 100644 --- a/noncore/settings/aqpkg/main.cpp +++ b/noncore/settings/aqpkg/main.cpp @@ -41,8 +41,12 @@ #include "global.h" +/* be less intrusive for translation -zecke */ +extern QString LOCAL_SERVER; +extern QString LOCAL_IPKGS; + int main(int argc, char *argv[]) { #ifdef QWS QPEApplication a( argc, argv ); @@ -54,8 +58,11 @@ int main(int argc, char *argv[]) // Disable suspend mode QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; #endif + LOCAL_SERVER = QObject::tr( "Installed packages" ); + LOCAL_IPKGS = QObject::tr( "Local packages" ); + MainWindow *win = new MainWindow(); a.setMainWidget(win); win->showMaximized(); diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 0efa1e0..45a6663 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -1053,27 +1053,25 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) // Version available is the same - option to remove or reinstall caption = tr( "Do you wish to remove or reinstall\n%1?" ); text = tr( "Remove or ReInstall" ); secondButton = tr( "ReInstall" ); - secondOption = tr( "R" ); + secondOption = "R"; // Internal action code, do not translate } else if ( val == 1 ) { // Version available is newer - option to remove or upgrade caption = tr( "Do you wish to remove or upgrade\n%1?" ); text = tr( "Remove or Upgrade" ); secondButton = tr( "Upgrade" ); - secondOption = tr( "U" ); + secondOption = "U"; // Internal action code, do not translate } // Sticky option not implemented yet, but will eventually allow // the user to say something like 'remove all' if ( stickyOption == "" ) { QString msgtext; msgtext = caption.arg( ( const char * )name ); -// switch( QMessageBox::information( this, text, -// msgtext, tr( "Remove" ), secondButton ) ) QuestionDlg dlg( text, msgtext, secondButton ); switch( dlg.exec() ) { case 0: // Cancel diff --git a/noncore/settings/aqpkg/mem.cpp b/noncore/settings/aqpkg/mem.cpp index 5f32a26..4c6117b 100644 --- a/noncore/settings/aqpkg/mem.cpp +++ b/noncore/settings/aqpkg/mem.cpp @@ -98,9 +98,9 @@ void DumpUnfreed() { AllocList::iterator i; long totalSize = 0; char buf[1024]; - + // Debug output, okay to leave untranslated for(i = allocList.begin(); i != allocList.end(); i++) { sprintf(buf, "%-15s: LINE %ld, ADDRESS %ld %ld unfreed", (*i)->file, (*i)->line, (*i)->address, (*i)->size); totalSize += (*i)->size; diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp index 4c27c65..adda832 100644 --- a/noncore/settings/aqpkg/package.cpp +++ b/noncore/settings/aqpkg/package.cpp @@ -29,16 +29,19 @@ #include "package.h" #include "global.h" +#include <qobject.h> + Package::Package( QString &name ) { packageName = name; - version = "N/A"; - description = "N/A"; - packageSize = "N/A"; - section = "N/A"; + QString tempstr = QObject::tr( "N/A" ); + version = tempstr; + description = tempstr; + packageSize = tempstr; + section = tempstr; localPackage = 0; installed = false; packageStoredLocally = false; @@ -50,12 +53,13 @@ Package::Package( QString &name ) Package::Package( char *name ) { packageName = name; - version = "N/A"; - description = "N/A"; - packageSize = "N/A"; - section = "N/A"; + QString tempstr = QObject::tr( "N/A" ); + version = tempstr; + description = tempstr; + packageSize = tempstr; + section = tempstr; localPackage = 0; installed = false; packageStoredLocally = false; @@ -70,13 +74,14 @@ Package::~Package() } QString Package :: toString() { - QString ret = "Package - " + getPackageName() + - "\n version - " + getVersion(); + QString ret = QObject::tr( "Package - %1\n version - %2" ). + arg( getPackageName() ). + arg( getVersion() ); if ( localPackage ) - ret += "\n inst version - " + localPackage->getVersion(); + ret.append( QObject::tr( "\n inst version - %1" ).arg( localPackage->getVersion() ) ); return ret; } diff --git a/noncore/settings/aqpkg/version.cpp b/noncore/settings/aqpkg/version.cpp index e836da1..59e6f3f 100644 --- a/noncore/settings/aqpkg/version.cpp +++ b/noncore/settings/aqpkg/version.cpp @@ -22,9 +22,11 @@ #include <stdlib.h> #include <ctype.h> #include <string.h> -# define _(Text) Text +#include <qobject.h> + +//# define _(Text) Text class versionrevision { public: @@ -108,9 +110,9 @@ int versionsatisfied3(const struct versionrevision *it, if (strcmp(op, ">>") == 0) return r > 0; if (strcmp(op, "=") == 0) return r == 0; - fprintf(stderr, "unknown operator: %s", op); +// fprintf(stderr, "unknown operator: %s", op); exit(1); } @@ -118,15 +120,18 @@ const char *parseversion(struct versionrevision *rversion, const char *string) { char *hyphen, *colon, *eepochcolon; unsigned long epoch; - if (!*string) return _("version string is empty"); + if ( !*string ) + return QObject::tr( "Version string is empty." ); colon= strchr(string,':'); if (colon) { epoch= strtoul(string,&eepochcolon,10); - if (colon != eepochcolon) return _("epoch in version is not number"); - if (!*++colon) return _("nothing after colon in version number"); + if ( colon != eepochcolon ) + return QObject::tr( "Epoch in version is not number." ); + if ( !*++colon ) + return QObject::tr( "Nothing after colon in version number." ); string= colon; rversion->epoch= epoch; } else { rversion->epoch= 0; @@ -166,15 +171,15 @@ int compareVersions( const char *v1, const char *v2 ) versionrevision ver, ref; err = parseversion(&ref, v1); if (err) { - fprintf(stderr, "Invalid version `%s': %s\n", v2, err); +// fprintf(stderr, "Invalid version `%s': %s\n", v2, err); return -2; } err = parseversion(&ver, v2); if (err) { - fprintf(stderr, "Invalid version `%s': %s\n", v1, err); +// fprintf(stderr, "Invalid version `%s': %s\n", v1, err); return -2; } if ( versionsatisfied3( &ver, &ref, "=" ) ) |