summaryrefslogtreecommitdiffstats
path: root/kalarm/alarmlistview.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /kalarm/alarmlistview.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kalarm/alarmlistview.cpp')
-rw-r--r--kalarm/alarmlistview.cpp148
1 files changed, 74 insertions, 74 deletions
diff --git a/kalarm/alarmlistview.cpp b/kalarm/alarmlistview.cpp
index 19fcda4b5..8fb72fe31 100644
--- a/kalarm/alarmlistview.cpp
+++ b/kalarm/alarmlistview.cpp
@@ -20,11 +20,11 @@
#include "kalarm.h"
-#include <qtooltip.h>
-#include <qpainter.h>
-#include <qstyle.h>
-#include <qheader.h>
-#include <qregexp.h>
+#include <tqtooltip.h>
+#include <tqpainter.h>
+#include <tqstyle.h>
+#include <tqheader.h>
+#include <tqregexp.h>
#include <kglobal.h>
#include <klocale.h>
@@ -44,10 +44,10 @@
class AlarmListTooltip : public QToolTip
{
public:
- AlarmListTooltip(QWidget* parent) : QToolTip(parent) { }
+ AlarmListTooltip(TQWidget* parent) : TQToolTip(parent) { }
virtual ~AlarmListTooltip() {}
protected:
- virtual void maybeTip(const QPoint&);
+ virtual void maybeTip(const TQPoint&);
};
@@ -55,26 +55,26 @@ class AlarmListTooltip : public QToolTip
= Class: AlarmListView
= Displays the list of outstanding alarms.
=============================================================================*/
-QValueList<EventListViewBase*> AlarmListView::mInstanceList;
+TQValueList<EventListViewBase*> AlarmListView::mInstanceList;
bool AlarmListView::mDragging = false;
-AlarmListView::AlarmListView(const QValueList<int>& order, QWidget* parent, const char* name)
+AlarmListView::AlarmListView(const TQValueList<int>& order, TQWidget* parent, const char* name)
: EventListViewBase(parent, name),
mMousePressed(false),
mDrawMessageInColour(false),
mShowExpired(false)
{
- static QString titles[COLUMN_COUNT] = {
+ static TQString titles[COLUMN_COUNT] = {
i18n("Time"),
i18n("Time To"),
i18n("Repeat"),
- QString::null,
- QString::null,
+ TQString::null,
+ TQString::null,
i18n("Message, File or Command")
};
- setSelectionMode(QListView::Extended);
+ setSelectionMode(TQListView::Extended);
// Set the column order
int i;
@@ -134,17 +134,17 @@ AlarmListView::AlarmListView(const QValueList<int>& order, QWidget* parent, cons
mTimeColumnHeaderWidth = columnWidth(mColumn[TIME_COLUMN]);
mTimeToColumnHeaderWidth = columnWidth(mColumn[TIME_TO_COLUMN]);
setColumnAlignment(mColumn[REPEAT_COLUMN], Qt::AlignHCenter);
- setColumnWidthMode(mColumn[REPEAT_COLUMN], QListView::Maximum);
+ setColumnWidthMode(mColumn[REPEAT_COLUMN], TQListView::Maximum);
// Set the width of the colour column in proportion to height
setColumnWidth(mColumn[COLOUR_COLUMN], itemHeight() * 3/4);
- setColumnWidthMode(mColumn[COLOUR_COLUMN], QListView::Manual);
+ setColumnWidthMode(mColumn[COLOUR_COLUMN], TQListView::Manual);
// Set the width of the alarm type column to exactly accommodate the icons.
// Don't allow the user to resize it (to avoid refresh problems, and bearing
// in mind that resizing doesn't seem very useful anyway).
setColumnWidth(mColumn[TYPE_COLUMN], AlarmListViewItem::typeIconWidth(this));
- setColumnWidthMode(mColumn[TYPE_COLUMN], QListView::Manual);
+ setColumnWidthMode(mColumn[TYPE_COLUMN], TQListView::Manual);
header()->setResizeEnabled(false, mColumn[TYPE_COLUMN]);
mInstanceList.append(this);
@@ -167,7 +167,7 @@ void AlarmListView::populate()
KAEvent event;
KCal::Event::List events;
KCal::Event::List::ConstIterator it;
- QDateTime now = QDateTime::currentDateTime();
+ TQDateTime now = TQDateTime::currentDateTime();
if (mShowExpired)
{
AlarmCalendar* cal = AlarmCalendar::expiredCalendarOpen();
@@ -208,7 +208,7 @@ void AlarmListView::selectTimeColumns(bool time, bool timeTo)
{
// Unhide the time column
int colWidth = mTimeColumnHeaderWidth;
- QFontMetrics fm = fontMetrics();
+ TQFontMetrics fm = fontMetrics();
for (AlarmListViewItem* item = firstChild(); item; item = item->nextSibling())
{
int w = item->width(fm, this, mColumn[TIME_COLUMN]);
@@ -216,13 +216,13 @@ void AlarmListView::selectTimeColumns(bool time, bool timeTo)
colWidth = w;
}
setColumnWidth(mColumn[TIME_COLUMN], colWidth);
- setColumnWidthMode(mColumn[TIME_COLUMN], QListView::Maximum);
+ setColumnWidthMode(mColumn[TIME_COLUMN], TQListView::Maximum);
changed = true;
}
else if (!time && w)
{
// Hide the time column
- setColumnWidthMode(mColumn[TIME_COLUMN], QListView::Manual);
+ setColumnWidthMode(mColumn[TIME_COLUMN], TQListView::Manual);
setColumnWidth(mColumn[TIME_COLUMN], 0);
changed = true;
}
@@ -230,7 +230,7 @@ void AlarmListView::selectTimeColumns(bool time, bool timeTo)
if (timeTo && !w)
{
// Unhide the time-to-alarm column
- setColumnWidthMode(mColumn[TIME_TO_COLUMN], QListView::Maximum);
+ setColumnWidthMode(mColumn[TIME_TO_COLUMN], TQListView::Maximum);
updateTimeToAlarms(true);
if (columnWidth(mColumn[TIME_TO_COLUMN]) < mTimeToColumnHeaderWidth)
setColumnWidth(mColumn[TIME_TO_COLUMN], mTimeToColumnHeaderWidth);
@@ -239,7 +239,7 @@ void AlarmListView::selectTimeColumns(bool time, bool timeTo)
else if (!timeTo && w)
{
// Hide the time-to-alarm column
- setColumnWidthMode(mColumn[TIME_TO_COLUMN], QListView::Manual);
+ setColumnWidthMode(mColumn[TIME_TO_COLUMN], TQListView::Manual);
setColumnWidth(mColumn[TIME_TO_COLUMN], 0);
changed = true;
}
@@ -257,7 +257,7 @@ void AlarmListView::updateTimeToAlarms(bool forceDisplay)
{
if (forceDisplay || columnWidth(mColumn[TIME_TO_COLUMN]))
{
- QDateTime now = QDateTime::currentDateTime();
+ TQDateTime now = TQDateTime::currentDateTime();
for (AlarmListViewItem* item = firstChild(); item; item = item->nextSibling())
item->updateTimeToAlarm(now, forceDisplay);
}
@@ -269,7 +269,7 @@ void AlarmListView::updateTimeToAlarms(bool forceDisplay)
*/
void AlarmListView::addEvent(const KAEvent& event, EventListViewBase* view)
{
- QDateTime now = QDateTime::currentDateTime();
+ TQDateTime now = TQDateTime::currentDateTime();
for (InstanceListConstIterator it = mInstanceList.begin(); it != mInstanceList.end(); ++it)
static_cast<AlarmListView*>(*it)->addEntry(event, now, true, (*it == view));
}
@@ -277,7 +277,7 @@ void AlarmListView::addEvent(const KAEvent& event, EventListViewBase* view)
/******************************************************************************
* Add a new item to the list.
*/
-AlarmListViewItem* AlarmListView::addEntry(const KAEvent& event, const QDateTime& now, bool setSize, bool reselect)
+AlarmListViewItem* AlarmListView::addEntry(const KAEvent& event, const TQDateTime& now, bool setSize, bool reselect)
{
if (!mShowExpired && event.expired())
return 0;
@@ -290,7 +290,7 @@ AlarmListViewItem* AlarmListView::addEntry(const KAEvent& event, const QDateTime
*/
EventListViewItemBase* AlarmListView::createItem(const KAEvent& event)
{
- return new AlarmListViewItem(this, event, QDateTime::currentDateTime());
+ return new AlarmListViewItem(this, event, TQDateTime::currentDateTime());
}
/******************************************************************************
@@ -304,9 +304,9 @@ bool AlarmListView::expired(AlarmListViewItem* item) const
/******************************************************************************
* Return the column order.
*/
-QValueList<int> AlarmListView::columnOrder() const
+TQValueList<int> AlarmListView::columnOrder() const
{
- QHeader* hdr = header();
+ TQHeader* hdr = header();
int order[COLUMN_COUNT];
order[TIME_COLUMN] = hdr->mapToIndex(mColumn[TIME_COLUMN]);
order[TIME_TO_COLUMN] = hdr->mapToIndex(mColumn[TIME_TO_COLUMN]);
@@ -314,16 +314,16 @@ QValueList<int> AlarmListView::columnOrder() const
order[COLOUR_COLUMN] = hdr->mapToIndex(mColumn[COLOUR_COLUMN]);
order[TYPE_COLUMN] = hdr->mapToIndex(mColumn[TYPE_COLUMN]);
order[MESSAGE_COLUMN] = hdr->mapToIndex(mColumn[MESSAGE_COLUMN]);
- QValueList<int> orderList;
+ TQValueList<int> orderList;
for (int i = 0; i < COLUMN_COUNT; ++i)
orderList += order[i];
return orderList;
}
/******************************************************************************
-* Returns the QWhatsThis text for a specified column.
+* Returns the TQWhatsThis text for a specified column.
*/
-QString AlarmListView::whatsThisText(int column) const
+TQString AlarmListView::whatsThisText(int column) const
{
if (column == mColumn[TIME_COLUMN])
return i18n("Next scheduled date and time of the alarm");
@@ -345,12 +345,12 @@ QString AlarmListView::whatsThisText(int column) const
* Records the position of the mouse when the left button is pressed, for use
* in drag operations.
*/
-void AlarmListView::contentsMousePressEvent(QMouseEvent* e)
+void AlarmListView::contentsMousePressEvent(TQMouseEvent* e)
{
- QListView::contentsMousePressEvent(e);
+ TQListView::contentsMousePressEvent(e);
if (e->button() == Qt::LeftButton)
{
- QPoint p(contentsToViewport(e->pos()));
+ TQPoint p(contentsToViewport(e->pos()));
if (itemAt(p))
{
mMousePressPos = e->pos();
@@ -364,21 +364,21 @@ void AlarmListView::contentsMousePressEvent(QMouseEvent* e)
* Called when the mouse is moved.
* Creates a drag object when the mouse drags one or more selected items.
*/
-void AlarmListView::contentsMouseMoveEvent(QMouseEvent* e)
+void AlarmListView::contentsMouseMoveEvent(TQMouseEvent* e)
{
- QListView::contentsMouseMoveEvent(e);
+ TQListView::contentsMouseMoveEvent(e);
if (mMousePressed
- && (mMousePressPos - e->pos()).manhattanLength() > QApplication::startDragDistance())
+ && (mMousePressPos - e->pos()).manhattanLength() > TQApplication::startDragDistance())
{
// Create a calendar object containing all the currently selected alarms
kdDebug(5950) << "AlarmListView::contentsMouseMoveEvent(): drag started" << endl;
mMousePressed = false;
- KCal::CalendarLocal cal(QString::fromLatin1("UTC"));
+ KCal::CalendarLocal cal(TQString::fromLatin1("UTC"));
cal.setLocalTime(); // write out using local time (i.e. no time zone)
- QValueList<EventListViewItemBase*> items = selectedItems();
+ TQValueList<EventListViewItemBase*> items = selectedItems();
if (!items.count())
return;
- for (QValueList<EventListViewItemBase*>::Iterator it = items.begin(); it != items.end(); ++it)
+ for (TQValueList<EventListViewItemBase*>::Iterator it = items.begin(); it != items.end(); ++it)
{
const KAEvent& event = (*it)->event();
KCal::Event* kcalEvent = new KCal::Event;
@@ -399,9 +399,9 @@ void AlarmListView::contentsMouseMoveEvent(QMouseEvent* e)
* Notes that the mouse left button is no longer pressed, for use in drag
* operations.
*/
-void AlarmListView::contentsMouseReleaseEvent(QMouseEvent *e)
+void AlarmListView::contentsMouseReleaseEvent(TQMouseEvent *e)
{
- QListView::contentsMouseReleaseEvent(e);
+ TQListView::contentsMouseReleaseEvent(e);
mMousePressed = false;
mDragging = false;
}
@@ -414,7 +414,7 @@ void AlarmListView::contentsMouseReleaseEvent(QMouseEvent *e)
int AlarmListViewItem::mTimeHourPos = -2;
int AlarmListViewItem::mDigitWidth = -1;
-AlarmListViewItem::AlarmListViewItem(AlarmListView* parent, const KAEvent& event, const QDateTime& now)
+AlarmListViewItem::AlarmListViewItem(AlarmListView* parent, const KAEvent& event, const TQDateTime& now)
: EventListViewItemBase(parent, event),
mMessageTruncated(false),
mTimeToAlarmShown(false)
@@ -426,17 +426,17 @@ AlarmListViewItem::AlarmListViewItem(AlarmListView* parent, const KAEvent& event
setText(parent->column(AlarmListView::TIME_COLUMN), alarmTimeText(dateTime));
if (parent->column(AlarmListView::TIME_TO_COLUMN) >= 0)
{
- QString tta = timeToAlarmText(now);
+ TQString tta = timeToAlarmText(now);
setText(parent->column(AlarmListView::TIME_TO_COLUMN), tta);
mTimeToAlarmShown = !tta.isNull();
}
- QTime t = dateTime.time();
+ TQTime t = dateTime.time();
mDateTimeOrder.sprintf("%04d%03d%02d%02d", dateTime.date().year(), dateTime.date().dayOfYear(),
t.hour(), t.minute());
int repeatOrder = 0;
int repeatInterval = 0;
- QString repeatText = event.recurrenceText(true); // text displayed in Repeat column
+ TQString repeatText = event.recurrenceText(true); // text displayed in Repeat column
if (repeatText.isEmpty())
repeatText = event.repetitionText(true);
if (event.repeatAtLogin())
@@ -480,10 +480,10 @@ AlarmListViewItem::AlarmListViewItem(AlarmListView* parent, const KAEvent& event
/******************************************************************************
* Return the single line alarm summary text.
*/
-QString AlarmListViewItem::alarmText(const KAEvent& event) const
+TQString AlarmListViewItem::alarmText(const KAEvent& event) const
{
bool truncated;
- QString text = AlarmText::summary(event, 1, &truncated);
+ TQString text = AlarmText::summary(event, 1, &truncated);
mMessageTruncated = truncated;
return text;
}
@@ -491,23 +491,23 @@ QString AlarmListViewItem::alarmText(const KAEvent& event) const
/******************************************************************************
* Return the alarm time text in the form "date time".
*/
-QString AlarmListViewItem::alarmTimeText(const DateTime& dateTime) const
+TQString AlarmListViewItem::alarmTimeText(const DateTime& dateTime) const
{
KLocale* locale = KGlobal::locale();
- QString dateTimeText = locale->formatDate(dateTime.date(), true);
+ TQString dateTimeText = locale->formatDate(dateTime.date(), true);
if (!dateTime.isDateOnly())
{
dateTimeText += ' ';
- QString time = locale->formatTime(dateTime.time());
+ TQString time = locale->formatTime(dateTime.time());
if (mTimeHourPos == -2)
{
// Initialise the position of the hour within the time string, if leading
// zeroes are omitted, so that displayed times can be aligned with each other.
mTimeHourPos = -1; // default = alignment isn't possible/sensible
- if (!QApplication::reverseLayout()) // don't try to align right-to-left languages
+ if (!TQApplication::reverseLayout()) // don't try to align right-to-left languages
{
- QString fmt = locale->timeFormat();
- int i = fmt.find(QRegExp("%[kl]")); // check if leading zeroes are omitted
+ TQString fmt = locale->timeFormat();
+ int i = fmt.find(TQRegExp("%[kl]")); // check if leading zeroes are omitted
if (i >= 0 && i == fmt.find('%')) // and whether the hour is first
mTimeHourPos = i; // yes, so need to align
}
@@ -523,10 +523,10 @@ QString AlarmListViewItem::alarmTimeText(const DateTime& dateTime) const
/******************************************************************************
* Return the time-to-alarm text.
*/
-QString AlarmListViewItem::timeToAlarmText(const QDateTime& now) const
+TQString AlarmListViewItem::timeToAlarmText(const TQDateTime& now) const
{
if (event().expired())
- return QString::null;
+ return TQString::null;
DateTime dateTime = event().displayDateTime();
if (dateTime.isDateOnly())
{
@@ -535,7 +535,7 @@ QString AlarmListViewItem::timeToAlarmText(const QDateTime& now) const
}
int mins = (now.secsTo(dateTime.dateTime()) + 59) / 60;
if (mins < 0)
- return QString::null;
+ return TQString::null;
char minutes[3] = "00";
minutes[0] = (mins%60) / 10 + '0';
minutes[1] = (mins%60) % 10 + '0';
@@ -551,19 +551,19 @@ QString AlarmListViewItem::timeToAlarmText(const QDateTime& now) const
* The updated value is only displayed if it is different from the existing value,
* or if 'forceDisplay' is true.
*/
-void AlarmListViewItem::updateTimeToAlarm(const QDateTime& now, bool forceDisplay)
+void AlarmListViewItem::updateTimeToAlarm(const TQDateTime& now, bool forceDisplay)
{
if (event().expired())
{
if (forceDisplay || mTimeToAlarmShown)
{
- setText(alarmListView()->column(AlarmListView::TIME_TO_COLUMN), QString::null);
+ setText(alarmListView()->column(AlarmListView::TIME_TO_COLUMN), TQString::null);
mTimeToAlarmShown = false;
}
}
else
{
- QString tta = timeToAlarmText(now);
+ TQString tta = timeToAlarmText(now);
if (forceDisplay || tta != text(alarmListView()->column(AlarmListView::TIME_TO_COLUMN)))
setText(alarmListView()->column(AlarmListView::TIME_TO_COLUMN), tta);
mTimeToAlarmShown = !tta.isNull();
@@ -573,14 +573,14 @@ void AlarmListViewItem::updateTimeToAlarm(const QDateTime& now, bool forceDispla
/******************************************************************************
* Paint one value in one of the columns in the list view.
*/
-void AlarmListViewItem::paintCell(QPainter* painter, const QColorGroup& cg, int column, int width, int /*align*/)
+void AlarmListViewItem::paintCell(TQPainter* painter, const TQColorGroup& cg, int column, int width, int /*align*/)
{
const AlarmListView* listView = alarmListView();
int margin = listView->itemMargin();
- QRect box(margin, margin, width - margin*2, height() - margin*2); // area within which to draw
+ TQRect box(margin, margin, width - margin*2, height() - margin*2); // area within which to draw
bool selected = isSelected();
- QColor bgColour = selected ? cg.highlight() : cg.base();
- QColor fgColour = selected ? cg.highlightedText()
+ TQColor bgColour = selected ? cg.highlight() : cg.base();
+ TQColor fgColour = selected ? cg.highlightedText()
: !event().enabled() ? Preferences::disabledColour()
: event().expired() ? Preferences::expiredColour() : cg.text();
painter->setPen(fgColour);
@@ -589,7 +589,7 @@ void AlarmListViewItem::paintCell(QPainter* painter, const QColorGroup& cg, int
if (column == listView->column(AlarmListView::TIME_COLUMN))
{
int i = -1;
- QString str = text(column);
+ TQString str = text(column);
if (mTimeHourPos >= 0)
{
// Need to pad out spacing to align times without leading zeroes
@@ -598,7 +598,7 @@ void AlarmListViewItem::paintCell(QPainter* painter, const QColorGroup& cg, int
{
if (mDigitWidth < 0)
mDigitWidth = painter->fontMetrics().width("0");
- QString date = str.left(i + 1);
+ TQString date = str.left(i + 1);
int w = painter->fontMetrics().width(date) + mDigitWidth;
painter->drawText(box, AlignVCenter, date);
box.setLeft(box.left() + w);
@@ -621,15 +621,15 @@ void AlarmListViewItem::paintCell(QPainter* painter, const QColorGroup& cg, int
else if (column == listView->column(AlarmListView::TYPE_COLUMN))
{
// Display the alarm type icon, horizontally and vertically centred in the cell
- QPixmap* pixmap = eventIcon();
- QRect pixmapRect = pixmap->rect();
+ TQPixmap* pixmap = eventIcon();
+ TQRect pixmapRect = pixmap->rect();
int diff = box.height() - pixmap->height();
if (diff < 0)
{
pixmapRect.setTop(-diff / 2);
pixmapRect.setHeight(box.height());
}
- QPoint iconTopLeft(box.left() + (box.width() - pixmapRect.width()) / 2,
+ TQPoint iconTopLeft(box.left() + (box.width() - pixmapRect.width()) / 2,
box.top() + (diff > 0 ? diff / 2 : 0));
painter->drawPixmap(iconTopLeft, *pixmap, pixmapRect);
}
@@ -641,7 +641,7 @@ void AlarmListViewItem::paintCell(QPainter* painter, const QColorGroup& cg, int
painter->setBackgroundColor(event().bgColour());
// painter->setPen(event().fgColour());
}
- QString txt = text(column);
+ TQString txt = text(column);
painter->drawText(box, AlignVCenter, txt);
mMessageColWidth = listView->fontMetrics().boundingRect(txt).width();
}
@@ -652,13 +652,13 @@ void AlarmListViewItem::paintCell(QPainter* painter, const QColorGroup& cg, int
*/
int AlarmListViewItem::typeIconWidth(AlarmListView* v)
{
- return iconWidth() + 2 * v->style().pixelMetric(QStyle::PM_DefaultFrameWidth);
+ return iconWidth() + 2 * v->style().pixelMetric(TQStyle::PM_DefaultFrameWidth);
}
/******************************************************************************
* Return the column sort order for one item in the list.
*/
-QString AlarmListViewItem::key(int column, bool) const
+TQString AlarmListViewItem::key(int column, bool) const
{
AlarmListView* listView = alarmListView();
if (column == listView->column(AlarmListView::TIME_COLUMN)
@@ -682,7 +682,7 @@ QString AlarmListViewItem::key(int column, bool) const
/******************************************************************************
* Displays the full alarm text in a tooltip, if not all the text is displayed.
*/
-void AlarmListTooltip::maybeTip(const QPoint& pt)
+void AlarmListTooltip::maybeTip(const TQPoint& pt)
{
AlarmListView* listView = (AlarmListView*)parentWidget()->parentWidget();
int column = listView->column(AlarmListView::MESSAGE_COLUMN);
@@ -700,7 +700,7 @@ void AlarmListTooltip::maybeTip(const QPoint& pt)
if (columnX + widthNeeded <= listView->viewport()->width())
return;
}
- QRect rect = listView->itemRect(item);
+ TQRect rect = listView->itemRect(item);
rect.setLeft(columnX);
rect.setWidth(columnWidth);
kdDebug(5950) << "AlarmListTooltip::maybeTip(): display\n";