summaryrefslogtreecommitdiffstats
path: root/knode/utilities.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'knode/utilities.cpp')
-rw-r--r--knode/utilities.cpp120
1 files changed, 60 insertions, 60 deletions
diff --git a/knode/utilities.cpp b/knode/utilities.cpp
index 5f9c2e98c..67d4e3bac 100644
--- a/knode/utilities.cpp
+++ b/knode/utilities.cpp
@@ -12,10 +12,10 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
*/
-#include <qlayout.h>
-#include <qregexp.h>
-#include <qapplication.h>
-#include <qcursor.h>
+#include <tqlayout.h>
+#include <tqregexp.h>
+#include <tqapplication.h>
+#include <tqcursor.h>
#include <klocale.h>
#include <kmessagebox.h>
@@ -33,8 +33,8 @@
//================================================================================
-KNFile::KNFile(const QString& fname)
- : QFile(fname), filePos(0), readBytes(0)
+KNFile::KNFile(const TQString& fname)
+ : TQFile(fname), filePos(0), readBytes(0)
{
buffer.resize(512);
dataPtr=buffer.data();
@@ -47,15 +47,15 @@ KNFile::~KNFile()
}
-const QCString& KNFile::readLine()
+const TQCString& KNFile::readLine()
{
filePos=at();
- readBytes=QFile::readLine(dataPtr, buffer.size()-1);
+ readBytes=TQFile::readLine(dataPtr, buffer.size()-1);
if(readBytes!=-1) {
while ((dataPtr[readBytes-1]!='\n')&&(static_cast<uint>(readBytes+2)==buffer.size())) { // don't get tricked by files without newline
at(filePos);
if (!increaseBuffer() ||
- (readBytes=QFile::readLine(dataPtr, buffer.size()-1))==-1) {
+ (readBytes=TQFile::readLine(dataPtr, buffer.size()-1))==-1) {
readBytes=1;
break;
}
@@ -68,15 +68,15 @@ const QCString& KNFile::readLine()
}
-const QCString& KNFile::readLineWnewLine()
+const TQCString& KNFile::readLineWnewLine()
{
filePos=at();
- readBytes=QFile::readLine(dataPtr, buffer.size()-1);
+ readBytes=TQFile::readLine(dataPtr, buffer.size()-1);
if(readBytes!=-1) {
while ((dataPtr[readBytes-1]!='\n')&&(static_cast<uint>(readBytes+2)==buffer.size())) { // don't get tricked by files without newline
at(filePos);
if (!increaseBuffer() ||
- (readBytes=QFile::readLine(dataPtr, buffer.size()-1))==-1) {
+ (readBytes=TQFile::readLine(dataPtr, buffer.size()-1))==-1) {
dataPtr[0] = '\0';
break;
}
@@ -90,7 +90,7 @@ const QCString& KNFile::readLineWnewLine()
int KNFile::findString(const char *s)
{
- QCString searchBuffer;
+ TQCString searchBuffer;
searchBuffer.resize(2048);
char *buffPtr = searchBuffer.data(), *pos;
int readBytes, currentFilePos;
@@ -132,9 +132,9 @@ bool KNFile::increaseBuffer()
//===============================================================================
-QString KNSaveHelper::lastPath;
+TQString KNSaveHelper::lastPath;
-KNSaveHelper::KNSaveHelper(QString saveName, QWidget *parent)
+KNSaveHelper::KNSaveHelper(TQString saveName, TQWidget *parent)
: p_arent(parent), s_aveName(saveName), file(0), tmpFile(0)
{
}
@@ -155,9 +155,9 @@ KNSaveHelper::~KNSaveHelper()
}
-QFile* KNSaveHelper::getFile(const QString &dialogTitle)
+TQFile* KNSaveHelper::getFile(const TQString &dialogTitle)
{
- url = KFileDialog::getSaveURL(lastPath + s_aveName, QString::null, p_arent, dialogTitle);
+ url = KFileDialog::getSaveURL(lastPath + s_aveName, TQString::null, p_arent, dialogTitle);
if (url.isEmpty())
return 0;
@@ -165,14 +165,14 @@ QFile* KNSaveHelper::getFile(const QString &dialogTitle)
lastPath = url.upURL().url();
if (url.isLocalFile()) {
- if (QFileInfo(url.path()).exists() &&
+ if (TQFileInfo(url.path()).exists() &&
(KMessageBox::warningContinueCancel(knGlobals.topWidget,
i18n("<qt>A file named <b>%1</b> already exists.<br>Do you want to replace it?</qt>").arg(url.path()),
dialogTitle, i18n("&Replace")) != KMessageBox::Continue)) {
return 0;
}
- file = new QFile(url.path());
+ file = new TQFile(url.path());
if(!file->open(IO_WriteOnly)) {
KNHelper::displayExternalFileError();
delete file;
@@ -194,9 +194,9 @@ QFile* KNSaveHelper::getFile(const QString &dialogTitle)
//===============================================================================
-QString KNLoadHelper::l_astPath;
+TQString KNLoadHelper::l_astPath;
-KNLoadHelper::KNLoadHelper(QWidget *parent)
+KNLoadHelper::KNLoadHelper(TQWidget *parent)
: p_arent(parent), f_ile(0)
{
}
@@ -210,12 +210,12 @@ KNLoadHelper::~KNLoadHelper()
}
-KNFile* KNLoadHelper::getFile( const QString &dialogTitle )
+KNFile* KNLoadHelper::getFile( const TQString &dialogTitle )
{
if (f_ile)
return f_ile;
- KURL url = KFileDialog::getOpenURL(l_astPath,QString::null,p_arent,dialogTitle);
+ KURL url = KFileDialog::getOpenURL(l_astPath,TQString::null,p_arent,dialogTitle);
if (url.isEmpty())
return 0;
@@ -237,7 +237,7 @@ KNFile* KNLoadHelper::setURL(KURL url)
if (u_rl.isEmpty())
return 0;
- QString fileName;
+ TQString fileName;
if (!u_rl.isLocalFile()) {
if (KIO::NetAccess::download(u_rl, t_empName, 0))
fileName = t_empName;
@@ -261,26 +261,26 @@ KNFile* KNLoadHelper::setURL(KURL url)
// **** keyboard selection dialog *********************************************
-int KNHelper::selectDialog(QWidget *parent, const QString &caption, const QStringList &options, int initialValue)
+int KNHelper::selectDialog(TQWidget *parent, const TQString &caption, const TQStringList &options, int initialValue)
{
KDialogBase *dlg=new KDialogBase(KDialogBase::Plain, caption, KDialogBase::Ok|KDialogBase::Cancel,
KDialogBase::Ok, parent);
- QFrame *page = dlg->plainPage();
- QHBoxLayout *pageL = new QHBoxLayout(page,8,5);
+ TQFrame *page = dlg->plainPage();
+ TQHBoxLayout *pageL = new TQHBoxLayout(page,8,5);
KNDialogListBox *list = new KNDialogListBox(true, page);
pageL->addWidget(list);
- QString s;
- for ( QStringList::ConstIterator it = options.begin(); it != options.end(); ++it ) {
+ TQString s;
+ for ( TQStringList::ConstIterator it = options.begin(); it != options.end(); ++it ) {
s = (*it);
- s.replace(QRegExp("&"),""); // remove accelerators
+ s.replace(TQRegExp("&"),""); // remove accelerators
list->insertItem(s);
}
list->setCurrentItem(initialValue);
list->setFocus();
- restoreWindowSize("selectBox", dlg, QSize(247,174));
+ restoreWindowSize("selectBox", dlg, TQSize(247,174));
int ret;
if (dlg->exec())
@@ -295,7 +295,7 @@ int KNHelper::selectDialog(QWidget *parent, const QString &caption, const QStrin
// **** window geometry managing *********************************************
-void KNHelper::saveWindowSize(const QString &name, const QSize &s)
+void KNHelper::saveWindowSize(const TQString &name, const TQSize &s)
{
KConfig *c=knGlobals.config();
c->setGroup("WINDOW_SIZES");
@@ -303,15 +303,15 @@ void KNHelper::saveWindowSize(const QString &name, const QSize &s)
}
-void KNHelper::restoreWindowSize(const QString &name, QWidget *d, const QSize &defaultSize)
+void KNHelper::restoreWindowSize(const TQString &name, TQWidget *d, const TQSize &defaultSize)
{
KConfig *c=knGlobals.config();
c->setGroup("WINDOW_SIZES");
- QSize s=c->readSizeEntry(name,&defaultSize);
+ TQSize s=c->readSizeEntry(name,&defaultSize);
if(s.isValid()) {
- QRect max = KGlobalSettings::desktopGeometry(QCursor::pos());
+ TQRect max = KGlobalSettings::desktopGeometry(TQCursor::pos());
if ( s.width() > max.width() ) s.setWidth( max.width()-5 );
if ( s.height() > max.height() ) s.setHeight( max.height()-5 );
d->resize(s);
@@ -320,10 +320,10 @@ void KNHelper::restoreWindowSize(const QString &name, QWidget *d, const QSize &d
// **** scramble password strings **********************************************
-const QString KNHelper::encryptStr(const QString& aStr)
+const TQString KNHelper::encryptStr(const TQString& aStr)
{
uint i,val,len = aStr.length();
- QCString result;
+ TQCString result;
for (i=0; i<len; i++)
{
@@ -336,25 +336,25 @@ const QString KNHelper::encryptStr(const QString& aStr)
}
-const QString KNHelper::decryptStr(const QString& aStr)
+const TQString KNHelper::decryptStr(const TQString& aStr)
{
return encryptStr(aStr);
}
// **** rot13 *******************************************************************
-QString KNHelper::rot13(const QString &s)
+TQString KNHelper::rot13(const TQString &s)
{
- QString r(s);
+ TQString r(s);
for (int i=0; (uint)i<r.length(); i++) {
- if ( r[i] >= QChar('A') && r[i] <= QChar('M') ||
- r[i] >= QChar('a') && r[i] <= QChar('m') )
- r[i] = (char)((int)QChar(r[i]) + 13);
+ if ( r[i] >= TQChar('A') && r[i] <= TQChar('M') ||
+ r[i] >= TQChar('a') && r[i] <= TQChar('m') )
+ r[i] = (char)((int)TQChar(r[i]) + 13);
else
- if ( r[i] >= QChar('N') && r[i] <= QChar('Z') ||
- r[i] >= QChar('n') && r[i] <= QChar('z') )
- r[i] = (char)((int)QChar(r[i]) - 13);
+ if ( r[i] >= TQChar('N') && r[i] <= TQChar('Z') ||
+ r[i] >= TQChar('n') && r[i] <= TQChar('z') )
+ r[i] = (char)((int)TQChar(r[i]) - 13);
}
return r;
@@ -362,7 +362,7 @@ QString KNHelper::rot13(const QString &s)
// **** text rewraping *********************************************************
-int findBreakPos(const QString &text, int start)
+int findBreakPos(const TQString &text, int start)
{
int i;
for(i=start;i>=0;i--)
@@ -377,9 +377,9 @@ int findBreakPos(const QString &text, int start)
}
-void appendTextWPrefix(QString &result, const QString &text, int wrapAt, const QString &prefix)
+void appendTextWPrefix(TQString &result, const TQString &text, int wrapAt, const TQString &prefix)
{
- QString txt=text;
+ TQString txt=text;
int breakPos;
while(!txt.isEmpty()) {
@@ -390,18 +390,18 @@ void appendTextWPrefix(QString &result, const QString &text, int wrapAt, const Q
txt.remove(0,breakPos+1);
} else {
result+=(prefix+txt+"\n");
- txt=QString::null;
+ txt=TQString::null;
}
}
}
-QString KNHelper::rewrapStringList(QStringList text, int wrapAt, QChar quoteChar, bool stopAtSig, bool alwaysSpace)
+TQString KNHelper::rewrapStringList(TQStringList text, int wrapAt, TQChar quoteChar, bool stopAtSig, bool alwaysSpace)
{
- QString quoted, lastPrefix, thisPrefix, leftover, thisLine;
+ TQString quoted, lastPrefix, thisPrefix, leftover, thisLine;
int breakPos;
- for(QStringList::Iterator line=text.begin(); line!=text.end(); ++line) {
+ for(TQStringList::Iterator line=text.begin(); line!=text.end(); ++line) {
if(stopAtSig && (*line)=="-- ")
break;
@@ -412,8 +412,8 @@ QString KNHelper::rewrapStringList(QStringList text, int wrapAt, QChar quoteChar
else
thisLine.prepend(quoteChar+' ');
- thisPrefix=QString::null;
- QChar c;
+ thisPrefix=TQString::null;
+ TQChar c;
for(int idx=0; idx<(int)(thisLine.length()); idx++) {
c=thisLine.at(idx);
if( (c==' ') ||
@@ -431,7 +431,7 @@ QString KNHelper::rewrapStringList(QStringList text, int wrapAt, QChar quoteChar
appendTextWPrefix(quoted, leftover, wrapAt, lastPrefix);
else
thisLine.prepend(leftover+" ");
- leftover=QString::null;
+ leftover=TQString::null;
}
if((int)(thisPrefix.length()+thisLine.length()) > wrapAt) {
@@ -454,25 +454,25 @@ QString KNHelper::rewrapStringList(QStringList text, int wrapAt, QChar quoteChar
// **** misc. message-boxes **********************************************************
-void KNHelper::displayInternalFileError(QWidget *w)
+void KNHelper::displayInternalFileError(TQWidget *w)
{
KMessageBox::error((w!=0)? w : knGlobals.topWidget, i18n("Unable to load/save configuration.\nWrong permissions on home folder?\nYou should close KNode now to avoid data loss."));
}
-void KNHelper::displayExternalFileError(QWidget *w)
+void KNHelper::displayExternalFileError(TQWidget *w)
{
KMessageBox::error((w!=0)? w : knGlobals.topWidget, i18n("Unable to load/save file."));
}
-void KNHelper::displayRemoteFileError(QWidget *w)
+void KNHelper::displayRemoteFileError(TQWidget *w)
{
KMessageBox::error((w!=0)? w : knGlobals.topWidget, i18n("Unable to save remote file."));
}
-void KNHelper::displayTempFileError(QWidget *w)
+void KNHelper::displayTempFileError(TQWidget *w)
{
KMessageBox::error((w!=0)? w : knGlobals.topWidget, i18n("Unable to create temporary file."));
}