summaryrefslogtreecommitdiffstats
path: root/kate/filetemplates/plugin/filetemplates.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kate/filetemplates/plugin/filetemplates.cpp')
-rw-r--r--kate/filetemplates/plugin/filetemplates.cpp382
1 files changed, 191 insertions, 191 deletions
diff --git a/kate/filetemplates/plugin/filetemplates.cpp b/kate/filetemplates/plugin/filetemplates.cpp
index e1eb847..90b64c9 100644
--- a/kate/filetemplates/plugin/filetemplates.cpp
+++ b/kate/filetemplates/plugin/filetemplates.cpp
@@ -48,21 +48,21 @@
#include <kuser.h>
#include <kxmlguifactory.h>
-#include <qbuttongroup.h>
-#include <qcheckbox.h>
-#include <qcombobox.h>
-#include <qcursor.h>
-#include <qdatetime.h>
-#include <qdict.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlineedit.h>
-#include <qpopupmenu.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qregexp.h>
-#include <qstyle.h>
-#include <qwhatsthis.h>
+#include <tqbuttongroup.h>
+#include <tqcheckbox.h>
+#include <tqcombobox.h>
+#include <tqcursor.h>
+#include <tqdatetime.h>
+#include <tqdict.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqlineedit.h>
+#include <tqpopupmenu.h>
+#include <tqpushbutton.h>
+#include <tqradiobutton.h>
+#include <tqregexp.h>
+#include <tqstyle.h>
+#include <tqwhatsthis.h>
#include <stdlib.h>
@@ -98,7 +98,7 @@ KatePluginFactory::~KatePluginFactory()
delete s_instance;
}
-QObject* KatePluginFactory::createObject( QObject* parent, const char* name, const char*, const QStringList & )
+TQObject* KatePluginFactory::createObject( TQObject* parent, const char* name, const char*, const TQStringList & )
{
return new KateFileTemplates( parent, name );
}
@@ -110,22 +110,22 @@ KInstance* KatePluginFactory::s_instance = 0L;
class TemplateInfo
{
public:
- TemplateInfo( const QString& fn, const QString &t, const QString &g )
+ TemplateInfo( const TQString& fn, const TQString &t, const TQString &g )
: filename( fn ), tmplate ( t ), group( g ) { ; }
~TemplateInfo() { ; }
- QString filename;
- QString tmplate;
- QString group;
- QString description;
- QString author;
- QString highlight;
- QString icon;
+ TQString filename;
+ TQString tmplate;
+ TQString group;
+ TQString description;
+ TQString author;
+ TQString highlight;
+ TQString icon;
};
//END TemplateInfo
//BEGIN KateFileTemplates
-KateFileTemplates::KateFileTemplates( QObject* parent, const char* name )
+KateFileTemplates::KateFileTemplates( TQObject* parent, const char* name )
: Kate::Plugin ( (Kate::Application*)parent, name ),
m_actionCollection( new KActionCollection( this, "template_actions", new KInstance("kate") ) )
{
@@ -133,29 +133,29 @@ KateFileTemplates::KateFileTemplates( QObject* parent, const char* name )
// We plug them into each view's menus, and update them centrally, so that
// new plugins can automatically become visible in all windows.
(void) new KAction ( i18n("Any File..."), 0, this,
- SLOT( slotAny() ), m_actionCollection,
+ TQT_SLOT( slotAny() ), m_actionCollection,
"file_template_any" );
// recent templates
m_acRecentTemplates = new KRecentFilesAction( i18n("&Use Recent"), 0, this,
- SLOT(slotOpenTemplate(const KURL &)),
+ TQT_SLOT(slotOpenTemplate(const KURL &)),
m_actionCollection,
"file_templates_recent" );
m_acRecentTemplates->loadEntries( kapp->config(), "Recent Templates" );
// template menu
m_dw = new KDirWatch( this, "template_dirwatch" );
- QStringList dirs = KGlobal::dirs()->findDirs("data", "kate/plugins/katefiletemplates/templates");
- for ( QStringList::Iterator it = dirs.begin(); it != dirs.end(); ++it )
+ TQStringList dirs = KGlobal::dirs()->findDirs("data", "kate/plugins/katefiletemplates/templates");
+ for ( TQStringList::Iterator it = dirs.begin(); it != dirs.end(); ++it )
{
m_dw->addDir( *it, true );
}
- connect( m_dw, SIGNAL(dirty(const QString&)),
- this, SLOT(updateTemplateDirs(const QString&)) );
- connect( m_dw, SIGNAL(created(const QString&)),
- this, SLOT(updateTemplateDirs(const QString&)) );
- connect( m_dw, SIGNAL(deleted(const QString&)),
- this, SLOT(updateTemplateDirs(const QString&)) );
+ connect( m_dw, TQT_SIGNAL(dirty(const TQString&)),
+ this, TQT_SLOT(updateTemplateDirs(const TQString&)) );
+ connect( m_dw, TQT_SIGNAL(created(const TQString&)),
+ this, TQT_SLOT(updateTemplateDirs(const TQString&)) );
+ connect( m_dw, TQT_SIGNAL(deleted(const TQString&)),
+ this, TQT_SLOT(updateTemplateDirs(const TQString&)) );
m_templates.setAutoDelete( true );
updateTemplateDirs();
@@ -167,29 +167,29 @@ KateFileTemplates::KateFileTemplates( QObject* parent, const char* name )
/**
* Called whenever the template dir is changed. Recreates the templates list.
*/
-void KateFileTemplates::updateTemplateDirs(const QString &d)
+void KateFileTemplates::updateTemplateDirs(const TQString &d)
{
kdDebug()<<"updateTemplateDirs called with arg "<<d<<endl;
- QStringList templates = KGlobal::dirs()->findAllResources(
+ TQStringList templates = KGlobal::dirs()->findAllResources(
"data","kate/plugins/katefiletemplates/templates/*.katetemplate",
false,true);
m_templates.clear();
- QRegExp re( "\\b(\\w+)\\s*=\\s*(.+)(?:\\s+\\w+=|$)" );
+ TQRegExp re( "\\b(\\w+)\\s*=\\s*(.+)(?:\\s+\\w+=|$)" );
re.setMinimal( true );
KConfig *config = kapp->config();
- QStringList hidden;
+ TQStringList hidden;
config->readListEntry( "Hidden", hidden, ';' );
- for ( QStringList::Iterator it=templates.begin(); it != templates.end(); ++it )
+ for ( TQStringList::Iterator it=templates.begin(); it != templates.end(); ++it )
{
- QFile _f( *it );
+ TQFile _f( *it );
if ( _f.open( IO_ReadOnly ) )
{
- QString fname = (*it).section( '/', -1 );
+ TQString fname = (*it).section( '/', -1 );
// skip if hidden
if ( hidden.contains( fname ) )
@@ -198,10 +198,10 @@ void KateFileTemplates::updateTemplateDirs(const QString &d)
// Read the first line of the file, to get the group/name
TemplateInfo *tmp = new TemplateInfo( *it, fname, "Other" );
bool trymore ( true );
- QTextStream stream(&_f);
+ TQTextStream stream(&_f);
while ( trymore )
{
- QString _line = stream.readLine();
+ TQString _line = stream.readLine();
trymore = _line.startsWith( "katetemplate:" );
if ( ! trymore ) break;
@@ -249,7 +249,7 @@ void KateFileTemplates::addView(Kate::MainWindow *win)
PluginView *view = new PluginView ();
(void) new KAction( i18n("&Manage Templates..."), 0,
- this, SLOT(slotEditTemplate()),
+ this, TQT_SLOT(slotEditTemplate()),
view->actionCollection(), "settings_manage_templates" );
(void)new KActionMenu( i18n("New From &Template"), "make",
@@ -276,10 +276,10 @@ void KateFileTemplates::removeView(Kate::MainWindow *win)
}
}
-QStringList KateFileTemplates::groups()
+TQStringList KateFileTemplates::groups()
{
- QStringList l;
- QString s;
+ TQStringList l;
+ TQString s;
for ( uint i = 0; i < m_templates.count(); i++ )
{
@@ -293,7 +293,7 @@ QStringList KateFileTemplates::groups()
void KateFileTemplates::refreshMenu( PluginView *v )
{
- QPopupMenu *m = (QPopupMenu*)(((KActionMenu*)(v->actionCollection()->action("file_new_fromtemplate")))->popupMenu());
+ TQPopupMenu *m = (TQPopupMenu*)(((KActionMenu*)(v->actionCollection()->action("file_new_fromtemplate")))->popupMenu());
// clear the menu for templates
m->clear();
@@ -303,12 +303,12 @@ void KateFileTemplates::refreshMenu( PluginView *v )
m_acRecentTemplates->plug( m );
m->insertSeparator();
- QDict<QPopupMenu> submenus; // ### QMAP
+ TQDict<TQPopupMenu> submenus; // ### QMAP
for ( uint i = 0; i < m_templates.count(); i++ )
{
if ( ! submenus[ m_templates.at( i )->group ] )
{
- QPopupMenu *sm = new QPopupMenu();
+ TQPopupMenu *sm = new TQPopupMenu();
submenus.insert( m_templates.at( i )->group, sm );
m->insertItem( m_templates.at( i )->group, sm );
}
@@ -316,13 +316,13 @@ void KateFileTemplates::refreshMenu( PluginView *v )
if ( ! m_templates.at( i )->icon.isEmpty() )
submenus[m_templates.at( i )->group]->insertItem(
SmallIconSet( m_templates.at( i )->icon ),
- m_templates.at( i )->tmplate, this, SLOT(slotOpenTemplate( int )), 0, i );
+ m_templates.at( i )->tmplate, this, TQT_SLOT(slotOpenTemplate( int )), 0, i );
else
submenus[m_templates.at( i )->group]->insertItem(
- m_templates.at( i )->tmplate, this, SLOT(slotOpenTemplate( int )), 0, i );
+ m_templates.at( i )->tmplate, this, TQT_SLOT(slotOpenTemplate( int )), 0, i );
// add whatsthis containing the description and author
- QString w ( m_templates.at( i )->description );
+ TQString w ( m_templates.at( i )->description );
if( ! m_templates.at( i )->author.isEmpty() )
{
w.append( "<p>Author: " );
@@ -346,9 +346,9 @@ void KateFileTemplates::slotAny()
return;
// get a URL and pass that to slotOpenTemplate
- QString fn = KFileDialog::getOpenFileName(
+ TQString fn = KFileDialog::getOpenFileName(
"katefiletemplate",
- QString::null,
+ TQString::null,
application()->activeMainWindow()->viewManager()->activeView(),
i18n("Open as Template") );
if ( ! fn.isEmpty() )
@@ -368,16 +368,16 @@ void KateFileTemplates::slotOpenTemplate( int index )
void KateFileTemplates::slotOpenTemplate( const KURL &url )
{
// check if the file can be opened
- QString tmpfile;
- QString filename = url.fileName();
+ TQString tmpfile;
+ TQString filename = url.fileName();
kdDebug()<<"file: "<<filename<<endl;
if ( KIO::NetAccess::download( url, tmpfile, 0L ) )
{
bool isTemplate ( filename.endsWith( ".katetemplate" ) );
- QString docname;
+ TQString docname;
// open the file and parse for template variables and macros
- QFile file(tmpfile);
+ TQFile file(tmpfile);
if ( ! file.open( IO_ReadOnly ) )
{
KMessageBox::sorry( application()->activeMainWindow()->viewManager()->activeView(),
@@ -388,7 +388,7 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url )
}
// this may take a moment..
- kapp->setOverrideCursor( QCursor(QCursor::WaitCursor) );
+ kapp->setOverrideCursor( TQCursor(TQCursor::WaitCursor) );
// create a new document
application()->activeMainWindow()->viewManager()->openURL( KURL() );
@@ -396,8 +396,8 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url )
Kate::Document *doc = view->getDoc();
- QTextStream stream(&file);
- QString str, tmp;
+ TQTextStream stream(&file);
+ TQString str, tmp;
uint numlines = 0;
uint doneheader = 0;
while ( !stream.eof() ) {
@@ -407,7 +407,7 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url )
// look for document name, highlight
if ( ! (doneheader & 1) )
{
- QRegExp reName( "\\bdocumentname\\s*=\\s*(.+)(?:\\s+\\w+\\s*=|$)", false );
+ TQRegExp reName( "\\bdocumentname\\s*=\\s*(.+)(?:\\s+\\w+\\s*=|$)", false );
reName.setMinimal( true );
if ( reName.search( tmp ) > -1 )
{
@@ -419,7 +419,7 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url )
if ( ! (doneheader & 2) )
{
- QRegExp reHl( "\\bhighlight\\s*=\\s*(.+)(?:\\s+\\w+\\s*=|$)", false );
+ TQRegExp reHl( "\\bhighlight\\s*=\\s*(.+)(?:\\s+\\w+\\s*=|$)", false );
reHl.setMinimal( true );
kdDebug()<<"looking for a hl mode"<<endl;
if ( reHl.search( tmp ) > -1 )
@@ -427,7 +427,7 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url )
kdDebug()<<"looking for a hl mode -- "<<reHl.cap()<<endl;
// this is overly complex, too bad the interface is
// not providing a resonable method..
- QString hlmode = reHl.cap( 1 );
+ TQString hlmode = reHl.cap( 1 );
uint _i = 0;
while ( _i < doc->hlModeCount() )
{
@@ -466,12 +466,12 @@ 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
- QString p = docname;
+ TQString p = docname;
p.replace( "%1", "\\d+" );
p.replace( ".", "\\." );
p.prepend( "^" );
p.append( "$" );
- QRegExp reName( p );
+ TQRegExp reName( p );
int count = 1;
for ( uint i=0; i < application()->documentManager()->documents(); i++ )
@@ -495,7 +495,7 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url )
m_emailstuff = 0;
if (isTemplate) {
KTextEditor::TemplateInterface *ti=KTextEditor::templateInterface(doc);
- ti->insertTemplateText(0,0,str,QMap<QString,QString>());
+ ti->insertTemplateText(0,0,str,TQMap<TQString,TQString>());
} else {
doc->insertText( 0, 0, str );
view->setCursorPosition( line, col );
@@ -504,9 +504,9 @@ void KateFileTemplates::slotOpenTemplate( const KURL &url )
}
-QWidget *KateFileTemplates::parentWindow()
+TQWidget *KateFileTemplates::parentWindow()
{
- return dynamic_cast<QWidget*>(application()->activeMainWindow());
+ return dynamic_cast<TQWidget*>(application()->activeMainWindow());
}
// The next part are tools to aid the creation and editing of templates
@@ -544,39 +544,39 @@ void KateFileTemplates::slotEditTemplate()
//BEGIN KateTemplateInfoWidget
// This widget can be used to change the data of a TemplateInfo object
-KateTemplateInfoWidget::KateTemplateInfoWidget( QWidget *parent, TemplateInfo *info, KateFileTemplates *kft )
- : QWidget( parent ),
+KateTemplateInfoWidget::KateTemplateInfoWidget( TQWidget *parent, TemplateInfo *info, KateFileTemplates *kft )
+ : TQWidget( parent ),
info( info ),
kft( kft )
{
- QGridLayout *lo = new QGridLayout( this, 6, 2 );
+ TQGridLayout *lo = new TQGridLayout( this, 6, 2 );
lo->setAutoAdd( true );
lo->setSpacing( KDialogBase::spacingHint() );
- QLabel *l = new QLabel( i18n("&Template:"), this );
- QHBox *hb = new QHBox( this );
+ TQLabel *l = new TQLabel( i18n("&Template:"), this );
+ TQHBox *hb = new TQHBox( this );
hb->setSpacing( KDialogBase::spacingHint() );
- leTemplate = new QLineEdit( hb );
+ leTemplate = new TQLineEdit( hb );
l->setBuddy( leTemplate );
- QWhatsThis::add( leTemplate, i18n("<p>This string is used as the template's name "
+ TQWhatsThis::add( leTemplate, i18n("<p>This string is used as the template's name "
"and is displayed, for example, in the Template menu. It should describe the "
"meaning of the template, for example 'HTML Document'.</p>") );
ibIcon = new KIconButton( hb );
- QWhatsThis::add( ibIcon, i18n(
+ TQWhatsThis::add( ibIcon, i18n(
"Press to select or change the icon for this template") );
- l = new QLabel( i18n("&Group:"), this );
- cmbGroup = new QComboBox( true, this );
+ l = new TQLabel( i18n("&Group:"), this );
+ cmbGroup = new TQComboBox( true, this );
cmbGroup->insertStringList( kft->groups() );
l->setBuddy( cmbGroup );
- QWhatsThis::add( cmbGroup, i18n("<p>The group is used for chosing a "
+ TQWhatsThis::add( cmbGroup, i18n("<p>The group is used for chosing a "
"submenu for the plugin. If it is empty, 'Other' is used.</p>"
"<p>You can type any string to add a new group to your menu.</p>") );
- l = new QLabel( i18n("Document &name:"), this );
- leDocumentName = new QLineEdit( this );
+ l = new TQLabel( i18n("Document &name:"), this );
+ leDocumentName = new TQLineEdit( this );
l->setBuddy( leDocumentName );
- QWhatsThis::add( leDocumentName, i18n("<p>This string will be used to set a name "
+ 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 "
"increasing with each similarly named file.</p><p> For example, if the "
@@ -584,23 +584,23 @@ KateTemplateInfoWidget::KateTemplateInfoWidget( QWidget *parent, TemplateInfo *i
"named 'New shellscript (1).sh', the second 'New shellscipt (2).sh', and "
"so on.</p>") );
- l = new QLabel( i18n( "&Highlight:"), this );
- btnHighlight = new QPushButton( i18n("None"), this );
+ l = new TQLabel( i18n( "&Highlight:"), this );
+ btnHighlight = new TQPushButton( i18n("None"), this );
l->setBuddy( btnHighlight );
- QWhatsThis::add( btnHighlight, i18n("<p>Select the highlight to use for the "
+ TQWhatsThis::add( btnHighlight, i18n("<p>Select the highlight to use for the "
"template. If 'None' is chosen, the property will not be set.</p>") );
- l = new QLabel( i18n("&Description:"), this );
- leDescription = new QLineEdit( this );
+ l = new TQLabel( i18n("&Description:"), this );
+ leDescription = new TQLineEdit( this );
l->setBuddy( leDescription );
- QWhatsThis::add( leDescription, i18n("<p>This string is used, for example, as "
+ TQWhatsThis::add( leDescription, i18n("<p>This string is used, for example, as "
"context help for this template (such as the 'whatsthis' help for the "
"menu item.)</p>") );
- l = new QLabel( i18n("&Author:"), this );
- leAuthor = new QLineEdit( this );
+ l = new TQLabel( i18n("&Author:"), this );
+ leAuthor = new TQLineEdit( this );
l->setBuddy( leAuthor );
- QWhatsThis::add( leAuthor, i18n("<p>You can set this if you want to share your "
+ TQWhatsThis::add( leAuthor, i18n("<p>You can set this if you want to share your "
"template with other users.</p>"
"<p>the recommended form is like an Email "
"address: 'Anders Lund &lt;anders@alweb.dk&gt;'</p>") );
@@ -622,20 +622,20 @@ KateTemplateInfoWidget::KateTemplateInfoWidget( QWidget *parent, TemplateInfo *i
Kate::Document *doc = kft->application()->documentManager()->activeDocument();
if ( doc )
{
- QPopupMenu *m = new QPopupMenu( btnHighlight );
- connect( m, SIGNAL( activated( int ) ), this, SLOT( slotHlSet( int ) ) );
- QDict<QPopupMenu> submenus;
+ TQPopupMenu *m = new TQPopupMenu( btnHighlight );
+ connect( m, TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( slotHlSet( int ) ) );
+ TQDict<TQPopupMenu> submenus;
for ( uint n = 0; n < doc->hlModeCount(); n++ )
{
// create the sub menu if it does not exist
- QString text( doc->hlModeSectionName( n ) );
+ TQString text( doc->hlModeSectionName( n ) );
if ( ! text.isEmpty() )
{
if ( ! submenus[ text ] )
{
- QPopupMenu *sm = new QPopupMenu();
+ TQPopupMenu *sm = new TQPopupMenu();
submenus.insert( text, sm );
- connect( sm, SIGNAL( activated( int ) ), this, SLOT( slotHlSet( int ) ) );
+ connect( sm, TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( slotHlSet( int ) ) );
m->insertItem( text, sm );
}
@@ -659,7 +659,7 @@ void KateTemplateInfoWidget::slotHlSet( int id )
//BEGIN KateTemplateWizard
// A simple wizard to help create a new template :-)
-KateTemplateWizard::KateTemplateWizard( QWidget *parent, KateFileTemplates *kft )
+KateTemplateWizard::KateTemplateWizard( TQWidget *parent, KateFileTemplates *kft )
: KWizard( parent ),
kft( kft )
{
@@ -667,47 +667,47 @@ KateTemplateWizard::KateTemplateWizard( QWidget *parent, KateFileTemplates *kft
helpButton()->hide();
// 1) Optionally choose a file or existing template to start from
- QWidget *page = new QWidget( this );
- QGridLayout *glo = new QGridLayout( page );
+ TQWidget *page = new TQWidget( this );
+ TQGridLayout *glo = new TQGridLayout( page );
//lo->setAutoAdd( true );
glo->setSpacing( KDialogBase::spacingHint() );
- glo->addMultiCellWidget( new QLabel( i18n("<p>If you want to base this "
+ glo->addMultiCellWidget( new TQLabel( i18n("<p>If you want to base this "
"template on an existing file or template, select the appropriate option "
"below.</p>"), page ), 1, 1, 1, 2);
- bgOrigin = new QButtonGroup( page );
+ bgOrigin = new TQButtonGroup( page );
bgOrigin->hide();
bgOrigin->setRadioButtonExclusive( true );
- QRadioButton *rb = new QRadioButton( i18n("Start with an &empty document" ), page );
+ TQRadioButton *rb = new TQRadioButton( i18n("Start with an &empty document" ), page );
bgOrigin->insert( rb, 1 );
glo->addMultiCellWidget( rb, 2, 2, 1, 2 );
rb->setChecked( true );
- rb = new QRadioButton( i18n("Use an existing file:"), page );
+ 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( QStyle::SR_RadioButtonIndicator, rb ).width();
- glo->addItem( new QSpacerItem( marg, 1, QSizePolicy::Fixed ), 4, 1 );
+ int marg = rb->style().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 );
- rb = new QRadioButton( i18n("Use an existing template:"), page );
+ rb = new TQRadioButton( i18n("Use an existing template:"), page );
bgOrigin->insert( rb, 3 );
glo->addMultiCellWidget( rb, 5, 5, 1, 2 );
- glo->addItem( new QSpacerItem( marg, 1, QSizePolicy::Fixed ), 6, 1 );
- btnTmpl = new QPushButton( page );
+ glo->addItem( new TQSpacerItem( marg, 1, TQSizePolicy::Fixed ), 6, 1 );
+ btnTmpl = new TQPushButton( page );
glo->addWidget( btnTmpl, 6, 2 );
- QPopupMenu *m = new QPopupMenu( btnTmpl );
- connect( m, SIGNAL( activated( int ) ), this, SLOT( slotTmplateSet( int ) ) );
+ TQPopupMenu *m = new TQPopupMenu( btnTmpl );
+ connect( m, TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( slotTmplateSet( int ) ) );
- QDict<QPopupMenu> submenus;
+ TQDict<TQPopupMenu> submenus;
for ( uint i = 0; i < kft->templates().count(); i++ )
{
if ( ! submenus[ kft->templates().at( i )->group ] )
{
- QPopupMenu *sm = new QPopupMenu();
- connect( sm, SIGNAL( activated( int ) ), this, SLOT( slotTmplateSet( int ) ) );
+ TQPopupMenu *sm = new TQPopupMenu();
+ connect( sm, TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( slotTmplateSet( int ) ) );
submenus.insert( kft->templates().at( i )->group, sm );
m->insertItem( kft->templates().at( i )->group, sm );
}
@@ -717,10 +717,10 @@ KateTemplateWizard::KateTemplateWizard( QWidget *parent, KateFileTemplates *kft
}
btnTmpl->setPopup( m );
- connect( bgOrigin, SIGNAL(clicked(int)), this, SLOT(slotStateChanged(int)) );
- connect( urOrigin, SIGNAL(textChanged(const QString&)), this, SLOT(slotStateChanged(const QString&)) );
+ connect( bgOrigin, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(slotStateChanged(int)) );
+ connect( urOrigin, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotStateChanged(const TQString&)) );
- glo->addMultiCell( new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding ), 7, 7, 1, 2 );
+ glo->addMultiCell( new TQSpacerItem( 1, 1, TQSizePolicy::Expanding, TQSizePolicy::Expanding ), 7, 7, 1, 2 );
addPage( page, i18n("Choose Template Origin") );
kdDebug()<<"=== Adding template origin page at "<<page<<endl;
@@ -729,77 +729,77 @@ KateTemplateWizard::KateTemplateWizard( QWidget *parent, KateFileTemplates *kft
kdDebug()<<"=== Adding template info page at "<<kti<<endl;
addPage( kti, i18n("Edit Template Properties") );
// get liekly values from KTE
- QMap<QString, QString> map;
+ TQMap<TQString, TQString> map;
map[ "fullname" ] = "";
map[ "email" ] = "";
KTextEditor::TemplateInterface::expandMacros( map, parent );
- QString sFullname = map["fullname"];
- QString sEmail = map["email"];
- QString _s = sFullname;
+ TQString sFullname = map["fullname"];
+ TQString sEmail = map["email"];
+ TQString _s = sFullname;
if ( ! sEmail.isEmpty() )
_s += " <" + sEmail + ">";
kti->leAuthor->setText( _s );
// 3) choose a location - either the template directory (default) or
// a custom location
- page = new QWidget( this );
- glo = new QGridLayout( page, 7, 2 );
+ page = new TQWidget( this );
+ glo = new TQGridLayout( page, 7, 2 );
glo->setSpacing( KDialogBase::spacingHint() );
- glo->addMultiCellWidget( new QLabel( i18n("<p>Choose a location for the "
+ glo->addMultiCellWidget( new TQLabel( i18n("<p>Choose a location for the "
"template. If you store it in the template directory, it will "
"automatically be added to the template menu.</p>"), page ), 1, 1, 1, 2);
- bgLocation = new QButtonGroup( page );
+ bgLocation = new TQButtonGroup( page );
bgLocation->hide();
bgLocation->setRadioButtonExclusive( true );
- rb = new QRadioButton( i18n("Template directory"), page );
+ rb = new TQRadioButton( i18n("Template directory"), page );
bgLocation->insert( rb, 1 );
glo->addMultiCellWidget( rb, 2, 2, 1, 2 );
rb->setChecked( true );
- glo->addMultiCell( new QSpacerItem( marg, 1, QSizePolicy::Fixed ), 3, 4, 1, 1 );
- leTemplateFileName = new QLineEdit( page );
- QLabel *l = new QLabel( leTemplateFileName, i18n("Template &file name:"), page );
+ glo->addMultiCell( new TQSpacerItem( marg, 1, TQSizePolicy::Fixed ), 3, 4, 1, 1 );
+ leTemplateFileName = new TQLineEdit( page );
+ TQLabel *l = new TQLabel( leTemplateFileName, i18n("Template &file name:"), page );
glo->addWidget( l, 3, 2 );
glo->addWidget( leTemplateFileName, 4, 2 );
- rb = new QRadioButton( i18n("Custom location:"), page );
+ rb = new TQRadioButton( i18n("Custom location:"), page );
bgLocation->insert( rb, 2 );
glo->addMultiCellWidget( rb, 5, 5, 1, 2 );
- glo->addItem( new QSpacerItem( marg, 1, QSizePolicy::Fixed ), 6, 1 );
+ glo->addItem( new TQSpacerItem( marg, 1, TQSizePolicy::Fixed ), 6, 1 );
urLocation = new KURLRequester( page );
glo->addWidget( urLocation, 6, 2 );
- connect( bgLocation, SIGNAL(clicked(int)), this, SLOT(slotStateChanged(int)) );
- connect( urLocation, SIGNAL(textChanged(const QString&)), this, SLOT(slotStateChanged(const QString&)) );
- connect( leTemplateFileName, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChanged(const QString &)) );
+ connect( bgLocation, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(slotStateChanged(int)) );
+ connect( urLocation, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotStateChanged(const TQString&)) );
+ connect( leTemplateFileName, TQT_SIGNAL(textChanged(const TQString &)), this, TQT_SLOT(slotStateChanged(const TQString &)) );
- glo->addMultiCell( new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding ), 7, 7, 1, 2 );
+ glo->addMultiCell( new TQSpacerItem( 1, 1, TQSizePolicy::Expanding, TQSizePolicy::Expanding ), 7, 7, 1, 2 );
addPage( page, i18n("Choose Location") );
kdDebug()<<"=== Adding location page at "<<page<<endl;
// 4) Should we edit the text to add some macros, replacing username etc?
// This is *only* relevant if the origin is a non-template file.
- page = new QWidget( this );
- QVBoxLayout *lo = new QVBoxLayout( page );
+ page = new TQWidget( this );
+ TQVBoxLayout *lo = new TQVBoxLayout( page );
lo->setSpacing( KDialogBase::spacingHint() );
lo->addWidget(
- new QLabel( i18n( "<p>You can replace certain strings in the text with "
+ new TQLabel( i18n( "<p>You can replace certain strings in the text with "
"template macros.<p>If any of the data below is incorrect or missing, "
"edit the data in the KDE email information."), page ) );
- cbRRealname = new QCheckBox( i18n("Replace full name '%1' with the "
+ cbRRealname = new TQCheckBox( i18n("Replace full name '%1' with the "
"'%{fullname}' macro").arg( sFullname ), page );
cbRRealname->setEnabled( ! sFullname.isEmpty() );
lo->addWidget( cbRRealname );
- cbREmail = new QCheckBox( i18n("Replace email address '%1' with the "
+ cbREmail = new TQCheckBox( i18n("Replace email address '%1' with the "
"'%email' macro").arg( sEmail ), page);
cbREmail->setEnabled( ! sEmail.isEmpty() );
lo->addWidget( cbREmail );
@@ -809,17 +809,17 @@ KateTemplateWizard::KateTemplateWizard( QWidget *parent, KateFileTemplates *kft
addPage( page, i18n("Autoreplace Macros") );
kdDebug()<<"=== Adding autoreplace page at "<<page<<endl;
// 5) Display a summary
- page = new QWidget( this );
- lo = new QVBoxLayout( page );
+ page = new TQWidget( this );
+ lo = new TQVBoxLayout( page );
lo->setSpacing( KDialogBase::spacingHint() );
- QString s = i18n("<p>The template will now be created and saved to the chosen "
+ TQString s = i18n("<p>The template will now be created and saved to the chosen "
"location. To position the cursor put a caret ('^') character where you "
"want it in files created from the template.</p>");
- lo->addWidget( new QLabel( s, page ) );
+ lo->addWidget( new TQLabel( s, page ) );
- cbOpenTemplate = new QCheckBox( i18n("Open the template for editing"), page );
+ cbOpenTemplate = new TQCheckBox( i18n("Open the template for editing"), page );
lo->addWidget( cbOpenTemplate );
@@ -827,7 +827,7 @@ KateTemplateWizard::KateTemplateWizard( QWidget *parent, KateFileTemplates *kft
addPage( page, i18n("Create Template") );
kdDebug()<<"=== Adding summary page at "<<endl;
- connect( this, SIGNAL(selected(const QString&)), this, SLOT(slotStateChanged(const QString&)) );
+ connect( this, TQT_SIGNAL(selected(const TQString&)), this, TQT_SLOT(slotStateChanged(const TQString&)) );
}
void KateTemplateWizard::slotTmplateSet( int idx )
@@ -902,7 +902,7 @@ void KateTemplateWizard::accept()
KURL templateUrl;
if ( bgLocation->selectedId() == 1 )
{
- QString suggestion;
+ TQString suggestion;
if ( ! leTemplateFileName->text().isEmpty() )
suggestion = leTemplateFileName->text();
else
@@ -913,11 +913,11 @@ void KateTemplateWizard::accept()
if ( ! suggestion.endsWith(".katetemplate") )
suggestion.append(".katetemplate");
- QString dir = KGlobal::dirs()->saveLocation( "data", "kate/plugins/katefiletemplates/templates/", true );
+ TQString dir = KGlobal::dirs()->saveLocation( "data", "kate/plugins/katefiletemplates/templates/", true );
templateUrl = dir + suggestion;
- if ( QFile::exists( templateUrl.path() ) )
+ if ( TQFile::exists( templateUrl.path() ) )
{
if ( KMessageBox::warningContinueCancel( this, i18n(
"<p>The file <br><strong>'%1'</strong><br> already exists; if you "
@@ -933,11 +933,11 @@ void KateTemplateWizard::accept()
templateUrl = urLocation->url();
}
- QWizard::accept();
+ TQWizard::accept();
// The following must be done:
// 1) add the collected template information to the top
uint ln = 0;
- QString s, str;
+ TQString s, str;
if ( ! kti->leTemplate->text().isEmpty() )
s += " Template=" + kti->leTemplate->text();
if ( ! kti->cmbGroup->currentText().isEmpty() )
@@ -968,10 +968,10 @@ void KateTemplateWizard::accept()
else // template
u = KURL( kft->templates().at( selectedTemplateIdx )->filename );
- QString tmpfile, tmp;
+ TQString tmpfile, tmp;
if ( KIO::NetAccess::download( u, tmpfile, 0L ) )
{
- QFile file(tmpfile);
+ TQFile file(tmpfile);
if ( ! file.open( IO_ReadOnly ) )
{
KMessageBox::sorry( this, i18n(
@@ -983,8 +983,8 @@ void KateTemplateWizard::accept()
return;
}
- QTextStream stream(&file);
- QString ln;
+ TQTextStream stream(&file);
+ TQString ln;
bool trymore = true;
while ( !stream.eof() )
{
@@ -1005,8 +1005,8 @@ 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( QRegExp("%(?=\\{[^}]+\\})"), "\\%" );
- tmp.replace( QRegExp("\\$(?=\\{[^}]+\\})"), "\\$" );
+ tmp.replace( TQRegExp("%(?=\\{[^}]+\\})"), "\\%" );
+ tmp.replace( TQRegExp("\\$(?=\\{[^}]+\\})"), "\\$" );
//tmp.replace( "^", "\\^" );
if ( cbRRealname->isChecked() && ! sFullname.isEmpty() )
@@ -1028,11 +1028,11 @@ void KateTemplateWizard::accept()
{
if ( templateUrl.isLocalFile() )
{
- QFile file( templateUrl.path() );
+ TQFile file( templateUrl.path() );
if ( file.open(IO_WriteOnly) )
{
kdDebug()<<"file opened with succes"<<endl;
- QTextStream stream( &file );
+ TQTextStream stream( &file );
stream << str;
file.close();
succes = true;
@@ -1041,8 +1041,8 @@ void KateTemplateWizard::accept()
else
{
KTempFile tmp;
- QString fn = tmp.name();
- QTextStream stream( tmp.file() );
+ TQString fn = tmp.name();
+ TQTextStream stream( tmp.file() );
stream << str;
tmp.close();
@@ -1083,51 +1083,51 @@ class KateTemplateItem : public KListViewItem
//BEGIN KFTNewStuff
class KFTNewStuff : public KNewStuff {
public:
- KFTNewStuff( const QString &type, QWidget *parent=0 ) : KNewStuff( type, parent ), m_win( parent ) {}
+ KFTNewStuff( const TQString &type, TQWidget *parent=0 ) : KNewStuff( type, parent ), m_win( parent ) {}
~KFTNewStuff() {}
- bool install( const QString &/*filename*/ ) { return true; }
- bool createUploadFile( const QString &/*filename*/ ) { return false; }
- QString downloadDestination( KNS::Entry *entry )
+ bool install( const TQString &/*filename*/ ) { return true; }
+ bool createUploadFile( const TQString &/*filename*/ ) { return false; }
+ TQString downloadDestination( KNS::Entry *entry )
{
- QString dir = KGlobal::dirs()->saveLocation( "data", "kate/plugins/katefiletemplates/templates/", true );
+ TQString dir = KGlobal::dirs()->saveLocation( "data", "kate/plugins/katefiletemplates/templates/", true );
return dir.append( entry->payload().filename() );
}
private:
- QWidget *m_win;
+ TQWidget *m_win;
};
//END KTNewStuff
//BEGIN KateTemplateManager
-KateTemplateManager::KateTemplateManager( KateFileTemplates *kft, QWidget *parent, const char *name )
- : QWidget( parent, name )
+KateTemplateManager::KateTemplateManager( KateFileTemplates *kft, TQWidget *parent, const char *name )
+ : TQWidget( parent, name )
, kft( kft )
{
- QGridLayout *lo = new QGridLayout( this, 2, 6 );
+ TQGridLayout *lo = new TQGridLayout( this, 2, 6 );
lo->setSpacing( KDialogBase::spacingHint() );
lvTemplates = new KListView( this );
lvTemplates->addColumn( i18n("Template") );
lo->addMultiCellWidget( lvTemplates, 1, 1, 1, 6 );
- connect( lvTemplates, SIGNAL(selectionChanged()), this, SLOT(slotUpdateState()) );
+ connect( lvTemplates, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(slotUpdateState()) );
- btnNew = new QPushButton( i18n("New..."), this );
- connect( btnNew, SIGNAL(clicked()), kft, SLOT(slotCreateTemplate()) );
+ btnNew = new TQPushButton( i18n("New..."), this );
+ connect( btnNew, TQT_SIGNAL(clicked()), kft, TQT_SLOT(slotCreateTemplate()) );
lo->addWidget( btnNew, 2, 2 );
- btnEdit = new QPushButton( i18n("Edit..."), this );
- connect( btnEdit, SIGNAL(clicked()), this, SLOT( slotEditTemplate()) );
+ btnEdit = new TQPushButton( i18n("Edit..."), this );
+ connect( btnEdit, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotEditTemplate()) );
lo->addWidget( btnEdit, 2, 3 );
- btnRemove = new QPushButton( i18n("Remove"), this );
- connect( btnRemove, SIGNAL(clicked()), this, SLOT(slotRemoveTemplate()) );
+ btnRemove = new TQPushButton( i18n("Remove"), this );
+ connect( btnRemove, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotRemoveTemplate()) );
lo->addWidget( btnRemove, 2, 4 );
- btnUpload = new QPushButton( i18n("Upload..."), this );
- connect( btnUpload, SIGNAL(clicked()), this, SLOT(slotUpload()) );
+ btnUpload = new TQPushButton( i18n("Upload..."), this );
+ connect( btnUpload, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotUpload()) );
lo->addWidget( btnUpload, 2, 5 );
- btnDownload = new QPushButton( i18n("Download..."), this );
- connect( btnDownload, SIGNAL(clicked()), this, SLOT(slotDownload()) );
+ btnDownload = new TQPushButton( i18n("Download..."), this );
+ connect( btnDownload, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotDownload()) );
lo->addWidget( btnDownload, 2, 6 );
lo->setColStretch( 1, 1 );
@@ -1146,7 +1146,7 @@ void KateTemplateManager::reload()
{
lvTemplates->clear();
- QDict<KListViewItem> groupitems; // FIXME QMAP
+ TQDict<KListViewItem> groupitems; // FIXME QMAP
for ( uint i = 0; i < kft->templates().count(); i++ )
{
if ( ! groupitems[ kft->templates().at( i )->group ] )
@@ -1189,15 +1189,15 @@ void KateTemplateManager::slotRemoveTemplate()
// If it fails (there was a global, unwritable instance), add to a
// list of removed templates
KConfig *config = kapp->config();
- QString fname = item->templateinfo->filename.section( '/', -1 );
- QStringList templates = KGlobal::dirs()->findAllResources(
+ TQString fname = item->templateinfo->filename.section( '/', -1 );
+ TQStringList templates = KGlobal::dirs()->findAllResources(
"data", fname.prepend( "kate/plugins/katefiletemplates/templates/" ),
false,true);
int failed = 0;
int removed = 0;
- for ( QStringList::Iterator it=templates.begin(); it!=templates.end(); ++it )
+ for ( TQStringList::Iterator it=templates.begin(); it!=templates.end(); ++it )
{
- if ( ! QFile::remove(*it) )
+ if ( ! TQFile::remove(*it) )
failed++;
else
removed++;
@@ -1206,7 +1206,7 @@ void KateTemplateManager::slotRemoveTemplate()
if ( failed )
{
config->setGroup( "KateFileTemplates" );
- QStringList l;
+ TQStringList l;
config->readListEntry( "Hidden", l, ';' );
l << fname;
config->writeEntry( "Hidden", l, ';' );
@@ -1233,7 +1233,7 @@ void KateTemplateManager::slotUpload()
if ( item )
{
KFTNewStuff *ns = new KFTNewStuff( "katefiletemplates/template", this );
- ns->upload( item->templateinfo->filename, QString::null );
+ ns->upload( item->templateinfo->filename, TQString::null );
}
}