#include "package.h"
#include "aaptinterface.h"
-Repository::Repository()
+Repository::Repository(): iEnabled(false)
{
- iEnabled = false;
}
-QString Repository::toString()
+Repository::~Repository()
+{
+}
+
+QString Repository::toString() const
{
QString str;
if( iEnabled )
else
str = "#deb ";
- str += iUrl + iDir + " " + iDist + " " + iComponents;
+ str += iUrl + iDir + " " + iDist;
+ if( !iComponents.isEmpty() )
+ str += " " + iComponents;
return( str.trimmed() );
}
-QStringList Repository::toListFileNames()
+QStringList Repository::toListFileNames() const
{
QStringList names;
com << "";
for( int i=0; i<com.count(); i++ ) {
QString chopUrl = iUrl.mid( iUrl.indexOf("://")+3 );
- if( com.at(i)!="" )
+ if( !com.at(i).isEmpty() )
disttext = "dists_";
else
disttext = "_";
QString str = chopUrl + iDir + disttext + iDist + "_" + com.at(i);
- if( com.at(i)!="" )
+ if( !com.at(i).isEmpty() )
str += "_binary-armel_Packages";
else
str += "_Packages";
iDir = parts.at(1).right( parts.at(1).length()-d-1 );
}
- if( parts.at(2)!="" )
+ if( !parts.at(2).isEmpty() )
iDist = parts.at(2);
else
return false;
if( !iUrl.endsWith('/') )
iUrl.append('/');
iDir = dir.trimmed();
- if( !iDir.endsWith('/') && iDir!="" )
+ if( !iDir.endsWith('/') && !iDir.isEmpty() )
iDir.append('/');
iDist = dist.trimmed();
iComponents = components.trimmed();
iEnabled = enabled;
+ if( iDist.isEmpty() )
+ iDist = ".";
+
// ensure that the protocol part of the URL is lowercase
int pos = iUrl.indexOf("://");
QString proto = iUrl.left(pos);