summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 21:16:40 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 21:16:40 +0000
commit2b68fbb8009068b07eabe253cc02b8c2ebadfb86 (patch)
tree8286e225337388beeccc53cc23a08a03a5562676
parent215dff23960d6691b85f8417b2695b0a911fa3a1 (diff)
downloadtdmtheme-2b68fbb8009068b07eabe253cc02b8c2ebadfb86.tar.gz
tdmtheme-2b68fbb8009068b07eabe253cc02b8c2ebadfb86.zip
TQt4 port kdmtheme
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdmtheme@1239295 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--src/kdmtheme.cpp122
-rw-r--r--src/kdmtheme.h31
2 files changed, 77 insertions, 76 deletions
diff --git a/src/kdmtheme.cpp b/src/kdmtheme.cpp
index bc4a26b..e5820f1 100644
--- a/src/kdmtheme.cpp
+++ b/src/kdmtheme.cpp
@@ -33,93 +33,93 @@
#include <kurlrequesterdlg.h>
#include <kparts/genericfactory.h>
-#include <qcheckbox.h>
-#include <qdir.h>
-#include <qlayout.h>
-#include <qlabel.h>
-#include <qptrlist.h>
-#include <qpixmap.h>
-#include <qpushbutton.h>
-#include <qlistview.h>
-#include <qwhatsthis.h>
-#include <qwidget.h>
+#include <tqcheckbox.h>
+#include <tqdir.h>
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqptrlist.h>
+#include <tqpixmap.h>
+#include <tqpushbutton.h>
+#include <tqlistview.h>
+#include <tqwhatsthis.h>
+#include <tqwidget.h>
#include <unistd.h>
-class ThemeData : public QListViewItem {
+class ThemeData : public TQListViewItem {
public:
- ThemeData( QListView *parent = 0 ) : QListViewItem( parent ) {}
+ ThemeData( TQListView *tqparent = 0 ) : TQListViewItem( tqparent ) {}
- QString name;
- QString path;
- QString screenShot;
- QString copyright;
- QString description;
+ TQString name;
+ TQString path;
+ TQString screenShot;
+ TQString copyright;
+ TQString description;
};
-typedef KGenericFactory<KDMThemeWidget, QWidget> kdmthemeFactory;
+typedef KGenericFactory<KDMThemeWidget, TQWidget> kdmthemeFactory;
K_EXPORT_COMPONENT_FACTORY( kcm_kdmtheme, kdmthemeFactory("kcmkdmtheme"))
-KDMThemeWidget::KDMThemeWidget( QWidget *parent, const char *name, const QStringList& )
- : KCModule(parent, name), config( 0L )
+KDMThemeWidget::KDMThemeWidget( TQWidget *tqparent, const char *name, const TQStringList& )
+ : KCModule(tqparent, name), config( 0L )
{
- QGridLayout *ml = new QGridLayout( this );
+ TQGridLayout *ml = new TQGridLayout( this );
ml->setSpacing( KDialog::spacingHint() );
ml->setMargin( KDialog::marginHint() );
- cUseTheme = new QCheckBox( this );
+ cUseTheme = new TQCheckBox( this );
cUseTheme->setText( i18n( "En&able KDM Themes" ) );
ml->addMultiCellWidget( cUseTheme, 0, 0, 0, 2 );
- themeWidget = new QListView( this );
+ themeWidget = new TQListView( this );
themeWidget->addColumn( i18n( "Theme" ) );
themeWidget->addColumn( i18n( "Author" ) );
themeWidget->setAllColumnsShowFocus( true );
themeWidget->setShowSortIndicator( true );
themeWidget->setRootIsDecorated( false );
- QWhatsThis::add( themeWidget, i18n("This is a list of installed themes.\n"
+ TQWhatsThis::add( themeWidget, i18n("This is a list of installed themes.\n"
"Click the one to be used.") );
ml->addMultiCellWidget( themeWidget, 1, 3, 0, 1 );
- preview = new QLabel( this );
- preview->setFixedSize( QSize( 200, 150 ) );
+ preview = new TQLabel( this );
+ preview->setFixedSize( TQSize( 200, 150 ) );
preview->setScaledContents( true );
- QWhatsThis::add(preview, i18n("This is a screen shot of what KDM will look like.") );
+ TQWhatsThis::add(preview, i18n("This is a screen shot of what KDM will look like.") );
ml->addWidget( preview, 1, 2 );
- info = new QLabel( this );
+ info = new TQLabel( this );
info->setMaximumWidth( 200 );
- info->setAlignment( int( QLabel::AlignTop | QLabel::WordBreak) );
- QWhatsThis::add(info, i18n("This contains information about the selected theme.") );
+ info->tqsetAlignment( int( TQLabel::AlignTop | TQLabel::WordBreak) );
+ TQWhatsThis::add(info, i18n("This contains information about the selected theme.") );
ml->addMultiCellWidget( info, 3, 4, 2, 2 );
- bInstallTheme = new QPushButton( i18n("Install &new theme"), this );
- QWhatsThis::add(bInstallTheme, i18n("This will install a theme into the theme directory.") );
+ bInstallTheme = new TQPushButton( i18n("Install &new theme"), this );
+ TQWhatsThis::add(bInstallTheme, i18n("This will install a theme into the theme directory.") );
ml->addWidget( bInstallTheme, 4, 0 );
- bRemoveTheme = new QPushButton( i18n("&Remove theme"), this );
- QWhatsThis::add(bRemoveTheme, i18n("This will remove the selected theme.") );
+ bRemoveTheme = new TQPushButton( i18n("&Remove theme"), this );
+ TQWhatsThis::add(bRemoveTheme, i18n("This will remove the selected theme.") );
ml->addWidget( bRemoveTheme, 4, 1 );
- connect( themeWidget, SIGNAL(selectionChanged()), SLOT(themeSelected()) );
- connect( bInstallTheme, SIGNAL(clicked()), SLOT(installNewTheme()) );
- connect( bRemoveTheme, SIGNAL(clicked()), SLOT(removeSelectedThemes()) );
- connect( cUseTheme, SIGNAL( toggled( bool ) ), SLOT( toggleUseTheme( bool ) ) );
+ connect( themeWidget, TQT_SIGNAL(selectionChanged()), TQT_SLOT(themeSelected()) );
+ connect( bInstallTheme, TQT_SIGNAL(clicked()), TQT_SLOT(installNewTheme()) );
+ connect( bRemoveTheme, TQT_SIGNAL(clicked()), TQT_SLOT(removeSelectedThemes()) );
+ connect( cUseTheme, TQT_SIGNAL( toggled( bool ) ), TQT_SLOT( toggleUseTheme( bool ) ) );
- QStringList themeDirs = KGlobal::dirs()->findDirs("data","kdm/");
+ TQStringList themeDirs = KGlobal::dirs()->findDirs("data","kdm/");
themeDir = KGlobal::dirs()->findDirs("data","kdm/").last();
- QDir d;
- for ( QStringList::Iterator dirs = themeDirs.begin(); dirs != themeDirs.end(); ++dirs ) {
+ TQDir d;
+ for ( TQStringList::Iterator dirs = themeDirs.begin(); dirs != themeDirs.end(); ++dirs ) {
kdDebug() << "Loading themes... ( " + *dirs + "themes/" + " )" << endl;
d.setPath( *dirs + "themes/" );
- d.setFilter( QDir::Dirs );
- QStringList list = d.entryList();
- for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
+ d.setFilter( TQDir::Dirs );
+ TQStringList list = d.entryList();
+ for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
if (*it == "." || *it == "..") continue;
insertTheme( *dirs + "themes/" + *it );
}
@@ -133,9 +133,9 @@ KDMThemeWidget::KDMThemeWidget( QWidget *parent, const char *name, const QString
}
}
-void KDMThemeWidget::selectTheme( const QString &path )
+void KDMThemeWidget::selectTheme( const TQString &path )
{
- for ( QListViewItemIterator tdi( themeWidget ); tdi.current(); tdi++ ) {
+ for ( TQListViewItemIterator tdi( themeWidget ); tdi.current(); tdi++ ) {
ThemeData * td = ((ThemeData *)*tdi);
if (td->path == path) {
themeWidget->clearSelection();
@@ -147,7 +147,7 @@ void KDMThemeWidget::selectTheme( const QString &path )
void KDMThemeWidget::load()
{
- QString kdmrc = KGlobal::dirs()->findResource("config", "kdm/kdmrc");
+ TQString kdmrc = KGlobal::dirs()->findResource("config", "kdm/kdmrc");
if ( kdmrc.isEmpty() ) {
kdError() << "Failed to find kdm resource file kdmrc!" << endl;
@@ -195,10 +195,10 @@ void KDMThemeWidget::setReadOnly(bool ro)
bRemoveTheme->setEnabled( ro );
}
-void KDMThemeWidget::insertTheme( const QString &_theme )
+void KDMThemeWidget::insertTheme( const TQString &_theme )
{
KConfig * themeConfig;
- QString name;
+ TQString name;
kdDebug() << "Looking for " << _theme << "/KdmGreeterTheme.desktop" << endl;
themeConfig = new KConfig( _theme + "/KdmGreeterTheme.desktop");
@@ -214,7 +214,7 @@ void KDMThemeWidget::insertTheme( const QString &_theme )
return;
}
- for ( QListViewItemIterator tdi( themeWidget ); tdi.current(); tdi++ ) {
+ for ( TQListViewItemIterator tdi( themeWidget ); tdi.current(); tdi++ ) {
ThemeData * td = ((ThemeData *)*tdi);
if (td->name == name)
return;
@@ -242,21 +242,21 @@ void KDMThemeWidget::updateInfoView( ThemeData *theme )
theme->description) : "") );
preview->setPixmap( theme->path + '/' + theme->screenShot );
preview->setText( theme->screenShot.isEmpty() ?
- "Screenshot not available" : QString() );
+ "Screenshot not available" : TQString() );
}
void KDMThemeWidget::installNewTheme()
{
- KURLRequesterDlg fileRequester( QString::null, this, i18n("Drag or Type Theme URL") );
+ KURLRequesterDlg fileRequester( TQString(), this, i18n("Drag or Type Theme URL") );
fileRequester.urlRequester()->setMode( KFile::File | KFile::Directory | KFile::ExistingOnly );
KURL themeURL = fileRequester.getURL();
if (themeURL.isEmpty())
return;
- QString themeTmpFile;
+ TQString themeTmpFile;
if (!KIO::NetAccess::download( themeURL, themeTmpFile, this )) {
- QString sorryText;
+ TQString sorryText;
if (themeURL.isLocalFile())
sorryText = i18n("Unable to find the KDM theme archive %1.",themeURL.prettyURL());
else
@@ -266,14 +266,14 @@ void KDMThemeWidget::installNewTheme()
return;
}
- QList<KArchiveDirectory> foundThemes;
+ TQList<KArchiveDirectory> foundThemes;
KTar archive( themeTmpFile );
archive.open( IO_ReadOnly );
const KArchiveDirectory *archDir = archive.directory();
- QStringList entries = archDir->entries();
- for (QStringList::Iterator ent = entries.begin(); ent != entries.end(); ++ent) {
+ TQStringList entries = archDir->entries();
+ for (TQStringList::Iterator ent = entries.begin(); ent != entries.end(); ++ent) {
const KArchiveEntry *possibleDir = archDir->entry( *ent );
if (possibleDir->isDirectory()) {
const KArchiveDirectory *subDir =
@@ -289,7 +289,7 @@ void KDMThemeWidget::installNewTheme()
KMessageBox::error( this, i18n("The file is not a valid KDM theme archive.") );
else {
KProgressDialog progressDiag( this,
- i18n("Installing KDM themes"), QString() );
+ i18n("Installing KDM themes"), TQString() );
progressDiag.setModal( true );
progressDiag.setAutoClose( true );
progressDiag.progressBar()->setTotalSteps( foundThemes.count() );
@@ -299,10 +299,10 @@ void KDMThemeWidget::installNewTheme()
progressDiag.setLabel(
i18n("<qt>Installing <strong>%1</strong> theme</qt>", ard->name() ) );
- QString path = themeDir + "themes/" + ard->name();
+ TQString path = themeDir + "themes/" + ard->name();
kdDebug() << "Unpacking new theme to " << path << endl;
ard->copyTo( path, true );
- if (QDir( path ).exists())
+ if (TQDir( path ).exists())
insertTheme( path );
progressDiag.progressBar()->setValue( progressDiag.progressBar()->value() + 1 );
@@ -329,7 +329,7 @@ void KDMThemeWidget::themeSelected()
void KDMThemeWidget::removeSelectedThemes()
{
- QListViewItem * themes = themeWidget->selectedItem();
+ TQListViewItem * themes = themeWidget->selectedItem();
if (!themes)
return;
if (KMessageBox::questionYesNoList( this,
diff --git a/src/kdmtheme.h b/src/kdmtheme.h
index 3496464..e371826 100644
--- a/src/kdmtheme.h
+++ b/src/kdmtheme.h
@@ -24,20 +24,21 @@
#include <kconfig.h>
#include <kcmodule.h>
-#include <qwidget.h>
+#include <tqwidget.h>
class ThemeData;
-class QLabel;
-class QPushButton;
-class QListView;
-class QCheckBox;
+class TQLabel;
+class TQPushButton;
+class TQListView;
+class TQCheckBox;
class KDMThemeWidget : public KCModule {
Q_OBJECT
+ TQ_OBJECT
public:
- KDMThemeWidget( QWidget *parent = 0, const char *name=0, const QStringList& = QStringList() );
+ KDMThemeWidget( TQWidget *tqparent = 0, const char *name=0, const TQStringList& = TQStringList() );
virtual void load();
virtual void save();
@@ -45,19 +46,19 @@ class KDMThemeWidget : public KCModule {
void setReadOnly( bool );
private:
- void selectTheme( const QString & );
- void insertTheme( const QString & );
+ void selectTheme( const TQString & );
+ void insertTheme( const TQString & );
void updateInfoView( ThemeData * );
- QListView *themeWidget;
- QLabel *preview;
- QLabel *info;
- QPushButton *bInstallTheme;
- QPushButton *bRemoveTheme;
- QCheckBox *cUseTheme;
+ TQListView *themeWidget;
+ TQLabel *preview;
+ TQLabel *info;
+ TQPushButton *bInstallTheme;
+ TQPushButton *bRemoveTheme;
+ TQCheckBox *cUseTheme;
ThemeData *defaultTheme;
- QString themeDir;
+ TQString themeDir;
KConfig *config;
protected slots: