author | zautrix <zautrix> | 2005-06-19 08:37:29 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-19 08:37:29 (UTC) |
commit | 862c536aec16f9ae02ae81b8487ec13edd014ccc (patch) (unidiff) | |
tree | cdef3fde19950299dc025cfa33c365fb9dada1d9 | |
parent | 98f69fd81c23d99d9fe80326d4bc4d3af23e18ec (diff) | |
download | kdepimpi-862c536aec16f9ae02ae81b8487ec13edd014ccc.zip kdepimpi-862c536aec16f9ae02ae81b8487ec13edd014ccc.tar.gz kdepimpi-862c536aec16f9ae02ae81b8487ec13edd014ccc.tar.bz2 |
fixx
-rw-r--r-- | korganizer/kodaymatrix.cpp | 6 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 35 |
2 files changed, 25 insertions, 16 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 30efbf6..3468657 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -874,130 +874,130 @@ void KODayMatrix::dropEvent(QDropEvent *e) | |||
874 | start.setDate(days[idx]); | 874 | start.setDate(days[idx]); |
875 | end.setDate(days[idx].addDays(duration)); | 875 | end.setDate(days[idx].addDays(duration)); |
876 | 876 | ||
877 | event->setDtStart(start); | 877 | event->setDtStart(start); |
878 | event->setDtEnd(end); | 878 | event->setDtEnd(end); |
879 | mCalendar->addEvent(event); | 879 | mCalendar->addEvent(event); |
880 | 880 | ||
881 | emit eventDropped(event); | 881 | emit eventDropped(event); |
882 | } else { | 882 | } else { |
883 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; | 883 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; |
884 | e->ignore(); | 884 | e->ignore(); |
885 | } | 885 | } |
886 | #endif | 886 | #endif |
887 | } | 887 | } |
888 | 888 | ||
889 | // ---------------------------------------------------------------------------- | 889 | // ---------------------------------------------------------------------------- |
890 | // P A I N T E V E N T H A N D L I N G | 890 | // P A I N T E V E N T H A N D L I N G |
891 | // ---------------------------------------------------------------------------- | 891 | // ---------------------------------------------------------------------------- |
892 | 892 | ||
893 | void KODayMatrix::paintEvent(QPaintEvent * pevent) | 893 | void KODayMatrix::paintEvent(QPaintEvent * pevent) |
894 | { | 894 | { |
895 | 895 | ||
896 | if ( width() <= 0 || height() <= 0 ) | 896 | if ( width() <= 0 || height() <= 0 ) |
897 | return; | 897 | return; |
898 | if ( mPendingUpdateBeforeRepaint ) { | 898 | if ( mPendingUpdateBeforeRepaint ) { |
899 | updateViewTimed(); | 899 | updateViewTimed(); |
900 | mPendingUpdateBeforeRepaint = false; | 900 | mPendingUpdateBeforeRepaint = false; |
901 | } | 901 | } |
902 | #if 0 | 902 | #if 0 |
903 | if ( myPix.width() != width() || myPix.height()!=height() ) { | 903 | if ( myPix.width() != width() || myPix.height()!=height() ) { |
904 | myPix.resize(size() ); | 904 | myPix.resize(size() ); |
905 | mRedrawNeeded = true; | 905 | mRedrawNeeded = true; |
906 | } | 906 | } |
907 | #endif | 907 | #endif |
908 | if ( oldW != width() || oldH !=height() ) | 908 | if ( oldW != width() || oldH !=height() ) |
909 | mRedrawNeeded = true; | 909 | mRedrawNeeded = true; |
910 | 910 | ||
911 | oldH = height() ; | 911 | oldH = height() ; |
912 | oldW = width(); | 912 | oldW = width(); |
913 | if ( myPix.width() < width() || myPix.height() < height() ) { | 913 | if ( myPix.width() < width() || myPix.height() < height() ) { |
914 | myPix.resize(size() ); | 914 | myPix.resize(size() ); |
915 | mRedrawNeeded = true; | 915 | mRedrawNeeded = true; |
916 | 916 | ||
917 | } | 917 | } |
918 | 918 | ||
919 | if ( mRedrawNeeded ) { | 919 | if ( mRedrawNeeded ) { |
920 | //qDebug("REDRAW "); | 920 | //qDebug("REDRAW "); |
921 | QPainter p(&myPix); | 921 | QPainter p(&myPix); |
922 | p.setFont(font()); | 922 | p.setFont(font()); |
923 | 923 | ||
924 | 924 | ||
925 | int dheight = daysize.height(); | 925 | int dheight = daysize.height(); |
926 | int dwidth = daysize.width(); | 926 | int dwidth = daysize.width(); |
927 | int row,col; | 927 | int row,col; |
928 | int selw, selh; | 928 | int selw, selh; |
929 | int xyOff = frameWidth(); | 929 | int xyOff = frameWidth(); |
930 | int colModulo = (width()-2) % 7; | 930 | int colModulo = (width()-2) % 7; |
931 | int rowModulo = (height()-2) % 6; | 931 | int rowModulo = (height()-2) % 6; |
932 | //qDebug("col %d row %d ",colModulo,rowModulo ); | 932 | //qDebug("col %d row %d ",colModulo,rowModulo ); |
933 | 933 | ||
934 | bool isRTL = KOGlobals::self()->reverseLayout(); | 934 | bool isRTL = KOGlobals::self()->reverseLayout(); |
935 | 935 | ||
936 | // draw background and topleft frame | 936 | // draw background and topleft frame |
937 | p.fillRect(0,0,width(),height(), mDefaultBackColor); | 937 | p.fillRect(0,0,width(),height(), mDefaultBackColor); |
938 | p.setPen(mDefaultTextColor); | 938 | //p.setPen(mDefaultTextColor); |
939 | p.drawRect(0, 0, width(), height()); | 939 | //p.drawRect(0, 0, width(), height()); |
940 | int mSelStartT = mSelStart; | 940 | int mSelStartT = mSelStart; |
941 | int mSelEndT = mSelEnd; | 941 | int mSelEndT = mSelEnd; |
942 | if ( mSelEndT >= NUMDAYS ) | 942 | if ( mSelEndT >= NUMDAYS ) |
943 | mSelEndT = NUMDAYS-1; | 943 | mSelEndT = NUMDAYS-1; |
944 | // draw selected days with highlighted background color | 944 | // draw selected days with highlighted background color |
945 | if (mSelStart != NOSELECTION) { | 945 | if (mSelStart != NOSELECTION) { |
946 | bool skip = false; | 946 | bool skip = false; |
947 | if ( ! mouseDown ) { | 947 | if ( ! mouseDown ) { |
948 | int mo = days[20].month(); | 948 | int mo = days[20].month(); |
949 | //qDebug("-- %d %d ", mSelStartT, mSelEndT); | 949 | //qDebug("-- %d %d ", mSelStartT, mSelEndT); |
950 | //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); | 950 | //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); |
951 | int startMo = days[mSelStartT].month(); | 951 | int startMo = days[mSelStartT].month(); |
952 | int endMo = days[mSelEndT].month(); | 952 | int endMo = days[mSelEndT].month(); |
953 | if ( startMo == 12 && mo == 1 && endMo <= 2 ) | 953 | if ( startMo == 12 && mo == 1 && endMo <= 2 ) |
954 | startMo = 1; | 954 | startMo = 1; |
955 | if ( endMo == 1 && mo == 12 ) | 955 | if ( endMo == 1 && mo == 12 ) |
956 | endMo = 12; | 956 | endMo = 12; |
957 | if ( mo == 12 && startMo == 1 ) | 957 | if ( mo == 12 && startMo == 1 ) |
958 | startMo = 13; | 958 | startMo = 13; |
959 | if ( (startMo > mo || endMo < mo) ) { | 959 | if ( (startMo > mo || endMo < mo) ) { |
960 | skip = true; | 960 | skip = true; |
961 | } else { | 961 | } else { |
962 | if ( days[mSelStartT].month() != mo ) { | 962 | if ( days[mSelStartT].month() != mo ) { |
963 | int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); | 963 | int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); |
964 | mSelStartT += add +1; | 964 | mSelStartT += add +1; |
965 | } | 965 | } |
966 | if ( days[mSelEndT].month() != mo ) { | 966 | if ( days[mSelEndT].month() != mo ) { |
967 | int sub = days[mSelEndT].day(); | 967 | int sub = days[mSelEndT].day(); |
968 | mSelEndT -= sub ; | 968 | mSelEndT -= sub ; |
969 | } | 969 | } |
970 | } | 970 | } |
971 | } | 971 | } |
972 | //qDebug("SKIP %d ", skip); | 972 | //qDebug("SKIP %d ", skip); |
973 | if ( ! skip ) { | 973 | if ( ! skip ) { |
974 | row = mSelStartT/7; | 974 | row = mSelStartT/7; |
975 | col = mSelStartT -row*7; | 975 | col = mSelStartT -row*7; |
976 | QColor selcol = KOPrefs::instance()->mHighlightColor; | 976 | QColor selcol = KOPrefs::instance()->mHighlightColor; |
977 | int addCol = 0; | 977 | int addCol = 0; |
978 | int addRow = 0; | 978 | int addRow = 0; |
979 | int addRow2 = 0; | 979 | int addRow2 = 0; |
980 | int addCol2 = 0; | 980 | int addCol2 = 0; |
981 | if (row == mSelEndT/7) { | 981 | if (row == mSelEndT/7) { |
982 | if ( rowModulo ) { | 982 | if ( rowModulo ) { |
983 | if ( row >= 6 - rowModulo ) | 983 | if ( row >= 6 - rowModulo ) |
984 | addRow = row - 5 + rowModulo; | 984 | addRow = row - 5 + rowModulo; |
985 | } | 985 | } |
986 | if ( colModulo ) { | 986 | if ( colModulo ) { |
987 | int colt1 = mSelEndT%7; | 987 | int colt1 = mSelEndT%7; |
988 | //qDebug("colt1 %d ", colt1 ); | 988 | //qDebug("colt1 %d ", colt1 ); |
989 | if ( colt1 >= 7 - colModulo ) | 989 | if ( colt1 >= 7 - colModulo ) |
990 | addCol = colt1 - 7 + colModulo+1; | 990 | addCol = colt1 - 7 + colModulo+1; |
991 | int colt = mSelStartT%7; | 991 | int colt = mSelStartT%7; |
992 | if ( colt >= 7 - colModulo ) | 992 | if ( colt >= 7 - colModulo ) |
993 | addCol2 = colt - 7 + colModulo; | 993 | addCol2 = colt - 7 + colModulo; |
994 | addCol -= addCol2; | 994 | addCol -= addCol2; |
995 | //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); | 995 | //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); |
996 | } | 996 | } |
997 | // Single row selection | 997 | // Single row selection |
998 | //if ( row == 0) | 998 | //if ( row == 0) |
999 | // addRow = 1; | 999 | // addRow = 1; |
1000 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, | 1000 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, |
1001 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); | 1001 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); |
1002 | } else { | 1002 | } else { |
1003 | // draw first row to the right | 1003 | // draw first row to the right |
@@ -1111,93 +1111,95 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
1111 | addCol += 1; | 1111 | addCol += 1; |
1112 | if ( row == 0 ) | 1112 | if ( row == 0 ) |
1113 | addRow = 1; | 1113 | addRow = 1; |
1114 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth+1, dheight+1); | 1114 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth+1, dheight+1); |
1115 | p.setPen(tmppen); | 1115 | p.setPen(tmppen); |
1116 | } | 1116 | } |
1117 | 1117 | ||
1118 | // if any events are on that day then draw it using a bold font | 1118 | // if any events are on that day then draw it using a bold font |
1119 | if ( eDays.testBit(i) ) { | 1119 | if ( eDays.testBit(i) ) { |
1120 | QFont myFont = font(); | 1120 | QFont myFont = font(); |
1121 | myFont.setBold(true); | 1121 | myFont.setBold(true); |
1122 | p.setFont(myFont); | 1122 | p.setFont(myFont); |
1123 | } | 1123 | } |
1124 | 1124 | ||
1125 | // if it is a holiday then use the default holiday color | 1125 | // if it is a holiday then use the default holiday color |
1126 | if ( pDays.testBit(i)) { | 1126 | if ( pDays.testBit(i)) { |
1127 | if ( bDays.testBit(i) ) { | 1127 | if ( bDays.testBit(i) ) { |
1128 | if ( hDays.testBit(i) ) | 1128 | if ( hDays.testBit(i) ) |
1129 | p.setPen(QColor(0,200,0)); | 1129 | p.setPen(QColor(0,200,0)); |
1130 | else | 1130 | else |
1131 | p.setPen(QColor(Qt::blue)); | 1131 | p.setPen(QColor(Qt::blue)); |
1132 | } else { | 1132 | } else { |
1133 | if (actcol == mDefaultTextColor ) { | 1133 | if (actcol == mDefaultTextColor ) { |
1134 | p.setPen(KOPrefs::instance()->mHolidayColor); | 1134 | p.setPen(KOPrefs::instance()->mHolidayColor); |
1135 | } else { | 1135 | } else { |
1136 | p.setPen(mHolidayColorShaded); | 1136 | p.setPen(mHolidayColorShaded); |
1137 | } | 1137 | } |
1138 | } | 1138 | } |
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | // draw selected days with special color | 1141 | // draw selected days with special color |
1142 | // DO NOT specially highlight holidays in selection ! | 1142 | // DO NOT specially highlight holidays in selection ! |
1143 | if (i >= mSelStartT && i <= mSelEndT) { | 1143 | if (i >= mSelStartT && i <= mSelEndT) { |
1144 | ;//p.setPen(mSelectedDaysColor); | 1144 | ;//p.setPen(mSelectedDaysColor); |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | int addCol = 0; | 1147 | int addCol = 0; |
1148 | int addRow = 0; | 1148 | int addRow = 0; |
1149 | if ( colModulo ) { | 1149 | if ( colModulo ) { |
1150 | if ( col >= 7 - colModulo ) | 1150 | if ( col >= 7 - colModulo ) |
1151 | addCol = col - 7 + colModulo; | 1151 | addCol = col - 7 + colModulo; |
1152 | } | 1152 | } |
1153 | if ( rowModulo ) { | 1153 | if ( rowModulo ) { |
1154 | if ( row >= 6 - rowModulo ) | 1154 | if ( row >= 6 - rowModulo ) |
1155 | addRow = row - 5 + rowModulo; | 1155 | addRow = row - 5 + rowModulo; |
1156 | } | 1156 | } |
1157 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); | 1157 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); |
1158 | ++addCol;//++addCol; | 1158 | ++addCol;//++addCol; |
1159 | if ( row == 0) | 1159 | if ( row == 0) |
1160 | addRow = 1; | 1160 | addRow = 1; |
1161 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, | 1161 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, |
1162 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 1162 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
1163 | 1163 | ||
1164 | // reset color to actual color | 1164 | // reset color to actual color |
1165 | if (pDays.testBit(i)) { | 1165 | if (pDays.testBit(i)) { |
1166 | p.setPen(actcol); | 1166 | p.setPen(actcol); |
1167 | } | 1167 | } |
1168 | // reset bold font to plain font | 1168 | // reset bold font to plain font |
1169 | if ( eDays.testBit(i)) { | 1169 | if ( eDays.testBit(i)) { |
1170 | QFont myFont = font(); | 1170 | QFont myFont = font(); |
1171 | myFont.setBold(false); | 1171 | myFont.setBold(false); |
1172 | p.setFont(myFont); | 1172 | p.setFont(myFont); |
1173 | } | 1173 | } |
1174 | } | 1174 | } |
1175 | p.setPen(mDefaultTextColor); | ||
1176 | p.drawRect(0, 0, width(), height()); | ||
1175 | } else { | 1177 | } else { |
1176 | //qDebug("NO redraw "); | 1178 | //qDebug("NO redraw "); |
1177 | } | 1179 | } |
1178 | 1180 | ||
1179 | bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,CopyROP); | 1181 | bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,CopyROP); |
1180 | mRedrawNeeded = false; | 1182 | mRedrawNeeded = false; |
1181 | } | 1183 | } |
1182 | 1184 | ||
1183 | // ---------------------------------------------------------------------------- | 1185 | // ---------------------------------------------------------------------------- |
1184 | // R E SI Z E E V E N T H A N D L I N G | 1186 | // R E SI Z E E V E N T H A N D L I N G |
1185 | // ---------------------------------------------------------------------------- | 1187 | // ---------------------------------------------------------------------------- |
1186 | 1188 | ||
1187 | void KODayMatrix::resizeEvent(QResizeEvent *) | 1189 | void KODayMatrix::resizeEvent(QResizeEvent *) |
1188 | { | 1190 | { |
1189 | QRect sz = frameRect(); | 1191 | QRect sz = frameRect(); |
1190 | daysize.setHeight(sz.height()*7 / NUMDAYS); | 1192 | daysize.setHeight(sz.height()*7 / NUMDAYS); |
1191 | daysize.setWidth(sz.width() / 7); | 1193 | daysize.setWidth(sz.width() / 7); |
1192 | } | 1194 | } |
1193 | 1195 | ||
1194 | QSize KODayMatrix::sizeHint() const | 1196 | QSize KODayMatrix::sizeHint() const |
1195 | { | 1197 | { |
1196 | 1198 | ||
1197 | QFontMetrics fm ( font() ); | 1199 | QFontMetrics fm ( font() ); |
1198 | int wid = fm.width( "30") *7+3; | 1200 | int wid = fm.width( "30") *7+3; |
1199 | int hei = fm.height() * 6+3; | 1201 | int hei = fm.height() * 6+3; |
1200 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); | 1202 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); |
1201 | return QSize ( wid, hei ); | 1203 | return QSize ( wid, hei ); |
1202 | 1204 | ||
1203 | } | 1205 | } |
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index bb88386..ea53043 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -168,201 +168,208 @@ void KOCalEditView::selectStdCal( int id, bool b ) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | void KOCalEditView::selectCalAlarm(int id ,bool b ) | 170 | void KOCalEditView::selectCalAlarm(int id ,bool b ) |
171 | { | 171 | { |
172 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; | 172 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; |
173 | emit alarmEnabled ( id , b ); | 173 | emit alarmEnabled ( id , b ); |
174 | emit needsUpdate(); | 174 | emit needsUpdate(); |
175 | } | 175 | } |
176 | void KOCalEditView::selectReadOnly(int id ,bool b ) | 176 | void KOCalEditView::selectReadOnly(int id ,bool b ) |
177 | { | 177 | { |
178 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; | 178 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; |
179 | emit calendarReadonly ( id , b ); | 179 | emit calendarReadonly ( id , b ); |
180 | if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { | 180 | if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { |
181 | KOPrefs::instance()->getCalendar( id )->isStandard = false; | 181 | KOPrefs::instance()->getCalendar( id )->isStandard = false; |
182 | KOPrefs::instance()->getCalendar( 1 )->isStandard = true; | 182 | KOPrefs::instance()->getCalendar( 1 )->isStandard = true; |
183 | emit setCalendarDefault ( 1 ); | 183 | emit setCalendarDefault ( 1 ); |
184 | } | 184 | } |
185 | emit needsUpdate(); | 185 | emit needsUpdate(); |
186 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 186 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
187 | 187 | ||
188 | } | 188 | } |
189 | void KOCalEditView::setColor( const QColor& c, int id ) | 189 | void KOCalEditView::setColor( const QColor& c, int id ) |
190 | { | 190 | { |
191 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; | 191 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; |
192 | emit needsUpdate(); | 192 | emit needsUpdate(); |
193 | } | 193 | } |
194 | void KOCalEditView::deleteCal( int id ) | 194 | void KOCalEditView::deleteCal( int id ) |
195 | { | 195 | { |
196 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); | 196 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); |
197 | QString name = kkf->mName; | 197 | QString name = kkf->mName; |
198 | QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); | 198 | QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); |
199 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; | 199 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; |
200 | if ( kkf->isStandard ) | 200 | if ( kkf->isStandard ) |
201 | selectStdCal( 1, true ); | 201 | selectStdCal( 1, true ); |
202 | emit removeCalendar ( id ); | 202 | emit removeCalendar ( id ); |
203 | KOPrefs::instance()->mCalendars.remove ( kkf ); | 203 | KOPrefs::instance()->mCalendars.remove ( kkf ); |
204 | emit needsUpdate(); | 204 | emit needsUpdate(); |
205 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 205 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
206 | } | 206 | } |
207 | void KOCalEditView::infoCal( int id ) | 207 | void KOCalEditView::infoCal( int id ) |
208 | { | 208 | { |
209 | QString name = KOPrefs::instance()->getCalendar( id )->mName; | 209 | QString name = KOPrefs::instance()->getCalendar( id )->mName; |
210 | QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); | 210 | QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); |
211 | if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { | 211 | if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { |
212 | if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { | 212 | if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { |
213 | emit calendarAdded( id ); | 213 | emit calendarAdded( id ); |
214 | emit needsUpdate(); | 214 | emit needsUpdate(); |
215 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 215 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | else | 218 | else |
219 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); | 219 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); |
220 | } | 220 | } |
221 | void KOCalEditView::readConfig() | 221 | void KOCalEditView::readConfig() |
222 | { | 222 | { |
223 | 223 | ||
224 | mStdandardB.clear(); | 224 | mStdandardB.clear(); |
225 | mEnabledB.clear(); | 225 | mEnabledB.clear(); |
226 | mAlarmB.clear(); | 226 | mAlarmB.clear(); |
227 | mROB.clear(); | 227 | mROB.clear(); |
228 | 228 | ||
229 | if ( mw ) delete mw; | 229 | if ( mw ) delete mw; |
230 | mw = new QWidget ( viewport() ); | 230 | mw = new QWidget ( viewport() ); |
231 | addChild(mw); | 231 | addChild(mw); |
232 | 232 | int ii = 0; | |
233 | mainLayout = new QGridLayout ( mw , 2, 8 ); | 233 | mainLayout = new QGridLayout ( mw , 2, 8 ); |
234 | mainLayout->setMargin( 3); | 234 | mainLayout->setMargin( 2 ); |
235 | mainLayout->setSpacing( 2); | 235 | mainLayout->setSpacing( 2 ); |
236 | QPushButton * addBut = new QPushButton ( mw ); | 236 | QPushButton * addBut = new QPushButton ( mw ); |
237 | addBut->setFocusPolicy(NoFocus); | 237 | addBut->setFocusPolicy(NoFocus); |
238 | mainLayout->addWidget( addBut,0,0 ); | 238 | mainLayout->addWidget( addBut,0,0 ); |
239 | addBut->setPixmap ( SmallIcon("plus")); | 239 | addBut->setPixmap ( SmallIcon("plus")); |
240 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); | 240 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); |
241 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 241 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
242 | 242 | int max = addBut->sizeHint().height(); | |
243 | addBut = new QPushButton ( mw ); | 243 | addBut = new QPushButton ( mw ); |
244 | addBut->setFocusPolicy(NoFocus); | 244 | addBut->setFocusPolicy(NoFocus); |
245 | mainLayout->addWidget( addBut,0,1 ); | 245 | mainLayout->addWidget( addBut,0,++ii ); |
246 | addBut->setPixmap ( SmallIcon("eye")); | 246 | addBut->setPixmap ( SmallIcon("eye")); |
247 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); | 247 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); |
248 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 248 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
249 | 249 | ||
250 | QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); | 250 | QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); |
251 | mainLayout->addWidget( lab,0,2 ); | 251 | mainLayout->addWidget( lab,0,++ii ); |
252 | lab = new QLabel ( i18n(" "), mw ); | 252 | //lab = new QLabel ( i18n(" "), mw ); |
253 | mainLayout->addWidget( lab,0,3 ); | 253 | //mainLayout->addWidget( lab,0,++ii ); |
254 | lab->setFixedWidth( 6 ); | 254 | //lab->setFixedWidth( 1 ); |
255 | addBut = new QPushButton ( mw ); | 255 | addBut = new QPushButton ( mw ); |
256 | addBut->setFocusPolicy(NoFocus); | 256 | addBut->setFocusPolicy(NoFocus); |
257 | mainLayout->addWidget( addBut,0,4 ); | 257 | mainLayout->addWidget( addBut,0,++ii ); |
258 | addBut->setPixmap ( SmallIcon("bell")); | 258 | addBut->setPixmap ( SmallIcon("bell")); |
259 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); | 259 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); |
260 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 260 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
261 | 261 | ||
262 | addBut = new QPushButton ( mw ); | 262 | addBut = new QPushButton ( mw ); |
263 | addBut->setFocusPolicy(NoFocus); | 263 | addBut->setFocusPolicy(NoFocus); |
264 | mainLayout->addWidget( addBut,0,5 ); | 264 | mainLayout->addWidget( addBut,0,++ii ); |
265 | addBut->setPixmap ( SmallIcon("pencil")); | 265 | addBut->setPixmap ( SmallIcon("pencil")); |
266 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); | 266 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); |
267 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 267 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
268 | 268 | ||
269 | lab = new QLabel ( i18n(" Color "), mw ); | 269 | lab = new QLabel ( i18n(" Color "), mw ); |
270 | mainLayout->addWidget( lab,0,6 ); | 270 | mainLayout->addWidget( lab,0,++ii ); |
271 | lab = new QLabel ( "", mw ); | ||
272 | mainLayout->addWidget( lab,0,++ii ); | ||
273 | lab->setMaximumWidth( max+4 ); | ||
274 | lab = new QLabel ( "", mw ); | ||
275 | mainLayout->addWidget( lab,0,++ii ); | ||
276 | |||
277 | |||
271 | #if 0 | 278 | #if 0 |
272 | addBut = new QPushButton ( mw ); | 279 | addBut = new QPushButton ( mw ); |
273 | mainLayout->addWidget( addBut,0,6 ); | 280 | mainLayout->addWidget( addBut,0,6 ); |
274 | addBut->setPixmap ( SmallIcon("minus")); | 281 | addBut->setPixmap ( SmallIcon("minus")); |
275 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); | 282 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); |
276 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 283 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
277 | #endif | 284 | #endif |
278 | 285 | ||
279 | 286 | ||
280 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 287 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
281 | int row = 1; | 288 | int row = 1; |
282 | while ( kkf ) { | 289 | while ( kkf ) { |
283 | int iii = 0; | 290 | int iii = 0; |
284 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); | 291 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); |
285 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); | 292 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); |
286 | cb->setChecked( kkf->isStandard ); | 293 | cb->setChecked( kkf->isStandard ); |
287 | cb->setNum( kkf->mCalNumber ); | 294 | cb->setNum( kkf->mCalNumber ); |
288 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); | 295 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); |
289 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 296 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
290 | cb->setEnabled( false ); | 297 | cb->setEnabled( false ); |
291 | cb = new KOCalCheckButton( mw ); | 298 | cb = new KOCalCheckButton( mw ); |
292 | mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); | 299 | mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); |
293 | cb->setChecked( kkf->isEnabled ); | 300 | cb->setChecked( kkf->isEnabled ); |
294 | cb->setNum( kkf->mCalNumber ); | 301 | cb->setNum( kkf->mCalNumber ); |
295 | if ( kkf->mErrorOnLoad ) | 302 | if ( kkf->mErrorOnLoad ) |
296 | cb->setEnabled( false ); | 303 | cb->setEnabled( false ); |
297 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); | 304 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); |
298 | KOCalButton* name = new KOCalButton( mw ); | 305 | KOCalButton* name = new KOCalButton( mw ); |
299 | name->setNum( kkf->mCalNumber ); | 306 | name->setNum( kkf->mCalNumber ); |
300 | name->setText( kkf->mName ); | 307 | name->setText( kkf->mName ); |
301 | mainLayout->addWidget( name,row,++iii ); | 308 | mainLayout->addWidget( name,row,++iii ); |
302 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); | 309 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); |
303 | lab = new QLabel ( i18n(" "), mw ); | 310 | //lab = new QLabel (" ", mw ); |
304 | mainLayout->addWidget( lab,row,++iii ); | 311 | //mainLayout->addWidget( lab,row,++iii ); |
305 | cb = new KOCalCheckButton( mw ); | 312 | cb = new KOCalCheckButton( mw ); |
306 | mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); | 313 | mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); |
307 | cb->setChecked( kkf->isAlarmEnabled ); | 314 | cb->setChecked( kkf->isAlarmEnabled ); |
308 | cb->setNum( kkf->mCalNumber ); | 315 | cb->setNum( kkf->mCalNumber ); |
309 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); | 316 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); |
310 | if ( kkf->mErrorOnLoad ) | 317 | if ( kkf->mErrorOnLoad ) |
311 | cb->setEnabled( false ); | 318 | cb->setEnabled( false ); |
312 | cb = new KOCalCheckButton( mw ); | 319 | cb = new KOCalCheckButton( mw ); |
313 | mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); | 320 | mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); |
314 | cb->setChecked( kkf->isReadOnly ); | 321 | cb->setChecked( kkf->isReadOnly ); |
315 | cb->setNum( kkf->mCalNumber ); | 322 | cb->setNum( kkf->mCalNumber ); |
316 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); | 323 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); |
317 | if ( kkf->mErrorOnLoad ) | 324 | if ( kkf->mErrorOnLoad ) |
318 | cb->setEnabled( false ); | 325 | cb->setEnabled( false ); |
319 | if ( row > 1) { | 326 | if ( row > 1) { |
320 | KColorButton *colb = new KColorButton( mw ); | 327 | KColorButton *colb = new KColorButton( mw ); |
321 | mainLayout->addWidget( colb,row,++iii ); | 328 | mainLayout->addWidget( colb,row,++iii ); |
322 | colb->setID( kkf->mCalNumber ); | 329 | colb->setID( kkf->mCalNumber ); |
323 | colb->setColor( kkf->mDefaultColor ); | 330 | colb->setColor( kkf->mDefaultColor ); |
324 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); | 331 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); |
325 | KOCalButton* calb = new KOCalButton( mw ); | 332 | KOCalButton* calb = new KOCalButton( mw ); |
326 | mainLayout->addWidget( calb,row,++iii ); | 333 | mainLayout->addWidget( calb,row,++iii ); |
327 | calb->setNum( kkf->mCalNumber ); | 334 | calb->setNum( kkf->mCalNumber ); |
328 | calb->setPixmap ( SmallIcon("minus")); | 335 | calb->setPixmap ( SmallIcon("minus")); |
329 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 336 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
330 | int hei = calb->sizeHint().height(); | 337 | int hei = calb->sizeHint().height(); |
331 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); | 338 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
332 | } | 339 | } |
333 | ++row; | 340 | ++row; |
334 | kkf = KOPrefs::instance()->mCalendars.next(); | 341 | kkf = KOPrefs::instance()->mCalendars.next(); |
335 | } | 342 | } |
336 | lab = new QLabel ( "", mw ); | 343 | lab = new QLabel ( "", mw ); |
337 | mainLayout->addWidget( lab,row,0 ); | 344 | mainLayout->addWidget( lab,row,0 ); |
338 | mw->show(); | 345 | mw->show(); |
339 | 346 | ||
340 | } | 347 | } |
341 | void KOCalEditView::addCal() | 348 | void KOCalEditView::addCal() |
342 | { | 349 | { |
343 | bool tryagain = true; | 350 | bool tryagain = true; |
344 | QString name, file; | 351 | QString name, file; |
345 | while ( tryagain ) { | 352 | while ( tryagain ) { |
346 | KONewCalPrefs prefs ( this ); | 353 | KONewCalPrefs prefs ( this ); |
347 | prefs.nameE->setText( name ); | 354 | prefs.nameE->setText( name ); |
348 | prefs.url->setURL( file ); | 355 | prefs.url->setURL( file ); |
349 | if ( ! prefs.exec() ) | 356 | if ( ! prefs.exec() ) |
350 | return; | 357 | return; |
351 | name = prefs.calName(); | 358 | name = prefs.calName(); |
352 | file = prefs.calFileName(); | 359 | file = prefs.calFileName(); |
353 | tryagain = false; | 360 | tryagain = false; |
354 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 361 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
355 | while ( kkf ) { | 362 | while ( kkf ) { |
356 | if ( kkf->mName == name ) { | 363 | if ( kkf->mName == name ) { |
357 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); | 364 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); |
358 | name = ""; | 365 | name = ""; |
359 | tryagain = true; | 366 | tryagain = true; |
360 | break; | 367 | break; |
361 | } | 368 | } |
362 | if ( kkf->mFileName == file ) { | 369 | if ( kkf->mFileName == file ) { |
363 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); | 370 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); |
364 | tryagain = true; | 371 | tryagain = true; |
365 | file = ""; | 372 | file = ""; |
366 | break; | 373 | break; |
367 | } | 374 | } |
368 | kkf = KOPrefs::instance()->mCalendars.next(); | 375 | kkf = KOPrefs::instance()->mCalendars.next(); |