summaryrefslogtreecommitdiffstats
path: root/kplato/kptdatetable.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/kptdatetable.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/kptdatetable.cc')
-rw-r--r--kplato/kptdatetable.cc336
1 files changed, 168 insertions, 168 deletions
diff --git a/kplato/kptdatetable.cc b/kplato/kptdatetable.cc
index db49e657..6117a941 100644
--- a/kplato/kptdatetable.cc
+++ b/kplato/kptdatetable.cc
@@ -26,14 +26,14 @@
#include <knotifyclient.h>
#include <kcalendarsystem.h>
-#include <qdatetime.h>
-#include <qstring.h>
-#include <qpen.h>
-#include <qpainter.h>
-#include <qdialog.h>
+#include <tqdatetime.h>
+#include <tqstring.h>
+#include <tqpen.h>
+#include <tqpainter.h>
+#include <tqdialog.h>
#include <assert.h>
-#include <qlayout.h>
-#include <qvaluelist.h>
+#include <tqlayout.h>
+#include <tqvaluelist.h>
#include <kglobalsettings.h>
#include <kdebug.h>
@@ -41,23 +41,23 @@
namespace KPlato
{
-DateValidator::DateValidator(QWidget* parent, const char* name)
- : QValidator(parent, name)
+DateValidator::DateValidator(TQWidget* tqparent, const char* name)
+ : TQValidator(TQT_TQOBJECT(tqparent), name)
{
}
-QValidator::State
-DateValidator::validate(QString& text, int&) const
+TQValidator::State
+DateValidator::validate(TQString& text, int&) const
{
- QDate temp;
+ TQDate temp;
// ----- everything is tested in date():
return date(text, temp);
}
-QValidator::State
-DateValidator::date(const QString& text, QDate& d) const
+TQValidator::State
+DateValidator::date(const TQString& text, TQDate& d) const
{
- QDate tmp = KGlobal::locale()->readDate(text);
+ TQDate tmp = KGlobal::locale()->readDate(text);
if (!tmp.isNull())
{
d = tmp;
@@ -67,14 +67,14 @@ DateValidator::date(const QString& text, QDate& d) const
}
void
-DateValidator::fixup( QString& ) const
+DateValidator::fixup( TQString& ) const
{
}
-DateTable::DateTable(QWidget *parent, QDate date_, const char* name, WFlags f)
- : QGridView(parent, name, f),
+DateTable::DateTable(TQWidget *tqparent, TQDate date_, const char* name, WFlags f)
+ : TQGridView(tqparent, name, f),
m_enabled(true)
{
//kdDebug()<<k_funcinfo<<endl;
@@ -82,15 +82,15 @@ DateTable::DateTable(QWidget *parent, QDate date_, const char* name, WFlags f)
m_selectedDates.clear();
m_selectedWeekdays.clear();
- QPair<int, int> p(0,0);
+ TQPair<int, int> p(0,0);
m_weeks.fill(p, 7);
setFontSize(10);
if(!date_.isValid()) {
kdError() <<k_funcinfo<<"Given date is invalid, using current date." << endl;
- date_=QDate::currentDate();
+ date_=TQDate::tqcurrentDate();
}
- setFocusPolicy( QWidget::StrongFocus );
+ setFocusPolicy( TQ_StrongFocus );
setNumCols(7+m_dateStartCol); // 7 days a week + maybe 1 for weeknumbers
setNumRows(7); // 6 weeks max + headline
@@ -99,9 +99,9 @@ DateTable::DateTable(QWidget *parent, QDate date_, const char* name, WFlags f)
viewport()->setEraseColor(KGlobalSettings::baseColor());
setDate(date_); // this initializes firstday, numdays, numDaysPrevMonth
- colorBackgroundHoliday = QColor(0, 245, 255, QColor::Hsv);
+ colorBackgroundHoliday = TQColor(0, 245, 255, TQColor::Hsv);
//colorBackgroundHoliday = colorBackgroundHoliday.light();
- colorBackgroundWorkday = QColor(208, 230, 240, QColor::Hsv);;
+ colorBackgroundWorkday = TQColor(208, 230, 240, TQColor::Hsv);;
//colorBackgroundWorkday = colorBackgroundWorkday.light();
colorTextHoliday = black;
colorTextWorkday = black;
@@ -111,12 +111,12 @@ DateTable::DateTable(QWidget *parent, QDate date_, const char* name, WFlags f)
}
-void DateTable::paintWeekday(QPainter *painter, int col) {
- QRect rect;
+void DateTable::paintWeekday(TQPainter *painter, int col) {
+ TQRect rect;
int w=cellWidth();
int h=cellHeight();
- QFont font = KGlobalSettings::generalFont();
+ TQFont font = KGlobalSettings::generalFont();
font.setBold(true);
if (!m_enabled)
font.setItalic(true);
@@ -142,7 +142,7 @@ void DateTable::paintWeekday(QPainter *painter, int col) {
painter->drawRect(0, 0, w, h);
painter->setPen(colorTextHoliday);
}
- if (m_selectedWeekdays.contains(day)) {
+ if (m_selectedWeekdays.tqcontains(day)) {
painter->setPen(backgroundSelectColor);
painter->setBrush(backgroundSelectColor);
painter->drawRect(2, 2, w-4, h-4);
@@ -159,12 +159,12 @@ void DateTable::paintWeekday(QPainter *painter, int col) {
//kdDebug()<<k_funcinfo<<"headline: row,col=("<<row<<","<<col<<")"<<" day="<<daystr<<endl;
}
-void DateTable::paintWeekNumber(QPainter *painter, int row) {
- QRect rect;
+void DateTable::paintWeekNumber(TQPainter *painter, int row) {
+ TQRect rect;
int w=cellWidth();
int h=cellHeight();
- QFont font=KGlobalSettings::generalFont();
+ TQFont font=KGlobalSettings::generalFont();
font.setBold(true);
if (!m_enabled)
font.setItalic(true);
@@ -175,7 +175,7 @@ void DateTable::paintWeekNumber(QPainter *painter, int row) {
painter->drawRect(0, 0, w, h);
painter->setPen(KGlobalSettings::textColor());
- painter->drawText(0, 0, w, h-1, AlignCenter, QString("%1").arg(m_weeks[row].first), -1, &rect);
+ painter->drawText(0, 0, w, h-1, AlignCenter, TQString("%1").tqarg(m_weeks[row].first), -1, &rect);
painter->setPen(colorLine);
painter->moveTo(w-1, 0);
painter->lineTo(w-1, h-1);
@@ -184,19 +184,19 @@ void DateTable::paintWeekNumber(QPainter *painter, int row) {
if(rect.height()>maxCell.height()) maxCell.setHeight(rect.height());
}
-void DateTable::paintDay(QPainter *painter, int row, int col) {
+void DateTable::paintDay(TQPainter *painter, int row, int col) {
//kdDebug()<<k_funcinfo<<"row,col=("<<row<<","<<col<<")"<<" num col="<<numCols()<<endl;
- QRect rect;
+ TQRect rect;
int w=cellWidth();
int h=cellHeight();
- QFont font=KGlobalSettings::generalFont();
+ TQFont font=KGlobalSettings::generalFont();
font.setPointSize(fontsize);
if (!m_enabled)
font.setItalic(true);
painter->setFont(font);
- QDate d = getDate(position(row, col));
+ TQDate d = getDate(position(row, col));
painter->setBrush(KGlobalSettings::baseColor());
painter->setPen(KGlobalSettings::baseColor());
@@ -214,14 +214,14 @@ void DateTable::paintDay(QPainter *painter, int row, int col) {
painter->setBrush(colorBackgroundWorkday);
painter->drawRect(0, 0, w, h);
}
- if(m_selectedDates.contains(d)) {
+ if(m_selectedDates.tqcontains(d)) {
//kdDebug()<<k_funcinfo<<"Selected: "<<d<<" row,col=("<<row<<","<<col<<")"<<endl;
painter->setPen(backgroundSelectColor);
painter->setBrush(backgroundSelectColor);
painter->drawRect(2, 2, w-4, h-4);
}
// If weeks or weekdays are selected/marked we draw lines around the date
- QPen pen = painter->pen();
+ TQPen pen = painter->pen();
if (m_markedWeekdays.state(weekday(col)) == Map::Working) {
//kdDebug()<<k_funcinfo<<"Marked weekday: row,dayCol=("<<row<<","<<dayCol<<")=Working"<<endl;
pen.setColor(colorBackgroundWorkday);
@@ -232,20 +232,20 @@ void DateTable::paintDay(QPainter *painter, int row, int col) {
painter->lineTo(w-1, h-1);
}
// then paint square if current date
- if (d == QDate::currentDate()) {
+ if (d == TQDate::tqcurrentDate()) {
painter->setPen(colorLine);
painter->drawRect(1, 1, w-2, h-2);
}
// and now the day number
d.month() == date.month() ? painter->setPen(KGlobalSettings::textColor()) : painter->setPen(gray);
- painter->drawText(0, 0, w, h, AlignCenter, QString().setNum(d.day()), -1, &rect);
+ painter->drawText(0, 0, w, h, AlignCenter, TQString().setNum(d.day()), -1, &rect);
if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width());
if(rect.height()>maxCell.height()) maxCell.setHeight(rect.height());
}
-void DateTable::paintCell(QPainter *painter, int row, int col) {
+void DateTable::paintCell(TQPainter *painter, int row, int col) {
//kdDebug()<<k_funcinfo<<"row,col=("<<row<<","<<col<<")"<<"enabled="<<m_enabled<<endl;
if (row == 0 && col == 0) {
painter->save();
@@ -271,67 +271,67 @@ void DateTable::paintCell(QPainter *painter, int row, int col) {
}
//FIXME
-void DateTable::keyPressEvent( QKeyEvent *e ) {
+void DateTable::keyPressEvent( TQKeyEvent *e ) {
if (!m_enabled)
return;
- if ( e->key() == Qt::Key_Prior ) {
+ if ( e->key() == TQt::Key_Prior ) {
setDate(date.addMonths(-1));
return;
}
- if ( e->key() == Qt::Key_Next ) {
+ if ( e->key() == TQt::Key_Next ) {
setDate(date.addMonths(1));
return;
}
- if ( e->key() == Qt::Key_Up ) {
+ if ( e->key() == TQt::Key_Up ) {
if ( date.day() > 7 ) {
setDate(date.addDays(-7));
return;
}
}
- if ( e->key() == Qt::Key_Down ) {
+ if ( e->key() == TQt::Key_Down ) {
if ( date.day() <= date.daysInMonth()-7 ) {
setDate(date.addDays(7));
return;
}
}
- if ( e->key() == Qt::Key_Left ) {
+ if ( e->key() == TQt::Key_Left ) {
if ( date.day() > 1 ) {
setDate(date.addDays(-1));
return;
}
}
- if ( e->key() == Qt::Key_Right ) {
+ if ( e->key() == TQt::Key_Right ) {
if ( date.day() < date.daysInMonth() ) {
setDate(date.addDays(1));
return;
}
}
- if ( e->key() == Qt::Key_Minus ) {
+ if ( e->key() == TQt::Key_Minus ) {
setDate(date.addDays(-1));
return;
}
- if ( e->key() == Qt::Key_Plus ) {
+ if ( e->key() == TQt::Key_Plus ) {
setDate(date.addDays(1));
return;
}
- if ( e->key() == Qt::Key_N ) {
- setDate(QDate::currentDate());
+ if ( e->key() == TQt::Key_N ) {
+ setDate(TQDate::tqcurrentDate());
return;
}
- if ( e->key() == Qt::Key_Control ) {
+ if ( e->key() == TQt::Key_Control ) {
return;
}
- if ( e->key() == Qt::Key_Shift ) {
+ if ( e->key() == TQt::Key_Shift ) {
return;
}
KNotifyClient::beep();
}
-void DateTable::viewportResizeEvent(QResizeEvent * e) {
- QGridView::viewportResizeEvent(e);
+void DateTable::viewportResizeEvent(TQResizeEvent * e) {
+ TQGridView::viewportResizeEvent(e);
setCellWidth(viewport()->width()/numCols());
setCellHeight(viewport()->height()/numRows());
@@ -339,8 +339,8 @@ void DateTable::viewportResizeEvent(QResizeEvent * e) {
void DateTable::setFontSize(int size) {
int count;
- QFontMetrics metrics(fontMetrics());
- QRect rect;
+ TQFontMetrics metrics(fontMetrics());
+ TQRect rect;
// ----- store rectangles:
fontsize=size;
// ----- find largest day name:
@@ -349,37 +349,37 @@ void DateTable::setFontSize(int size) {
for(count=0; count<7; ++count)
{
rect=metrics.boundingRect(KGlobal::locale()->calendar()->weekDayName(count+1, true));
- maxCell.setWidth(QMAX(maxCell.width(), rect.width()));
- maxCell.setHeight(QMAX(maxCell.height(), rect.height()));
+ maxCell.setWidth(TQMAX(maxCell.width(), rect.width()));
+ maxCell.setHeight(TQMAX(maxCell.height(), rect.height()));
}
// ----- compare with a real wide number and add some space:
- rect=metrics.boundingRect(QString::fromLatin1("88"));
- maxCell.setWidth(QMAX(maxCell.width()+2, rect.width()));
- maxCell.setHeight(QMAX(maxCell.height()+4, rect.height()));
+ rect=metrics.boundingRect(TQString::tqfromLatin1("88"));
+ maxCell.setWidth(TQMAX(maxCell.width()+2, rect.width()));
+ maxCell.setHeight(TQMAX(maxCell.height()+4, rect.height()));
}
//FIXME
-void DateTable::wheelEvent ( QWheelEvent * e ) {
+void DateTable::wheelEvent ( TQWheelEvent * e ) {
setDate(date.addMonths( -(int)(e->delta()/120)) );
e->accept();
}
-void DateTable::contentsMousePressEvent(QMouseEvent *e) {
+void DateTable::contentsMousePressEvent(TQMouseEvent *e) {
if (!m_enabled)
return;
//kdDebug()<<k_funcinfo<<endl;
- if(e->type()!=QEvent::MouseButtonPress) {
+ if(e->type()!=TQEvent::MouseButtonPress) {
return;
}
- QPoint mouseCoord = e->pos();
+ TQPoint mouseCoord = e->pos();
int row=rowAt(mouseCoord.y());
int col=columnAt(mouseCoord.x());
if (row == 0 && col == 0) { // user clicked on (unused) upper left square
updateSelectedCells();
m_selectedWeekdays.clear();
m_selectedDates.clear();
- repaintContents(false);
+ tqrepaintContents(false);
emit selectionCleared();
return;
}
@@ -388,7 +388,7 @@ void DateTable::contentsMousePressEvent(QMouseEvent *e) {
m_selectedWeekdays.clear();
m_selectedDates.clear();
updateSelectedCells();
- repaintContents(false);
+ tqrepaintContents(false);
return;
}
if (row==0 && col>0) { // the user clicked on weekdays
@@ -401,7 +401,7 @@ void DateTable::contentsMousePressEvent(QMouseEvent *e) {
bool select = false;
for(int i=m_dateStartCol; i < col; ++i) {
//kdDebug()<<"Down["<<i<<"]: col="<<col<<" day="<<day<<" column(i)="<<column(i)<<endl;
- if (m_selectedWeekdays.contains(weekday(i))) {
+ if (m_selectedWeekdays.tqcontains(weekday(i))) {
select = true; // we have hit a selected day; select the rest
} else if (select) {
m_selectedWeekdays.toggle(weekday(i)); // select
@@ -411,14 +411,14 @@ void DateTable::contentsMousePressEvent(QMouseEvent *e) {
select = false;
for(int i=7; i > col; --i) {
//kdDebug()<<"Up["<<i<<"]: col="<<col<<" day="<<day<<" column(i)="<<column(i)<<endl;
- if (m_selectedWeekdays.contains(weekday(i))) {
+ if (m_selectedWeekdays.tqcontains(weekday(i))) {
if (selected) m_selectedWeekdays.toggle(weekday(i)); // deselect
else select = true;
} else if (select) {
m_selectedWeekdays.toggle(weekday(i)); // select
}
}
- if (!m_selectedWeekdays.contains(day)) {
+ if (!m_selectedWeekdays.tqcontains(day)) {
m_selectedWeekdays.toggle(day); // always select
}
} else if (e->state() & ControlButton) {
@@ -429,7 +429,7 @@ void DateTable::contentsMousePressEvent(QMouseEvent *e) {
m_selectedWeekdays.toggleClear(day);
}
updateSelectedCells();
- repaintContents(false);
+ tqrepaintContents(false);
if (m_enabled) {
//kdDebug()<<k_funcinfo<<"emit weekdaySelected("<<day<<")"<<endl;
emit weekdaySelected(day); // day= 1..7
@@ -442,12 +442,12 @@ void DateTable::contentsMousePressEvent(QMouseEvent *e) {
m_selectedWeekdays.clear();
if (e->state() & ShiftButton) {
// find first&last date
- QDate first;
- QDate last;
+ TQDate first;
+ TQDate last;
DateMap::ConstIterator it;
for (it = m_selectedDates.constBegin(); it != m_selectedDates.constEnd(); ++it) {
//kdDebug()<<k_funcinfo<<it.key()<<endl;
- QDate d = QDate::fromString(it.key(), Qt::ISODate);
+ TQDate d = TQDate::fromString(it.key(), Qt::ISODate);
if (!d.isValid())
continue;
if (!first.isValid() || first > d)
@@ -458,7 +458,7 @@ void DateTable::contentsMousePressEvent(QMouseEvent *e) {
// select between anchor and pressed date inclusive
m_selectedDates.clear();
if (first.isValid() && last.isValid()) {
- QDate anchor = first < date ? first : last;
+ TQDate anchor = first < date ? first : last;
int i = anchor > date ? -1 : 1;
while (anchor != date) {
//kdDebug()<<k_funcinfo<<anchor.toString(Qt::ISODate)<<endl;
@@ -478,11 +478,11 @@ void DateTable::contentsMousePressEvent(QMouseEvent *e) {
//kdDebug()<<k_funcinfo<<"toggleClear date: "<<date.toString()<<" state="<<m_selectedDates.state(date)<<endl;
}
}
- repaintContents(false);
+ tqrepaintContents(false);
}
-bool DateTable::contentsMousePressEvent_internal(QMouseEvent *e) {
- QPoint mouseCoord = e->pos();
+bool DateTable::contentsMousePressEvent_internal(TQMouseEvent *e) {
+ TQPoint mouseCoord = e->pos();
int row=rowAt(mouseCoord.y());
int col=columnAt(mouseCoord.x());
if(row<1 || col<0) { // the user clicked on the frame of the table
@@ -493,10 +493,10 @@ bool DateTable::contentsMousePressEvent_internal(QMouseEvent *e) {
return true;
}
-bool DateTable::selectDate(const QDate& date_) {
+bool DateTable::selectDate(const TQDate& date_) {
//kdDebug()<<k_funcinfo<<"date="<<date_.toString()<<endl;
bool changed=false;
- QDate temp;
+ TQDate temp;
// -----
if(!date_.isValid()) {
return false;
@@ -512,25 +512,25 @@ bool DateTable::selectDate(const QDate& date_) {
numdays=date.daysInMonth();
if(date.month()==1) { // set to december of previous year
temp.setYMD(date.year()-1, 12, 1);
- setWeekNumbers(QDate(date.year()-1, 12, 31));
+ setWeekNumbers(TQDate(date.year()-1, 12, 31));
} else { // set to previous month
temp.setYMD(date.year(), date.month()-1, 1);
- QDate d(date.year(), date.month()-1,1);
+ TQDate d(date.year(), date.month()-1,1);
setWeekNumbers(d.addDays(d.daysInMonth()-1));
}
numDaysPrevMonth=temp.daysInMonth();
if(changed) {
- repaintContents(false);
+ tqrepaintContents(false);
}
if (m_enabled)
emit(dateChanged(date));
return true;
}
-bool DateTable::setDate(const QDate& date_, bool repaint) {
+bool DateTable::setDate(const TQDate& date_, bool tqrepaint) {
//kdDebug()<<k_funcinfo<<"date="<<date_.toString()<<endl;
bool changed=false;
- QDate temp;
+ TQDate temp;
// -----
if(!date_.isValid()) {
//kdDebug() << "DateTable::setDate: refusing to set invalid date." << endl;
@@ -549,54 +549,54 @@ bool DateTable::setDate(const QDate& date_, bool repaint) {
numdays=date.daysInMonth();
if(date.month()==1) { // set to december of previous year
temp.setYMD(date.year()-1, 12, 1);
- setWeekNumbers(QDate(date.year()-1, 12, 31));
+ setWeekNumbers(TQDate(date.year()-1, 12, 31));
} else { // set to previous month
temp.setYMD(date.year(), date.month()-1, 1);
- QDate d(date.year(), date.month()-1,1);
+ TQDate d(date.year(), date.month()-1,1);
setWeekNumbers(d.addDays(d.daysInMonth()-1));
}
/* if (m_selectedWeekdays.isEmpty() &&
- !m_selectedDates.isEmpty() && !m_selectedDates.contains(date))
+ !m_selectedDates.isEmpty() && !m_selectedDates.tqcontains(date))
{
//kdDebug()<<k_funcinfo<<"date inserted"<<endl;
m_selectedDates.insert(date);
}*/
numDaysPrevMonth=temp.daysInMonth();
- if(changed && repaint) {
- repaintContents(false);
+ if(changed && tqrepaint) {
+ tqrepaintContents(false);
}
if (m_enabled)
emit(dateChanged(date));
return true;
}
-const QDate& DateTable::getDate() const {
+const TQDate& DateTable::getDate() const {
return date;
}
-void DateTable::focusInEvent( QFocusEvent *e ) {
- QGridView::focusInEvent( e );
+void DateTable::focusInEvent( TQFocusEvent *e ) {
+ TQGridView::focusInEvent( e );
}
-void DateTable::focusOutEvent( QFocusEvent *e ) {
- QGridView::focusOutEvent( e );
+void DateTable::focusOutEvent( TQFocusEvent *e ) {
+ TQGridView::focusOutEvent( e );
}
-QSize DateTable::sizeHint() const {
+TQSize DateTable::tqsizeHint() const {
if(maxCell.height()>0 && maxCell.width()>0) {
- return QSize(maxCell.width()*numCols()+2*frameWidth(),
+ return TQSize(maxCell.width()*numCols()+2*frameWidth(),
(maxCell.height()+2)*numRows()+2*frameWidth());
} else {
- //kdDebug() << "DateTable::sizeHint: obscure failure - " << endl;
- return QSize(-1, -1);
+ //kdDebug() << "DateTable::tqsizeHint: obscure failure - " << endl;
+ return TQSize(-1, -1);
}
}
-void DateTable::setWeekNumbers(QDate date) {
+void DateTable::setWeekNumbers(TQDate date) {
if (!date.isValid()) {
kdError()<<k_funcinfo<<"Invalid date"<<endl;
}
- QDate d(date);
+ TQDate d(date);
for (int i = 1; i < 7; ++i) {
m_weeks[i].first = d.weekNumber(&(m_weeks[i].second));
//kdDebug()<<k_funcinfo<<"date="<<d.toString()<<" week=("<<m_weeks[i].first<<","<<m_weeks[i].second<<")"<<endl;
@@ -615,11 +615,11 @@ void DateTable::updateCells() {
void DateTable::updateSelectedCells() {
//kdDebug()<<k_funcinfo<<endl;
- QDate dt(date.year(), date.month(), 1);
+ TQDate dt(date.year(), date.month(), 1);
dt = dt.addDays(-firstday);
for (int pos=0; pos < 42; ++pos) {
- if (m_selectedDates.contains(dt.addDays(pos)) ||
- m_selectedWeekdays.contains(pos%7+1))
+ if (m_selectedDates.tqcontains(dt.addDays(pos)) ||
+ m_selectedWeekdays.tqcontains(pos%7+1))
{
updateCell(pos/7+1, pos%7+1);
//kdDebug()<<k_funcinfo<<" update cell ("<<pos/7+1<<","<<pos%7+1<<") date="<<dt.addDays(pos).toString()<<endl;
@@ -628,11 +628,11 @@ void DateTable::updateSelectedCells() {
}
void DateTable::updateMarkedCells() {
- QDate dt(date.year(), date.month(), 1);
+ TQDate dt(date.year(), date.month(), 1);
dt = dt.addDays(-firstday);
for (int pos=0; pos < 42; ++pos) {
- if (m_markedDates.contains(dt.addDays(pos)) ||
- m_markedWeekdays.contains(pos%7+1))
+ if (m_markedDates.tqcontains(dt.addDays(pos)) ||
+ m_markedWeekdays.tqcontains(pos%7+1))
{
updateCell(pos/7+1, pos%7+1);
//kdDebug()<<k_funcinfo<<" update cell ("<<pos/7+1<<","<<pos%7+1<<") date="<<dt.addDays(pos).toString()<<endl;
@@ -645,19 +645,19 @@ void DateTable::setMarkedWeekdays(const IntMap days) {
m_markedWeekdays.clear();
m_markedWeekdays = days;
updateMarkedCells();
- repaintContents(false);
+ tqrepaintContents(false);
}
bool DateTable::weekdayMarked(int day) {
- return m_markedWeekdays.contains(day);
+ return m_markedWeekdays.tqcontains(day);
}
-bool DateTable::dateMarked(QDate date) {
+bool DateTable::dateMarked(TQDate date) {
return m_markedDates[date.toString()];
}
-QDate DateTable::getDate(int pos) const {
- return QDate(date.year(), date.month(), 1).addDays(pos-firstday);
+TQDate DateTable::getDate(int pos) const {
+ return TQDate(date.year(), date.month(), 1).addDays(pos-firstday);
}
int DateTable::weekday(int col) const {
@@ -678,13 +678,13 @@ void DateTable::clear() {
clearSelection();
m_markedDates.clear();
m_markedWeekdays.clear();
- repaintContents(false);
+ tqrepaintContents(false);
}
void DateTable::clearSelection() {
m_selectedDates.clear();
m_selectedWeekdays.clear();
- repaintContents(false);
+ tqrepaintContents(false);
}
void DateTable::setEnabled(bool yes) {
@@ -709,24 +709,24 @@ void DateTable::markSelected(int state) {
}
}
updateSelectedCells();
- repaintContents(false);
+ tqrepaintContents(false);
}
DateInternalWeekSelector::DateInternalWeekSelector
-(int fontsize, QWidget* parent, const char* name)
- : QLineEdit(parent, name),
- val(new QIntValidator(this)),
+(int fontsize, TQWidget* tqparent, const char* name)
+ : TQLineEdit(tqparent, name),
+ val(new TQIntValidator(TQT_TQOBJECT(this))),
result(0)
{
- QFont font;
+ TQFont font;
// -----
font=KGlobalSettings::generalFont();
font.setPointSize(fontsize);
setFont(font);
- setFrameStyle(QFrame::NoFrame);
+ setFrameStyle(TQFrame::NoFrame);
val->setRange(1, 53);
setValidator(val);
- connect(this, SIGNAL(returnPressed()), SLOT(weekEnteredSlot()));
+ connect(this, TQT_SIGNAL(returnPressed()), TQT_SLOT(weekEnteredSlot()));
}
void
@@ -754,19 +754,19 @@ DateInternalWeekSelector::getWeek() const
void
DateInternalWeekSelector::setWeek(int week)
{
- QString temp;
+ TQString temp;
// -----
temp.setNum(week);
setText(temp);
}
DateInternalMonthPicker::DateInternalMonthPicker
-(int fontsize, QWidget* parent, const char* name)
- : QGridView(parent, name),
+(int fontsize, TQWidget* tqparent, const char* name)
+ : TQGridView(tqparent, name),
result(0) // invalid
{
- QRect rect;
- QFont font;
+ TQRect rect;
+ TQFont font;
// -----
activeCol = -1;
activeRow = -1;
@@ -775,7 +775,7 @@ DateInternalMonthPicker::DateInternalMonthPicker
setFont(font);
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
- setFrameStyle(QFrame::NoFrame);
+ setFrameStyle(TQFrame::NoFrame);
setNumRows(4);
setNumCols(3);
// enable to find drawing failures:
@@ -783,7 +783,7 @@ DateInternalMonthPicker::DateInternalMonthPicker
viewport()->setEraseColor(KGlobalSettings::baseColor()); // for consistency with the datepicker
// ----- find the preferred size
// (this is slow, possibly, but unfortunatly it is needed here):
- QFontMetrics metrics(font);
+ TQFontMetrics metrics(font);
for(int i=1; i <= 12; ++i)
{
rect=metrics.boundingRect(KGlobal::locale()->calendar()->monthName(i, false));
@@ -793,10 +793,10 @@ DateInternalMonthPicker::DateInternalMonthPicker
}
-QSize
-DateInternalMonthPicker::sizeHint() const
+TQSize
+DateInternalMonthPicker::tqsizeHint() const
{
- return QSize((max.width()+6)*numCols()+2*frameWidth(),
+ return TQSize((max.width()+6)*numCols()+2*frameWidth(),
(max.height()+6)*numRows()+2*frameWidth());
}
@@ -807,23 +807,23 @@ DateInternalMonthPicker::getResult() const
}
void
-DateInternalMonthPicker::setupPainter(QPainter *p)
+DateInternalMonthPicker::setupPainter(TQPainter *p)
{
p->setPen(KGlobalSettings::textColor());
}
void
-DateInternalMonthPicker::viewportResizeEvent(QResizeEvent*)
+DateInternalMonthPicker::viewportResizeEvent(TQResizeEvent*)
{
setCellWidth(width()/3);
setCellHeight(height()/4);
}
void
-DateInternalMonthPicker::paintCell(QPainter* painter, int row, int col)
+DateInternalMonthPicker::paintCell(TQPainter* painter, int row, int col)
{
int index;
- QString text;
+ TQString text;
// ----- find the number of the cell:
index=3*row+col+1;
text=KGlobal::locale()->calendar()->monthName(index, false);
@@ -833,16 +833,16 @@ DateInternalMonthPicker::paintCell(QPainter* painter, int row, int col)
}
void
-DateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e)
+DateInternalMonthPicker::contentsMousePressEvent(TQMouseEvent *e)
{
- if(!isEnabled() || e->button() != LeftButton)
+ if(!isEnabled() || e->button() != Qt::LeftButton)
{
KNotifyClient::beep();
return;
}
// -----
int row, col;
- QPoint mouseCoord;
+ TQPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
@@ -860,12 +860,12 @@ DateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e)
}
void
-DateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e)
+DateInternalMonthPicker::contentsMouseMoveEvent(TQMouseEvent *e)
{
- if (e->state() & LeftButton)
+ if (e->state() & Qt::LeftButton)
{
int row, col;
- QPoint mouseCoord;
+ TQPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
@@ -894,13 +894,13 @@ DateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e)
updateCell( row, col /*, false */ ); // mark the new active cell
}
}
- if ( tmpRow > -1 ) // repaint the former active cell
+ if ( tmpRow > -1 ) // tqrepaint the former active cell
updateCell( tmpRow, tmpCol /*, true */ );
}
}
void
-DateInternalMonthPicker::contentsMouseReleaseEvent(QMouseEvent *e)
+DateInternalMonthPicker::contentsMouseReleaseEvent(TQMouseEvent *e)
{
if(!isEnabled())
{
@@ -908,7 +908,7 @@ DateInternalMonthPicker::contentsMouseReleaseEvent(QMouseEvent *e)
}
// -----
int row, col, pos;
- QPoint mouseCoord;
+ TQPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
@@ -925,21 +925,21 @@ DateInternalMonthPicker::contentsMouseReleaseEvent(QMouseEvent *e)
DateInternalYearSelector::DateInternalYearSelector
-(int fontsize, QWidget* parent, const char* name)
- : QLineEdit(parent, name),
- val(new QIntValidator(this)),
+(int fontsize, TQWidget* tqparent, const char* name)
+ : TQLineEdit(tqparent, name),
+ val(new TQIntValidator(TQT_TQOBJECT(this))),
result(0)
{
- QFont font;
+ TQFont font;
// -----
font=KGlobalSettings::generalFont();
font.setPointSize(fontsize);
setFont(font);
- setFrameStyle(QFrame::NoFrame);
- // we have to respect the limits of QDate here, I fear:
+ setFrameStyle(TQFrame::NoFrame);
+ // we have to respect the limits of TQDate here, I fear:
val->setRange(0, 8000);
setValidator(val);
- connect(this, SIGNAL(returnPressed()), SLOT(yearEnteredSlot()));
+ connect(this, TQT_SIGNAL(returnPressed()), TQT_SLOT(yearEnteredSlot()));
}
void
@@ -947,7 +947,7 @@ DateInternalYearSelector::yearEnteredSlot()
{
bool ok;
int year;
- QDate date;
+ TQDate date;
// ----- check if this is a valid year:
year=text().toInt(&ok);
if(!ok)
@@ -974,28 +974,28 @@ DateInternalYearSelector::getYear() const
void
DateInternalYearSelector::setYear(int year)
{
- QString temp;
+ TQString temp;
// -----
temp.setNum(year);
setText(temp);
}
-PopupFrame::PopupFrame(QWidget* parent, const char* name)
- : QFrame(parent, name, WType_Popup),
+PopupFrame::PopupFrame(TQWidget* tqparent, const char* name)
+ : TQFrame(tqparent, name, WType_Popup),
result(0), // rejected
main(0)
{
- setFrameStyle(QFrame::Box|QFrame::Raised);
+ setFrameStyle(TQFrame::Box|TQFrame::Raised);
setMidLineWidth(2);
}
void
-PopupFrame::keyPressEvent(QKeyEvent* e)
+PopupFrame::keyPressEvent(TQKeyEvent* e)
{
if(e->key()==Key_Escape)
{
result=0; // rejected
- qApp->exit_loop();
+ tqApp->exit_loop();
}
}
@@ -1003,11 +1003,11 @@ void
PopupFrame::close(int r)
{
result=r;
- qApp->exit_loop();
+ tqApp->exit_loop();
}
void
-PopupFrame::setMainWidget(QWidget* m)
+PopupFrame::setMainWidget(TQWidget* m)
{
main=m;
if(main!=0)
@@ -1017,7 +1017,7 @@ PopupFrame::setMainWidget(QWidget* m)
}
void
-PopupFrame::resizeEvent(QResizeEvent*)
+PopupFrame::resizeEvent(TQResizeEvent*)
{
if(main!=0)
{
@@ -1027,10 +1027,10 @@ PopupFrame::resizeEvent(QResizeEvent*)
}
void
-PopupFrame::popup(const QPoint &pos)
+PopupFrame::popup(const TQPoint &pos)
{
// Make sure the whole popup is visible.
- QRect d = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(pos));
+ TQRect d = TQApplication::desktop()->screenGeometry(TQApplication::desktop()->screenNumber(pos));
int x = pos.x();
int y = pos.y();
int w = width();
@@ -1050,11 +1050,11 @@ PopupFrame::popup(const QPoint &pos)
}
int
-PopupFrame::exec(QPoint pos)
+PopupFrame::exec(TQPoint pos)
{
popup(pos);
- repaint();
- qApp->enter_loop();
+ tqrepaint();
+ tqApp->enter_loop();
hide();
return result;
}
@@ -1062,7 +1062,7 @@ PopupFrame::exec(QPoint pos)
int
PopupFrame::exec(int x, int y)
{
- return exec(QPoint(x, y));
+ return exec(TQPoint(x, y));
}
void PopupFrame::virtual_hook( int, void* )