summaryrefslogtreecommitdiffstats
path: root/kabc/plugins/file
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:46:43 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:46:43 +0000
commitffe8a83e053396df448e9413828527613ca3bd46 (patch)
treea73d4169e02df4a50f9a12cb165fcd0ab5bac7c6 /kabc/plugins/file
parent682bf3bfdcbcbb1fca85e8a36ed03e062e0555d5 (diff)
downloadtdelibs-ffe8a83e053396df448e9413828527613ca3bd46.tar.gz
tdelibs-ffe8a83e053396df448e9413828527613ca3bd46.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1157647 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kabc/plugins/file')
-rw-r--r--kabc/plugins/file/resourcefile.cpp78
-rw-r--r--kabc/plugins/file/resourcefile.h20
-rw-r--r--kabc/plugins/file/resourcefileconfig.cpp26
-rw-r--r--kabc/plugins/file/resourcefileconfig.h6
4 files changed, 65 insertions, 65 deletions
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index 9c0f85fb8..b391dffa5 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -25,9 +25,9 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qtimer.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
+#include <tqtimer.h>
#include <kapplication.h>
#include <kconfig.h>
@@ -50,7 +50,7 @@ ResourceFile::ResourceFile( const KConfig *config )
: Resource( config ), mFormat( 0 ),
mAsynchronous( false )
{
- QString fileName, formatName;
+ TQString fileName, formatName;
if ( config ) {
fileName = config->readPathEntry( "FileName", StdAddressBook::fileName() );
@@ -63,15 +63,15 @@ ResourceFile::ResourceFile( const KConfig *config )
init( fileName, formatName );
}
-ResourceFile::ResourceFile( const QString &fileName,
- const QString &formatName )
+ResourceFile::ResourceFile( const TQString &fileName,
+ const TQString &formatName )
: Resource( 0 ), mFormat( 0 ),
mAsynchronous( false )
{
init( fileName, formatName );
}
-void ResourceFile::init( const QString &fileName, const QString &formatName )
+void ResourceFile::init( const TQString &fileName, const TQString &formatName )
{
mFormatName = formatName;
@@ -83,9 +83,9 @@ void ResourceFile::init( const QString &fileName, const QString &formatName )
mFormat = factory->format( mFormatName );
}
- connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
- connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
- connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
+ connect( &mDirWatch, TQT_SIGNAL( dirty(const TQString&) ), TQT_SLOT( fileChanged() ) );
+ connect( &mDirWatch, TQT_SIGNAL( created(const TQString&) ), TQT_SLOT( fileChanged() ) );
+ connect( &mDirWatch, TQT_SIGNAL( deleted(const TQString&) ), TQT_SLOT( fileChanged() ) );
setFileName( fileName );
@@ -143,7 +143,7 @@ void ResourceFile::releaseSaveTicket( Ticket *ticket )
bool ResourceFile::doOpen()
{
- QFile file( mFileName );
+ TQFile file( mFileName );
if ( !file.exists() ) {
// try to create the file
@@ -153,7 +153,7 @@ bool ResourceFile::doOpen()
return ok;
} else {
- QFileInfo fileInfo( mFileName );
+ TQFileInfo fileInfo( mFileName );
if ( readOnly() || !fileInfo.isWritable() ) {
if ( !file.open( IO_ReadOnly ) )
return false;
@@ -167,22 +167,22 @@ bool ResourceFile::doOpen()
kdDebug() << "File size is zero. Evaluating backups" << endl;
for (int i=0; i!=20; i++)
{
- QFile backup( mFileName + "__" + QString::number(i) );
+ TQFile backup( mFileName + "__" + TQString::number(i) );
kdDebug() << "Evaluating" << backup.name() << " size: " << backup.size() << endl;
if ( backup.size() != 0 )
{
kdDebug() << "Restoring backup " << i << endl;
- const QString src = mFileName + "__" + QString::number(i);
- const QString dest = mFileName;
+ const TQString src = mFileName + "__" + TQString::number(i);
+ const TQString dest = mFileName;
// remove dest
- QFile::remove( dest );
+ TQFile::remove( dest );
// copy src to dest
if ( backup.open( IO_ReadOnly ) ) {
- const QByteArray data = backup.readAll();
+ const TQByteArray data = backup.readAll();
- QFile out( dest );
+ TQFile out( dest );
if ( out.open( IO_WriteOnly ) ) {
out.writeBlock( data );
out.close();
@@ -213,7 +213,7 @@ bool ResourceFile::load()
mAsynchronous = false;
- QFile file( mFileName );
+ TQFile file( mFileName );
if ( !file.open( IO_ReadOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) );
return false;
@@ -245,25 +245,25 @@ bool ResourceFile::save( Ticket * )
kdDebug(5700) << "ResourceFile::save()" << endl;
// Only do the logrotate dance when the __0 file is not 0 bytes.
- QFile file( mFileName + "__0" );
+ TQFile file( mFileName + "__0" );
if ( file.size() != 0 ) {
- const QString last = mFileName + "__20";
+ const TQString last = mFileName + "__20";
kdDebug() << "deleting " << last << endl;
- QFile::remove( last );
+ TQFile::remove( last );
for (int i=19; i>=0; i--)
{
- const QString src = mFileName + "__" + QString::number(i);
- const QString dest = mFileName + "__" + QString::number(i+1);
+ const TQString src = mFileName + "__" + TQString::number(i);
+ const TQString dest = mFileName + "__" + TQString::number(i+1);
kdDebug() << "moving " << src << " -> " << dest << endl;
// copy src to dest
- QFile in( src );
+ TQFile in( src );
if ( in.open( IO_ReadOnly ) ) {
- const QByteArray data = in.readAll();
+ const TQByteArray data = in.readAll();
- QFile out( dest );
+ TQFile out( dest );
if ( out.open( IO_WriteOnly ) ) {
out.writeBlock( data );
out.close();
@@ -273,13 +273,13 @@ bool ResourceFile::save( Ticket * )
}
// remove src
- QFile::remove( src );
+ TQFile::remove( src );
}
} else
kdDebug() << "Not starting logrotate __0 is 0 bytes." << endl;
- QString extension = "__0";
- (void) KSaveFile::backupFile( mFileName, QString::null /*directory*/,
+ TQString extension = "__0";
+ (void) KSaveFile::backupFile( mFileName, TQString::null /*directory*/,
extension );
mDirWatch.stopScan();
@@ -309,14 +309,14 @@ bool ResourceFile::asyncSave( Ticket *ticket )
bool ok = save( ticket );
if ( !ok )
- QTimer::singleShot( 0, this, SLOT( emitSavingError() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( emitSavingError() ) );
else
- QTimer::singleShot( 0, this, SLOT( emitSavingFinished() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( emitSavingFinished() ) );
return ok;
}
-void ResourceFile::setFileName( const QString &fileName )
+void ResourceFile::setFileName( const TQString &fileName )
{
mDirWatch.stopScan();
if ( mDirWatch.contains( mFileName ) )
@@ -328,12 +328,12 @@ void ResourceFile::setFileName( const QString &fileName )
mDirWatch.startScan();
}
-QString ResourceFile::fileName() const
+TQString ResourceFile::fileName() const
{
return mFileName;
}
-void ResourceFile::setFormat( const QString &format )
+void ResourceFile::setFormat( const TQString &format )
{
mFormatName = format;
delete mFormat;
@@ -342,7 +342,7 @@ void ResourceFile::setFormat( const QString &format )
mFormat = factory->format( mFormatName );
}
-QString ResourceFile::format() const
+TQString ResourceFile::format() const
{
return mFormatName;
}
@@ -365,9 +365,9 @@ void ResourceFile::fileChanged()
void ResourceFile::removeAddressee( const Addressee &addr )
{
- QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) );
- QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) );
- QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) );
+ TQFile::remove( TQFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) );
+ TQFile::remove( TQFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) );
+ TQFile::remove( TQFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) );
mAddrMap.erase( addr.uid() );
}
diff --git a/kabc/plugins/file/resourcefile.h b/kabc/plugins/file/resourcefile.h
index 84dfc7cda..b44c22ec1 100644
--- a/kabc/plugins/file/resourcefile.h
+++ b/kabc/plugins/file/resourcefile.h
@@ -52,7 +52,7 @@ class KABC_EXPORT ResourceFile : public Resource
/**
Construct file resource on file @arg fileName using format @arg formatName.
*/
- ResourceFile( const QString &fileName, const QString &formatName = "vcard" );
+ ResourceFile( const TQString &fileName, const TQString &formatName = "vcard" );
/**
Destructor.
@@ -103,22 +103,22 @@ class KABC_EXPORT ResourceFile : public Resource
/**
Set name of file to be used for saving.
*/
- void setFileName( const QString & );
+ void setFileName( const TQString & );
/**
Return name of file used for loading and saving the address book.
*/
- QString fileName() const;
+ TQString fileName() const;
/**
Sets a new format by name.
*/
- void setFormat( const QString &name );
+ void setFormat( const TQString &name );
/**
Returns the format name.
*/
- QString format() const;
+ TQString format() const;
/**
Remove a addressee from its source.
@@ -136,14 +136,14 @@ class KABC_EXPORT ResourceFile : public Resource
void fileChanged();
protected:
- void init( const QString &fileName, const QString &format );
+ void init( const TQString &fileName, const TQString &format );
- bool lock( const QString &fileName );
- void unlock( const QString &fileName );
+ bool lock( const TQString &fileName );
+ void unlock( const TQString &fileName );
private:
- QString mFileName;
- QString mFormatName;
+ TQString mFileName;
+ TQString mFormatName;
FormatPlugin *mFormat;
diff --git a/kabc/plugins/file/resourcefileconfig.cpp b/kabc/plugins/file/resourcefileconfig.cpp
index a6d8ab4f9..92b07594f 100644
--- a/kabc/plugins/file/resourcefileconfig.cpp
+++ b/kabc/plugins/file/resourcefileconfig.cpp
@@ -18,8 +18,8 @@
Boston, MA 02110-1301, USA.
*/
-#include <qlabel.h>
-#include <qlayout.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
#include <kdebug.h>
#include <klocale.h>
@@ -36,30 +36,30 @@
using namespace KABC;
-ResourceFileConfig::ResourceFileConfig( QWidget* parent, const char* name )
+ResourceFileConfig::ResourceFileConfig( TQWidget* parent, const char* name )
: ConfigWidget( parent, name )
{
- QGridLayout *mainLayout = new QGridLayout( this, 2, 2, 0,
+ TQGridLayout *mainLayout = new TQGridLayout( this, 2, 2, 0,
KDialog::spacingHint() );
- QLabel *label = new QLabel( i18n( "Format:" ), this );
+ TQLabel *label = new TQLabel( i18n( "Format:" ), this );
mFormatBox = new KComboBox( this );
mainLayout->addWidget( label, 0, 0 );
mainLayout->addWidget( mFormatBox, 0, 1 );
- label = new QLabel( i18n( "Location:" ), this );
+ label = new TQLabel( i18n( "Location:" ), this );
mFileNameEdit = new KURLRequester( this );
- connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ),
- SLOT( checkFilePermissions( const QString & ) ) );
+ connect( mFileNameEdit, TQT_SIGNAL( textChanged( const TQString & ) ),
+ TQT_SLOT( checkFilePermissions( const TQString & ) ) );
mainLayout->addWidget( label, 1, 0 );
mainLayout->addWidget( mFileNameEdit, 1, 1 );
FormatFactory *factory = FormatFactory::self();
- QStringList formats = factory->formats();
- QStringList::Iterator it;
+ TQStringList formats = factory->formats();
+ TQStringList::Iterator it;
for ( it = formats.begin(); it != formats.end(); ++it ) {
FormatInfo *info = factory->info( *it );
if ( info ) {
@@ -108,11 +108,11 @@ void ResourceFileConfig::saveSettings( KRES::Resource *res )
resource->setFileName( mFileNameEdit->url() );
}
-void ResourceFileConfig::checkFilePermissions( const QString& fileName )
+void ResourceFileConfig::checkFilePermissions( const TQString& fileName )
{
// If file exist but is not writeable...
- if ( access( QFile::encodeName( fileName ), F_OK ) == 0 )
- emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 );
+ if ( access( TQFile::encodeName( fileName ), F_OK ) == 0 )
+ emit setReadOnly( access( TQFile::encodeName( fileName ), W_OK ) < 0 );
}
#include "resourcefileconfig.moc"
diff --git a/kabc/plugins/file/resourcefileconfig.h b/kabc/plugins/file/resourcefileconfig.h
index 3e92f0728..343a5623d 100644
--- a/kabc/plugins/file/resourcefileconfig.h
+++ b/kabc/plugins/file/resourcefileconfig.h
@@ -33,7 +33,7 @@ class KABC_EXPORT ResourceFileConfig : public KRES::ConfigWidget
Q_OBJECT
public:
- ResourceFileConfig( QWidget* parent = 0, const char* name = 0 );
+ ResourceFileConfig( TQWidget* parent = 0, const char* name = 0 );
void setEditMode( bool value );
@@ -42,14 +42,14 @@ public slots:
void saveSettings( KRES::Resource *resource );
protected slots:
- void checkFilePermissions( const QString& fileName );
+ void checkFilePermissions( const TQString& fileName );
private:
KComboBox* mFormatBox;
KURLRequester* mFileNameEdit;
bool mInEditMode;
- QStringList mFormatTypes;
+ TQStringList mFormatTypes;
};
}