From 395a904bff7b4d6ead445c342f7ac0c5fbf29121 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 18 Jun 2011 17:00:31 +0000 Subject: 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 --- kate/filetemplates/plugin/filetemplates.cpp | 92 ++++++++++++++--------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'kate/filetemplates/plugin/filetemplates.cpp') 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 submenus; // ### QMAP + TQDict 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( "

" ); 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("Error opening the file
%1
for reading. The document will not be created.
").arg(filename), + i18n("Error opening the file
%1
for reading. The document will not be created.
").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(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("

This string will be used to set a name " "for the new document, to display in the title bar and file list.

" - "

If the string contains '%N', that will be replaced with a number " + "

If the string tqcontains '%N', that will be replaced with a number " "increasing with each similarly named file.

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( "

The file
'%1'
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( "Error opening the file
%1
for reading. " - "The document will not be created
").arg(u.prettyURL()), + "The document will not be created").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 groupitems; // FIXME QMAP + TQDict 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 '"<templateinfo->tmplate<<"'"<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" -- cgit v1.2.1