-rw-r--r-- | korganizer/timespanview.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/korganizer/timespanview.cpp b/korganizer/timespanview.cpp index df8ff88..0908056 100644 --- a/korganizer/timespanview.cpp +++ b/korganizer/timespanview.cpp | |||
@@ -1,111 +1,115 @@ | |||
1 | 1 | ||
2 | #ifndef DESKTOP_VERSION | 2 | #ifndef DESKTOP_VERSION |
3 | #include <qksplitter.h> | 3 | #include <qksplitter.h> |
4 | #else | 4 | #else |
5 | #include <qsplitter.h> | 5 | #include <qsplitter.h> |
6 | #endif | 6 | #endif |
7 | #include <qlistview.h> | 7 | #include <q3listview.h> |
8 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | #include <qheader.h> | 9 | #include <q3header.h> |
10 | #include <qpushbutton.h> | 10 | #include <qpushbutton.h> |
11 | //Added by qt3to4: | ||
12 | #include <Q3HBoxLayout> | ||
13 | #include <Q3VBoxLayout> | ||
14 | #include <Q3ValueList> | ||
11 | 15 | ||
12 | #include <klocale.h> | 16 | #include <klocale.h> |
13 | #include <kdebug.h> | 17 | #include <kdebug.h> |
14 | 18 | ||
15 | #include "lineview.h" | 19 | #include "lineview.h" |
16 | #include "timeline.h" | 20 | #include "timeline.h" |
17 | 21 | ||
18 | #include "timespanview.h" | 22 | #include "timespanview.h" |
19 | 23 | ||
20 | 24 | ||
21 | TimeSpanView::TimeSpanView( QWidget *parent, const char *name ) : | 25 | TimeSpanView::TimeSpanView( QWidget *parent, const char *name ) : |
22 | QWidget( parent, name ) | 26 | QWidget( parent, name ) |
23 | { | 27 | { |
24 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 28 | Q3BoxLayout *topLayout = new Q3VBoxLayout( this ); |
25 | #ifndef DESKTOP_VERSION | 29 | #ifndef DESKTOP_VERSION |
26 | mSplitter = new QKSplitter( this ); | 30 | mSplitter = new QKSplitter( this ); |
27 | #else | 31 | #else |
28 | mSplitter = new QSplitter( this ); | 32 | mSplitter = new QSplitter( this ); |
29 | #endif | 33 | #endif |
30 | topLayout->addWidget( mSplitter ); | 34 | topLayout->addWidget( mSplitter ); |
31 | 35 | ||
32 | mList = new QListView( mSplitter ); | 36 | mList = new Q3ListView( mSplitter ); |
33 | mList->addColumn( i18n("Summary") ); | 37 | mList->addColumn( i18n("Summary") ); |
34 | 38 | ||
35 | QWidget *rightPane = new QWidget( mSplitter ); | 39 | QWidget *rightPane = new QWidget( mSplitter ); |
36 | QBoxLayout *rightPaneLayout = new QVBoxLayout( rightPane ); | 40 | Q3BoxLayout *rightPaneLayout = new Q3VBoxLayout( rightPane ); |
37 | 41 | ||
38 | mTimeLine = new TimeLine( rightPane ); | 42 | mTimeLine = new TimeLine( rightPane ); |
39 | mTimeLine->setFixedHeight( mList->header()->height() ); | 43 | mTimeLine->setFixedHeight( mList->header()->height() ); |
40 | rightPaneLayout->addWidget( mTimeLine ); | 44 | rightPaneLayout->addWidget( mTimeLine ); |
41 | 45 | ||
42 | mLineView = new LineView( rightPane ); | 46 | mLineView = new LineView( rightPane ); |
43 | rightPaneLayout->addWidget( mLineView ); | 47 | rightPaneLayout->addWidget( mLineView ); |
44 | 48 | ||
45 | QBoxLayout *buttonLayout = new QHBoxLayout( rightPaneLayout ); | 49 | Q3BoxLayout *buttonLayout = new Q3HBoxLayout( rightPaneLayout ); |
46 | 50 | ||
47 | QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane ); | 51 | QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane ); |
48 | connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) ); | 52 | connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) ); |
49 | buttonLayout->addWidget( zoomInButton ); | 53 | buttonLayout->addWidget( zoomInButton ); |
50 | 54 | ||
51 | QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane ); | 55 | QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane ); |
52 | connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) ); | 56 | connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) ); |
53 | buttonLayout->addWidget( zoomOutButton ); | 57 | buttonLayout->addWidget( zoomOutButton ); |
54 | 58 | ||
55 | QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane ); | 59 | QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane ); |
56 | connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) ); | 60 | connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) ); |
57 | buttonLayout->addWidget( centerButton ); | 61 | buttonLayout->addWidget( centerButton ); |
58 | 62 | ||
59 | connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)), | 63 | connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)), |
60 | mTimeLine,SLOT(setContentsPos(int))); | 64 | mTimeLine,SLOT(setContentsPos(int))); |
61 | } | 65 | } |
62 | 66 | ||
63 | TimeSpanView::~TimeSpanView() | 67 | TimeSpanView::~TimeSpanView() |
64 | { | 68 | { |
65 | } | 69 | } |
66 | 70 | ||
67 | QValueList<int> TimeSpanView::splitterSizes() | 71 | Q3ValueList<int> TimeSpanView::splitterSizes() |
68 | { | 72 | { |
69 | return mSplitter->sizes(); | 73 | return mSplitter->sizes(); |
70 | } | 74 | } |
71 | 75 | ||
72 | void TimeSpanView::setSplitterSizes( QValueList<int> sizes ) | 76 | void TimeSpanView::setSplitterSizes( Q3ValueList<int> sizes ) |
73 | { | 77 | { |
74 | mSplitter->setSizes( sizes ); | 78 | mSplitter->setSizes( sizes ); |
75 | } | 79 | } |
76 | 80 | ||
77 | void TimeSpanView::addItem( KCal::Event *event ) | 81 | void TimeSpanView::addItem( KCal::Event *event ) |
78 | { | 82 | { |
79 | new QListViewItem( mList, event->summary() ); | 83 | new Q3ListViewItem( mList, event->summary() ); |
80 | 84 | ||
81 | QDateTime startDt = event->dtStart(); | 85 | QDateTime startDt = event->dtStart(); |
82 | QDateTime endDt = event->dtEnd(); | 86 | QDateTime endDt = event->dtEnd(); |
83 | 87 | ||
84 | // kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString() | 88 | // kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString() |
85 | // << " end: " << endDt.toString() << endl; | 89 | // << " end: " << endDt.toString() << endl; |
86 | 90 | ||
87 | int startSecs = mStartDate.secsTo( startDt ); | 91 | int startSecs = mStartDate.secsTo( startDt ); |
88 | int durationSecs = startDt.secsTo( endDt ); | 92 | int durationSecs = startDt.secsTo( endDt ); |
89 | 93 | ||
90 | // kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl; | 94 | // kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl; |
91 | 95 | ||
92 | int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel; | 96 | int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel; |
93 | int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel; | 97 | int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel; |
94 | 98 | ||
95 | // kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl; | 99 | // kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl; |
96 | 100 | ||
97 | mLineView->addLine( startX, endX ); | 101 | mLineView->addLine( startX, endX ); |
98 | } | 102 | } |
99 | 103 | ||
100 | void TimeSpanView::clear() | 104 | void TimeSpanView::clear() |
101 | { | 105 | { |
102 | mList->clear(); | 106 | mList->clear(); |
103 | mLineView->clear(); | 107 | mLineView->clear(); |
104 | } | 108 | } |
105 | 109 | ||
106 | void TimeSpanView::updateView() | 110 | void TimeSpanView::updateView() |
107 | { | 111 | { |
108 | #if QT_VERSION >= 0x030000 | 112 | #if QT_VERSION >= 0x030000 |
109 | mLineView->updateContents(); | 113 | mLineView->updateContents(); |
110 | mTimeLine->updateContents(); | 114 | mTimeLine->updateContents(); |
111 | #else | 115 | #else |