From c663b6440964f6ac48027143ac9e63298991f9d0 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:33:34 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdepasswd/kcm/chfacedlg.cpp | 78 ++++++++++++++++++------------------- kdepasswd/kcm/chfacedlg.h | 12 +++--- kdepasswd/kcm/chfnprocess.cpp | 4 +- kdepasswd/kcm/chfnprocess.h | 6 +-- kdepasswd/kcm/main.cpp | 90 +++++++++++++++++++++---------------------- kdepasswd/kcm/main.h | 12 +++--- 6 files changed, 101 insertions(+), 101 deletions(-) (limited to 'kdepasswd/kcm') diff --git a/kdepasswd/kcm/chfacedlg.cpp b/kdepasswd/kcm/chfacedlg.cpp index 1894ac814..c5f700338 100644 --- a/kdepasswd/kcm/chfacedlg.cpp +++ b/kdepasswd/kcm/chfacedlg.cpp @@ -25,14 +25,14 @@ * @author Braden MacDonald */ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -52,35 +52,35 @@ /** * TODO: It would be nice if the widget were in a .ui */ -ChFaceDlg::ChFaceDlg(const QString& picsdir, QWidget *parent, const char *name, bool modal) +ChFaceDlg::ChFaceDlg(const TQString& picsdir, TQWidget *parent, const char *name, bool modal) : KDialogBase( parent, name, modal, i18n("Change your Face"), Ok|Cancel, Ok, true ) { - QWidget *page = new QWidget(this); + TQWidget *page = new TQWidget(this); setMainWidget( page ); - QVBoxLayout *top = new QVBoxLayout(page, 0, spacingHint()); + TQVBoxLayout *top = new TQVBoxLayout(page, 0, spacingHint()); - QLabel *header = new QLabel( i18n("Select a new face:"), page ); + TQLabel *header = new TQLabel( i18n("Select a new face:"), page ); top->addWidget( header ); m_FacesWidget = new KIconView( page ); - m_FacesWidget->setSelectionMode( QIconView::Single ); + m_FacesWidget->setSelectionMode( TQIconView::Single ); m_FacesWidget->setItemsMovable( false ); m_FacesWidget->setMinimumSize( 400, 200 ); - connect( m_FacesWidget, SIGNAL( selectionChanged( QIconViewItem * ) ), SLOT( slotFaceWidgetSelectionChanged( QIconViewItem * ) ) ); + connect( m_FacesWidget, TQT_SIGNAL( selectionChanged( TQIconViewItem * ) ), TQT_SLOT( slotFaceWidgetSelectionChanged( TQIconViewItem * ) ) ); - connect( m_FacesWidget, SIGNAL( doubleClicked( QIconViewItem *, const QPoint & ) ), SLOT( slotOk() ) ); + connect( m_FacesWidget, TQT_SIGNAL( doubleClicked( TQIconViewItem *, const TQPoint & ) ), TQT_SLOT( slotOk() ) ); top->addWidget( m_FacesWidget ); // Buttons to get more pics - QHBoxLayout * morePics = new QHBoxLayout( 0, 0, spacingHint() ); - QPushButton *browseBtn = new QPushButton( i18n("Custom &Image..."), page ); - connect( browseBtn, SIGNAL( clicked() ), SLOT( slotGetCustomImage() ) ); + TQHBoxLayout * morePics = new TQHBoxLayout( 0, 0, spacingHint() ); + TQPushButton *browseBtn = new TQPushButton( i18n("Custom &Image..."), page ); + connect( browseBtn, TQT_SIGNAL( clicked() ), TQT_SLOT( slotGetCustomImage() ) ); morePics->addWidget( browseBtn ); #if 0 - QPushButton *acquireBtn = new QPushButton( i18n("&Acquire Image..."), page ); + TQPushButton *acquireBtn = new TQPushButton( i18n("&Acquire Image..."), page ); acquireBtn->setEnabled( false ); morePics->addWidget( acquireBtn ); #endif @@ -88,36 +88,36 @@ ChFaceDlg::ChFaceDlg(const QString& picsdir, QWidget *parent, const char *name, top->addLayout( morePics ); // Filling the icon view - QDir facesDir( picsdir ); + TQDir facesDir( picsdir ); if ( facesDir.exists() ) { - QStringList picslist = facesDir.entryList( QDir::Files ); - for ( QStringList::Iterator it = picslist.begin(); it != picslist.end(); ++it ) - new QIconViewItem( m_FacesWidget, (*it).section(".",0,0), QPixmap( picsdir + *it ) ); + TQStringList picslist = facesDir.entryList( TQDir::Files ); + for ( TQStringList::Iterator it = picslist.begin(); it != picslist.end(); ++it ) + new TQIconViewItem( m_FacesWidget, (*it).section(".",0,0), TQPixmap( picsdir + *it ) ); } facesDir.setPath( KCFGUserAccount::userFaceDir() ); if ( facesDir.exists() ) { - QStringList picslist = facesDir.entryList( QDir::Files ); - for ( QStringList::Iterator it = picslist.begin(); it != picslist.end(); ++it ) - new QIconViewItem( m_FacesWidget, "/"+(*it) == KCFGUserAccount::customFaceFile() ? + TQStringList picslist = facesDir.entryList( TQDir::Files ); + for ( TQStringList::Iterator it = picslist.begin(); it != picslist.end(); ++it ) + new TQIconViewItem( m_FacesWidget, "/"+(*it) == KCFGUserAccount::customFaceFile() ? i18n("(Custom)") : (*it).section(".",0,0), - QPixmap( KCFGUserAccount::userFaceDir() + *it ) ); + TQPixmap( KCFGUserAccount::userFaceDir() + *it ) ); } - m_FacesWidget->setResizeMode( QIconView::Adjust ); + m_FacesWidget->setResizeMode( TQIconView::Adjust ); //m_FacesWidget->setGridX( FACE_PIX_SIZE - 10 ); m_FacesWidget->arrangeItemsInGrid(); enableButtonOK( false ); - //connect( this, SIGNAL( okClicked() ), SLOT( slotSaveCustomImage() ) ); + //connect( this, TQT_SIGNAL( okClicked() ), TQT_SLOT( slotSaveCustomImage() ) ); resize( 420, 400 ); } -void ChFaceDlg::addCustomPixmap( QString imPath, bool saveCopy ) +void ChFaceDlg::addCustomPixmap( TQString imPath, bool saveCopy ) { - QImage pix( imPath ); + TQImage pix( imPath ); // TODO: save pix to TMPDIR/userinfo-tmp, // then scale and copy *that* to ~/.faces @@ -128,24 +128,24 @@ void ChFaceDlg::addCustomPixmap( QString imPath, bool saveCopy ) } if ( (pix.width() > KCFGUserAccount::faceSize()) || (pix.height() > KCFGUserAccount::faceSize()) ) - pix = pix.scale( KCFGUserAccount::faceSize(), KCFGUserAccount::faceSize(), QImage::ScaleMin );// Should be no bigger than certain size. + pix = pix.scale( KCFGUserAccount::faceSize(), KCFGUserAccount::faceSize(), TQImage::ScaleMin );// Should be no bigger than certain size. if ( saveCopy ) { // If we should save a copy: - QDir userfaces( KCFGUserAccount::userFaceDir() ); + TQDir userfaces( KCFGUserAccount::userFaceDir() ); if ( !userfaces.exists( ) ) userfaces.mkdir( userfaces.absPath() ); pix.save( userfaces.absPath() + "/.userinfo-tmp" , "PNG" ); - KonqOperations::copy( this, KonqOperations::COPY, KURL::List( KURL( userfaces.absPath() + "/.userinfo-tmp" ) ), KURL( userfaces.absPath() + "/" + QFileInfo(imPath).fileName().section(".",0,0) ) ); + KonqOperations::copy( this, KonqOperations::COPY, KURL::List( KURL( userfaces.absPath() + "/.userinfo-tmp" ) ), KURL( userfaces.absPath() + "/" + TQFileInfo(imPath).fileName().section(".",0,0) ) ); #if 0 if ( !pix.save( userfaces.absPath() + "/" + imPath , "PNG" ) ) KMessageBox::sorry(this, i18n("There was an error saving the image:\n%1").arg( userfaces.absPath() ) ); #endif } - QIconViewItem* newface = new QIconViewItem( m_FacesWidget, QFileInfo(imPath).fileName().section(".",0,0) , pix ); + TQIconViewItem* newface = new TQIconViewItem( m_FacesWidget, TQFileInfo(imPath).fileName().section(".",0,0) , pix ); newface->setKey( KCFGUserAccount::customKey() );// Add custom items to end m_FacesWidget->ensureItemVisible( newface ); m_FacesWidget->setCurrentItem( newface ); @@ -153,9 +153,9 @@ void ChFaceDlg::addCustomPixmap( QString imPath, bool saveCopy ) void ChFaceDlg::slotGetCustomImage( ) { - QCheckBox* checkWidget = new QCheckBox( i18n("&Save copy in custom faces folder for future use"), 0 ); + TQCheckBox* checkWidget = new TQCheckBox( i18n("&Save copy in custom faces folder for future use"), 0 ); - KFileDialog *dlg = new KFileDialog( QDir::homeDirPath(), KImageIO::pattern( KImageIO::Reading ), + KFileDialog *dlg = new KFileDialog( TQDir::homeDirPath(), KImageIO::pattern( KImageIO::Reading ), this, 0, true, checkWidget); dlg->setOperationMode( KFileDialog::Opening ); @@ -164,7 +164,7 @@ void ChFaceDlg::slotGetCustomImage( ) KImageFilePreview *ip = new KImageFilePreview( dlg ); dlg->setPreviewWidget( ip ); - if (dlg->exec() == QDialog::Accepted) + if (dlg->exec() == TQDialog::Accepted) addCustomPixmap( dlg->selectedFile(), checkWidget->isChecked() ); // Because we give it a parent we have to close it ourselves. dlg->close(true); @@ -175,7 +175,7 @@ void ChFaceDlg::slotSaveCustomImage() { if ( m_FacesWidget->currentItem()->key() == USER_CUSTOM_KEY) { - QDir userfaces( QDir::homeDirPath() + USER_FACES_DIR ); + TQDir userfaces( TQDir::homeDirPath() + USER_FACES_DIR ); if ( !userfaces.exists( ) ) userfaces.mkdir( userfaces.absPath() ); diff --git a/kdepasswd/kcm/chfacedlg.h b/kdepasswd/kcm/chfacedlg.h index 1802ccd92..085153264 100644 --- a/kdepasswd/kcm/chfacedlg.h +++ b/kdepasswd/kcm/chfacedlg.h @@ -28,7 +28,7 @@ #ifndef CHFACEDLG_H #define CHFACEDLG_H -#include +#include #include // declaration below @@ -42,26 +42,26 @@ class ChFaceDlg : public KDialogBase public: - ChFaceDlg(const QString& picsdirs, QWidget *parent=0, const char *name=0, bool modal=true); + ChFaceDlg(const TQString& picsdirs, TQWidget *parent=0, const char *name=0, bool modal=true); - QPixmap getFaceImage() const + TQPixmap getFaceImage() const { if(m_FacesWidget->currentItem()) return *(m_FacesWidget->currentItem()->pixmap()); else - return QPixmap(); + return TQPixmap(); } private slots: - void slotFaceWidgetSelectionChanged( QIconViewItem *item ) + void slotFaceWidgetSelectionChanged( TQIconViewItem *item ) { enableButtonOK( !item->pixmap()->isNull() ); } void slotGetCustomImage(); //void slotSaveCustomImage(); private: - void addCustomPixmap( QString imPath, bool saveCopy ); + void addCustomPixmap( TQString imPath, bool saveCopy ); KIconView *m_FacesWidget; }; diff --git a/kdepasswd/kcm/chfnprocess.cpp b/kdepasswd/kcm/chfnprocess.cpp index ec39a152a..4f6af0add 100644 --- a/kdepasswd/kcm/chfnprocess.cpp +++ b/kdepasswd/kcm/chfnprocess.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include @@ -52,7 +52,7 @@ int ChfnProcess::ConverseChfn(const char *pass) { int status=-1; - QCString line; + TQCString line; while(1) { line = readLine(); diff --git a/kdepasswd/kcm/chfnprocess.h b/kdepasswd/kcm/chfnprocess.h index f8bb4e0cf..4f129b643 100644 --- a/kdepasswd/kcm/chfnprocess.h +++ b/kdepasswd/kcm/chfnprocess.h @@ -11,7 +11,7 @@ #ifndef CHFNPROC_H #define CHFNPROC_H -#include +#include #include class ChfnProcess : public PtyProcess @@ -22,12 +22,12 @@ public: int exec(const char *pass, const char *name); - QCString error() { return m_Error; } + TQCString error() { return m_Error; } private: int ConverseChfn(const char *pass); - QCString m_Error; + TQCString m_Error; }; #endif diff --git a/kdepasswd/kcm/main.cpp b/kdepasswd/kcm/main.cpp index d49304484..a3a25c0f3 100644 --- a/kdepasswd/kcm/main.cpp +++ b/kdepasswd/kcm/main.cpp @@ -20,15 +20,15 @@ * */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -52,31 +52,31 @@ #include "chfacedlg.h" #include "main.h" -typedef KGenericFactory Factory; +typedef KGenericFactory Factory; K_EXPORT_COMPONENT_FACTORY( kcm_useraccount, Factory("useraccount") ) -KCMUserAccount::KCMUserAccount( QWidget *parent, const char *name, - const QStringList &) +KCMUserAccount::KCMUserAccount( TQWidget *parent, const char *name, + const TQStringList &) : KCModule( parent, name) { - QVBoxLayout *topLayout = new QVBoxLayout(this); + TQVBoxLayout *topLayout = new TQVBoxLayout(this); _mw = new MainWidget(this); topLayout->addWidget( _mw ); - connect( _mw->btnChangeFace, SIGNAL(clicked()), SLOT(slotFaceButtonClicked())); - connect( _mw->btnChangePassword, SIGNAL(clicked()), SLOT(slotChangePassword())); + connect( _mw->btnChangeFace, TQT_SIGNAL(clicked()), TQT_SLOT(slotFaceButtonClicked())); + connect( _mw->btnChangePassword, TQT_SIGNAL(clicked()), TQT_SLOT(slotChangePassword())); _mw->btnChangePassword->setGuiItem( KGuiItem( i18n("Change &Password..."), "password" )); - connect( _mw->leRealname, SIGNAL(textChanged(const QString&)), SLOT(changed())); - connect( _mw->leOrganization, SIGNAL(textChanged(const QString&)), SLOT(changed())); - connect( _mw->leEmail, SIGNAL(textChanged(const QString&)), SLOT(changed())); - connect( _mw->leSMTP, SIGNAL(textChanged(const QString&)), SLOT(changed())); + connect( _mw->leRealname, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(changed())); + connect( _mw->leOrganization, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(changed())); + connect( _mw->leEmail, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(changed())); + connect( _mw->leSMTP, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(changed())); _ku = new KUser(); _kes = new KEMailSettings(); _mw->lblUsername->setText( _ku->loginName() ); - _mw->lblUID->setText( QString().number(_ku->uid()) ); + _mw->lblUID->setText( TQString().number(_ku->uid()) ); KAboutData *about = new KAboutData(I18N_NOOP("kcm_useraccount"), I18N_NOOP("Password & User Information"), 0, 0, @@ -108,7 +108,7 @@ KCMUserAccount::KCMUserAccount( QWidget *parent, const char *name, void KCMUserAccount::slotChangePassword() { KProcess *proc = new KProcess; - QString bin = KGlobal::dirs()->findExe("kdepasswd"); + TQString bin = KGlobal::dirs()->findExe("kdepasswd"); if ( !bin ) { kdDebug() << "kcm_useraccount: kdepasswd was not found." << endl; @@ -146,22 +146,22 @@ void KCMUserAccount::load() _mw->leOrganization->setText( _kes->getSetting( KEMailSettings::Organization )); _mw->leSMTP->setText( _kes->getSetting( KEMailSettings::OutServer )); - QString _userPicsDir = KCFGUserAccount::faceDir() + + TQString _userPicsDir = KCFGUserAccount::faceDir() + KGlobal::dirs()->resourceDirs("data").last() + "kdm/faces/"; - QString fs = KCFGUserAccount::faceSource(); - if (fs == QString::fromLatin1("UserOnly")) + TQString fs = KCFGUserAccount::faceSource(); + if (fs == TQString::fromLatin1("UserOnly")) _facePerm = userOnly; - else if (fs == QString::fromLatin1("PreferUser")) + else if (fs == TQString::fromLatin1("PreferUser")) _facePerm = userFirst; - else if (fs == QString::fromLatin1("PreferAdmin")) + else if (fs == TQString::fromLatin1("PreferAdmin")) _facePerm = adminFirst; else _facePerm = adminOnly; // Admin Only if ( _facePerm == adminFirst ) { // If the administrator's choice takes preference - _facePixmap = QPixmap( _userPicsDir + _ku->loginName() + ".face.icon" ); + _facePixmap = TQPixmap( _userPicsDir + _ku->loginName() + ".face.icon" ); if ( _facePixmap.isNull() ) _facePerm = userFirst; @@ -172,23 +172,23 @@ void KCMUserAccount::load() if ( _facePerm >= userFirst ) { // If the user's choice takes preference - _facePixmap = QPixmap( KCFGUserAccount::faceFile() ); + _facePixmap = TQPixmap( KCFGUserAccount::faceFile() ); // The user has no face, should we check for the admin's setting? if ( _facePixmap.isNull() && _facePerm == userFirst ) - _facePixmap = QPixmap( _userPicsDir + _ku->loginName() + ".face.icon" ); + _facePixmap = TQPixmap( _userPicsDir + _ku->loginName() + ".face.icon" ); if ( _facePixmap.isNull() ) - _facePixmap = QPixmap( _userPicsDir + KCFGUserAccount::defaultFile() ); + _facePixmap = TQPixmap( _userPicsDir + KCFGUserAccount::defaultFile() ); _mw->btnChangeFace->setPixmap( _facePixmap ); } else if ( _facePerm <= adminOnly ) { // Admin only - _facePixmap = QPixmap( _userPicsDir + _ku->loginName() + ".face.icon" ); + _facePixmap = TQPixmap( _userPicsDir + _ku->loginName() + ".face.icon" ); if ( _facePixmap.isNull() ) - _facePixmap = QPixmap( _userPicsDir + KCFGUserAccount::defaultFile() ); + _facePixmap = TQPixmap( _userPicsDir + KCFGUserAccount::defaultFile() ); _mw->btnChangeFace->setPixmap( _facePixmap ); } @@ -209,7 +209,7 @@ void KCMUserAccount::save() /* Save realname to /etc/passwd */ if ( _mw->leRealname->isModified() ) { - QCString password; + TQCString password; int ret = KPasswordDialog::getPassword( password, i18n("Please enter " "your password in order to save your settings:")); @@ -247,7 +247,7 @@ void KCMUserAccount::save() } -void KCMUserAccount::changeFace(const QPixmap &pix) +void KCMUserAccount::changeFace(const TQPixmap &pix) { if ( _facePerm < userFirst ) return; // If the user isn't allowed to change their face, don't! @@ -273,7 +273,7 @@ void KCMUserAccount::slotFaceButtonClicked() ChFaceDlg* pDlg = new ChFaceDlg( KGlobal::dirs()->resourceDirs("data").last() + "/kdm/pics/users/" ); - if ( pDlg->exec() == QDialog::Accepted && !pDlg->getFaceImage().isNull() ) + if ( pDlg->exec() == TQDialog::Accepted && !pDlg->getFaceImage().isNull() ) changeFace( pDlg->getFaceImage() ); delete pDlg; @@ -284,16 +284,16 @@ void KCMUserAccount::slotFaceButtonClicked() * The function was called after checking event type and * the code is now below that if statement */ -bool KCMUserAccount::eventFilter(QObject *, QEvent *e) +bool KCMUserAccount::eventFilter(TQObject *, TQEvent *e) { - if (e->type() == QEvent::DragEnter) + if (e->type() == TQEvent::DragEnter) { - QDragEnterEvent *ee = (QDragEnterEvent *) e; + TQDragEnterEvent *ee = (TQDragEnterEvent *) e; ee->accept( KURLDrag::canDecode(ee) ); return true; } - if (e->type() == QEvent::Drop) + if (e->type() == TQEvent::Drop) { if ( _facePerm < userFirst ) { @@ -302,12 +302,12 @@ bool KCMUserAccount::eventFilter(QObject *, QEvent *e) return true; } - KURL *url = decodeImgDrop( (QDropEvent *) e, this); + KURL *url = decodeImgDrop( (TQDropEvent *) e, this); if (url) { - QString pixPath; + TQString pixPath; KIO::NetAccess::download(*url, pixPath, this); - changeFace( QPixmap( pixPath ) ); + changeFace( TQPixmap( pixPath ) ); KIO::NetAccess::removeTempFile(pixPath); delete url; } @@ -316,7 +316,7 @@ bool KCMUserAccount::eventFilter(QObject *, QEvent *e) return false; } -inline KURL *KCMUserAccount::decodeImgDrop(QDropEvent *e, QWidget *wdg) +inline KURL *KCMUserAccount::decodeImgDrop(TQDropEvent *e, TQWidget *wdg) { KURL::List uris; @@ -328,10 +328,10 @@ inline KURL *KCMUserAccount::decodeImgDrop(QDropEvent *e, QWidget *wdg) if( KImageIO::canRead(KImageIO::type(url->fileName())) ) return url; - QStringList qs = QStringList::split('\n', KImageIO::pattern()); + TQStringList qs = TQStringList::split('\n', KImageIO::pattern()); qs.remove(qs.begin()); - QString msg = i18n( "%1 does not appear to be an image file.\n" + TQString msg = i18n( "%1 does not appear to be an image file.\n" "Please use files with these extensions:\n" "%2").arg(url->fileName()).arg(qs.join("\n")); KMessageBox::sorry( wdg, msg); diff --git a/kdepasswd/kcm/main.h b/kdepasswd/kcm/main.h index 2ee475bc9..29562a226 100644 --- a/kdepasswd/kcm/main.h +++ b/kdepasswd/kcm/main.h @@ -39,8 +39,8 @@ class KCMUserAccount : public KCModule Q_OBJECT public: - KCMUserAccount(QWidget* parent, const char* name = "KCMUserAccount", - const QStringList& list=QStringList()); + KCMUserAccount(TQWidget* parent, const char* name = "KCMUserAccount", + const TQStringList& list=TQStringList()); ~KCMUserAccount(); /** @@ -57,7 +57,7 @@ public: /** * For the face button */ - bool eventFilter(QObject *, QEvent *e); + bool eventFilter(TQObject *, TQEvent *e); private slots: void slotChangePassword(); @@ -65,14 +65,14 @@ private slots: void slotFaceButtonClicked(); private: - void changeFace(const QPixmap& pix); - inline KURL* decodeImgDrop(QDropEvent *e, QWidget *wdg); + void changeFace(const TQPixmap& pix); + inline KURL* decodeImgDrop(TQDropEvent *e, TQWidget *wdg); KEMailSettings *_kes; KUser *_ku; MainWidget *_mw; FacePerm _facePerm; - QPixmap _facePixmap; + TQPixmap _facePixmap; }; -- cgit v1.2.1