summaryrefslogtreecommitdiffstats
path: root/src/modules/eventeditor/eventeditor.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-28 18:31:12 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-28 18:31:12 +0000
commit0a80cfd57d271dd44221467efb426675fa470356 (patch)
tree6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/modules/eventeditor/eventeditor.cpp
parent3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff)
downloadkvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz
kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip
TQt4 port kvirc
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/eventeditor/eventeditor.cpp')
-rw-r--r--src/modules/eventeditor/eventeditor.cpp160
1 files changed, 80 insertions, 80 deletions
diff --git a/src/modules/eventeditor/eventeditor.cpp b/src/modules/eventeditor/eventeditor.cpp
index bedeca5f..b425319e 100644
--- a/src/modules/eventeditor/eventeditor.cpp
+++ b/src/modules/eventeditor/eventeditor.cpp
@@ -39,38 +39,38 @@
#include "kvi_kvs_eventmanager.h"
-#include <qmessagebox.h>
+#include <tqmessagebox.h>
-#include <qsplitter.h>
-#include <qlayout.h>
+#include <tqsplitter.h>
+#include <tqlayout.h>
#include "kvi_tal_vbox.h"
#include "kvi_tal_popupmenu.h"
-#include <qtooltip.h>
-#include <qpushbutton.h>
-#include <qevent.h>
+#include <tqtooltip.h>
+#include <tqpushbutton.h>
+#include <tqevent.h>
extern KviEventEditorWindow * g_pEventEditorWindow;
-const QPixmap * KviEventListViewItem::pixmap(int col) const
+const TQPixmap * KviEventListViewItem::pixmap(int col) const
{
return g_pIconManager->getSmallIcon(firstChild() ? KVI_SMALLICON_EVENT : KVI_SMALLICON_EVENTNOHANDLERS);
}
-const QPixmap * KviEventHandlerListViewItem::pixmap(int col) const
+const TQPixmap * KviEventHandlerListViewItem::pixmap(int col) const
{
return g_pIconManager->getSmallIcon(m_bEnabled ? KVI_SMALLICON_HANDLER : KVI_SMALLICON_HANDLERDISABLED);
}
-KviEventEditor::KviEventEditor(QWidget * par)
-: QWidget(par,"event_editor")
+KviEventEditor::KviEventEditor(TQWidget * par)
+: TQWidget(par,"event_editor")
{
- QGridLayout * l = new QGridLayout(this,1,1,2,2);
+ TQGridLayout * l = new TQGridLayout(this,1,1,2,2);
- QSplitter * spl = new QSplitter(Qt::Horizontal,this);
+ TQSplitter * spl = new TQSplitter(Qt::Horizontal,this);
spl->setOpaqueResize(false);
l->addWidget(spl,0,0);
@@ -82,12 +82,12 @@ KviEventEditor::KviEventEditor(QWidget * par)
m_pListView->setShowSortIndicator(true);
m_pListView->setRootIsDecorated(true);
- QPushButton * pb = new QPushButton(__tr2qs("&Export All To..."),boxi);
- connect(pb,SIGNAL(clicked()),this,SLOT(exportAllEvents()));
+ TQPushButton * pb = new TQPushButton(__tr2qs("&Export All To..."),boxi);
+ connect(pb,TQT_SIGNAL(clicked()),this,TQT_SLOT(exportAllEvents()));
KviTalVBox * box = new KviTalVBox(spl);
- m_pNameEditor = new QLineEdit(box);
- QToolTip::add(m_pNameEditor,__tr2qs("Edit the event handler name."));
+ m_pNameEditor = new TQLineEdit(box);
+ TQToolTip::add(m_pNameEditor,__tr2qs("Edit the event handler name."));
m_pEditor = KviScriptEditor::createInstance(box);
m_pEditor->setFocus();
@@ -129,56 +129,56 @@ void KviEventEditor::oneTimeSetup()
m_pContextPopup = new KviTalPopupMenu(this);
- connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(selectionChanged(KviTalListViewItem *)));
- connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),
- this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int)));
+ connect(m_pListView,TQT_SIGNAL(selectionChanged(KviTalListViewItem *)),this,TQT_SLOT(selectionChanged(KviTalListViewItem *)));
+ connect(m_pListView,TQT_SIGNAL(rightButtonPressed(KviTalListViewItem *,const TQPoint &,int)),
+ this,TQT_SLOT(itemPressed(KviTalListViewItem *,const TQPoint &,int)));
}
-void KviEventEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col)
+void KviEventEditor::itemPressed(KviTalListViewItem *it,const TQPoint &pnt,int col)
{
__range_valid(m_bOneTimeSetupDone);
if(it)
{
m_pContextPopup->clear();
- if(it->parent())
+ if(it->tqparent())
{
- QString tmp;
+ TQString tmp;
if(!(((KviEventHandlerListViewItem *)it)->m_bEnabled))
m_pContextPopup->insertItem(
*(g_pIconManager->getSmallIcon(KVI_SMALLICON_HANDLER)),
- __tr2qs("&Enable Handler"),this,SLOT(toggleCurrentHandlerEnabled()));
+ __tr2qs("&Enable Handler"),this,TQT_SLOT(toggleCurrentHandlerEnabled()));
else
m_pContextPopup->insertItem(
*(g_pIconManager->getSmallIcon(KVI_SMALLICON_HANDLERDISABLED)),
- __tr2qs("&Disable Handler"),this,SLOT(toggleCurrentHandlerEnabled()));
+ __tr2qs("&Disable Handler"),this,TQT_SLOT(toggleCurrentHandlerEnabled()));
//m_pContextPopup->setItemChecked(id,((KviEventHandlerListViewItem *)it)->m_bEnabled);
m_pContextPopup->insertItem(
- *(g_pIconManager->getSmallIcon(KVI_SMALLICON_QUIT)),
+ *(g_pIconManager->getSmallIcon(KVI_SMALLICON_TQUIT)),
__tr2qs("Re&move Handler"),
- this,SLOT(removeCurrentHandler()));
+ this,TQT_SLOT(removeCurrentHandler()));
m_pContextPopup->insertItem(
*(g_pIconManager->getSmallIcon(KVI_SMALLICON_FOLDER)),
__tr2qs("&Export Handler To..."),
- this,SLOT(exportCurrentHandler()));
+ this,TQT_SLOT(exportCurrentHandler()));
} else {
m_pContextPopup->insertItem(
*(g_pIconManager->getSmallIcon(KVI_SMALLICON_HANDLER)),
__tr2qs("&New Handler"),
- this,SLOT(addHandlerForCurrentEvent()));
+ this,TQT_SLOT(addHandlerForCurrentEvent()));
}
m_pContextPopup->popup(pnt);
}
}
-void KviEventEditor::getUniqueHandlerName(KviEventListViewItem *it,QString &buffer)
+void KviEventEditor::getUniqueHandlerName(KviEventListViewItem *it,TQString &buffer)
{
__range_valid(m_bOneTimeSetupDone);
- QString newName = buffer;
+ TQString newName = buffer;
if(newName.isEmpty())newName = __tr2qs("unnamed");
bool bFound = true;
@@ -190,10 +190,10 @@ void KviEventEditor::getUniqueHandlerName(KviEventListViewItem *it,QString &buff
for(KviEventHandlerListViewItem * ch = (KviEventHandlerListViewItem *)(it->firstChild());ch;ch = (KviEventHandlerListViewItem *)ch->nextSibling())
{
- if(KviQString::equalCI(newName,ch->m_szName))
+ if(KviTQString::equalCI(newName,ch->m_szName))
{
bFound = true;
- KviQString::sprintf(newName,"%Q_%d",&buffer,idx);
+ KviTQString::sprintf(newName,"%TQ_%d",&buffer,idx);
idx++;
break;
}
@@ -210,9 +210,9 @@ void KviEventEditor::addHandlerForCurrentEvent()
KviTalListViewItem * it = m_pListView->selectedItem();
if(it)
{
- if(it->parent() == 0)
+ if(it->tqparent() == 0)
{
- QString buffer = __tr2qs("default");
+ TQString buffer = __tr2qs("default");
getUniqueHandlerName((KviEventListViewItem *)it,buffer);
KviTalListViewItem * ch = new KviEventHandlerListViewItem(it,buffer,"",true);
it->setOpen(true);
@@ -240,7 +240,7 @@ void KviEventEditor::toggleCurrentHandlerEnabled()
if(m_pLastEditedItem)
{
m_pLastEditedItem->m_bEnabled = !(m_pLastEditedItem->m_bEnabled);
- m_pListView->repaintItem(m_pLastEditedItem);
+ m_pListView->tqrepaintItem(m_pLastEditedItem);
selectionChanged(m_pLastEditedItem);
}
}
@@ -255,11 +255,11 @@ void KviEventEditor::commit()
{
if(it->firstChild())
{
- QString szContext;
+ TQString szContext;
for(KviTalListViewItem * ch = it->firstChild();ch;ch = ch->nextSibling())
{
- KviQString::sprintf(szContext,"%Q::%Q",&(((KviEventListViewItem *)it)->m_szName),&(((KviEventHandlerListViewItem *)ch)->m_szName));
+ KviTQString::sprintf(szContext,"%Q::%Q",&(((KviEventListViewItem *)it)->m_szName),&(((KviEventHandlerListViewItem *)ch)->m_szName));
KviKvsScriptEventHandler * s = KviKvsScriptEventHandler::createInstance( // msvc workaround
((KviEventHandlerListViewItem *)ch)->m_szName,
@@ -281,14 +281,14 @@ void KviEventEditor::saveLastEditedItem()
__range_valid(m_bOneTimeSetupDone);
if(!m_pLastEditedItem)return;
- QString buffer = m_pNameEditor->text();
- if(!KviQString::equalCI(buffer,m_pLastEditedItem->m_szName))
+ TQString buffer = m_pNameEditor->text();
+ if(!KviTQString::equalCI(buffer,m_pLastEditedItem->m_szName))
{
- getUniqueHandlerName((KviEventListViewItem *)(m_pLastEditedItem->parent()),buffer);
+ getUniqueHandlerName((KviEventListViewItem *)(m_pLastEditedItem->tqparent()),buffer);
}
m_pLastEditedItem->m_szName = buffer;
- QString tmp;
+ TQString tmp;
m_pEditor->getText(tmp);
m_pLastEditedItem->m_szBuffer = tmp;
@@ -298,7 +298,7 @@ void KviEventEditor::selectionChanged(KviTalListViewItem * it)
{
__range_valid(m_bOneTimeSetupDone);
saveLastEditedItem();
- if(it->parent())
+ if(it->tqparent())
{
m_pLastEditedItem = (KviEventHandlerListViewItem *)it;
m_pNameEditor->setEnabled(true);
@@ -310,34 +310,34 @@ void KviEventEditor::selectionChanged(KviTalListViewItem * it)
m_pNameEditor->setEnabled(false);
m_pNameEditor->setText("");
m_pEditor->setEnabled(false);
- QString parms = ((KviEventListViewItem *)it)->m_szParams;
+ TQString parms = ((KviEventListViewItem *)it)->m_szParams;
if(parms.isEmpty())parms = __tr2qs("none");
KviCommandFormatter::indent(parms);
KviCommandFormatter::indent(parms);
- QString tmp;
- KviQString::sprintf(tmp,__tr2qs("\n\n Event:\n %s\n\n Parameters:\n%s"),
+ TQString tmp;
+ KviTQString::sprintf(tmp,__tr2qs("\n\n Event:\n %s\n\n Parameters:\n%s"),
((KviEventListViewItem *)it)->m_szName.utf8().data(),parms.utf8().data());
m_pEditor->setText(tmp);
}
}
-void KviEventEditor::showEvent(QShowEvent *e)
+void KviEventEditor::showEvent(TQShowEvent *e)
{
oneTimeSetup();
- QWidget::showEvent(e);
+ TQWidget::showEvent(e);
}
-void KviEventEditor::getExportEventBuffer(QString &buffer,KviEventHandlerListViewItem * it)
+void KviEventEditor::getExportEventBuffer(TQString &buffer,KviEventHandlerListViewItem * it)
{
- if(!it->parent())return;
+ if(!it->tqparent())return;
- QString szBuf = it->m_szBuffer;
+ TQString szBuf = it->m_szBuffer;
KviCommandFormatter::blockFromBuffer(szBuf);
buffer = "event(";
- buffer += ((KviEventListViewItem *)(it->parent()))->m_szName;
+ buffer += ((KviEventListViewItem *)(it->tqparent()))->m_szName;
buffer += ",";
buffer += it->m_szName;
buffer += ")\n";
@@ -348,7 +348,7 @@ void KviEventEditor::getExportEventBuffer(QString &buffer,KviEventHandlerListVie
{
buffer += "\n";
buffer += "eventctl -d ";
- buffer += ((KviEventListViewItem *)(it->parent()))->m_szName;
+ buffer += ((KviEventListViewItem *)(it->tqparent()))->m_szName;
buffer += " ";
buffer += it->m_szName;
}
@@ -360,23 +360,23 @@ void KviEventEditor::exportCurrentHandler()
saveLastEditedItem();
if(!m_pLastEditedItem)return;
- QString szName = QDir::homeDirPath();
- if(!szName.endsWith(QString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR;
- szName += ((KviEventListViewItem *)(m_pLastEditedItem->parent()))->m_szName;
+ TQString szName = TQDir::homeDirPath();
+ if(!szName.endsWith(TQString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR;
+ szName += ((KviEventListViewItem *)(m_pLastEditedItem->tqparent()))->m_szName;
szName += ".";
szName += m_pLastEditedItem->m_szName;
szName += ".kvs";
- QString szFile;
+ TQString szFile;
if(!KviFileDialog::askForSaveFileName(szFile,__tr2qs("Choose a Filename - KVIrc"),szName,"*.kvs",true,true,true))return;
- QString szOut;
+ TQString szOut;
getExportEventBuffer(szOut,m_pLastEditedItem);
if(!KviFileUtils::writeFile(szFile,szOut))
{
- QMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the event file."),__tr2qs("&OK"));
+ TQMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the event file."),__tr2qs("&OK"));
}
}
@@ -386,14 +386,14 @@ void KviEventEditor::exportAllEvents()
KviEventListViewItem * it = (KviEventListViewItem *)m_pListView->firstChild();
- QString out;
+ TQString out;
while(it)
{
KviEventHandlerListViewItem * item = (KviEventHandlerListViewItem *)it->firstChild();
while(item)
{
- QString tmp;
+ TQString tmp;
getExportEventBuffer(tmp,item);
out += tmp;
out += "\n";
@@ -402,17 +402,17 @@ void KviEventEditor::exportAllEvents()
it = (KviEventListViewItem *)it->nextSibling();
}
- QString szName = QDir::homeDirPath();
- if(!szName.endsWith(QString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR;
+ TQString szName = TQDir::homeDirPath();
+ if(!szName.endsWith(TQString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR;
szName += "events.kvs";
- QString szFile;
+ TQString szFile;
- if(!KviFileDialog::askForSaveFileName(szFile,__tr2qs("Choose a Filename - KVIrc"),szName,QString::null,true,true))return;
+ if(!KviFileDialog::askForSaveFileName(szFile,__tr2qs("Choose a Filename - KVIrc"),szName,TQString(),true,true))return;
if(!KviFileUtils::writeFile(szFile,out))
{
- QMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the events file."),__tr2qs("Ok"));
+ TQMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the events file."),__tr2qs("Ok"));
}
}
@@ -426,21 +426,21 @@ KviEventEditorWindow::KviEventEditorWindow(KviFrame * lpFrm)
m_pEditor = new KviEventEditor(this);
- m_pBase = new QWidget(this);
- QGridLayout * g = new QGridLayout(m_pBase,1,4,4,4);
+ m_pBase = new TQWidget(this);
+ TQGridLayout * g = new TQGridLayout(m_pBase,1,4,4,4);
- QPushButton * btn = new QPushButton(__tr2qs("&OK"),m_pBase);
- connect(btn,SIGNAL(clicked()),this,SLOT(okClicked()));
+ TQPushButton * btn = new TQPushButton(__tr2qs("&OK"),m_pBase);
+ connect(btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(okClicked()));
btn->setIconSet(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT)));
g->addWidget(btn,0,1);
- btn = new QPushButton(__tr2qs("&Apply"),m_pBase);
- connect(btn,SIGNAL(clicked()),this,SLOT(applyClicked()));
+ btn = new TQPushButton(__tr2qs("&Apply"),m_pBase);
+ connect(btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(applyClicked()));
btn->setIconSet(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT)));
g->addWidget(btn,0,2);
- btn = new QPushButton(__tr2qs("Cancel"),m_pBase);
- connect(btn,SIGNAL(clicked()),this,SLOT(cancelClicked()));
+ btn = new TQPushButton(__tr2qs("Cancel"),m_pBase);
+ connect(btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(cancelClicked()));
btn->setIconSet(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_DISCARD)));
g->addWidget(btn,0,3);
@@ -469,14 +469,14 @@ void KviEventEditorWindow::cancelClicked()
}
-QPixmap * KviEventEditorWindow::myIconPtr()
+TQPixmap * KviEventEditorWindow::myIconPtr()
{
return g_pIconManager->getSmallIcon(KVI_SMALLICON_EVENT);
}
-void KviEventEditorWindow::resizeEvent(QResizeEvent *e)
+void KviEventEditorWindow::resizeEvent(TQResizeEvent *e)
{
- int hght = m_pBase->sizeHint().height();
+ int hght = m_pBase->tqsizeHint().height();
m_pEditor->setGeometry(0,0,width(),height()- hght);
m_pBase->setGeometry(0,height() - hght,width(),hght);
}
@@ -485,9 +485,9 @@ void KviEventEditorWindow::fillCaptionBuffers()
{
m_szPlainTextCaption = __tr2qs("Event Editor");
- static QString p1("<nobr><font color=\"");
- static QString p2("\"><b>");
- static QString p3("</b></font></nobr>");
+ static TQString p1("<nobr><font color=\"");
+ static TQString p2("\"><b>");
+ static TQString p3("</b></font></nobr>");
m_szHtmlActiveCaption = p1;
m_szHtmlActiveCaption += KVI_OPTION_COLOR(KviOption_colorCaptionTextActive).name();
@@ -524,7 +524,7 @@ void KviEventEditorWindow::loadProperties(KviConfig *cfg)
{
/*
#ifdef COMPILE_SCRIPTTOOLBAR
- QValueList<int> def;
+ TQValueList<int> def;
def.append(20);
def.append(80);
m_pEditor->setSizes(cfg->readIntListEntry("Sizes",def));