summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-05 12:44:31 (UTC)
committer zautrix <zautrix>2005-04-05 12:44:31 (UTC)
commite1fd021493c30106d2a31449d620ab6eaf96f18f (patch) (unidiff)
tree95667bbee29f5913c7c2e70dd9ba80356432c351
parent854e1b46d7895bf4860d914abb5f1e954dfbfe6a (diff)
downloadkdepimpi-e1fd021493c30106d2a31449d620ab6eaf96f18f.zip
kdepimpi-e1fd021493c30106d2a31449d620ab6eaf96f18f.tar.gz
kdepimpi-e1fd021493c30106d2a31449d620ab6eaf96f18f.tar.bz2
font point fix + versionupdate
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--desktop/rpm/kdepim_rpm2
-rw-r--r--korganizer/mainwindow.cpp4
-rw-r--r--microkde/ofontselector.cpp3
-rw-r--r--version2
4 files changed, 6 insertions, 5 deletions
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm
index 5e7783b..af64b99 100644
--- a/desktop/rpm/kdepim_rpm
+++ b/desktop/rpm/kdepim_rpm
@@ -1,84 +1,84 @@
1Summary: A collection of PIM programs 1Summary: A collection of PIM programs
2Name: KDE-Pim-Pi 2Name: KDE-Pim-Pi
3Version: 2.0.24 3Version: 2.0.25
4Release: SuSE_9.2 4Release: SuSE_9.2
5Copyright:GPL 5Copyright:GPL
6Group: Productivity/Pim 6Group: Productivity/Pim
7Source:http://sourceforge.net/projects/kdepimpi/ 7Source:http://sourceforge.net/projects/kdepimpi/
8URL:http://sourceforge.net/projects/kdepimpi/ 8URL:http://sourceforge.net/projects/kdepimpi/
9Packager: zautrix 9Packager: zautrix
10 10
11%description 11%description
12This package contains the platform-independent PIM programs from 12This package contains the platform-independent PIM programs from
13www.pi-sync.info, compiled for SuSE 9.2: 13www.pi-sync.info, compiled for SuSE 9.2:
14KTimeTacker/Pi 14KTimeTacker/Pi
15KPhone/Pi 15KPhone/Pi
16KAddressbook/Pi 16KAddressbook/Pi
17KOrganizer/Pi 17KOrganizer/Pi
18PasswordManager/Pi 18PasswordManager/Pi
19KOPieMail/Pi 19KOPieMail/Pi
20 20
21These applications do not need anything from the KDE-desktop 21These applications do not need anything from the KDE-desktop
22at all to run on Linux. However, there is a dependency from 22at all to run on Linux. However, there is a dependency from
23two KDE libs, because a small command line program is included 23two KDE libs, because a small command line program is included
24to make it possible to sync with the KDE-desktop applications. 24to make it possible to sync with the KDE-desktop applications.
25 25
26These applications are independent from the KDE-desktop 26These applications are independent from the KDE-desktop
27environment. That means, nothing of your existing 27environment. That means, nothing of your existing
28KDE-desktop setup will be changed, or any data 28KDE-desktop setup will be changed, or any data
29(calendar-addressbook) used by the KDE-desktop 29(calendar-addressbook) used by the KDE-desktop
30applications will be changed or accessed. 30applications will be changed or accessed.
31These applications stores their data and config in 31These applications stores their data and config in
32$HOME/kdepim/ 32$HOME/kdepim/
33However, because the same file format is used, 33However, because the same file format is used,
34an easy exchange of data with the KDE-desktop 34an easy exchange of data with the KDE-desktop
35is possible. 35is possible.
36A small command line program is included 36A small command line program is included
37to make it possible to sync with the KDE-desktop applications. 37to make it possible to sync with the KDE-desktop applications.
38You do not need to call this program from the commandline, 38You do not need to call this program from the commandline,
39it is called from the KDE-Pim/Pi apps when you choose there: 39it is called from the KDE-Pim/Pi apps when you choose there:
40Sync with KDE_Desktop. 40Sync with KDE_Desktop.
41If something is going wrong, please start the 41If something is going wrong, please start the
42KDE-Pim/Pi program itself from the console to get detailed output. 42KDE-Pim/Pi program itself from the console to get detailed output.
43 43
44After installation, you should have a 44After installation, you should have a
45PIM-pi 45PIM-pi
46folder in your KDE start menu, where you can 46folder in your KDE start menu, where you can
47start the applications from. 47start the applications from.
48 48
49These programs makes it possible to sync your Zaurus easily 49These programs makes it possible to sync your Zaurus easily
50(with the KDE-Pim/Pi programs running on the Zaurus) 50(with the KDE-Pim/Pi programs running on the Zaurus)
51with the KDE-desktop calendar/addressbook data. 51with the KDE-desktop calendar/addressbook data.
52If you want to use that, you have to update your 52If you want to use that, you have to update your
53KDE-desktop to version 3.3.0 or higher. 53KDE-desktop to version 3.3.0 or higher.
54SuSE 9.2 contains KDE 3.3.0 such that no update is needed. 54SuSE 9.2 contains KDE 3.3.0 such that no update is needed.
55Actually - after the (non difficult) configuration is set up - 55Actually - after the (non difficult) configuration is set up -
56with two mouseklicks on the Zaurus, 56with two mouseklicks on the Zaurus,
57the Zaurus syncs with the corresponding KDE-Pim/Pi 57the Zaurus syncs with the corresponding KDE-Pim/Pi
58program on the Linux Desktop which syncs automatically 58program on the Linux Desktop which syncs automatically
59with the KDE-desktop data. 59with the KDE-desktop data.
60 60
61If you want to use the KDE-desktop calendar/addressbook applications, 61If you want to use the KDE-desktop calendar/addressbook applications,
62just install these apps in this package and use them as a syncing tool for the 62just install these apps in this package and use them as a syncing tool for the
63Zaurus <-> KDE-desktop sync. 63Zaurus <-> KDE-desktop sync.
64The sync requires a network connection from your Zaurus to 64The sync requires a network connection from your Zaurus to
65the PC. A detailed Sync HowTo is available in the 65the PC. A detailed Sync HowTo is available in the
66Help menu of the applications. 66Help menu of the applications.
67 67
68These applications makes it also possible, that you can sync 68These applications makes it also possible, that you can sync
69(or just export the data to) your mobile phone with your 69(or just export the data to) your mobile phone with your
70data of the KDE-desktop calendar/addressbook applications. 70data of the KDE-desktop calendar/addressbook applications.
71This is tested and working for Nokia mobile phones, 71This is tested and working for Nokia mobile phones,
72it may work with others as well. 72it may work with others as well.
73(More info about that: -> Sync HowTo) 73(More info about that: -> Sync HowTo)
74 74
75NOTE: 75NOTE:
76When using SuSE 9.1 you have to update your KDE to 3.3.x 76When using SuSE 9.1 you have to update your KDE to 3.3.x
77and you have to make an online update in SuSE 9.1 to make it 77and you have to make an online update in SuSE 9.1 to make it
78possible to get the infrared connection working, such that 78possible to get the infrared connection working, such that
79you can sync your (Nokia) mobile phone via infrared. 79you can sync your (Nokia) mobile phone via infrared.
80 80
81%files 81%files
82/opt/kde3/share/applnk/PIM-pi/ 82/opt/kde3/share/applnk/PIM-pi/
83/opt/kdepimpi/ 83/opt/kdepimpi/
84/usr/lib/libmicro* 84/usr/lib/libmicro*
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7aa3b60..9505d06 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1415,1033 +1415,1033 @@ void MainWindow::synchowto()
1415} 1415}
1416void MainWindow::faq() 1416void MainWindow::faq()
1417{ 1417{
1418 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1418 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1419 1419
1420} 1420}
1421void MainWindow::whatsNew() 1421void MainWindow::whatsNew()
1422{ 1422{
1423 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1423 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1424 1424
1425} 1425}
1426void MainWindow::licence() 1426void MainWindow::licence()
1427{ 1427{
1428 KApplication::showLicence(); 1428 KApplication::showLicence();
1429 1429
1430} 1430}
1431void MainWindow::about() 1431void MainWindow::about()
1432{ 1432{
1433 QString version; 1433 QString version;
1434#include <../version> 1434#include <../version>
1435 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1435 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1436 i18n("KOrganizer/Platform-independent\n") + 1436 i18n("KOrganizer/Platform-independent\n") +
1437 "(KO/Pi) " + version + " - " + 1437 "(KO/Pi) " + version + " - " +
1438 1438
1439#ifdef DESKTOP_VERSION 1439#ifdef DESKTOP_VERSION
1440 i18n("Desktop Edition\n") + 1440 i18n("Desktop Edition\n") +
1441#else 1441#else
1442 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1442 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1443#endif 1443#endif
1444 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1444 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1445} 1445}
1446void MainWindow::keyBindings() 1446void MainWindow::keyBindings()
1447{ 1447{
1448 QString cap = i18n("KO/Pi Keys + Colors"); 1448 QString cap = i18n("KO/Pi Keys + Colors");
1449 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1449 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1450 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1450 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1451 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1451 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1452 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1452 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1453 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1453 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1454 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1454 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1455 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1455 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1456 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1456 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1457 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1457 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1458 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1458 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1459 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1459 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1460 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1460 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1461 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1461 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1462 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1462 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1463 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1463 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1464 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1464 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1465 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1465 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1466 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1466 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1467 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1467 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1468 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1468 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1469 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1469 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1470 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1470 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1471 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1471 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1472 i18n("<p><h3>In agenda view:</h3></p>\n") + 1472 i18n("<p><h3>In agenda view:</h3></p>\n") +
1473 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1473 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1474 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1474 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1475 i18n("<p><h3>In todo view:</h3></p>\n") + 1475 i18n("<p><h3>In todo view:</h3></p>\n") +
1476 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1476 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1477 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1477 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1478 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1478 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1479 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1479 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1480 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1480 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1481 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1481 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1482 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1482 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1483 i18n("<p><h3>In list view:</h3></p>\n") + 1483 i18n("<p><h3>In list view:</h3></p>\n") +
1484 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1484 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1485 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1485 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1486 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1486 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1487 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1487 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1488 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1488 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1489 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1489 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1490 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1490 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1491 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1491 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1492 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1492 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1493 i18n("<p><b>E</b>: Edit item</p>\n") + 1493 i18n("<p><b>E</b>: Edit item</p>\n") +
1494 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1494 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1495 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1495 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1496 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1496 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1497 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1497 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1498 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1498 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1499 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1499 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1500 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1500 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1501 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1501 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1502 i18n("<p><b>White</b>: Item readonly</p>\n"); 1502 i18n("<p><b>White</b>: Item readonly</p>\n");
1503 displayText( text, cap); 1503 displayText( text, cap);
1504} 1504}
1505void MainWindow::aboutAutoSaving() 1505void MainWindow::aboutAutoSaving()
1506{ 1506{
1507 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1507 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1508 1508
1509 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1509 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1510 1510
1511} 1511}
1512void MainWindow::aboutKnownBugs() 1512void MainWindow::aboutKnownBugs()
1513{ 1513{
1514 QMessageBox* msg; 1514 QMessageBox* msg;
1515 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1515 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1516 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1516 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1517 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1517 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1518 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1518 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1519 i18n("\nor report them in the bugtracker on\n") + 1519 i18n("\nor report them in the bugtracker on\n") +
1520 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1520 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1521 QMessageBox::NoIcon, 1521 QMessageBox::NoIcon,
1522 QMessageBox::Ok, 1522 QMessageBox::Ok,
1523 QMessageBox::NoButton, 1523 QMessageBox::NoButton,
1524 QMessageBox::NoButton); 1524 QMessageBox::NoButton);
1525 msg->exec(); 1525 msg->exec();
1526 delete msg; 1526 delete msg;
1527 1527
1528} 1528}
1529 1529
1530QString MainWindow::defaultFileName() 1530QString MainWindow::defaultFileName()
1531{ 1531{
1532 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1532 return locateLocal( "data", "korganizer/mycalendar.ics" );
1533} 1533}
1534QString MainWindow::syncFileName() 1534QString MainWindow::syncFileName()
1535{ 1535{
1536#ifdef DESKTOP_VERSION 1536#ifdef DESKTOP_VERSION
1537 return locateLocal( "tmp", "synccalendar.ics" ); 1537 return locateLocal( "tmp", "synccalendar.ics" );
1538#else 1538#else
1539 return QString( "/tmp/synccalendar.ics" ); 1539 return QString( "/tmp/synccalendar.ics" );
1540#endif 1540#endif
1541} 1541}
1542#include "koglobals.h" 1542#include "koglobals.h"
1543#include <kcalendarsystem.h> 1543#include <kcalendarsystem.h>
1544void MainWindow::updateWeek(QDate seda) 1544void MainWindow::updateWeek(QDate seda)
1545{ 1545{
1546 int weekNum = KGlobal::locale()->weekNum ( seda ); 1546 int weekNum = KGlobal::locale()->weekNum ( seda );
1547 mWeekPixmap.fill( mWeekBgColor ); 1547 mWeekPixmap.fill( mWeekBgColor );
1548 QPainter p ( &mWeekPixmap ); 1548 QPainter p ( &mWeekPixmap );
1549 p.setFont( mWeekFont ); 1549 p.setFont( mWeekFont );
1550 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1550 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1551 p.end(); 1551 p.end();
1552 QIconSet icon3 ( mWeekPixmap ); 1552 QIconSet icon3 ( mWeekPixmap );
1553 mWeekAction->setIconSet ( icon3 ); 1553 mWeekAction->setIconSet ( icon3 );
1554 1554
1555} 1555}
1556void MainWindow::updateWeekNum(const DateList &selectedDates) 1556void MainWindow::updateWeekNum(const DateList &selectedDates)
1557{ 1557{
1558 updateWeek( selectedDates.first() ); 1558 updateWeek( selectedDates.first() );
1559} 1559}
1560void MainWindow::processIncidenceSelection( Incidence *incidence ) 1560void MainWindow::processIncidenceSelection( Incidence *incidence )
1561{ 1561{
1562 1562
1563 if ( !incidence ) { 1563 if ( !incidence ) {
1564 enableIncidenceActions( false ); 1564 enableIncidenceActions( false );
1565 1565
1566 mNewSubTodoAction->setEnabled( false ); 1566 mNewSubTodoAction->setEnabled( false );
1567 setCaptionToDates(); 1567 setCaptionToDates();
1568 return; 1568 return;
1569 1569
1570 } 1570 }
1571 1571
1572 //KGlobal::locale()->formatDateTime(nextA, true); 1572 //KGlobal::locale()->formatDateTime(nextA, true);
1573 QString startString = ""; 1573 QString startString = "";
1574 if ( incidence->type() != "Todo" ) { 1574 if ( incidence->type() != "Todo" ) {
1575 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1575 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1576 if ( incidence->doesFloat() ) { 1576 if ( incidence->doesFloat() ) {
1577 startString += ": "+incidence->dtStartDateStr( true ); 1577 startString += ": "+incidence->dtStartDateStr( true );
1578 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1578 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1579 1579
1580 } else { 1580 } else {
1581 startString = ": "+incidence->dtStartStr(true); 1581 startString = ": "+incidence->dtStartStr(true);
1582 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1582 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1583 1583
1584 } 1584 }
1585 1585
1586 } else { 1586 } else {
1587 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1587 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1588 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1588 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1589 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1589 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1590 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1590 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1591 bool ok; 1591 bool ok;
1592 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1592 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1593 if ( ok ) { 1593 if ( ok ) {
1594 int years = noc.date().year() - incidence->dtStart().date().year(); 1594 int years = noc.date().year() - incidence->dtStart().date().year();
1595 startString += i18n(" (%1 y.)"). arg( years ); 1595 startString += i18n(" (%1 y.)"). arg( years );
1596 } 1596 }
1597 } 1597 }
1598 else 1598 else
1599 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1599 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1600 } 1600 }
1601 1601
1602 } 1602 }
1603 else 1603 else
1604 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1604 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1605 if ( !incidence->location().isEmpty() ) 1605 if ( !incidence->location().isEmpty() )
1606 startString += " (" +incidence->location()+")"; 1606 startString += " (" +incidence->location()+")";
1607 setCaption( incidence->summary()+startString); 1607 setCaption( incidence->summary()+startString);
1608 1608
1609 enableIncidenceActions( true ); 1609 enableIncidenceActions( true );
1610 1610
1611 if ( incidence->type() == "Event" ) { 1611 if ( incidence->type() == "Event" ) {
1612 mShowAction->setText( i18n("Show Event...") ); 1612 mShowAction->setText( i18n("Show Event...") );
1613 mEditAction->setText( i18n("Edit Event...") ); 1613 mEditAction->setText( i18n("Edit Event...") );
1614 mDeleteAction->setText( i18n("Delete Event...") ); 1614 mDeleteAction->setText( i18n("Delete Event...") );
1615 1615
1616 mNewSubTodoAction->setEnabled( false ); 1616 mNewSubTodoAction->setEnabled( false );
1617 } else if ( incidence->type() == "Todo" ) { 1617 } else if ( incidence->type() == "Todo" ) {
1618 mShowAction->setText( i18n("Show Todo...") ); 1618 mShowAction->setText( i18n("Show Todo...") );
1619 mEditAction->setText( i18n("Edit Todo...") ); 1619 mEditAction->setText( i18n("Edit Todo...") );
1620 mDeleteAction->setText( i18n("Delete Todo...") ); 1620 mDeleteAction->setText( i18n("Delete Todo...") );
1621 1621
1622 mNewSubTodoAction->setEnabled( true ); 1622 mNewSubTodoAction->setEnabled( true );
1623 } else { 1623 } else {
1624 mShowAction->setText( i18n("Show...") ); 1624 mShowAction->setText( i18n("Show...") );
1625 mShowAction->setText( i18n("Edit...") ); 1625 mShowAction->setText( i18n("Edit...") );
1626 mShowAction->setText( i18n("Delete...") ); 1626 mShowAction->setText( i18n("Delete...") );
1627 1627
1628 mNewSubTodoAction->setEnabled( false ); 1628 mNewSubTodoAction->setEnabled( false );
1629 } 1629 }
1630} 1630}
1631 1631
1632void MainWindow::enableIncidenceActions( bool enabled ) 1632void MainWindow::enableIncidenceActions( bool enabled )
1633{ 1633{
1634 mShowAction->setEnabled( enabled ); 1634 mShowAction->setEnabled( enabled );
1635 mEditAction->setEnabled( enabled ); 1635 mEditAction->setEnabled( enabled );
1636 mDeleteAction->setEnabled( enabled ); 1636 mDeleteAction->setEnabled( enabled );
1637 1637
1638 mCloneAction->setEnabled( enabled ); 1638 mCloneAction->setEnabled( enabled );
1639 mMoveAction->setEnabled( enabled ); 1639 mMoveAction->setEnabled( enabled );
1640 mBeamAction->setEnabled( enabled ); 1640 mBeamAction->setEnabled( enabled );
1641 mCancelAction->setEnabled( enabled ); 1641 mCancelAction->setEnabled( enabled );
1642} 1642}
1643 1643
1644void MainWindow::importOL() 1644void MainWindow::importOL()
1645{ 1645{
1646#ifdef _OL_IMPORT_ 1646#ifdef _OL_IMPORT_
1647 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1647 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1648 id->exec(); 1648 id->exec();
1649 delete id; 1649 delete id;
1650 mView->updateView(); 1650 mView->updateView();
1651#endif 1651#endif
1652} 1652}
1653void MainWindow::importBday() 1653void MainWindow::importBday()
1654{ 1654{
1655 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1655 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1656 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1656 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1657 i18n("Import!"), i18n("Cancel"), 0, 1657 i18n("Import!"), i18n("Cancel"), 0,
1658 0, 1 ); 1658 0, 1 );
1659 if ( result == 0 ) { 1659 if ( result == 0 ) {
1660 mView->importBday(); 1660 mView->importBday();
1661 1661
1662 } 1662 }
1663 1663
1664 1664
1665} 1665}
1666void MainWindow::importQtopia() 1666void MainWindow::importQtopia()
1667{ 1667{
1668 //#ifndef DESKTOP_VERSION 1668 //#ifndef DESKTOP_VERSION
1669 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1669 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1670#ifdef DESKTOP_VERSION 1670#ifdef DESKTOP_VERSION
1671 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1671 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1672#endif 1672#endif
1673 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1673 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1674 i18n("Import!"), i18n("Cancel"), 0, 1674 i18n("Import!"), i18n("Cancel"), 0,
1675 0, 1 ); 1675 0, 1 );
1676 if ( result == 0 ) { 1676 if ( result == 0 ) {
1677#ifndef DESKTOP_VERSION 1677#ifndef DESKTOP_VERSION
1678 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1678 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1679 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1679 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1680 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1680 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1681#else 1681#else
1682 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1682 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1683 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1683 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1684 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1684 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1685#endif 1685#endif
1686 mView->importQtopia( categories, datebook, todolist ); 1686 mView->importQtopia( categories, datebook, todolist );
1687 } 1687 }
1688#if 0 1688#if 0
1689 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1689 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1690 i18n("Not supported \non desktop!\n"), 1690 i18n("Not supported \non desktop!\n"),
1691 i18n("Ok"), i18n("Cancel"), 0, 1691 i18n("Ok"), i18n("Cancel"), 0,
1692 0, 1 ); 1692 0, 1 );
1693 1693
1694#endif 1694#endif
1695} 1695}
1696 1696
1697void MainWindow::saveOnClose() 1697void MainWindow::saveOnClose()
1698{ 1698{
1699 KOPrefs *p = KOPrefs::instance(); 1699 KOPrefs *p = KOPrefs::instance();
1700 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1700 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1701 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1701 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1702 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1702 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1703 if ( filterToolBar ) { 1703 if ( filterToolBar ) {
1704 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1704 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1705 } 1705 }
1706#ifdef DESKTOP_VERSION 1706#ifdef DESKTOP_VERSION
1707 1707
1708 QPoint myP; 1708 QPoint myP;
1709 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1709 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1710 if ( p->mToolBarHor ) 1710 if ( p->mToolBarHor )
1711 p->mToolBarUp = myP.y() > height()/2; 1711 p->mToolBarUp = myP.y() > height()/2;
1712 else 1712 else
1713 p->mToolBarUp = myP.x() > width()/2; 1713 p->mToolBarUp = myP.x() > width()/2;
1714 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1714 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1715 if ( p->mToolBarHorV ) 1715 if ( p->mToolBarHorV )
1716 p->mToolBarUpV = myP.y() > height()/2; 1716 p->mToolBarUpV = myP.y() > height()/2;
1717 else 1717 else
1718 p->mToolBarUpV = myP.x() > width()/2 ; 1718 p->mToolBarUpV = myP.x() > width()/2 ;
1719 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1719 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1720 if ( p->mToolBarHorN ) 1720 if ( p->mToolBarHorN )
1721 p->mToolBarUpN = myP.y() > height()/2; 1721 p->mToolBarUpN = myP.y() > height()/2;
1722 else 1722 else
1723 p->mToolBarUpN = myP.x() > width()/2 ; 1723 p->mToolBarUpN = myP.x() > width()/2 ;
1724 if ( filterToolBar ) { 1724 if ( filterToolBar ) {
1725 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1725 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1726 if ( p->mToolBarHorF ) 1726 if ( p->mToolBarHorF )
1727 p->mToolBarUpF = myP.y() > height()/2; 1727 p->mToolBarUpF = myP.y() > height()/2;
1728 else 1728 else
1729 p->mToolBarUpF = myP.x() > width()/2 ; 1729 p->mToolBarUpF = myP.x() > width()/2 ;
1730 } 1730 }
1731#else 1731#else
1732 if ( p->mToolBarHor ) 1732 if ( p->mToolBarHor )
1733 p->mToolBarUp = iconToolBar->y() > height()/2; 1733 p->mToolBarUp = iconToolBar->y() > height()/2;
1734 else 1734 else
1735 p->mToolBarUp = iconToolBar->x() > width()/2; 1735 p->mToolBarUp = iconToolBar->x() > width()/2;
1736 if ( p->mToolBarHorV ) 1736 if ( p->mToolBarHorV )
1737 p->mToolBarUpV = viewToolBar->y() > height()/2; 1737 p->mToolBarUpV = viewToolBar->y() > height()/2;
1738 else 1738 else
1739 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1739 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1740 1740
1741 if ( p->mToolBarHorN ) 1741 if ( p->mToolBarHorN )
1742 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1742 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1743 else 1743 else
1744 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1744 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1745 if ( filterToolBar ) { 1745 if ( filterToolBar ) {
1746 if ( p->mToolBarHorF ) 1746 if ( p->mToolBarHorF )
1747 p->mToolBarUpF = filterToolBar->y() > height()/2; 1747 p->mToolBarUpF = filterToolBar->y() > height()/2;
1748 else 1748 else
1749 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1749 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1750 } 1750 }
1751#endif 1751#endif
1752 1752
1753 1753
1754 mView->writeSettings(); 1754 mView->writeSettings();
1755 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1755 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1756 save(); 1756 save();
1757} 1757}
1758void MainWindow::slotModifiedChanged( bool changed ) 1758void MainWindow::slotModifiedChanged( bool changed )
1759{ 1759{
1760 if ( mBlockAtStartup ) 1760 if ( mBlockAtStartup )
1761 return; 1761 return;
1762 1762
1763 int msec; 1763 int msec;
1764 // we store the changes after 1 minute, 1764 // we store the changes after 1 minute,
1765 // and for safety reasons after 10 minutes again 1765 // and for safety reasons after 10 minutes again
1766 if ( !mSyncManager->blockSave() ) 1766 if ( !mSyncManager->blockSave() )
1767 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1767 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1768 else 1768 else
1769 msec = 1000 * 600; 1769 msec = 1000 * 600;
1770 mSaveTimer.start( msec, true ); // 1 minute 1770 mSaveTimer.start( msec, true ); // 1 minute
1771 qDebug("KO: Saving File in %d secs!", msec/1000); 1771 qDebug("KO: Saving File in %d secs!", msec/1000);
1772 mCalendarModifiedFlag = true; 1772 mCalendarModifiedFlag = true;
1773} 1773}
1774void MainWindow::saveStopTimer() 1774void MainWindow::saveStopTimer()
1775{ 1775{
1776 mSaveTimer.stop(); 1776 mSaveTimer.stop();
1777 if (mSaveTimer.isActive() ) 1777 if (mSaveTimer.isActive() )
1778 qDebug("ti active "); 1778 qDebug("ti active ");
1779 else 1779 else
1780 qDebug("KO: Save timer stopped"); 1780 qDebug("KO: Save timer stopped");
1781} 1781}
1782void MainWindow::save() 1782void MainWindow::save()
1783{ 1783{
1784 if ( !mCalendarModifiedFlag ) { 1784 if ( !mCalendarModifiedFlag ) {
1785 qDebug("KO: Calendar not modified. Nothing saved."); 1785 qDebug("KO: Calendar not modified. Nothing saved.");
1786 return; 1786 return;
1787 } 1787 }
1788 if ( mSyncManager->blockSave() ) 1788 if ( mSyncManager->blockSave() )
1789 return; 1789 return;
1790 mSyncManager->setBlockSave(true); 1790 mSyncManager->setBlockSave(true);
1791 if ( mView->checkFileVersion( defaultFileName()) ) { 1791 if ( mView->checkFileVersion( defaultFileName()) ) {
1792 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1792 QTime neededSaveTime = QDateTime::currentDateTime().time();
1793 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1793 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1794 qDebug("KO: Start saving data to file!"); 1794 qDebug("KO: Start saving data to file!");
1795 mView->saveCalendar( defaultFileName() ); 1795 mView->saveCalendar( defaultFileName() );
1796 mCalendarModifiedFlag = false; 1796 mCalendarModifiedFlag = false;
1797 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1797 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1798 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1798 qDebug("KO: Needed %d ms for saving.",msNeeded );
1799 QString savemes; 1799 QString savemes;
1800 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1800 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1801 setCaption(savemes); 1801 setCaption(savemes);
1802 } else 1802 } else
1803 setCaption(i18n("Saving cancelled!")); 1803 setCaption(i18n("Saving cancelled!"));
1804 mSyncManager->setBlockSave( false ); 1804 mSyncManager->setBlockSave( false );
1805} 1805}
1806 1806
1807void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1807void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1808{ 1808{
1809 if ( !e->isAutoRepeat() ) { 1809 if ( !e->isAutoRepeat() ) {
1810 mFlagKeyPressed = false; 1810 mFlagKeyPressed = false;
1811 } 1811 }
1812} 1812}
1813void MainWindow::keyPressEvent ( QKeyEvent * e ) 1813void MainWindow::keyPressEvent ( QKeyEvent * e )
1814{ 1814{
1815 qApp->processEvents(); 1815 qApp->processEvents();
1816 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1816 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1817 e->ignore(); 1817 e->ignore();
1818 // qDebug(" ignore %d",e->isAutoRepeat() ); 1818 // qDebug(" ignore %d",e->isAutoRepeat() );
1819 return; 1819 return;
1820 } 1820 }
1821 if (! e->isAutoRepeat() ) 1821 if (! e->isAutoRepeat() )
1822 mFlagKeyPressed = true; 1822 mFlagKeyPressed = true;
1823 KOPrefs *p = KOPrefs::instance(); 1823 KOPrefs *p = KOPrefs::instance();
1824 bool showSelectedDates = false; 1824 bool showSelectedDates = false;
1825 int size; 1825 int size;
1826 int pro = 0; 1826 int pro = 0;
1827 //qDebug("MainWindow::keyPressEvent "); 1827 //qDebug("MainWindow::keyPressEvent ");
1828 switch ( e->key() ) { 1828 switch ( e->key() ) {
1829 case Qt::Key_Right: 1829 case Qt::Key_Right:
1830 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1830 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1831 mView->goNextMonth(); 1831 mView->goNextMonth();
1832 else 1832 else
1833 mView->goNext(); 1833 mView->goNext();
1834 showSelectedDates = true; 1834 showSelectedDates = true;
1835 break; 1835 break;
1836 case Qt::Key_Left: 1836 case Qt::Key_Left:
1837 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1837 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1838 mView->goPreviousMonth(); 1838 mView->goPreviousMonth();
1839 else 1839 else
1840 mView->goPrevious(); 1840 mView->goPrevious();
1841 showSelectedDates = true; 1841 showSelectedDates = true;
1842 break; 1842 break;
1843 case Qt::Key_Down: 1843 case Qt::Key_Down:
1844 mView->viewManager()->agendaView()->scrollOneHourDown(); 1844 mView->viewManager()->agendaView()->scrollOneHourDown();
1845 break; 1845 break;
1846 case Qt::Key_Up: 1846 case Qt::Key_Up:
1847 mView->viewManager()->agendaView()->scrollOneHourUp(); 1847 mView->viewManager()->agendaView()->scrollOneHourUp();
1848 break; 1848 break;
1849 case Qt::Key_K: 1849 case Qt::Key_K:
1850 mView->viewManager()->showMonthViewWeek(); 1850 mView->viewManager()->showMonthViewWeek();
1851 break; 1851 break;
1852 case Qt::Key_I: 1852 case Qt::Key_I:
1853 mView->showIncidence(); 1853 mView->showIncidence();
1854 break; 1854 break;
1855 case Qt::Key_Delete: 1855 case Qt::Key_Delete:
1856 case Qt::Key_Backspace: 1856 case Qt::Key_Backspace:
1857 mView->deleteIncidence(); 1857 mView->deleteIncidence();
1858 break; 1858 break;
1859 case Qt::Key_D: 1859 case Qt::Key_D:
1860 mView->viewManager()->showDayView(); 1860 mView->viewManager()->showDayView();
1861 showSelectedDates = true; 1861 showSelectedDates = true;
1862 break; 1862 break;
1863 case Qt::Key_O: 1863 case Qt::Key_O:
1864 mView->toggleFilerEnabled( ); 1864 mView->toggleFilerEnabled( );
1865 break; 1865 break;
1866 case Qt::Key_0: 1866 case Qt::Key_0:
1867 case Qt::Key_1: 1867 case Qt::Key_1:
1868 case Qt::Key_2: 1868 case Qt::Key_2:
1869 case Qt::Key_3: 1869 case Qt::Key_3:
1870 case Qt::Key_4: 1870 case Qt::Key_4:
1871 case Qt::Key_5: 1871 case Qt::Key_5:
1872 case Qt::Key_6: 1872 case Qt::Key_6:
1873 case Qt::Key_7: 1873 case Qt::Key_7:
1874 case Qt::Key_8: 1874 case Qt::Key_8:
1875 case Qt::Key_9: 1875 case Qt::Key_9:
1876 pro = e->key()-48; 1876 pro = e->key()-48;
1877 if ( pro == 0 ) 1877 if ( pro == 0 )
1878 pro = 10; 1878 pro = 10;
1879 if ( e->state() == Qt::ControlButton) 1879 if ( e->state() == Qt::ControlButton)
1880 pro += 10; 1880 pro += 10;
1881 break; 1881 break;
1882 case Qt::Key_M: 1882 case Qt::Key_M:
1883 mView->viewManager()->showMonthView(); 1883 mView->viewManager()->showMonthView();
1884 showSelectedDates = true; 1884 showSelectedDates = true;
1885 break; 1885 break;
1886 case Qt::Key_Insert: 1886 case Qt::Key_Insert:
1887 mView->newEvent(); 1887 mView->newEvent();
1888 break; 1888 break;
1889 case Qt::Key_S : 1889 case Qt::Key_S :
1890 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1890 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1891 mView->newSubTodo(); 1891 mView->newSubTodo();
1892 else 1892 else
1893 mView->dialogManager()->showSearchDialog(); 1893 mView->dialogManager()->showSearchDialog();
1894 break; 1894 break;
1895 case Qt::Key_Y : 1895 case Qt::Key_Y :
1896 case Qt::Key_Z : 1896 case Qt::Key_Z :
1897 mView->viewManager()->showWorkWeekView(); 1897 mView->viewManager()->showWorkWeekView();
1898 showSelectedDates = true; 1898 showSelectedDates = true;
1899 break; 1899 break;
1900 case Qt::Key_U : 1900 case Qt::Key_U :
1901 mView->viewManager()->showWeekView(); 1901 mView->viewManager()->showWeekView();
1902 showSelectedDates = true; 1902 showSelectedDates = true;
1903 break; 1903 break;
1904 case Qt::Key_H : 1904 case Qt::Key_H :
1905 keyBindings(); 1905 keyBindings();
1906 break; 1906 break;
1907 case Qt::Key_W: 1907 case Qt::Key_W:
1908 mView->viewManager()->showWhatsNextView(); 1908 mView->viewManager()->showWhatsNextView();
1909 break; 1909 break;
1910 case Qt::Key_L: 1910 case Qt::Key_L:
1911 mView->viewManager()->showListView(); 1911 mView->viewManager()->showListView();
1912 break; 1912 break;
1913 case Qt::Key_N: 1913 case Qt::Key_N:
1914 mView->viewManager()->showNextView(); 1914 mView->viewManager()->showNextView();
1915 break; 1915 break;
1916 case Qt::Key_V: 1916 case Qt::Key_V:
1917 mView->viewManager()->showTodoView(); 1917 mView->viewManager()->showTodoView();
1918 break; 1918 break;
1919 case Qt::Key_C: 1919 case Qt::Key_C:
1920 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1920 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1921 break; 1921 break;
1922 case Qt::Key_P: 1922 case Qt::Key_P:
1923 mView->showDatePicker( ); 1923 mView->showDatePicker( );
1924 break; 1924 break;
1925 case Qt::Key_F: 1925 case Qt::Key_F:
1926 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1926 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1927 mView->editFilters(); 1927 mView->editFilters();
1928 else 1928 else
1929 mView->toggleFilter(); 1929 mView->toggleFilter();
1930 break; 1930 break;
1931 case Qt::Key_X: 1931 case Qt::Key_X:
1932 if ( e->state() == Qt::ControlButton ) 1932 if ( e->state() == Qt::ControlButton )
1933 mView->toggleDateNavigatorWidget(); 1933 mView->toggleDateNavigatorWidget();
1934 else { 1934 else {
1935 mView->viewManager()->showNextXView(); 1935 mView->viewManager()->showNextXView();
1936 showSelectedDates = true; 1936 showSelectedDates = true;
1937 } 1937 }
1938 break; 1938 break;
1939 case Qt::Key_Space: 1939 case Qt::Key_Space:
1940 mView->toggleExpand(); 1940 mView->toggleExpand();
1941 break; 1941 break;
1942 case Qt::Key_A: 1942 case Qt::Key_A:
1943 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 1943 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
1944 mView->showNextAlarms(); 1944 mView->showNextAlarms();
1945 else 1945 else
1946 mView->toggleAllDaySize(); 1946 mView->toggleAllDaySize();
1947 break; 1947 break;
1948 case Qt::Key_T: 1948 case Qt::Key_T:
1949 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1949 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1950 mView->newTodo(); 1950 mView->newTodo();
1951 else { 1951 else {
1952 mView->goToday(); 1952 mView->goToday();
1953 showSelectedDates = true; 1953 showSelectedDates = true;
1954 } 1954 }
1955 break; 1955 break;
1956 case Qt::Key_J: 1956 case Qt::Key_J:
1957 mView->viewManager()->showJournalView(); 1957 mView->viewManager()->showJournalView();
1958 break; 1958 break;
1959 case Qt::Key_B: 1959 case Qt::Key_B:
1960 mView->editIncidenceDescription();; 1960 mView->editIncidenceDescription();;
1961 break; 1961 break;
1962 // case Qt::Key_Return: 1962 // case Qt::Key_Return:
1963 case Qt::Key_E: 1963 case Qt::Key_E:
1964 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1964 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1965 mView->newEvent(); 1965 mView->newEvent();
1966 else 1966 else
1967 mView->editIncidence(); 1967 mView->editIncidence();
1968 break; 1968 break;
1969 case Qt::Key_Plus: 1969 case Qt::Key_Plus:
1970 size = p->mHourSize +2; 1970 size = p->mHourSize +2;
1971 if ( size <= 22 ) 1971 if ( size <= 22 )
1972 configureAgenda( size ); 1972 configureAgenda( size );
1973 break; 1973 break;
1974 case Qt::Key_Minus: 1974 case Qt::Key_Minus:
1975 size = p->mHourSize - 2; 1975 size = p->mHourSize - 2;
1976 if ( size >= 4 ) 1976 if ( size >= 4 )
1977 configureAgenda( size ); 1977 configureAgenda( size );
1978 break; 1978 break;
1979 1979
1980 1980
1981 default: 1981 default:
1982 e->ignore(); 1982 e->ignore();
1983 } 1983 }
1984 if ( pro > 0 ) { 1984 if ( pro > 0 ) {
1985 mView->selectFilter( pro-1 ); 1985 mView->selectFilter( pro-1 );
1986 } 1986 }
1987 if ( showSelectedDates ) { 1987 if ( showSelectedDates ) {
1988 ;// setCaptionToDates(); 1988 ;// setCaptionToDates();
1989 } 1989 }
1990 1990
1991} 1991}
1992void MainWindow::fillFilterMenuTB() 1992void MainWindow::fillFilterMenuTB()
1993{ 1993{
1994 selectFilterMenuTB->clear(); 1994 selectFilterMenuTB->clear();
1995 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 1995 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
1996 selectFilterMenuTB->insertSeparator(); 1996 selectFilterMenuTB->insertSeparator();
1997 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 1997 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
1998 1998
1999 selectFilterMenuTB->insertSeparator(); 1999 selectFilterMenuTB->insertSeparator();
2000 QPtrList<CalFilter> fili = mView->filters(); 2000 QPtrList<CalFilter> fili = mView->filters();
2001 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2001 CalFilter *curfilter = mView->filterView()->selectedFilter();
2002 CalFilter *filter = fili.first(); 2002 CalFilter *filter = fili.first();
2003 int iii = 2; 2003 int iii = 2;
2004 bool checkitem = mView->filterView()->filtersEnabled(); 2004 bool checkitem = mView->filterView()->filtersEnabled();
2005 while(filter) { 2005 while(filter) {
2006 selectFilterMenuTB->insertItem( filter->name(), iii ); 2006 selectFilterMenuTB->insertItem( filter->name(), iii );
2007 if ( filter == curfilter) 2007 if ( filter == curfilter)
2008 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2008 selectFilterMenuTB->setItemChecked( iii, checkitem );
2009 filter = fili.next(); 2009 filter = fili.next();
2010 ++iii; 2010 ++iii;
2011 } 2011 }
2012 if ( !checkitem ) 2012 if ( !checkitem )
2013 selectFilterMenuTB->setItemChecked( 1, true ); 2013 selectFilterMenuTB->setItemChecked( 1, true );
2014 2014
2015 int x = 0; 2015 int x = 0;
2016 int y = iconToolBar->height(); 2016 int y = iconToolBar->height();
2017 int dX = 0; 2017 int dX = 0;
2018 int dY = 0; 2018 int dY = 0;
2019 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2019 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2020 if ( iconToolBar->y() > height()/2 ) { 2020 if ( iconToolBar->y() > height()/2 ) {
2021 dY = selectFilterMenuTB->sizeHint().height()+8; 2021 dY = selectFilterMenuTB->sizeHint().height()+8;
2022 y = 0; 2022 y = 0;
2023 } 2023 }
2024 } else { 2024 } else {
2025 if ( iconToolBar->x() > width()/2 ) { // right side 2025 if ( iconToolBar->x() > width()/2 ) { // right side
2026 x=0; 2026 x=0;
2027 dX= selectFilterMenuTB->sizeHint().width()+8; 2027 dX= selectFilterMenuTB->sizeHint().width()+8;
2028 y = 0; 2028 y = 0;
2029 } else { 2029 } else {
2030 x= iconToolBar->width(); 2030 x= iconToolBar->width();
2031 y = 0; 2031 y = 0;
2032 } 2032 }
2033 } 2033 }
2034 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2034 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2035 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2035 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2036} 2036}
2037void MainWindow::fillFilterMenu() 2037void MainWindow::fillFilterMenu()
2038{ 2038{
2039 selectFilterMenu->clear(); 2039 selectFilterMenu->clear();
2040 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2040 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2041 selectFilterMenu->insertSeparator(); 2041 selectFilterMenu->insertSeparator();
2042 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2042 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2043 2043
2044 selectFilterMenu->insertSeparator(); 2044 selectFilterMenu->insertSeparator();
2045 QPtrList<CalFilter> fili = mView->filters(); 2045 QPtrList<CalFilter> fili = mView->filters();
2046 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2046 CalFilter *curfilter = mView->filterView()->selectedFilter();
2047 CalFilter *filter = fili.first(); 2047 CalFilter *filter = fili.first();
2048 int iii = 2; 2048 int iii = 2;
2049 bool checkitem = mView->filterView()->filtersEnabled(); 2049 bool checkitem = mView->filterView()->filtersEnabled();
2050 while(filter) { 2050 while(filter) {
2051 selectFilterMenu->insertItem( filter->name(), iii ); 2051 selectFilterMenu->insertItem( filter->name(), iii );
2052 if ( filter == curfilter) 2052 if ( filter == curfilter)
2053 selectFilterMenu->setItemChecked( iii, checkitem ); 2053 selectFilterMenu->setItemChecked( iii, checkitem );
2054 filter = fili.next(); 2054 filter = fili.next();
2055 ++iii; 2055 ++iii;
2056 } 2056 }
2057 if ( !checkitem ) 2057 if ( !checkitem )
2058 selectFilterMenu->setItemChecked( 1, true ); 2058 selectFilterMenu->setItemChecked( 1, true );
2059} 2059}
2060void MainWindow::fillFilterMenuPopup() 2060void MainWindow::fillFilterMenuPopup()
2061{ 2061{
2062 filterPopupMenu->clear(); 2062 filterPopupMenu->clear();
2063 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2063 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2064 2064
2065 filterPopupMenu->insertSeparator(); 2065 filterPopupMenu->insertSeparator();
2066 QPtrList<CalFilter> fili = mView->filters(); 2066 QPtrList<CalFilter> fili = mView->filters();
2067 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2067 CalFilter *curfilter = mView->filterView()->selectedFilter();
2068 CalFilter *filter = fili.first(); 2068 CalFilter *filter = fili.first();
2069 int iii = 1; 2069 int iii = 1;
2070 bool checkitem = mView->filterView()->filtersEnabled(); 2070 bool checkitem = mView->filterView()->filtersEnabled();
2071 while(filter) { 2071 while(filter) {
2072 filterPopupMenu->insertItem( filter->name(), iii ); 2072 filterPopupMenu->insertItem( filter->name(), iii );
2073 if ( filter == curfilter) 2073 if ( filter == curfilter)
2074 filterPopupMenu->setItemChecked( iii, checkitem ); 2074 filterPopupMenu->setItemChecked( iii, checkitem );
2075 filter = fili.next(); 2075 filter = fili.next();
2076 ++iii; 2076 ++iii;
2077 } 2077 }
2078 if ( !checkitem ) 2078 if ( !checkitem )
2079 filterPopupMenu->setItemChecked( 0, true ); 2079 filterPopupMenu->setItemChecked( 0, true );
2080} 2080}
2081void MainWindow::selectFilter( int fil ) 2081void MainWindow::selectFilter( int fil )
2082{ 2082{
2083 2083
2084 if ( fil == 0 ) { 2084 if ( fil == 0 ) {
2085 mView->editFilters( ); 2085 mView->editFilters( );
2086 } else if ( fil == 1 ){ 2086 } else if ( fil == 1 ){
2087 if ( mView->filterView()->filtersEnabled() ) 2087 if ( mView->filterView()->filtersEnabled() )
2088 mView->toggleFilerEnabled( ); 2088 mView->toggleFilerEnabled( );
2089 } else { 2089 } else {
2090 if ( !mView->filterView()->filtersEnabled() ) { 2090 if ( !mView->filterView()->filtersEnabled() ) {
2091 mView->filterView()->blockSignals( true ); 2091 mView->filterView()->blockSignals( true );
2092 mView->toggleFilerEnabled( ); 2092 mView->toggleFilerEnabled( );
2093 mView->filterView()->blockSignals( false ); 2093 mView->filterView()->blockSignals( false );
2094 } 2094 }
2095 mView->selectFilter( fil-2 ); 2095 mView->selectFilter( fil-2 );
2096 } 2096 }
2097} 2097}
2098void MainWindow::updateFilterToolbar() 2098void MainWindow::updateFilterToolbar()
2099{ 2099{
2100 if ( filterMenubar ) { 2100 if ( filterMenubar ) {
2101 if ( !mView->filterView()->filtersEnabled() ) { 2101 if ( !mView->filterView()->filtersEnabled() ) {
2102 filterMenubar->changeItem( 0, i18n("No Filter") ); 2102 filterMenubar->changeItem( 0, i18n("No Filter") );
2103 } else { 2103 } else {
2104 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2104 CalFilter *curfilter = mView->filterView()->selectedFilter();
2105 if ( curfilter ) { 2105 if ( curfilter ) {
2106 filterMenubar->changeItem( 0, curfilter->name() ); 2106 filterMenubar->changeItem( 0, curfilter->name() );
2107 } 2107 }
2108 } 2108 }
2109 } 2109 }
2110} 2110}
2111void MainWindow::selectFilterPopup( int fil ) 2111void MainWindow::selectFilterPopup( int fil )
2112{ 2112{
2113 selectFilter( fil + 1 ); 2113 selectFilter( fil + 1 );
2114 2114
2115} 2115}
2116void MainWindow::configureToolBar( int item ) 2116void MainWindow::configureToolBar( int item )
2117{ 2117{
2118 2118
2119 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2119 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2120 KOPrefs *p = KOPrefs::instance(); 2120 KOPrefs *p = KOPrefs::instance();
2121 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2121 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2122 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2122 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2123 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2123 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2124 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2124 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2125 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2125 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2126 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2126 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2127 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2127 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2128 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2128 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2129 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2129 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2130 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2130 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2131 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2131 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2132 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2132 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2133 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2133 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2134 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2134 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2135 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2135 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2136 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2136 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2137 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2137 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2138 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2138 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2139 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2139 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2140 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2140 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2141 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2141 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2142 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2142 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2143 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2143 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2144 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2144 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2145 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2145 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2146 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2146 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2147 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2147 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2148 // initActions(); 2148 // initActions();
2149} 2149}
2150void MainWindow::setCaption ( const QString & c ) 2150void MainWindow::setCaption ( const QString & c )
2151{ 2151{
2152 QString cap = c; 2152 QString cap = c;
2153 cap.replace( QRegExp("\n"), " " ); 2153 cap.replace( QRegExp("\n"), " " );
2154 cap = cap.stripWhiteSpace(); 2154 cap = cap.stripWhiteSpace();
2155 if ( cap.isEmpty() ) 2155 if ( cap.isEmpty() )
2156 cap = "KO/Pi"; 2156 cap = "KO/Pi";
2157 QWidget::setCaption( cap ); 2157 QWidget::setCaption( cap );
2158} 2158}
2159void MainWindow::setCaptionToDates() 2159void MainWindow::setCaptionToDates()
2160{ 2160{
2161 QString selDates; 2161 QString selDates;
2162 QDate date = mView->startDate(); 2162 QDate date = mView->startDate();
2163 if ( ! date.isValid() ) { 2163 if ( ! date.isValid() ) {
2164 setCaption(""); 2164 setCaption("");
2165 return; 2165 return;
2166 } 2166 }
2167 selDates = KGlobal::locale()->formatDate( date, true); 2167 selDates = KGlobal::locale()->formatDate( date, true);
2168 if (mView->startDate() < mView->endDate() ) 2168 if (mView->startDate() < mView->endDate() )
2169 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2169 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2170 else { 2170 else {
2171 QString addString; 2171 QString addString;
2172 if ( date == QDateTime::currentDateTime().date() ) 2172 if ( date == QDateTime::currentDateTime().date() )
2173 addString = i18n("Today"); 2173 addString = i18n("Today");
2174 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2174 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2175 addString = i18n("Tomorrow"); 2175 addString = i18n("Tomorrow");
2176 if ( !addString.isEmpty() ) 2176 if ( !addString.isEmpty() )
2177 selDates = addString+", "+selDates ; 2177 selDates = addString+", "+selDates ;
2178 } 2178 }
2179 setCaption( i18n("Dates: ") + selDates ); 2179 setCaption( i18n("Dates: ") + selDates );
2180 2180
2181} 2181}
2182void MainWindow::showConfigureAgenda( ) 2182void MainWindow::showConfigureAgenda( )
2183{ 2183{
2184 int iii; 2184 int iii;
2185 for ( iii = 1;iii<= 10 ;++iii ){ 2185 for ( iii = 1;iii<= 10 ;++iii ){
2186 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2186 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2187 } 2187 }
2188 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2188 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2189} 2189}
2190void MainWindow::configureAgenda( int item ) 2190void MainWindow::configureAgenda( int item )
2191{ 2191{
2192 if ( KOPrefs::instance()->mHourSize == item ) 2192 if ( KOPrefs::instance()->mHourSize == item )
2193 return; 2193 return;
2194 KOPrefs::instance()->mHourSize=item; 2194 KOPrefs::instance()->mHourSize=item;
2195 mView->viewManager()->agendaView()->updateConfig(); 2195 mView->viewManager()->agendaView()->updateConfig();
2196} 2196}
2197 2197
2198void MainWindow::saveCalendar() 2198void MainWindow::saveCalendar()
2199{ 2199{
2200 QString fn = KOPrefs::instance()->mLastSaveFile; 2200 QString fn = KOPrefs::instance()->mLastSaveFile;
2201 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 2201 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
2202 2202
2203 if ( fn == "" ) 2203 if ( fn == "" )
2204 return; 2204 return;
2205 QFileInfo info; 2205 QFileInfo info;
2206 info.setFile( fn ); 2206 info.setFile( fn );
2207 QString mes; 2207 QString mes;
2208 bool createbup = true; 2208 bool createbup = true;
2209 if ( info. exists() ) { 2209 if ( info. exists() ) {
2210 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 2210 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
2211 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2211 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2212 i18n("Overwrite!"), i18n("Cancel"), 0, 2212 i18n("Overwrite!"), i18n("Cancel"), 0,
2213 0, 1 ); 2213 0, 1 );
2214 if ( result != 0 ) { 2214 if ( result != 0 ) {
2215 createbup = false; 2215 createbup = false;
2216 } 2216 }
2217 } 2217 }
2218 if ( createbup ) { 2218 if ( createbup ) {
2219 mView->saveCalendar( fn ); 2219 mView->saveCalendar( fn );
2220 mes = i18n("KO/Pi:Saved %1").arg(fn); 2220 mes = i18n("KO/Pi:Saved %1").arg(fn);
2221 KOPrefs::instance()->mLastSaveFile = fn; 2221 KOPrefs::instance()->mLastSaveFile = fn;
2222 setCaption(mes); 2222 setCaption(mes);
2223 } 2223 }
2224} 2224}
2225void MainWindow::loadCalendar() 2225void MainWindow::loadCalendar()
2226{ 2226{
2227 2227
2228 QString fn = KOPrefs::instance()->mLastLoadFile; 2228 QString fn = KOPrefs::instance()->mLastLoadFile;
2229 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2229 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2230 2230
2231 if ( fn == "" ) 2231 if ( fn == "" )
2232 return; 2232 return;
2233 QFileInfo info; 2233 QFileInfo info;
2234 info.setFile( fn ); 2234 info.setFile( fn );
2235 QString mess; 2235 QString mess;
2236 bool loadbup = true; 2236 bool loadbup = true;
2237 if ( info. exists() ) { 2237 if ( info. exists() ) {
2238 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2238 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2239 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2239 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2240 mess, 2240 mess,
2241 i18n("Load!"), i18n("Cancel"), 0, 2241 i18n("Load!"), i18n("Cancel"), 0,
2242 0, 1 ); 2242 0, 1 );
2243 if ( result != 0 ) { 2243 if ( result != 0 ) {
2244 loadbup = false; 2244 loadbup = false;
2245 } 2245 }
2246 } else { 2246 } else {
2247 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2247 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2248 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2248 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2249 0, 1 ); 2249 0, 1 );
2250 2250
2251 return; 2251 return;
2252 } 2252 }
2253 if ( loadbup ) { 2253 if ( loadbup ) {
2254 mView->openCalendar( fn ); 2254 mView->openCalendar( fn );
2255 KOPrefs::instance()->mLastLoadFile = fn; 2255 KOPrefs::instance()->mLastLoadFile = fn;
2256 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2256 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2257 setCaption(mess); 2257 setCaption(mess);
2258 } 2258 }
2259 2259
2260} 2260}
2261void MainWindow::quickImportIcal() 2261void MainWindow::quickImportIcal()
2262{ 2262{
2263 importFile( KOPrefs::instance()->mLastImportFile, false ); 2263 importFile( KOPrefs::instance()->mLastImportFile, false );
2264} 2264}
2265void MainWindow::importFile( QString fn, bool quick ) 2265void MainWindow::importFile( QString fn, bool quick )
2266{ 2266{
2267 QFileInfo info; 2267 QFileInfo info;
2268 info.setFile( fn ); 2268 info.setFile( fn );
2269 QString mess; 2269 QString mess;
2270 bool loadbup = true; 2270 bool loadbup = true;
2271 if ( !info. exists() ) { 2271 if ( !info. exists() ) {
2272 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2272 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2273 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2273 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2274 mess ); 2274 mess );
2275 return; 2275 return;
2276 } 2276 }
2277 int result = 0; 2277 int result = 0;
2278 if ( !quick ) { 2278 if ( !quick ) {
2279 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2279 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2280 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2280 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2281 mess, 2281 mess,
2282 "Import", "Cancel", 0, 2282 "Import", "Cancel", 0,
2283 0, 1 ); 2283 0, 1 );
2284 } 2284 }
2285 if ( result == 0 ) { 2285 if ( result == 0 ) {
2286 if ( mView->openCalendar( fn, true )) { 2286 if ( mView->openCalendar( fn, true )) {
2287 KOPrefs::instance()->mLastImportFile = fn; 2287 KOPrefs::instance()->mLastImportFile = fn;
2288 setCaption(i18n("Imported file successfully")); 2288 setCaption(i18n("Imported file successfully"));
2289 } else { 2289 } else {
2290 setCaption(i18n("Error importing file")); 2290 setCaption(i18n("Error importing file"));
2291 } 2291 }
2292 } 2292 }
2293} 2293}
2294 2294
2295void MainWindow::importIcal() 2295void MainWindow::importIcal()
2296{ 2296{
2297 2297
2298 QString fn =KOPrefs::instance()->mLastImportFile; 2298 QString fn =KOPrefs::instance()->mLastImportFile;
2299 2299
2300 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2300 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2301 if ( fn == "" ) 2301 if ( fn == "" )
2302 return; 2302 return;
2303 importFile( fn, true ); 2303 importFile( fn, true );
2304 2304
2305} 2305}
2306 2306
2307void MainWindow::exportVCalendar() 2307void MainWindow::exportVCalendar()
2308{ 2308{
2309 QString fn = KOPrefs::instance()->mLastVcalFile; 2309 QString fn = KOPrefs::instance()->mLastVcalFile;
2310 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2310 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2311 if ( fn == "" ) 2311 if ( fn == "" )
2312 return; 2312 return;
2313 QFileInfo info; 2313 QFileInfo info;
2314 info.setFile( fn ); 2314 info.setFile( fn );
2315 QString mes; 2315 QString mes;
2316 bool createbup = true; 2316 bool createbup = true;
2317 if ( info. exists() ) { 2317 if ( info. exists() ) {
2318 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2318 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2319 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2319 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2320 i18n("Overwrite!"), i18n("Cancel"), 0, 2320 i18n("Overwrite!"), i18n("Cancel"), 0,
2321 0, 1 ); 2321 0, 1 );
2322 if ( result != 0 ) { 2322 if ( result != 0 ) {
2323 createbup = false; 2323 createbup = false;
2324 } 2324 }
2325 } 2325 }
2326 if ( createbup ) { 2326 if ( createbup ) {
2327 if ( mView->exportVCalendar( fn ) ) { 2327 if ( mView->exportVCalendar( fn ) ) {
2328 KOPrefs::instance()->mLastVcalFile = fn; 2328 KOPrefs::instance()->mLastVcalFile = fn;
2329 if ( fn.length() > 20 ) 2329 if ( fn.length() > 20 )
2330 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2330 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2331 else 2331 else
2332 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2332 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2333 setCaption(mes); 2333 setCaption(mes);
2334 } 2334 }
2335 } 2335 }
2336 2336
2337} 2337}
2338QString MainWindow::sentSyncFile() 2338QString MainWindow::sentSyncFile()
2339{ 2339{
2340#ifdef DESKTOP_VERSION 2340#ifdef DESKTOP_VERSION
2341 return locateLocal( "tmp", "copysynccal.ics" ); 2341 return locateLocal( "tmp", "copysynccal.ics" );
2342#else 2342#else
2343 return QString( "/tmp/copysynccal.ics" ); 2343 return QString( "/tmp/copysynccal.ics" );
2344#endif 2344#endif
2345} 2345}
2346 2346
2347void MainWindow::syncFileRequest() 2347void MainWindow::syncFileRequest()
2348{ 2348{
2349 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2349 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2350 mSyncManager->slotSyncMenu( 999 ); 2350 mSyncManager->slotSyncMenu( 999 );
2351 } 2351 }
2352 2352
2353 setCaption(i18n("Saving Data to temp file ..." )); 2353 setCaption(i18n("Saving Data to temp file ..." ));
2354 mView->saveCalendar( sentSyncFile() ); 2354 mView->saveCalendar( sentSyncFile() );
2355 setCaption(i18n("Data saved to temp file!" )); 2355 setCaption(i18n("Data saved to temp file!" ));
2356 2356
2357} 2357}
2358void MainWindow::getFile( bool success ) 2358void MainWindow::getFile( bool success )
2359{ 2359{
2360 if ( ! success ) { 2360 if ( ! success ) {
2361 setCaption( i18n("Error receiving file. Nothing changed!") ); 2361 setCaption( i18n("Error receiving file. Nothing changed!") );
2362 return; 2362 return;
2363 } 2363 }
2364 mView->openCalendar( sentSyncFile() ); 2364 mView->openCalendar( sentSyncFile() );
2365 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2365 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2366 mSyncManager->slotSyncMenu( 999 ); 2366 mSyncManager->slotSyncMenu( 999 );
2367 } 2367 }
2368 setCaption( i18n("Pi-Sync successful!") ); 2368 setCaption( i18n("Pi-Sync successful!") );
2369} 2369}
2370 2370
2371void MainWindow::printSel( ) 2371void MainWindow::printSel( )
2372{ 2372{
2373 mView->viewManager()->agendaView()->agenda()->printSelection(); 2373 mView->viewManager()->agendaView()->agenda()->printSelection();
2374} 2374}
2375 2375
2376void MainWindow::printCal() 2376void MainWindow::printCal()
2377{ 2377{
2378 mView->print();//mCp->showDialog(); 2378 mView->print();//mCp->showDialog();
2379} 2379}
2380 2380
2381 2381
2382#include "libkdepim/kdatepicker.h" 2382#include "libkdepim/kdatepicker.h"
2383#include <kdatetbl.h> 2383#include <kdatetbl.h>
2384 2384
2385void MainWindow::weekAction() 2385void MainWindow::weekAction()
2386{ 2386{
2387 int month; 2387 int month;
2388 KPopupFrame* popup = new KPopupFrame(this); 2388 KPopupFrame* popup = new KPopupFrame(this);
2389 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2389 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2390 // ----- 2390 // -----
2391 picker->resize(picker->sizeHint()); 2391 picker->resize(picker->sizeHint());
2392 popup->setMainWidget(picker); 2392 popup->setMainWidget(picker);
2393 picker->setFocus(); 2393 picker->setFocus();
2394 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2394 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2395 int x = 0; 2395 int x = 0;
2396 int y = iconToolBar->height(); 2396 int y = iconToolBar->height();
2397 int dX = 0; 2397 int dX = 0;
2398 int dY = 0; 2398 int dY = 0;
2399 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2399 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2400 if ( iconToolBar->y() > height()/2 ) { 2400 if ( iconToolBar->y() > height()/2 ) {
2401 dY = picker->sizeHint().height()+8; 2401 dY = picker->sizeHint().height()+8;
2402 y = 0; 2402 y = 0;
2403 } 2403 }
2404 } else { 2404 } else {
2405 if ( iconToolBar->x() > width()/2 ) { // right side 2405 if ( iconToolBar->x() > width()/2 ) { // right side
2406 x=0; 2406 x=0;
2407 dX= picker->sizeHint().width()+8; 2407 dX= picker->sizeHint().width()+8;
2408 y = 0; 2408 y = 0;
2409 } else { 2409 } else {
2410 x= iconToolBar->width(); 2410 x= iconToolBar->width();
2411 y = 0; 2411 y = 0;
2412 } 2412 }
2413 } 2413 }
2414 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2414 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2415 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2415 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2416 { 2416 {
2417 month = picker->getResult(); 2417 month = picker->getResult();
2418 emit selectWeek ( month ); 2418 emit selectWeek ( month );
2419 //qDebug("weekSelected %d ", month); 2419 //qDebug("weekSelected %d ", month);
2420 } 2420 }
2421 delete popup; 2421 delete popup;
2422} 2422}
2423 2423
2424void MainWindow::hideEvent ( QHideEvent * ) 2424void MainWindow::hideEvent ( QHideEvent * )
2425{ 2425{
2426 QString message; 2426 QString message;
2427 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2427 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2428 if ( nextA.isValid() ) { 2428 if ( nextA.isValid() ) {
2429 QString sum = mCalendar->nextSummary(); 2429 QString sum = mCalendar->nextSummary();
2430 2430
2431 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2431 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2432 setCaption( message ); 2432 setCaption( message );
2433 } 2433 }
2434} 2434}
2435 2435
2436void MainWindow::resizeEvent( QResizeEvent* e) 2436void MainWindow::resizeEvent( QResizeEvent* e)
2437{ 2437{
2438#ifndef DESKTOP_VERSION 2438#ifndef DESKTOP_VERSION
2439 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar ) { 2439 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2440 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2440 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2441 filterToolBar->hide(); 2441 filterToolBar->hide();
2442 else 2442 else
2443 filterToolBar->show(); 2443 filterToolBar->show();
2444 } 2444 }
2445#endif 2445#endif
2446 QMainWindow::resizeEvent( e); 2446 QMainWindow::resizeEvent( e);
2447} 2447}
diff --git a/microkde/ofontselector.cpp b/microkde/ofontselector.cpp
index c8471cc..05095f3 100644
--- a/microkde/ofontselector.cpp
+++ b/microkde/ofontselector.cpp
@@ -1,412 +1,413 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 5 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qlistbox.h> 30#include <qlistbox.h>
31#include <qcombobox.h> 31#include <qcombobox.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qmultilineedit.h> 34#include <qmultilineedit.h>
35 35
36#include <qpe/fontdatabase.h> 36#include <qpe/fontdatabase.h>
37 37
38#include "ofontselector.h" 38#include "ofontselector.h"
39 39
40class OFontSelectorPrivate { 40class OFontSelectorPrivate {
41public: 41public:
42 QListBox * m_font_family_list; 42 QListBox * m_font_family_list;
43 QComboBox * m_font_style_list; 43 QComboBox * m_font_style_list;
44 QComboBox * m_font_size_list; 44 QComboBox * m_font_size_list;
45 QMultiLineEdit *m_preview; 45 QMultiLineEdit *m_preview;
46 46
47 bool m_pointbug : 1; 47 bool m_pointbug : 1;
48 48
49 FontDatabase m_fdb; 49 FontDatabase m_fdb;
50}; 50};
51 51
52namespace { 52namespace {
53 53
54class FontListItem : public QListBoxText { 54class FontListItem : public QListBoxText {
55public: 55public:
56 FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText ( ) 56 FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText ( )
57 { 57 {
58 m_name = t; 58 m_name = t;
59 m_styles = styles; 59 m_styles = styles;
60 m_sizes = sizes; 60 m_sizes = sizes;
61 61
62 QString str = t; 62 QString str = t;
63 str [0] = str [0]. upper ( ); 63 str [0] = str [0]. upper ( );
64 setText ( str ); 64 setText ( str );
65 } 65 }
66 66
67 QString family ( ) const 67 QString family ( ) const
68 { 68 {
69 return m_name; 69 return m_name;
70 } 70 }
71 71
72 const QStringList &styles ( ) const 72 const QStringList &styles ( ) const
73 { 73 {
74 return m_styles; 74 return m_styles;
75 } 75 }
76 76
77 const QValueList<int> &sizes ( ) const 77 const QValueList<int> &sizes ( ) const
78 { 78 {
79 return m_sizes; 79 return m_sizes;
80 } 80 }
81 81
82private: 82private:
83 QStringList m_styles; 83 QStringList m_styles;
84 QValueList<int> m_sizes; 84 QValueList<int> m_sizes;
85 QString m_name; 85 QString m_name;
86}; 86};
87 87
88 88
89static int findItemCB ( QComboBox *box, const QString &str ) 89static int findItemCB ( QComboBox *box, const QString &str )
90{ 90{
91 for ( int i = 0; i < box-> count ( ); i++ ) { 91 for ( int i = 0; i < box-> count ( ); i++ ) {
92 if ( box-> text ( i ) == str ) 92 if ( box-> text ( i ) == str )
93 return i; 93 return i;
94 } 94 }
95 return -1; 95 return -1;
96} 96}
97 97
98} 98}
99/* static same as anon. namespace */ 99/* static same as anon. namespace */
100static int qt_version ( ) 100static int qt_version ( )
101{ 101{
102 const char *qver = qVersion ( ); 102 const char *qver = qVersion ( );
103 103
104 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 104 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
105} 105}
106 106
107/** 107/**
108 * Constructs the Selector object 108 * Constructs the Selector object
109 * @param withpreview If a font preview should be given 109 * @param withpreview If a font preview should be given
110 * @param parent The parent of the Font Selector 110 * @param parent The parent of the Font Selector
111 * @param name The name of the object 111 * @param name The name of the object
112 * @param fl WidgetFlags 112 * @param fl WidgetFlags
113 */ 113 */
114OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) 114OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
115{ 115{
116 d = new OFontSelectorPrivate ( ); 116 d = new OFontSelectorPrivate ( );
117 117
118 QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); 118 QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 );
119 gridLayout->setRowStretch ( 4, 10 ); 119 gridLayout->setRowStretch ( 4, 10 );
120 120
121 d-> m_font_family_list = new QListBox( this, "FontListBox" ); 121 d-> m_font_family_list = new QListBox( this, "FontListBox" );
122 gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); 122 gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 );
123 connect( d-> m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); 123 connect( d-> m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) );
124 124
125 QLabel *label = new QLabel( tr( "Style" ), this ); 125 QLabel *label = new QLabel( tr( "Style" ), this );
126 gridLayout->addWidget( label, 0, 1 ); 126 gridLayout->addWidget( label, 0, 1 );
127 127
128 d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); 128 d-> m_font_style_list = new QComboBox( this, "StyleListBox" );
129 connect( d-> m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); 129 connect( d-> m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) );
130 gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); 130 gridLayout->addWidget( d-> m_font_style_list, 1, 1 );
131 131
132 label = new QLabel( tr( "Size" ), this ); 132 label = new QLabel( tr( "Size" ), this );
133 gridLayout->addWidget( label, 2, 1 ); 133 gridLayout->addWidget( label, 2, 1 );
134 134
135 d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); 135 d-> m_font_size_list = new QComboBox( this, "SizeListBox" );
136 connect( d-> m_font_size_list, SIGNAL( activated( int ) ), 136 connect( d-> m_font_size_list, SIGNAL( activated( int ) ),
137 this, SLOT( fontSizeClicked( int ) ) ); 137 this, SLOT( fontSizeClicked( int ) ) );
138 gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); 138 gridLayout->addWidget( d-> m_font_size_list, 3, 1 );
139 139
140 d-> m_pointbug = ( qt_version ( ) <= 233 ); 140 //d-> m_pointbug = ( qt_version ( ) <= 233 );
141 d->m_pointbug = ( qt_version() == 232 || qt_version() == 233 ); // SharpROM uses 2.3.2
141 142
142 if ( withpreview ) { 143 if ( withpreview ) {
143 d-> m_preview = new QMultiLineEdit ( this, "Preview" ); 144 d-> m_preview = new QMultiLineEdit ( this, "Preview" );
144 d-> m_preview-> setAlignment ( AlignCenter ); 145 d-> m_preview-> setAlignment ( AlignCenter );
145 d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); 146 d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth );
146 d-> m_preview-> setMargin ( 3 ); 147 d-> m_preview-> setMargin ( 3 );
147 d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); 148 d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ));
148 gridLayout-> addRowSpacing ( 5, 4 ); 149 gridLayout-> addRowSpacing ( 5, 4 );
149 gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); 150 gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 );
150 gridLayout-> setRowStretch ( 6, 5 ); 151 gridLayout-> setRowStretch ( 6, 5 );
151 } 152 }
152 else 153 else
153 d-> m_preview = 0; 154 d-> m_preview = 0;
154 155
155 loadFonts ( d-> m_font_family_list ); 156 loadFonts ( d-> m_font_family_list );
156} 157}
157 158
158OFontSelector::~OFontSelector ( ) 159OFontSelector::~OFontSelector ( )
159{ 160{
160 delete d; 161 delete d;
161} 162}
162 163
163/** 164/**
164 * This methods tries to set the font 165 * This methods tries to set the font
165 * @param f The wishes font 166 * @param f The wishes font
166 * @return success or failure 167 * @return success or failure
167 */ 168 */
168bool OFontSelector::setSelectedFont ( const QFont &f ) 169bool OFontSelector::setSelectedFont ( const QFont &f )
169{ 170{
170 return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); 171 return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( )));
171} 172}
172 173
173 174
174/** 175/**
175 * This is an overloaded method @see setSelectedFont 176 * This is an overloaded method @see setSelectedFont
176 * @param familyStr The family of the font 177 * @param familyStr The family of the font
177 * @param styleStr The style of the font 178 * @param styleStr The style of the font
178 * @param sizeVal The size of font 179 * @param sizeVal The size of font
179 * @param charset The charset to be used. Will be deprecated by QT3 180 * @param charset The charset to be used. Will be deprecated by QT3
180 */ 181 */
181bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) 182bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset )
182{ 183{
183 QString sizeStr = QString::number ( sizeVal ); 184 QString sizeStr = QString::number ( sizeVal );
184 185
185 QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); 186 QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr );
186 if ( !family ) 187 if ( !family )
187 family = d-> m_font_family_list-> findItem ( "Helvetica" ); 188 family = d-> m_font_family_list-> findItem ( "Helvetica" );
188 if ( !family ) 189 if ( !family )
189 family = d-> m_font_family_list-> firstItem ( ); 190 family = d-> m_font_family_list-> firstItem ( );
190 d-> m_font_family_list-> setCurrentItem ( family ); 191 d-> m_font_family_list-> setCurrentItem ( family );
191 fontFamilyClicked ( d-> m_font_family_list-> index ( family )); 192 fontFamilyClicked ( d-> m_font_family_list-> index ( family ));
192 193
193 int style = findItemCB ( d-> m_font_style_list, styleStr ); 194 int style = findItemCB ( d-> m_font_style_list, styleStr );
194 if ( style < 0 ) 195 if ( style < 0 )
195 style = findItemCB ( d-> m_font_style_list, "Regular" ); 196 style = findItemCB ( d-> m_font_style_list, "Regular" );
196 if ( style < 0 && d-> m_font_style_list-> count ( ) > 0 ) 197 if ( style < 0 && d-> m_font_style_list-> count ( ) > 0 )
197 style = 0; 198 style = 0;
198 d-> m_font_style_list-> setCurrentItem ( style ); 199 d-> m_font_style_list-> setCurrentItem ( style );
199 fontStyleClicked ( style ); 200 fontStyleClicked ( style );
200 201
201 int size = findItemCB ( d-> m_font_size_list, sizeStr ); 202 int size = findItemCB ( d-> m_font_size_list, sizeStr );
202 if ( size < 0 ) 203 if ( size < 0 )
203 size = findItemCB ( d-> m_font_size_list, "10" ); 204 size = findItemCB ( d-> m_font_size_list, "10" );
204 if ( size < 0 && d-> m_font_size_list-> count ( ) > 0 ) 205 if ( size < 0 && d-> m_font_size_list-> count ( ) > 0 )
205 size = 0; 206 size = 0;
206 d-> m_font_size_list-> setCurrentItem ( size ); 207 d-> m_font_size_list-> setCurrentItem ( size );
207 fontSizeClicked ( size ); 208 fontSizeClicked ( size );
208 209
209 return (( family ) && ( style >= 0 ) && ( size >= 0 )); 210 return (( family ) && ( style >= 0 ) && ( size >= 0 ));
210} 211}
211 212
212/** 213/**
213 * This method returns the name, style and size of the currently selected 214 * This method returns the name, style and size of the currently selected
214 * font or false if no font is selected 215 * font or false if no font is selected
215 * @param family The font family will be written there 216 * @param family The font family will be written there
216 * @param style The style will be written there 217 * @param style The style will be written there
217 * @param size The size will be written there 218 * @param size The size will be written there
218 * @return success or failure 219 * @return success or failure
219 */ 220 */
220bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) 221bool OFontSelector::selectedFont ( QString &family, QString &style, int &size )
221{ 222{
222 QString dummy; 223 QString dummy;
223 return selectedFont ( family, style, size, dummy ); 224 return selectedFont ( family, style, size, dummy );
224} 225}
225 226
226 227
227/** 228/**
228 * This method does return the font family or QString::null if there is 229 * This method does return the font family or QString::null if there is
229 * no font item selected 230 * no font item selected
230 * @return the font family 231 * @return the font family
231 */ 232 */
232QString OFontSelector::fontFamily ( ) const 233QString OFontSelector::fontFamily ( ) const
233{ 234{
234 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); 235 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( ));
235 236
236 return fli ? fli-> family ( ) : QString::null; 237 return fli ? fli-> family ( ) : QString::null;
237} 238}
238 239
239/** 240/**
240 * This method will return the style of the font or QString::null 241 * This method will return the style of the font or QString::null
241 * @return the style of the font 242 * @return the style of the font
242 */ 243 */
243QString OFontSelector::fontStyle ( ) const 244QString OFontSelector::fontStyle ( ) const
244{ 245{
245 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); 246 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( ));
246 int fst = d-> m_font_style_list-> currentItem ( ); 247 int fst = d-> m_font_style_list-> currentItem ( );
247 248
248 return ( fli && fst >= 0 ) ? fli-> styles ( ) [fst] : QString::null; 249 return ( fli && fst >= 0 ) ? fli-> styles ( ) [fst] : QString::null;
249} 250}
250 251
251/** 252/**
252 * This method will return the font size or 10 if no font size is available 253 * This method will return the font size or 10 if no font size is available
253 */ 254 */
254int OFontSelector::fontSize ( ) const 255int OFontSelector::fontSize ( ) const
255{ 256{
256 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); 257 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( ));
257 int fsi = d-> m_font_size_list-> currentItem ( ); 258 int fsi = d-> m_font_size_list-> currentItem ( );
258 259
259 return ( fli && fsi >= 0 ) ? fli-> sizes ( ) [fsi] : 10; 260 return ( fli && fsi >= 0 ) ? fli-> sizes ( ) [fsi] : 10;
260} 261}
261 262
262/** 263/**
263 * returns the charset of the font or QString::null 264 * returns the charset of the font or QString::null
264 */ 265 */
265QString OFontSelector::fontCharSet ( ) const 266QString OFontSelector::fontCharSet ( ) const
266{ 267{
267 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); 268 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( ));
268 269
269 return fli ? d-> m_fdb. charSets ( fli-> family ( )) [0] : QString::null; 270 return fli ? d-> m_fdb. charSets ( fli-> family ( )) [0] : QString::null;
270} 271}
271 272
272/** 273/**
273 * Overloaded member function see above 274 * Overloaded member function see above
274 * @see selectedFont 275 * @see selectedFont
275 */ 276 */
276bool OFontSelector::selectedFont ( QString &family, QString &style, int &size, QString &charset ) 277bool OFontSelector::selectedFont ( QString &family, QString &style, int &size, QString &charset )
277{ 278{
278 int ffa = d-> m_font_family_list-> currentItem ( ); 279 int ffa = d-> m_font_family_list-> currentItem ( );
279 int fst = d-> m_font_style_list-> currentItem ( ); 280 int fst = d-> m_font_style_list-> currentItem ( );
280 int fsi = d-> m_font_size_list-> currentItem ( ); 281 int fsi = d-> m_font_size_list-> currentItem ( );
281 282
282 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( ffa ); 283 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( ffa );
283 284
284 if ( fli ) { 285 if ( fli ) {
285 family = fli-> family ( ); 286 family = fli-> family ( );
286 style = fst >= 0 ? fli-> styles ( ) [fst] : QString::null; 287 style = fst >= 0 ? fli-> styles ( ) [fst] : QString::null;
287 size = fsi >= 0 ? fli-> sizes ( ) [fsi] : 10; 288 size = fsi >= 0 ? fli-> sizes ( ) [fsi] : 10;
288 charset = d-> m_fdb. charSets ( fli-> family ( )) [0]; 289 charset = d-> m_fdb. charSets ( fli-> family ( )) [0];
289 290
290 return true; 291 return true;
291 } 292 }
292 else 293 else
293 return false; 294 return false;
294} 295}
295 296
296 297
297 298
298 299
299void OFontSelector::loadFonts ( QListBox *list ) 300void OFontSelector::loadFonts ( QListBox *list )
300{ 301{
301 QStringList f = d-> m_fdb. families ( ); 302 QStringList f = d-> m_fdb. families ( );
302 303
303 for ( QStringList::ConstIterator it = f. begin ( ); it != f. end ( ); ++it ) { 304 for ( QStringList::ConstIterator it = f. begin ( ); it != f. end ( ); ++it ) {
304 QValueList <int> ps = d-> m_fdb. pointSizes ( *it ); 305 QValueList <int> ps = d-> m_fdb. pointSizes ( *it );
305 306
306 if ( d-> m_pointbug ) { 307 if ( d-> m_pointbug ) {
307 for ( QValueList <int>::Iterator it = ps. begin ( ); it != ps. end ( ); it++ ) 308 for ( QValueList <int>::Iterator it = ps. begin ( ); it != ps. end ( ); it++ )
308 *it /= 10; 309 *it /= 10;
309 } 310 }
310 311
311 list-> insertItem ( new FontListItem ( *it, d-> m_fdb. styles ( *it ), ps )); 312 list-> insertItem ( new FontListItem ( *it, d-> m_fdb. styles ( *it ), ps ));
312 } 313 }
313} 314}
314 315
315void OFontSelector::fontFamilyClicked ( int index ) 316void OFontSelector::fontFamilyClicked ( int index )
316{ 317{
317 QString oldstyle = d-> m_font_style_list-> currentText ( ); 318 QString oldstyle = d-> m_font_style_list-> currentText ( );
318 QString oldsize = d-> m_font_size_list-> currentText ( ); 319 QString oldsize = d-> m_font_size_list-> currentText ( );
319 320
320 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( index ); 321 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( index );
321 322
322 d-> m_font_style_list-> clear ( ); 323 d-> m_font_style_list-> clear ( );
323 d-> m_font_style_list-> insertStringList ( fli-> styles ( )); 324 d-> m_font_style_list-> insertStringList ( fli-> styles ( ));
324 d-> m_font_style_list-> setEnabled ( !fli-> styles ( ). isEmpty ( )); 325 d-> m_font_style_list-> setEnabled ( !fli-> styles ( ). isEmpty ( ));
325 326
326 int i; 327 int i;
327 328
328 i = findItemCB ( d-> m_font_style_list, oldstyle ); 329 i = findItemCB ( d-> m_font_style_list, oldstyle );
329 if ( i < 0 ) 330 if ( i < 0 )
330 i = findItemCB ( d-> m_font_style_list, "Regular" ); 331 i = findItemCB ( d-> m_font_style_list, "Regular" );
331 if (( i < 0 ) && ( d-> m_font_style_list-> count ( ) > 0 )) 332 if (( i < 0 ) && ( d-> m_font_style_list-> count ( ) > 0 ))
332 i = 0; 333 i = 0;
333 334
334 if ( i >= 0 ) { 335 if ( i >= 0 ) {
335 d-> m_font_style_list-> setCurrentItem ( i ); 336 d-> m_font_style_list-> setCurrentItem ( i );
336 fontStyleClicked ( i ); 337 fontStyleClicked ( i );
337 } 338 }
338 339
339 d-> m_font_size_list-> clear ( ); 340 d-> m_font_size_list-> clear ( );
340 QValueList<int> sl = fli-> sizes ( ); 341 QValueList<int> sl = fli-> sizes ( );
341 342
342 for ( QValueList<int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 343 for ( QValueList<int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
343 d-> m_font_size_list-> insertItem ( QString::number ( *it )); 344 d-> m_font_size_list-> insertItem ( QString::number ( *it ));
344 345
345 i = findItemCB ( d-> m_font_size_list, oldsize ); 346 i = findItemCB ( d-> m_font_size_list, oldsize );
346 if ( i < 0 ) 347 if ( i < 0 )
347 i = findItemCB ( d-> m_font_size_list, "10" ); 348 i = findItemCB ( d-> m_font_size_list, "10" );
348 if (( i < 0 ) && ( d-> m_font_size_list-> count ( ) > 0 )) 349 if (( i < 0 ) && ( d-> m_font_size_list-> count ( ) > 0 ))
349 i = 0; 350 i = 0;
350 351
351 if ( i >= 0 ) { 352 if ( i >= 0 ) {
352 d-> m_font_size_list-> setCurrentItem ( i ); 353 d-> m_font_size_list-> setCurrentItem ( i );
353 fontSizeClicked ( i ); 354 fontSizeClicked ( i );
354 } 355 }
355 changeFont ( ); 356 changeFont ( );
356} 357}
357 358
358void OFontSelector::fontStyleClicked ( int /*index*/ ) 359void OFontSelector::fontStyleClicked ( int /*index*/ )
359{ 360{
360 changeFont ( ); 361 changeFont ( );
361} 362}
362 363
363void OFontSelector::fontSizeClicked ( int /*index*/ ) 364void OFontSelector::fontSizeClicked ( int /*index*/ )
364{ 365{
365 changeFont ( ); 366 changeFont ( );
366} 367}
367 368
368void OFontSelector::changeFont ( ) 369void OFontSelector::changeFont ( )
369{ 370{
370 QFont f = selectedFont ( ); 371 QFont f = selectedFont ( );
371 372
372 if ( d-> m_preview ) 373 if ( d-> m_preview )
373 d-> m_preview-> setFont ( f ); 374 d-> m_preview-> setFont ( f );
374 375
375 emit fontSelected ( f ); 376 emit fontSelected ( f );
376} 377}
377 378
378/** 379/**
379 * Return the selected font 380 * Return the selected font
380 */ 381 */
381QFont OFontSelector::selectedFont ( ) 382QFont OFontSelector::selectedFont ( )
382{ 383{
383 int ffa = d-> m_font_family_list-> currentItem ( ); 384 int ffa = d-> m_font_family_list-> currentItem ( );
384 int fst = d-> m_font_style_list-> currentItem ( ); 385 int fst = d-> m_font_style_list-> currentItem ( );
385 int fsi = d-> m_font_size_list-> currentItem ( ); 386 int fsi = d-> m_font_size_list-> currentItem ( );
386 387
387 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( ffa ); 388 FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( ffa );
388 389
389 if ( fli ) { 390 if ( fli ) {
390 return d-> m_fdb. font ( fli-> family ( ), \ 391 return d-> m_fdb. font ( fli-> family ( ), \
391 fst >= 0 ? fli-> styles ( ) [fst] : QString::null, \ 392 fst >= 0 ? fli-> styles ( ) [fst] : QString::null, \
392 fsi >= 0 ? fli-> sizes ( ) [fsi] : 10, \ 393 fsi >= 0 ? fli-> sizes ( ) [fsi] : 10, \
393 d-> m_fdb. charSets ( fli-> family ( )) [0] ); 394 d-> m_fdb. charSets ( fli-> family ( )) [0] );
394 } 395 }
395 else 396 else
396 return QFont ( ); 397 return QFont ( );
397} 398}
398 399
399 400
400void OFontSelector::resizeEvent ( QResizeEvent *re ) 401void OFontSelector::resizeEvent ( QResizeEvent *re )
401{ 402{
402 if ( d-> m_preview ) { 403 if ( d-> m_preview ) {
403 d-> m_preview-> setMinimumHeight ( 1 ); 404 d-> m_preview-> setMinimumHeight ( 1 );
404 d-> m_preview-> setMaximumHeight ( 32767 ); 405 d-> m_preview-> setMaximumHeight ( 32767 );
405 } 406 }
406 407
407 QWidget::resizeEvent ( re ); 408 QWidget::resizeEvent ( re );
408 409
409 if ( d-> m_preview ) 410 if ( d-> m_preview )
410 d-> m_preview-> setFixedHeight ( d-> m_preview-> height ( )); 411 d-> m_preview-> setFixedHeight ( d-> m_preview-> height ( ));
411 412
412} 413}
diff --git a/version b/version
index f601af0..1065c0d 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "2.0.24"; version = "2.0.25";