summaryrefslogtreecommitdiffstats
path: root/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /certmanager/lib/backends/chiasmus/chiasmusbackend.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'certmanager/lib/backends/chiasmus/chiasmusbackend.cpp')
-rw-r--r--certmanager/lib/backends/chiasmus/chiasmusbackend.cpp168
1 files changed, 84 insertions, 84 deletions
diff --git a/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp b/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp
index 15a63de53..aad0701ae 100644
--- a/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp
+++ b/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp
@@ -47,9 +47,9 @@
#include <kshell.h>
#include <kdebug.h>
-#include <qstringlist.h>
-#include <qvariant.h>
-#include <qfileinfo.h>
+#include <tqstringlist.h>
+#include <tqvariant.h>
+#include <tqfileinfo.h>
#include <map>
#include <memory>
@@ -59,12 +59,12 @@
namespace {
//
- // The usual QVariant template helpers:
+ // The usual TQVariant template helpers:
//
// to<> is a demarshaller. It's a class b/c you can't partially
// specialise function templates yet. However, to<> can be used as if
- // it was a function: QString s = to<QString>( myVariant );
+ // it was a function: TQString s = to<TQString>( myVariant );
template <typename T> class to {};
#define MAKE_TO( type, func ) \
@@ -72,7 +72,7 @@ namespace {
class to< type > { \
type m; \
public: \
- to( const QVariant & v ) : m( v.func() ) {} \
+ to( const TQVariant & v ) : m( v.func() ) {} \
operator type() const { return m; } \
}
@@ -83,31 +83,31 @@ namespace {
class to<KURL> {
KURL m;
public:
- to( const QVariant & v ) {
+ to( const TQVariant & v ) {
m.setPath( v.toString() );
}
operator KURL() const { return m; }
};
template <typename T>
- class to< QValueList<T> > {
- QValueList<T> m;
+ class to< TQValueList<T> > {
+ TQValueList<T> m;
public:
- to( const QVariant & v ) {
- const QValueList<QVariant> vl = v.toList();
- for ( QValueList<QVariant>::const_iterator it = vl.begin(), end = vl.end() ; it != end ; ++it )
+ to( const TQVariant & v ) {
+ const TQValueList<TQVariant> vl = v.toList();
+ for ( TQValueList<TQVariant>::const_iterator it = vl.begin(), end = vl.end() ; it != end ; ++it )
m.push_back( to<T>( *it ) );
}
- operator QValueList<T> () const { return m; }
+ operator TQValueList<T> () const { return m; }
};
template <>
class to<KURL::List> {
KURL::List m;
public:
- to( const QVariant & v ) {
+ to( const TQVariant & v ) {
// wow, KURL::List is broken... it lacks conversion from and to QVL<KURL>...
- m += to< QValueList<KURL> >( v );
+ m += to< TQValueList<KURL> >( v );
}
operator KURL::List() const { return m; }
};
@@ -116,37 +116,37 @@ namespace {
// from<> is the demarshaller. See to<> for why this is a class...
template <typename T>
- struct from_helper : public QVariant {
- from_helper( const T & t ) : QVariant( t ) {}
+ struct from_helper : public TQVariant {
+ from_helper( const T & t ) : TQVariant( t ) {}
};
template <typename T>
- QVariant from( const T & t ) {
+ TQVariant from( const T & t ) {
return from_helper<T>( t );
}
// some special types:
- template <> struct from_helper<bool> : public QVariant {
- from_helper( bool b ) : QVariant( b, int() ) {}
+ template <> struct from_helper<bool> : public TQVariant {
+ from_helper( bool b ) : TQVariant( b, int() ) {}
};
- template <> struct from_helper<KURL> : public QVariant {
- from_helper( const KURL & url ) : QVariant( url.path() ) {}
+ template <> struct from_helper<KURL> : public TQVariant {
+ from_helper( const KURL & url ) : TQVariant( url.path() ) {}
};
- template <typename T> struct from_helper< QValueList<T> > : public QVariant {
- from_helper( const QValueList<T> & l ) {
- QValueList<QVariant> result;
- for ( typename QValueList<T>::const_iterator it = l.begin(), end = l.end() ; it != end ; ++it )
+ template <typename T> struct from_helper< TQValueList<T> > : public TQVariant {
+ from_helper( const TQValueList<T> & l ) {
+ TQValueList<TQVariant> result;
+ for ( typename TQValueList<T>::const_iterator it = l.begin(), end = l.end() ; it != end ; ++it )
result.push_back( from( *it ) );
- QVariant::operator=( result );
+ TQVariant::operator=( result );
}
};
- template <> struct from_helper<KURL::List> : public from_helper< QValueList<KURL> > {
- from_helper( const KURL::List & l ) : from_helper< QValueList<KURL> >( l ) {}
+ template <> struct from_helper<KURL::List> : public from_helper< TQValueList<KURL> > {
+ from_helper( const KURL::List & l ) : from_helper< TQValueList<KURL> >( l ) {}
};
class ChiasmusConfigEntry : public Kleo::CryptoConfigEntry {
unsigned int mIdx;
- QVariant mValue;
+ TQVariant mValue;
bool mDirty;
public:
ChiasmusConfigEntry( unsigned int i )
@@ -155,8 +155,8 @@ namespace {
{
assert( i < kleo_chiasmus_config_entries_dim );
}
- QString name() const { return kleo_chiasmus_config_entries[mIdx].name; }
- QString description() const { return i18n( kleo_chiasmus_config_entries[mIdx].description ); }
+ TQString name() const { return kleo_chiasmus_config_entries[mIdx].name; }
+ TQString description() const { return i18n( kleo_chiasmus_config_entries[mIdx].description ); }
bool isOptional() const { return kleo_chiasmus_config_entries[mIdx].is_optional; }
bool isReadOnly() const { return false; }
bool isList() const { return kleo_chiasmus_config_entries[mIdx].is_list; }
@@ -165,7 +165,7 @@ namespace {
ArgType argType() const { return static_cast<ArgType>( kleo_chiasmus_config_entries[mIdx].type ); }
bool isSet() const { return mValue != defaultValue(); }
bool boolValue() const { return mValue.toBool(); }
- QString stringValue() const { return mValue.toString(); }
+ TQString stringValue() const { return mValue.toString(); }
int intValue() const { return mValue.toInt(); }
unsigned int uintValue() const { return mValue.toUInt(); }
KURL urlValue() const {
@@ -173,15 +173,15 @@ namespace {
KURL u; u.setPath( mValue.toString() ); return u;
}
unsigned int numberOfTimesSet() const { return 0; }
- QStringList stringValueList() const { return mValue.toStringList(); }
- QValueList<int> intValueList() const { return to< QValueList<int> >( mValue ); }
- QValueList<unsigned int> uintValueList() const { return to< QValueList<unsigned int> >( mValue ); }
+ TQStringList stringValueList() const { return mValue.toStringList(); }
+ TQValueList<int> intValueList() const { return to< TQValueList<int> >( mValue ); }
+ TQValueList<unsigned int> uintValueList() const { return to< TQValueList<unsigned int> >( mValue ); }
KURL::List urlValueList() const {
if ( argType() != ArgType_Path && argType()!= ArgType_DirPath ) return mValue.toStringList();
else return to<KURL::List>( mValue ); }
void resetToDefault() { mValue = defaultValue(); mDirty = false; }
- void setBoolValue( bool value ) { setValue( QVariant( value, int() ) ); }
- void setStringValue( const QString & value ) { setValue( value ); }
+ void setBoolValue( bool value ) { setValue( TQVariant( value, int() ) ); }
+ void setStringValue( const TQString & value ) { setValue( value ); }
void setIntValue( int value ) { setValue( value ); }
void setUIntValue( unsigned int value ) { setValue( value ); }
void setURLValue( const KURL & value ) {
@@ -189,13 +189,13 @@ namespace {
else setValue( value.path() );
}
void setNumberOfTimesSet( unsigned int ) {}
- void setStringValueList( const QStringList & value ) { setValue( value ); }
- void setIntValueList( const QValueList<int> & l ) { setValue( from( l ) ); }
- void setUIntValueList( const QValueList<unsigned int> & l ) { setValue( from( l ) ); }
+ void setStringValueList( const TQStringList & value ) { setValue( value ); }
+ void setIntValueList( const TQValueList<int> & l ) { setValue( from( l ) ); }
+ void setUIntValueList( const TQValueList<unsigned int> & l ) { setValue( from( l ) ); }
void setURLValueList( const KURL::List & l ) { setValue( from( l ) ); }
bool isDirty() const { return mDirty; }
- QVariant value() const { return mValue; }
+ TQVariant value() const { return mValue; }
void sync( KConfigBase * config ) {
if ( !mDirty )
@@ -208,67 +208,67 @@ namespace {
mValue = config->readPropertyEntry( kleo_chiasmus_config_entries[mIdx].name, defaultValue() );
}
private:
- QVariant defaultValue() const;
- void setValue( const QVariant & value ) { mValue = value; mDirty = true; }
+ TQVariant defaultValue() const;
+ void setValue( const TQVariant & value ) { mValue = value; mDirty = true; }
};
- QVariant ChiasmusConfigEntry::defaultValue() const {
+ TQVariant ChiasmusConfigEntry::defaultValue() const {
const kleo_chiasmus_config_data & data = kleo_chiasmus_config_entries[mIdx];
switch ( data.type ) {
default:
- return QVariant();
+ return TQVariant();
case ArgType_None:
if ( isList() )
- return QValueList<QVariant>() << QVariant( data.defaults.boolean.value, int() );
+ return TQValueList<TQVariant>() << TQVariant( data.defaults.boolean.value, int() );
else
- return QVariant( data.defaults.boolean.value, int() );
+ return TQVariant( data.defaults.boolean.value, int() );
case ArgType_String:
if ( isList() )
- return QStringList( QString::fromLatin1( data.defaults.string ) );
+ return TQStringList( TQString::fromLatin1( data.defaults.string ) );
else
- return QString::fromLatin1( data.defaults.string );
+ return TQString::fromLatin1( data.defaults.string );
case ArgType_Int:
if ( isList() )
- return QValueList<QVariant>() << data.defaults.integer;
+ return TQValueList<TQVariant>() << data.defaults.integer;
else
return data.defaults.integer;
case ArgType_UInt:
if ( isList() )
- return QValueList<QVariant>() << data.defaults.unsigned_integer;
+ return TQValueList<TQVariant>() << data.defaults.unsigned_integer;
else
return data.defaults.unsigned_integer;
case ArgType_Path:
case ArgType_DirPath:
if ( isList() )
- return QValueList<QVariant>() << QString::fromLatin1( data.defaults.path );
+ return TQValueList<TQVariant>() << TQString::fromLatin1( data.defaults.path );
else
- return QString::fromLatin1( data.defaults.path );
+ return TQString::fromLatin1( data.defaults.path );
case ArgType_URL:
case ArgType_LDAPURL:
if ( isList() )
- return QValueList<QVariant>() << QString::fromLatin1( data.defaults.url );
+ return TQValueList<TQVariant>() << TQString::fromLatin1( data.defaults.url );
else
- return QString::fromLatin1( data.defaults.url );
+ return TQString::fromLatin1( data.defaults.url );
}
}
class ChiasmusGeneralGroup : public Kleo::CryptoConfigGroup {
- mutable std::map<QString,ChiasmusConfigEntry*> mCache;
+ mutable std::map<TQString,ChiasmusConfigEntry*> mCache;
mutable KConfig * mConfigObject;
public:
ChiasmusGeneralGroup() : Kleo::CryptoConfigGroup(), mConfigObject( 0 ) {}
~ChiasmusGeneralGroup() { clear(); delete mConfigObject; }
- QString name() const { return "General"; }
- QString iconName() const { return "chiasmus_chi"; }
- QString description() const { return i18n( "General" ); }
+ TQString name() const { return "General"; }
+ TQString iconName() const { return "chiasmus_chi"; }
+ TQString description() const { return i18n( "General" ); }
Kleo::CryptoConfigEntry::Level level() const { return Kleo::CryptoConfigEntry::Level_Basic; }
- QStringList entryList() const {
- QStringList result;
+ TQStringList entryList() const {
+ TQStringList result;
for ( unsigned int i = 0 ; i < kleo_chiasmus_config_entries_dim ; ++i )
result.push_back( kleo_chiasmus_config_entries[i].name );
return result;
}
- Kleo::CryptoConfigEntry * entry( const QString & name ) const {
+ Kleo::CryptoConfigEntry * entry( const TQString & name ) const {
if ( ChiasmusConfigEntry * entry = mCache[name] )
return entry;
const KConfigGroup group( configObject(), "Chiasmus" );
@@ -283,7 +283,7 @@ namespace {
void sync() {
KConfigGroup group( configObject(), "Chiasmus" );
- for ( std::map<QString,ChiasmusConfigEntry*>::const_iterator it = mCache.begin(), end = mCache.end() ; it != end ; ++it )
+ for ( std::map<TQString,ChiasmusConfigEntry*>::const_iterator it = mCache.begin(), end = mCache.end() ; it != end ; ++it )
it->second->sync( &group );
group.sync();
clear();
@@ -296,7 +296,7 @@ namespace {
return mConfigObject;
}
void clear() {
- for ( std::map<QString,ChiasmusConfigEntry*>::const_iterator it = mCache.begin(), end = mCache.end() ; it != end ; ++it )
+ for ( std::map<TQString,ChiasmusConfigEntry*>::const_iterator it = mCache.begin(), end = mCache.end() ; it != end ; ++it )
delete it->second;
mCache.clear();
}
@@ -313,11 +313,11 @@ namespace {
mGeneralGroup->sync();
}
- QString name() const { return "Chiasmus"; }
- QString iconName() const { return "chiasmus_chi"; }
- QString description() const { return i18n( "Chiasmus" ); }
- QStringList groupList() const { return QStringList() << "General"; }
- Kleo::CryptoConfigGroup * group( const QString & name ) const {
+ TQString name() const { return "Chiasmus"; }
+ TQString iconName() const { return "chiasmus_chi"; }
+ TQString description() const { return i18n( "Chiasmus" ); }
+ TQStringList groupList() const { return TQStringList() << "General"; }
+ Kleo::CryptoConfigGroup * group( const TQString & name ) const {
if ( name != "General" )
return 0;
if ( !mGeneralGroup )
@@ -334,8 +334,8 @@ public:
CryptoConfig() : Kleo::CryptoConfig(), mComponent( 0 ) {}
~CryptoConfig() { delete mComponent; }
- QStringList componentList() const { return QStringList() << "Chiasmus" ; }
- ChiasmusComponent * component( const QString & name ) const {
+ TQStringList componentList() const { return TQStringList() << "Chiasmus" ; }
+ ChiasmusComponent * component( const TQString & name ) const {
if ( name != "Chiasmus" )
return 0;
if ( !mComponent )
@@ -359,8 +359,8 @@ public:
}
~Protocol() {}
- QString name() const { return "Chiasmus"; }
- QString displayName() const { return i18n( "Chiasmus command line tool" ); }
+ TQString name() const { return "Chiasmus"; }
+ TQString displayName() const { return i18n( "Chiasmus command line tool" ); }
KeyListJob * keyListJob( bool, bool, bool ) const { return 0; }
EncryptJob * encryptJob( bool, bool ) const { return 0; }
DecryptJob * decryptJob() const { return 0; }
@@ -370,14 +370,14 @@ public:
KeyGenerationJob * keyGenerationJob() const { return 0; }
ImportJob * importJob() const { return 0; }
ExportJob * publicKeyExportJob( bool ) const { return 0; }
- ExportJob * secretKeyExportJob( bool, const QString& ) const { return 0; }
+ ExportJob * secretKeyExportJob( bool, const TQString& ) const { return 0; }
DownloadJob * downloadJob( bool ) const { return 0; }
DeleteJob * deleteJob() const { return 0; }
SignEncryptJob * signEncryptJob( bool, bool ) const { return 0; }
DecryptVerifyJob * decryptVerifyJob( bool ) const { return 0; }
RefreshKeysJob * refreshKeysJob() const { return 0; }
- SpecialJob * specialJob( const char * type, const QMap<QString,QVariant> & args ) const {
+ SpecialJob * specialJob( const char * type, const TQMap<TQString,TQVariant> & args ) const {
if ( qstricmp( type, "x-obtain-keys" ) == 0 && args.size() == 0 )
return new ObtainKeysJob();
if ( qstricmp( type, "x-encrypt" ) == 0 && args.size() == 0 )
@@ -407,11 +407,11 @@ Kleo::ChiasmusBackend::~ChiasmusBackend() {
delete mProtocol;
}
-QString Kleo::ChiasmusBackend::name() const {
+TQString Kleo::ChiasmusBackend::name() const {
return "Chiasmus";
}
-QString Kleo::ChiasmusBackend::displayName() const {
+TQString Kleo::ChiasmusBackend::displayName() const {
return i18n( "Chiasmus" );
}
@@ -430,19 +430,19 @@ Kleo::CryptoBackend::Protocol * Kleo::ChiasmusBackend::protocol( const char * na
return mProtocol;
}
-bool Kleo::ChiasmusBackend::checkForOpenPGP( QString * reason ) const {
+bool Kleo::ChiasmusBackend::checkForOpenPGP( TQString * reason ) const {
if ( reason )
*reason = i18n( "Unsupported protocol \"%1\"" ).arg( "OpenPGP" );
return false;
}
-bool Kleo::ChiasmusBackend::checkForSMIME( QString * reason ) const {
+bool Kleo::ChiasmusBackend::checkForSMIME( TQString * reason ) const {
if ( reason )
*reason = i18n( "Unsupported protocol \"%1\"" ).arg( "SMIME" );
return false;
}
-bool Kleo::ChiasmusBackend::checkForChiasmus( QString * reason ) const {
+bool Kleo::ChiasmusBackend::checkForChiasmus( TQString * reason ) const {
// kills the protocol instance when we return false:
std::auto_ptr<Protocol> tmp( mProtocol );
@@ -450,8 +450,8 @@ bool Kleo::ChiasmusBackend::checkForChiasmus( QString * reason ) const {
const CryptoConfigEntry * path = config()->entry( "Chiasmus", "General", "path" );
assert( path ); assert( path->argType() == CryptoConfigEntry::ArgType_Path );
- const QString chiasmus = path->urlValue().path();
- const QFileInfo fi( KShell::tildeExpand( chiasmus ) );
+ const TQString chiasmus = path->urlValue().path();
+ const TQFileInfo fi( KShell::tildeExpand( chiasmus ) );
if ( !fi.isExecutable() ) {
if ( reason )
*reason = i18n( "File \"%1\" does not exist or is not executable." ).arg( chiasmus );
@@ -463,7 +463,7 @@ bool Kleo::ChiasmusBackend::checkForChiasmus( QString * reason ) const {
return true;
}
-bool Kleo::ChiasmusBackend::checkForProtocol( const char * name, QString * reason ) const {
+bool Kleo::ChiasmusBackend::checkForProtocol( const char * name, TQString * reason ) const {
if ( qstricmp( name, "Chiasmus" ) == 0 )
return checkForChiasmus( reason );
if ( reason )