diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
commit | 395a904bff7b4d6ead445c342f7ac0c5fbf29121 (patch) | |
tree | 9829cadb79d2cc7c29a940627fadb28b11e54150 /kate/filetemplates | |
parent | 399f47c376fdf4d19192732a701ea9578d11619d (diff) | |
download | tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.tar.gz tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.zip |
TQt4 port kdeaddons
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1237404 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kate/filetemplates')
-rw-r--r-- | kate/filetemplates/plugin/filetemplates.cpp | 92 | ||||
-rw-r--r-- | kate/filetemplates/plugin/filetemplates.h | 25 | ||||
-rw-r--r-- | kate/filetemplates/plugin/katetemplate.xml | 2 | ||||
-rw-r--r-- | kate/filetemplates/templates/language.xml.katetemplate | 2 |
4 files changed, 63 insertions, 58 deletions
diff --git a/kate/filetemplates/plugin/filetemplates.cpp b/kate/filetemplates/plugin/filetemplates.cpp index 90b64c9..5d6649a 100644 --- a/kate/filetemplates/plugin/filetemplates.cpp +++ b/kate/filetemplates/plugin/filetemplates.cpp @@ -98,9 +98,9 @@ KatePluginFactory::~KatePluginFactory() delete s_instance; } -TQObject* KatePluginFactory::createObject( TQObject* parent, const char* name, const char*, const TQStringList & ) +TQObject* KatePluginFactory::createObject( TQObject* tqparent, const char* name, const char*, const TQStringList & ) { - return new KateFileTemplates( parent, name ); + return new KateFileTemplates( tqparent, name ); } KInstance* KatePluginFactory::s_instance = 0L; @@ -125,8 +125,8 @@ class TemplateInfo //END TemplateInfo //BEGIN KateFileTemplates -KateFileTemplates::KateFileTemplates( TQObject* parent, const char* name ) - : Kate::Plugin ( (Kate::Application*)parent, name ), +KateFileTemplates::KateFileTemplates( TQObject* tqparent, const char* name ) + : Kate::Plugin ( (Kate::Application*)tqparent, name ), m_actionCollection( new KActionCollection( this, "template_actions", new KInstance("kate") ) ) { // create actions, so that they are shared. @@ -192,7 +192,7 @@ void KateFileTemplates::updateTemplateDirs(const TQString &d) TQString fname = (*it).section( '/', -1 ); // skip if hidden - if ( hidden.contains( fname ) ) + if ( hidden.tqcontains( fname ) ) continue; // Read the first line of the file, to get the group/name @@ -284,7 +284,7 @@ TQStringList KateFileTemplates::groups() for ( uint i = 0; i < m_templates.count(); i++ ) { s = m_templates.at( i )->group; - if ( ! l.contains( s ) ) + if ( ! l.tqcontains( s ) ) l.append( s ); } @@ -303,7 +303,7 @@ void KateFileTemplates::refreshMenu( PluginView *v ) m_acRecentTemplates->plug( m ); m->insertSeparator(); - TQDict<TQPopupMenu> submenus; // ### QMAP + TQDict<TQPopupMenu> submenus; // ### TQMAP for ( uint i = 0; i < m_templates.count(); i++ ) { if ( ! submenus[ m_templates.at( i )->group ] ) @@ -332,7 +332,7 @@ void KateFileTemplates::refreshMenu( PluginView *v ) w.prepend( "<p>" ); if ( ! w.isEmpty() ) - submenus[m_templates.at( i )->group]->findItem( i )->setWhatsThis( w ); + submenus[m_templates.at( i )->group]->tqfindItem( i )->setWhatsThis( w ); } } @@ -348,7 +348,7 @@ void KateFileTemplates::slotAny() // get a URL and pass that to slotOpenTemplate TQString fn = KFileDialog::getOpenFileName( "katefiletemplate", - TQString::null, + TQString(), application()->activeMainWindow()->viewManager()->activeView(), i18n("Open as Template") ); if ( ! fn.isEmpty() ) @@ -381,7 +381,7 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url ) if ( ! file.open( IO_ReadOnly ) ) { KMessageBox::sorry( application()->activeMainWindow()->viewManager()->activeView(), - i18n("<qt>Error opening the file<br><strong>%1</strong><br>for reading. The document will not be created.</qt>").arg(filename), + i18n("<qt>Error opening the file<br><strong>%1</strong><br>for reading. The document will not be created.</qt>").tqarg(filename), i18n("Template Plugin"), 0 ); KIO::NetAccess::removeTempFile( tmpfile ); return; @@ -412,7 +412,7 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url ) if ( reName.search( tmp ) > -1 ) { docname = reName.cap( 1 ); - docname = docname.replace( "%N", "%1" ); + docname = docname.tqreplace( "%N", "%1" ); doneheader |= 1; } } @@ -458,7 +458,7 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url ) if ( ! isTemplate ) { - int d = filename.findRev('.'); + int d = filename.tqfindRev('.'); docname = i18n("Untitled %1"); if ( d > 0 ) docname += filename.mid( d ); } else if ( docname.isEmpty() ) @@ -467,8 +467,8 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url ) // check for other documents matching this naming scheme, // and do a count before chosing a name for this one TQString p = docname; - p.replace( "%1", "\\d+" ); - p.replace( ".", "\\." ); + p.tqreplace( "%1", "\\d+" ); + p.tqreplace( ".", "\\." ); p.prepend( "^" ); p.append( "$" ); TQRegExp reName( p ); @@ -478,8 +478,8 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url ) if ( ( reName.search ( application()->documentManager()->document( i )->docName() ) > -1 ) ) count++; - if ( docname.contains( "%1" ) ) - docname = docname.arg( count ); + if ( docname.tqcontains( "%1" ) ) + docname = docname.tqarg( count ); doc->setDocName( docname ); @@ -504,7 +504,7 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url ) } -TQWidget *KateFileTemplates::parentWindow() +TQWidget *KateFileTemplates::tqparentWindow() { return dynamic_cast<TQWidget*>(application()->activeMainWindow()); } @@ -523,7 +523,7 @@ TQWidget *KateFileTemplates::parentWindow() // and edit the file as she wants to... void KateFileTemplates::slotCreateTemplate() { - KateTemplateWizard w( parentWindow(), this ); + KateTemplateWizard w( tqparentWindow(), this ); w.exec(); updateTemplateDirs(); @@ -536,7 +536,7 @@ void KateFileTemplates::slotCreateTemplate() // * Set the URL to a writable one if required void KateFileTemplates::slotEditTemplate() { - KDialogBase dlg( parentWindow(), "templatemanager", false, i18n("Manage File Templates"), KDialogBase::Close); + KDialogBase dlg( tqparentWindow(), "templatemanager", false, i18n("Manage File Templates"), KDialogBase::Close); dlg.setMainWidget( new KateTemplateManager( this, &dlg ) ); dlg.exec(); } @@ -544,8 +544,8 @@ void KateFileTemplates::slotEditTemplate() //BEGIN KateTemplateInfoWidget // This widget can be used to change the data of a TemplateInfo object -KateTemplateInfoWidget::KateTemplateInfoWidget( TQWidget *parent, TemplateInfo *info, KateFileTemplates *kft ) - : TQWidget( parent ), +KateTemplateInfoWidget::KateTemplateInfoWidget( TQWidget *tqparent, TemplateInfo *info, KateFileTemplates *kft ) + : TQWidget( tqparent ), info( info ), kft( kft ) { @@ -578,7 +578,7 @@ KateTemplateInfoWidget::KateTemplateInfoWidget( TQWidget *parent, TemplateInfo * l->setBuddy( leDocumentName ); TQWhatsThis::add( leDocumentName, i18n("<p>This string will be used to set a name " "for the new document, to display in the title bar and file list.</p>" - "<p>If the string contains '%N', that will be replaced with a number " + "<p>If the string tqcontains '%N', that will be replaced with a number " "increasing with each similarly named file.</p><p> For example, if the " "Document Name is 'New shellscript (%N).sh', the first document will be " "named 'New shellscript (1).sh', the second 'New shellscipt (2).sh', and " @@ -659,8 +659,8 @@ void KateTemplateInfoWidget::slotHlSet( int id ) //BEGIN KateTemplateWizard // A simple wizard to help create a new template :-) -KateTemplateWizard::KateTemplateWizard( TQWidget *parent, KateFileTemplates *kft ) - : KWizard( parent ), +KateTemplateWizard::KateTemplateWizard( TQWidget *tqparent, KateFileTemplates *kft ) + : KWizard( tqparent ), kft( kft ) { // Hide the help button for now @@ -687,7 +687,7 @@ KateTemplateWizard::KateTemplateWizard( TQWidget *parent, KateFileTemplates *kft rb = new TQRadioButton( i18n("Use an existing file:"), page ); bgOrigin->insert( rb, 2 ); glo->addMultiCellWidget( rb, 3, 3, 1, 2 ); - int marg = rb->style().subRect( TQStyle::SR_RadioButtonIndicator, rb ).width(); + int marg = rb->tqstyle().subRect( TQStyle::SR_RadioButtonIndicator, rb ).width(); glo->addItem( new TQSpacerItem( marg, 1, TQSizePolicy::Fixed ), 4, 1 ); urOrigin = new KURLRequester( page ); glo->addWidget( urOrigin, 4, 2 ); @@ -733,7 +733,7 @@ KateTemplateWizard::KateTemplateWizard( TQWidget *parent, KateFileTemplates *kft map[ "fullname" ] = ""; map[ "email" ] = ""; - KTextEditor::TemplateInterface::expandMacros( map, parent ); + KTextEditor::TemplateInterface::expandMacros( map, tqparent ); TQString sFullname = map["fullname"]; TQString sEmail = map["email"]; TQString _s = sFullname; @@ -795,12 +795,12 @@ KateTemplateWizard::KateTemplateWizard( TQWidget *parent, KateFileTemplates *kft "edit the data in the KDE email information."), page ) ); cbRRealname = new TQCheckBox( i18n("Replace full name '%1' with the " - "'%{fullname}' macro").arg( sFullname ), page ); + "'%{fullname}' macro").tqarg( sFullname ), page ); cbRRealname->setEnabled( ! sFullname.isEmpty() ); lo->addWidget( cbRRealname ); cbREmail = new TQCheckBox( i18n("Replace email address '%1' with the " - "'%email' macro").arg( sEmail ), page); + "'%email' macro").tqarg( sEmail ), page); cbREmail->setEnabled( ! sEmail.isEmpty() ); lo->addWidget( cbREmail ); @@ -908,7 +908,7 @@ void KateTemplateWizard::accept() else suggestion = kti->leTemplate->text(); - suggestion.replace(" ", ""); + suggestion.tqreplace(" ", ""); if ( ! suggestion.endsWith(".katetemplate") ) suggestion.append(".katetemplate"); @@ -922,7 +922,7 @@ void KateTemplateWizard::accept() if ( KMessageBox::warningContinueCancel( this, i18n( "<p>The file <br><strong>'%1'</strong><br> already exists; if you " "do not want to overwrite it, change the template file name to " - "something else.").arg( templateUrl.prettyURL() ), + "something else.").tqarg( templateUrl.prettyURL() ), i18n("File Exists"), i18n("Overwrite") ) == KMessageBox::Cancel ) return; @@ -976,7 +976,7 @@ void KateTemplateWizard::accept() { KMessageBox::sorry( this, i18n( "<qt>Error opening the file<br><strong>%1</strong><br>for reading. " - "The document will not be created</qt>").arg(u.prettyURL()), + "The document will not be created</qt>").tqarg(u.prettyURL()), i18n("Template Plugin"), 0 ); KIO::NetAccess::removeTempFile( tmpfile ); @@ -1005,16 +1005,16 @@ void KateTemplateWizard::accept() { // 3) if the file is not already a template, escape any "%" and "^" in it, // and try do do some replacement of the authors username, name and email. - tmp.replace( TQRegExp("%(?=\\{[^}]+\\})"), "\\%" ); - tmp.replace( TQRegExp("\\$(?=\\{[^}]+\\})"), "\\$" ); - //tmp.replace( "^", "\\^" ); + tmp.tqreplace( TQRegExp("%(?=\\{[^}]+\\})"), "\\%" ); + tmp.tqreplace( TQRegExp("\\$(?=\\{[^}]+\\})"), "\\$" ); + //tmp.tqreplace( "^", "\\^" ); if ( cbRRealname->isChecked() && ! sFullname.isEmpty() ) - tmp.replace( sFullname, "%{realname}" ); + tmp.tqreplace( sFullname, "%{realname}" ); if ( cbREmail->isChecked() && ! sEmail.isEmpty() ) - tmp.replace( sEmail, "%{email}" ); + tmp.tqreplace( sEmail, "%{email}" ); } str += tmp; @@ -1055,7 +1055,7 @@ void KateTemplateWizard::accept() { KMessageBox::sorry( this, i18n( "Unable to save the template to '%1'.\n\nThe template will be opened, " - "so you can save it from the editor.").arg( templateUrl.prettyURL() ), + "so you can save it from the editor.").tqarg( templateUrl.prettyURL() ), i18n("Save Failed") ); kft->application()->activeMainWindow()->viewManager()->openURL( KURL() ); @@ -1072,8 +1072,8 @@ void KateTemplateWizard::accept() class KateTemplateItem : public KListViewItem { public: - KateTemplateItem( KListViewItem *parent, TemplateInfo *templateinfo ) - : KListViewItem( parent, templateinfo->tmplate ), templateinfo( templateinfo ) + KateTemplateItem( KListViewItem *tqparent, TemplateInfo *templateinfo ) + : KListViewItem( tqparent, templateinfo->tmplate ), templateinfo( templateinfo ) { } TemplateInfo *templateinfo; @@ -1083,7 +1083,7 @@ class KateTemplateItem : public KListViewItem //BEGIN KFTNewStuff class KFTNewStuff : public KNewStuff { public: - KFTNewStuff( const TQString &type, TQWidget *parent=0 ) : KNewStuff( type, parent ), m_win( parent ) {} + KFTNewStuff( const TQString &type, TQWidget *tqparent=0 ) : KNewStuff( type, tqparent ), m_win( tqparent ) {} ~KFTNewStuff() {} bool install( const TQString &/*filename*/ ) { return true; } bool createUploadFile( const TQString &/*filename*/ ) { return false; } @@ -1099,8 +1099,8 @@ class KFTNewStuff : public KNewStuff { //END KTNewStuff //BEGIN KateTemplateManager -KateTemplateManager::KateTemplateManager( KateFileTemplates *kft, TQWidget *parent, const char *name ) - : TQWidget( parent, name ) +KateTemplateManager::KateTemplateManager( KateFileTemplates *kft, TQWidget *tqparent, const char *name ) + : TQWidget( tqparent, name ) , kft( kft ) { TQGridLayout *lo = new TQGridLayout( this, 2, 6 ); @@ -1146,7 +1146,7 @@ void KateTemplateManager::reload() { lvTemplates->clear(); - TQDict<KListViewItem> groupitems; // FIXME QMAP + TQDict<KListViewItem> groupitems; // FIXME TQMAP for ( uint i = 0; i < kft->templates().count(); i++ ) { if ( ! groupitems[ kft->templates().at( i )->group ] ) @@ -1216,7 +1216,7 @@ void KateTemplateManager::slotRemoveTemplate() // for this template, so the template is installable again. // ### This assumes that the knewstuff name is similar to the template name. kdDebug()<<"trying to remove knewstuff key '"<<item->templateinfo->tmplate<<"'"<<endl; - config->setGroup("KNewStuffStatus"); + config->setGroup("KNewStufftqStatus"); config->deleteEntry( item->templateinfo->tmplate ); @@ -1233,7 +1233,7 @@ void KateTemplateManager::slotUpload() if ( item ) { KFTNewStuff *ns = new KFTNewStuff( "katefiletemplates/template", this ); - ns->upload( item->templateinfo->filename, TQString::null ); + ns->upload( item->templateinfo->filename, TQString() ); } } @@ -1249,6 +1249,6 @@ void KateTemplateManager::slotDownload() //END KateTemplateManager -// kate: space-indent on; indent-width 2; replace-tabs on; +// kate: space-indent on; indent-width 2; tqreplace-tabs on; #include "filetemplates.moc" diff --git a/kate/filetemplates/plugin/filetemplates.h b/kate/filetemplates/plugin/filetemplates.h index 11734d5..6bcffce 100644 --- a/kate/filetemplates/plugin/filetemplates.h +++ b/kate/filetemplates/plugin/filetemplates.h @@ -39,12 +39,13 @@ class KatePluginFactory : public KLibFactory { Q_OBJECT + TQ_OBJECT public: KatePluginFactory(); virtual ~KatePluginFactory(); - virtual TQObject* createObject( TQObject* parent = 0, const char* pname = 0, const char* name = "TQObject", const TQStringList &args = TQStringList() ); + virtual TQObject* createObject( TQObject* tqparent = 0, const char* pname = 0, const char* name = TQOBJECT_OBJECT_NAME_STRING, const TQStringList &args = TQStringList() ); private: static KInstance* s_instance; @@ -73,9 +74,10 @@ class KatePluginFactory : public KLibFactory class KateFileTemplates : public Kate::Plugin, public Kate::PluginViewInterface { Q_OBJECT + TQ_OBJECT public: - KateFileTemplates( TQObject* parent = 0, const char* name = 0 ); + KateFileTemplates( TQObject* tqparent = 0, const char* name = 0 ); virtual ~KateFileTemplates(); void addView (Kate::MainWindow *win); @@ -100,14 +102,14 @@ class KateFileTemplates : public Kate::Plugin, public Kate::PluginViewInterface /** * @return a a pointer to the active main window */ - TQWidget * parentWindow(); + TQWidget * tqparentWindow(); public slots: /** * Update the template collection by rereading the template * directories. Also updates the menu. */ - void updateTemplateDirs(const TQString &s=TQString::null); + void updateTemplateDirs(const TQString &s=TQString()); private slots: /** @@ -154,11 +156,12 @@ class TemplateInfo; /** * This widget provide a GUI for editing template properties. */ -class KateTemplateInfoWidget : public QWidget +class KateTemplateInfoWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - KateTemplateInfoWidget( TQWidget *parent=0, TemplateInfo *info=0, KateFileTemplates *kft=0 ); + KateTemplateInfoWidget( TQWidget *tqparent=0, TemplateInfo *info=0, KateFileTemplates *kft=0 ); ~KateTemplateInfoWidget() {} TemplateInfo *info; @@ -191,8 +194,9 @@ class KateTemplateWizard : public KWizard { friend class KateFileTemplates; Q_OBJECT + TQ_OBJECT public: - KateTemplateWizard( TQWidget* parent, KateFileTemplates *ktf ); + KateTemplateWizard( TQWidget* tqparent, KateFileTemplates *ktf ); ~KateTemplateWizard() {} public slots: @@ -227,11 +231,12 @@ class KateTemplateWizard : public KWizard class TQCheckBox *cbOpenTemplate; }; -class KateTemplateManager : public QWidget +class KateTemplateManager : public TQWidget { Q_OBJECT + TQ_OBJECT public: - KateTemplateManager( KateFileTemplates *kft=0, TQWidget *parent=0, const char *name=0 ); + KateTemplateManager( KateFileTemplates *kft=0, TQWidget *tqparent=0, const char *name=0 ); ~KateTemplateManager() {} public slots: @@ -255,4 +260,4 @@ class KateTemplateManager : public QWidget }; #endif // _PLUGIN_KATE_FILETEMPLATES_H_ -// kate: space-indent on; indent-width 2; replace-tabs on; +// kate: space-indent on; indent-width 2; tqreplace-tabs on; diff --git a/kate/filetemplates/plugin/katetemplate.xml b/kate/filetemplates/plugin/katetemplate.xml index 0748481..78647d4 100644 --- a/kate/filetemplates/plugin/katetemplate.xml +++ b/kate/filetemplates/plugin/katetemplate.xml @@ -84,4 +84,4 @@ <keywords casesensitive="0"/> </general> </language> -<!-- kate: space-indent on; indent-width 2; replace-tabs on; --> +<!-- kate: space-indent on; indent-width 2; tqreplace-tabs on; --> diff --git a/kate/filetemplates/templates/language.xml.katetemplate b/kate/filetemplates/templates/language.xml.katetemplate index 420ba84..65d677a 100644 --- a/kate/filetemplates/templates/language.xml.katetemplate +++ b/kate/filetemplates/templates/language.xml.katetemplate @@ -57,4 +57,4 @@ katetemplate: Description=This template will create the basics of a kate highlig --> </general> </language> -<!-- kate: space-indent on; indent-width 2; replace-tabs on; indent-mode xml; --> +<!-- kate: space-indent on; indent-width 2; tqreplace-tabs on; indent-mode xml; --> |