summaryrefslogtreecommitdiffstats
path: root/kregexpeditor/userdefinedregexps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kregexpeditor/userdefinedregexps.cpp')
-rw-r--r--kregexpeditor/userdefinedregexps.cpp114
1 files changed, 57 insertions, 57 deletions
diff --git a/kregexpeditor/userdefinedregexps.cpp b/kregexpeditor/userdefinedregexps.cpp
index de2f675..10c97b0 100644
--- a/kregexpeditor/userdefinedregexps.cpp
+++ b/kregexpeditor/userdefinedregexps.cpp
@@ -27,36 +27,36 @@
#endif
#include "userdefinedregexps.h"
-#include <qheader.h>
-#include <qpopupmenu.h>
-#include <qdir.h>
+#include <tqheader.h>
+#include <tqpopupmenu.h>
+#include <tqdir.h>
#include "widgetfactory.h"
#include "compoundregexp.h"
-#include <qlayout.h>
-#include <qlabel.h>
+#include <tqlayout.h>
+#include <tqlabel.h>
-UserDefinedRegExps::UserDefinedRegExps( QWidget *parent, const char *name )
- : QDockWindow( QDockWindow::InDock, parent, name)
+UserDefinedRegExps::UserDefinedRegExps( TQWidget *parent, const char *name )
+ : TQDockWindow( TQDockWindow::InDock, parent, name)
{
- QWidget* top = new QWidget( this );
- QVBoxLayout* lay = new QVBoxLayout( top, 6 );
+ TQWidget* top = new TQWidget( this );
+ TQVBoxLayout* lay = new TQVBoxLayout( top, 6 );
lay->setAutoAdd( true );
- QLabel* label = new QLabel( i18n("Compound regular expressions:"), top );
+ TQLabel* label = new TQLabel( i18n("Compound regular expressions:"), top );
// This is to avoid that the label set the minimum width for the window.
label->setMinimumSize(1,0);
- _userDefined = new QListView( top, "UserDefinedRegExps::_userDefined" );
- _userDefined->addColumn( QString::null );
+ _userDefined = new TQListView( top, "UserDefinedRegExps::_userDefined" );
+ _userDefined->addColumn( TQString::null );
_userDefined->header()->hide();
// _userDefined->setRootIsDecorated( true );
setWidget( top );
slotPopulateUserRegexps();
- connect( _userDefined, SIGNAL(clicked(QListViewItem*)), this, SLOT(slotLoad(QListViewItem*)) );
- connect( _userDefined, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&, int )),
- this, SLOT( slotEdit( QListViewItem*, const QPoint& ) ) );
+ connect( _userDefined, TQT_SIGNAL(clicked(TQListViewItem*)), this, TQT_SLOT(slotLoad(TQListViewItem*)) );
+ connect( _userDefined, TQT_SIGNAL(rightButtonPressed(TQListViewItem*,const TQPoint&, int )),
+ this, TQT_SLOT( slotEdit( TQListViewItem*, const TQPoint& ) ) );
}
void UserDefinedRegExps::slotPopulateUserRegexps()
@@ -67,46 +67,46 @@ void UserDefinedRegExps::slotPopulateUserRegexps()
createItems( i18n("User Defined"), WidgetWinItem::path(), true );
#ifdef QT_ONLY
- QStringList dirs;
- dirs << QString::fromLatin1( "predefined" );
+ TQStringList dirs;
+ dirs << TQString::fromLatin1( "predefined" );
#else
- QStringList dirs = KGlobal::dirs()->findDirs( "data", QString::fromLocal8Bit("kregexpeditor/predefined/") );
+ TQStringList dirs = KGlobal::dirs()->findDirs( "data", TQString::fromLocal8Bit("kregexpeditor/predefined/") );
#endif
- for ( QStringList::iterator it1 = dirs.begin(); it1 != dirs.end(); ++it1 ) {
- QDir dir( *it1, QString::null, QDir::Name, QDir::Dirs );
- QStringList subdirs = dir.entryList();
- for ( QStringList::iterator it2 = subdirs.begin(); it2 != subdirs.end(); ++it2 ) {
- if ( *it2 == QString::fromLocal8Bit(".") || *it2 == QString::fromLocal8Bit("..") )
+ for ( TQStringList::iterator it1 = dirs.begin(); it1 != dirs.end(); ++it1 ) {
+ TQDir dir( *it1, TQString::null, TQDir::Name, TQDir::Dirs );
+ TQStringList subdirs = dir.entryList();
+ for ( TQStringList::iterator it2 = subdirs.begin(); it2 != subdirs.end(); ++it2 ) {
+ if ( *it2 == TQString::fromLocal8Bit(".") || *it2 == TQString::fromLocal8Bit("..") )
continue;
- createItems( *it2, *it1 + QString::fromLocal8Bit("/") + *it2, false );
+ createItems( *it2, *it1 + TQString::fromLocal8Bit("/") + *it2, false );
}
}
}
-void UserDefinedRegExps::createItems( const QString& _title, const QString& dir, bool usersRegExp )
+void UserDefinedRegExps::createItems( const TQString& _title, const TQString& dir, bool usersRegExp )
{
- QString title = _title;
- if (_title == QString::fromLatin1("general"))
+ TQString title = _title;
+ if (_title == TQString::fromLatin1("general"))
title = i18n("General");
- QListViewItem* lvItem = new QListViewItem( _userDefined, title );
+ TQListViewItem* lvItem = new TQListViewItem( _userDefined, title );
lvItem->setOpen( true );
- QDir directory( dir );
- QStringList files = directory.entryList( QString::fromLocal8Bit("*.regexp") );
- for ( QStringList::Iterator it = files.begin(); it != files.end(); ++it ) {
- QString fileName = dir + QString::fromLocal8Bit("/") + *it;
+ TQDir directory( dir );
+ TQStringList files = directory.entryList( TQString::fromLocal8Bit("*.regexp") );
+ for ( TQStringList::Iterator it = files.begin(); it != files.end(); ++it ) {
+ TQString fileName = dir + TQString::fromLocal8Bit("/") + *it;
- QFile file( fileName );
+ TQFile file( fileName );
if ( ! file.open(IO_ReadOnly) ) {
KMessageBox::sorry( this, i18n("Could not open file for reading: %1").arg(fileName) );
continue;
}
- QTextStream stream( &file );
- QString data = stream.read();
+ TQTextStream stream( &file );
+ TQString data = stream.read();
file.close();
RegExp* regexp = WidgetFactory::createRegExp( data );
@@ -126,7 +126,7 @@ void UserDefinedRegExps::createItems( const QString& _title, const QString& dir,
}
}
-const QPtrList<CompoundRegExp> UserDefinedRegExps::regExps() const
+const TQPtrList<CompoundRegExp> UserDefinedRegExps::regExps() const
{
return _regExps;
}
@@ -137,7 +137,7 @@ void UserDefinedRegExps::slotUnSelect()
_userDefined->clearSelection();
}
-void UserDefinedRegExps::slotLoad(QListViewItem* item)
+void UserDefinedRegExps::slotLoad(TQListViewItem* item)
{
if ( !item || ! dynamic_cast<WidgetWinItem*>(item) ) {
// Mouse pressed outside a widget.
@@ -150,9 +150,9 @@ void UserDefinedRegExps::slotLoad(QListViewItem* item)
}
}
-void UserDefinedRegExps::slotEdit( QListViewItem* item, const QPoint& pos )
+void UserDefinedRegExps::slotEdit( TQListViewItem* item, const TQPoint& pos )
{
- QPopupMenu* menu = new QPopupMenu( this );
+ TQPopupMenu* menu = new TQPopupMenu( this );
menu->insertItem(i18n("Delete"), 1 );
menu->insertItem(i18n("Rename..."), 2 );
if ( !item || ! dynamic_cast<WidgetWinItem*>( item ) ) {
@@ -174,7 +174,7 @@ void UserDefinedRegExps::slotEdit( QListViewItem* item, const QPoint& pos )
if ( which == 1 ) { // Delete
WidgetWinItem* winItem = dynamic_cast<WidgetWinItem*>( item );
Q_ASSERT( winItem );
- QFile file( winItem->fileName() );
+ TQFile file( winItem->fileName() );
Q_ASSERT( file.exists() );
file.remove();
delete item;
@@ -183,10 +183,10 @@ void UserDefinedRegExps::slotEdit( QListViewItem* item, const QPoint& pos )
WidgetWinItem* winItem = dynamic_cast<WidgetWinItem*>( item );
Q_ASSERT( winItem );
- QString oldFile = winItem->fileName();
- QString oldName = winItem->name();
+ TQString oldFile = winItem->fileName();
+ TQString oldName = winItem->name();
- QString txt;
+ TQString txt;
#ifdef QT_ONLY
txt = QInputDialog::getText( tr("Rename Regular Expression"), tr("New name:") );
#else
@@ -197,10 +197,10 @@ void UserDefinedRegExps::slotEdit( QListViewItem* item, const QPoint& pos )
txt = dlg.text();
#endif
if ( !txt.isNull() && oldName != txt ) {
- QString fileName = WidgetWinItem::path() + QString::fromLocal8Bit("/") + txt + QString::fromLocal8Bit(".regexp");
- QFileInfo finfo( fileName );
+ TQString fileName = WidgetWinItem::path() + TQString::fromLocal8Bit("/") + txt + TQString::fromLocal8Bit(".regexp");
+ TQFileInfo finfo( fileName );
if ( finfo.exists() ) {
- int answer = KMessageBox::warningYesNo( this, i18n("<p>Overwrite named regular expression <b>%1</b>?</p>").arg(txt), QString::null, i18n("Overwrite"), i18n("Do Not Overwrite") );
+ int answer = KMessageBox::warningYesNo( this, i18n("<p>Overwrite named regular expression <b>%1</b>?</p>").arg(txt), TQString::null, i18n("Overwrite"), i18n("Do Not Overwrite") );
if ( answer != KMessageBox::Yes )
return;
@@ -209,7 +209,7 @@ void UserDefinedRegExps::slotEdit( QListViewItem* item, const QPoint& pos )
}
else
winItem->setName( txt );
- QDir dir;
+ TQDir dir;
dir.rename( oldFile, fileName );
}
}
@@ -223,18 +223,18 @@ void UserDefinedRegExps::slotSelectNewAction()
slotUnSelect();
}
-WidgetWinItem::WidgetWinItem( QString fileName, RegExp* regexp, bool usersRegExp, QListViewItem* parent )
- :QListViewItem( parent ), _regexp( regexp ), _usersRegExp ( usersRegExp )
+WidgetWinItem::WidgetWinItem( TQString fileName, RegExp* regexp, bool usersRegExp, TQListViewItem* parent )
+ :TQListViewItem( parent ), _regexp( regexp ), _usersRegExp ( usersRegExp )
{
- int index = fileName.findRev(QString::fromLocal8Bit(".regexp"));
+ int index = fileName.findRev(TQString::fromLocal8Bit(".regexp"));
_name = fileName.left(index);
setText( 0, _name );
}
-QString WidgetWinItem::fileName() const
+TQString WidgetWinItem::fileName() const
{
- return path() + QString::fromLocal8Bit("/") +_name + QString::fromLocal8Bit(".regexp");
+ return path() + TQString::fromLocal8Bit("/") +_name + TQString::fromLocal8Bit(".regexp");
}
RegExp* WidgetWinItem::regExp() const
@@ -242,23 +242,23 @@ RegExp* WidgetWinItem::regExp() const
return _regexp;
}
-QString WidgetWinItem::name() const
+TQString WidgetWinItem::name() const
{
return _name;
}
-void WidgetWinItem::setName( const QString& nm )
+void WidgetWinItem::setName( const TQString& nm )
{
_name = nm;
setText( 0, nm );
}
-QString WidgetWinItem::path()
+TQString WidgetWinItem::path()
{
#ifdef QT_ONLY
- return QString::fromLatin1( "predefined" );
+ return TQString::fromLatin1( "predefined" );
#else
- return locateLocal("data", QString::fromLocal8Bit("KRegExpEditor/"));
+ return locateLocal("data", TQString::fromLocal8Bit("KRegExpEditor/"));
#endif
}