summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/package.cpp
authortille <tille>2002-04-27 13:06:45 (UTC)
committer tille <tille>2002-04-27 13:06:45 (UTC)
commitdb90999f6298c1107888f062f2c25cb8817b528a (patch) (side-by-side diff)
tree020ebe65beb9286f3c63e4329fc3a0f298d34460 /noncore/unsupported/oipkg/package.cpp
parente2f3288d468508f2cf7c0a327044963ca4b1b54a (diff)
downloadopie-db90999f6298c1107888f062f2c25cb8817b528a.zip
opie-db90999f6298c1107888f062f2c25cb8817b528a.tar.gz
opie-db90999f6298c1107888f062f2c25cb8817b528a.tar.bz2
added popup menu to choose inst dest (and more...)
Diffstat (limited to 'noncore/unsupported/oipkg/package.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/package.cpp54
1 files changed, 44 insertions, 10 deletions
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 1705f78..9f602b5 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -1,52 +1,59 @@
#include "package.h"
#include <qpe/process.h>
#include <qpe/stringutil.h>
#include "debug.h"
Package::~Package()
{
}
-Package::Package()
+Package::Package( PackageManagerSettings *s )
{
+ init(s);
+}
+
+void Package::init( PackageManagerSettings *s )
+{
+ settings = s;
_size = "";
_section = "";
_subsection = "";
_shortDesc = "";
_desc = "";
_name = "";
_toProcess = false;
_status = "";
+ _dest = "";
}
-Package::Package( QStringList pack )
+Package::Package( QStringList pack, PackageManagerSettings *s )
{
- Package();
+ init(s);
parsePackage( pack );
_toProcess = false;
}
-Package::Package( QString n )
+Package::Package( QString n, PackageManagerSettings *s )
{
- Package();
+ init(s);
_name = QString( n );
_toProcess = false;
}
Package::Package( Package *pi )
{
- Package();
+ init(pi->settings);
copyValues( pi );
_toProcess = false;
}
void Package::setValue( QString n, QString t )
{
if ( n == "Status" && installed() ) return;
if ( n == "Package" )
{
_name = QString( t );
}
@@ -163,43 +170,43 @@ void Package::toggleProcess()
void Package::copyValues( Package* pack )
{
if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size );
if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section );
if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection );
if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc );
if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc );
if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name );
if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status );
}
-QString Package::getSection()
+QString Package::section()
{
return _section;
}
void Package::setSection( QString s)
{
int i = s.find("/");
if ( i > 0 )
{
_section = s.left(i);
_subsection = s.mid(i+1);
}else{
_section = s;
_subsection = "";
}
}
-QString Package::getSubSection()
+QString Package::subSection()
{
return _subsection;
}
void Package::parsePackage( QStringList pack )
{
if ( pack.isEmpty() ) return;
int count = pack.count();
for( int i = 0; i < count; i++ )
{
QString line = pack[i];
int sep = line.find( QRegExp(":[\t ]+") );
@@ -244,20 +251,47 @@ QString Package::details()
description.append(":</b> ");
description.append(Qtopia::escapeString(line.mid(sep+2)));
} else {
description.append(" ");
description.append(Qtopia::escapeString(line));
}
}
}
}
return description;
}
-/** No descriptions */
void Package::processed()
{
_toProcess = false;
- //hack, but we're mot writing status anyway...
+ //hack, but we're not writing status anyway...
if ( installed() ) _status = "install";
else _status = "installed";
}
+
+QString Package::dest()
+{
+ if ( installed()||(!installed() && _toProcess) )
+ return _dest!=""?_dest:settings->getDestinationName();
+ else return "";
+}
+
+void Package::setDest( QString d )
+{
+ _dest = d;
+}
+
+void Package::setOn()
+{
+ _toProcess = true;
+}
+
+bool Package::link()
+{
+ if ( _dest == "root" || (!installed() && !_toProcess) ) return false;
+ return _link;
+}
+
+void Package::setLink(bool b)
+{
+ _link = b;
+}