author | zautrix <zautrix> | 2005-01-14 11:37:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-14 11:37:40 (UTC) |
commit | 61c95ce0295f1397db6499c5b468a9fb3d32a0f4 (patch) (unidiff) | |
tree | 2bceecc46d42a572adfad7d8e5000d1534642cbd | |
parent | a46ecf5ed81460ec9a4e457798e1bf0fb74c5624 (diff) | |
download | kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.zip kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.tar.gz kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.tar.bz2 |
made kapi saving faster
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 14 | ||||
-rw-r--r-- | kabc/addressee.cpp | 2 | ||||
-rw-r--r-- | kabc/picture.cpp | 38 | ||||
-rw-r--r-- | kabc/vcard/ContentLine.cpp | 30 | ||||
-rw-r--r-- | kabc/vcard/VCardv.cpp | 77 | ||||
-rw-r--r-- | kaddressbook/details/detailsviewcontainer.cpp | 11 | ||||
-rw-r--r-- | kaddressbook/details/detailsviewcontainer.h | 1 | ||||
-rw-r--r-- | kaddressbook/imagewidget.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 9 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 1 | ||||
-rw-r--r-- | kde2file/abdump/main.cpp | 2 | ||||
-rw-r--r-- | kde2file/caldump/main.cpp | 2 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 16 | ||||
-rw-r--r-- | version | 2 |
15 files changed, 133 insertions, 88 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 2fd63e7..ff87423 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,106 +1,120 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 1.9.17 ************ | 3 | ********** VERSION 1.9.17 ************ |
4 | 4 | ||
5 | KO/Pi: | 5 | KO/Pi: |
6 | Fixed that tooltips were not updated after moving an item in agenda view. | 6 | Fixed that tooltips were not updated after moving an item in agenda view. |
7 | Fixed a bug in sorting start date for recurring events in list view. | ||
7 | 8 | ||
8 | KA/Pi: | 9 | KA/Pi: |
9 | All fields search does now actually search all the (possible) fields, | 10 | All fields search does now actually search all the (possible) fields, |
10 | not only those listed in the contact list. | 11 | not only those listed in the contact list. |
12 | Made is possible to inline a picture in a vcard on the Z. | ||
13 | This was only possible on the desktop, now is it possible on the Z as well. | ||
14 | Fixed of missing save settings after filter configuration. | ||
15 | Made saving of addressbook much faster. | ||
16 | |||
17 | QWhatsThis was not working on the Z ( only black rectangle was shown). | ||
18 | This is Fixed. | ||
19 | |||
20 | KDE-Sync: | ||
21 | Now readonly KDE resources are synced as well. | ||
22 | (They are not changed in KDE itself, of course). | ||
23 | |||
24 | |||
11 | 25 | ||
12 | ********** VERSION 1.9.16 ************ | 26 | ********** VERSION 1.9.16 ************ |
13 | 27 | ||
14 | KO/Pi: | 28 | KO/Pi: |
15 | Fixed search dialog size on Z 6000 (480x640 display). | 29 | Fixed search dialog size on Z 6000 (480x640 display). |
16 | Added setting to hide/show time in agenda items. | 30 | Added setting to hide/show time in agenda items. |
17 | Added setting to hide not running todos in todo view. | 31 | Added setting to hide not running todos in todo view. |
18 | Added columns for start date/time in todo view. | 32 | Added columns for start date/time in todo view. |
19 | Replaced the solid half-hour lines in agenda view by dot lines. | 33 | Replaced the solid half-hour lines in agenda view by dot lines. |
20 | Added possibility of printing the What's Next View on the desktop | 34 | Added possibility of printing the What's Next View on the desktop |
21 | (i.e. Windows and Linux). | 35 | (i.e. Windows and Linux). |
22 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. | 36 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. |
23 | Added tooltips in month view.(Tooltips only available on desktop) | 37 | Added tooltips in month view.(Tooltips only available on desktop) |
24 | 38 | ||
25 | Fixed a strange problem in KO/Pi alarm applet. | 39 | Fixed a strange problem in KO/Pi alarm applet. |
26 | Did not find the actual problem, | 40 | Did not find the actual problem, |
27 | such that now Qtopia reboots again if deinstalling the alarm applet. | 41 | such that now Qtopia reboots again if deinstalling the alarm applet. |
28 | But the alarm applet should work again. | 42 | But the alarm applet should work again. |
29 | 43 | ||
30 | KA/Pi: | 44 | KA/Pi: |
31 | Fixed the problem, that internal pictures were not saved. | 45 | Fixed the problem, that internal pictures were not saved. |
32 | 46 | ||
33 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. | 47 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. |
34 | 48 | ||
35 | Fixed some minor problems. (Like word wrap in help text windows). | 49 | Fixed some minor problems. (Like word wrap in help text windows). |
36 | 50 | ||
37 | Fixed a compiling problem in microkde/kresources. | 51 | Fixed a compiling problem in microkde/kresources. |
38 | 52 | ||
39 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. | 53 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. |
40 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) | 54 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) |
41 | such that now syncing KO/Pi with Sharp DTM should work on the | 55 | such that now syncing KO/Pi with Sharp DTM should work on the |
42 | Zaurus C 3000 model. | 56 | Zaurus C 3000 model. |
43 | 57 | ||
44 | ********** VERSION 1.9.15 ************ | 58 | ********** VERSION 1.9.15 ************ |
45 | 59 | ||
46 | Usebilty enhancements in KO/Pi: | 60 | Usebilty enhancements in KO/Pi: |
47 | When clicking on the date in a month view cell, the day view is shown. | 61 | When clicking on the date in a month view cell, the day view is shown. |
48 | Old behaviour was, that the "new event" dialog popped up. | 62 | Old behaviour was, that the "new event" dialog popped up. |
49 | 63 | ||
50 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 64 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
51 | That means, you can restore the latest | 65 | That means, you can restore the latest |
52 | event/todo/journal you have deleted. | 66 | event/todo/journal you have deleted. |
53 | A journal is deleted, if you clear all the text of the journal. | 67 | A journal is deleted, if you clear all the text of the journal. |
54 | 68 | ||
55 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 69 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
56 | 70 | ||
57 | KA/Pi starting in 480x640 resolution: | 71 | KA/Pi starting in 480x640 resolution: |
58 | Hide the filter action in toolbar | 72 | Hide the filter action in toolbar |
59 | and added icons for undo/delete/redo in toolbar. | 73 | and added icons for undo/delete/redo in toolbar. |
60 | 74 | ||
61 | Change in OM/Pi ViewMail dialog: | 75 | Change in OM/Pi ViewMail dialog: |
62 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. | 76 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. |
63 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 77 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
64 | 78 | ||
65 | Fixed a crash when deleting mail-accounts in OM/Pi. | 79 | Fixed a crash when deleting mail-accounts in OM/Pi. |
66 | 80 | ||
67 | 81 | ||
68 | ********** VERSION 1.9.14 ************ | 82 | ********** VERSION 1.9.14 ************ |
69 | 83 | ||
70 | Fixed some problems with the dialog sizes when switching | 84 | Fixed some problems with the dialog sizes when switching |
71 | portrait/landscape mode on 640x480 PDA display. | 85 | portrait/landscape mode on 640x480 PDA display. |
72 | 86 | ||
73 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 87 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
74 | 88 | ||
75 | Fixed an ugly bug in KOpieMail: | 89 | Fixed an ugly bug in KOpieMail: |
76 | KOpieMail was not able to write files (mails) to MSDOS file system, | 90 | KOpieMail was not able to write files (mails) to MSDOS file system, |
77 | like on an usual preformatted SD card. That should work now. | 91 | like on an usual preformatted SD card. That should work now. |
78 | To save your mail data on the Sd card do the following: | 92 | To save your mail data on the Sd card do the following: |
79 | Create a dir on the SD card: | 93 | Create a dir on the SD card: |
80 | mkdir /mnt/card/localmail | 94 | mkdir /mnt/card/localmail |
81 | Go to your home dir: | 95 | Go to your home dir: |
82 | cd | 96 | cd |
83 | Go to kopiemail data storage dir: | 97 | Go to kopiemail data storage dir: |
84 | cd kdepim/apps/kopiemail | 98 | cd kdepim/apps/kopiemail |
85 | Create a symlink to the SD card: | 99 | Create a symlink to the SD card: |
86 | ls -s /mnt/card/localmail | 100 | ls -s /mnt/card/localmail |
87 | Now KOpieMail will store all mails on the SD card. | 101 | Now KOpieMail will store all mails on the SD card. |
88 | 102 | ||
89 | KO/Pi Monthview: | 103 | KO/Pi Monthview: |
90 | Now "Go to Today" selects the current month from day 1-end, | 104 | Now "Go to Today" selects the current month from day 1-end, |
91 | not the current date + some days. | 105 | not the current date + some days. |
92 | I.e. "Go to Today" shows now always | 106 | I.e. "Go to Today" shows now always |
93 | the current month with first day of month in the first row. | 107 | the current month with first day of month in the first row. |
94 | 108 | ||
95 | Added missing German translation. | 109 | Added missing German translation. |
96 | 110 | ||
97 | Fixed icons of executeable on Wintendo. | 111 | Fixed icons of executeable on Wintendo. |
98 | 112 | ||
99 | Added a "Show next Mail" button to the OM/Pi | 113 | Added a "Show next Mail" button to the OM/Pi |
100 | mail viewer such that the mail below the current mail | 114 | mail viewer such that the mail below the current mail |
101 | in the mail list view of the current folder | 115 | in the mail list view of the current folder |
102 | can be read with a single click. | 116 | can be read with a single click. |
103 | 117 | ||
104 | 118 | ||
105 | ********** VERSION 1.9.13 ************ | 119 | ********** VERSION 1.9.13 ************ |
106 | 120 | ||
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 3ce733d..568dfc4 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -1590,255 +1590,257 @@ void Addressee::insertKey( const Key &key ) | |||
1590 | detach(); | 1590 | detach(); |
1591 | mData->empty = false; | 1591 | mData->empty = false; |
1592 | 1592 | ||
1593 | Key::List::Iterator it; | 1593 | Key::List::Iterator it; |
1594 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 1594 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
1595 | if ( (*it).id() == key.id() ) { | 1595 | if ( (*it).id() == key.id() ) { |
1596 | *it = key; | 1596 | *it = key; |
1597 | return; | 1597 | return; |
1598 | } | 1598 | } |
1599 | } | 1599 | } |
1600 | mData->keys.append( key ); | 1600 | mData->keys.append( key ); |
1601 | } | 1601 | } |
1602 | 1602 | ||
1603 | void Addressee::removeKey( const Key &key ) | 1603 | void Addressee::removeKey( const Key &key ) |
1604 | { | 1604 | { |
1605 | detach(); | 1605 | detach(); |
1606 | 1606 | ||
1607 | Key::List::Iterator it; | 1607 | Key::List::Iterator it; |
1608 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 1608 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
1609 | if ( (*it).id() == key.id() ) { | 1609 | if ( (*it).id() == key.id() ) { |
1610 | mData->keys.remove( key ); | 1610 | mData->keys.remove( key ); |
1611 | return; | 1611 | return; |
1612 | } | 1612 | } |
1613 | } | 1613 | } |
1614 | } | 1614 | } |
1615 | 1615 | ||
1616 | Key Addressee::key( int type, QString customTypeString ) const | 1616 | Key Addressee::key( int type, QString customTypeString ) const |
1617 | { | 1617 | { |
1618 | Key::List::ConstIterator it; | 1618 | Key::List::ConstIterator it; |
1619 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 1619 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
1620 | if ( (*it).type() == type ) { | 1620 | if ( (*it).type() == type ) { |
1621 | if ( type == Key::Custom ) { | 1621 | if ( type == Key::Custom ) { |
1622 | if ( customTypeString.isEmpty() ) { | 1622 | if ( customTypeString.isEmpty() ) { |
1623 | return *it; | 1623 | return *it; |
1624 | } else { | 1624 | } else { |
1625 | if ( (*it).customTypeString() == customTypeString ) | 1625 | if ( (*it).customTypeString() == customTypeString ) |
1626 | return (*it); | 1626 | return (*it); |
1627 | } | 1627 | } |
1628 | } else { | 1628 | } else { |
1629 | return *it; | 1629 | return *it; |
1630 | } | 1630 | } |
1631 | } | 1631 | } |
1632 | } | 1632 | } |
1633 | return Key( QString(), type ); | 1633 | return Key( QString(), type ); |
1634 | } | 1634 | } |
1635 | void Addressee::setKeys( const Key::List& list ) { | 1635 | void Addressee::setKeys( const Key::List& list ) { |
1636 | detach(); | 1636 | detach(); |
1637 | mData->keys = list; | 1637 | mData->keys = list; |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | Key::List Addressee::keys() const | 1640 | Key::List Addressee::keys() const |
1641 | { | 1641 | { |
1642 | return mData->keys; | 1642 | return mData->keys; |
1643 | } | 1643 | } |
1644 | 1644 | ||
1645 | Key::List Addressee::keys( int type, QString customTypeString ) const | 1645 | Key::List Addressee::keys( int type, QString customTypeString ) const |
1646 | { | 1646 | { |
1647 | Key::List list; | 1647 | Key::List list; |
1648 | 1648 | ||
1649 | Key::List::ConstIterator it; | 1649 | Key::List::ConstIterator it; |
1650 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 1650 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
1651 | if ( (*it).type() == type ) { | 1651 | if ( (*it).type() == type ) { |
1652 | if ( type == Key::Custom ) { | 1652 | if ( type == Key::Custom ) { |
1653 | if ( customTypeString.isEmpty() ) { | 1653 | if ( customTypeString.isEmpty() ) { |
1654 | list.append(*it); | 1654 | list.append(*it); |
1655 | } else { | 1655 | } else { |
1656 | if ( (*it).customTypeString() == customTypeString ) | 1656 | if ( (*it).customTypeString() == customTypeString ) |
1657 | list.append(*it); | 1657 | list.append(*it); |
1658 | } | 1658 | } |
1659 | } else { | 1659 | } else { |
1660 | list.append(*it); | 1660 | list.append(*it); |
1661 | } | 1661 | } |
1662 | } | 1662 | } |
1663 | } | 1663 | } |
1664 | return list; | 1664 | return list; |
1665 | } | 1665 | } |
1666 | 1666 | ||
1667 | Key Addressee::findKey( const QString &id ) const | 1667 | Key Addressee::findKey( const QString &id ) const |
1668 | { | 1668 | { |
1669 | Key::List::ConstIterator it; | 1669 | Key::List::ConstIterator it; |
1670 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 1670 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
1671 | if ( (*it).id() == id ) { | 1671 | if ( (*it).id() == id ) { |
1672 | return *it; | 1672 | return *it; |
1673 | } | 1673 | } |
1674 | } | 1674 | } |
1675 | return Key(); | 1675 | return Key(); |
1676 | } | 1676 | } |
1677 | 1677 | ||
1678 | QString Addressee::asString() const | 1678 | QString Addressee::asString() const |
1679 | { | 1679 | { |
1680 | return "Smith, agent Smith..."; | 1680 | return "Smith, agent Smith..."; |
1681 | } | 1681 | } |
1682 | 1682 | ||
1683 | void Addressee::dump() const | 1683 | void Addressee::dump() const |
1684 | { | 1684 | { |
1685 | return; | 1685 | return; |
1686 | #if 0 | ||
1686 | kdDebug(5700) << "Addressee {" << endl; | 1687 | kdDebug(5700) << "Addressee {" << endl; |
1687 | 1688 | ||
1688 | kdDebug(5700) << " Uid: '" << uid() << "'" << endl; | 1689 | kdDebug(5700) << " Uid: '" << uid() << "'" << endl; |
1689 | 1690 | ||
1690 | kdDebug(5700) << " Name: '" << name() << "'" << endl; | 1691 | kdDebug(5700) << " Name: '" << name() << "'" << endl; |
1691 | kdDebug(5700) << " FormattedName: '" << formattedName() << "'" << endl; | 1692 | kdDebug(5700) << " FormattedName: '" << formattedName() << "'" << endl; |
1692 | kdDebug(5700) << " FamilyName: '" << familyName() << "'" << endl; | 1693 | kdDebug(5700) << " FamilyName: '" << familyName() << "'" << endl; |
1693 | kdDebug(5700) << " GivenName: '" << givenName() << "'" << endl; | 1694 | kdDebug(5700) << " GivenName: '" << givenName() << "'" << endl; |
1694 | kdDebug(5700) << " AdditionalName: '" << additionalName() << "'" << endl; | 1695 | kdDebug(5700) << " AdditionalName: '" << additionalName() << "'" << endl; |
1695 | kdDebug(5700) << " Prefix: '" << prefix() << "'" << endl; | 1696 | kdDebug(5700) << " Prefix: '" << prefix() << "'" << endl; |
1696 | kdDebug(5700) << " Suffix: '" << suffix() << "'" << endl; | 1697 | kdDebug(5700) << " Suffix: '" << suffix() << "'" << endl; |
1697 | kdDebug(5700) << " NickName: '" << nickName() << "'" << endl; | 1698 | kdDebug(5700) << " NickName: '" << nickName() << "'" << endl; |
1698 | kdDebug(5700) << " Birthday: '" << birthday().toString() << "'" << endl; | 1699 | kdDebug(5700) << " Birthday: '" << birthday().toString() << "'" << endl; |
1699 | kdDebug(5700) << " Mailer: '" << mailer() << "'" << endl; | 1700 | kdDebug(5700) << " Mailer: '" << mailer() << "'" << endl; |
1700 | kdDebug(5700) << " TimeZone: '" << timeZone().asString() << "'" << endl; | 1701 | kdDebug(5700) << " TimeZone: '" << timeZone().asString() << "'" << endl; |
1701 | kdDebug(5700) << " Geo: '" << geo().asString() << "'" << endl; | 1702 | kdDebug(5700) << " Geo: '" << geo().asString() << "'" << endl; |
1702 | kdDebug(5700) << " Title: '" << title() << "'" << endl; | 1703 | kdDebug(5700) << " Title: '" << title() << "'" << endl; |
1703 | kdDebug(5700) << " Role: '" << role() << "'" << endl; | 1704 | kdDebug(5700) << " Role: '" << role() << "'" << endl; |
1704 | kdDebug(5700) << " Organization: '" << organization() << "'" << endl; | 1705 | kdDebug(5700) << " Organization: '" << organization() << "'" << endl; |
1705 | kdDebug(5700) << " Note: '" << note() << "'" << endl; | 1706 | kdDebug(5700) << " Note: '" << note() << "'" << endl; |
1706 | kdDebug(5700) << " ProductId: '" << productId() << "'" << endl; | 1707 | kdDebug(5700) << " ProductId: '" << productId() << "'" << endl; |
1707 | kdDebug(5700) << " Revision: '" << revision().toString() << "'" << endl; | 1708 | kdDebug(5700) << " Revision: '" << revision().toString() << "'" << endl; |
1708 | kdDebug(5700) << " SortString: '" << sortString() << "'" << endl; | 1709 | kdDebug(5700) << " SortString: '" << sortString() << "'" << endl; |
1709 | kdDebug(5700) << " Url: '" << url().url() << "'" << endl; | 1710 | kdDebug(5700) << " Url: '" << url().url() << "'" << endl; |
1710 | kdDebug(5700) << " Secrecy: '" << secrecy().asString() << "'" << endl; | 1711 | kdDebug(5700) << " Secrecy: '" << secrecy().asString() << "'" << endl; |
1711 | kdDebug(5700) << " Logo: '" << logo().asString() << "'" << endl; | 1712 | kdDebug(5700) << " Logo: '" << logo().asString() << "'" << endl; |
1712 | kdDebug(5700) << " Photo: '" << photo().asString() << "'" << endl; | 1713 | kdDebug(5700) << " Photo: '" << photo().asString() << "'" << endl; |
1713 | kdDebug(5700) << " Sound: '" << sound().asString() << "'" << endl; | 1714 | kdDebug(5700) << " Sound: '" << sound().asString() << "'" << endl; |
1714 | kdDebug(5700) << " Agent: '" << agent().asString() << "'" << endl; | 1715 | kdDebug(5700) << " Agent: '" << agent().asString() << "'" << endl; |
1715 | 1716 | ||
1716 | kdDebug(5700) << " Emails {" << endl; | 1717 | kdDebug(5700) << " Emails {" << endl; |
1717 | QStringList e = emails(); | 1718 | QStringList e = emails(); |
1718 | QStringList::ConstIterator it; | 1719 | QStringList::ConstIterator it; |
1719 | for( it = e.begin(); it != e.end(); ++it ) { | 1720 | for( it = e.begin(); it != e.end(); ++it ) { |
1720 | kdDebug(5700) << " " << (*it) << endl; | 1721 | kdDebug(5700) << " " << (*it) << endl; |
1721 | } | 1722 | } |
1722 | kdDebug(5700) << " }" << endl; | 1723 | kdDebug(5700) << " }" << endl; |
1723 | 1724 | ||
1724 | kdDebug(5700) << " PhoneNumbers {" << endl; | 1725 | kdDebug(5700) << " PhoneNumbers {" << endl; |
1725 | PhoneNumber::List p = phoneNumbers(); | 1726 | PhoneNumber::List p = phoneNumbers(); |
1726 | PhoneNumber::List::ConstIterator it2; | 1727 | PhoneNumber::List::ConstIterator it2; |
1727 | for( it2 = p.begin(); it2 != p.end(); ++it2 ) { | 1728 | for( it2 = p.begin(); it2 != p.end(); ++it2 ) { |
1728 | kdDebug(5700) << " Type: " << int((*it2).type()) << " Number: " << (*it2).number() << endl; | 1729 | kdDebug(5700) << " Type: " << int((*it2).type()) << " Number: " << (*it2).number() << endl; |
1729 | } | 1730 | } |
1730 | kdDebug(5700) << " }" << endl; | 1731 | kdDebug(5700) << " }" << endl; |
1731 | 1732 | ||
1732 | Address::List a = addresses(); | 1733 | Address::List a = addresses(); |
1733 | Address::List::ConstIterator it3; | 1734 | Address::List::ConstIterator it3; |
1734 | for( it3 = a.begin(); it3 != a.end(); ++it3 ) { | 1735 | for( it3 = a.begin(); it3 != a.end(); ++it3 ) { |
1735 | (*it3).dump(); | 1736 | (*it3).dump(); |
1736 | } | 1737 | } |
1737 | 1738 | ||
1738 | kdDebug(5700) << " Keys {" << endl; | 1739 | kdDebug(5700) << " Keys {" << endl; |
1739 | Key::List k = keys(); | 1740 | Key::List k = keys(); |
1740 | Key::List::ConstIterator it4; | 1741 | Key::List::ConstIterator it4; |
1741 | for( it4 = k.begin(); it4 != k.end(); ++it4 ) { | 1742 | for( it4 = k.begin(); it4 != k.end(); ++it4 ) { |
1742 | kdDebug(5700) << " Type: " << int((*it4).type()) << | 1743 | kdDebug(5700) << " Type: " << int((*it4).type()) << |
1743 | " Key: " << (*it4).textData() << | 1744 | " Key: " << (*it4).textData() << |
1744 | " CustomString: " << (*it4).customTypeString() << endl; | 1745 | " CustomString: " << (*it4).customTypeString() << endl; |
1745 | } | 1746 | } |
1746 | kdDebug(5700) << " }" << endl; | 1747 | kdDebug(5700) << " }" << endl; |
1747 | 1748 | ||
1748 | kdDebug(5700) << "}" << endl; | 1749 | kdDebug(5700) << "}" << endl; |
1750 | #endif | ||
1749 | } | 1751 | } |
1750 | 1752 | ||
1751 | 1753 | ||
1752 | void Addressee::insertAddress( const Address &address ) | 1754 | void Addressee::insertAddress( const Address &address ) |
1753 | { | 1755 | { |
1754 | detach(); | 1756 | detach(); |
1755 | mData->empty = false; | 1757 | mData->empty = false; |
1756 | 1758 | ||
1757 | Address::List::Iterator it; | 1759 | Address::List::Iterator it; |
1758 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 1760 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
1759 | if ( (*it).id() == address.id() ) { | 1761 | if ( (*it).id() == address.id() ) { |
1760 | *it = address; | 1762 | *it = address; |
1761 | return; | 1763 | return; |
1762 | } | 1764 | } |
1763 | } | 1765 | } |
1764 | mData->addresses.append( address ); | 1766 | mData->addresses.append( address ); |
1765 | } | 1767 | } |
1766 | 1768 | ||
1767 | void Addressee::removeAddress( const Address &address ) | 1769 | void Addressee::removeAddress( const Address &address ) |
1768 | { | 1770 | { |
1769 | detach(); | 1771 | detach(); |
1770 | 1772 | ||
1771 | Address::List::Iterator it; | 1773 | Address::List::Iterator it; |
1772 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 1774 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
1773 | if ( (*it).id() == address.id() ) { | 1775 | if ( (*it).id() == address.id() ) { |
1774 | mData->addresses.remove( it ); | 1776 | mData->addresses.remove( it ); |
1775 | return; | 1777 | return; |
1776 | } | 1778 | } |
1777 | } | 1779 | } |
1778 | } | 1780 | } |
1779 | 1781 | ||
1780 | Address Addressee::address( int type ) const | 1782 | Address Addressee::address( int type ) const |
1781 | { | 1783 | { |
1782 | Address address( type ); | 1784 | Address address( type ); |
1783 | Address::List::ConstIterator it; | 1785 | Address::List::ConstIterator it; |
1784 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 1786 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
1785 | if ( matchBinaryPatternA( (*it).type(), type ) ) { | 1787 | if ( matchBinaryPatternA( (*it).type(), type ) ) { |
1786 | if ( (*it).type() & Address::Pref ) | 1788 | if ( (*it).type() & Address::Pref ) |
1787 | return (*it); | 1789 | return (*it); |
1788 | else if ( address.isEmpty() ) | 1790 | else if ( address.isEmpty() ) |
1789 | address = (*it); | 1791 | address = (*it); |
1790 | } | 1792 | } |
1791 | } | 1793 | } |
1792 | 1794 | ||
1793 | return address; | 1795 | return address; |
1794 | } | 1796 | } |
1795 | 1797 | ||
1796 | Address::List Addressee::addresses() const | 1798 | Address::List Addressee::addresses() const |
1797 | { | 1799 | { |
1798 | return mData->addresses; | 1800 | return mData->addresses; |
1799 | } | 1801 | } |
1800 | 1802 | ||
1801 | Address::List Addressee::addresses( int type ) const | 1803 | Address::List Addressee::addresses( int type ) const |
1802 | { | 1804 | { |
1803 | Address::List list; | 1805 | Address::List list; |
1804 | 1806 | ||
1805 | Address::List::ConstIterator it; | 1807 | Address::List::ConstIterator it; |
1806 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 1808 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
1807 | if ( matchBinaryPattern( (*it).type(), type ) ) { | 1809 | if ( matchBinaryPattern( (*it).type(), type ) ) { |
1808 | list.append( *it ); | 1810 | list.append( *it ); |
1809 | } | 1811 | } |
1810 | } | 1812 | } |
1811 | 1813 | ||
1812 | return list; | 1814 | return list; |
1813 | } | 1815 | } |
1814 | 1816 | ||
1815 | Address Addressee::findAddress( const QString &id ) const | 1817 | Address Addressee::findAddress( const QString &id ) const |
1816 | { | 1818 | { |
1817 | Address::List::ConstIterator it; | 1819 | Address::List::ConstIterator it; |
1818 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 1820 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
1819 | if ( (*it).id() == id ) { | 1821 | if ( (*it).id() == id ) { |
1820 | return *it; | 1822 | return *it; |
1821 | } | 1823 | } |
1822 | } | 1824 | } |
1823 | return Address(); | 1825 | return Address(); |
1824 | } | 1826 | } |
1825 | 1827 | ||
1826 | void Addressee::insertCategory( const QString &c ) | 1828 | void Addressee::insertCategory( const QString &c ) |
1827 | { | 1829 | { |
1828 | detach(); | 1830 | detach(); |
1829 | mData->empty = false; | 1831 | mData->empty = false; |
1830 | 1832 | ||
1831 | if ( mData->categories.contains( c ) ) return; | 1833 | if ( mData->categories.contains( c ) ) return; |
1832 | 1834 | ||
1833 | mData->categories.append( c ); | 1835 | mData->categories.append( c ); |
1834 | } | 1836 | } |
1835 | 1837 | ||
1836 | void Addressee::removeCategory( const QString &c ) | 1838 | void Addressee::removeCategory( const QString &c ) |
1837 | { | 1839 | { |
1838 | detach(); | 1840 | detach(); |
1839 | 1841 | ||
1840 | QStringList::Iterator it = mData->categories.find( c ); | 1842 | QStringList::Iterator it = mData->categories.find( c ); |
1841 | if ( it == mData->categories.end() ) return; | 1843 | if ( it == mData->categories.end() ) return; |
1842 | 1844 | ||
1843 | mData->categories.remove( it ); | 1845 | mData->categories.remove( it ); |
1844 | } | 1846 | } |
diff --git a/kabc/picture.cpp b/kabc/picture.cpp index 6a34b98..57aa297 100644 --- a/kabc/picture.cpp +++ b/kabc/picture.cpp | |||
@@ -1,141 +1,167 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "picture.h" | 28 | #include "picture.h" |
29 | 29 | ||
30 | using namespace KABC; | 30 | using namespace KABC; |
31 | 31 | ||
32 | Picture::Picture() | 32 | Picture::Picture() |
33 | : mIntern( false ) | 33 | : mIntern( false ) |
34 | { | 34 | { |
35 | mUndefined = true; | 35 | mUndefined = true; |
36 | } | 36 | } |
37 | 37 | ||
38 | Picture::Picture( const QString &url ) | 38 | Picture::Picture( const QString &url ) |
39 | : mUrl( url ), mIntern( false ) | 39 | : mUrl( url ), mIntern( false ) |
40 | { | 40 | { |
41 | mUndefined = false; | 41 | mUndefined = false; |
42 | } | 42 | } |
43 | 43 | ||
44 | Picture::Picture( const QImage &data ) | 44 | Picture::Picture( const QImage &data ) |
45 | : mData( data ), mIntern( true ) | 45 | : mData( data ), mIntern( true ) |
46 | { | 46 | { |
47 | mUndefined = false; | 47 | mUndefined = false; |
48 | } | 48 | } |
49 | 49 | ||
50 | Picture::~Picture() | 50 | Picture::~Picture() |
51 | { | 51 | { |
52 | } | 52 | } |
53 | 53 | ||
54 | bool Picture::operator==( const Picture &p ) const | 54 | bool Picture::operator==( const Picture &p ) const |
55 | { | 55 | { |
56 | if ( mIntern != p.mIntern ) return false; | 56 | //qDebug("compare PIC "); |
57 | 57 | if ( mUndefined && p.mUndefined ) { | |
58 | //qDebug("compare PIC true 1 "); | ||
59 | return true; | ||
60 | } | ||
61 | if ( mUndefined || p.mUndefined ) { | ||
62 | //qDebug("compare PIC false 1"); | ||
63 | return false; | ||
64 | } | ||
65 | // now we should deal with two defined pics! | ||
66 | if ( mIntern != p.mIntern ) { | ||
67 | //qDebug("compare PIC false 2"); | ||
68 | return false; | ||
69 | } | ||
58 | if ( mIntern ) { | 70 | if ( mIntern ) { |
59 | if ( mData != p.mData ) | 71 | //qDebug("mIntern "); |
72 | if ( mData.isNull() && p.mData.isNull() ) { | ||
73 | //qDebug("compare PIC true 2 "); | ||
74 | return true; | ||
75 | } | ||
76 | if ( mData.isNull() || p.mData.isNull() ){ | ||
77 | //qDebug("compare PIC false 3-1"); | ||
78 | |||
79 | return false; | ||
80 | } | ||
81 | if ( mData != p.mData ) { | ||
82 | //qDebug("compare PIC false 3"); | ||
60 | return false; | 83 | return false; |
84 | } | ||
61 | } else { | 85 | } else { |
62 | if ( mUrl != p.mUrl ) | 86 | if ( mUrl != p.mUrl ) { |
63 | return false; | 87 | //qDebug("compare PIC false 4"); |
88 | return false; | ||
89 | } | ||
64 | } | 90 | } |
65 | 91 | //qDebug("compare PIC true "); | |
66 | return true; | 92 | return true; |
67 | } | 93 | } |
68 | 94 | ||
69 | bool Picture::operator!=( const Picture &p ) const | 95 | bool Picture::operator!=( const Picture &p ) const |
70 | { | 96 | { |
71 | return !( p == *this ); | 97 | return !( p == *this ); |
72 | } | 98 | } |
73 | 99 | ||
74 | void Picture::setUrl( const QString &url ) | 100 | void Picture::setUrl( const QString &url ) |
75 | { | 101 | { |
76 | mUrl = url; | 102 | mUrl = url; |
77 | mIntern = false; | 103 | mIntern = false; |
78 | mUndefined = false; | 104 | mUndefined = false; |
79 | } | 105 | } |
80 | 106 | ||
81 | void Picture::setData( const QImage &data ) | 107 | void Picture::setData( const QImage &data ) |
82 | { | 108 | { |
83 | mData = data; | 109 | mData = data; |
84 | mIntern = true; | 110 | mIntern = true; |
85 | mUndefined = false; | 111 | mUndefined = false; |
86 | } | 112 | } |
87 | 113 | ||
88 | void Picture::setType( const QString &type ) | 114 | void Picture::setType( const QString &type ) |
89 | { | 115 | { |
90 | mType = type; | 116 | mType = type; |
91 | } | 117 | } |
92 | 118 | ||
93 | bool Picture::isIntern() const | 119 | bool Picture::isIntern() const |
94 | { | 120 | { |
95 | return mIntern; | 121 | return mIntern; |
96 | } | 122 | } |
97 | 123 | ||
98 | QString Picture::url() const | 124 | QString Picture::url() const |
99 | { | 125 | { |
100 | return mUrl; | 126 | return mUrl; |
101 | } | 127 | } |
102 | 128 | ||
103 | QImage Picture::data() const | 129 | QImage Picture::data() const |
104 | { | 130 | { |
105 | return mData; | 131 | return mData; |
106 | } | 132 | } |
107 | QPixmap Picture::pixmap() const | 133 | QPixmap Picture::pixmap() const |
108 | { | 134 | { |
109 | QPixmap p; | 135 | QPixmap p; |
110 | p.convertFromImage ( mData ); | 136 | p.convertFromImage ( mData ); |
111 | return p; | 137 | return p; |
112 | } | 138 | } |
113 | 139 | ||
114 | QString Picture::type() const | 140 | QString Picture::type() const |
115 | { | 141 | { |
116 | return mType; | 142 | return mType; |
117 | } | 143 | } |
118 | bool Picture::undefined() const | 144 | bool Picture::undefined() const |
119 | { | 145 | { |
120 | return mUndefined; | 146 | return mUndefined; |
121 | } | 147 | } |
122 | 148 | ||
123 | 149 | ||
124 | QString Picture::asString() const | 150 | QString Picture::asString() const |
125 | { | 151 | { |
126 | if ( mIntern ) | 152 | if ( mIntern ) |
127 | return "intern picture"; | 153 | return "intern picture"; |
128 | else | 154 | else |
129 | return mUrl; | 155 | return mUrl; |
130 | } | 156 | } |
131 | 157 | ||
132 | QDataStream &KABC::operator<<( QDataStream &s, const Picture &picture ) | 158 | QDataStream &KABC::operator<<( QDataStream &s, const Picture &picture ) |
133 | { | 159 | { |
134 | return s << picture.mIntern << picture.mUrl << picture.mType << picture.mData; | 160 | return s << picture.mIntern << picture.mUrl << picture.mType << picture.mData; |
135 | } | 161 | } |
136 | 162 | ||
137 | QDataStream &KABC::operator>>( QDataStream &s, Picture &picture ) | 163 | QDataStream &KABC::operator>>( QDataStream &s, Picture &picture ) |
138 | { | 164 | { |
139 | s >> picture.mIntern >> picture.mUrl >> picture.mType >> picture.mData; | 165 | s >> picture.mIntern >> picture.mUrl >> picture.mType >> picture.mData; |
140 | return s; | 166 | return s; |
141 | } | 167 | } |
diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp index c368172..2f88cde 100644 --- a/kabc/vcard/ContentLine.cpp +++ b/kabc/vcard/ContentLine.cpp | |||
@@ -180,142 +180,170 @@ ContentLine::_parse() | |||
180 | group_ = firstPart.left(split); | 180 | group_ = firstPart.left(split); |
181 | firstPart= firstPart.mid(split + 1); | 181 | firstPart= firstPart.mid(split + 1); |
182 | } | 182 | } |
183 | 183 | ||
184 | vDebug("Group == " + group_); | 184 | vDebug("Group == " + group_); |
185 | vDebug("firstPart == " + firstPart); | 185 | vDebug("firstPart == " + firstPart); |
186 | vDebug("valuePart == " + valuePart); | 186 | vDebug("valuePart == " + valuePart); |
187 | 187 | ||
188 | // Now we have the group, the name and param list together and the value. | 188 | // Now we have the group, the name and param list together and the value. |
189 | 189 | ||
190 | QStrList l; | 190 | QStrList l; |
191 | 191 | ||
192 | RTokenise(firstPart, ";", l); | 192 | RTokenise(firstPart, ";", l); |
193 | 193 | ||
194 | if (l.count() == 0) {// invalid - no name ! | 194 | if (l.count() == 0) {// invalid - no name ! |
195 | vDebug("No name for this content line !"); | 195 | vDebug("No name for this content line !"); |
196 | return; | 196 | return; |
197 | } | 197 | } |
198 | 198 | ||
199 | name_ = l.at(0); | 199 | name_ = l.at(0); |
200 | 200 | ||
201 | // Now we have the name, so the rest of 'l' is the params. | 201 | // Now we have the name, so the rest of 'l' is the params. |
202 | // Remove the name part. | 202 | // Remove the name part. |
203 | l.remove(0u); | 203 | l.remove(0u); |
204 | 204 | ||
205 | entityType_= EntityNameToEntityType(name_); | 205 | entityType_= EntityNameToEntityType(name_); |
206 | paramType_= EntityTypeToParamType(entityType_); | 206 | paramType_= EntityTypeToParamType(entityType_); |
207 | 207 | ||
208 | unsigned int i = 0; | 208 | unsigned int i = 0; |
209 | 209 | ||
210 | // For each parameter, create a new parameter of the correct type. | 210 | // For each parameter, create a new parameter of the correct type. |
211 | 211 | ||
212 | QStrListIterator it(l); | 212 | QStrListIterator it(l); |
213 | 213 | ||
214 | for (; it.current(); ++it, i++) { | 214 | for (; it.current(); ++it, i++) { |
215 | 215 | ||
216 | QCString str = *it; | 216 | QCString str = *it; |
217 | 217 | ||
218 | split = str.find("="); | 218 | split = str.find("="); |
219 | if (split < 0 ) { | 219 | if (split < 0 ) { |
220 | vDebug("No '=' in paramter."); | 220 | vDebug("No '=' in paramter."); |
221 | continue; | 221 | continue; |
222 | } | 222 | } |
223 | 223 | ||
224 | QCString paraName = str.left(split); | 224 | QCString paraName = str.left(split); |
225 | QCString paraValue = str.mid(split + 1); | 225 | QCString paraValue = str.mid(split + 1); |
226 | 226 | ||
227 | QStrList paraValues; | 227 | QStrList paraValues; |
228 | RTokenise(paraValue, ",", paraValues); | 228 | RTokenise(paraValue, ",", paraValues); |
229 | 229 | ||
230 | QStrListIterator it2( paraValues ); | 230 | QStrListIterator it2( paraValues ); |
231 | 231 | ||
232 | for(; it2.current(); ++it2) { | 232 | for(; it2.current(); ++it2) { |
233 | 233 | ||
234 | Param *p = new Param; | 234 | Param *p = new Param; |
235 | p->setName( paraName ); | 235 | p->setName( paraName ); |
236 | p->setValue( *it2 ); | 236 | p->setValue( *it2 ); |
237 | 237 | ||
238 | paramList_.append(p); | 238 | paramList_.append(p); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | // Create a new value of the correct type. | 242 | // Create a new value of the correct type. |
243 | 243 | ||
244 | valueType_ = EntityTypeToValueType(entityType_); | 244 | valueType_ = EntityTypeToValueType(entityType_); |
245 | 245 | ||
246 | //kdDebug(5710) << "valueType: " << valueType_ << endl; | 246 | //kdDebug(5710) << "valueType: " << valueType_ << endl; |
247 | 247 | ||
248 | switch (valueType_) { | 248 | switch (valueType_) { |
249 | 249 | ||
250 | case ValueSound: value_ = new SoundValue;break; | 250 | case ValueSound: value_ = new SoundValue;break; |
251 | case ValueAgent: value_ = new AgentValue;break; | 251 | case ValueAgent: value_ = new AgentValue;break; |
252 | case ValueAddress: value_ = new AdrValue; break; | 252 | case ValueAddress: value_ = new AdrValue; break; |
253 | case ValueTel: value_ = new TelValue; break; | 253 | case ValueTel: value_ = new TelValue; break; |
254 | case ValueTextBin: value_ = new TextBinValue;break; | 254 | case ValueTextBin: value_ = new TextBinValue;break; |
255 | case ValueOrg: value_ = new OrgValue; break; | 255 | case ValueOrg: value_ = new OrgValue; break; |
256 | case ValueN: value_ = new NValue; break; | 256 | case ValueN: value_ = new NValue; break; |
257 | case ValueUTC: value_ = new UTCValue; break; | 257 | case ValueUTC: value_ = new UTCValue; break; |
258 | case ValueURI: value_ = new URIValue; break; | 258 | case ValueURI: value_ = new URIValue; break; |
259 | case ValueClass: value_ = new ClassValue;break; | 259 | case ValueClass: value_ = new ClassValue;break; |
260 | case ValueFloat: value_ = new FloatValue;break; | 260 | case ValueFloat: value_ = new FloatValue;break; |
261 | case ValueImage: value_ = new ImageValue;break; | 261 | case ValueImage: value_ = new ImageValue;break; |
262 | case ValueDate: value_ = new DateValue; break; | 262 | case ValueDate: value_ = new DateValue; break; |
263 | case ValueTextList: value_ = new TextListValue;break; | 263 | case ValueTextList: value_ = new TextListValue;break; |
264 | case ValueGeo: value_ = new GeoValue; break; | 264 | case ValueGeo: value_ = new GeoValue; break; |
265 | case ValueText: | 265 | case ValueText: |
266 | case ValueUnknown: | 266 | case ValueUnknown: |
267 | default: value_ = new TextValue; break; | 267 | default: value_ = new TextValue; break; |
268 | } | 268 | } |
269 | 269 | ||
270 | *value_ = valuePart; | 270 | *value_ = valuePart; |
271 | } | 271 | } |
272 | 272 | ||
273 | void | 273 | void |
274 | ContentLine::_assemble() | 274 | ContentLine::_assemble() |
275 | { | 275 | { |
276 | //strRep_.truncate(0); | ||
277 | QString line; | ||
278 | if (!group_.isEmpty()) | ||
279 | line = group_ + '.'; | ||
280 | line += name_; | ||
281 | ParamListIterator it(paramList_); | ||
282 | for (; it.current(); ++it) | ||
283 | line += ";" + it.current()->asString(); | ||
284 | |||
285 | if (value_ != 0) | ||
286 | line += ":" + value_->asString(); | ||
287 | |||
288 | line = line.replace( QRegExp( "\n" ), "\\n" ); | ||
289 | |||
290 | // Fold lines longer than 72 chars | ||
291 | const int maxLen = 72; | ||
292 | uint cursor = 0; | ||
293 | QString cut; | ||
294 | while( line.length() > ( cursor + 1 ) * maxLen ) { | ||
295 | cut += line.mid( cursor * maxLen, maxLen ); | ||
296 | cut += "\r\n "; | ||
297 | ++cursor; | ||
298 | } | ||
299 | cut += line.mid( cursor * maxLen ); | ||
300 | strRep_ = cut.latin1(); | ||
301 | //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); | ||
302 | #if 0 | ||
276 | vDebug("Assemble (argl) - my name is \"" + name_ + "\""); | 303 | vDebug("Assemble (argl) - my name is \"" + name_ + "\""); |
277 | strRep_.truncate(0); | 304 | strRep_.truncate(0); |
278 | 305 | ||
279 | QCString line; | 306 | QCString line; |
280 | 307 | ||
281 | if (!group_.isEmpty()) | 308 | if (!group_.isEmpty()) |
282 | line += group_ + '.'; | 309 | line += group_ + '.'; |
283 | 310 | ||
284 | line += name_; | 311 | line += name_; |
285 | 312 | ||
286 | vDebug("Adding parameters"); | 313 | vDebug("Adding parameters"); |
287 | ParamListIterator it(paramList_); | 314 | ParamListIterator it(paramList_); |
288 | 315 | ||
289 | for (; it.current(); ++it) | 316 | for (; it.current(); ++it) |
290 | line += ";" + it.current()->asString(); | 317 | line += ";" + it.current()->asString(); |
291 | 318 | ||
292 | vDebug("Adding value"); | 319 | vDebug("Adding value"); |
293 | if (value_ != 0) | 320 | if (value_ != 0) |
294 | line += ":" + value_->asString(); | 321 | line += ":" + value_->asString(); |
295 | else | 322 | else |
296 | vDebug("No value"); | 323 | vDebug("No value"); |
297 | 324 | ||
298 | // Quote newlines | 325 | // Quote newlines |
299 | line = line.replace( QRegExp( "\n" ), "\\n" ); | 326 | line = line.replace( QRegExp( "\n" ), "\\n" ); |
300 | 327 | ||
301 | // Fold lines longer than 72 chars | 328 | // Fold lines longer than 72 chars |
302 | const int maxLen = 72; | 329 | const int maxLen = 72; |
303 | uint cursor = 0; | 330 | uint cursor = 0; |
304 | while( line.length() > ( cursor + 1 ) * maxLen ) { | 331 | while( line.length() > ( cursor + 1 ) * maxLen ) { |
305 | strRep_ += line.mid( cursor * maxLen, maxLen ); | 332 | strRep_ += line.mid( cursor * maxLen, maxLen ); |
306 | strRep_ += "\r\n "; | 333 | strRep_ += "\r\n "; |
307 | ++cursor; | 334 | ++cursor; |
308 | } | 335 | } |
309 | strRep_ += line.mid( cursor * maxLen ); | 336 | strRep_ += line.mid( cursor * maxLen ); |
310 | //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); | 337 | qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); |
338 | #endif | ||
311 | } | 339 | } |
312 | 340 | ||
313 | void | 341 | void |
314 | ContentLine::clear() | 342 | ContentLine::clear() |
315 | { | 343 | { |
316 | group_.truncate(0); | 344 | group_.truncate(0); |
317 | name_.truncate(0); | 345 | name_.truncate(0); |
318 | paramList_.clear(); | 346 | paramList_.clear(); |
319 | delete value_; | 347 | delete value_; |
320 | value_ = 0; | 348 | value_ = 0; |
321 | } | 349 | } |
diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp index bc80707..49bfe43 100644 --- a/kabc/vcard/VCardv.cpp +++ b/kabc/vcard/VCardv.cpp | |||
@@ -1,299 +1,294 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcstring.h> | 24 | #include <qcstring.h> |
25 | #include <qstrlist.h> | 25 | #include <qstrlist.h> |
26 | #include <qstringlist.h> | ||
27 | #include <qstring.h> | ||
28 | #include <qvaluelist.h> | ||
26 | 29 | ||
27 | #include <VCardEntity.h> | 30 | #include <VCardEntity.h> |
28 | #include <VCardVCard.h> | 31 | #include <VCardVCard.h> |
29 | #include <VCardContentLine.h> | 32 | #include <VCardContentLine.h> |
30 | #include <VCardRToken.h> | 33 | #include <VCardRToken.h> |
31 | 34 | ||
32 | #include <VCardDefines.h> | 35 | #include <VCardDefines.h> |
33 | 36 | ||
34 | using namespace VCARD; | 37 | using namespace VCARD; |
35 | 38 | ||
36 | VCard::VCard() | 39 | VCard::VCard() |
37 | :Entity() | 40 | :Entity() |
38 | { | 41 | { |
39 | contentLineList_.setAutoDelete( TRUE ); | 42 | contentLineList_.setAutoDelete( TRUE ); |
40 | } | 43 | } |
41 | 44 | ||
42 | VCard::VCard(const VCard & x) | 45 | VCard::VCard(const VCard & x) |
43 | :Entity(x), | 46 | :Entity(x), |
44 | group_(x.group_) | 47 | group_(x.group_) |
45 | { | 48 | { |
46 | contentLineList_.setAutoDelete( TRUE ); | 49 | contentLineList_.setAutoDelete( TRUE ); |
47 | 50 | ||
48 | QPtrListIterator<ContentLine> it(x.contentLineList_); | 51 | QPtrListIterator<ContentLine> it(x.contentLineList_); |
49 | for (; it.current(); ++it) { | 52 | for (; it.current(); ++it) { |
50 | ContentLine * c = new ContentLine(*it.current()); | 53 | ContentLine * c = new ContentLine(*it.current()); |
51 | contentLineList_.append(c); | 54 | contentLineList_.append(c); |
52 | } | 55 | } |
53 | 56 | ||
54 | } | 57 | } |
55 | 58 | ||
56 | VCard::VCard(const QCString & s) | 59 | VCard::VCard(const QCString & s) |
57 | :Entity(s) | 60 | :Entity(s) |
58 | { | 61 | { |
59 | contentLineList_.setAutoDelete( TRUE ); | 62 | contentLineList_.setAutoDelete( TRUE ); |
60 | } | 63 | } |
61 | 64 | ||
62 | VCard & | 65 | VCard & |
63 | VCard::operator = (VCard & x) | 66 | VCard::operator = (VCard & x) |
64 | { | 67 | { |
65 | if (*this == x) return *this; | 68 | if (*this == x) return *this; |
66 | 69 | ||
67 | group_ = x.group(); | 70 | group_ = x.group(); |
68 | QPtrListIterator<ContentLine> it(x.contentLineList_); | 71 | QPtrListIterator<ContentLine> it(x.contentLineList_); |
69 | for (; it.current(); ++it) { | 72 | for (; it.current(); ++it) { |
70 | ContentLine * c = new ContentLine(*it.current()); | 73 | ContentLine * c = new ContentLine(*it.current()); |
71 | contentLineList_.append(c); | 74 | contentLineList_.append(c); |
72 | } | 75 | } |
73 | 76 | ||
74 | Entity::operator = (x); | 77 | Entity::operator = (x); |
75 | return *this; | 78 | return *this; |
76 | } | 79 | } |
77 | 80 | ||
78 | VCard & | 81 | VCard & |
79 | VCard::operator = (const QCString & s) | 82 | VCard::operator = (const QCString & s) |
80 | { | 83 | { |
81 | Entity::operator = (s); | 84 | Entity::operator = (s); |
82 | return *this; | 85 | return *this; |
83 | } | 86 | } |
84 | 87 | ||
85 | bool | 88 | bool |
86 | VCard::operator == (VCard & x) | 89 | VCard::operator == (VCard & x) |
87 | { | 90 | { |
88 | x.parse(); | 91 | x.parse(); |
89 | return false; | 92 | return false; |
90 | } | 93 | } |
91 | 94 | ||
92 | VCard::~VCard() | 95 | VCard::~VCard() |
93 | { | 96 | { |
94 | } | 97 | } |
95 | 98 | ||
96 | void | 99 | void |
97 | VCard::_parse() | 100 | VCard::_parse() |
98 | { | 101 | { |
99 | vDebug("parse() called"); | 102 | |
100 | QStrList l; | 103 | QStringList l; |
104 | QStrList sl; | ||
101 | 105 | ||
102 | RTokenise(strRep_, "\r\n", l); | 106 | RTokenise(strRep_, "\r\n", sl); |
103 | 107 | ||
104 | if (l.count() < 3) { // Invalid VCARD ! | 108 | if (sl.count() < 3) { // Invalid VCARD ! |
105 | vDebug("Invalid vcard"); | 109 | //qDebug("invalid vcard "); |
106 | return; | 110 | return; |
107 | } | 111 | } |
108 | 112 | l = QStringList::fromStrList( sl ); | |
109 | // Get the first line | 113 | // Get the first line |
110 | QCString beginLine = QCString(l.at(0)).stripWhiteSpace(); | 114 | QString beginLine = l[0].stripWhiteSpace(); |
111 | |||
112 | vDebug("Begin line == \"" + beginLine + "\""); | ||
113 | 115 | ||
114 | // Remove extra blank lines | 116 | // Remove extra blank lines |
115 | while (QCString(l.last()).isEmpty()) | 117 | while (l.last().isEmpty()) |
116 | l.remove(l.last()); | 118 | l.remove(l.last()); |
117 | 119 | ||
118 | // Now we know this is the last line | 120 | // Now we know this is the last line |
119 | QCString endLine = l.last(); | 121 | QString endLine = l.last(); |
120 | 122 | ||
121 | // Trash the first and last lines as we have seen them. | 123 | // Trash the first and last lines as we have seen them. |
122 | l.remove(0u); | 124 | l.remove(l.first()); |
123 | l.remove(l.last()); | 125 | l.remove(l.last()); |
124 | 126 | ||
125 | /////////////////////////////////////////////////////////////// | 127 | /////////////////////////////////////////////////////////////// |
126 | // FIRST LINE | 128 | // FIRST LINE |
127 | 129 | ||
128 | int split = beginLine.find(':'); | 130 | int split = beginLine.find(':'); |
129 | 131 | ||
130 | if (split == -1) { // invalid, no BEGIN | 132 | if (split == -1) { // invalid, no BEGIN |
131 | vDebug("No split"); | 133 | vDebug("No split"); |
132 | return; | 134 | return; |
133 | } | 135 | } |
134 | 136 | ||
135 | QCString firstPart(beginLine.left(split)); | 137 | QString firstPart(beginLine.left(split)); |
136 | QCString valuePart(beginLine.mid(split + 1)); | 138 | QString valuePart(beginLine.mid(split + 1)); |
137 | 139 | ||
138 | split = firstPart.find('.'); | 140 | split = firstPart.find('.'); |
139 | 141 | ||
140 | if (split != -1) { | 142 | if (split != -1) { |
141 | group_ = firstPart.left(split); | 143 | group_ = firstPart.left(split); |
142 | firstPart= firstPart.right(firstPart.length() - split - 1); | 144 | firstPart= firstPart.right(firstPart.length() - split - 1); |
143 | } | 145 | } |
144 | 146 | ||
145 | if (qstrnicmp(firstPart, "BEGIN", 5) != 0) { // No BEGIN ! | 147 | if (firstPart.left(5) != "BEGIN" ) { // No BEGIN ! |
146 | vDebug("No BEGIN"); | 148 | qDebug("no BEGIN in vcard "); |
147 | return; | 149 | return; |
148 | } | 150 | } |
149 | 151 | ||
150 | if (qstrnicmp(valuePart, "VCARD", 5) != 0) { // Not a vcard ! | 152 | if (valuePart.left(5) != "VCARD") { // Not a vcard ! |
151 | vDebug("No VCARD"); | 153 | qDebug("not a VCARD "); |
152 | return; | 154 | return; |
153 | } | 155 | } |
154 | 156 | ||
155 | /////////////////////////////////////////////////////////////// | 157 | /////////////////////////////////////////////////////////////// |
156 | // CONTENT LINES | 158 | // CONTENT LINES |
157 | // | 159 | // |
158 | vDebug("Content lines"); | 160 | vDebug("Content lines"); |
159 | 161 | ||
160 | // Handle folded lines. | 162 | // Handle folded lines. |
161 | 163 | ||
162 | QStrList refolded; | 164 | QStringList refolded; |
163 | |||
164 | QStrListIterator it(l); | ||
165 | 165 | ||
166 | QCString cur; | ||
167 | 166 | ||
168 | for (; it.current(); ++it) { | 167 | QStringList::Iterator it = l.begin(); |
169 | 168 | ||
170 | cur = it.current(); | 169 | QString cur; |
171 | 170 | ||
171 | for (; it != l.end(); ++it) { | ||
172 | cur = (*it); | ||
172 | ++it; | 173 | ++it; |
173 | 174 | while ( it!= l.end() && (*it).at(0) == ' '&& (*it).length()!= 1) { | |
174 | while ( | 175 | cur += (*it) ; |
175 | it.current() && | ||
176 | it.current()[0] == ' '&& | ||
177 | strlen(it.current()) != 1) | ||
178 | { | ||
179 | cur += it.current() + 1; | ||
180 | ++it; | 176 | ++it; |
181 | } | 177 | } |
182 | |||
183 | --it; | 178 | --it; |
184 | |||
185 | refolded.append(cur); | 179 | refolded.append(cur); |
186 | } | 180 | } |
187 | 181 | QStringList::Iterator it2 = refolded.begin(); | |
188 | QStrListIterator it2(refolded); | 182 | for (; it2 != refolded.end(); ++it2) { |
189 | 183 | ContentLine * cl = new ContentLine(QCString((*it2).latin1())); | |
190 | for (; it2.current(); ++it2) { | ||
191 | vDebug("New contentline using \"" + QCString(it2.current()) + "\""); | ||
192 | ContentLine * cl = new ContentLine(it2.current()); | ||
193 | |||
194 | cl->parse(); | 184 | cl->parse(); |
195 | if (cl->value() == 0) | 185 | if (cl->value() == 0) |
196 | { | 186 | { |
197 | qDebug("Content line could not be parsed. Discarded: %s", it2.current()); | 187 | qDebug("Content line could not be parsed. Discarded: %s", (*it2).latin1()); |
198 | delete cl; | 188 | delete cl; |
199 | } | 189 | } |
200 | else | 190 | else |
201 | contentLineList_.append(cl); | 191 | contentLineList_.append(cl); |
202 | } | 192 | } |
203 | 193 | ||
204 | /////////////////////////////////////////////////////////////// | 194 | /////////////////////////////////////////////////////////////// |
205 | // LAST LINE | 195 | // LAST LINE |
206 | 196 | ||
197 | |||
198 | // LR: sorry, but the remaining code in this method makes no sense | ||
199 | |||
200 | #if 0 | ||
207 | split = endLine.find(':'); | 201 | split = endLine.find(':'); |
208 | 202 | ||
209 | if (split == -1) // invalid, no END | 203 | if (split == -1) // invalid, no END |
210 | return; | 204 | return; |
211 | 205 | ||
212 | firstPart = endLine.left(split); | 206 | firstPart = endLine.left(split); |
213 | valuePart = endLine.right(firstPart.length() - split - 1); | 207 | valuePart = endLine.right(firstPart.length() - split - 1); |
214 | 208 | ||
215 | split = firstPart.find('.'); | 209 | split = firstPart.find('.'); |
216 | 210 | ||
217 | if (split != -1) { | 211 | if (split != -1) { |
218 | group_ = firstPart.left(split); | 212 | group_ = firstPart.left(split); |
219 | firstPart= firstPart.right(firstPart.length() - split - 1); | 213 | firstPart= firstPart.right(firstPart.length() - split - 1); |
220 | } | 214 | } |
221 | 215 | ||
222 | if (qstricmp(firstPart, "END") != 0) // No END ! | 216 | if (qstricmp(firstPart, "END") != 0) // No END ! |
223 | return; | 217 | return; |
224 | 218 | ||
225 | if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard ! | 219 | if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard ! |
226 | return; | 220 | return; |
221 | #endif | ||
227 | } | 222 | } |
228 | 223 | ||
229 | void | 224 | void |
230 | VCard::_assemble() | 225 | VCard::_assemble() |
231 | { | 226 | { |
232 | vDebug("Assembling vcard"); | 227 | vDebug("Assembling vcard"); |
233 | strRep_ = "BEGIN:VCARD\r\n"; | 228 | strRep_ = "BEGIN:VCARD\r\n"; |
234 | strRep_ += "VERSION:3.0\r\n"; | 229 | strRep_ += "VERSION:3.0\r\n"; |
235 | 230 | ||
236 | QPtrListIterator<ContentLine> it(contentLineList_); | 231 | QPtrListIterator<ContentLine> it(contentLineList_); |
237 | 232 | ||
238 | for (; it.current(); ++it) | 233 | for (; it.current(); ++it) |
239 | strRep_ += it.current()->asString() + "\r\n"; | 234 | strRep_ += it.current()->asString() + "\r\n"; |
240 | 235 | ||
241 | strRep_ += "END:VCARD\r\n"; | 236 | strRep_ += "END:VCARD\r\n"; |
242 | } | 237 | } |
243 | 238 | ||
244 | bool | 239 | bool |
245 | VCard::has(EntityType t) | 240 | VCard::has(EntityType t) |
246 | { | 241 | { |
247 | parse(); | 242 | parse(); |
248 | return contentLine(t) == 0 ? false : true; | 243 | return contentLine(t) == 0 ? false : true; |
249 | } | 244 | } |
250 | 245 | ||
251 | bool | 246 | bool |
252 | VCard::has(const QCString & s) | 247 | VCard::has(const QCString & s) |
253 | { | 248 | { |
254 | parse(); | 249 | parse(); |
255 | return contentLine(s) == 0 ? false : true; | 250 | return contentLine(s) == 0 ? false : true; |
256 | } | 251 | } |
257 | 252 | ||
258 | void | 253 | void |
259 | VCard::add(const ContentLine & cl) | 254 | VCard::add(const ContentLine & cl) |
260 | { | 255 | { |
261 | parse(); | 256 | parse(); |
262 | ContentLine * c = new ContentLine(cl); | 257 | ContentLine * c = new ContentLine(cl); |
263 | contentLineList_.append(c); | 258 | contentLineList_.append(c); |
264 | } | 259 | } |
265 | 260 | ||
266 | void | 261 | void |
267 | VCard::add(const QCString & s) | 262 | VCard::add(const QCString & s) |
268 | { | 263 | { |
269 | parse(); | 264 | parse(); |
270 | ContentLine * c = new ContentLine(s); | 265 | ContentLine * c = new ContentLine(s); |
271 | contentLineList_.append(c); | 266 | contentLineList_.append(c); |
272 | } | 267 | } |
273 | 268 | ||
274 | ContentLine * | 269 | ContentLine * |
275 | VCard::contentLine(EntityType t) | 270 | VCard::contentLine(EntityType t) |
276 | { | 271 | { |
277 | parse(); | 272 | parse(); |
278 | QPtrListIterator<ContentLine> it(contentLineList_); | 273 | QPtrListIterator<ContentLine> it(contentLineList_); |
279 | 274 | ||
280 | for (; it.current(); ++it) | 275 | for (; it.current(); ++it) |
281 | if (it.current()->entityType() == t) | 276 | if (it.current()->entityType() == t) |
282 | return it.current(); | 277 | return it.current(); |
283 | 278 | ||
284 | return 0; | 279 | return 0; |
285 | } | 280 | } |
286 | 281 | ||
287 | ContentLine * | 282 | ContentLine * |
288 | VCard::contentLine(const QCString & s) | 283 | VCard::contentLine(const QCString & s) |
289 | { | 284 | { |
290 | parse(); | 285 | parse(); |
291 | QPtrListIterator<ContentLine> it(contentLineList_); | 286 | QPtrListIterator<ContentLine> it(contentLineList_); |
292 | 287 | ||
293 | for (; it.current(); ++it) | 288 | for (; it.current(); ++it) |
294 | if (it.current()->entityType() == EntityNameToEntityType(s)) | 289 | if (it.current()->entityType() == EntityNameToEntityType(s)) |
295 | return it.current(); | 290 | return it.current(); |
296 | 291 | ||
297 | return 0; | 292 | return 0; |
298 | } | 293 | } |
299 | 294 | ||
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp index ceffc77..229cce0 100644 --- a/kaddressbook/details/detailsviewcontainer.cpp +++ b/kaddressbook/details/detailsviewcontainer.cpp | |||
@@ -36,134 +36,125 @@ | |||
36 | #include "look_html.h" | 36 | #include "look_html.h" |
37 | 37 | ||
38 | #ifdef KAB_EMBEDDED | 38 | #ifdef KAB_EMBEDDED |
39 | #include "kabprefs.h" | 39 | #include "kabprefs.h" |
40 | #endif //KAB_EMBEDDED | 40 | #endif //KAB_EMBEDDED |
41 | 41 | ||
42 | 42 | ||
43 | #include "detailsviewcontainer.h" | 43 | #include "detailsviewcontainer.h" |
44 | 44 | ||
45 | ViewContainer::ViewContainer( QWidget *parent, const char* name ) | 45 | ViewContainer::ViewContainer( QWidget *parent, const char* name ) |
46 | : QWidget( parent, name ), mCurrentLook( 0 ) | 46 | : QWidget( parent, name ), mCurrentLook( 0 ) |
47 | { | 47 | { |
48 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 48 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
49 | //topLayout->setMargin( KDialog::marginHint() ); | 49 | //topLayout->setMargin( KDialog::marginHint() ); |
50 | //topLayout->setSpacing( KDialog::spacingHint() ); | 50 | //topLayout->setSpacing( KDialog::spacingHint() ); |
51 | topLayout->setMargin( 0 ); | 51 | topLayout->setMargin( 0 ); |
52 | topLayout->setSpacing( 0 ); | 52 | topLayout->setSpacing( 0 ); |
53 | 53 | ||
54 | QBoxLayout *styleLayout = new QHBoxLayout( topLayout ); | 54 | QBoxLayout *styleLayout = new QHBoxLayout( topLayout ); |
55 | 55 | ||
56 | QLabel *label = new QLabel( i18n("Style:"), this ); | 56 | QLabel *label = new QLabel( i18n("Style:"), this ); |
57 | styleLayout->addWidget( label ); | 57 | styleLayout->addWidget( label ); |
58 | 58 | ||
59 | mStyleCombo = new QComboBox( this ); | 59 | mStyleCombo = new QComboBox( this ); |
60 | styleLayout->addWidget( mStyleCombo ); | 60 | styleLayout->addWidget( mStyleCombo ); |
61 | 61 | ||
62 | QFrame *frameRuler = new QFrame( this ); | 62 | QFrame *frameRuler = new QFrame( this ); |
63 | //US frameRuler->setFrameShape( QFrame::HLine ); | 63 | //US frameRuler->setFrameShape( QFrame::HLine ); |
64 | //US frameRuler->setFrameShadow( QFrame::Sunken ); | 64 | //US frameRuler->setFrameShadow( QFrame::Sunken ); |
65 | //US topLayout->addWidget( frameRuler ); | 65 | //US topLayout->addWidget( frameRuler ); |
66 | 66 | ||
67 | mDetailsStack = new QWidgetStack( this ); | 67 | mDetailsStack = new QWidgetStack( this ); |
68 | topLayout->addWidget( mDetailsStack, 1 ); | 68 | topLayout->addWidget( mDetailsStack, 1 ); |
69 | 69 | ||
70 | registerLooks(); | 70 | registerLooks(); |
71 | 71 | ||
72 | #if 1 | 72 | #if 1 |
73 | // Hide detailed view selection combo box, because we currently have | 73 | // Hide detailed view selection combo box, because we currently have |
74 | // only one. Reenable it when there are more detailed views. | 74 | // only one. Reenable it when there are more detailed views. |
75 | label->hide(); | 75 | label->hide(); |
76 | mStyleCombo->hide(); | 76 | mStyleCombo->hide(); |
77 | frameRuler->hide(); | 77 | frameRuler->hide(); |
78 | #endif | 78 | #endif |
79 | } | 79 | } |
80 | 80 | ||
81 | KABBasicLook *ViewContainer::currentLook() | 81 | KABBasicLook *ViewContainer::currentLook() |
82 | { | 82 | { |
83 | return mCurrentLook; | 83 | return mCurrentLook; |
84 | } | 84 | } |
85 | 85 | ||
86 | void ViewContainer::registerLooks() | 86 | void ViewContainer::registerLooks() |
87 | { | 87 | { |
88 | mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); | 88 | mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); |
89 | // mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); | 89 | // mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); |
90 | mStyleCombo->clear(); | 90 | mStyleCombo->clear(); |
91 | 91 | ||
92 | for ( uint i = 0; i < mLookFactories.count(); ++i ) | 92 | for ( uint i = 0; i < mLookFactories.count(); ++i ) |
93 | mStyleCombo->insertItem( mLookFactories.at( i )->description() ); | 93 | mStyleCombo->insertItem( mLookFactories.at( i )->description() ); |
94 | 94 | ||
95 | if ( !mLookFactories.isEmpty() ) | 95 | if ( !mLookFactories.isEmpty() ) |
96 | slotStyleSelected( 0 ); | 96 | slotStyleSelected( 0 ); |
97 | } | 97 | } |
98 | 98 | ||
99 | void ViewContainer::slotStyleSelected( int index ) | 99 | void ViewContainer::slotStyleSelected( int index ) |
100 | { | 100 | { |
101 | #ifndef KAB_EMBEDDED | 101 | #ifndef KAB_EMBEDDED |
102 | KConfig *config = kapp->config(); | 102 | KConfig *config = kapp->config(); |
103 | #else //KAB_EMBEDDED | 103 | #else //KAB_EMBEDDED |
104 | //US I hope I got the same config object as above expected. | 104 | //US I hope I got the same config object as above expected. |
105 | KConfig *config = KABPrefs::instance()->getConfig(); | 105 | KConfig *config = KABPrefs::instance()->getConfig(); |
106 | #endif //KAB_EMBEDDED | 106 | #endif //KAB_EMBEDDED |
107 | KABC::Addressee addr; | 107 | KABC::Addressee addr; |
108 | 108 | ||
109 | if ( index >= 0 && index < mStyleCombo->count() ) { | 109 | if ( index >= 0 && index < mStyleCombo->count() ) { |
110 | if ( mCurrentLook != 0 ) { | 110 | if ( mCurrentLook != 0 ) { |
111 | mCurrentLook->saveSettings( config ); | 111 | mCurrentLook->saveSettings( config ); |
112 | addr = mCurrentLook->addressee(); | 112 | addr = mCurrentLook->addressee(); |
113 | 113 | ||
114 | delete mCurrentLook; | 114 | delete mCurrentLook; |
115 | mCurrentLook = 0; | 115 | mCurrentLook = 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | KABLookFactory *factory = mLookFactories.at( index ); | 118 | KABLookFactory *factory = mLookFactories.at( index ); |
119 | 119 | ||
120 | mCurrentLook = factory->create(); | 120 | mCurrentLook = factory->create(); |
121 | mDetailsStack->raiseWidget( mCurrentLook ); | 121 | mDetailsStack->raiseWidget( mCurrentLook ); |
122 | 122 | ||
123 | connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, | 123 | connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, |
124 | SIGNAL( sendEmail( const QString& ) ) ); | 124 | SIGNAL( sendEmail( const QString& ) ) ); |
125 | connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, | 125 | connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, |
126 | SIGNAL( browse( const QString& ) ) ); | 126 | SIGNAL( browse( const QString& ) ) ); |
127 | } | 127 | } |
128 | 128 | ||
129 | mCurrentLook->restoreSettings( config ); | 129 | mCurrentLook->restoreSettings( config ); |
130 | mCurrentLook->setAddressee( addr ); | 130 | mCurrentLook->setAddressee( addr ); |
131 | } | 131 | } |
132 | void ViewContainer::refreshView() | ||
133 | { | ||
134 | if ( mCurrentLook ) { | ||
135 | mCurrentLook->setAddressee( mCurrentAddressee ); | ||
136 | } | ||
137 | } | ||
138 | 132 | ||
139 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) | 133 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) |
140 | { | 134 | { |
141 | if ( mCurrentLook != 0 ) { | 135 | if ( mCurrentLook != 0 ) { |
142 | if ( addressee == mCurrentAddressee ) | ||
143 | return; | ||
144 | else { | ||
145 | mCurrentAddressee = addressee; | 136 | mCurrentAddressee = addressee; |
146 | mCurrentLook->setAddressee( mCurrentAddressee ); | 137 | mCurrentLook->setAddressee( mCurrentAddressee ); |
147 | } | 138 | |
148 | } | 139 | } |
149 | } | 140 | } |
150 | 141 | ||
151 | KABC::Addressee ViewContainer::addressee() | 142 | KABC::Addressee ViewContainer::addressee() |
152 | { | 143 | { |
153 | static KABC::Addressee empty; // do not use! | 144 | static KABC::Addressee empty; // do not use! |
154 | 145 | ||
155 | if ( !mCurrentLook ) | 146 | if ( !mCurrentLook ) |
156 | return empty; | 147 | return empty; |
157 | else | 148 | else |
158 | return mCurrentLook->addressee(); | 149 | return mCurrentLook->addressee(); |
159 | } | 150 | } |
160 | 151 | ||
161 | void ViewContainer::setReadOnly( bool state ) | 152 | void ViewContainer::setReadOnly( bool state ) |
162 | { | 153 | { |
163 | if ( mCurrentLook ) | 154 | if ( mCurrentLook ) |
164 | mCurrentLook->setReadOnly( state ); | 155 | mCurrentLook->setReadOnly( state ); |
165 | } | 156 | } |
166 | 157 | ||
167 | #ifndef KAB_EMBEDDED | 158 | #ifndef KAB_EMBEDDED |
168 | #include "detailsviewcontainer.moc" | 159 | #include "detailsviewcontainer.moc" |
169 | #endif //KAB_EMBEDDED | 160 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h index b561d12..667f0cb 100644 --- a/kaddressbook/details/detailsviewcontainer.h +++ b/kaddressbook/details/detailsviewcontainer.h | |||
@@ -1,103 +1,102 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> | 3 | Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef DETAILSVIEWCONTAINER_H | 24 | #ifndef DETAILSVIEWCONTAINER_H |
25 | #define DETAILSVIEWCONTAINER_H | 25 | #define DETAILSVIEWCONTAINER_H |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | 28 | ||
29 | #include "look_basic.h" | 29 | #include "look_basic.h" |
30 | 30 | ||
31 | class QComboBox; | 31 | class QComboBox; |
32 | class QWidgetStack; | 32 | class QWidgetStack; |
33 | 33 | ||
34 | class ViewContainer : public QWidget | 34 | class ViewContainer : public QWidget |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | ViewContainer( QWidget *parent = 0, const char* name = 0 ); | 39 | ViewContainer( QWidget *parent = 0, const char* name = 0 ); |
40 | 40 | ||
41 | /** | 41 | /** |
42 | Return the look currently selected. If there is none, it | 42 | Return the look currently selected. If there is none, it |
43 | returns zero. Do not use this pointer to store a reference | 43 | returns zero. Do not use this pointer to store a reference |
44 | to a look, the user might select another one (e.g., create | 44 | to a look, the user might select another one (e.g., create |
45 | a new object) at any time. | 45 | a new object) at any time. |
46 | */ | 46 | */ |
47 | KABBasicLook *currentLook(); | 47 | KABBasicLook *currentLook(); |
48 | void refreshView(); | ||
49 | /** | 48 | /** |
50 | Return the contact currently displayed. | 49 | Return the contact currently displayed. |
51 | */ | 50 | */ |
52 | KABC::Addressee addressee(); | 51 | KABC::Addressee addressee(); |
53 | 52 | ||
54 | public slots: | 53 | public slots: |
55 | /** | 54 | /** |
56 | Set the contact currently displayed. | 55 | Set the contact currently displayed. |
57 | */ | 56 | */ |
58 | void setAddressee( const KABC::Addressee& addressee ); | 57 | void setAddressee( const KABC::Addressee& addressee ); |
59 | 58 | ||
60 | /** | 59 | /** |
61 | Set read-write state. | 60 | Set read-write state. |
62 | */ | 61 | */ |
63 | void setReadOnly( bool state ); | 62 | void setReadOnly( bool state ); |
64 | 63 | ||
65 | signals: | 64 | signals: |
66 | /** | 65 | /** |
67 | The contact has been changed. | 66 | The contact has been changed. |
68 | */ | 67 | */ |
69 | void addresseeChanged(); | 68 | void addresseeChanged(); |
70 | 69 | ||
71 | /** | 70 | /** |
72 | The user acticated the email address displayed. This may happen | 71 | The user acticated the email address displayed. This may happen |
73 | by, for example, clicking on the displayed mailto-URL. | 72 | by, for example, clicking on the displayed mailto-URL. |
74 | */ | 73 | */ |
75 | void sendEmail( const QString& ); | 74 | void sendEmail( const QString& ); |
76 | 75 | ||
77 | /** | 76 | /** |
78 | The user activated one of the displayed HTTP URLs. For example | 77 | The user activated one of the displayed HTTP URLs. For example |
79 | by clicking on the displayed homepage address. | 78 | by clicking on the displayed homepage address. |
80 | */ | 79 | */ |
81 | void browse( const QString& ); | 80 | void browse( const QString& ); |
82 | 81 | ||
83 | protected: | 82 | protected: |
84 | /** | 83 | /** |
85 | A style has been selected. Overloaded from base class. | 84 | A style has been selected. Overloaded from base class. |
86 | */ | 85 | */ |
87 | void slotStyleSelected( int ); | 86 | void slotStyleSelected( int ); |
88 | 87 | ||
89 | /** | 88 | /** |
90 | Register the available looks. | 89 | Register the available looks. |
91 | */ | 90 | */ |
92 | void registerLooks(); | 91 | void registerLooks(); |
93 | 92 | ||
94 | private: | 93 | private: |
95 | KABC::Addressee mCurrentAddressee; | 94 | KABC::Addressee mCurrentAddressee; |
96 | KABBasicLook *mCurrentLook; | 95 | KABBasicLook *mCurrentLook; |
97 | QPtrList<KABLookFactory> mLookFactories; | 96 | QPtrList<KABLookFactory> mLookFactories; |
98 | 97 | ||
99 | QComboBox *mStyleCombo; | 98 | QComboBox *mStyleCombo; |
100 | QWidgetStack *mDetailsStack; | 99 | QWidgetStack *mDetailsStack; |
101 | }; | 100 | }; |
102 | 101 | ||
103 | #endif | 102 | #endif |
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp index 49d456b..48370e3 100644 --- a/kaddressbook/imagewidget.cpp +++ b/kaddressbook/imagewidget.cpp | |||
@@ -38,262 +38,257 @@ | |||
38 | 38 | ||
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qgroupbox.h> | 40 | #include <qgroupbox.h> |
41 | #include <qlabel.h> | 41 | #include <qlabel.h> |
42 | #include <qlayout.h> | 42 | #include <qlayout.h> |
43 | #include <qpixmap.h> | 43 | #include <qpixmap.h> |
44 | #include <qapplication.h> | 44 | #include <qapplication.h> |
45 | 45 | ||
46 | #include "imagewidget.h" | 46 | #include "imagewidget.h" |
47 | 47 | ||
48 | ImageWidget::ImageWidget( QWidget *parent, const char *name ) | 48 | ImageWidget::ImageWidget( QWidget *parent, const char *name ) |
49 | : QWidget( parent, name ) | 49 | : QWidget( parent, name ) |
50 | { | 50 | { |
51 | QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(), | 51 | QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(), |
52 | KDialog::spacingHint() ); | 52 | KDialog::spacingHint() ); |
53 | 53 | ||
54 | QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); | 54 | QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); |
55 | QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2, | 55 | QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2, |
56 | KDialog::spacingHint() ); | 56 | KDialog::spacingHint() ); |
57 | boxLayout->setRowStretch( 2, 1 ); | 57 | boxLayout->setRowStretch( 2, 1 ); |
58 | 58 | ||
59 | mPhotoLabel = new QLabel( photoBox ); | 59 | mPhotoLabel = new QLabel( photoBox ); |
60 | int fac = 9; | 60 | int fac = 9; |
61 | if ( QApplication::desktop()->width() > 320 ) | 61 | if ( QApplication::desktop()->width() > 320 ) |
62 | fac = 6; | 62 | fac = 6; |
63 | mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac ); | 63 | mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac ); |
64 | mPhotoLabel->setScaledContents( true ); | 64 | mPhotoLabel->setScaledContents( true ); |
65 | mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 65 | mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
66 | boxLayout->addMultiCellWidget( mPhotoLabel, 0, 2, 0, 0 ); | 66 | boxLayout->addMultiCellWidget( mPhotoLabel, 0, 2, 0, 0 ); |
67 | 67 | ||
68 | mPhotoUrl = new KURLRequester( photoBox ); | 68 | mPhotoUrl = new KURLRequester( photoBox ); |
69 | #ifndef KAB_EMBEDDED | 69 | #ifndef KAB_EMBEDDED |
70 | mPhotoUrl->setFilter( KImageIO::pattern() ); | 70 | mPhotoUrl->setFilter( KImageIO::pattern() ); |
71 | #else //KAB_EMBEDDED | 71 | #else //KAB_EMBEDDED |
72 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???"); | 72 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???"); |
73 | #endif //KAB_EMBEDDED | 73 | #endif //KAB_EMBEDDED |
74 | 74 | ||
75 | 75 | ||
76 | boxLayout->addWidget( mPhotoUrl, 0, 1 ); | 76 | boxLayout->addWidget( mPhotoUrl, 0, 1 ); |
77 | 77 | ||
78 | mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), photoBox ); | 78 | mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), photoBox ); |
79 | mUsePhotoUrl->setEnabled( false ); | 79 | mUsePhotoUrl->setEnabled( false ); |
80 | boxLayout->addWidget( mUsePhotoUrl, 1, 1 ); | 80 | boxLayout->addWidget( mUsePhotoUrl, 1, 1 ); |
81 | 81 | ||
82 | topLayout->addWidget( photoBox, 0, 0 ); | 82 | topLayout->addWidget( photoBox, 0, 0 ); |
83 | 83 | ||
84 | QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); | 84 | QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); |
85 | boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() ); | 85 | boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() ); |
86 | boxLayout->setRowStretch( 2, 1 ); | 86 | boxLayout->setRowStretch( 2, 1 ); |
87 | 87 | ||
88 | mLogoLabel = new QLabel( logoBox ); | 88 | mLogoLabel = new QLabel( logoBox ); |
89 | mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac ); | 89 | mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac ); |
90 | mLogoLabel->setScaledContents( true ); | 90 | mLogoLabel->setScaledContents( true ); |
91 | mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 91 | mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
92 | boxLayout->addMultiCellWidget( mLogoLabel, 0, 2, 0, 0 ); | 92 | boxLayout->addMultiCellWidget( mLogoLabel, 0, 2, 0, 0 ); |
93 | 93 | ||
94 | mLogoUrl = new KURLRequester( logoBox ); | 94 | mLogoUrl = new KURLRequester( logoBox ); |
95 | #ifndef KAB_EMBEDDED | 95 | #ifndef KAB_EMBEDDED |
96 | mLogoUrl->setFilter( KImageIO::pattern() ); | 96 | mLogoUrl->setFilter( KImageIO::pattern() ); |
97 | #else //KAB_EMBEDDED | 97 | #else //KAB_EMBEDDED |
98 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined 2"); | 98 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined 2"); |
99 | #endif //KAB_EMBEDDED | 99 | #endif //KAB_EMBEDDED |
100 | boxLayout->addWidget( mLogoUrl, 0, 1 ); | 100 | boxLayout->addWidget( mLogoUrl, 0, 1 ); |
101 | 101 | ||
102 | mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), logoBox ); | 102 | mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), logoBox ); |
103 | mUseLogoUrl->setEnabled( false ); | 103 | mUseLogoUrl->setEnabled( false ); |
104 | boxLayout->addWidget( mUseLogoUrl, 1, 1 ); | 104 | boxLayout->addWidget( mUseLogoUrl, 1, 1 ); |
105 | 105 | ||
106 | topLayout->addWidget( logoBox, 1, 0 ); | 106 | topLayout->addWidget( logoBox, 1, 0 ); |
107 | 107 | ||
108 | connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ), | 108 | connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ), |
109 | SIGNAL( changed() ) ); | 109 | SIGNAL( changed() ) ); |
110 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), | 110 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), |
111 | SLOT( loadPhoto() ) ); | 111 | SLOT( loadPhoto() ) ); |
112 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), | 112 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), |
113 | SIGNAL( changed() ) ); | 113 | SIGNAL( changed() ) ); |
114 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), | 114 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), |
115 | SLOT( updateGUI() ) ); | 115 | SLOT( updateGUI() ) ); |
116 | connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ), | 116 | connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ), |
117 | SIGNAL( changed() ) ); | 117 | SIGNAL( changed() ) ); |
118 | 118 | ||
119 | connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ), | 119 | connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ), |
120 | SIGNAL( changed() ) ); | 120 | SIGNAL( changed() ) ); |
121 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), | 121 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), |
122 | SLOT( loadLogo() ) ); | 122 | SLOT( loadLogo() ) ); |
123 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), | 123 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), |
124 | SIGNAL( changed() ) ); | 124 | SIGNAL( changed() ) ); |
125 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), | 125 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), |
126 | SLOT( updateGUI() ) ); | 126 | SLOT( updateGUI() ) ); |
127 | connect( mUseLogoUrl, SIGNAL( toggled( bool ) ), | 127 | connect( mUseLogoUrl, SIGNAL( toggled( bool ) ), |
128 | SIGNAL( changed() ) ); | 128 | SIGNAL( changed() ) ); |
129 | 129 | ||
130 | #ifndef KAB_EMBEDDED | 130 | #ifndef KAB_EMBEDDED |
131 | KAcceleratorManager::manage( this ); | 131 | KAcceleratorManager::manage( this ); |
132 | #endif //KAB_EMBEDDED | 132 | #endif //KAB_EMBEDDED |
133 | 133 | ||
134 | #ifndef DESKTOP_VERSION | ||
135 | mUsePhotoUrl->setChecked( true ); | ||
136 | mUseLogoUrl->setChecked( true ); | ||
137 | #endif | ||
138 | } | 134 | } |
139 | 135 | ||
140 | ImageWidget::~ImageWidget() | 136 | ImageWidget::~ImageWidget() |
141 | { | 137 | { |
142 | } | 138 | } |
143 | 139 | ||
144 | void ImageWidget::setPhoto( const KABC::Picture &photo ) | 140 | void ImageWidget::setPhoto( const KABC::Picture &photo ) |
145 | { | 141 | { |
146 | bool blocked = signalsBlocked(); | 142 | bool blocked = signalsBlocked(); |
147 | blockSignals( true ); | 143 | blockSignals( true ); |
148 | 144 | ||
149 | if ( photo.isIntern() ) { | 145 | if ( photo.isIntern() ) { |
150 | //US | 146 | //US |
151 | //US mPhotoLabel->setPixmap( photo.data() ); | 147 | //US mPhotoLabel->setPixmap( photo.data() ); |
152 | if (photo.data().isNull() != true) | 148 | if (photo.data().isNull() != true) |
153 | { | 149 | { |
154 | QPixmap pm; | 150 | QPixmap pm; |
155 | pm.convertFromImage(photo.data()); | 151 | pm.convertFromImage(photo.data()); |
156 | 152 | ||
157 | mPhotoLabel->setPixmap( pm ); | 153 | mPhotoLabel->setPixmap( pm ); |
158 | } | 154 | } |
159 | 155 | ||
160 | mUsePhotoUrl->setChecked( false ); | 156 | mUsePhotoUrl->setChecked( false ); |
161 | } else { | 157 | } else { |
162 | mPhotoUrl->setURL( photo.url() ); | 158 | mPhotoUrl->setURL( photo.url() ); |
163 | if ( !photo.url().isEmpty() ) | 159 | if ( !photo.url().isEmpty() ) |
164 | mUsePhotoUrl->setChecked( true ); | 160 | mUsePhotoUrl->setChecked( true ); |
165 | loadPhoto(); | 161 | loadPhoto(); |
166 | } | 162 | } |
167 | 163 | ||
168 | blockSignals( blocked ); | 164 | blockSignals( blocked ); |
169 | } | 165 | } |
170 | 166 | ||
171 | KABC::Picture ImageWidget::photo() const | 167 | KABC::Picture ImageWidget::photo() const |
172 | { | 168 | { |
173 | KABC::Picture photo; | 169 | KABC::Picture photo; |
174 | 170 | ||
175 | if ( mUsePhotoUrl->isChecked() ) | 171 | if ( mUsePhotoUrl->isChecked() ) |
176 | photo.setUrl( mPhotoUrl->url() ); | 172 | photo.setUrl( mPhotoUrl->url() ); |
177 | else { | 173 | else { |
178 | QPixmap *px = mPhotoLabel->pixmap(); | 174 | QPixmap *px = mPhotoLabel->pixmap(); |
179 | if ( px ) { | 175 | if ( px ) { |
180 | #ifndef KAB_EMBEDDED | 176 | #ifndef KAB_EMBEDDED |
181 | if ( px->height() > px->width() ) | 177 | if ( px->height() > px->width() ) |
182 | photo.setData( px->convertToImage().scaleHeight( 140 ) ); | 178 | photo.setData( px->convertToImage().scaleHeight( 140 ) ); |
183 | else | 179 | else |
184 | photo.setData( px->convertToImage().scaleWidth( 100 ) ); | 180 | photo.setData( px->convertToImage().scaleWidth( 100 ) ); |
185 | #else //KAB_EMBEDDED | 181 | #else //KAB_EMBEDDED |
186 | //US add teh nullcheck | 182 | //US add teh nullcheck |
187 | if (px->isNull() != true ) | 183 | if (px->isNull() != true ) |
188 | photo.setData( px->convertToImage() ); | 184 | photo.setData( px->convertToImage() ); |
189 | #endif //KAB_EMBEDDED | 185 | #endif //KAB_EMBEDDED |
190 | 186 | ||
191 | photo.setType( "PNG" ); | 187 | photo.setType( "PNG" ); |
192 | } | 188 | } |
193 | } | 189 | } |
194 | 190 | ||
195 | return photo; | 191 | return photo; |
196 | } | 192 | } |
197 | 193 | ||
198 | void ImageWidget::setLogo( const KABC::Picture &logo ) | 194 | void ImageWidget::setLogo( const KABC::Picture &logo ) |
199 | { | 195 | { |
200 | bool blocked = signalsBlocked(); | 196 | bool blocked = signalsBlocked(); |
201 | blockSignals( true ); | 197 | blockSignals( true ); |
202 | 198 | ||
203 | if ( logo.isIntern() ) { | 199 | if ( logo.isIntern() ) { |
204 | //US | 200 | //US |
205 | //US mLogoLabel->setPixmap( logo.data() ); | 201 | //US mLogoLabel->setPixmap( logo.data() ); |
206 | if (logo.data().isNull() != true) | 202 | if (logo.data().isNull() != true) |
207 | { | 203 | { |
208 | QPixmap pm; | 204 | QPixmap pm; |
209 | pm.convertFromImage(logo.data()); | 205 | pm.convertFromImage(logo.data()); |
210 | mLogoLabel->setPixmap( pm ); | 206 | mLogoLabel->setPixmap( pm ); |
211 | } | 207 | } |
212 | mUseLogoUrl->setChecked( false ); | 208 | mUseLogoUrl->setChecked( false ); |
213 | } else { | 209 | } else { |
214 | mLogoUrl->setURL( logo.url() ); | 210 | mLogoUrl->setURL( logo.url() ); |
215 | if ( !logo.url().isEmpty() ) | 211 | if ( !logo.url().isEmpty() ) |
216 | mUseLogoUrl->setChecked( true ); | 212 | mUseLogoUrl->setChecked( true ); |
217 | loadLogo(); | 213 | loadLogo(); |
218 | } | 214 | } |
219 | 215 | ||
220 | blockSignals( blocked ); | 216 | blockSignals( blocked ); |
221 | } | 217 | } |
222 | 218 | ||
223 | KABC::Picture ImageWidget::logo() const | 219 | KABC::Picture ImageWidget::logo() const |
224 | { | 220 | { |
225 | KABC::Picture logo; | 221 | KABC::Picture logo; |
226 | 222 | ||
227 | if ( mUseLogoUrl->isChecked() ) | 223 | if ( mUseLogoUrl->isChecked() ) |
228 | logo.setUrl( mLogoUrl->url() ); | 224 | logo.setUrl( mLogoUrl->url() ); |
229 | else { | 225 | else { |
230 | QPixmap *px = mLogoLabel->pixmap(); | 226 | QPixmap *px = mLogoLabel->pixmap(); |
231 | if ( px ) { | 227 | if ( px ) { |
232 | #ifndef KAB_EMBEDDED | 228 | #ifndef KAB_EMBEDDED |
233 | if ( px->height() > px->width() ) | 229 | if ( px->height() > px->width() ) |
234 | logo.setData( px->convertToImage().scaleHeight( 140 ) ); | 230 | logo.setData( px->convertToImage().scaleHeight( 140 ) ); |
235 | else | 231 | else |
236 | logo.setData( px->convertToImage().scaleWidth( 100 ) ); | 232 | logo.setData( px->convertToImage().scaleWidth( 100 ) ); |
237 | #else //KAB_EMBEDDED | 233 | #else //KAB_EMBEDDED |
238 | logo.setData( px->convertToImage() ); | 234 | logo.setData( px->convertToImage() ); |
239 | #endif //KAB_EMBEDDED | 235 | #endif //KAB_EMBEDDED |
240 | 236 | ||
241 | logo.setType( "PNG" ); | 237 | logo.setType( "PNG" ); |
242 | 238 | ||
243 | } | 239 | } |
244 | } | 240 | } |
245 | 241 | ||
246 | return logo; | 242 | return logo; |
247 | } | 243 | } |
248 | 244 | ||
249 | void ImageWidget::loadPhoto() | 245 | void ImageWidget::loadPhoto() |
250 | { | 246 | { |
251 | mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) ); | 247 | mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) ); |
252 | } | 248 | } |
253 | 249 | ||
254 | void ImageWidget::loadLogo() | 250 | void ImageWidget::loadLogo() |
255 | { | 251 | { |
256 | mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) ); | 252 | mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) ); |
257 | } | 253 | } |
258 | 254 | ||
259 | void ImageWidget::updateGUI() | 255 | void ImageWidget::updateGUI() |
260 | { | 256 | { |
261 | KURLRequester *ptr = (KURLRequester*)sender(); | 257 | KURLRequester *ptr = (KURLRequester*)sender(); |
262 | 258 | ||
263 | #ifdef DESKTOP_VERSION | 259 | |
264 | if ( ptr == mPhotoUrl ) | 260 | if ( ptr == mPhotoUrl ) |
265 | mUsePhotoUrl->setEnabled( true ); | 261 | mUsePhotoUrl->setEnabled( true ); |
266 | else if ( ptr == mLogoUrl ) | 262 | else if ( ptr == mLogoUrl ) |
267 | mUseLogoUrl->setEnabled( true ); | 263 | mUseLogoUrl->setEnabled( true ); |
268 | #endif | ||
269 | } | 264 | } |
270 | 265 | ||
271 | QPixmap ImageWidget::loadPixmap( const KURL &url ) | 266 | QPixmap ImageWidget::loadPixmap( const KURL &url ) |
272 | { | 267 | { |
273 | QString tempFile; | 268 | QString tempFile; |
274 | QPixmap pixmap; | 269 | QPixmap pixmap; |
275 | 270 | ||
276 | if ( url.isEmpty() ) | 271 | if ( url.isEmpty() ) |
277 | return pixmap; | 272 | return pixmap; |
278 | 273 | ||
279 | if ( url.isLocalFile() ) | 274 | if ( url.isLocalFile() ) |
280 | pixmap = QPixmap( url.path() ); | 275 | pixmap = QPixmap( url.path() ); |
281 | else | 276 | else |
282 | { | 277 | { |
283 | #ifndef KAB_EMBEDDED | 278 | #ifndef KAB_EMBEDDED |
284 | if ( KIO::NetAccess::download( url, tempFile ) ) { | 279 | if ( KIO::NetAccess::download( url, tempFile ) ) { |
285 | pixmap = QPixmap( tempFile ); | 280 | pixmap = QPixmap( tempFile ); |
286 | KIO::NetAccess::removeTempFile( tempFile ); | 281 | KIO::NetAccess::removeTempFile( tempFile ); |
287 | } | 282 | } |
288 | #else //KAB_EMBEDDED | 283 | #else //KAB_EMBEDDED |
289 | qDebug("ImageWidget::loadPixmap : only local pixmaps are allowed"); | 284 | qDebug("ImageWidget::loadPixmap : only local pixmaps are allowed"); |
290 | #endif //KAB_EMBEDDED | 285 | #endif //KAB_EMBEDDED |
291 | 286 | ||
292 | } | 287 | } |
293 | 288 | ||
294 | return pixmap; | 289 | return pixmap; |
295 | } | 290 | } |
296 | 291 | ||
297 | #ifndef KAB_EMBEDDED | 292 | #ifndef KAB_EMBEDDED |
298 | #include "imagewidget.moc" | 293 | #include "imagewidget.moc" |
299 | #endif //KAB_EMBEDDED | 294 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index f6bdda4..e14e579 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1033,233 +1033,230 @@ void KABCore::pasteContacts( KABC::Addressee::List &list ) | |||
1033 | UndoStack::instance()->push( command ); | 1033 | UndoStack::instance()->push( command ); |
1034 | RedoStack::instance()->clear(); | 1034 | RedoStack::instance()->clear(); |
1035 | 1035 | ||
1036 | setModified( true ); | 1036 | setModified( true ); |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | void KABCore::setWhoAmI() | 1039 | void KABCore::setWhoAmI() |
1040 | { | 1040 | { |
1041 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1041 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1042 | 1042 | ||
1043 | if ( addrList.count() > 1 ) { | 1043 | if ( addrList.count() > 1 ) { |
1044 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 1044 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
1045 | return; | 1045 | return; |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 1048 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
1049 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 1049 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
1050 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 1050 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
1051 | } | 1051 | } |
1052 | void KABCore::editCategories() | 1052 | void KABCore::editCategories() |
1053 | { | 1053 | { |
1054 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); | 1054 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); |
1055 | dlg.exec(); | 1055 | dlg.exec(); |
1056 | } | 1056 | } |
1057 | void KABCore::setCategories() | 1057 | void KABCore::setCategories() |
1058 | { | 1058 | { |
1059 | 1059 | ||
1060 | QStringList uids; | 1060 | QStringList uids; |
1061 | XXPortSelectDialog dlgx( this, false, this ); | 1061 | XXPortSelectDialog dlgx( this, false, this ); |
1062 | if ( dlgx.exec() ) | 1062 | if ( dlgx.exec() ) |
1063 | uids = dlgx.uids(); | 1063 | uids = dlgx.uids(); |
1064 | else | 1064 | else |
1065 | return; | 1065 | return; |
1066 | if ( uids.isEmpty() ) | 1066 | if ( uids.isEmpty() ) |
1067 | return; | 1067 | return; |
1068 | // qDebug("count %d ", uids.count()); | 1068 | // qDebug("count %d ", uids.count()); |
1069 | 1069 | ||
1070 | 1070 | ||
1071 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 1071 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
1072 | if ( !dlg.exec() ) { | 1072 | if ( !dlg.exec() ) { |
1073 | message( i18n("Setting categories cancelled") ); | 1073 | message( i18n("Setting categories cancelled") ); |
1074 | return; | 1074 | return; |
1075 | } | 1075 | } |
1076 | bool merge = false; | 1076 | bool merge = false; |
1077 | QString msg = i18n( "Merge with existing categories?" ); | 1077 | QString msg = i18n( "Merge with existing categories?" ); |
1078 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 1078 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
1079 | merge = true; | 1079 | merge = true; |
1080 | 1080 | ||
1081 | message( i18n("Setting categories ... please wait!") ); | 1081 | message( i18n("Setting categories ... please wait!") ); |
1082 | QStringList categories = dlg.selectedCategories(); | 1082 | QStringList categories = dlg.selectedCategories(); |
1083 | 1083 | ||
1084 | //QStringList uids = mViewManager->selectedUids(); | 1084 | //QStringList uids = mViewManager->selectedUids(); |
1085 | QStringList::Iterator it; | 1085 | QStringList::Iterator it; |
1086 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 1086 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
1087 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 1087 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
1088 | if ( !addr.isEmpty() ) { | 1088 | if ( !addr.isEmpty() ) { |
1089 | if ( !merge ) | 1089 | if ( !merge ) |
1090 | addr.setCategories( categories ); | 1090 | addr.setCategories( categories ); |
1091 | else { | 1091 | else { |
1092 | QStringList addrCategories = addr.categories(); | 1092 | QStringList addrCategories = addr.categories(); |
1093 | QStringList::Iterator catIt; | 1093 | QStringList::Iterator catIt; |
1094 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 1094 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
1095 | if ( !addrCategories.contains( *catIt ) ) | 1095 | if ( !addrCategories.contains( *catIt ) ) |
1096 | addrCategories.append( *catIt ); | 1096 | addrCategories.append( *catIt ); |
1097 | } | 1097 | } |
1098 | addr.setCategories( addrCategories ); | 1098 | addr.setCategories( addrCategories ); |
1099 | } | 1099 | } |
1100 | mAddressBook->insertAddressee( addr ); | 1100 | mAddressBook->insertAddressee( addr ); |
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | if ( uids.count() > 0 ) | 1104 | if ( uids.count() > 0 ) |
1105 | setModified( true ); | 1105 | setModified( true ); |
1106 | message( i18n("Setting categories completed!") ); | 1106 | message( i18n("Setting categories completed!") ); |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1109 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1110 | { | 1110 | { |
1111 | mIncSearchWidget->setFields( fields ); | 1111 | mIncSearchWidget->setFields( fields ); |
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | void KABCore::incrementalSearch( const QString& text ) | 1114 | void KABCore::incrementalSearch( const QString& text ) |
1115 | { | 1115 | { |
1116 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1116 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | void KABCore::setModified() | 1119 | void KABCore::setModified() |
1120 | { | 1120 | { |
1121 | setModified( true ); | 1121 | setModified( true ); |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | void KABCore::setModifiedWOrefresh() | 1124 | void KABCore::setModifiedWOrefresh() |
1125 | { | 1125 | { |
1126 | // qDebug("KABCore::setModifiedWOrefresh() "); | 1126 | // qDebug("KABCore::setModifiedWOrefresh() "); |
1127 | mModified = true; | 1127 | mModified = true; |
1128 | mActionSave->setEnabled( mModified ); | 1128 | mActionSave->setEnabled( mModified ); |
1129 | #ifdef DESKTOP_VERSION | 1129 | |
1130 | mDetails->refreshView(); | ||
1131 | #endif | ||
1132 | 1130 | ||
1133 | } | 1131 | } |
1134 | void KABCore::setModified( bool modified ) | 1132 | void KABCore::setModified( bool modified ) |
1135 | { | 1133 | { |
1136 | mModified = modified; | 1134 | mModified = modified; |
1137 | mActionSave->setEnabled( mModified ); | 1135 | mActionSave->setEnabled( mModified ); |
1138 | 1136 | ||
1139 | if ( modified ) | 1137 | if ( modified ) |
1140 | mJumpButtonBar->recreateButtons(); | 1138 | mJumpButtonBar->recreateButtons(); |
1141 | 1139 | ||
1142 | mViewManager->refreshView(); | 1140 | mViewManager->refreshView(); |
1143 | mDetails->refreshView(); | ||
1144 | 1141 | ||
1145 | } | 1142 | } |
1146 | 1143 | ||
1147 | bool KABCore::modified() const | 1144 | bool KABCore::modified() const |
1148 | { | 1145 | { |
1149 | return mModified; | 1146 | return mModified; |
1150 | } | 1147 | } |
1151 | 1148 | ||
1152 | void KABCore::contactModified( const KABC::Addressee &addr ) | 1149 | void KABCore::contactModified( const KABC::Addressee &addr ) |
1153 | { | 1150 | { |
1154 | 1151 | ||
1155 | Command *command = 0; | 1152 | Command *command = 0; |
1156 | QString uid; | 1153 | QString uid; |
1157 | 1154 | ||
1158 | // check if it exists already | 1155 | // check if it exists already |
1159 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 1156 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
1160 | if ( origAddr.isEmpty() ) | 1157 | if ( origAddr.isEmpty() ) |
1161 | command = new PwNewCommand( mAddressBook, addr ); | 1158 | command = new PwNewCommand( mAddressBook, addr ); |
1162 | else { | 1159 | else { |
1163 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 1160 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
1164 | uid = addr.uid(); | 1161 | uid = addr.uid(); |
1165 | } | 1162 | } |
1166 | 1163 | ||
1167 | UndoStack::instance()->push( command ); | 1164 | UndoStack::instance()->push( command ); |
1168 | RedoStack::instance()->clear(); | 1165 | RedoStack::instance()->clear(); |
1169 | 1166 | mDetails->setAddressee( addr ); | |
1170 | setModified( true ); | 1167 | setModified( true ); |
1171 | } | 1168 | } |
1172 | 1169 | ||
1173 | void KABCore::newContact() | 1170 | void KABCore::newContact() |
1174 | { | 1171 | { |
1175 | 1172 | ||
1176 | 1173 | ||
1177 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 1174 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
1178 | 1175 | ||
1179 | QPtrList<KRES::Resource> kresResources; | 1176 | QPtrList<KRES::Resource> kresResources; |
1180 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 1177 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
1181 | KABC::Resource *resource; | 1178 | KABC::Resource *resource; |
1182 | while ( ( resource = it.current() ) != 0 ) { | 1179 | while ( ( resource = it.current() ) != 0 ) { |
1183 | ++it; | 1180 | ++it; |
1184 | if ( !resource->readOnly() ) { | 1181 | if ( !resource->readOnly() ) { |
1185 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1182 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1186 | if ( res ) | 1183 | if ( res ) |
1187 | kresResources.append( res ); | 1184 | kresResources.append( res ); |
1188 | } | 1185 | } |
1189 | } | 1186 | } |
1190 | 1187 | ||
1191 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1188 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1192 | resource = static_cast<KABC::Resource*>( res ); | 1189 | resource = static_cast<KABC::Resource*>( res ); |
1193 | 1190 | ||
1194 | if ( resource ) { | 1191 | if ( resource ) { |
1195 | KABC::Addressee addr; | 1192 | KABC::Addressee addr; |
1196 | addr.setResource( resource ); | 1193 | addr.setResource( resource ); |
1197 | mEditorDialog->setAddressee( addr ); | 1194 | mEditorDialog->setAddressee( addr ); |
1198 | KApplication::execDialog ( mEditorDialog ); | 1195 | KApplication::execDialog ( mEditorDialog ); |
1199 | 1196 | ||
1200 | } else | 1197 | } else |
1201 | return; | 1198 | return; |
1202 | 1199 | ||
1203 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1200 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1204 | 1201 | ||
1205 | 1202 | ||
1206 | } | 1203 | } |
1207 | 1204 | ||
1208 | void KABCore::addEmail( QString aStr ) | 1205 | void KABCore::addEmail( QString aStr ) |
1209 | { | 1206 | { |
1210 | #ifndef KAB_EMBEDDED | 1207 | #ifndef KAB_EMBEDDED |
1211 | QString fullName, email; | 1208 | QString fullName, email; |
1212 | 1209 | ||
1213 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1210 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1214 | 1211 | ||
1215 | // Try to lookup the addressee matching the email address | 1212 | // Try to lookup the addressee matching the email address |
1216 | bool found = false; | 1213 | bool found = false; |
1217 | QStringList emailList; | 1214 | QStringList emailList; |
1218 | KABC::AddressBook::Iterator it; | 1215 | KABC::AddressBook::Iterator it; |
1219 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1216 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1220 | emailList = (*it).emails(); | 1217 | emailList = (*it).emails(); |
1221 | if ( emailList.contains( email ) > 0 ) { | 1218 | if ( emailList.contains( email ) > 0 ) { |
1222 | found = true; | 1219 | found = true; |
1223 | (*it).setNameFromString( fullName ); | 1220 | (*it).setNameFromString( fullName ); |
1224 | editContact( (*it).uid() ); | 1221 | editContact( (*it).uid() ); |
1225 | } | 1222 | } |
1226 | } | 1223 | } |
1227 | 1224 | ||
1228 | if ( !found ) { | 1225 | if ( !found ) { |
1229 | KABC::Addressee addr; | 1226 | KABC::Addressee addr; |
1230 | addr.setNameFromString( fullName ); | 1227 | addr.setNameFromString( fullName ); |
1231 | addr.insertEmail( email, true ); | 1228 | addr.insertEmail( email, true ); |
1232 | 1229 | ||
1233 | mAddressBook->insertAddressee( addr ); | 1230 | mAddressBook->insertAddressee( addr ); |
1234 | mViewManager->refreshView( addr.uid() ); | 1231 | mViewManager->refreshView( addr.uid() ); |
1235 | editContact( addr.uid() ); | 1232 | editContact( addr.uid() ); |
1236 | } | 1233 | } |
1237 | #else //KAB_EMBEDDED | 1234 | #else //KAB_EMBEDDED |
1238 | qDebug("KABCore::addEmail finsih method"); | 1235 | qDebug("KABCore::addEmail finsih method"); |
1239 | #endif //KAB_EMBEDDED | 1236 | #endif //KAB_EMBEDDED |
1240 | } | 1237 | } |
1241 | 1238 | ||
1242 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1239 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1243 | { | 1240 | { |
1244 | mXXPortManager->importVCard( url, showPreview ); | 1241 | mXXPortManager->importVCard( url, showPreview ); |
1245 | } | 1242 | } |
1246 | void KABCore::importFromOL() | 1243 | void KABCore::importFromOL() |
1247 | { | 1244 | { |
1248 | #ifdef _WIN32_ | 1245 | #ifdef _WIN32_ |
1249 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1246 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1250 | idgl->exec(); | 1247 | idgl->exec(); |
1251 | KABC::Addressee::List list = idgl->getAddressList(); | 1248 | KABC::Addressee::List list = idgl->getAddressList(); |
1252 | if ( list.count() > 0 ) { | 1249 | if ( list.count() > 0 ) { |
1253 | KABC::Addressee::List listNew; | 1250 | KABC::Addressee::List listNew; |
1254 | KABC::Addressee::List listExisting; | 1251 | KABC::Addressee::List listExisting; |
1255 | KABC::Addressee::List::Iterator it; | 1252 | KABC::Addressee::List::Iterator it; |
1256 | KABC::AddressBook::Iterator iter; | 1253 | KABC::AddressBook::Iterator iter; |
1257 | for ( it = list.begin(); it != list.end(); ++it ) { | 1254 | for ( it = list.begin(); it != list.end(); ++it ) { |
1258 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1255 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1259 | listNew.append( (*it) ); | 1256 | listNew.append( (*it) ); |
1260 | else | 1257 | else |
1261 | listExisting.append( (*it) ); | 1258 | listExisting.append( (*it) ); |
1262 | } | 1259 | } |
1263 | if ( listExisting.count() > 0 ) | 1260 | if ( listExisting.count() > 0 ) |
1264 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1261 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1265 | if ( listNew.count() > 0 ) { | 1262 | if ( listNew.count() > 0 ) { |
@@ -1540,193 +1537,192 @@ void KABCore::openConfigDialog() | |||
1540 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1537 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1541 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1538 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1542 | ConfigureDialog->addModule(kabcfg ); | 1539 | ConfigureDialog->addModule(kabcfg ); |
1543 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1540 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1544 | ConfigureDialog->addModule(kdelibcfg ); | 1541 | ConfigureDialog->addModule(kdelibcfg ); |
1545 | 1542 | ||
1546 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1543 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1547 | this, SLOT( configurationChanged() ) ); | 1544 | this, SLOT( configurationChanged() ) ); |
1548 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1545 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1549 | this, SLOT( configurationChanged() ) ); | 1546 | this, SLOT( configurationChanged() ) ); |
1550 | saveSettings(); | 1547 | saveSettings(); |
1551 | #ifndef DESKTOP_VERSION | 1548 | #ifndef DESKTOP_VERSION |
1552 | ConfigureDialog->showMaximized(); | 1549 | ConfigureDialog->showMaximized(); |
1553 | #endif | 1550 | #endif |
1554 | if ( ConfigureDialog->exec() ) | 1551 | if ( ConfigureDialog->exec() ) |
1555 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1552 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1556 | delete ConfigureDialog; | 1553 | delete ConfigureDialog; |
1557 | } | 1554 | } |
1558 | 1555 | ||
1559 | void KABCore::openLDAPDialog() | 1556 | void KABCore::openLDAPDialog() |
1560 | { | 1557 | { |
1561 | #ifndef KAB_EMBEDDED | 1558 | #ifndef KAB_EMBEDDED |
1562 | if ( !mLdapSearchDialog ) { | 1559 | if ( !mLdapSearchDialog ) { |
1563 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1560 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1564 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1561 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1565 | SLOT( refreshView() ) ); | 1562 | SLOT( refreshView() ) ); |
1566 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1563 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1567 | SLOT( setModified() ) ); | 1564 | SLOT( setModified() ) ); |
1568 | } else | 1565 | } else |
1569 | mLdapSearchDialog->restoreSettings(); | 1566 | mLdapSearchDialog->restoreSettings(); |
1570 | 1567 | ||
1571 | if ( mLdapSearchDialog->isOK() ) | 1568 | if ( mLdapSearchDialog->isOK() ) |
1572 | mLdapSearchDialog->exec(); | 1569 | mLdapSearchDialog->exec(); |
1573 | #else //KAB_EMBEDDED | 1570 | #else //KAB_EMBEDDED |
1574 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1571 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1575 | #endif //KAB_EMBEDDED | 1572 | #endif //KAB_EMBEDDED |
1576 | } | 1573 | } |
1577 | 1574 | ||
1578 | void KABCore::print() | 1575 | void KABCore::print() |
1579 | { | 1576 | { |
1580 | #ifndef KAB_EMBEDDED | 1577 | #ifndef KAB_EMBEDDED |
1581 | KPrinter printer; | 1578 | KPrinter printer; |
1582 | if ( !printer.setup( this ) ) | 1579 | if ( !printer.setup( this ) ) |
1583 | return; | 1580 | return; |
1584 | 1581 | ||
1585 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1582 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1586 | mViewManager->selectedUids(), this ); | 1583 | mViewManager->selectedUids(), this ); |
1587 | 1584 | ||
1588 | wizard.exec(); | 1585 | wizard.exec(); |
1589 | #else //KAB_EMBEDDED | 1586 | #else //KAB_EMBEDDED |
1590 | qDebug("KABCore::print() finsih method"); | 1587 | qDebug("KABCore::print() finsih method"); |
1591 | #endif //KAB_EMBEDDED | 1588 | #endif //KAB_EMBEDDED |
1592 | 1589 | ||
1593 | } | 1590 | } |
1594 | 1591 | ||
1595 | 1592 | ||
1596 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1593 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1597 | { | 1594 | { |
1598 | if ( mGUIClient ) | 1595 | if ( mGUIClient ) |
1599 | mGUIClient->insertChildClient( client ); | 1596 | mGUIClient->insertChildClient( client ); |
1600 | else | 1597 | else |
1601 | KMessageBox::error( this, "no KXMLGUICLient"); | 1598 | KMessageBox::error( this, "no KXMLGUICLient"); |
1602 | } | 1599 | } |
1603 | 1600 | ||
1604 | 1601 | ||
1605 | void KABCore::configurationChanged() | 1602 | void KABCore::configurationChanged() |
1606 | { | 1603 | { |
1607 | mExtensionManager->reconfigure(); | 1604 | mExtensionManager->reconfigure(); |
1608 | } | 1605 | } |
1609 | 1606 | ||
1610 | void KABCore::addressBookChanged() | 1607 | void KABCore::addressBookChanged() |
1611 | { | 1608 | { |
1612 | /*US | 1609 | /*US |
1613 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1610 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1614 | while ( it.current() ) { | 1611 | while ( it.current() ) { |
1615 | if ( it.current()->dirty() ) { | 1612 | if ( it.current()->dirty() ) { |
1616 | QString text = i18n( "Data has been changed externally. Unsaved " | 1613 | QString text = i18n( "Data has been changed externally. Unsaved " |
1617 | "changes will be lost." ); | 1614 | "changes will be lost." ); |
1618 | KMessageBox::information( this, text ); | 1615 | KMessageBox::information( this, text ); |
1619 | } | 1616 | } |
1620 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1617 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1621 | ++it; | 1618 | ++it; |
1622 | } | 1619 | } |
1623 | */ | 1620 | */ |
1624 | if (mEditorDialog) | 1621 | if (mEditorDialog) |
1625 | { | 1622 | { |
1626 | if (mEditorDialog->dirty()) | 1623 | if (mEditorDialog->dirty()) |
1627 | { | 1624 | { |
1628 | QString text = i18n( "Data has been changed externally. Unsaved " | 1625 | QString text = i18n( "Data has been changed externally. Unsaved " |
1629 | "changes will be lost." ); | 1626 | "changes will be lost." ); |
1630 | KMessageBox::information( this, text ); | 1627 | KMessageBox::information( this, text ); |
1631 | } | 1628 | } |
1632 | QString currentuid = mEditorDialog->addressee().uid(); | 1629 | QString currentuid = mEditorDialog->addressee().uid(); |
1633 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1630 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1634 | } | 1631 | } |
1635 | mViewManager->refreshView(); | 1632 | mViewManager->refreshView(); |
1636 | // mDetails->refreshView(); | ||
1637 | 1633 | ||
1638 | 1634 | ||
1639 | } | 1635 | } |
1640 | 1636 | ||
1641 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1637 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1642 | const char *name ) | 1638 | const char *name ) |
1643 | { | 1639 | { |
1644 | 1640 | ||
1645 | if ( mEditorDialog == 0 ) { | 1641 | if ( mEditorDialog == 0 ) { |
1646 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1642 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1647 | name ? name : "editorDialog" ); | 1643 | name ? name : "editorDialog" ); |
1648 | 1644 | ||
1649 | 1645 | ||
1650 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1646 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1651 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1647 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1652 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1648 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1653 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1649 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1654 | } | 1650 | } |
1655 | 1651 | ||
1656 | return mEditorDialog; | 1652 | return mEditorDialog; |
1657 | } | 1653 | } |
1658 | 1654 | ||
1659 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1655 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1660 | { | 1656 | { |
1661 | //mEditorDict.remove( uid ); | 1657 | //mEditorDict.remove( uid ); |
1662 | } | 1658 | } |
1663 | 1659 | ||
1664 | void KABCore::initGUI() | 1660 | void KABCore::initGUI() |
1665 | { | 1661 | { |
1666 | #ifndef KAB_EMBEDDED | 1662 | #ifndef KAB_EMBEDDED |
1667 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1663 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1668 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1664 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1669 | 1665 | ||
1670 | mExtensionBarSplitter = new QSplitter( this ); | 1666 | mExtensionBarSplitter = new QSplitter( this ); |
1671 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1667 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1672 | 1668 | ||
1673 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1669 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1674 | 1670 | ||
1675 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1671 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1676 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1672 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1677 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1673 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1678 | SLOT( incrementalSearch( const QString& ) ) ); | 1674 | SLOT( incrementalSearch( const QString& ) ) ); |
1679 | 1675 | ||
1680 | mViewManager = new ViewManager( this, viewSpace ); | 1676 | mViewManager = new ViewManager( this, viewSpace ); |
1681 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1677 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1682 | 1678 | ||
1683 | mDetails = new ViewContainer( mDetailsSplitter ); | 1679 | mDetails = new ViewContainer( mDetailsSplitter ); |
1684 | 1680 | ||
1685 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1681 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1686 | 1682 | ||
1687 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1683 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1688 | 1684 | ||
1689 | topLayout->addWidget( mExtensionBarSplitter ); | 1685 | topLayout->addWidget( mExtensionBarSplitter ); |
1690 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1686 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1691 | topLayout->addWidget( mJumpButtonBar ); | 1687 | topLayout->addWidget( mJumpButtonBar ); |
1692 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1688 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1693 | 1689 | ||
1694 | mXXPortManager = new XXPortManager( this, this ); | 1690 | mXXPortManager = new XXPortManager( this, this ); |
1695 | 1691 | ||
1696 | #else //KAB_EMBEDDED | 1692 | #else //KAB_EMBEDDED |
1697 | //US initialize viewMenu before settingup viewmanager. | 1693 | //US initialize viewMenu before settingup viewmanager. |
1698 | // Viewmanager needs this menu to plugin submenues. | 1694 | // Viewmanager needs this menu to plugin submenues. |
1699 | viewMenu = new QPopupMenu( this ); | 1695 | viewMenu = new QPopupMenu( this ); |
1700 | settingsMenu = new QPopupMenu( this ); | 1696 | settingsMenu = new QPopupMenu( this ); |
1701 | //filterMenu = new QPopupMenu( this ); | 1697 | //filterMenu = new QPopupMenu( this ); |
1702 | ImportMenu = new QPopupMenu( this ); | 1698 | ImportMenu = new QPopupMenu( this ); |
1703 | ExportMenu = new QPopupMenu( this ); | 1699 | ExportMenu = new QPopupMenu( this ); |
1704 | syncMenu = new QPopupMenu( this ); | 1700 | syncMenu = new QPopupMenu( this ); |
1705 | changeMenu= new QPopupMenu( this ); | 1701 | changeMenu= new QPopupMenu( this ); |
1706 | beamMenu= new QPopupMenu( this ); | 1702 | beamMenu= new QPopupMenu( this ); |
1707 | 1703 | ||
1708 | //US since we have no splitter for the embedded system, setup | 1704 | //US since we have no splitter for the embedded system, setup |
1709 | // a layout with two frames. One left and one right. | 1705 | // a layout with two frames. One left and one right. |
1710 | 1706 | ||
1711 | QBoxLayout *topLayout; | 1707 | QBoxLayout *topLayout; |
1712 | 1708 | ||
1713 | // = new QHBoxLayout( this ); | 1709 | // = new QHBoxLayout( this ); |
1714 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1710 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1715 | 1711 | ||
1716 | // QWidget *mainBox = new QWidget( this ); | 1712 | // QWidget *mainBox = new QWidget( this ); |
1717 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1713 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1718 | 1714 | ||
1719 | #ifdef DESKTOP_VERSION | 1715 | #ifdef DESKTOP_VERSION |
1720 | topLayout = new QHBoxLayout( this ); | 1716 | topLayout = new QHBoxLayout( this ); |
1721 | 1717 | ||
1722 | 1718 | ||
1723 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1719 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1724 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1720 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1725 | 1721 | ||
1726 | topLayout->addWidget(mMiniSplitter ); | 1722 | topLayout->addWidget(mMiniSplitter ); |
1727 | 1723 | ||
1728 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1724 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1729 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1725 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1730 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1726 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1731 | mDetails = new ViewContainer( mMiniSplitter ); | 1727 | mDetails = new ViewContainer( mMiniSplitter ); |
1732 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1728 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
@@ -2196,193 +2192,192 @@ void KABCore::addActionsManually() | |||
2196 | //LR hide filteraction on started in 480x640 | 2192 | //LR hide filteraction on started in 480x640 |
2197 | if (QApplication::desktop()->width() == 480 ) { | 2193 | if (QApplication::desktop()->width() == 480 ) { |
2198 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 2194 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
2199 | } | 2195 | } |
2200 | mActionUndo->plug( tb ); | 2196 | mActionUndo->plug( tb ); |
2201 | mActionDelete->plug( tb ); | 2197 | mActionDelete->plug( tb ); |
2202 | mActionRedo->plug( tb ); | 2198 | mActionRedo->plug( tb ); |
2203 | } else { | 2199 | } else { |
2204 | mActionSave->plug( tb ); | 2200 | mActionSave->plug( tb ); |
2205 | tb->enableMoving(false); | 2201 | tb->enableMoving(false); |
2206 | } | 2202 | } |
2207 | //mActionQuit->plug ( tb ); | 2203 | //mActionQuit->plug ( tb ); |
2208 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2204 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2209 | 2205 | ||
2210 | //US link the searchwidget first to this. | 2206 | //US link the searchwidget first to this. |
2211 | // The real linkage to the toolbar happens later. | 2207 | // The real linkage to the toolbar happens later. |
2212 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2208 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2213 | //US tb->insertItem( mIncSearchWidget ); | 2209 | //US tb->insertItem( mIncSearchWidget ); |
2214 | /*US | 2210 | /*US |
2215 | mIncSearchWidget = new IncSearchWidget( tb ); | 2211 | mIncSearchWidget = new IncSearchWidget( tb ); |
2216 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2212 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2217 | SLOT( incrementalSearch( const QString& ) ) ); | 2213 | SLOT( incrementalSearch( const QString& ) ) ); |
2218 | 2214 | ||
2219 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2215 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2220 | 2216 | ||
2221 | //US topLayout->addWidget( mJumpButtonBar ); | 2217 | //US topLayout->addWidget( mJumpButtonBar ); |
2222 | this->layout()->add( mJumpButtonBar ); | 2218 | this->layout()->add( mJumpButtonBar ); |
2223 | */ | 2219 | */ |
2224 | 2220 | ||
2225 | #endif //KAB_EMBEDDED | 2221 | #endif //KAB_EMBEDDED |
2226 | 2222 | ||
2227 | mActionExport2phone->plug( ExportMenu ); | 2223 | mActionExport2phone->plug( ExportMenu ); |
2228 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2224 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2229 | syncManager->fillSyncMenu(); | 2225 | syncManager->fillSyncMenu(); |
2230 | 2226 | ||
2231 | } | 2227 | } |
2232 | void KABCore::showLicence() | 2228 | void KABCore::showLicence() |
2233 | { | 2229 | { |
2234 | KApplication::showLicence(); | 2230 | KApplication::showLicence(); |
2235 | } | 2231 | } |
2236 | 2232 | ||
2237 | void KABCore::manageCategories( ) | 2233 | void KABCore::manageCategories( ) |
2238 | { | 2234 | { |
2239 | KABCatPrefs* cp = new KABCatPrefs(); | 2235 | KABCatPrefs* cp = new KABCatPrefs(); |
2240 | cp->show(); | 2236 | cp->show(); |
2241 | int w =cp->sizeHint().width() ; | 2237 | int w =cp->sizeHint().width() ; |
2242 | int h = cp->sizeHint().height() ; | 2238 | int h = cp->sizeHint().height() ; |
2243 | int dw = QApplication::desktop()->width(); | 2239 | int dw = QApplication::desktop()->width(); |
2244 | int dh = QApplication::desktop()->height(); | 2240 | int dh = QApplication::desktop()->height(); |
2245 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2241 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2246 | if ( !cp->exec() ) { | 2242 | if ( !cp->exec() ) { |
2247 | delete cp; | 2243 | delete cp; |
2248 | return; | 2244 | return; |
2249 | } | 2245 | } |
2250 | int count = 0; | 2246 | int count = 0; |
2251 | message( i18n("Please wait, processing categories...")); | 2247 | message( i18n("Please wait, processing categories...")); |
2252 | if ( cp->addCat() ) { | 2248 | if ( cp->addCat() ) { |
2253 | KABC::AddressBook::Iterator it; | 2249 | KABC::AddressBook::Iterator it; |
2254 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2250 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2255 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2251 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2256 | QStringList catIncList = (*it).categories(); | 2252 | QStringList catIncList = (*it).categories(); |
2257 | int i; | 2253 | int i; |
2258 | for( i = 0; i< catIncList.count(); ++i ) { | 2254 | for( i = 0; i< catIncList.count(); ++i ) { |
2259 | if ( !catList.contains (catIncList[i])) { | 2255 | if ( !catList.contains (catIncList[i])) { |
2260 | catList.append( catIncList[i] ); | 2256 | catList.append( catIncList[i] ); |
2261 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2257 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2262 | ++count; | 2258 | ++count; |
2263 | } | 2259 | } |
2264 | } | 2260 | } |
2265 | } | 2261 | } |
2266 | catList.sort(); | 2262 | catList.sort(); |
2267 | KABPrefs::instance()->mCustomCategories = catList; | 2263 | KABPrefs::instance()->mCustomCategories = catList; |
2268 | KABPrefs::instance()->writeConfig(); | 2264 | KABPrefs::instance()->writeConfig(); |
2269 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2265 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2270 | } else { | 2266 | } else { |
2271 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2267 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2272 | QStringList catIncList; | 2268 | QStringList catIncList; |
2273 | QStringList newCatList; | 2269 | QStringList newCatList; |
2274 | KABC::AddressBook::Iterator it; | 2270 | KABC::AddressBook::Iterator it; |
2275 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2271 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2276 | QStringList catIncList = (*it).categories(); | 2272 | QStringList catIncList = (*it).categories(); |
2277 | int i; | 2273 | int i; |
2278 | if ( catIncList.count() ) { | 2274 | if ( catIncList.count() ) { |
2279 | newCatList.clear(); | 2275 | newCatList.clear(); |
2280 | for( i = 0; i< catIncList.count(); ++i ) { | 2276 | for( i = 0; i< catIncList.count(); ++i ) { |
2281 | if ( catList.contains (catIncList[i])) { | 2277 | if ( catList.contains (catIncList[i])) { |
2282 | newCatList.append( catIncList[i] ); | 2278 | newCatList.append( catIncList[i] ); |
2283 | } | 2279 | } |
2284 | } | 2280 | } |
2285 | newCatList.sort(); | 2281 | newCatList.sort(); |
2286 | (*it).setCategories( newCatList ); | 2282 | (*it).setCategories( newCatList ); |
2287 | mAddressBook->insertAddressee( (*it) ); | 2283 | mAddressBook->insertAddressee( (*it) ); |
2288 | } | 2284 | } |
2289 | } | 2285 | } |
2290 | setModified( true ); | 2286 | setModified( true ); |
2291 | mViewManager->refreshView(); | 2287 | mViewManager->refreshView(); |
2292 | mDetails->refreshView(); | ||
2293 | message( i18n("Removing categories done!")); | 2288 | message( i18n("Removing categories done!")); |
2294 | } | 2289 | } |
2295 | delete cp; | 2290 | delete cp; |
2296 | } | 2291 | } |
2297 | void KABCore::removeVoice() | 2292 | void KABCore::removeVoice() |
2298 | { | 2293 | { |
2299 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2294 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2300 | return; | 2295 | return; |
2301 | KABC::Addressee::List list; | 2296 | KABC::Addressee::List list; |
2302 | XXPortSelectDialog dlg( this, false, this ); | 2297 | XXPortSelectDialog dlg( this, false, this ); |
2303 | if ( dlg.exec() ) | 2298 | if ( dlg.exec() ) |
2304 | list = dlg.contacts(); | 2299 | list = dlg.contacts(); |
2305 | else | 2300 | else |
2306 | return; | 2301 | return; |
2307 | KABC::Addressee::List::Iterator it; | 2302 | KABC::Addressee::List::Iterator it; |
2308 | for ( it = list.begin(); it != list.end(); ++it ) { | 2303 | for ( it = list.begin(); it != list.end(); ++it ) { |
2309 | if ( (*it).removeVoice() ) | 2304 | if ( (*it).removeVoice() ) |
2310 | contactModified((*it) ); | 2305 | contactModified((*it) ); |
2311 | } | 2306 | } |
2312 | } | 2307 | } |
2313 | 2308 | ||
2314 | 2309 | ||
2315 | 2310 | ||
2316 | void KABCore::clipboardDataChanged() | 2311 | void KABCore::clipboardDataChanged() |
2317 | { | 2312 | { |
2318 | 2313 | ||
2319 | if ( mReadWrite ) | 2314 | if ( mReadWrite ) |
2320 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2315 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2321 | 2316 | ||
2322 | } | 2317 | } |
2323 | 2318 | ||
2324 | void KABCore::updateActionMenu() | 2319 | void KABCore::updateActionMenu() |
2325 | { | 2320 | { |
2326 | UndoStack *undo = UndoStack::instance(); | 2321 | UndoStack *undo = UndoStack::instance(); |
2327 | RedoStack *redo = RedoStack::instance(); | 2322 | RedoStack *redo = RedoStack::instance(); |
2328 | 2323 | ||
2329 | if ( undo->isEmpty() ) | 2324 | if ( undo->isEmpty() ) |
2330 | mActionUndo->setText( i18n( "Undo" ) ); | 2325 | mActionUndo->setText( i18n( "Undo" ) ); |
2331 | else | 2326 | else |
2332 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2327 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2333 | 2328 | ||
2334 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2329 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2335 | 2330 | ||
2336 | if ( !redo->top() ) | 2331 | if ( !redo->top() ) |
2337 | mActionRedo->setText( i18n( "Redo" ) ); | 2332 | mActionRedo->setText( i18n( "Redo" ) ); |
2338 | else | 2333 | else |
2339 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2334 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2340 | 2335 | ||
2341 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2336 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2342 | } | 2337 | } |
2343 | 2338 | ||
2344 | void KABCore::configureKeyBindings() | 2339 | void KABCore::configureKeyBindings() |
2345 | { | 2340 | { |
2346 | #ifndef KAB_EMBEDDED | 2341 | #ifndef KAB_EMBEDDED |
2347 | KKeyDialog::configure( actionCollection(), true ); | 2342 | KKeyDialog::configure( actionCollection(), true ); |
2348 | #else //KAB_EMBEDDED | 2343 | #else //KAB_EMBEDDED |
2349 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2344 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2350 | #endif //KAB_EMBEDDED | 2345 | #endif //KAB_EMBEDDED |
2351 | } | 2346 | } |
2352 | 2347 | ||
2353 | #ifdef KAB_EMBEDDED | 2348 | #ifdef KAB_EMBEDDED |
2354 | void KABCore::configureResources() | 2349 | void KABCore::configureResources() |
2355 | { | 2350 | { |
2356 | KRES::KCMKResources dlg( this, "" , 0 ); | 2351 | KRES::KCMKResources dlg( this, "" , 0 ); |
2357 | 2352 | ||
2358 | if ( !dlg.exec() ) | 2353 | if ( !dlg.exec() ) |
2359 | return; | 2354 | return; |
2360 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2355 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2361 | } | 2356 | } |
2362 | #endif //KAB_EMBEDDED | 2357 | #endif //KAB_EMBEDDED |
2363 | 2358 | ||
2364 | 2359 | ||
2365 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2360 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2366 | * for the attendees list of an event. | 2361 | * for the attendees list of an event. |
2367 | */ | 2362 | */ |
2368 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2363 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2369 | { | 2364 | { |
2370 | QStringList nameList; | 2365 | QStringList nameList; |
2371 | QStringList emailList; | 2366 | QStringList emailList; |
2372 | QStringList uidList; | 2367 | QStringList uidList; |
2373 | 2368 | ||
2374 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2369 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2375 | uint i=0; | 2370 | uint i=0; |
2376 | for (i=0; i < list.count(); i++) | 2371 | for (i=0; i < list.count(); i++) |
2377 | { | 2372 | { |
2378 | nameList.append(list[i].realName()); | 2373 | nameList.append(list[i].realName()); |
2379 | emailList.append(list[i].preferredEmail()); | 2374 | emailList.append(list[i].preferredEmail()); |
2380 | uidList.append(list[i].uid()); | 2375 | uidList.append(list[i].uid()); |
2381 | } | 2376 | } |
2382 | 2377 | ||
2383 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2378 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2384 | 2379 | ||
2385 | } | 2380 | } |
2386 | 2381 | ||
2387 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2382 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2388 | * to put them into the calendar. | 2383 | * to put them into the calendar. |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c7c12ff..85ffbdb 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -2,196 +2,193 @@ | |||
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KABCORE_H | 24 | #ifndef KABCORE_H |
25 | #define KABCORE_H | 25 | #define KABCORE_H |
26 | 26 | ||
27 | #include <kabc/field.h> | 27 | #include <kabc/field.h> |
28 | 28 | ||
29 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
30 | #endif //KAB_EMBEDDED | 30 | #endif //KAB_EMBEDDED |
31 | #include <qdict.h> | 31 | #include <qdict.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | 33 | ||
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <ksyncmanager.h> | 36 | #include <ksyncmanager.h> |
37 | #ifndef DESKTOP_VERSION | 37 | #ifndef DESKTOP_VERSION |
38 | #include <qcopchannel_qws.h> | 38 | #include <qcopchannel_qws.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | namespace KABC { | 41 | namespace KABC { |
42 | class AddressBook; | 42 | class AddressBook; |
43 | } | 43 | } |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | class KAboutData; | 46 | class KAboutData; |
47 | class KConfig; | 47 | class KConfig; |
48 | 48 | ||
49 | class KAddressBookService; | 49 | class KAddressBookService; |
50 | class LDAPSearchDialog; | 50 | class LDAPSearchDialog; |
51 | #else //KAB_EMBEDDED | 51 | #else //KAB_EMBEDDED |
52 | class KAddressBookMain; | 52 | class KAddressBookMain; |
53 | //US class QAction; | 53 | //US class QAction; |
54 | #endif //KAB_EMBEDDED | 54 | #endif //KAB_EMBEDDED |
55 | class KCMultiDialog; | 55 | class KCMultiDialog; |
56 | class KXMLGUIClient; | 56 | class KXMLGUIClient; |
57 | class ExtensionManager; | 57 | class ExtensionManager; |
58 | class XXPortManager; | 58 | class XXPortManager; |
59 | class JumpButtonBar; | 59 | class JumpButtonBar; |
60 | class IncSearchWidget; | 60 | class IncSearchWidget; |
61 | class KDGanttMinimizeSplitter; | 61 | class KDGanttMinimizeSplitter; |
62 | class KAction; | 62 | class KAction; |
63 | class KActionCollection; | 63 | class KActionCollection; |
64 | class KToggleAction; | 64 | class KToggleAction; |
65 | class KSyncProfile; | 65 | class KSyncProfile; |
66 | 66 | ||
67 | class QAction; | 67 | class QAction; |
68 | class QMenuBar; | 68 | class QMenuBar; |
69 | class QSplitter; | 69 | class QSplitter; |
70 | class ViewContainer; | 70 | class ViewContainer; |
71 | class ViewManager; | 71 | class ViewManager; |
72 | class AddresseeEditorDialog; | 72 | class AddresseeEditorDialog; |
73 | class Ir; | 73 | class Ir; |
74 | 74 | ||
75 | class KABCore : public QWidget, public KSyncInterface | 75 | class KABCore : public QWidget, public KSyncInterface |
76 | { | 76 | { |
77 | Q_OBJECT | 77 | Q_OBJECT |
78 | 78 | ||
79 | public: | 79 | public: |
80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | 80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); |
81 | 81 | ||
82 | 82 | ||
83 | ~KABCore(); | 83 | ~KABCore(); |
84 | 84 | ||
85 | 85 | ||
86 | #ifdef KAB_EMBEDDED | 86 | #ifdef KAB_EMBEDDED |
87 | //US added functionality | 87 | //US added functionality |
88 | QPopupMenu* getViewMenu() {return viewMenu;} | 88 | QPopupMenu* getViewMenu() {return viewMenu;} |
89 | QPopupMenu* getFilterMenu() {return filterMenu;} | 89 | QPopupMenu* getFilterMenu() {return filterMenu;} |
90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} | 90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} |
91 | void addActionsManually(); | 91 | void addActionsManually(); |
92 | #endif //KAB_EMBEDDED | 92 | #endif //KAB_EMBEDDED |
93 | /** | 93 | /** |
94 | Restores the global settings. | 94 | Restores the global settings. |
95 | */ | 95 | */ |
96 | void restoreSettings(); | 96 | void restoreSettings(); |
97 | 97 | ||
98 | /** | 98 | |
99 | Saves the global settings. | ||
100 | */ | ||
101 | void saveSettings(); | ||
102 | 99 | ||
103 | /** | 100 | /** |
104 | Returns a pointer to the StdAddressBook of the application. | 101 | Returns a pointer to the StdAddressBook of the application. |
105 | */ | 102 | */ |
106 | KABC::AddressBook *addressBook() const; | 103 | KABC::AddressBook *addressBook() const; |
107 | 104 | ||
108 | /** | 105 | /** |
109 | Returns a pointer to the KConfig object of the application. | 106 | Returns a pointer to the KConfig object of the application. |
110 | */ | 107 | */ |
111 | static KConfig *config(); | 108 | static KConfig *config(); |
112 | 109 | ||
113 | /** | 110 | /** |
114 | Returns a pointer to the global KActionCollection object. So | 111 | Returns a pointer to the global KActionCollection object. So |
115 | other classes can register their actions easily. | 112 | other classes can register their actions easily. |
116 | */ | 113 | */ |
117 | KActionCollection *actionCollection() const; | 114 | KActionCollection *actionCollection() const; |
118 | 115 | ||
119 | /** | 116 | /** |
120 | Returns the current search field of the Incremental Search Widget. | 117 | Returns the current search field of the Incremental Search Widget. |
121 | */ | 118 | */ |
122 | KABC::Field *currentSearchField() const; | 119 | KABC::Field *currentSearchField() const; |
123 | 120 | ||
124 | /** | 121 | /** |
125 | Returns the uid list of the currently selected contacts. | 122 | Returns the uid list of the currently selected contacts. |
126 | */ | 123 | */ |
127 | QStringList selectedUIDs() const; | 124 | QStringList selectedUIDs() const; |
128 | 125 | ||
129 | /** | 126 | /** |
130 | Displays the ResourceSelectDialog and returns the selected | 127 | Displays the ResourceSelectDialog and returns the selected |
131 | resource or a null pointer if no resource was selected by | 128 | resource or a null pointer if no resource was selected by |
132 | the user. | 129 | the user. |
133 | */ | 130 | */ |
134 | KABC::Resource *requestResource( QWidget *parent ); | 131 | KABC::Resource *requestResource( QWidget *parent ); |
135 | 132 | ||
136 | #ifndef KAB_EMBEDDED | 133 | #ifndef KAB_EMBEDDED |
137 | static KAboutData *createAboutData(); | 134 | static KAboutData *createAboutData(); |
138 | #endif //KAB_EMBEDDED | 135 | #endif //KAB_EMBEDDED |
139 | 136 | ||
140 | #ifdef KAB_EMBEDDED | 137 | #ifdef KAB_EMBEDDED |
141 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | 138 | inline QPopupMenu* getImportMenu() { return ImportMenu;} |
142 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | 139 | inline QPopupMenu* getExportMenu() { return ExportMenu;} |
143 | #endif //KAB_EMBEDDED | 140 | #endif //KAB_EMBEDDED |
144 | 141 | ||
145 | public slots: | 142 | public slots: |
146 | #ifdef KAB_EMBEDDED | 143 | #ifdef KAB_EMBEDDED |
147 | void createAboutData(); | 144 | void createAboutData(); |
148 | #endif //KAB_EMBEDDED | 145 | #endif //KAB_EMBEDDED |
149 | void setDetailsToggle(); | 146 | void setDetailsToggle(); |
150 | 147 | ||
151 | void showLicence(); | 148 | void showLicence(); |
152 | void faq(); | 149 | void faq(); |
153 | void whatsnew() ; | 150 | void whatsnew() ; |
154 | void synchowto() ; | 151 | void synchowto() ; |
155 | void multisynchowto() ; | 152 | void multisynchowto() ; |
156 | void kdesynchowto() ; | 153 | void kdesynchowto() ; |
157 | void writeToPhone(); | 154 | void writeToPhone(); |
158 | 155 | ||
159 | /** | 156 | /** |
160 | Is called whenever a contact is selected in the view. | 157 | Is called whenever a contact is selected in the view. |
161 | */ | 158 | */ |
162 | void setContactSelected( const QString &uid ); | 159 | void setContactSelected( const QString &uid ); |
163 | 160 | ||
164 | /** | 161 | /** |
165 | Opens the preferred mail composer with all selected contacts as | 162 | Opens the preferred mail composer with all selected contacts as |
166 | arguments. | 163 | arguments. |
167 | */ | 164 | */ |
168 | void sendMail(); | 165 | void sendMail(); |
169 | 166 | ||
170 | /** | 167 | /** |
171 | Opens the preferred mail composer with the given contacts as | 168 | Opens the preferred mail composer with the given contacts as |
172 | arguments. | 169 | arguments. |
173 | */ | 170 | */ |
174 | void sendMail( const QString& email ); | 171 | void sendMail( const QString& email ); |
175 | 172 | ||
176 | 173 | ||
177 | void mailVCard(); | 174 | void mailVCard(); |
178 | void mailVCard(const QStringList& uids); | 175 | void mailVCard(const QStringList& uids); |
179 | 176 | ||
180 | /** | 177 | /** |
181 | Beams the "WhoAmI contact. | 178 | Beams the "WhoAmI contact. |
182 | */ | 179 | */ |
183 | void beamMySelf(); | 180 | void beamMySelf(); |
184 | 181 | ||
185 | void beamVCard(); | 182 | void beamVCard(); |
186 | void export2phone(); | 183 | void export2phone(); |
187 | void beamVCard(const QStringList& uids); | 184 | void beamVCard(const QStringList& uids); |
188 | void beamDone( Ir *ir ); | 185 | void beamDone( Ir *ir ); |
189 | 186 | ||
190 | 187 | ||
191 | /** | 188 | /** |
192 | Starts the preferred web browser with the given URL as argument. | 189 | Starts the preferred web browser with the given URL as argument. |
193 | */ | 190 | */ |
194 | void browse( const QString& url ); | 191 | void browse( const QString& url ); |
195 | 192 | ||
196 | /** | 193 | /** |
197 | Select all contacts in the view. | 194 | Select all contacts in the view. |
@@ -265,193 +262,195 @@ class KABCore : public QWidget, public KSyncInterface | |||
265 | Marks the address book as modified without refreshing the view. | 262 | Marks the address book as modified without refreshing the view. |
266 | */ | 263 | */ |
267 | void setModifiedWOrefresh(); | 264 | void setModifiedWOrefresh(); |
268 | 265 | ||
269 | /** | 266 | /** |
270 | Marks the address book as modified concerning the argument. | 267 | Marks the address book as modified concerning the argument. |
271 | */ | 268 | */ |
272 | void setModified( bool modified ); | 269 | void setModified( bool modified ); |
273 | 270 | ||
274 | /** | 271 | /** |
275 | Returns whether the address book is modified. | 272 | Returns whether the address book is modified. |
276 | */ | 273 | */ |
277 | bool modified() const; | 274 | bool modified() const; |
278 | 275 | ||
279 | /** | 276 | /** |
280 | Called whenever an contact is modified in the contact editor | 277 | Called whenever an contact is modified in the contact editor |
281 | dialog or the quick edit. | 278 | dialog or the quick edit. |
282 | */ | 279 | */ |
283 | void contactModified( const KABC::Addressee &addr ); | 280 | void contactModified( const KABC::Addressee &addr ); |
284 | 281 | ||
285 | /** | 282 | /** |
286 | DCOP METHODS. | 283 | DCOP METHODS. |
287 | */ | 284 | */ |
288 | void addEmail( QString addr ); | 285 | void addEmail( QString addr ); |
289 | void importVCard( const KURL& url, bool showPreview ); | 286 | void importVCard( const KURL& url, bool showPreview ); |
290 | void importVCard( const QString& vCard, bool showPreview ); | 287 | void importVCard( const QString& vCard, bool showPreview ); |
291 | void newContact(); | 288 | void newContact(); |
292 | QString getNameByPhone( const QString& phone ); | 289 | QString getNameByPhone( const QString& phone ); |
293 | /** | 290 | /** |
294 | END DCOP METHODS | 291 | END DCOP METHODS |
295 | */ | 292 | */ |
296 | 293 | ||
297 | /** | 294 | /** |
298 | Saves the contents of the AddressBook back to disk. | 295 | Saves the contents of the AddressBook back to disk. |
299 | */ | 296 | */ |
300 | void save(); | 297 | void save(); |
301 | 298 | ||
302 | /** | 299 | /** |
303 | Undos the last command using the undo stack. | 300 | Undos the last command using the undo stack. |
304 | */ | 301 | */ |
305 | void undo(); | 302 | void undo(); |
306 | 303 | ||
307 | /** | 304 | /** |
308 | Redos the last command that was undone, using the redo stack. | 305 | Redos the last command that was undone, using the redo stack. |
309 | */ | 306 | */ |
310 | void redo(); | 307 | void redo(); |
311 | 308 | ||
312 | /** | 309 | /** |
313 | Shows the edit dialog for the given uid. If the uid is QString::null, | 310 | Shows the edit dialog for the given uid. If the uid is QString::null, |
314 | the method will try to find a selected addressee in the view. | 311 | the method will try to find a selected addressee in the view. |
315 | */ | 312 | */ |
316 | void editContact( const QString &uid /*US = QString::null*/ ); | 313 | void editContact( const QString &uid /*US = QString::null*/ ); |
317 | //US added a second method without defaultparameter | 314 | //US added a second method without defaultparameter |
318 | void editContact2(); | 315 | void editContact2(); |
319 | 316 | ||
320 | /** | 317 | /** |
321 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 318 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
322 | the method will try to find a selected addressee in the view. | 319 | the method will try to find a selected addressee in the view. |
323 | */ | 320 | */ |
324 | void executeContact( const QString &uid /*US = QString::null*/ ); | 321 | void executeContact( const QString &uid /*US = QString::null*/ ); |
325 | 322 | ||
326 | /** | 323 | /** |
327 | Launches the configuration dialog. | 324 | Launches the configuration dialog. |
328 | */ | 325 | */ |
329 | void openConfigDialog(); | 326 | void openConfigDialog(); |
330 | 327 | ||
331 | /** | 328 | /** |
332 | Launches the ldap search dialog. | 329 | Launches the ldap search dialog. |
333 | */ | 330 | */ |
334 | void openLDAPDialog(); | 331 | void openLDAPDialog(); |
335 | 332 | ||
336 | /** | 333 | /** |
337 | Creates a KAddressBookPrinter, which will display the print | 334 | Creates a KAddressBookPrinter, which will display the print |
338 | dialog and do the printing. | 335 | dialog and do the printing. |
339 | */ | 336 | */ |
340 | void print(); | 337 | void print(); |
341 | 338 | ||
342 | /** | 339 | /** |
343 | Registers a new GUI client, so plugins can register its actions. | 340 | Registers a new GUI client, so plugins can register its actions. |
344 | */ | 341 | */ |
345 | void addGUIClient( KXMLGUIClient *client ); | 342 | void addGUIClient( KXMLGUIClient *client ); |
346 | 343 | ||
347 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 344 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
348 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 345 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
349 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 346 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
350 | 347 | ||
351 | 348 | ||
352 | signals: | 349 | signals: |
353 | void contactSelected( const QString &name ); | 350 | void contactSelected( const QString &name ); |
354 | void contactSelected( const QPixmap &pixmap ); | 351 | void contactSelected( const QPixmap &pixmap ); |
355 | public slots: | 352 | public slots: |
356 | void recieve(QString cmsg ); | 353 | void recieve(QString cmsg ); |
357 | void getFile( bool success ); | 354 | void getFile( bool success ); |
358 | void syncFileRequest(); | 355 | void syncFileRequest(); |
359 | void setDetailsVisible( bool visible ); | 356 | void setDetailsVisible( bool visible ); |
360 | void setDetailsToState(); | 357 | void setDetailsToState(); |
361 | // void slotSyncMenu( int ); | 358 | |
359 | void saveSettings(); | ||
360 | |||
362 | private slots: | 361 | private slots: |
363 | void updateToolBar(); | 362 | void updateToolBar(); |
364 | void updateMainWindow(); | 363 | void updateMainWindow(); |
365 | void receive( const QCString& cmsg, const QByteArray& data ); | 364 | void receive( const QCString& cmsg, const QByteArray& data ); |
366 | void toggleBeamReceive( ); | 365 | void toggleBeamReceive( ); |
367 | void disableBR(bool); | 366 | void disableBR(bool); |
368 | void setJumpButtonBarVisible( bool visible ); | 367 | void setJumpButtonBarVisible( bool visible ); |
369 | void setCaptionBack(); | 368 | void setCaptionBack(); |
370 | void importFromOL(); | 369 | void importFromOL(); |
371 | void extensionModified( const KABC::Addressee::List &list ); | 370 | void extensionModified( const KABC::Addressee::List &list ); |
372 | void extensionChanged( int id ); | 371 | void extensionChanged( int id ); |
373 | void clipboardDataChanged(); | 372 | void clipboardDataChanged(); |
374 | void updateActionMenu(); | 373 | void updateActionMenu(); |
375 | void configureKeyBindings(); | 374 | void configureKeyBindings(); |
376 | void removeVoice(); | 375 | void removeVoice(); |
377 | #ifdef KAB_EMBEDDED | 376 | #ifdef KAB_EMBEDDED |
378 | void configureResources(); | 377 | void configureResources(); |
379 | #endif //KAB_EMBEDDED | 378 | #endif //KAB_EMBEDDED |
380 | 379 | ||
381 | void slotEditorDestroyed( const QString &uid ); | 380 | void slotEditorDestroyed( const QString &uid ); |
382 | void configurationChanged(); | 381 | void configurationChanged(); |
383 | void addressBookChanged(); | 382 | void addressBookChanged(); |
384 | 383 | ||
385 | private: | 384 | private: |
386 | void resizeEvent(QResizeEvent* e ); | 385 | void resizeEvent(QResizeEvent* e ); |
387 | bool mBRdisabled; | 386 | bool mBRdisabled; |
388 | #ifndef DESKTOP_VERSION | 387 | #ifndef DESKTOP_VERSION |
389 | QCopChannel* infrared; | 388 | QCopChannel* infrared; |
390 | #endif | 389 | #endif |
391 | QTimer *mMessageTimer; | 390 | QTimer *mMessageTimer; |
392 | void initGUI(); | 391 | void initGUI(); |
393 | void initActions(); | 392 | void initActions(); |
394 | QString getPhoneFile(); | 393 | QString getPhoneFile(); |
395 | 394 | ||
396 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 395 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
397 | const char *name = 0 ); | 396 | const char *name = 0 ); |
398 | 397 | ||
399 | KXMLGUIClient *mGUIClient; | 398 | KXMLGUIClient *mGUIClient; |
400 | 399 | ||
401 | KABC::AddressBook *mAddressBook; | 400 | KABC::AddressBook *mAddressBook; |
402 | 401 | ||
403 | ViewManager *mViewManager; | 402 | ViewManager *mViewManager; |
404 | // QSplitter *mDetailsSplitter; | 403 | // QSplitter *mDetailsSplitter; |
405 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 404 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
406 | ViewContainer *mDetails; | 405 | ViewContainer *mDetails; |
407 | KDGanttMinimizeSplitter* mMiniSplitter; | 406 | KDGanttMinimizeSplitter* mMiniSplitter; |
408 | XXPortManager *mXXPortManager; | 407 | XXPortManager *mXXPortManager; |
409 | JumpButtonBar *mJumpButtonBar; | 408 | JumpButtonBar *mJumpButtonBar; |
410 | IncSearchWidget *mIncSearchWidget; | 409 | IncSearchWidget *mIncSearchWidget; |
411 | ExtensionManager *mExtensionManager; | 410 | ExtensionManager *mExtensionManager; |
412 | 411 | ||
413 | KCMultiDialog *mConfigureDialog; | 412 | KCMultiDialog *mConfigureDialog; |
414 | 413 | ||
415 | #ifndef KAB_EMBEDDED | 414 | #ifndef KAB_EMBEDDED |
416 | LDAPSearchDialog *mLdapSearchDialog; | 415 | LDAPSearchDialog *mLdapSearchDialog; |
417 | #endif //KAB_EMBEDDED | 416 | #endif //KAB_EMBEDDED |
418 | // QDict<AddresseeEditorDialog> mEditorDict; | 417 | // QDict<AddresseeEditorDialog> mEditorDict; |
419 | AddresseeEditorDialog *mEditorDialog; | 418 | AddresseeEditorDialog *mEditorDialog; |
420 | bool mReadWrite; | 419 | bool mReadWrite; |
421 | bool mModified; | 420 | bool mModified; |
422 | bool mIsPart; | 421 | bool mIsPart; |
423 | bool mMultipleViewsAtOnce; | 422 | bool mMultipleViewsAtOnce; |
424 | 423 | ||
425 | 424 | ||
426 | //US file menu | 425 | //US file menu |
427 | KAction *mActionMail; | 426 | KAction *mActionMail; |
428 | KAction *mActionBeam; | 427 | KAction *mActionBeam; |
429 | KToggleAction *mActionBR; | 428 | KToggleAction *mActionBR; |
430 | KAction *mActionExport2phone; | 429 | KAction *mActionExport2phone; |
431 | KAction* mActionPrint; | 430 | KAction* mActionPrint; |
432 | KAction* mActionNewContact; | 431 | KAction* mActionNewContact; |
433 | KAction *mActionSave; | 432 | KAction *mActionSave; |
434 | KAction *mActionEditAddressee; | 433 | KAction *mActionEditAddressee; |
435 | KAction *mActionMailVCard; | 434 | KAction *mActionMailVCard; |
436 | KAction *mActionBeamVCard; | 435 | KAction *mActionBeamVCard; |
437 | 436 | ||
438 | KAction *mActionQuit; | 437 | KAction *mActionQuit; |
439 | 438 | ||
440 | //US edit menu | 439 | //US edit menu |
441 | KAction *mActionCopy; | 440 | KAction *mActionCopy; |
442 | KAction *mActionCut; | 441 | KAction *mActionCut; |
443 | KAction *mActionPaste; | 442 | KAction *mActionPaste; |
444 | KAction *mActionSelectAll; | 443 | KAction *mActionSelectAll; |
445 | KAction *mActionUndo; | 444 | KAction *mActionUndo; |
446 | KAction *mActionRedo; | 445 | KAction *mActionRedo; |
447 | KAction *mActionDelete; | 446 | KAction *mActionDelete; |
448 | 447 | ||
449 | //US settings menu | 448 | //US settings menu |
450 | KAction *mActionConfigResources; | 449 | KAction *mActionConfigResources; |
451 | KAction *mActionConfigKAddressbook; | 450 | KAction *mActionConfigKAddressbook; |
452 | KAction *mActionConfigShortcuts; | 451 | KAction *mActionConfigShortcuts; |
453 | KAction *mActionConfigureToolbars; | 452 | KAction *mActionConfigureToolbars; |
454 | KAction *mActionKeyBindings; | 453 | KAction *mActionKeyBindings; |
455 | KToggleAction *mActionJumpBar; | 454 | KToggleAction *mActionJumpBar; |
456 | KToggleAction *mActionDetails; | 455 | KToggleAction *mActionDetails; |
457 | KAction *mActionWhoAmI; | 456 | KAction *mActionWhoAmI; |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 33bef5a..59bddd9 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -512,192 +512,193 @@ void ViewManager::dropped( QDropEvent *e ) | |||
512 | KABC::Addressee addr; | 512 | KABC::Addressee addr; |
513 | KABC::VCardConverter converter; | 513 | KABC::VCardConverter converter; |
514 | QStringList list = QStringList::split( "\r\n\r\n", vcards ); | 514 | QStringList list = QStringList::split( "\r\n\r\n", vcards ); |
515 | QStringList::Iterator it; | 515 | QStringList::Iterator it; |
516 | for ( it = list.begin(); it != list.end(); ++it ) { | 516 | for ( it = list.begin(); it != list.end(); ++it ) { |
517 | if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { | 517 | if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { |
518 | KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); | 518 | KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); |
519 | if ( a.isEmpty() ) { | 519 | if ( a.isEmpty() ) { |
520 | mCore->addressBook()->insertAddressee( addr ); | 520 | mCore->addressBook()->insertAddressee( addr ); |
521 | emit modified(); | 521 | emit modified(); |
522 | } | 522 | } |
523 | } | 523 | } |
524 | } | 524 | } |
525 | 525 | ||
526 | mActiveView->refresh(); | 526 | mActiveView->refresh(); |
527 | } | 527 | } |
528 | #else //KAB_EMBEDDED | 528 | #else //KAB_EMBEDDED |
529 | qDebug("ViewManager::dropped() has to be changed!!" ); | 529 | qDebug("ViewManager::dropped() has to be changed!!" ); |
530 | #endif //KAB_EMBEDDED | 530 | #endif //KAB_EMBEDDED |
531 | 531 | ||
532 | } | 532 | } |
533 | 533 | ||
534 | void ViewManager::startDrag() | 534 | void ViewManager::startDrag() |
535 | { | 535 | { |
536 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; | 536 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; |
537 | 537 | ||
538 | #ifndef KAB_EMBEDDED | 538 | #ifndef KAB_EMBEDDED |
539 | 539 | ||
540 | // Get the list of all the selected addressees | 540 | // Get the list of all the selected addressees |
541 | KABC::Addressee::List addrList; | 541 | KABC::Addressee::List addrList; |
542 | QStringList uidList = selectedUids(); | 542 | QStringList uidList = selectedUids(); |
543 | QStringList::Iterator iter; | 543 | QStringList::Iterator iter; |
544 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) | 544 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) |
545 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); | 545 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); |
546 | 546 | ||
547 | KMultipleDrag *drag = new KMultipleDrag( this ); | 547 | KMultipleDrag *drag = new KMultipleDrag( this ); |
548 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); | 548 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); |
549 | KABC::Addressee::List::Iterator it; | 549 | KABC::Addressee::List::Iterator it; |
550 | QStringList vcards; | 550 | QStringList vcards; |
551 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { | 551 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { |
552 | QString vcard = QString::null; | 552 | QString vcard = QString::null; |
553 | KABC::VCardConverter converter; | 553 | KABC::VCardConverter converter; |
554 | if ( converter.addresseeToVCard( *it, vcard ) ) | 554 | if ( converter.addresseeToVCard( *it, vcard ) ) |
555 | vcards.append( vcard ); | 555 | vcards.append( vcard ); |
556 | } | 556 | } |
557 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); | 557 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); |
558 | 558 | ||
559 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); | 559 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); |
560 | drag->dragCopy(); | 560 | drag->dragCopy(); |
561 | 561 | ||
562 | #else //KAB_EMBEDDED | 562 | #else //KAB_EMBEDDED |
563 | qDebug("ViewManager::startDrag() has to be changed!!" ); | 563 | qDebug("ViewManager::startDrag() has to be changed!!" ); |
564 | #endif //KAB_EMBEDDED | 564 | #endif //KAB_EMBEDDED |
565 | 565 | ||
566 | } | 566 | } |
567 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) | 567 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) |
568 | { | 568 | { |
569 | if ( mActiveView ) | 569 | if ( mActiveView ) |
570 | mActiveView->doSearch( s, field ); | 570 | mActiveView->doSearch( s, field ); |
571 | 571 | ||
572 | } | 572 | } |
573 | void ViewManager::setActiveFilter( int index ) | 573 | void ViewManager::setActiveFilter( int index ) |
574 | { | 574 | { |
575 | Filter currentFilter; | 575 | Filter currentFilter; |
576 | 576 | ||
577 | if ( ( index - 1 ) < 0 ) | 577 | if ( ( index - 1 ) < 0 ) |
578 | currentFilter = Filter(); | 578 | currentFilter = Filter(); |
579 | else | 579 | else |
580 | currentFilter = mFilterList[ index - 1 ]; | 580 | currentFilter = mFilterList[ index - 1 ]; |
581 | 581 | ||
582 | // Check if we have a view. Since the filter combo is created before | 582 | // Check if we have a view. Since the filter combo is created before |
583 | // the view, this slot could be called before there is a valid view. | 583 | // the view, this slot could be called before there is a valid view. |
584 | if ( mActiveView ) { | 584 | if ( mActiveView ) { |
585 | mActiveView->setFilter( currentFilter ); | 585 | mActiveView->setFilter( currentFilter ); |
586 | mActiveView->refresh(); | 586 | mActiveView->refresh(); |
587 | emit selected( QString::null ); | 587 | emit selected( QString::null ); |
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
591 | void ViewManager::configureFilters() | 591 | void ViewManager::configureFilters() |
592 | { | 592 | { |
593 | FilterDialog dlg( this ); | 593 | FilterDialog dlg( this ); |
594 | 594 | ||
595 | dlg.setFilters( mFilterList ); | 595 | dlg.setFilters( mFilterList ); |
596 | 596 | ||
597 | if ( dlg.exec() ) | 597 | if ( dlg.exec() ) |
598 | mFilterList = dlg.filters(); | 598 | mFilterList = dlg.filters(); |
599 | 599 | ||
600 | uint pos = mActionSelectFilter->currentItem(); | 600 | uint pos = mActionSelectFilter->currentItem(); |
601 | mActionSelectFilter->setItems( filterNames() ); | 601 | mActionSelectFilter->setItems( filterNames() ); |
602 | mActionSelectFilter->setCurrentItem( pos ); | 602 | mActionSelectFilter->setCurrentItem( pos ); |
603 | setActiveFilter( pos ); | 603 | setActiveFilter( pos ); |
604 | int cw = 150; | 604 | int cw = 150; |
605 | if (QApplication::desktop()->width() == 480 ) | 605 | if (QApplication::desktop()->width() == 480 ) |
606 | cw = 0; | 606 | cw = 0; |
607 | mActionSelectFilter->setComboWidth( cw ); | 607 | mActionSelectFilter->setComboWidth( cw ); |
608 | saveSettings(); | ||
608 | } | 609 | } |
609 | 610 | ||
610 | QStringList ViewManager::filterNames() const | 611 | QStringList ViewManager::filterNames() const |
611 | { | 612 | { |
612 | QStringList names( i18n( "No Filter" ) ); | 613 | QStringList names( i18n( "No Filter" ) ); |
613 | 614 | ||
614 | Filter::List::ConstIterator it; | 615 | Filter::List::ConstIterator it; |
615 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) | 616 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) |
616 | names.append( (*it).name() ); | 617 | names.append( (*it).name() ); |
617 | 618 | ||
618 | return names; | 619 | return names; |
619 | } | 620 | } |
620 | 621 | ||
621 | int ViewManager::filterPosition( const QString &name ) const | 622 | int ViewManager::filterPosition( const QString &name ) const |
622 | { | 623 | { |
623 | int pos = 0; | 624 | int pos = 0; |
624 | 625 | ||
625 | Filter::List::ConstIterator it; | 626 | Filter::List::ConstIterator it; |
626 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) | 627 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) |
627 | if ( name == (*it).name() ) | 628 | if ( name == (*it).name() ) |
628 | return pos + 1; | 629 | return pos + 1; |
629 | 630 | ||
630 | return 0; | 631 | return 0; |
631 | } | 632 | } |
632 | 633 | ||
633 | void ViewManager::initActions() | 634 | void ViewManager::initActions() |
634 | { | 635 | { |
635 | //US <ActionList name="view_loadedviews"/> | 636 | //US <ActionList name="view_loadedviews"/> |
636 | //US <Separator/> | 637 | //US <Separator/> |
637 | 638 | ||
638 | #ifdef KAB_EMBEDDED | 639 | #ifdef KAB_EMBEDDED |
639 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); | 640 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); |
640 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 641 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); |
641 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); | 642 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); |
642 | #endif //KAB_EMBEDDED | 643 | #endif //KAB_EMBEDDED |
643 | 644 | ||
644 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); | 645 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); |
645 | #if KDE_VERSION >= 309 | 646 | #if KDE_VERSION >= 309 |
646 | mActionSelectView->setMenuAccelsEnabled( false ); | 647 | mActionSelectView->setMenuAccelsEnabled( false ); |
647 | #endif | 648 | #endif |
648 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), | 649 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), |
649 | SLOT( setActiveView( const QString& ) ) ); | 650 | SLOT( setActiveView( const QString& ) ) ); |
650 | 651 | ||
651 | 652 | ||
652 | #ifdef KAB_EMBEDDED | 653 | #ifdef KAB_EMBEDDED |
653 | mActionSelectView->plug(viewmenu); | 654 | mActionSelectView->plug(viewmenu); |
654 | viewmenu->insertSeparator(); | 655 | viewmenu->insertSeparator(); |
655 | #endif //KAB_EMBEDDED | 656 | #endif //KAB_EMBEDDED |
656 | 657 | ||
657 | KAction *action; | 658 | KAction *action; |
658 | 659 | ||
659 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, | 660 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, |
660 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); | 661 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); |
661 | #ifndef KAB_EMBEDDED | 662 | #ifndef KAB_EMBEDDED |
662 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); | 663 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); |
663 | #else //KAB_EMBEDDED | 664 | #else //KAB_EMBEDDED |
664 | action->plug(viewmenu); | 665 | action->plug(viewmenu); |
665 | #endif //KAB_EMBEDDED | 666 | #endif //KAB_EMBEDDED |
666 | 667 | ||
667 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, | 668 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, |
668 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); | 669 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); |
669 | #ifndef KAB_EMBEDDED | 670 | #ifndef KAB_EMBEDDED |
670 | action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); | 671 | action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); |
671 | #else //KAB_EMBEDDED | 672 | #else //KAB_EMBEDDED |
672 | action->plug(viewmenu); | 673 | action->plug(viewmenu); |
673 | #endif //KAB_EMBEDDED | 674 | #endif //KAB_EMBEDDED |
674 | 675 | ||
675 | mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, | 676 | mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, |
676 | this, SLOT( deleteView() ), | 677 | this, SLOT( deleteView() ), |
677 | mCore->actionCollection(), "view_delete" ); | 678 | mCore->actionCollection(), "view_delete" ); |
678 | #ifndef KAB_EMBEDDED | 679 | #ifndef KAB_EMBEDDED |
679 | mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); | 680 | mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); |
680 | #else //KAB_EMBEDDED | 681 | #else //KAB_EMBEDDED |
681 | mActionDeleteView->plug(viewmenu); | 682 | mActionDeleteView->plug(viewmenu); |
682 | viewmenu->insertSeparator(); | 683 | viewmenu->insertSeparator(); |
683 | #endif //KAB_EMBEDDED | 684 | #endif //KAB_EMBEDDED |
684 | 685 | ||
685 | #ifndef KAB_EMBEDDED | 686 | #ifndef KAB_EMBEDDED |
686 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, | 687 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, |
687 | SLOT( refreshView(const QString &) ), mCore->actionCollection(), | 688 | SLOT( refreshView(const QString &) ), mCore->actionCollection(), |
688 | "view_refresh" ); | 689 | "view_refresh" ); |
689 | action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); | 690 | action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); |
690 | #else //KAB_EMBEDDED | 691 | #else //KAB_EMBEDDED |
691 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, | 692 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, |
692 | SLOT( refreshView()), mCore->actionCollection(), | 693 | SLOT( refreshView()), mCore->actionCollection(), |
693 | "view_refresh" ); | 694 | "view_refresh" ); |
694 | action->plug(viewmenu); | 695 | action->plug(viewmenu); |
695 | viewmenu->insertSeparator(); | 696 | viewmenu->insertSeparator(); |
696 | #endif //KAB_EMBEDDED | 697 | #endif //KAB_EMBEDDED |
697 | 698 | ||
698 | action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, | 699 | action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, |
699 | SLOT( configureFilters() ), mCore->actionCollection(), | 700 | SLOT( configureFilters() ), mCore->actionCollection(), |
700 | "options_edit_filters" ); | 701 | "options_edit_filters" ); |
701 | 702 | ||
702 | mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); | 703 | mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); |
703 | #if KDE_VERSION >= 309 | 704 | #if KDE_VERSION >= 309 |
diff --git a/kde2file/abdump/main.cpp b/kde2file/abdump/main.cpp index 1ee64f5..9ad78e5 100644 --- a/kde2file/abdump/main.cpp +++ b/kde2file/abdump/main.cpp | |||
@@ -11,185 +11,183 @@ | |||
11 | * This program is distributed in the hope that it will be useful, * | 11 | * This program is distributed in the hope that it will be useful, * |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
14 | * GNU General Public License for more details. * | 14 | * GNU General Public License for more details. * |
15 | * * | 15 | * * |
16 | * You should have received a copy of the GNU General Public License * | 16 | * You should have received a copy of the GNU General Public License * |
17 | * along with this program; if not, write to the Free Software * | 17 | * along with this program; if not, write to the Free Software * |
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * | 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
19 | * * | 19 | * * |
20 | * As a special exception, permission is given to link this program * | 20 | * As a special exception, permission is given to link this program * |
21 | * with any edition of Qt, and distribute the resulting executable, * | 21 | * with any edition of Qt, and distribute the resulting executable, * |
22 | * without including the source code for Qt in the source distribution. * | 22 | * without including the source code for Qt in the source distribution. * |
23 | * * | 23 | * * |
24 | ******************************************************************************/ | 24 | ******************************************************************************/ |
25 | 25 | ||
26 | #include <kcmdlineargs.h> | 26 | #include <kcmdlineargs.h> |
27 | #include <kaboutdata.h> | 27 | #include <kaboutdata.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #include <kconfig.h> | 30 | #include <kconfig.h> |
31 | #include <kstandarddirs.h> | 31 | #include <kstandarddirs.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | 33 | ||
34 | #include <kabc/addressbook.h> | 34 | #include <kabc/addressbook.h> |
35 | #include <kabc/stdaddressbook.h> | 35 | #include <kabc/stdaddressbook.h> |
36 | #include <kabc/resource.h> | 36 | #include <kabc/resource.h> |
37 | #include <kabc/vcardconverter.h> | 37 | #include <kabc/vcardconverter.h> |
38 | 38 | ||
39 | #include <qdatetime.h> | 39 | #include <qdatetime.h> |
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include <qapplication.h> | 42 | #include <qapplication.h> |
43 | 43 | ||
44 | #include <stdlib.h> | 44 | #include <stdlib.h> |
45 | #include <iostream> | 45 | #include <iostream> |
46 | 46 | ||
47 | using namespace std; | 47 | using namespace std; |
48 | 48 | ||
49 | static const char progName[] = "kdecalendar"; | 49 | static const char progName[] = "kdecalendar"; |
50 | static const char progDisplay[] = "KDE_Addressbook"; | 50 | static const char progDisplay[] = "KDE_Addressbook"; |
51 | static const char progVersion[] = "33.1/3"; | 51 | static const char progVersion[] = "33.1/3"; |
52 | static const char progDesc[] = "A command line interface to KDE addressbooks"; | 52 | static const char progDesc[] = "A command line interface to KDE addressbooks"; |
53 | 53 | ||
54 | 54 | ||
55 | static KCmdLineOptions options[] = | 55 | static KCmdLineOptions options[] = |
56 | { | 56 | { |
57 | { "dump", | 57 | { "dump", |
58 | I18N_NOOP( "Dumps addressbook" ), 0 }, | 58 | I18N_NOOP( "Dumps addressbook" ), 0 }, |
59 | { "read", | 59 | { "read", |
60 | I18N_NOOP( "Reads addressbook" ), 0 }, | 60 | I18N_NOOP( "Reads addressbook" ), 0 }, |
61 | KCmdLineLastOption | 61 | KCmdLineLastOption |
62 | }; | 62 | }; |
63 | 63 | ||
64 | int main( int argc, char *argv[] ) | 64 | int main( int argc, char *argv[] ) |
65 | { | 65 | { |
66 | KAboutData aboutData( | 66 | KAboutData aboutData( |
67 | progName, // internal program name | 67 | progName, // internal program name |
68 | I18N_NOOP( progDisplay ), // displayable program name. | 68 | I18N_NOOP( progDisplay ), // displayable program name. |
69 | progVersion, // version string | 69 | progVersion, // version string |
70 | I18N_NOOP( progDesc ), // short porgram description | 70 | I18N_NOOP( progDesc ), // short porgram description |
71 | KAboutData::License_GPL, // license type | 71 | KAboutData::License_GPL, // license type |
72 | "(c) 2004, Lutz Rogowski", // copyright statement | 72 | "(c) 2004, Lutz Rogowski", // copyright statement |
73 | 0, // any free form text | 73 | 0, // any free form text |
74 | "", // program home page address | 74 | "", // program home page address |
75 | "bugs.kde.org" // bug report email address | 75 | "bugs.kde.org" // bug report email address |
76 | ); | 76 | ); |
77 | 77 | ||
78 | 78 | ||
79 | // KCmdLineArgs::init() final 'true' argument indicates no commandline options | 79 | // KCmdLineArgs::init() final 'true' argument indicates no commandline options |
80 | // for QApplication/KApplication (no KDE or Qt options) | 80 | // for QApplication/KApplication (no KDE or Qt options) |
81 | KCmdLineArgs::init( argc, argv, &aboutData, true ); | 81 | KCmdLineArgs::init( argc, argv, &aboutData, true ); |
82 | KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. | 82 | KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. |
83 | 83 | ||
84 | KInstance ins ( progName ); | 84 | KInstance ins ( progName ); |
85 | 85 | ||
86 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 86 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
87 | 87 | ||
88 | bool read = false; | 88 | bool read = false; |
89 | if ( args->isSet( "read" ) ) { | 89 | if ( args->isSet( "read" ) ) { |
90 | read = true; | 90 | read = true; |
91 | qDebug("read "); | 91 | qDebug("read "); |
92 | } | 92 | } |
93 | QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; | 93 | QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; |
94 | 94 | ||
95 | KABC::StdAddressBook* standardAddressBook = KABC::StdAddressBook::self(); | 95 | KABC::StdAddressBook* standardAddressBook = KABC::StdAddressBook::self(); |
96 | standardAddressBook->setAutomaticSave( false ); | 96 | standardAddressBook->setAutomaticSave( false ); |
97 | qDebug("************************************* "); | 97 | qDebug("************************************* "); |
98 | qDebug("***************kdeABdump************* "); | 98 | qDebug("***************kdeABdump************* "); |
99 | qDebug("************************************* "); | 99 | qDebug("************************************* "); |
100 | if ( !read ) { | 100 | if ( !read ) { |
101 | KABC::AddressBook::Iterator it; | 101 | KABC::AddressBook::Iterator it; |
102 | KABC::VCardConverter converter; | 102 | KABC::VCardConverter converter; |
103 | QString datastream; | 103 | QString datastream; |
104 | for( it = standardAddressBook->begin(); it != standardAddressBook->end(); ++it ) { | 104 | for( it = standardAddressBook->begin(); it != standardAddressBook->end(); ++it ) { |
105 | if ( (*it).isEmpty() || ! (*it).resource() ) | 105 | if ( (*it).isEmpty() || ! (*it).resource() ) |
106 | continue; | 106 | continue; |
107 | if ( (*it).resource()->readOnly() ) | ||
108 | continue; | ||
109 | KABC::Addressee a = ( *it ); | 107 | KABC::Addressee a = ( *it ); |
110 | QString vcard = converter.createVCard( a ); | 108 | QString vcard = converter.createVCard( a ); |
111 | vcard += QString("\r\n"); | 109 | vcard += QString("\r\n"); |
112 | datastream += vcard; | 110 | datastream += vcard; |
113 | } | 111 | } |
114 | QFile outFile(fileName); | 112 | QFile outFile(fileName); |
115 | if ( outFile.open(IO_WriteOnly) ) { | 113 | if ( outFile.open(IO_WriteOnly) ) { |
116 | QTextStream t( &outFile ); // use a text stream | 114 | QTextStream t( &outFile ); // use a text stream |
117 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 115 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
118 | t <<datastream; | 116 | t <<datastream; |
119 | t << "\r\n\r\n"; | 117 | t << "\r\n\r\n"; |
120 | outFile.close(); | 118 | outFile.close(); |
121 | } | 119 | } |
122 | } else { | 120 | } else { |
123 | //Addressee::List aList;//parseVCards( const QString& vcard ); | 121 | //Addressee::List aList;//parseVCards( const QString& vcard ); |
124 | KABC::Addressee::List list; | 122 | KABC::Addressee::List list; |
125 | int added = 0, changedC = 0, deleted = 0; | 123 | int added = 0, changedC = 0, deleted = 0; |
126 | QFile file( fileName ); | 124 | QFile file( fileName ); |
127 | if ( file.open( IO_ReadOnly ) ) { | 125 | if ( file.open( IO_ReadOnly ) ) { |
128 | QTextStream t( &file ); // use a text stream | 126 | QTextStream t( &file ); // use a text stream |
129 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 127 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
130 | QString data; | 128 | QString data; |
131 | data = t.read(); | 129 | data = t.read(); |
132 | file.close(); | 130 | file.close(); |
133 | KABC::VCardConverter converter; | 131 | KABC::VCardConverter converter; |
134 | list = converter.parseVCards( data ); | 132 | list = converter.parseVCards( data ); |
135 | qDebug("kdeABdump::file has %d entries", list.count()); | 133 | qDebug("kdeABdump::file has %d entries", list.count()); |
136 | 134 | ||
137 | KABC::Addressee::List::Iterator it; | 135 | KABC::Addressee::List::Iterator it; |
138 | for ( it = list.begin();it != list.end();++it) { | 136 | for ( it = list.begin();it != list.end();++it) { |
139 | (*it).setChanged( true ); | 137 | (*it).setChanged( true ); |
140 | bool changed = ((*it).custom( "KADDRESSBOOK", "X-ExternalID" ) == "changed"); | 138 | bool changed = ((*it).custom( "KADDRESSBOOK", "X-ExternalID" ) == "changed"); |
141 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); | 139 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); |
142 | //qDebug("ext %s ", (*it).custom( "KADDRESSBOOK", "X-ExternalID" ).latin1()); | 140 | //qDebug("ext %s ", (*it).custom( "KADDRESSBOOK", "X-ExternalID" ).latin1()); |
143 | if ( changed ) { | 141 | if ( changed ) { |
144 | //qDebug("changed Addressee found! "); | 142 | //qDebug("changed Addressee found! "); |
145 | KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() ); | 143 | KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() ); |
146 | if ( ! std.isEmpty() ) | 144 | if ( ! std.isEmpty() ) |
147 | (*it).setResource(std.resource()); | 145 | (*it).setResource(std.resource()); |
148 | standardAddressBook->insertAddressee( (*it) ); | 146 | standardAddressBook->insertAddressee( (*it) ); |
149 | ++changedC; | 147 | ++changedC; |
150 | } else { | 148 | } else { |
151 | //maybe added? | 149 | //maybe added? |
152 | KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() ); | 150 | KABC::Addressee std = standardAddressBook->findByUid( (*it).uid() ); |
153 | if ( std.isEmpty() ) { | 151 | if ( std.isEmpty() ) { |
154 | standardAddressBook->insertAddressee( (*it) ); | 152 | standardAddressBook->insertAddressee( (*it) ); |
155 | ++added; | 153 | ++added; |
156 | } | 154 | } |
157 | } | 155 | } |
158 | } | 156 | } |
159 | KABC::AddressBook::Iterator itA = standardAddressBook->begin(); | 157 | KABC::AddressBook::Iterator itA = standardAddressBook->begin(); |
160 | KABC::AddressBook::Iterator it2 ; | 158 | KABC::AddressBook::Iterator it2 ; |
161 | while ( itA != standardAddressBook->end() ) { | 159 | while ( itA != standardAddressBook->end() ) { |
162 | bool found = false; | 160 | bool found = false; |
163 | KABC::Addressee::List::Iterator itL; | 161 | KABC::Addressee::List::Iterator itL; |
164 | for ( itL = list.begin();itL != list.end();++itL) { | 162 | for ( itL = list.begin();itL != list.end();++itL) { |
165 | if ( (*itL).uid() == (*itA).uid() ) { | 163 | if ( (*itL).uid() == (*itA).uid() ) { |
166 | found = true; | 164 | found = true; |
167 | break; | 165 | break; |
168 | } | 166 | } |
169 | } | 167 | } |
170 | if ( !found ) { | 168 | if ( !found ) { |
171 | it2 = itA; | 169 | it2 = itA; |
172 | ++itA; | 170 | ++itA; |
173 | standardAddressBook->removeAddressee( it2 ); | 171 | standardAddressBook->removeAddressee( it2 ); |
174 | ++deleted; | 172 | ++deleted; |
175 | } else { | 173 | } else { |
176 | ++itA; | 174 | ++itA; |
177 | } | 175 | } |
178 | } | 176 | } |
179 | 177 | ||
180 | //standardAddressBook->saveAll(); | 178 | //standardAddressBook->saveAll(); |
181 | standardAddressBook->setAutomaticSave( true ); | 179 | standardAddressBook->setAutomaticSave( true ); |
182 | qDebug("************************************* "); | 180 | qDebug("************************************* "); |
183 | qDebug("*************kdeABdump*************** "); | 181 | qDebug("*************kdeABdump*************** "); |
184 | qDebug("************************************* "); | 182 | qDebug("************************************* "); |
185 | qDebug("Addressbook entries\nchanged %d\ndeleted %d\nadded %d\nfrom file %s", changedC,deleted, added, fileName.latin1()); | 183 | qDebug("Addressbook entries\nchanged %d\ndeleted %d\nadded %d\nfrom file %s", changedC,deleted, added, fileName.latin1()); |
186 | } else | 184 | } else |
187 | qDebug("error open file "); | 185 | qDebug("error open file "); |
188 | } | 186 | } |
189 | 187 | ||
190 | delete standardAddressBook; | 188 | delete standardAddressBook; |
191 | //KABC::StdAddressBook::close(); | 189 | //KABC::StdAddressBook::close(); |
192 | //StdAddressBook::mSelf = 0; | 190 | //StdAddressBook::mSelf = 0; |
193 | qDebug("ente "); | 191 | qDebug("ente "); |
194 | return 0; | 192 | return 0; |
195 | } | 193 | } |
diff --git a/kde2file/caldump/main.cpp b/kde2file/caldump/main.cpp index be1735b..08ccafb 100644 --- a/kde2file/caldump/main.cpp +++ b/kde2file/caldump/main.cpp | |||
@@ -36,193 +36,193 @@ | |||
36 | # else | 36 | # else |
37 | # include <time.h> | 37 | # include <time.h> |
38 | # endif | 38 | # endif |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #include <kcmdlineargs.h> | 41 | #include <kcmdlineargs.h> |
42 | #include <kaboutdata.h> | 42 | #include <kaboutdata.h> |
43 | #include <klocale.h> | 43 | #include <klocale.h> |
44 | #include <kglobal.h> | 44 | #include <kglobal.h> |
45 | #include <kconfig.h> | 45 | #include <kconfig.h> |
46 | #include <kstandarddirs.h> | 46 | #include <kstandarddirs.h> |
47 | #include <kdebug.h> | 47 | #include <kdebug.h> |
48 | 48 | ||
49 | #include <libkcal/calformat.h> | 49 | #include <libkcal/calformat.h> |
50 | #include <libkcal/calendarresources.h> | 50 | #include <libkcal/calendarresources.h> |
51 | #include <libkcal/resourcelocal.h> | 51 | #include <libkcal/resourcelocal.h> |
52 | #include <libkcal/filestorage.h> | 52 | #include <libkcal/filestorage.h> |
53 | #include <libkcal/icalformat.h> | 53 | #include <libkcal/icalformat.h> |
54 | 54 | ||
55 | #include <qdatetime.h> | 55 | #include <qdatetime.h> |
56 | #include <qfile.h> | 56 | #include <qfile.h> |
57 | #include <qdir.h> | 57 | #include <qdir.h> |
58 | #include <qapplication.h> | 58 | #include <qapplication.h> |
59 | 59 | ||
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <iostream> | 61 | #include <iostream> |
62 | 62 | ||
63 | using namespace KCal; | 63 | using namespace KCal; |
64 | using namespace std; | 64 | using namespace std; |
65 | 65 | ||
66 | static const char progName[] = "kdecalendar"; | 66 | static const char progName[] = "kdecalendar"; |
67 | static const char progDisplay[] = "KDE_Calendar"; | 67 | static const char progDisplay[] = "KDE_Calendar"; |
68 | static const char progVersion[] = "33.1/3"; | 68 | static const char progVersion[] = "33.1/3"; |
69 | static const char progDesc[] = "A command line interface to KDE calendars"; | 69 | static const char progDesc[] = "A command line interface to KDE calendars"; |
70 | 70 | ||
71 | 71 | ||
72 | static KCmdLineOptions options[] = | 72 | static KCmdLineOptions options[] = |
73 | { | 73 | { |
74 | { "dump", | 74 | { "dump", |
75 | I18N_NOOP( "Dumps calendar" ), 0 }, | 75 | I18N_NOOP( "Dumps calendar" ), 0 }, |
76 | { "read", | 76 | { "read", |
77 | I18N_NOOP( "Reads calendar" ), 0 }, | 77 | I18N_NOOP( "Reads calendar" ), 0 }, |
78 | KCmdLineLastOption | 78 | KCmdLineLastOption |
79 | }; | 79 | }; |
80 | 80 | ||
81 | int main( int argc, char *argv[] ) | 81 | int main( int argc, char *argv[] ) |
82 | { | 82 | { |
83 | KAboutData aboutData( | 83 | KAboutData aboutData( |
84 | progName, // internal program name | 84 | progName, // internal program name |
85 | I18N_NOOP( progDisplay ), // displayable program name. | 85 | I18N_NOOP( progDisplay ), // displayable program name. |
86 | progVersion, // version string | 86 | progVersion, // version string |
87 | I18N_NOOP( progDesc ), // short porgram description | 87 | I18N_NOOP( progDesc ), // short porgram description |
88 | KAboutData::License_GPL, // license type | 88 | KAboutData::License_GPL, // license type |
89 | "(c) 2004, Lutz Rogowski", // copyright statement | 89 | "(c) 2004, Lutz Rogowski", // copyright statement |
90 | 0, // any free form text | 90 | 0, // any free form text |
91 | "", // program home page address | 91 | "", // program home page address |
92 | "bugs.kde.org" // bug report email address | 92 | "bugs.kde.org" // bug report email address |
93 | ); | 93 | ); |
94 | 94 | ||
95 | 95 | ||
96 | // KCmdLineArgs::init() final 'true' argument indicates no commandline options | 96 | // KCmdLineArgs::init() final 'true' argument indicates no commandline options |
97 | // for QApplication/KApplication (no KDE or Qt options) | 97 | // for QApplication/KApplication (no KDE or Qt options) |
98 | KCmdLineArgs::init( argc, argv, &aboutData, true ); | 98 | KCmdLineArgs::init( argc, argv, &aboutData, true ); |
99 | KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. | 99 | KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. |
100 | 100 | ||
101 | KInstance ins ( progName ); | 101 | KInstance ins ( progName ); |
102 | 102 | ||
103 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 103 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
104 | 104 | ||
105 | bool read = false; | 105 | bool read = false; |
106 | if ( args->isSet( "read" ) ) { | 106 | if ( args->isSet( "read" ) ) { |
107 | read = true; | 107 | read = true; |
108 | qDebug("read "); | 108 | qDebug("read "); |
109 | } | 109 | } |
110 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; | 110 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; |
111 | CalendarResources *calendarResource = 0; | 111 | CalendarResources *calendarResource = 0; |
112 | CalendarLocal *localCalendar = 0; | 112 | CalendarLocal *localCalendar = 0; |
113 | KConfig c( locate( "config", "korganizerrc" ) ); | 113 | KConfig c( locate( "config", "korganizerrc" ) ); |
114 | c.setGroup( "Time & Date" ); | 114 | c.setGroup( "Time & Date" ); |
115 | QString tz = c.readEntry( "TimeZoneId" ); | 115 | QString tz = c.readEntry( "TimeZoneId" ); |
116 | calendarResource = new CalendarResources( tz ); | 116 | calendarResource = new CalendarResources( tz ); |
117 | calendarResource->readConfig(); | 117 | calendarResource->readConfig(); |
118 | calendarResource->load(); | 118 | calendarResource->load(); |
119 | qDebug("************************************* "); | 119 | qDebug("************************************* "); |
120 | qDebug("**************kdecaldump************* "); | 120 | qDebug("**************kdecaldump************* "); |
121 | qDebug("************************************* "); | 121 | qDebug("************************************* "); |
122 | qDebug("Using timezone ID: %s", calendarResource->timeZoneId().latin1()); | 122 | qDebug("Using timezone ID: %s", calendarResource->timeZoneId().latin1()); |
123 | 123 | ||
124 | if ( !read ) { | 124 | if ( !read ) { |
125 | localCalendar = new CalendarLocal(); | 125 | localCalendar = new CalendarLocal(); |
126 | localCalendar->setTimeZoneId( calendarResource->timeZoneId()); | 126 | localCalendar->setTimeZoneId( calendarResource->timeZoneId()); |
127 | KCal::Incidence::List allInc = calendarResource->rawIncidences(); | 127 | KCal::Incidence::List allInc = calendarResource->rawIncidences(); |
128 | Incidence::List::ConstIterator it; | 128 | Incidence::List::ConstIterator it; |
129 | int num = 0; | 129 | int num = 0; |
130 | for( it = allInc.begin(); it != allInc.end(); ++it ) { | 130 | for( it = allInc.begin(); it != allInc.end(); ++it ) { |
131 | ResourceCalendar * re = calendarResource->resource( (*it) ); | 131 | ResourceCalendar * re = calendarResource->resource( (*it) ); |
132 | if ( re && !re->readOnly() ) { | 132 | if ( re && /*!re->readOnly() now readonly syncing possible */) { |
133 | ++num; | 133 | ++num; |
134 | Incidence* cl = (*it)->clone(); | 134 | Incidence* cl = (*it)->clone(); |
135 | cl->setLastModified( (*it)->lastModified() ); | 135 | cl->setLastModified( (*it)->lastModified() ); |
136 | if ( cl->type() == "Journal" ) | 136 | if ( cl->type() == "Journal" ) |
137 | localCalendar->addJournal( (Journal *) cl ); | 137 | localCalendar->addJournal( (Journal *) cl ); |
138 | else if ( cl->type() == "Todo" ) | 138 | else if ( cl->type() == "Todo" ) |
139 | localCalendar->addTodo( (Todo *) cl ); | 139 | localCalendar->addTodo( (Todo *) cl ); |
140 | else if ( cl->type() == "Event" ) | 140 | else if ( cl->type() == "Event" ) |
141 | localCalendar->addEvent( (Event *) cl ); | 141 | localCalendar->addEvent( (Event *) cl ); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | FileStorage* storage = new FileStorage( calendarResource ); | 145 | FileStorage* storage = new FileStorage( calendarResource ); |
146 | storage->setFileName( fileName ); | 146 | storage->setFileName( fileName ); |
147 | storage->setSaveFormat( new ICalFormat() ); | 147 | storage->setSaveFormat( new ICalFormat() ); |
148 | storage->save(); | 148 | storage->save(); |
149 | delete storage; | 149 | delete storage; |
150 | qDebug("************************************* "); | 150 | qDebug("************************************* "); |
151 | qDebug("************kdecaldump*************** "); | 151 | qDebug("************kdecaldump*************** "); |
152 | qDebug("************************************* "); | 152 | qDebug("************************************* "); |
153 | qDebug("%d calendar entries dumped to file %s", num, fileName.latin1()); | 153 | qDebug("%d calendar entries dumped to file %s", num, fileName.latin1()); |
154 | 154 | ||
155 | } else { | 155 | } else { |
156 | qDebug("************load"); | 156 | qDebug("************load"); |
157 | localCalendar = new CalendarLocal(); | 157 | localCalendar = new CalendarLocal(); |
158 | localCalendar->setTimeZoneId( calendarResource->timeZoneId()); | 158 | localCalendar->setTimeZoneId( calendarResource->timeZoneId()); |
159 | FileStorage* storage = new FileStorage( localCalendar ); | 159 | FileStorage* storage = new FileStorage( localCalendar ); |
160 | storage->setFileName( fileName ); | 160 | storage->setFileName( fileName ); |
161 | int num = 0; | 161 | int num = 0; |
162 | int del = 0; | 162 | int del = 0; |
163 | int add = 0; | 163 | int add = 0; |
164 | if ( storage->load() ) { | 164 | if ( storage->load() ) { |
165 | qDebug("***********loaded!"); | 165 | qDebug("***********loaded!"); |
166 | KCal::Incidence::List newInc = localCalendar->rawIncidences(); | 166 | KCal::Incidence::List newInc = localCalendar->rawIncidences(); |
167 | Incidence::List::ConstIterator it; | 167 | Incidence::List::ConstIterator it; |
168 | for( it = newInc.begin(); it != newInc.end(); ++it ) { | 168 | for( it = newInc.begin(); it != newInc.end(); ++it ) { |
169 | if ( (*it)->pilotId() > 1 ) { //changed | 169 | if ( (*it)->pilotId() > 1 ) { //changed |
170 | qDebug("*********pilot id %d %s ",(*it)->pilotId() ,(*it)->summary().latin1()); | 170 | qDebug("*********pilot id %d %s ",(*it)->pilotId() ,(*it)->summary().latin1()); |
171 | Incidence *incOld = calendarResource->incidence( (*it)->uid() ); | 171 | Incidence *incOld = calendarResource->incidence( (*it)->uid() ); |
172 | ResourceCalendar * res = 0; | 172 | ResourceCalendar * res = 0; |
173 | if ( incOld ) | 173 | if ( incOld ) |
174 | res = calendarResource->resource( incOld ); | 174 | res = calendarResource->resource( incOld ); |
175 | if ( res ) { | 175 | if ( res ) { |
176 | Incidence* cl = (*it)->clone(); | 176 | Incidence* cl = (*it)->clone(); |
177 | cl->setPilotId( incOld->pilotId() ); | 177 | cl->setPilotId( incOld->pilotId() ); |
178 | ++num; | 178 | ++num; |
179 | if ( incOld->type() == "Journal" ) | 179 | if ( incOld->type() == "Journal" ) |
180 | calendarResource->deleteJournal( (Journal *) incOld ); | 180 | calendarResource->deleteJournal( (Journal *) incOld ); |
181 | else if ( incOld->type() == "Todo" ) | 181 | else if ( incOld->type() == "Todo" ) |
182 | calendarResource->deleteTodo( (Todo *) incOld ); | 182 | calendarResource->deleteTodo( (Todo *) incOld ); |
183 | else if ( incOld->type() == "Event" ) | 183 | else if ( incOld->type() == "Event" ) |
184 | calendarResource->deleteEvent( (Event *) incOld ); | 184 | calendarResource->deleteEvent( (Event *) incOld ); |
185 | qDebug("*********change incidence %s ",cl->summary().latin1()); | 185 | qDebug("*********change incidence %s ",cl->summary().latin1()); |
186 | if ( cl->type() == "Journal" ) | 186 | if ( cl->type() == "Journal" ) |
187 | calendarResource->addJournal( (Journal *) cl, res ); | 187 | calendarResource->addJournal( (Journal *) cl, res ); |
188 | else if ( cl->type() == "Todo" ) | 188 | else if ( cl->type() == "Todo" ) |
189 | calendarResource->addTodo( (Todo *) cl, res ); | 189 | calendarResource->addTodo( (Todo *) cl, res ); |
190 | else if ( cl->type() == "Event" ) | 190 | else if ( cl->type() == "Event" ) |
191 | calendarResource->addEvent( (Event *) cl, res ); | 191 | calendarResource->addEvent( (Event *) cl, res ); |
192 | 192 | ||
193 | } else { | 193 | } else { |
194 | Incidence* cl = (*it)->clone(); | 194 | Incidence* cl = (*it)->clone(); |
195 | qDebug("*********add incidence %s ",cl->summary().latin1()); | 195 | qDebug("*********add incidence %s ",cl->summary().latin1()); |
196 | calendarResource->addIncidence( cl ); | 196 | calendarResource->addIncidence( cl ); |
197 | ++add; | 197 | ++add; |
198 | } | 198 | } |
199 | } else { // maybe added | 199 | } else { // maybe added |
200 | Incidence *incOld = calendarResource->incidence( (*it)->uid() ); | 200 | Incidence *incOld = calendarResource->incidence( (*it)->uid() ); |
201 | if ( !incOld ) { //added | 201 | if ( !incOld ) { //added |
202 | Incidence* cl = (*it)->clone(); | 202 | Incidence* cl = (*it)->clone(); |
203 | qDebug("*********add incidence %s ",cl->summary().latin1()); | 203 | qDebug("*********add incidence %s ",cl->summary().latin1()); |
204 | calendarResource->addIncidence( cl ); | 204 | calendarResource->addIncidence( cl ); |
205 | ++add; | 205 | ++add; |
206 | } | 206 | } |
207 | } | 207 | } |
208 | } | 208 | } |
209 | KCal::Incidence::List allInc = calendarResource->rawIncidences(); | 209 | KCal::Incidence::List allInc = calendarResource->rawIncidences(); |
210 | 210 | ||
211 | for( it = allInc.begin(); it != allInc.end(); ++it ) { | 211 | for( it = allInc.begin(); it != allInc.end(); ++it ) { |
212 | ResourceCalendar * re = calendarResource->resource( (*it) ); | 212 | ResourceCalendar * re = calendarResource->resource( (*it) ); |
213 | if ( re && !re->readOnly() ) { | 213 | if ( re && !re->readOnly() ) { |
214 | Incidence* cl = localCalendar->incidence( (*it)->uid() ); | 214 | Incidence* cl = localCalendar->incidence( (*it)->uid() ); |
215 | if ( !cl ) { | 215 | if ( !cl ) { |
216 | ++del; | 216 | ++del; |
217 | cl = (*it); | 217 | cl = (*it); |
218 | if ( cl->type() == "Journal" ) | 218 | if ( cl->type() == "Journal" ) |
219 | calendarResource->deleteJournal( (Journal *) cl ); | 219 | calendarResource->deleteJournal( (Journal *) cl ); |
220 | else if ( cl->type() == "Todo" ) | 220 | else if ( cl->type() == "Todo" ) |
221 | calendarResource->deleteTodo( (Todo *) cl ); | 221 | calendarResource->deleteTodo( (Todo *) cl ); |
222 | else if ( cl->type() == "Event" ) | 222 | else if ( cl->type() == "Event" ) |
223 | calendarResource->deleteEvent( (Event *) cl ); | 223 | calendarResource->deleteEvent( (Event *) cl ); |
224 | //QDateTime lm = cl->lastModified(); | 224 | //QDateTime lm = cl->lastModified(); |
225 | //cl->setResources( (*it)->resources() ); | 225 | //cl->setResources( (*it)->resources() ); |
226 | //cl->setLastModified(lm); | 226 | //cl->setLastModified(lm); |
227 | } | 227 | } |
228 | } | 228 | } |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 3d4acb7..f8bfc8b 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1,209 +1,211 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1999 Preston Brown | 3 | Copyright (c) 1999 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qprogressbar.h> | 29 | #include <qprogressbar.h> |
30 | #include <qfileinfo.h> | 30 | #include <qfileinfo.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qregexp.h> | 35 | #include <qregexp.h> |
36 | 36 | ||
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <kiconloader.h> | 39 | #include <kiconloader.h> |
40 | #include <kglobal.h> | 40 | #include <kglobal.h> |
41 | 41 | ||
42 | #include <libkdepim/kpimglobalprefs.h> | 42 | #include <libkdepim/kpimglobalprefs.h> |
43 | #include <libkcal/calendar.h> | 43 | #include <libkcal/calendar.h> |
44 | #include <libkcal/calendarlocal.h> | 44 | #include <libkcal/calendarlocal.h> |
45 | #include <libkcal/icalformat.h> | 45 | #include <libkcal/icalformat.h> |
46 | #include <libkcal/vcalformat.h> | 46 | #include <libkcal/vcalformat.h> |
47 | #include <libkcal/recurrence.h> | 47 | #include <libkcal/recurrence.h> |
48 | #include <libkcal/filestorage.h> | 48 | #include <libkcal/filestorage.h> |
49 | #include <libkdepim/categoryselectdialog.h> | 49 | #include <libkdepim/categoryselectdialog.h> |
50 | #ifndef DESKTOP_VERSION | 50 | #ifndef DESKTOP_VERSION |
51 | #include <qpe/qpeapplication.h> | 51 | #include <qpe/qpeapplication.h> |
52 | #else | 52 | #else |
53 | #include <qapplication.h> | 53 | #include <qapplication.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | #ifndef KORG_NOPRINTER | 56 | #ifndef KORG_NOPRINTER |
57 | #include "calprinter.h" | 57 | #include "calprinter.h" |
58 | #endif | 58 | #endif |
59 | #include "koglobals.h" | 59 | #include "koglobals.h" |
60 | #include "koprefs.h" | 60 | #include "koprefs.h" |
61 | #include "kfiledialog.h" | 61 | #include "kfiledialog.h" |
62 | 62 | ||
63 | #include "kolistview.h" | 63 | #include "kolistview.h" |
64 | 64 | ||
65 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 65 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
66 | { | 66 | { |
67 | mItem = item; | 67 | mItem = item; |
68 | mDate = date; | 68 | mDate = date; |
69 | } | 69 | } |
70 | 70 | ||
71 | ListItemVisitor::~ListItemVisitor() | 71 | ListItemVisitor::~ListItemVisitor() |
72 | { | 72 | { |
73 | } | 73 | } |
74 | 74 | ||
75 | bool ListItemVisitor::visit(Event *e) | 75 | bool ListItemVisitor::visit(Event *e) |
76 | { | 76 | { |
77 | 77 | ||
78 | bool ok = false; | 78 | bool ok = false; |
79 | QString start, end; | 79 | QString start, end; |
80 | QDate ds, de; | ||
80 | if ( e->doesRecur() ) { | 81 | if ( e->doesRecur() ) { |
81 | QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 82 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
82 | if ( ok ) { | 83 | if ( ok ) { |
83 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 84 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
84 | start = KGlobal::locale()->formatDate(d,true); | 85 | start = KGlobal::locale()->formatDate(ds,true); |
85 | end = KGlobal::locale()->formatDate(d.addDays( days),true); | 86 | de = ds.addDays( days); |
87 | end = KGlobal::locale()->formatDate(de,true); | ||
86 | } | 88 | } |
87 | 89 | ||
88 | } | 90 | } |
89 | if ( ! ok ) { | 91 | if ( ! ok ) { |
90 | start =e->dtStartDateStr(); | 92 | start =e->dtStartDateStr(); |
91 | end = e->dtEndDateStr(); | 93 | end = e->dtEndDateStr(); |
94 | ds = e->dtStart().date(); | ||
95 | de = e->dtEnd().date(); | ||
92 | } | 96 | } |
93 | mItem->setText(0,e->summary()); | 97 | mItem->setText(0,e->summary()); |
94 | mItem->setText(1,start); | 98 | mItem->setText(1,start); |
95 | mItem->setText(2,e->dtStartTimeStr()); | 99 | mItem->setText(2,e->dtStartTimeStr()); |
96 | mItem->setText(3,end); | 100 | mItem->setText(3,end); |
97 | mItem->setText(4,e->dtEndTimeStr()); | 101 | mItem->setText(4,e->dtEndTimeStr()); |
98 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 102 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); |
99 | mItem->setText(6, e->recurrence()->recurrenceText()); | 103 | mItem->setText(6, e->recurrence()->recurrenceText()); |
100 | mItem->setText(7,"---"); | 104 | mItem->setText(7,"---"); |
101 | mItem->setText(8,"---"); | 105 | mItem->setText(8,"---"); |
102 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 106 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
103 | mItem->setText(10,e->categoriesStr()); | 107 | mItem->setText(10,e->categoriesStr()); |
104 | 108 | ||
105 | QString key; | 109 | QString key; |
106 | QDate d = e->dtStart().date(); | ||
107 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 110 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
108 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); | 111 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
109 | mItem->setSortKey(1,key); | 112 | mItem->setSortKey(1,key); |
110 | 113 | ||
111 | d = e->dtEnd().date(); | ||
112 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 114 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
113 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); | 115 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
114 | mItem->setSortKey(3,key); | 116 | mItem->setSortKey(3,key); |
115 | 117 | ||
116 | return true; | 118 | return true; |
117 | } | 119 | } |
118 | 120 | ||
119 | bool ListItemVisitor::visit(Todo *t) | 121 | bool ListItemVisitor::visit(Todo *t) |
120 | { | 122 | { |
121 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); | 123 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); |
122 | if (t->hasStartDate()) { | 124 | if (t->hasStartDate()) { |
123 | mItem->setText(1,t->dtStartDateStr()); | 125 | mItem->setText(1,t->dtStartDateStr()); |
124 | if (t->doesFloat()) { | 126 | if (t->doesFloat()) { |
125 | mItem->setText(2,"---"); | 127 | mItem->setText(2,"---"); |
126 | } else { | 128 | } else { |
127 | mItem->setText(2,t->dtStartTimeStr()); | 129 | mItem->setText(2,t->dtStartTimeStr()); |
128 | } | 130 | } |
129 | } else { | 131 | } else { |
130 | mItem->setText(1,"---"); | 132 | mItem->setText(1,"---"); |
131 | mItem->setText(2,"---"); | 133 | mItem->setText(2,"---"); |
132 | } | 134 | } |
133 | mItem->setText(3,"---"); | 135 | mItem->setText(3,"---"); |
134 | mItem->setText(4,"---"); | 136 | mItem->setText(4,"---"); |
135 | mItem->setText(5,"---"); | 137 | mItem->setText(5,"---"); |
136 | mItem->setText(6,"---"); | 138 | mItem->setText(6,"---"); |
137 | if (t->hasDueDate()) { | 139 | if (t->hasDueDate()) { |
138 | mItem->setText(7,t->dtDueDateStr()); | 140 | mItem->setText(7,t->dtDueDateStr()); |
139 | if (t->doesFloat()) { | 141 | if (t->doesFloat()) { |
140 | mItem->setText(8,"---"); | 142 | mItem->setText(8,"---"); |
141 | } else { | 143 | } else { |
142 | mItem->setText(8,t->dtDueTimeStr()); | 144 | mItem->setText(8,t->dtDueTimeStr()); |
143 | } | 145 | } |
144 | } else { | 146 | } else { |
145 | mItem->setText(7,"---"); | 147 | mItem->setText(7,"---"); |
146 | mItem->setText(8,"---"); | 148 | mItem->setText(8,"---"); |
147 | } | 149 | } |
148 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 150 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
149 | mItem->setText(10,t->categoriesStr()); | 151 | mItem->setText(10,t->categoriesStr()); |
150 | 152 | ||
151 | QString key; | 153 | QString key; |
152 | QDate d; | 154 | QDate d; |
153 | if (t->hasDueDate()) { | 155 | if (t->hasDueDate()) { |
154 | d = t->dtDue().date(); | 156 | d = t->dtDue().date(); |
155 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 157 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
156 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 158 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
157 | mItem->setSortKey(7,key); | 159 | mItem->setSortKey(7,key); |
158 | } | 160 | } |
159 | if ( t->hasStartDate() ) { | 161 | if ( t->hasStartDate() ) { |
160 | d = t->dtStart().date(); | 162 | d = t->dtStart().date(); |
161 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 163 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
162 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 164 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
163 | mItem->setSortKey(1,key); | 165 | mItem->setSortKey(1,key); |
164 | } | 166 | } |
165 | return true; | 167 | return true; |
166 | } | 168 | } |
167 | 169 | ||
168 | bool ListItemVisitor::visit(Journal * j) | 170 | bool ListItemVisitor::visit(Journal * j) |
169 | { | 171 | { |
170 | QString des = j->description().left(50); | 172 | QString des = j->description().left(50); |
171 | des = des.simplifyWhiteSpace (); | 173 | des = des.simplifyWhiteSpace (); |
172 | des.replace (QRegExp ("\\n"),"" ); | 174 | des.replace (QRegExp ("\\n"),"" ); |
173 | des.replace (QRegExp ("\\r"),"" ); | 175 | des.replace (QRegExp ("\\r"),"" ); |
174 | mItem->setText(0,i18n("Journal")+": "+des.left(25)); | 176 | mItem->setText(0,i18n("Journal")+": "+des.left(25)); |
175 | mItem->setText(1,j->dtStartDateStr()); | 177 | mItem->setText(1,j->dtStartDateStr()); |
176 | mItem->setText(2,"---"); | 178 | mItem->setText(2,"---"); |
177 | mItem->setText(3,"---"); | 179 | mItem->setText(3,"---"); |
178 | mItem->setText(4,"---"); | 180 | mItem->setText(4,"---"); |
179 | mItem->setText(5,"---"); | 181 | mItem->setText(5,"---"); |
180 | mItem->setText(6,"---"); | 182 | mItem->setText(6,"---"); |
181 | mItem->setText(7,j->dtStartDateStr()); | 183 | mItem->setText(7,j->dtStartDateStr()); |
182 | mItem->setText(8,"---"); | 184 | mItem->setText(8,"---"); |
183 | mItem->setText(9,"---"); | 185 | mItem->setText(9,"---"); |
184 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); | 186 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); |
185 | 187 | ||
186 | QString key; | 188 | QString key; |
187 | QDate d = j->dtStart().date(); | 189 | QDate d = j->dtStart().date(); |
188 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 190 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
189 | mItem->setSortKey(1,key); | 191 | mItem->setSortKey(1,key); |
190 | mItem->setSortKey(7,key); | 192 | mItem->setSortKey(7,key); |
191 | 193 | ||
192 | return true; | 194 | return true; |
193 | } | 195 | } |
194 | 196 | ||
195 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 197 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
196 | const char *name) | 198 | const char *name) |
197 | : KOEventView(calendar, parent, name) | 199 | : KOEventView(calendar, parent, name) |
198 | { | 200 | { |
199 | mActiveItem = 0; | 201 | mActiveItem = 0; |
200 | mListView = new KOListViewListView(this); | 202 | mListView = new KOListViewListView(this); |
201 | mListView->addColumn(i18n("Summary")); | 203 | mListView->addColumn(i18n("Summary")); |
202 | mListView->addColumn(i18n("Start Date")); | 204 | mListView->addColumn(i18n("Start Date")); |
203 | mListView->addColumn(i18n("Start Time")); | 205 | mListView->addColumn(i18n("Start Time")); |
204 | mListView->addColumn(i18n("End Date")); | 206 | mListView->addColumn(i18n("End Date")); |
205 | mListView->addColumn(i18n("End Time")); | 207 | mListView->addColumn(i18n("End Time")); |
206 | mListView->addColumn(i18n("Alarm")); // alarm set? | 208 | mListView->addColumn(i18n("Alarm")); // alarm set? |
207 | mListView->addColumn(i18n("Recurs")); // recurs? | 209 | mListView->addColumn(i18n("Recurs")); // recurs? |
208 | mListView->addColumn(i18n("Due Date")); | 210 | mListView->addColumn(i18n("Due Date")); |
209 | mListView->addColumn(i18n("Due Time")); | 211 | mListView->addColumn(i18n("Due Time")); |
@@ -1 +1 @@ | |||
version = "1.9.16"; | version = "1.9.17"; | ||