-rw-r--r-- | noncore/settings/aqpkg/datamgr.cpp | 19 | ||||
-rw-r--r-- | noncore/settings/aqpkg/datamgr.h | 8 | ||||
-rw-r--r-- | noncore/settings/aqpkg/global.h | 4 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 4 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.cpp | 139 | ||||
-rw-r--r-- | noncore/settings/aqpkg/main.cpp | 9 | ||||
-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 | 35 | ||||
-rw-r--r-- | noncore/settings/aqpkg/version.cpp | 39 |
10 files changed, 107 insertions, 158 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 @@ -2,3 +2,3 @@ This file is part of the OPIE Project - + =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> @@ -42,2 +42,5 @@ +QString LOCAL_SERVER; +QString LOCAL_IPKGS; + @@ -49,3 +52,3 @@ DataManager::DataManager() availableCategories = "#"; - + serverList.setAutoDelete( TRUE ); @@ -139,3 +142,3 @@ void DataManager :: loadServers() d->linkToRoot( linkToRoot ); - + destList.append( d ); @@ -182,3 +185,3 @@ void DataManager :: reloadServerData( ) int i = 0; - + Server *server; @@ -192,3 +195,3 @@ void DataManager :: reloadServerData( ) qApp->processEvents(); - + // Now we've read the config file in we need to read the servers @@ -203,3 +206,3 @@ void DataManager :: reloadServerData( ) else - server->readPackageFile( getServer( LOCAL_SERVER ) ); + server->readPackageFile( getServer( LOCAL_SERVER ) ); } @@ -214,3 +217,3 @@ void DataManager :: writeOutIpkgConf() } - + QTextStream t( &f ); @@ -296,3 +299,3 @@ void DataManager :: writeOutIpkgConf() t << "#option offline_root target\n"; - + f.close(); 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 @@ -2,3 +2,3 @@ This file is part of the OPIE Project - + =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> @@ -42,4 +42,6 @@ using namespace std; -#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; 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 @@ -2,3 +2,3 @@ This file is part of the OPIE Project - + =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> @@ -32,3 +32,3 @@ -#define VERSION_TEXT "AQPkg Version 1.11" +//extern QString VERSION_TEXT; 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 @@ -396,7 +396,5 @@ void InstallDlgImpl :: displayAvailableSpace( const QString &text ) 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 ); } 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 @@ -2,3 +2,3 @@ This file is part of the OPIE Project - + =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> @@ -113,3 +113,3 @@ void Ipkg :: runIpkg() } - + #ifdef X86 @@ -129,3 +129,3 @@ void Ipkg :: runIpkg() if ( package != "" ) - emit outputText( QString( "Dealing with package " ) + package ); + emit outputText( tr( "Dealing with package %1" ).arg( package) ); @@ -140,3 +140,3 @@ void Ipkg :: runIpkg() { - emit outputText( QString( "Removing symbolic links...\n" ) ); + emit outputText( tr( "Removing symbolic links...\n" ) ); linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); @@ -145,3 +145,3 @@ void Ipkg :: runIpkg() } - + // Execute command @@ -164,3 +164,3 @@ void Ipkg :: createSymLinks() emit outputText( " " ); - emit outputText( QString( "Creating symbolic links for " )+ package ); + emit outputText( tr( "Creating symbolic links for %1." ).arg( package) ); @@ -175,3 +175,3 @@ void Ipkg :: createSymLinks() 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 ); @@ -183,3 +183,3 @@ void Ipkg :: createSymLinks() - emit outputText( "Finished" ); + emit outputText( tr("Finished") ); emit outputText( "" ); @@ -197,10 +197,10 @@ void Ipkg :: removeStatusEntry() 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 ); @@ -209,3 +209,3 @@ void Ipkg :: removeStatusEntry() { - tempstr = "Couldn't open status file - "; + tempstr = tr("Couldn't open status file - "); tempstr.append( statusFile ); @@ -217,3 +217,3 @@ void Ipkg :: removeStatusEntry() { - tempstr = "Couldn't create tempory status file - "; + tempstr = tr("Couldn't create tempory status file - "); tempstr.append( outStatusFile ); @@ -258,3 +258,3 @@ void Ipkg :: removeStatusEntry() - // Improve UI responsiveness + // Improve UI responsiveness i++; @@ -269,4 +269,4 @@ void Ipkg :: removeStatusEntry() out << (const char *)(*it) << endl; - - // Improve UI responsiveness + + // Improve UI responsiveness i++; @@ -275,3 +275,3 @@ void Ipkg :: removeStatusEntry() } - + in.close(); @@ -292,3 +292,3 @@ int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) } - + // OK we're gonna use OProcess to run this thing @@ -307,3 +307,3 @@ int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) this, SLOT(commandStderr(OProcess *, char *, int))); - + for ( QStringList::Iterator it = cmd.begin(); it != cmd.end(); ++it ) @@ -317,3 +317,3 @@ int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) { - emit outputText( QString( "Couldn't start ipkg process" ) ); + emit outputText( tr("Couldn't start ipkg process" ) ); } @@ -348,3 +348,3 @@ void Ipkg::commandStdout(OProcess*, char *buffer, int buflen) } - + buffer[0] = '\0'; @@ -370,3 +370,3 @@ void Ipkg::processFinished() removeStatusEntry(); - + delete proc; @@ -388,68 +388,2 @@ void Ipkg :: abort() -/* -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 ) @@ -458,3 +392,3 @@ void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, cons return; - + qApp->processEvents(); @@ -478,3 +412,3 @@ QStringList* Ipkg :: getList( const QString &packageFilename, const QString &des f.close(); - + packageFileDir = "/usr/lib/ipkg/info/"; @@ -485,3 +419,3 @@ QStringList* Ipkg :: getList( const QString &packageFilename, const QString &des { - QString tempstr = "Could not open :"; + QString tempstr = tr("Could not open :"); tempstr.append( packageFileDir ); @@ -530,3 +464,3 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const sourceFile.append( file ); - + QString linkFile = destDir; @@ -535,3 +469,3 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const linkFile.append( file.mid( 1 ) ); - } + } else @@ -550,3 +484,3 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const { - QString tempstr = "Creating directory "; + QString tempstr = tr("Creating directory "); tempstr.append( linkFile ); @@ -558,3 +492,3 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const // emit outputText( QString( "Directory " ) + linkFile + " already exists" ); - + } @@ -563,6 +497,5 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const 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 ); @@ -580,4 +513,3 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const - text = (rc ? "Removed " : "Failed to remove "); - text.append( linkFile ); + text = ( rc ? tr( "Removed %1" ) : tr( "Failed to remove %1" ) ).arg( linkFile ); emit outputText( text ); @@ -590,4 +522,3 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const { - 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 @@ -2,3 +2,3 @@ This file is part of the OPIE Project - + =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> @@ -44,2 +44,6 @@ +/* be less intrusive for translation -zecke */ +extern QString LOCAL_SERVER; +extern QString LOCAL_IPKGS; + int main(int argc, char *argv[]) @@ -57,2 +61,5 @@ int main(int argc, char *argv[]) + LOCAL_SERVER = QObject::tr( "Installed packages" ); + LOCAL_IPKGS = QObject::tr( "Local packages" ); + MainWindow *win = new MainWindow(); 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 @@ -1056,3 +1056,3 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) secondButton = tr( "ReInstall" ); - secondOption = tr( "R" ); + secondOption = "R"; // Internal action code, do not translate } @@ -1064,3 +1064,3 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) secondButton = tr( "Upgrade" ); - secondOption = tr( "U" ); + secondOption = "U"; // Internal action code, do not translate } @@ -1073,4 +1073,2 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) msgtext = caption.arg( ( const char * )name ); -// switch( QMessageBox::information( this, text, -// msgtext, tr( "Remove" ), secondButton ) ) QuestionDlg dlg( text, msgtext, secondButton ); 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 @@ -101,3 +101,3 @@ void DumpUnfreed() char buf[1024]; - + // Debug output, okay to leave untranslated for(i = allocList.begin(); i != allocList.end(); i++) { 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 @@ -2,3 +2,3 @@ This file is part of the OPIE Project - + =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> @@ -32,2 +32,4 @@ +#include <qobject.h> + Package::Package( QString &name ) @@ -36,7 +38,8 @@ Package::Package( QString &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; @@ -53,7 +56,8 @@ Package::Package( char *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; @@ -73,7 +77,8 @@ 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() ) ); @@ -89,3 +94,3 @@ void Package :: setStatus( const QString &s ) status = s.simplifyWhiteSpace( ); - + two = status.find( " " ); // find second column 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 @@ -25,3 +25,5 @@ -# define _(Text) Text +#include <qobject.h> + +//# define _(Text) Text @@ -46,3 +48,3 @@ public: } - + unsigned long epoch; @@ -51,5 +53,5 @@ public: const char *familiar_revision; -}; +}; -static int verrevcmp(const char *val, const char *ref) +static int verrevcmp(const char *val, const char *ref) { @@ -84,3 +86,3 @@ static int verrevcmp(const char *val, const char *ref) int versioncompare(const struct versionrevision *version, - const struct versionrevision *refversion) + const struct versionrevision *refversion) { @@ -97,3 +99,3 @@ int versionsatisfied3(const struct versionrevision *it, const struct versionrevision *ref, - const char *op) + const char *op) { @@ -111,3 +113,3 @@ int versionsatisfied3(const struct versionrevision *it, return r == 0; - fprintf(stderr, "unknown operator: %s", op); +// fprintf(stderr, "unknown operator: %s", op); @@ -116,3 +118,3 @@ int versionsatisfied3(const struct versionrevision *it, -const char *parseversion(struct versionrevision *rversion, const char *string) +const char *parseversion(struct versionrevision *rversion, const char *string) { @@ -121,4 +123,5 @@ const char *parseversion(struct versionrevision *rversion, const char *string) - if (!*string) return _("version string is empty"); - + if ( !*string ) + return QObject::tr( "Version string is empty." ); + colon= strchr(string,':'); @@ -126,4 +129,6 @@ const char *parseversion(struct versionrevision *rversion, const char *string) 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; @@ -158,3 +163,3 @@ const char *parseversion(struct versionrevision *rversion, const char *string) rversion->familiar_revision); -*/ +*/ return 0; @@ -169,3 +174,3 @@ int compareVersions( const char *v1, const char *v2 ) if (err) { - fprintf(stderr, "Invalid version `%s': %s\n", v2, err); +// fprintf(stderr, "Invalid version `%s': %s\n", v2, err); return -2; @@ -175,3 +180,3 @@ int compareVersions( const char *v1, const char *v2 ) if (err) { - fprintf(stderr, "Invalid version `%s': %s\n", v1, err); +// fprintf(stderr, "Invalid version `%s': %s\n", v1, err); return -2; @@ -188,3 +193,3 @@ int compareVersions( const char *v1, const char *v2 ) /* -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { @@ -203,3 +208,3 @@ int main(int argc, char *argv[]) } - + err = parseversion(&ref, argv[3]); |