From f008adb5a77e094eaf6abf3fc0f36958e66896a5 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 25 Jun 2011 05:28:35 +0000 Subject: TQt4 port koffice This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kplato/kptreportview.cc | 276 ++++++++++++++++++++++++------------------------ 1 file changed, 138 insertions(+), 138 deletions(-) (limited to 'kplato/kptreportview.cc') diff --git a/kplato/kptreportview.cc b/kplato/kptreportview.cc index d5e964c7..abcf1904 100644 --- a/kplato/kptreportview.cc +++ b/kplato/kptreportview.cc @@ -41,13 +41,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include namespace KPlato { @@ -70,70 +70,70 @@ public: ~ReportTagsPrivate() {} - QString getData(QString source, QString tag) const { - if (tag.contains(".")) + TQString getData(TQString source, TQString tag) const { + if (tag.tqcontains(".")) return getData(tag); return getData(source + "." + tag); } - QString getData(QString tag) const { + TQString getData(TQString tag) const { //kdDebug()<formatDate(QDate::currentDate(), true); + return l->formatDate(TQDate::tqcurrentDate(), true); } - return QString::null; + return TQString(); } if (tag.section(".", 0, 0) == "project") { if (tag.section(".", 1, 1) == "name") - return (m_project ? m_project->name() : QString::null); + return (m_project ? m_project->name() : TQString()); if (tag.section(".", 1, 1) == "leader") - return (m_project ? m_project->leader() : QString::null); + return (m_project ? m_project->leader() : TQString()); } else if (tag.section(".", 0, 0) == "task") { if (tag.section(".", 1, 1) == "name") - return (m_task ? m_task->name() : QString::null); + return (m_task ? m_task->name() : TQString()); if (tag.section(".", 1, 1) == "responsible") - return (m_task ? m_task->leader() : QString::null); + return (m_task ? m_task->leader() : TQString()); else if (tag.section(".", 1, 1) == "wbs") - return (m_task ? m_task->wbs() : QString::null); + return (m_task ? m_task->wbs() : TQString()); else if (tag.section(".", 1, 1) == "start") - return (m_task ? l->formatDateTime(m_task->startTime()) : QString::null); + return (m_task ? l->formatDateTime(m_task->startTime()) : TQString()); else if (tag.section(".", 1, 1) == "starttime") - return (m_task ? l->formatTime(m_task->startTime().time()) : QString::null); + return (m_task ? l->formatTime(m_task->startTime().time()) : TQString()); else if (tag.section(".", 1, 1) == "startdate") - return (m_task ? l->formatDate(m_task->startTime().date(), true) : QString::null); + return (m_task ? l->formatDate(m_task->startTime().date(), true) : TQString()); else if (tag.section(".", 1, 1) == "duration") { - return (m_task ? m_task->duration().toString(Duration::Format_i18nDayTime) : QString::null); + return (m_task ? m_task->duration().toString(Duration::Format_i18nDayTime) : TQString()); } else if (tag.section(".", 1, 1) == "plannedcost") { - return (m_task ? l->formatMoney(m_task->plannedCost()) : QString::null); + return (m_task ? l->formatMoney(m_task->plannedCost()) : TQString()); } } else if (tag.section(".", 0, 0) == "resourcegroup") { if (tag.section(".", 1, 1) == "name") - return (m_resourcegroup ? m_resourcegroup->name() : QString::null); + return (m_resourcegroup ? m_resourcegroup->name() : TQString()); } else if (tag.section(".", 0, 0) == "resource") { if (tag.section(".", 1, 1) == "name") - return (m_resource ? m_resource->name() : QString::null); + return (m_resource ? m_resource->name() : TQString()); if (tag.section(".", 1, 1) == "type") - return (m_resource ? m_resource->typeToString() : QString::null); + return (m_resource ? m_resource->typeToString() : TQString()); if (tag.section(".", 1, 1) == "email") - return (m_resource ? m_resource->email() : QString::null); + return (m_resource ? m_resource->email() : TQString()); if (tag.section(".", 1, 1) == "availablefrom") - return (m_resource ? l->formatDate(m_resource->availableFrom().date(), true) : QString::null); + return (m_resource ? l->formatDate(m_resource->availableFrom().date(), true) : TQString()); if (tag.section(".", 1, 1) == "availableuntil") - return (m_resource ? l->formatDate(m_resource->availableUntil().date(), true) : QString::null); + return (m_resource ? l->formatDate(m_resource->availableUntil().date(), true) : TQString()); if (tag.section(".", 1, 1) == "units") - return (m_resource ? QString("%1%").arg(m_resource->units()) : QString::null); + return (m_resource ? TQString("%1%").tqarg(m_resource->units()) : TQString()); if (tag.section(".", 1, 1) == "normalrate") - return (m_resource ? l->formatMoney(m_resource->normalRate()) : QString::null); + return (m_resource ? l->formatMoney(m_resource->normalRate()) : TQString()); if (tag.section(".", 1, 1) == "overtimerate") - return (m_resource ? l->formatMoney(m_resource->overtimeRate()) : QString::null); + return (m_resource ? l->formatMoney(m_resource->overtimeRate()) : TQString()); } - return QString::null; + return TQString(); } Project *m_project; @@ -141,25 +141,25 @@ public: ResourceGroup *m_resourcegroup; Resource *m_resource; - QString alltasksLevel; - QStringList alltasksProps; - QString summarytasksLevel; - QStringList summarytasksProps; - QString tasksLevel; - QStringList tasksProps; - QString milestonesLevel; - QStringList milestonesProps; - QString resourcegroupsLevel; - QStringList resourcegroupsProps; - QString resourcesLevel; - QStringList resourcesProps; + TQString alltasksLevel; + TQStringList alltasksProps; + TQString summarytasksLevel; + TQStringList summarytasksProps; + TQString tasksLevel; + TQStringList tasksProps; + TQString milestonesLevel; + TQStringList milestonesProps; + TQString resourcegroupsLevel; + TQStringList resourcegroupsProps; + TQString resourcesLevel; + TQStringList resourcesProps; }; class KugarReportViewer : public Kugar::MReportViewer { public: - KugarReportViewer(QWidget *parent = 0, const char *name = 0) - : MReportViewer(parent, name) + KugarReportViewer(TQWidget *tqparent = 0, const char *name = 0) + : MReportViewer(tqparent, name) {} int currentPage() { @@ -170,8 +170,8 @@ public: } }; -ReportView::ReportView(View *view, QWidget *parent) - : QSplitter(parent), +ReportView::ReportView(View *view, TQWidget *tqparent) + : TQSplitter(tqparent), m_mainview(view), m_reportTags(0) { @@ -188,17 +188,17 @@ ReportView::ReportView(View *view, QWidget *parent) initReportList(); - connect(m_reportList, SIGNAL(clicked(QListViewItem*)), SLOT(slotReportListClicked(QListViewItem*))); - connect(m_reportList, SIGNAL(selectionChanged(QListViewItem*)), SLOT(slotReportListSelectionChanged(QListViewItem*))); + connect(m_reportList, TQT_SIGNAL(clicked(TQListViewItem*)), TQT_SLOT(slotReportListClicked(TQListViewItem*))); + connect(m_reportList, TQT_SIGNAL(selectionChanged(TQListViewItem*)), TQT_SLOT(slotReportListSelectionChanged(TQListViewItem*))); //setCentralWidget(m_reportview); // Create the user interface. - //KStdAction::print(this,SLOT(slotPrint()),actionCollection()); - //KStdAction::quit(this,SLOT(slotFileQuit()),actionCollection()); + //KStdAction::print(this,TQT_SLOT(slotPrint()),actionCollection()); + //KStdAction::quit(this,TQT_SLOT(slotFileQuit()),actionCollection()); -// KStdAction::showToolbar(this,SLOT(slotViewToolBar()),actionCollection()); -// KStdAction::showStatusbar(this,SLOT(slotViewStatusBar()),actionCollection()); +// KStdAction::showToolbar(this,TQT_SLOT(slotViewToolBar()),actionCollection()); +// KStdAction::showStatusbar(this,TQT_SLOT(slotViewStatusBar()),actionCollection()); // statusBar(); @@ -215,19 +215,19 @@ ReportView::~ReportView() { void ReportView::initReportList() { //FIXME: We need a solution that takes care project specific reports. //kdDebug()<clear(); KStandardDirs std; - QStringList reportDesktopFiles = std.findAllResources("data", "kplato/reports/*.desktop", true, true); - for (QStringList::iterator it = reportDesktopFiles.begin(); it != reportDesktopFiles.end(); ++it) { + TQStringList reportDesktopFiles = std.findAllResources("data", "kplato/reports/*.desktop", true, true); + for (TQStringList::iterator it = reportDesktopFiles.begin(); it != reportDesktopFiles.end(); ++it) { KDesktopFile file((*it), true); - QString name = file.readName(); + TQString name = file.readName(); if (!name.isNull()) { //kdDebug()<<" file: "<<*it<<" name="<insertItem(new ReportItem(m_reportList, name, url)); @@ -236,7 +236,7 @@ void ReportView::initReportList() { } } -void ReportView::draw(const QString &report) { +void ReportView::draw(const TQString &report) { //kdDebug()<clearReport(); m_reportTags = new ReportTagsPrivate(); @@ -262,7 +262,7 @@ void ReportView::print(KPrinter &printer) { // Generate report data based on info from the template file void ReportView::setReportData() { - QString s = "\n"; + TQString s = "\n"; s+="\n"; s += setReportDetail(); s+="\n"; @@ -270,9 +270,9 @@ void ReportView::setReportData() { m_reportview->setReportData(s); } -QString ReportView::setReportDetail() { +TQString ReportView::setReportDetail() { //kdDebug()<alltasksLevel != "-1") { //kdDebug()<summarytasksLevel == "0") { // make a report that has summarytasks as starting points - QPtrListIterator it(mainView()->getProject().childNodeIterator()); + TQPtrListIterator it(mainView()->getProject().childNodeIterator()); for (; it.current(); ++it) { if (it.current()->type() == Node::Type_Summarytask) { s += setTaskDetail(it.current()); @@ -302,7 +302,7 @@ QString ReportView::setReportDetail() { } else if (m_reportTags->tasksLevel == "0") { // make a report that has tasks as starting points - QPtrListIterator it(mainView()->getProject().childNodeIterator()); + TQPtrListIterator it(mainView()->getProject().childNodeIterator()); for (; it.current(); ++it) { if (it.current()->type() == Node::Type_Task) { s += setTaskDetail(it.current()); @@ -319,16 +319,16 @@ QString ReportView::setReportDetail() { } else if (m_reportTags->resourcegroupsLevel == "0") { // make a report that has resourcegroups as starting points - QPtrListIterator it(mainView()->getProject().resourceGroups()); + TQPtrListIterator it(mainView()->getProject().resourceGroups()); for (; it.current(); ++it) { s += setResourceGroupDetail(it.current()); } } else if (m_reportTags->resourcesLevel == "0") { // make a report that has resources as starting points - QPtrListIterator it(mainView()->getProject().resourceGroups()); + TQPtrListIterator it(mainView()->getProject().resourceGroups()); for (; it.current(); ++it) { - QPtrListIterator rit(it.current()->resources()); + TQPtrListIterator rit(it.current()->resources()); for (; rit.current(); ++rit) { s += setResourceDetail(rit.current()); } @@ -338,14 +338,14 @@ QString ReportView::setReportDetail() { return s; } -QString ReportView::setResourceGroupDetail(ResourceGroup *group) { +TQString ReportView::setResourceGroupDetail(ResourceGroup *group) { //kdDebug()<name()<resourcegroupsLevel != "-1") { m_reportTags->m_resourcegroup = group; //kdDebug()<name()<<": level="<resourcegroupsLevel<resourcegroupsProps, m_reportTags->resourcegroupsLevel); - QPtrListIterator rit(group->resources()); + TQPtrListIterator rit(group->resources()); for (; rit.current(); ++rit) { s += setResourceDetail(rit.current()); } @@ -353,9 +353,9 @@ QString ReportView::setResourceGroupDetail(ResourceGroup *group) { return s; } -QString ReportView::setResourceDetail(Resource *res) { +TQString ReportView::setResourceDetail(Resource *res) { //kdDebug()<name()<resourcesLevel != "-1") { m_reportTags->m_resource = res; //kdDebug()<name()<<": level="<resourcesLevel< it(node->childNodeIterator()); + TQString s; + TQPtrListIterator it(node->childNodeIterator()); for (; it.current(); ++it) { s += setTaskDetail(it.current()); if (it.current()->type() == Node::Type_Summarytask) @@ -376,11 +376,11 @@ QString ReportView::setTaskChildren(Node *node) { return s; } -QString ReportView::setTaskDetail(Node *node) { +TQString ReportView::setTaskDetail(Node *node) { //kdDebug()<type() == Node::Type_Task) { props = m_reportTags->tasksProps; level = m_reportTags->tasksLevel; @@ -398,18 +398,18 @@ QString ReportView::setTaskDetail(Node *node) { return s; } -QString ReportView::setDetail(const QString & source, QStringList &properties, QString &level) { - QString s = "getData(source, properties[i].section('=', 1, 1)); if (data.isNull()) data = ""; - data = data.replace('<', "<"); - data = data.replace('>', ">"); - data = data.replace('"', """); + data = data.tqreplace('<', "<"); + data = data.tqreplace('>', ">"); + data = data.tqreplace('"', """); s += "\"" + data + "\""; // Property //kdDebug()<close(); } -void ReportView::loadTemplate(QIODevice &dev) { - QString errorMsg; +void ReportView::loadTemplate(TQIODevice &dev) { + TQString errorMsg; int errorLine; int errorColumn; if (!templateDoc.setContent( &dev , &errorMsg, &errorLine, &errorColumn)) { - QString msg = "Parsing template file failed with "; + TQString msg = "Parsing template file failed with "; KMessageBox::sorry( this, msg + errorMsg, i18n("Generate Report")); return; } loadTemplate(templateDoc); } -void ReportView::loadTemplate(QDomDocument &doc) { - QDomNode tpl; - QDomNode child; +void ReportView::loadTemplate(TQDomDocument &doc) { + TQDomNode tpl; + TQDomNode child; for (tpl = doc.firstChild(); !tpl.isNull(); tpl = tpl.nextSibling()) if (tpl.nodeName() == "KugarTemplate") break; @@ -494,13 +494,13 @@ void ReportView::loadTemplate(QDomDocument &doc) { m_reportTags->m_project = &(mainView()->getPart()->getProject()); // Get all the child report elements - QDomNodeList children = tpl.childNodes(); - int childCount = children.length(); + TQDomNodeList tqchildren = tpl.childNodes(); + int childCount = tqchildren.length(); for(int j = 0; j < childCount; j++){ - child = children.item(j); - if(child.nodeType() == QDomNode::ElementNode) { - QDomElement e = child.toElement(); + child = tqchildren.item(j); + if(child.nodeType() == TQDomNode::ElementNode) { + TQDomElement e = child.toElement(); //kdDebug()<getData(tag.mid(1, tag.length()-2)); - r = r.replace(tag, data); + if ( ((i = s.tqfind('[', i)) != -1) && ((j = s.tqfind(']', i+1)) != -1) ) { + TQString tag = s.mid(i, j-i+1); + TQString data = m_reportTags->getData(tag.mid(1, tag.length()-2)); + r = r.tqreplace(tag, data); } } while (i != -1 && j != -1); n.setNodeValue(r); //kdDebug()<<" new Text="<getData(s); + TQString s = e.attribute("Field"); + TQString data = m_reportTags->getData(s); e.setAttribute("Text", data); //kdDebug()<<" new Text="<selectedItem()) slotReportListSelectionChanged(item); } -void ReportView::slotReportListSelectionChanged(QListViewItem* item) { +void ReportView::slotReportListSelectionChanged(TQListViewItem* item) { ReportItem *ri = dynamic_cast(item); if (ri == 0) return; -- cgit v1.2.1