summaryrefslogtreecommitdiffstats
path: root/kplato/kptaccountsview.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kplato/kptaccountsview.cc
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
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
Diffstat (limited to 'kplato/kptaccountsview.cc')
-rw-r--r--kplato/kptaccountsview.cc186
1 files changed, 93 insertions, 93 deletions
diff --git a/kplato/kptaccountsview.cc b/kplato/kptaccountsview.cc
index 3fc5d8dd..d9e0c33d 100644
--- a/kplato/kptaccountsview.cc
+++ b/kplato/kptaccountsview.cc
@@ -26,21 +26,21 @@
#include "kptview.h"
#include "kpteffortcostmap.h"
-#include <qapplication.h>
-#include <qcombobox.h>
-#include <qdatetime.h>
-#include <qdatetimeedit.h>
-#include <qheader.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qpainter.h>
-#include <qpalette.h>
-#include <qpushbutton.h>
-#include <qvaluelist.h>
-#include <qpopupmenu.h>
-#include <qsizepolicy.h>
-#include <qhbox.h>
-#include <qpaintdevicemetrics.h>
+#include <tqapplication.h>
+#include <tqcombobox.h>
+#include <tqdatetime.h>
+#include <tqdatetimeedit.h>
+#include <tqheader.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqpainter.h>
+#include <tqpalette.h>
+#include <tqpushbutton.h>
+#include <tqvaluelist.h>
+#include <tqpopupmenu.h>
+#include <tqsizepolicy.h>
+#include <tqhbox.h>
+#include <tqpaintdevicemetrics.h>
#include <kcalendarsystem.h>
#include <kglobal.h>
@@ -53,26 +53,26 @@
namespace KPlato
{
-class Label : public QLabel
+class Label : public TQLabel
{
public:
- Label(QWidget *w)
- : QLabel(w)
+ Label(TQWidget *w)
+ : TQLabel(w)
{}
- void paintContents(QPainter *p) {
+ void paintContents(TQPainter *p) {
drawContents(p);
}
};
-AccountsView::AccountItem::AccountItem(Account *a, QListView *parent, bool highlight)
- : DoubleListViewBase::MasterListItem(parent, a->name(), highlight),
+AccountsView::AccountItem::AccountItem(Account *a, TQListView *tqparent, bool highlight)
+ : DoubleListViewBase::MasterListItem(tqparent, a->name(), highlight),
account(a) {
- if (parent->columns() >= 3) {
+ if (tqparent->columns() >= 3) {
setText(2, a->description());
}
//kdDebug()<<k_funcinfo<<endl;
}
-AccountsView::AccountItem::AccountItem(Account *a, QListViewItem *p, bool highlight)
+AccountsView::AccountItem::AccountItem(Account *a, TQListViewItem *p, bool highlight)
: DoubleListViewBase::MasterListItem(p, a->name(), highlight),
account(a) {
if (listView() && listView()->columns() >= 3) {
@@ -81,39 +81,39 @@ AccountsView::AccountItem::AccountItem(Account *a, QListViewItem *p, bool highli
//kdDebug()<<k_funcinfo<<endl;
}
-AccountsView::AccountItem::AccountItem(QString text, Account *a, QListViewItem *parent, bool highlight)
- : DoubleListViewBase::MasterListItem(parent, text, highlight),
+AccountsView::AccountItem::AccountItem(TQString text, Account *a, TQListViewItem *tqparent, bool highlight)
+ : DoubleListViewBase::MasterListItem(tqparent, text, highlight),
account(a) {
//kdDebug()<<k_funcinfo<<endl;
}
-void AccountsView::AccountItem::add(int col, const QDate &date, const EffortCost &ec) {
+void AccountsView::AccountItem::add(int col, const TQDate &date, const EffortCost &ec) {
EffortCost &cm = costMap.add(date, ec);
if (m_slaveItem)
m_slaveItem->setText(col, KGlobal::locale()->formatMoney(cm.cost(), "", 0));
}
-AccountsView::AccountsView(Project &project, View *view, QWidget *parent)
- : QWidget(parent, "Accounts view"),
+AccountsView::AccountsView(Project &project, View *view, TQWidget *tqparent)
+ : TQWidget(tqparent, "Accounts view"),
m_mainview(view),
m_project(project),
m_accounts(project.accounts()) {
- m_date = QDate::currentDate();
+ m_date = TQDate::tqcurrentDate();
m_period = 0;
m_periodTexts<<i18n("Day")<<i18n("Week")<<i18n("Month");
m_cumulative = false;
- QVBoxLayout *lay1 = new QVBoxLayout(this, 0, KDialog::spacingHint());
+ TQVBoxLayout *lay1 = new TQVBoxLayout(this, 0, KDialog::spacingHint());
- QHBoxLayout *lay2 = new QHBoxLayout(0, 0, KDialog::spacingHint());
+ TQHBoxLayout *lay2 = new TQHBoxLayout(0, 0, KDialog::spacingHint());
m_label = new Label(this);
- m_label->setFrameShape(QLabel::StyledPanel);
- m_label->setFrameShadow(QLabel::Sunken);
- m_label->setAlignment(int(QLabel::WordBreak | QLabel::AlignVCenter));
+ m_label->setFrameShape(TQLabel::StyledPanel);
+ m_label->setFrameShadow(TQLabel::Sunken);
+ m_label->tqsetAlignment(int(TQLabel::WordBreak | TQLabel::AlignVCenter));
lay2->addWidget(m_label);
- m_changeBtn = new QPushButton(i18n("Configure..."), this);
- m_changeBtn->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, m_changeBtn->sizePolicy().hasHeightForWidth()));
+ m_changeBtn = new TQPushButton(i18n("Configure..."), this);
+ m_changeBtn->tqsetSizePolicy(TQSizePolicy((TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)0, 0, 0, m_changeBtn->sizePolicy().hasHeightForWidth()));
lay2->addWidget(m_changeBtn);
lay1->addLayout(lay2);
@@ -124,12 +124,12 @@ AccountsView::AccountsView(Project &project, View *view, QWidget *parent)
lay1->addWidget(m_dlv);
- connect(this, SIGNAL(update()), SLOT(slotUpdate()));
- connect(m_changeBtn, SIGNAL(clicked()), SLOT(slotConfigure()));
+ connect(this, TQT_SIGNAL(update()), TQT_SLOT(slotUpdate()));
+ connect(m_changeBtn, TQT_SIGNAL(clicked()), TQT_SLOT(slotConfigure()));
- QValueList<int> list = m_dlv->sizes();
+ TQValueList<int> list = m_dlv->sizes();
int tot = list[0] + list[1];
- list[0] = QMIN(35, tot);
+ list[0] = TQMIN(35, tot);
list[1] = tot-list[0];
m_dlv->setSizes(list);
}
@@ -139,7 +139,7 @@ void AccountsView::zoom(double zoom) {
}
void AccountsView::init() {
- m_date = QDate::currentDate();
+ m_date = TQDate::tqcurrentDate();
m_period = 0;
initAccList(m_accounts.accountList());
}
@@ -165,32 +165,32 @@ void AccountsView::initAccList(const AccountList &list) {
createPeriods();
}
-void AccountsView::initAccSubItems(Account *acc, AccountsView::AccountItem *parent) {
+void AccountsView::initAccSubItems(Account *acc, AccountsView::AccountItem *tqparent) {
if (!acc->accountList().isEmpty()) {
-/* AccountsView::AccountItem *a = new AccountsView::AccountItem(i18n("Subaccounts"), acc, parent);
- DoubleListViewBase::SlaveListItem *i = new DoubleListViewBase::SlaveListItem(a, parent->period);
+/* AccountsView::AccountItem *a = new AccountsView::AccountItem(i18n("Subaccounts"), acc, tqparent);
+ DoubleListViewBase::SlaveListItem *i = new DoubleListViewBase::SlaveListItem(a, tqparent->period);
a->period = i;*/
- initAccList(acc->accountList(), parent);
+ initAccList(acc->accountList(), tqparent);
}
-// AccountsView::AccountItem *a = new AccountsView::AccountItem(i18n("Variance"), acc, parent, true);
-// DoubleListViewBase::SlaveListItem *i = new DoubleListViewBase::SlaveListItem(a, parent->period, true);
+// AccountsView::AccountItem *a = new AccountsView::AccountItem(i18n("Variance"), acc, tqparent, true);
+// DoubleListViewBase::SlaveListItem *i = new DoubleListViewBase::SlaveListItem(a, tqparent->period, true);
// a->period = i;
//
-// a = new AccountsView::AccountItem(i18n("Actual"), acc, parent);
-// i = new DoubleListViewBase::SlaveListItem(a, parent->period);
+// a = new AccountsView::AccountItem(i18n("Actual"), acc, tqparent);
+// i = new DoubleListViewBase::SlaveListItem(a, tqparent->period);
// a->period = i;
//
-// a = new AccountsView::AccountItem(i18n("Planned"), acc, parent);
-// i = new DoubleListViewBase::SlaveListItem(a, parent->period);
+// a = new AccountsView::AccountItem(i18n("Planned"), acc, tqparent);
+// i = new DoubleListViewBase::SlaveListItem(a, tqparent->period);
// a->period = i;
}
-void AccountsView::initAccList(const AccountList &list, AccountsView::AccountItem *parent) {
+void AccountsView::initAccList(const AccountList &list, AccountsView::AccountItem *tqparent) {
AccountListIterator it = list;
for (it.toLast(); it.current(); --it) {
- AccountsView::AccountItem *a = new AccountsView::AccountItem(it.current(), parent);
+ AccountsView::AccountItem *a = new AccountsView::AccountItem(it.current(), tqparent);
a->setOpen(true);
a->setExpandable(!it.current()->isElement());
initAccSubItems(it.current(), a);
@@ -207,30 +207,30 @@ void AccountsView::createPeriods() {
void AccountsView::slotUpdate() {
//kdDebug()<<k_funcinfo<<endl;
- QApplication::setOverrideCursor(Qt::waitCursor);
+ TQApplication::setOverrideCursor(TQt::waitCursor);
createPeriods();
KLocale *locale = KGlobal::locale();
const KCalendarSystem *cal = locale->calendar();
- QString t;
+ TQString t;
if (m_cumulative) {
t += " <b>" + i18n("Cumulative") + "</b> ";
}
- t += i18n("Cut-off date:%1").arg("<b>" + locale->formatDate(m_date, true) + "</b>");
- t += " " + i18n("Periodicity:%1").arg("<b>" + periodText(m_period) + "</b>");
+ t += i18n("Cut-off date:%1").tqarg("<b>" + locale->formatDate(m_date, true) + "</b>");
+ t += " " + i18n("Periodicity:%1").tqarg("<b>" + periodText(m_period) + "</b>");
m_label->setText(t);
// Add columns for selected period/periods
- QDate start = m_project.startTime().date();
- QDate end = m_date;
+ TQDate start = m_project.startTime().date();
+ TQDate end = m_date;
//kdDebug()<<k_funcinfo<<start.toString()<<" - "<<end.toString()<<endl;
int c=0;
if (m_period == 0) { //Daily
- for (QDate dt = start; dt <= end; dt = cal->addDays(dt, 1), ++c) {
- QString df = locale->formatDate(dt, true);
+ for (TQDate dt = start; dt <= end; dt = cal->addDays(dt, 1), ++c) {
+ TQString df = locale->formatDate(dt, true);
m_dlv->addSlaveColumn(df);
}
- QListViewItemIterator it(m_dlv->masterListView());
+ TQListViewItemIterator it(m_dlv->masterListView());
for (;it.current(); ++it) {
AccountsView::AccountItem *item = dynamic_cast<AccountsView::AccountItem*>(it.current());
if (!item || !item->account || !item->account->isElement()) {
@@ -239,7 +239,7 @@ void AccountsView::slotUpdate() {
item->costMap = m_accounts.plannedCost(*(item->account), start, end);
double cost = 0.0;
int col=0;
- for (QDate d=start; d <= end; d = cal->addDays(d, 1), ++col) {
+ for (TQDate d=start; d <= end; d = cal->addDays(d, 1), ++col) {
EffortCost &ec = item->costMap.effortCostOnDate(d);
cost = (m_cumulative ? cost + ec.cost() : ec.cost());
item->setSlaveItem(col, cost);
@@ -247,20 +247,20 @@ void AccountsView::slotUpdate() {
}
}
m_dlv->calculate();
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
return;
}
if (m_period == 1) { //Weekly
//TODO make this user controlled
int weekStartDay = locale->weekStartDay();
- QDate dt = start;
- QDate pend = cal->addDays(dt, 7 + weekStartDay - 1 - cal->dayOfWeek(dt));
+ TQDate dt = start;
+ TQDate pend = cal->addDays(dt, 7 + weekStartDay - 1 - cal->dayOfWeek(dt));
for (; pend <= end; ++c) {
//kdDebug()<<k_funcinfo<<c<<": "<<dt<<"-"<<pend<<" : "<<end<<endl;
int y;
int w = cal->weekNumber(dt, &y);
- QString t = i18n("<week>-<year>", "%1-%2").arg(w).arg(y);
+ TQString t = i18n("<week>-<year>", "%1-%2").tqarg(w).tqarg(y);
m_dlv->addSlaveColumn(t);
dt = pend.addDays(1);
pend = cal->addDays(pend, 7);
@@ -269,10 +269,10 @@ void AccountsView::slotUpdate() {
}
}
if (c == 0) {
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
return;
}
- QListViewItemIterator it(m_dlv->masterListView());
+ TQListViewItemIterator it(m_dlv->masterListView());
for (;it.current(); ++it) {
AccountsView::AccountItem *item = dynamic_cast<AccountsView::AccountItem*>(it.current());
if (!item || !item->account || !item->account->isElement()) {
@@ -280,8 +280,8 @@ void AccountsView::slotUpdate() {
}
item->costMap = m_accounts.plannedCost(*(item->account), start, end);
double cost = 0.0;
- QDate d = start;
- QDate pend = cal->addDays(d, 7 + weekStartDay - 1 - cal->dayOfWeek(d));
+ TQDate d = start;
+ TQDate pend = cal->addDays(d, 7 + weekStartDay - 1 - cal->dayOfWeek(d));
for (int col=0; pend <= end; ++col) {
double cst = item->costMap.cost(d, d.daysTo(pend)+1);
cost = (m_cumulative ? cost + cst : cst);
@@ -295,17 +295,17 @@ void AccountsView::slotUpdate() {
}
}
m_dlv->calculate();
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
return;
}
if (m_period == 2) { //Monthly
//TODO make this user controlled
- QDate dt = start;
- QDate pend;
+ TQDate dt = start;
+ TQDate pend;
cal->setYMD(pend, dt.year(), dt.month(), dt.daysInMonth());
for (; pend <= end; ++c) {
//kdDebug()<<k_funcinfo<<c<<": "<<dt<<"-"<<pend<<" : "<<end<<endl;
- QString m = cal->monthName(dt, true) + QString(" %1").arg( dt.year());
+ TQString m = cal->monthName(dt, true) + TQString(" %1").tqarg( dt.year());
m_dlv->addSlaveColumn(m);
dt = pend.addDays(1); // 1. next month
@@ -315,10 +315,10 @@ void AccountsView::slotUpdate() {
}
}
if (c == 0) {
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
return;
}
- QListViewItemIterator it(m_dlv->masterListView());
+ TQListViewItemIterator it(m_dlv->masterListView());
for (;it.current(); ++it) {
AccountsView::AccountItem *item = dynamic_cast<AccountsView::AccountItem*>(it.current());
if (!item || !item->account || !item->account->isElement()) {
@@ -326,7 +326,7 @@ void AccountsView::slotUpdate() {
}
item->costMap = m_accounts.plannedCost(*(item->account), start, end);
double cost = 0.0;
- QDate d = start;
+ TQDate d = start;
cal->setYMD(pend, d.year(), d.month(), d.daysInMonth());
for (int col=0; pend <= end; ++col) {
double cst = item->costMap.cost(d, d.daysTo(pend)+1);
@@ -341,26 +341,26 @@ void AccountsView::slotUpdate() {
}
}
m_dlv->calculate();
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
return;
}
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
}
void AccountsView::print(KPrinter &printer) {
//kdDebug()<<k_funcinfo<<endl;
- QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
+ TQPaintDeviceMetrics m = TQPaintDeviceMetrics ( &printer );
uint top, left, bottom, right;
printer.margins(&top, &left, &bottom, &right);
//kdDebug()<<m.width()<<"x"<<m.height()<<" : "<<top<<", "<<left<<", "<<bottom<<", "<<right<<" : "<<size()<<endl;
- QPainter p;
+ TQPainter p;
p.begin(&printer);
p.setViewport(left, top, m.width()-left-right, m.height()-top-bottom);
p.setClipRect(left, top, m.width()-left-right, m.height()-top-bottom);
- QRect preg = p.clipRegion(QPainter::CoordPainter).boundingRect();
+ TQRect preg = p.clipRegion(TQPainter::CoordPainter).boundingRect();
//kdDebug()<<"p="<<preg<<endl;
//p.drawRect(preg.x(), preg.y(), preg.width()-1, preg.height()-1);
- double scale = QMIN((double)preg.width()/(double)size().width(), (double)preg.height()/(double)(size().height()));
+ double scale = TQMIN((double)preg.width()/(double)size().width(), (double)preg.height()/(double)(size().height()));
//kdDebug()<<"scale="<<scale<<endl;
if (scale < 1.0) {
p.scale(scale, scale);
@@ -373,12 +373,12 @@ void AccountsView::print(KPrinter &printer) {
bool AccountsView::setContext(Context::Accountsview &context) {
//kdDebug()<<k_funcinfo<<"---->"<<endl;
- QValueList<int> list;
+ TQValueList<int> list;
list << context.accountsviewsize << context.periodviewsize;
//m_dlv->setSizes(list); //NOTE: This doesn't always work!
m_date = context.date;
if (!m_date.isValid())
- m_date = QDate::currentDate();
+ m_date = TQDate::tqcurrentDate();
m_period = context.period;
m_cumulative = context.cumulative;
setContextClosedItems(context);
@@ -387,9 +387,9 @@ bool AccountsView::setContext(Context::Accountsview &context) {
}
void AccountsView::setContextClosedItems(Context::Accountsview &context) {
- for (QStringList::ConstIterator it = context.closedItems.begin(); it != context.closedItems.end(); ++it) {
+ for (TQStringList::ConstIterator it = context.closedItems.begin(); it != context.closedItems.end(); ++it) {
if (m_accounts.findAccount(*it)) {
- QListViewItemIterator lit(m_dlv->masterListView());
+ TQListViewItemIterator lit(m_dlv->masterListView());
for (; lit.current(); ++lit) {
if (lit.current()->text(0) == (*it)) {
m_dlv->setOpen(lit.current(), false);
@@ -413,10 +413,10 @@ void AccountsView::getContext(Context::Accountsview &context) const {
}
-void AccountsView::getContextClosedItems(Context::Accountsview &context, QListViewItem *item) const {
+void AccountsView::getContextClosedItems(Context::Accountsview &context, TQListViewItem *item) const {
if (item == 0)
return;
- for (QListViewItem *i = item; i; i = i->nextSibling()) {
+ for (TQListViewItem *i = item; i; i = i->nextSibling()) {
if (!i->isOpen()) {
context.closedItems.append(i->text(0));
//kdDebug()<<k_funcinfo<<"add closed "<<i->text(0)<<endl;
@@ -437,9 +437,9 @@ void AccountsView::slotConfigure() {
delete dia;
}
-QString AccountsView::periodText(int offset) {
- QString s;
- QStringList::const_iterator it = m_periodTexts.at(offset);
+TQString AccountsView::periodText(int offset) {
+ TQString s;
+ TQStringList::const_iterator it = m_periodTexts.at(offset);
if (it != m_periodTexts.constEnd()) {
s = (*it);
}