[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: [Kde-pim] [PATCH] RTL Language Issues In KOrganizer - Bugs #40725, 41693
From: Meni Livne <livne () kde ! org>
Date: 2002-05-02 9:14:34
[Download RAW message or body]
Greetings,
The attached patch should fix most of the problems described in bugs #40725
and #41693 (the first one was reported by me a few weeks ago). These two talk
the same problem - KOrganizer in KDE 3.0 is practically unusable with RTL
languages (Arabic, Hebrew etc.). You can see for yourself by running
korganizer --reverse and seeing what a mess it causes with events.
It seems to work well, however there still seem to be problems with moving and
resizing of all-day events, but at least it's better that the current
situation, in which KOrganizer is practically unusable with these languages.
As an added bonus, the patch fixes some minor issues with the direction of the
[previous|next][day|month|year] arrows when KOrganizer's in reverse layout.
Now, if nobody objects, I shall go on committing this to the _BRANCH, and then
forward-port it to HEAD.
Regards.
["korganizer_rtl.patch" (text/x-diff)]
Index: kodaymatrix.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/kodaymatrix.cpp,v
retrieving revision 1.11.2.1
diff -u -r1.11.2.1 kodaymatrix.cpp
--- kodaymatrix.cpp 2002/04/16 21:09:25 1.11.2.1
+++ kodaymatrix.cpp 2002/05/02 08:52:03
@@ -279,7 +279,8 @@
int KODayMatrix::getDayIndexFrom(int x, int y)
{
- return 7*(y/daysize.height()) + x/daysize.width();
+ return 7*(y/daysize.height()) + (QApplication::reverseLayout() ?
+ 6 - x/daysize.width() : x/daysize.width());
}
// ----------------------------------------------------------------------------
@@ -448,6 +449,7 @@
int dwidth = daysize.width();
int row,col;
int selw, selh;
+ bool isRTL = QApplication::reverseLayout();
// draw background and topleft frame
p.fillRect(pevent->rect(), mDefaultBackColor);
@@ -463,10 +465,12 @@
if (row == mSelEnd/7) {
// Single row selection
- p.fillRect(col*dwidth, row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol);
+ p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth,
+ row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol);
} else {
// draw first row to the right
- p.fillRect(col*dwidth, row*dheight, (7-col)*dwidth, dheight, selcol);
+ p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth,
+ dheight, selcol);
// draw full block till last line
selh = mSelEnd/7-row;
if (selh > 1) {
@@ -474,7 +478,8 @@
}
// draw last block from left to mSelEnd
selw = mSelEnd-7*(mSelEnd/7)+1;
- p.fillRect(0, (row+selh)*dheight, selw*dwidth, dheight, selcol);
+ p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight,
+ selw*dwidth, dheight, selcol);
}
}
@@ -484,7 +489,7 @@
QPen tmppen;
for(int i = 0; i < NUMDAYS; i++) {
row = i/7;
- col = i-row*7;
+ col = isRTL ? 6-(i-row*7) : i-row*7;
// if it is the first day of a month switch color from normal to shaded and vice versa
if (days[i].day() == 1) {
Index: koagenda.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koagenda.cpp,v
retrieving revision 1.39.2.1
diff -u -r1.39.2.1 koagenda.cpp
--- koagenda.cpp 2002/04/27 11:15:44 1.39.2.1
+++ koagenda.cpp 2002/05/02 08:51:45
@@ -81,7 +81,8 @@
int col = 0;
for(it = dateList.begin(); it != dateList.end(); ++it) {
if((*it) == currentDate)
- return col;
+ return QApplication::reverseLayout() ?
+ agenda->columns() - 1 - col : col;
++col;
}
@@ -763,7 +764,8 @@
*/
void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy)
{
- gx = x/mGridSpacingX;
+ gx = QApplication::reverseLayout() ? mColumns - 1 - x/mGridSpacingX :
+ x/mGridSpacingX;
gy = y/mGridSpacingY;
}
@@ -772,7 +774,8 @@
*/
void KOAgenda::gridToContents (int gx, int gy, int& x, int& y)
{
- x = gx*mGridSpacingX;
+ x = QApplication::reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX:
+ gx*mGridSpacingX;
y = gy*mGridSpacingY;
}
@@ -970,8 +973,10 @@
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
subCellWidth = mGridSpacingY / item->subCells();
item->resize(mGridSpacingX * item->cellWidth(),subCellWidth);
- moveChild(item,item->cellX() * mGridSpacingX,
- item->subCell() * subCellWidth);
+ moveChild(item,QApplication::reverseLayout() ?
+ (mColumns - 1 - item->cellX()) * mGridSpacingX :
+ item->cellX() * mGridSpacingX,
+ item->subCell() * subCellWidth);
}
} else {
mGridSpacingX = (width() - verticalScrollBar()->width())/mColumns;
@@ -982,8 +987,10 @@
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
subCellWidth = mGridSpacingX / item->subCells();
item->resize(subCellWidth,item->height());
- moveChild(item,item->cellX() * mGridSpacingX +
- item->subCell() * subCellWidth,childY(item));
+ moveChild(item,(QApplication::reverseLayout() ?
+ (mColumns - 1 - item->cellX()) * mGridSpacingX :
+ item->cellX() * mGridSpacingX) +
+ item->subCell() * subCellWidth,childY(item));
}
}
Index: koagendaview.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koagendaview.cpp,v
retrieving revision 1.64.2.1
diff -u -r1.64.2.1 koagendaview.cpp
--- koagendaview.cpp 2002/04/16 20:38:12 1.64.2.1
+++ koagendaview.cpp 2002/05/02 08:51:54
@@ -219,7 +219,9 @@
for(i=0;i<mColumns;++i) {
if (mEnabled[i]) {
int cellWidth = contentsRect().right()/mColumns;
- int xOffset = i*cellWidth + cellWidth/2 -mPixmap.width()/2;
+ int xOffset = QApplication::reverseLayout() ?
+ (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
+ i*cellWidth + cellWidth/2 -mPixmap.width()/2;
p->drawPixmap(QPoint(xOffset,0),mPixmap);
}
}
@@ -253,12 +255,14 @@
mDayLabelsFrame = 0;
mDayLabels = 0;
+ bool isRTL = QApplication::reverseLayout();
+
if ( KOPrefs::instance()->mVerticalScreen ) {
mExpandedPixmap = SmallIcon( "1downarrow" );
mNotExpandedPixmap = SmallIcon( "1uparrow" );
} else {
- mExpandedPixmap = SmallIcon( "1rightarrow" );
- mNotExpandedPixmap = SmallIcon( "1leftarrow" );
+ mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" );
+ mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" );
}
QBoxLayout *topLayout = new QVBoxLayout(this);
Index: kdatenav.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/kdatenav.cpp,v
retrieving revision 1.81
diff -u -r1.81 kdatenav.cpp
--- kdatenav.cpp 2002/01/21 19:21:58 1.81
+++ kdatenav.cpp 2002/05/02 08:51:35
@@ -73,22 +73,24 @@
tfont.setPointSize(10);
tfont.setBold(FALSE);
+ bool isRTL = QApplication::reverseLayout();
+
// Create backward navigation buttons
prevYear = new QPushButton(ctrlFrame);
- prevYear->setPixmap(SmallIcon("2leftarrow"));
+ prevYear->setPixmap(SmallIcon(isRTL ? "2rightarrow" : "2leftarrow"));
QToolTip::add(prevYear, i18n("Previous Year"));
prevMonth = new QPushButton(ctrlFrame);
- prevMonth->setPixmap(SmallIcon("1leftarrow"));
+ prevMonth->setPixmap(SmallIcon(isRTL ? "1rightarrow" : "1leftarrow"));
QToolTip::add(prevMonth, i18n("Previous Month"));
// Create forward navigation buttons
nextMonth = new QPushButton(ctrlFrame);
- nextMonth->setPixmap(SmallIcon("1rightarrow"));
+ nextMonth->setPixmap(SmallIcon(isRTL ? "1leftarrow" : "1rightarrow"));
QToolTip::add(nextMonth, i18n("Next Month"));
nextYear = new QPushButton(ctrlFrame);
- nextYear->setPixmap(SmallIcon("2rightarrow"));
+ nextYear->setPixmap(SmallIcon(isRTL ? "2leftarrow" : "2rightarrow"));
QToolTip::add(nextYear, i18n("Next Year"));
// Create month name label
Index: korganizer.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizer.cpp,v
retrieving revision 1.102.2.1
diff -u -r1.102.2.1 korganizer.cpp
--- korganizer.cpp 2002/04/27 11:15:44 1.102.2.1
+++ korganizer.cpp 2002/05/02 08:52:14
@@ -413,11 +413,12 @@
*/
// Navigation menu
+ bool isRTL = QApplication::reverseLayout();
(void)new KAction(i18n("Go to &Today"), "today", 0,
mCalendarView,SLOT(goToday()),
actionCollection(), "go_today");
- action = new KAction(i18n("Go &Backward"), "1leftarrow", 0,
+ action = new KAction(i18n("Go &Backward"), isRTL ? "1rightarrow" : "1leftarrow", 0,
mCalendarView,SLOT(goPrevious()),
actionCollection(), "go_previous");
@@ -429,7 +430,7 @@
connect(mCalendarView,SIGNAL(changeNavStringPrev(const QString &)),
this,SLOT(dumpText(const QString &)));
*/
- action = new KAction(i18n("Go &Forward"), "1rightarrow", 0,
+ action = new KAction(i18n("Go &Forward"), isRTL ? "1leftarrow" : "1rightarrow", 0,
mCalendarView,SLOT(goNext()),
actionCollection(), "go_next");
/*
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic