diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2013-09-03 20:02:55 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-09-03 21:02:00 +0200 |
commit | 533bad2a1503973aaf8186691422c2eda91d02d4 (patch) | |
tree | f7e52f62416048859aa9bde8425e20aac0e7c669 /tdeabc | |
parent | 8144d5434bbd1c4448a37695aed6ad3d348043d8 (diff) | |
download | tdepim-533bad2a1503973aaf8186691422c2eda91d02d4.tar.gz tdepim-533bad2a1503973aaf8186691422c2eda91d02d4.zip |
Additional k => tde renaming and fixes
Diffstat (limited to 'tdeabc')
-rw-r--r-- | tdeabc/CMakeLists.txt | 13 | ||||
-rw-r--r-- | tdeabc/Makefile.am | 5 | ||||
-rw-r--r-- | tdeabc/README | 1 | ||||
-rw-r--r-- | tdeabc/frontend/Makefile.am | 10 | ||||
-rw-r--r-- | tdeabc/frontend/main.cpp | 20 | ||||
-rw-r--r-- | tdeabc/frontend/mainWindow.ui | 1409 | ||||
-rw-r--r-- | tdeabc/frontend/mainWindow.ui.h | 658 | ||||
-rw-r--r-- | tdeabc/tdeabc2mutt/CMakeLists.txt | 29 | ||||
-rw-r--r-- | tdeabc/tdeabc2mutt/Makefile.am | 13 | ||||
-rw-r--r-- | tdeabc/tdeabc2mutt/README | 19 | ||||
-rw-r--r-- | tdeabc/tdeabc2mutt/main.cpp | 80 | ||||
-rw-r--r-- | tdeabc/tdeabc2mutt/tdeabc2mutt.cpp | 160 | ||||
-rw-r--r-- | tdeabc/tdeabc2mutt/tdeabc2mutt.h | 57 | ||||
-rw-r--r-- | tdeabc/tdeabcdistlistupdater/CMakeLists.txt | 42 | ||||
-rw-r--r-- | tdeabc/tdeabcdistlistupdater/Makefile.am | 12 | ||||
-rw-r--r-- | tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.cpp | 95 | ||||
-rw-r--r-- | tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.desktop | 10 |
17 files changed, 2633 insertions, 0 deletions
diff --git a/tdeabc/CMakeLists.txt b/tdeabc/CMakeLists.txt new file mode 100644 index 000000000..a59541918 --- /dev/null +++ b/tdeabc/CMakeLists.txt @@ -0,0 +1,13 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( tdeabc2mutt ) +tde_conditional_add_subdirectory( WITH_NEWDISTRLISTS tdeabcdistlistupdater ) diff --git a/tdeabc/Makefile.am b/tdeabc/Makefile.am new file mode 100644 index 000000000..9d721845e --- /dev/null +++ b/tdeabc/Makefile.am @@ -0,0 +1,5 @@ +if compile_newdistrlists +KABCDISTLISTUPDATER=tdeabcdistlistupdater +endif + +SUBDIRS = tdeabc2mutt $(KABCDISTLISTUPDATER) diff --git a/tdeabc/README b/tdeabc/README new file mode 100644 index 000000000..5fac637a6 --- /dev/null +++ b/tdeabc/README @@ -0,0 +1 @@ +This directory contains test code for tdeabc. diff --git a/tdeabc/frontend/Makefile.am b/tdeabc/frontend/Makefile.am new file mode 100644 index 000000000..3b97d9100 --- /dev/null +++ b/tdeabc/frontend/Makefile.am @@ -0,0 +1,10 @@ +INCLUDES = -I$(includedir)/tdeabc $(all_includes) + +METASOURCES = AUTO + +bin_PROGRAMS = tdeabcfrontend + +tdeabcfrontend_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor +tdeabcfrontend_LDADD = -ltdeabc $(LIB_TDECORE) +tdeabcfrontend_SOURCES = main.cpp mainWindow.ui + diff --git a/tdeabc/frontend/main.cpp b/tdeabc/frontend/main.cpp new file mode 100644 index 000000000..0e941e017 --- /dev/null +++ b/tdeabc/frontend/main.cpp @@ -0,0 +1,20 @@ +#include <tdeaboutdata.h> +#include <tdeapplication.h> +#include <kdebug.h> +#include <tdelocale.h> +#include <tdecmdlineargs.h> + +#include "mainWindow.h" + +int main( int argc, char ** argv ) +{ + TDEAboutData aboutData("testkabc",I18N_NOOP("TestKabc"),"0.1"); + TDECmdLineArgs::init(argc,argv,&aboutData); + + TDEApplication app; + + MainWindow *w = new MainWindow; + w->show(); + app.connect( &app, TQT_SIGNAL( lastWindowClosed() ), &app, TQT_SLOT( quit() ) ); + return app.exec(); +} diff --git a/tdeabc/frontend/mainWindow.ui b/tdeabc/frontend/mainWindow.ui new file mode 100644 index 000000000..240114a6a --- /dev/null +++ b/tdeabc/frontend/mainWindow.ui @@ -0,0 +1,1409 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>MainWindow</class> +<widget class="TQMainWindow"> + <property name="name"> + <cstring>MainWindow</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>570</width> + <height>534</height> + </rect> + </property> + <property name="caption"> + <string>KABC Frontend</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQListView" row="0" column="0"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>UID</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>mAddresseeList</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="resizeMode"> + <enum>AllColumns</enum> + </property> + </widget> + <widget class="TQTabWidget" row="0" column="1"> + <property name="name"> + <cstring>TabWidget2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="tabPosition"> + <enum>Top</enum> + </property> + <property name="tabShape"> + <enum>Rounded</enum> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&General</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLineEdit" row="0" column="1"> + <property name="name"> + <cstring>mNameEdit</cstring> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Name:</string> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>URL:</string> + </property> + </widget> + <widget class="TQLineEdit" row="1" column="1"> + <property name="name"> + <cstring>mUrlEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="5" column="1"> + <property name="name"> + <cstring>mAdditionalNameEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="7" column="1"> + <property name="name"> + <cstring>mSuffixEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="4" column="1"> + <property name="name"> + <cstring>mGivenNameEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="3" column="1"> + <property name="name"> + <cstring>mPrefixEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="6" column="1"> + <property name="name"> + <cstring>mFamilyNameEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="2" column="1"> + <property name="name"> + <cstring>mFormattedNameEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="8" column="1"> + <property name="name"> + <cstring>mNickNameEdit</cstring> + </property> + </widget> + <widget class="TQLabel" row="8" column="0"> + <property name="name"> + <cstring>TextLabel7</cstring> + </property> + <property name="text"> + <string>Nickname:</string> + </property> + </widget> + <widget class="TQLabel" row="7" column="0"> + <property name="name"> + <cstring>TextLabel5</cstring> + </property> + <property name="text"> + <string>Honorific suffixes:</string> + </property> + </widget> + <widget class="TQLabel" row="6" column="0"> + <property name="name"> + <cstring>TextLabel3_2</cstring> + </property> + <property name="text"> + <string>Family name:</string> + </property> + </widget> + <widget class="TQLabel" row="5" column="0"> + <property name="name"> + <cstring>TextLabel4</cstring> + </property> + <property name="text"> + <string>Additional names:</string> + </property> + </widget> + <widget class="TQLabel" row="4" column="0"> + <property name="name"> + <cstring>TextLabel6</cstring> + </property> + <property name="text"> + <string>Given name:</string> + </property> + </widget> + <widget class="TQLabel" row="3" column="0"> + <property name="name"> + <cstring>TextLabel1_3</cstring> + </property> + <property name="text"> + <string>Honorific prefixes:</string> + </property> + </widget> + <widget class="TQLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel8</cstring> + </property> + <property name="text"> + <string>Formatted name:</string> + </property> + </widget> + <widget class="TQLabel" row="9" column="0"> + <property name="name"> + <cstring>TextLabel15</cstring> + </property> + <property name="text"> + <string>Sort string:</string> + </property> + </widget> + <widget class="TQLineEdit" row="9" column="1"> + <property name="name"> + <cstring>mSortStringEdit</cstring> + </property> + </widget> + <widget class="TQLabel" row="11" column="0"> + <property name="name"> + <cstring>TextLabel11</cstring> + </property> + <property name="text"> + <string>Role:</string> + </property> + </widget> + <widget class="TQLabel" row="12" column="0"> + <property name="name"> + <cstring>TextLabel12</cstring> + </property> + <property name="text"> + <string>Organization:</string> + </property> + </widget> + <widget class="TQLabel" row="10" column="0"> + <property name="name"> + <cstring>TextLabel10</cstring> + </property> + <property name="text"> + <string>Title:</string> + </property> + </widget> + <widget class="TQLineEdit" row="10" column="1"> + <property name="name"> + <cstring>mTitleEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="11" column="1"> + <property name="name"> + <cstring>mRoleEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="12" column="1"> + <property name="name"> + <cstring>mOrganizationEdit</cstring> + </property> + </widget> + <spacer row="13" column="1"> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Phone && &Mail</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQGroupBox" row="1" column="0"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="title"> + <string>&Phone</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel2_3</cstring> + </property> + <property name="text"> + <string>Id:</string> + </property> + </widget> + <widget class="TQComboBox" row="0" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>mPhoneIdCombo</cstring> + </property> + </widget> + <widget class="TQPushButton" row="0" column="3"> + <property name="name"> + <cstring>PushButton3</cstring> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + <widget class="TQPushButton" row="0" column="4"> + <property name="name"> + <cstring>PushButton4</cstring> + </property> + <property name="text"> + <string>New</string> + </property> + </widget> + <widget class="TQLineEdit" row="1" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>mPhoneNumberEdit</cstring> + </property> + </widget> + <widget class="TQLabel" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel1_5</cstring> + </property> + <property name="text"> + <string>Number:</string> + </property> + </widget> + <widget class="TQButtonGroup" row="2" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>ButtonGroup2</cstring> + </property> + <property name="title"> + <string>Type</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQCheckBox" row="2" column="0"> + <property name="name"> + <cstring>mPhoneWorkCheck</cstring> + </property> + <property name="text"> + <string>Work</string> + </property> + </widget> + <widget class="TQCheckBox" row="3" column="0"> + <property name="name"> + <cstring>mPhonePrefCheck</cstring> + </property> + <property name="text"> + <string>Pref</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="0"> + <property name="name"> + <cstring>mPhoneHomeCheck</cstring> + </property> + <property name="text"> + <string>Home</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="1"> + <property name="name"> + <cstring>mPhoneCellCheck</cstring> + </property> + <property name="text"> + <string>Cell</string> + </property> + </widget> + <widget class="TQCheckBox" row="0" column="0"> + <property name="name"> + <cstring>mPhoneFaxCheck</cstring> + </property> + <property name="text"> + <string>Fax</string> + </property> + </widget> + <widget class="TQCheckBox" row="3" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>mPhoneBbsCheck</cstring> + </property> + <property name="text"> + <string>BBS</string> + </property> + </widget> + <widget class="TQCheckBox" row="0" column="1"> + <property name="name"> + <cstring>mPhoneCarCheck</cstring> + </property> + <property name="text"> + <string>Car</string> + </property> + </widget> + <widget class="TQCheckBox" row="2" column="1"> + <property name="name"> + <cstring>mPhoneVideoCheck</cstring> + </property> + <property name="text"> + <string>Video</string> + </property> + </widget> + <widget class="TQCheckBox" row="0" column="2"> + <property name="name"> + <cstring>mPhoneIsdnCheck</cstring> + </property> + <property name="text"> + <string>ISDN</string> + </property> + </widget> + <widget class="TQCheckBox" row="0" column="3"> + <property name="name"> + <cstring>mPhoneVoiceCheck</cstring> + </property> + <property name="text"> + <string>Voice</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="2"> + <property name="name"> + <cstring>mPhonePcsCheck</cstring> + </property> + <property name="text"> + <string>PCS</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="3"> + <property name="name"> + <cstring>mPhoneModemCheck</cstring> + </property> + <property name="text"> + <string>Modem</string> + </property> + </widget> + <widget class="TQCheckBox" row="2" column="2"> + <property name="name"> + <cstring>mPhonePagerCheck</cstring> + </property> + <property name="text"> + <string>Pager</string> + </property> + </widget> + <widget class="TQCheckBox" row="2" column="3"> + <property name="name"> + <cstring>mPhoneMsgCheck</cstring> + </property> + <property name="text"> + <string>Msg</string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="TQGroupBox" row="0" column="0"> + <property name="name"> + <cstring>GroupBox2</cstring> + </property> + <property name="title"> + <string>Ema&il</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQPushButton" row="0" column="1"> + <property name="name"> + <cstring>PushButton7</cstring> + </property> + <property name="text"> + <string>&New</string> + </property> + </widget> + <widget class="TQPushButton" row="1" column="1"> + <property name="name"> + <cstring>PushButton5</cstring> + </property> + <property name="text"> + <string>&Edit</string> + </property> + </widget> + <widget class="TQPushButton" row="2" column="1"> + <property name="name"> + <cstring>PushButton6</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQListView" row="0" column="0" rowspan="4" colspan="1"> + <column> + <property name="text"> + <string>Address</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>mEmailListView</cstring> + </property> + <property name="resizeMode"> + <enum>AllColumns</enum> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>A&ddress</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel16</cstring> + </property> + <property name="text"> + <string>Id:</string> + </property> + </widget> + <widget class="TQLabel" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel1_4</cstring> + </property> + <property name="text"> + <string>Post office box:</string> + </property> + </widget> + <widget class="TQLabel" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel2_2</cstring> + </property> + <property name="text"> + <string>Extended:</string> + </property> + </widget> + <widget class="TQLabel" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel3_3</cstring> + </property> + <property name="text"> + <string>Street:</string> + </property> + </widget> + <widget class="TQLabel" row="5" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel4_2</cstring> + </property> + <property name="text"> + <string>Locality:</string> + </property> + </widget> + <widget class="TQLineEdit" row="2" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>mAddressPostOfficeBoxEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="3" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>mAddressExtendedEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="4" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>mAddressStreetEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="5" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>mAddressLocalityEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="6" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>mAddressRegionEdit</cstring> + </property> + </widget> + <widget class="TQLabel" row="6" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel5_2</cstring> + </property> + <property name="text"> + <string>Region:</string> + </property> + </widget> + <widget class="TQLabel" row="8" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel7_2</cstring> + </property> + <property name="text"> + <string>Country:</string> + </property> + </widget> + <widget class="TQLabel" row="7" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel6_2</cstring> + </property> + <property name="text"> + <string>Postal code:</string> + </property> + </widget> + <widget class="TQTextEdit" row="10" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>mAddressLabelEdit</cstring> + </property> + </widget> + <widget class="TQLabel" row="9" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel13</cstring> + </property> + <property name="text"> + <string>Label:</string> + </property> + </widget> + <widget class="TQLineEdit" row="7" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>mAddressPostalCodeEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="8" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>mAddressCountryEdit</cstring> + </property> + </widget> + <widget class="TQButtonGroup" row="1" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>ButtonGroup1</cstring> + </property> + <property name="title"> + <string>Type</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQCheckBox" row="0" column="3"> + <property name="name"> + <cstring>mAddressDomCheck</cstring> + </property> + <property name="text"> + <string>Dom</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="3"> + <property name="name"> + <cstring>mAddressIntlCheck</cstring> + </property> + <property name="text"> + <string>Intl</string> + </property> + </widget> + <widget class="TQCheckBox" row="0" column="2"> + <property name="name"> + <cstring>mAddressParcelCheck</cstring> + </property> + <property name="text"> + <string>Parcel</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="2"> + <property name="name"> + <cstring>mAddressPostalCheck</cstring> + </property> + <property name="text"> + <string>Postal</string> + </property> + </widget> + <widget class="TQCheckBox" row="0" column="1"> + <property name="name"> + <cstring>mAddressHomeCheck</cstring> + </property> + <property name="text"> + <string>Home</string> + </property> + </widget> + <widget class="TQCheckBox" row="0" column="0"> + <property name="name"> + <cstring>mAddressPrefCheck</cstring> + </property> + <property name="text"> + <string>Pref</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="1"> + <property name="name"> + <cstring>mAddressWorkCheck</cstring> + </property> + <property name="text"> + <string>Work</string> + </property> + </widget> + </grid> + </widget> + <widget class="TQPushButton" row="0" column="4"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="text"> + <string>&New</string> + </property> + </widget> + <widget class="TQPushButton" row="0" column="3"> + <property name="name"> + <cstring>PushButton2</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + <widget class="TQComboBox" row="0" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>mAddressIdCombo</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Special</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQTextEdit" row="2" column="0"> + <property name="name"> + <cstring>mNoteEdit</cstring> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel14</cstring> + </property> + <property name="text"> + <string>Note:</string> + </property> + </widget> + <widget class="TQGroupBox" row="0" column="0"> + <property name="name"> + <cstring>GroupBox2_2</cstring> + </property> + <property name="title"> + <string>Categories</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQListView" row="0" column="0" rowspan="4" colspan="1"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>mCategoryListView</cstring> + </property> + <property name="resizeMode"> + <enum>AllColumns</enum> + </property> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>Spacer2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton" row="2" column="1"> + <property name="name"> + <cstring>PushButton6_2</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + <widget class="TQPushButton" row="1" column="1"> + <property name="name"> + <cstring>PushButton5_2</cstring> + </property> + <property name="text"> + <string>&Edit</string> + </property> + </widget> + <widget class="TQPushButton" row="0" column="1"> + <property name="name"> + <cstring>PushButton7_2</cstring> + </property> + <property name="text"> + <string>&New</string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Custom</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQGroupBox" row="0" column="0"> + <property name="name"> + <cstring>GroupBox2_2_2</cstring> + </property> + <property name="title"> + <string>Custom Entries</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="TQListView" row="0" column="0" rowspan="4" colspan="1"> + <column> + <property name="text"> + <string>App</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Value</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>mCustomListView</cstring> + </property> + <property name="resizeMode"> + <enum>AllColumns</enum> + </property> + </widget> + <widget class="TQPushButton" row="0" column="1"> + <property name="name"> + <cstring>PushButton7_2_2</cstring> + </property> + <property name="text"> + <string>&New</string> + </property> + </widget> + <widget class="TQPushButton" row="1" column="1"> + <property name="name"> + <cstring>PushButton5_2_2</cstring> + </property> + <property name="text"> + <string>&Edit</string> + </property> + </widget> + <widget class="TQPushButton" row="2" column="1"> + <property name="name"> + <cstring>PushButton6_2_2</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>Spacer2_2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </grid> + </widget> + </widget> + </grid> +</widget> +<menubar> + <property name="name"> + <cstring>menubar</cstring> + </property> + <item text="&File" name="PopupMenu"> + <action name="open"/> + <action name="open_std"/> + <action name="save"/> + <separator/> + <action name="dump"/> + </item> + <item text="&Addressee" name="PopupMenu_2"> + <action name="addressee_new"/> + <action name="addressee_remove"/> + </item> +</menubar> +<toolbars> + <toolbar dock="2"> + <property name="name"> + <cstring>Toolbar_3</cstring> + </property> + <property name="label"> + <string>Toolbar_3</string> + </property> + <action name="open"/> + <action name="save"/> + </toolbar> +</toolbars> +<actions> + <action> + <property name="name"> + <cstring>open</cstring> + </property> + <property name="iconSet"> + <iconset>image0</iconset> + </property> + <property name="text"> + <string>Action</string> + </property> + <property name="menuText"> + <string>&Open</string> + </property> + <property name="statusTip"> + <string>Open Address Book</string> + </property> + </action> + <action> + <property name="name"> + <cstring>save</cstring> + </property> + <property name="iconSet"> + <iconset>image1</iconset> + </property> + <property name="text"> + <string>Action</string> + </property> + <property name="menuText"> + <string>&Save</string> + </property> + <property name="statusTip"> + <string>Save Address Book</string> + </property> + </action> + <action> + <property name="name"> + <cstring>addressee_new</cstring> + </property> + <property name="text"> + <string>Action</string> + </property> + <property name="menuText"> + <string>&New</string> + </property> + <property name="statusTip"> + <string>New Addressee</string> + </property> + </action> + <action> + <property name="name"> + <cstring>addressee_remove</cstring> + </property> + <property name="text"> + <string>Action</string> + </property> + <property name="menuText"> + <string>&Remove</string> + </property> + <property name="statusTip"> + <string>Remove Addressee</string> + </property> + </action> + <action> + <property name="name"> + <cstring>dump</cstring> + </property> + <property name="text"> + <string>Dump</string> + </property> + <property name="menuText"> + <string>&Dump</string> + </property> + <property name="toolTip"> + <string>Dump Addressbook</string> + </property> + </action> + <action> + <property name="name"> + <cstring>open_std</cstring> + </property> + <property name="text"> + <string>Open Standard Addressbook</string> + </property> + <property name="menuText"> + <string>Open Standard &Addressbook</string> + </property> + </action> +</actions> +<images> + <image name="image0"> + <data format="XPM.GZ" length="706">789cad92cf0ac2300cc6ef7d8ab0dc866c6eb231101f41f12888873673e8610a3a0f22bebbfdb3d6ced583e09742f3f54792429bc6b0592f214ed9b5e3dd91800efc02717d6bdbfb76b778b028cf41ae12b268c2a2040856e7d35ee528739c6a294bca56b32a33b656960a2aa950962bdb48192aac6d1add36a87f1094d2fb2731a7a856b81b7e23e8886dee0143900b2ed0c9bb1b0aeec580f880ff548343bd6b10c9534f42c0cd19013b670cfa9a003024047a1200b6463d898b5a87fe4e4928a2e79cbd00444d9e3f</data> + </image> + <image name="image1"> + <data format="XPM.GZ" length="706">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022330543251d2e253d856405bffcbc54105b19c856360003103711c4b530b63084709340dc64d364a36453103705ca35837093c1dc9424b31430570f2b00cb2863015099c444e5242400e49026930c1446372d3919a607c8275206610fed641291fd9f8822830688925146350e9b0c6e17d0500614dd7aa830052c93a2870d2ad55a7301002caeaa93</data> + </image> +</images> +<connections> + <connection> + <sender>mAddresseeList</sender> + <signal>selectionChanged(TQListViewItem*)</signal> + <receiver>MainWindow</receiver> + <slot>updateAddressee(TQListViewItem*)</slot> + </connection> + <connection> + <sender>save</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>fileSave()</slot> + </connection> + <connection> + <sender>open</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>fileOpen()</slot> + </connection> + <connection> + <sender>addressee_remove</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>removeEntry()</slot> + </connection> + <connection> + <sender>addressee_new</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>newEntry()</slot> + </connection> + <connection> + <sender>PushButton1</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>newAddress()</slot> + </connection> + <connection> + <sender>PushButton2</sender> + <signal>pressed()</signal> + <receiver>MainWindow</receiver> + <slot>removeAddress()</slot> + </connection> + <connection> + <sender>mAddressIdCombo</sender> + <signal>activated(int)</signal> + <receiver>MainWindow</receiver> + <slot>updateAddress(int)</slot> + </connection> + <connection> + <sender>dump</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>dumpAddressBook()</slot> + </connection> + <connection> + <sender>PushButton3</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>removePhoneNumber()</slot> + </connection> + <connection> + <sender>PushButton4</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>newPhoneNumber()</slot> + </connection> + <connection> + <sender>PushButton5</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>editEmail()</slot> + </connection> + <connection> + <sender>PushButton7</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>newEmail()</slot> + </connection> + <connection> + <sender>PushButton6</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>removeEmail()</slot> + </connection> + <connection> + <sender>mPhoneIdCombo</sender> + <signal>activated(int)</signal> + <receiver>MainWindow</receiver> + <slot>updatePhone(int)</slot> + </connection> + <connection> + <sender>PushButton7_2</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>newCategory()</slot> + </connection> + <connection> + <sender>PushButton5_2</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>editCategory()</slot> + </connection> + <connection> + <sender>PushButton6_2</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>removeCategory()</slot> + </connection> + <connection> + <sender>PushButton7_2_2</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>newCustom()</slot> + </connection> + <connection> + <sender>PushButton5_2_2</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>editCustom()</slot> + </connection> + <connection> + <sender>PushButton6_2_2</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>removeCustom()</slot> + </connection> + <connection> + <sender>open_std</sender> + <signal>activated()</signal> + <receiver>MainWindow</receiver> + <slot>fileOpenStd()</slot> + </connection> +</connections> +<tabstops> + <tabstop>mAddresseeList</tabstop> + <tabstop>TabWidget2</tabstop> + <tabstop>mNameEdit</tabstop> + <tabstop>mUrlEdit</tabstop> + <tabstop>mFormattedNameEdit</tabstop> + <tabstop>mPrefixEdit</tabstop> + <tabstop>mGivenNameEdit</tabstop> + <tabstop>mAdditionalNameEdit</tabstop> + <tabstop>mFamilyNameEdit</tabstop> + <tabstop>mSuffixEdit</tabstop> + <tabstop>mNickNameEdit</tabstop> + <tabstop>mSortStringEdit</tabstop> + <tabstop>mTitleEdit</tabstop> + <tabstop>mRoleEdit</tabstop> + <tabstop>mOrganizationEdit</tabstop> + <tabstop>mEmailListView</tabstop> + <tabstop>PushButton7</tabstop> + <tabstop>PushButton5</tabstop> + <tabstop>PushButton6</tabstop> + <tabstop>mPhoneIdCombo</tabstop> + <tabstop>PushButton3</tabstop> + <tabstop>PushButton4</tabstop> + <tabstop>mPhoneNumberEdit</tabstop> + <tabstop>mPhoneFaxCheck</tabstop> + <tabstop>mPhoneCarCheck</tabstop> + <tabstop>mPhoneIsdnCheck</tabstop> + <tabstop>mPhoneVoiceCheck</tabstop> + <tabstop>mPhoneHomeCheck</tabstop> + <tabstop>mPhoneCellCheck</tabstop> + <tabstop>mPhonePcsCheck</tabstop> + <tabstop>mPhoneModemCheck</tabstop> + <tabstop>mPhoneWorkCheck</tabstop> + <tabstop>mPhoneVideoCheck</tabstop> + <tabstop>mPhonePagerCheck</tabstop> + <tabstop>mPhoneMsgCheck</tabstop> + <tabstop>mPhonePrefCheck</tabstop> + <tabstop>mPhoneBbsCheck</tabstop> + <tabstop>mAddressIdCombo</tabstop> + <tabstop>PushButton2</tabstop> + <tabstop>PushButton1</tabstop> + <tabstop>mAddressPrefCheck</tabstop> + <tabstop>mAddressHomeCheck</tabstop> + <tabstop>mAddressParcelCheck</tabstop> + <tabstop>mAddressDomCheck</tabstop> + <tabstop>mAddressWorkCheck</tabstop> + <tabstop>mAddressPostalCheck</tabstop> + <tabstop>mAddressIntlCheck</tabstop> + <tabstop>mAddressPostOfficeBoxEdit</tabstop> + <tabstop>mAddressExtendedEdit</tabstop> + <tabstop>mAddressStreetEdit</tabstop> + <tabstop>mAddressLocalityEdit</tabstop> + <tabstop>mAddressRegionEdit</tabstop> + <tabstop>mAddressPostalCodeEdit</tabstop> + <tabstop>mAddressCountryEdit</tabstop> + <tabstop>mAddressLabelEdit</tabstop> + <tabstop>mCategoryListView</tabstop> + <tabstop>PushButton7_2</tabstop> + <tabstop>PushButton5_2</tabstop> + <tabstop>PushButton6_2</tabstop> + <tabstop>mNoteEdit</tabstop> + <tabstop>mCustomListView</tabstop> + <tabstop>PushButton7_2_2</tabstop> + <tabstop>PushButton5_2_2</tabstop> + <tabstop>PushButton6_2_2</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in declaration">resourcefile.h</include> + <include location="global" impldecl="in declaration">addressbook.h</include> + <include location="local" impldecl="in implementation">mainWindow.ui.h</include> +</includes> +<forwards> + <forward>class AddresseeItem</forward> +</forwards> +<variables> + <variable>TDEABC::ResourceFile *mResourceFile</variable> + <variable>AddresseeItem *mCurrentItem</variable> + <variable>TDEABC::AddressBook *mAddressBook</variable> + <variable>TQString mCurrentAddress</variable> + <variable>TQString mCurrentPhone</variable> +</variables> +<Q_SLOTS> + <slot>init()</slot> + <slot>destroy()</slot> + <slot>fileSave()</slot> + <slot>fileOpen()</slot> + <slot>loadAddressBook( const TQString & fileName )</slot> + <slot>updateAddressee( TQListViewItem * item )</slot> + <slot>readAddressee( const TDEABC::Addressee & a )</slot> + <slot returnType="TDEABC::Addressee">writeAddressee( const TDEABC::Addressee & addressee )</slot> + <slot>newEntry()</slot> + <slot>removeEntry()</slot> + <slot>updateAddress( int id )</slot> + <slot returnType="TDEABC::Address">writeAddress( const TDEABC::Address & address )</slot> + <slot>writeAddress( const TQString & id )</slot> + <slot>readAddress( const TDEABC::Address & a )</slot> + <slot>readAddress( const TQString & id )</slot> + <slot>updatePhone( int id )</slot> + <slot returnType="TDEABC::PhoneNumber">writePhone( const TDEABC::PhoneNumber & phoneNumber )</slot> + <slot>writePhone( const TQString & id )</slot> + <slot>readPhone( const TDEABC::PhoneNumber & p )</slot> + <slot>readPhone( const TQString & id )</slot> + <slot>newAddress()</slot> + <slot>removeAddress()</slot> + <slot>dumpAddressBook()</slot> + <slot>newEmail()</slot> + <slot>editEmail()</slot> + <slot>removeEmail()</slot> + <slot>newPhoneNumber()</slot> + <slot>removePhoneNumber()</slot> + <slot>newCategory()</slot> + <slot>editCategory()</slot> + <slot>removeCategory()</slot> + <slot>editCustom()</slot> + <slot>newCustom()</slot> + <slot>removeCustom()</slot> + <slot>addressBookChanged()</slot> + <slot>addressBookLocked()</slot> + <slot>addressBookUnlocked()</slot> + <slot>fileOpenStd()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tdeabc/frontend/mainWindow.ui.h b/tdeabc/frontend/mainWindow.ui.h new file mode 100644 index 000000000..8e678b932 --- /dev/null +++ b/tdeabc/frontend/mainWindow.ui.h @@ -0,0 +1,658 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use TQt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + +#include <tqfiledialog.h> +#include <kinputdialog.h> +#include <tqmessagebox.h> + +#include <tdelocale.h> +#include <kdebug.h> + +#include <tdeabc/stdaddressbook.h> + +using namespace TDEABC; + +class AddresseeItem : public TQListViewItem +{ + public: + AddresseeItem( TQListView *parent, const Addressee &a ) : + TQListViewItem( parent, a.realName(), a.uid() ), mAddressee( a ) {} + + void setAddressee( const Addressee &a ) { mAddressee = a; } + Addressee &addressee() { return mAddressee; } + + private: + Addressee mAddressee; +}; + +void MainWindow::init() +{ + mAddressBook = TDEABC::StdAddressBook::self( true ); + + mCurrentItem = 0; + + mEmailListView->header()->hide(); + mCategoryListView->header()->hide(); + + connect( mAddressBook, TQT_SIGNAL( addressBookChanged( AddressBook * ) ), + TQT_SLOT( addressBookChanged() ) ); + connect( mAddressBook, TQT_SIGNAL( addressBookLocked( AddressBook * ) ), + TQT_SLOT( addressBookLocked() ) ); + connect( mAddressBook, TQT_SIGNAL( addressBookUnlocked( AddressBook * ) ), + TQT_SLOT( addressBookUnlocked() ) ); +} + +void MainWindow::destroy() +{ + delete mAddressBook; +} + +void MainWindow::fileSave() +{ + updateAddressee( mAddresseeList->selectedItem() ); + + StdAddressBook::save(); +} + +void MainWindow::fileOpen() +{ + TQString fileName = TQFileDialog::getOpenFileName(); + + loadAddressBook( fileName ); +} + +void MainWindow::loadAddressBook( const TQString &fileName ) +{ + kdDebug() << "loadAddressBook(): '" << fileName << "'" << endl; + + mAddresseeList->clear(); + mCurrentItem = 0; + mCurrentAddress = TQString(); + readAddressee( Addressee() ); + + TDEABC::AddressBook::Iterator it; + for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { + new AddresseeItem( mAddresseeList, (*it) ); + } +} + +void MainWindow::updateAddressee( TQListViewItem *item ) +{ + AddresseeItem *addresseeItem = dynamic_cast<AddresseeItem *>( item ); + if ( !addresseeItem ) return; + + if (mCurrentItem ) { + writeAddress( mCurrentAddress ); + writePhone( mCurrentPhone ); + Addressee a = writeAddressee( mCurrentItem->addressee() ); + mCurrentItem->setAddressee( a ); + mAddressBook->insertAddressee( a ); + } + mCurrentItem = addresseeItem; + + readAddressee( addresseeItem->addressee() ); + updateAddress( mAddressIdCombo->currentItem() ); + updatePhone( mPhoneIdCombo->currentItem() ); +} + + +void MainWindow::readAddressee( const TDEABC::Addressee &a ) +{ + kdDebug() << "MainWindow::readAddressee(): " << a.name() << endl; + + mNameEdit->setText( a.name() ); + mUrlEdit->setText( a.url().url() ); + mAdditionalNameEdit->setText( a.additionalName() ); + mSuffixEdit->setText( a.suffix() ); + mGivenNameEdit->setText( a.givenName() ); + mPrefixEdit->setText( a.prefix() ); + mFamilyNameEdit->setText( a.familyName() ); + mFormattedNameEdit->setText( a.formattedName() ); + mNickNameEdit->setText( a.nickName() ); + mSortStringEdit->setText( a.sortString() ); + mTitleEdit->setText( a.title() ); + mRoleEdit->setText( a.role() ); + mOrganizationEdit->setText( a.organization() ); + mNoteEdit->setText( a.note() ); +// mLabelEdit->setText( a.label() ); + + mEmailListView->clear(); + TQStringList emails = a.emails(); + TQStringList::ConstIterator it3; + for( it3 = emails.begin(); it3 != emails.end(); ++it3 ) { + new TQListViewItem( mEmailListView, *it3 ); + } + + mCategoryListView->clear(); + TQStringList categories = a.categories(); + TQStringList::ConstIterator it4; + for( it4 = categories.begin(); it4 != categories.end(); ++it4 ) { + new TQListViewItem( mCategoryListView, *it4 ); + } + + mCustomListView->clear(); + TQStringList customs = a.customs(); + TQStringList::ConstIterator it5; + for( it5 = customs.begin(); it5 != customs.end(); ++it5 ) { + int posDash = (*it5).find( "-" ); + int posColon = (*it5).find( ":" ); + + TQString app = (*it5).left( posDash ); + TQString cname = (*it5).mid( posDash + 1, posColon - posDash - 1 ); + TQString value = (*it5).mid( posColon + 1 ); + + new TQListViewItem( mCustomListView, app, cname, value ); + } + + Address::List addresses = a.addresses(); + mAddressIdCombo->clear(); + Address::List::ConstIterator it; + for( it = addresses.begin(); it != addresses.end(); ++it ) { + mAddressIdCombo->insertItem( (*it).id() ); + } + if ( mAddressIdCombo->count() > 0 ) mCurrentAddress = mAddressIdCombo->currentText(); + else mCurrentAddress = TQString(); + readAddress( mCurrentAddress ); + + mPhoneIdCombo->clear(); + PhoneNumber::List pl = a.phoneNumbers(); + PhoneNumber::List::ConstIterator it2; + for( it2 = pl.begin(); it2 != pl.end(); ++it2) { + mPhoneIdCombo->insertItem( (*it2).id() ); + } + if ( mPhoneIdCombo->count() > 0 ) mCurrentPhone = mPhoneIdCombo->currentText(); + readPhone( mCurrentPhone ); +} + +TDEABC::Addressee MainWindow::writeAddressee( const TDEABC::Addressee &addressee ) +{ + Addressee a( addressee ); + a.setName( mNameEdit->text() ); + if ( !mUrlEdit->text().isEmpty() ) { + a.setUrl( KURL( mUrlEdit->text() ) ); + } + + a.setAdditionalName( mAdditionalNameEdit->text() ); + a.setSuffix( mSuffixEdit->text() ); + a.setGivenName( mGivenNameEdit->text() ); + a.setPrefix( mPrefixEdit->text() ); + a.setFamilyName( mFamilyNameEdit->text() ); + a.setFormattedName( mFormattedNameEdit->text() ); + a.setNickName( mNickNameEdit->text() ); + a.setSortString( mSortStringEdit->text() ); + a.setTitle( mTitleEdit->text() ); + a.setRole( mRoleEdit->text() ); + a.setOrganization( mOrganizationEdit->text() ); + a.setNote( mNoteEdit->text() ); +// a.setLabel( mLabelEdit->text() ); + + kdDebug() << "MainWindow::writeAddressee()" << endl; + a.dump(); + + return a; +} + +void MainWindow::newEntry() +{ + bool ok = false; + TQString name = KInputDialog::getText( i18n("New Address Book Entry"), + i18n("Please enter name:"), + TQString(), &ok, + this ); + if ( !ok || name.isEmpty() ) return; + + Addressee a; + a.setName( name ); + mAddressBook->insertAddressee( a ); + + new AddresseeItem( mAddresseeList, a ); +} + +void MainWindow::removeEntry() +{ + AddresseeItem *item = dynamic_cast<AddresseeItem *>(mAddresseeList->selectedItem()); + if ( item ) { + mAddressBook->removeAddressee( item->addressee() ); + delete item; + mCurrentItem = 0; + } +} + + +void MainWindow::updateAddress( int id ) +{ + if( !mCurrentItem ) return; + + writeAddress( mCurrentAddress ); + if ( mAddressIdCombo->count() > 0 ) { + mCurrentAddress = mAddressIdCombo->text( id ); + } else { + mCurrentAddress = TQString(); + } + readAddress( mCurrentAddress ); +} + +TDEABC::Address MainWindow::writeAddress( const TDEABC::Address &address ) +{ + Address a( address ); + + a.setPostOfficeBox( mAddressPostOfficeBoxEdit->text() ); + a.setExtended( mAddressExtendedEdit->text() ); + a.setStreet( mAddressStreetEdit->text() ); + a.setLocality( mAddressLocalityEdit->text() ); + a.setRegion( mAddressRegionEdit->text() ); + a.setLabel( mAddressLabelEdit->text() ); + a.setPostalCode( mAddressPostalCodeEdit->text() ); + a.setCountry( mAddressCountryEdit->text() ); + + int type = 0; + if ( mAddressDomCheck->isChecked() ) type |= Address::Dom; + if ( mAddressIntlCheck->isChecked() ) type |= Address::Intl; + if ( mAddressParcelCheck->isChecked() ) type |= Address::Parcel; + if ( mAddressPostalCheck->isChecked() ) type |= Address::Postal; + if ( mAddressHomeCheck->isChecked() ) type |= Address::Home; + if ( mAddressPrefCheck->isChecked() ) type |= Address::Pref; + if ( mAddressWorkCheck->isChecked() ) type |= Address::Work; + a.setType( type ); + + return a; +} + +void MainWindow::writeAddress( const TQString &id ) +{ + if ( !mCurrentItem ) return; + + if ( id.isEmpty() ) return; + + Address address; + address.setId( id ); + address = writeAddress( address ); + + mCurrentItem->addressee().insertAddress( address ); +} + +void MainWindow::readAddress( const TDEABC::Address &a ) +{ + mAddressPostOfficeBoxEdit->setText( a.postOfficeBox() ); + mAddressExtendedEdit->setText( a.extended() ); + mAddressStreetEdit->setText( a.street() ); + mAddressLocalityEdit->setText( a.locality() ); + mAddressRegionEdit->setText( a.region() ); + mAddressLabelEdit->setText( a.label() ); + mAddressPostalCodeEdit->setText( a.postalCode() ); + mAddressCountryEdit->setText( a.country() ); + + int type = a.type(); + if ( type & Address::Dom ) mAddressDomCheck->setChecked( true ); + else mAddressDomCheck->setChecked( false ); + if ( type & Address::Intl ) mAddressIntlCheck->setChecked( true ); + else mAddressIntlCheck->setChecked( false ); + if ( type & Address::Parcel ) mAddressParcelCheck->setChecked( true ); + else mAddressParcelCheck->setChecked( false ); + if ( type & Address::Postal ) mAddressPostalCheck->setChecked( true ); + else mAddressPostalCheck->setChecked( false ); + if ( type & Address::Home ) mAddressHomeCheck->setChecked( true ); + else mAddressHomeCheck->setChecked( false ); + if ( type & Address::Pref ) mAddressPrefCheck->setChecked( true ); + else mAddressPrefCheck->setChecked( false ); + if ( type & Address::Work ) mAddressWorkCheck->setChecked( true ); + else mAddressWorkCheck->setChecked( false ); +} + +void MainWindow::readAddress( const TQString &id ) +{ + if ( !mCurrentItem || id.isEmpty() ) { + readAddress( Address() ); + return; + } + + Address address = mCurrentItem->addressee().findAddress( id ); + readAddress( address ); +} + +void MainWindow::updatePhone( int id ) +{ + if( !mCurrentItem ) return; + + writePhone( mCurrentPhone ); + if ( mPhoneIdCombo->count() > 0 ) { + mCurrentPhone = mPhoneIdCombo->text( id ); + } else { + mCurrentPhone = TQString(); + } + readPhone( mCurrentPhone ); +} + +TDEABC::PhoneNumber MainWindow::writePhone( const TDEABC::PhoneNumber &phoneNumber ) +{ + PhoneNumber p( phoneNumber ); + + p.setNumber( mPhoneNumberEdit->text() ); + + int type = 0; + if ( mPhoneMsgCheck->isChecked() ) type |= PhoneNumber::Msg; + if ( mPhoneVoiceCheck->isChecked() ) type |= PhoneNumber::Voice; + if ( mPhoneFaxCheck->isChecked() ) type |= PhoneNumber::Fax; + if ( mPhoneCellCheck->isChecked() ) type |= PhoneNumber::Cell; + if ( mPhoneHomeCheck->isChecked() ) type |= PhoneNumber::Home; + if ( mPhonePrefCheck->isChecked() ) type |= PhoneNumber::Pref; + if ( mPhoneWorkCheck->isChecked() ) type |= PhoneNumber::Work; + if ( mPhoneVideoCheck->isChecked() ) type |= PhoneNumber::Video; + if ( mPhoneBbsCheck->isChecked() ) type |= PhoneNumber::Bbs; + if ( mPhoneModemCheck->isChecked() ) type |= PhoneNumber::Modem; + if ( mPhoneCarCheck->isChecked() ) type |= PhoneNumber::Car; + if ( mPhoneIsdnCheck->isChecked() ) type |= PhoneNumber::Isdn; + if ( mPhonePcsCheck->isChecked() ) type |= PhoneNumber::Pcs; + if ( mPhonePagerCheck->isChecked() ) type |= PhoneNumber::Pager; + p.setType( type ); + + return p; +} + +void MainWindow::writePhone( const TQString &id ) +{ + if ( !mCurrentItem ) return; + + if ( id.isEmpty() ) return; + + PhoneNumber p; + p.setId( id ); + p = writePhone( p ); + + mCurrentItem->addressee().insertPhoneNumber( p ); +} + +void MainWindow::readPhone( const TDEABC::PhoneNumber &p ) +{ + mPhoneNumberEdit->setText( p.number() ); + + int type = p.type(); + if ( type & PhoneNumber::Msg ) mPhoneMsgCheck->setChecked( true ); + else mPhoneMsgCheck->setChecked( false ); + if ( type & PhoneNumber::Voice ) mPhoneVoiceCheck->setChecked( true ); + else mPhoneVoiceCheck->setChecked( false ); + if ( type & PhoneNumber::Fax ) mPhoneFaxCheck->setChecked( true ); + else mPhoneFaxCheck->setChecked( false ); + if ( type & PhoneNumber::Cell ) mPhoneCellCheck->setChecked( true ); + else mPhoneCellCheck->setChecked( false ); + if ( type & PhoneNumber::Home ) mPhoneHomeCheck->setChecked( true ); + else mPhoneHomeCheck->setChecked( false ); + if ( type & PhoneNumber::Pref ) mPhonePrefCheck->setChecked( true ); + else mPhonePrefCheck->setChecked( false ); + if ( type & PhoneNumber::Work ) mPhoneWorkCheck->setChecked( true ); + else mPhoneWorkCheck->setChecked( false ); + if ( type & PhoneNumber::Video ) mPhoneVideoCheck->setChecked( true ); + else mPhoneVideoCheck->setChecked( false ); + if ( type & PhoneNumber::Bbs ) mPhoneBbsCheck->setChecked( true ); + else mPhoneBbsCheck->setChecked( false ); + if ( type & PhoneNumber::Modem ) mPhoneModemCheck->setChecked( true ); + else mPhoneModemCheck->setChecked( false ); + if ( type & PhoneNumber::Car ) mPhoneCarCheck->setChecked( true ); + else mPhoneCarCheck->setChecked( false ); + if ( type & PhoneNumber::Isdn ) mPhoneIsdnCheck->setChecked( true ); + else mPhoneIsdnCheck->setChecked( false ); + if ( type & PhoneNumber::Pcs ) mPhonePcsCheck->setChecked( true ); + else mPhonePcsCheck->setChecked( false ); + if ( type & PhoneNumber::Pager ) mPhonePagerCheck->setChecked( true ); + else mPhonePagerCheck->setChecked( false ); +} + +void MainWindow::readPhone( const TQString &id ) +{ + if ( !mCurrentItem || id.isEmpty() ) { + readPhone( PhoneNumber() ); + return; + } + + PhoneNumber p = mCurrentItem->addressee().findPhoneNumber( id ); + readPhone( p ); +} + + +void MainWindow::newAddress() +{ + if( !mCurrentItem ) return; + + Address address; + mCurrentItem->addressee().insertAddress( address ); + + mAddressIdCombo->insertItem( address.id() ); +} + +void MainWindow::removeAddress() +{ + if ( !mCurrentItem ) return; + + TQString id = mAddressIdCombo->currentText(); + if ( id.isEmpty() ) return; + + Address address; + address.setId( id ); + mCurrentItem->addressee().removeAddress( address ); + + readAddressee( mCurrentItem->addressee() ); +} + + +void MainWindow::dumpAddressBook() +{ + mAddressBook->dump(); +} + + +void MainWindow::newEmail() +{ + if ( !mCurrentItem ) return; + + bool ok = false; + TQString name = KInputDialog::getText( i18n("New Email Address"), + i18n("Please enter email address:"), + TQString(), &ok, + this ); + if ( !ok || name.isEmpty() ) return; + + new TQListViewItem( mEmailListView, name ); + mCurrentItem->addressee().insertEmail( name ); +} + +void MainWindow::editEmail() +{ + if ( !mCurrentItem ) return; + + TQListViewItem *item = mEmailListView->selectedItem(); + if( !item ) return; + + TQString oldName = item->text( 0 ); + + bool ok = false; + TQString name = KInputDialog::getText( i18n("Edit Email Address"), + i18n("Please enter new email address:"), + oldName, &ok, + this ); + if ( !ok || name.isEmpty() ) return; + + item->setText( 0, name ); + mCurrentItem->addressee().removeEmail( oldName ); + mCurrentItem->addressee().insertEmail( name ); +} + +void MainWindow::removeEmail() +{ + if ( !mCurrentItem ) return; + + TQListViewItem *item = mEmailListView->selectedItem(); + if( !item ) return; + + mCurrentItem->addressee().removeEmail( item->text( 0 ) ); + delete item; +} + +void MainWindow::newPhoneNumber() +{ + if ( !mCurrentItem ) return; + + PhoneNumber p; + mCurrentItem->addressee().insertPhoneNumber( p ); + + mPhoneIdCombo->insertItem( p.id() ); +} + +void MainWindow::removePhoneNumber() +{ + if ( !mCurrentItem ) return; + + TQString id = mPhoneIdCombo->currentText(); + if ( id.isEmpty() ) return; + + PhoneNumber p; + p.setId( id ); + mCurrentItem->addressee().removePhoneNumber( p ); + + readAddressee( mCurrentItem->addressee() ); +} + + +void MainWindow::newCategory() +{ + if ( !mCurrentItem ) return; + + bool ok = false; + TQString name = KInputDialog::getText( i18n("New Category"), + i18n("Please enter category name:"), + TQString(), &ok, + this ); + if ( !ok || name.isEmpty() ) return; + + new TQListViewItem( mCategoryListView, name ); + mCurrentItem->addressee().insertCategory( name ); +} + +void MainWindow::editCategory() +{ + if ( !mCurrentItem ) return; + + TQListViewItem *item = mCategoryListView->selectedItem(); + if( !item ) return; + + TQString oldName = item->text( 0 ); + + bool ok = false; + TQString name = KInputDialog::getText( i18n("Edit Category"), + i18n("Please enter new category name:"), + oldName, &ok, + this ); + if ( !ok || name.isEmpty() ) return; + + item->setText( 0, name ); + mCurrentItem->addressee().removeCategory( oldName ); + mCurrentItem->addressee().insertCategory( name ); +} + +void MainWindow::removeCategory() +{ + if ( !mCurrentItem ) return; + + TQListViewItem *item = mCategoryListView->selectedItem(); + if( !item ) return; + + mCurrentItem->addressee().removeCategory( item->text( 0 ) ); + delete item; +} + + +void MainWindow::editCustom() +{ + if ( !mCurrentItem ) return; + + TQListViewItem *item = mCustomListView->selectedItem(); + if( !item ) return; + + TQString oldName = item->text( 0 ) + "-" + item->text( 1 ) + ":" + + item->text( 2 ); + + bool ok = false; + TQString name = KInputDialog::getText( i18n("New Custom Entry"), + i18n("Please enter custom entry.\n" + "Format: APP-NAME:VALUE"), + oldName, &ok, + this ); + if ( !ok || name.isEmpty() ) return; + + int posDash = name.find( "-" ); + int posColon = name.find( ":" ); + + TQString app = name.left( posDash ); + TQString cname = name.mid( posDash + 1, posColon - posDash - 1 ); + TQString value = name.mid( posColon + 1 ); + + item->setText( 0, app ); + item->setText( 1, cname ); + item->setText( 2, value ); + + mCurrentItem->addressee().removeCustom( app, cname ); + mCurrentItem->addressee().insertCustom( app, cname, value ); +} + +void MainWindow::newCustom() +{ + if ( !mCurrentItem ) return; + + bool ok = false; + TQString name = KInputDialog::getText( i18n("New Custom Entry"), + i18n("Please enter custom entry.\n" + "Format: APP-NAME:VALUE"), + TQString(), &ok, + this ); + if ( !ok || name.isEmpty() ) return; + + int posDash = name.find( "-" ); + int posColon = name.find( ":" ); + + TQString app = name.left( posDash ); + TQString cname = name.mid( posDash + 1, posColon - posDash - 1 ); + TQString value = name.mid( posColon + 1 ); + + new TQListViewItem( mCustomListView, app, cname, value ); + + mCurrentItem->addressee().insertCustom( app, cname, value ); +} + +void MainWindow::removeCustom() +{ + if ( !mCurrentItem ) return; + + TQListViewItem *item = mCustomListView->selectedItem(); + if( !item ) return; + + mCurrentItem->addressee().removeCustom( item->text( 0 ), item->text( 1 ) ); + delete item; +} + +void MainWindow::addressBookChanged() +{ + TQMessageBox::warning( this, i18n("Address Book Changed"), + i18n("The address book has changed on disk."), + i18n("Reload") ); + loadAddressBook( "dummy" ); +} + +void MainWindow::addressBookLocked() +{ + kdDebug() << "AddressBook locked()" << endl; +} + +void MainWindow::addressBookUnlocked() +{ + kdDebug() << "AddressBook unlocked()" << endl; +} + + +void MainWindow::fileOpenStd() +{ + loadAddressBook( StdAddressBook::fileName() ); +} diff --git a/tdeabc/tdeabc2mutt/CMakeLists.txt b/tdeabc/tdeabc2mutt/CMakeLists.txt new file mode 100644 index 000000000..035c38940 --- /dev/null +++ b/tdeabc/tdeabc2mutt/CMakeLists.txt @@ -0,0 +1,29 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### tdeabc2mutt (executable) #################### + +tde_add_executable( tdeabc2mutt AUTOMOC + SOURCES tdeabc2mutt.cpp main.cpp + LINK tdeabc-shared + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/tdeabc/tdeabc2mutt/Makefile.am b/tdeabc/tdeabc2mutt/Makefile.am new file mode 100644 index 000000000..d921711b7 --- /dev/null +++ b/tdeabc/tdeabc2mutt/Makefile.am @@ -0,0 +1,13 @@ +INCLUDES = -I$(includedir)/tdeabc $(all_includes) + +METASOURCES = AUTO + +bin_PROGRAMS = tdeabc2mutt + +tdeabc2mutt_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor +tdeabc2mutt_LDADD = -ltdeabc $(LIB_TDECORE) +tdeabc2mutt_SOURCES = tdeabc2mutt.cpp main.cpp + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/tdeabc2mutt.pot + diff --git a/tdeabc/tdeabc2mutt/README b/tdeabc/tdeabc2mutt/README new file mode 100644 index 000000000..2da528a9a --- /dev/null +++ b/tdeabc/tdeabc2mutt/README @@ -0,0 +1,19 @@ +KAbc2Mutt +----------- + +tdeabc2mutt is a small programm to make the email addresses, stored in +kaddressbook, available in mutt. +You only have to add the following line to your .muttrc + + source "tdeabc2mutt |" + +You can also configure mutt to query tdeabc2mutt when typing a substring +of an email address (see the docu for query_command). +To do this, add the following line to your .muttrc + + set query_command = "tdeabc2mutt --query '%s' --format query" + +Have fun with it + +Ciao, +Tobias diff --git a/tdeabc/tdeabc2mutt/main.cpp b/tdeabc/tdeabc2mutt/main.cpp new file mode 100644 index 000000000..0515c37d9 --- /dev/null +++ b/tdeabc/tdeabc2mutt/main.cpp @@ -0,0 +1,80 @@ +/* + KAbc2Mutt + + Copyright (c) 2003 - 2004 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of version 2 of the GNU General Public + License as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include <tdeapplication.h> +#include <tdecmdlineargs.h> +#include <tdelocale.h> + +#include <iostream> + +#include "tdeabc2mutt.h" + +static const char version[] = "0.2"; +static const char appName[] = "tdeabc2mutt"; +static const char programName[] = I18N_NOOP( "tdeabc2mutt" ); +static const char description[] = I18N_NOOP( "tdeabc - mutt converter" ); + +static TDECmdLineOptions k2moptions[] = +{ + { "query <substring>", I18N_NOOP( "Only show contacts where name or address matches <substring>" ), 0 }, + { "format <format>", I18N_NOOP( "Default format is 'alias'. 'query' returns email<tab>name<tab>, as needed by mutt's query_command" ), "alias" }, + { "alternate-key-format", I18N_NOOP( "Default key format is 'JohDoe', this option turns it into 'jdoe'" ), 0 }, + { "ignore-case", I18N_NOOP( "Make queries case insensitive" ), 0 }, + { "all-addresses", I18N_NOOP( "Return all mail addresses, not just the preferred one" ), 0}, + TDECmdLineLastOption +}; + + +int main( int argc, char **argv ) +{ + TDEApplication::disableAutoDcopRegistration(); + TDECmdLineArgs::init( argc, argv, appName, programName, description, version ); + TDECmdLineArgs::addCmdLineOptions( k2moptions ); + + TDEApplication app( false, false ); + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + KABC2Mutt *object = new KABC2Mutt( 0 ); + + // Handle --format option + object->setFormat( (args->getOption("format") == "query") ? KABC2Mutt::Query : KABC2Mutt::Aliases ); + + // Handle --alternate-key-format option + object->setAlternateKeyFormat( args->isSet( "alternate-key-format" ) ); + + // Handle --all-addresses option + object->setAllAddresses( args->isSet( "all-addresses" ) ); + + // Handle --query option + const TQString subString = TQString::fromLocal8Bit( args->getOption( "query" ) ); + if ( !subString.isEmpty() ) { + // Mutt wants a first line with some status message on it + // See http://mutt.org/doc/manual/manual-4.html#ss4.5 + std::cout << i18n( "Searching KDE addressbook" ).latin1() << std::endl; + } + object->setQuery( subString ); + + // Handle --ignore-case option + object->setIgnoreCase( !args->isSet( "ignore-case" ) ); + + object->run(); + + return app.exec(); +} diff --git a/tdeabc/tdeabc2mutt/tdeabc2mutt.cpp b/tdeabc/tdeabc2mutt/tdeabc2mutt.cpp new file mode 100644 index 000000000..d36582baf --- /dev/null +++ b/tdeabc/tdeabc2mutt/tdeabc2mutt.cpp @@ -0,0 +1,160 @@ +/* + KAbc2Mutt + + Copyright (c) 2003 - 2004 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of version 2 of the GNU General Public + License as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include <tdeabc/distributionlist.h> +#include <tdeapplication.h> +#include <tdelocale.h> + +#include <tqregexp.h> + +#include <iostream> + +#include "tdeabc2mutt.h" + +static std::ostream & operator<< ( std::ostream &os, const TQString &s ); + +KABC2Mutt::KABC2Mutt( TQObject *parent, const char *name ) + : TQObject( parent, name ), mFormat( Aliases ), + mIgnoreCase( false ), mAllAddresses( false ), + mAlternateKeyFormat( false ), + mAddressBook( 0 ) +{ +} + +void KABC2Mutt::run() +{ + mAddressBook = TDEABC::StdAddressBook::self( true ); + TDEABC::StdAddressBook::setAutomaticSave( false ); + + connect( mAddressBook, TQT_SIGNAL( addressBookChanged( AddressBook* ) ), + this, TQT_SLOT( loadingFinished() ) ); +} + +void KABC2Mutt::loadingFinished() +{ + // print addressees + TDEABC::AddressBook::ConstIterator iaddr; + for ( iaddr = mAddressBook->begin(); iaddr != mAddressBook->end(); ++iaddr ) { + const TQString name = (*iaddr).givenName() + ' ' + (*iaddr).familyName(); + if ( !mQuery.isEmpty() ) { + bool match = (name.find(mQuery, 0, mIgnoreCase) > -1) || + ((*iaddr).preferredEmail().find( mQuery, 0, mIgnoreCase ) > -1 ); + if ( !match ) + continue; + } + + const TQStringList &allAddresses = (*iaddr).emails(); + TQStringList::const_iterator from, to; + bool multiple = false; + + if ( mAllAddresses ) { + // use all entries + multiple = allAddresses.size() > 1; + from = allAddresses.begin(); + to = allAddresses.end(); + } else { + // use only the first entry, the one returned by preferredEmail() + from = to = allAddresses.begin(); // start with empty list + if ( to != allAddresses.end() ) + ++to; + } + + size_t index = 0; + if ( mFormat == Aliases ) { + static const TQChar space = TQChar( ' ' ); + static const TQChar underscore = TQChar( '_' ); + + TQString key; + if ( !mAlternateKeyFormat ) + key = (*iaddr).givenName().left( 3 ) + (*iaddr).familyName().left( 3 ); + else + if ( !(*iaddr).familyName().isEmpty() ) + key = (*iaddr).givenName().left( 1 ).lower() + + (*iaddr).familyName().lower().replace( space, underscore ); + else + key = (*iaddr).givenName().lower().replace( space, underscore ); + + while ( from != to ) { + std::cout << "alias " << key; + if ( index ) + std::cout << index; + std::cout << '\t' << name << " <" << (*from) << '>' << std::endl; + ++index; + ++from; + } + + if ( !(*iaddr).nickName().isEmpty() ) { + std::cout << "alias " + << (*iaddr).nickName().lower().replace( space, underscore ) + << '\t' << name << " <" + << (*iaddr).preferredEmail() << '>' << std::endl; + } + } else { + while ( from != to ) { + std::cout << (*from) << '\t' << name; + if ( multiple ) { + if ( index ) + std::cout << "\t#" << index; + else + std::cout << '\t' << i18n( "preferred" ); + ++index; + } + std::cout << std::endl; + ++from; + } + } + } + + // print all distribution lists + TDEABC::DistributionListManager manager( mAddressBook ); + manager.load(); + + TQStringList dists = manager.listNames(); + for ( TQStringList::Iterator iaddr = dists.begin(); iaddr != dists.end(); ++iaddr ) { + TDEABC::DistributionList *list = manager.list( *iaddr ); + if ( list ) { + if ( !mQuery.isEmpty() ) { + bool match = ((*iaddr).find(mQuery) > -1); + if ( !match ) + continue; + } + + TQStringList emails = list->emails(); + if ( emails.isEmpty() ) + continue; + + if ( mFormat == Aliases ) { + std::cout << "alias " << (*iaddr).replace( TQRegExp( " " ), "_" ) + << '\t' << emails.join( "," ) << std::endl; + } else { + std::cout << emails.join( "," ) << '\t' << (*iaddr) << '\t' << std::endl; + } + } + } + + kapp->quit(); +} + +static std::ostream & operator<< ( std::ostream &os, const TQString &s ) +{ + os << s.local8Bit().data(); + return os; +} + +#include "tdeabc2mutt.moc" diff --git a/tdeabc/tdeabc2mutt/tdeabc2mutt.h b/tdeabc/tdeabc2mutt/tdeabc2mutt.h new file mode 100644 index 000000000..a0e58a598 --- /dev/null +++ b/tdeabc/tdeabc2mutt/tdeabc2mutt.h @@ -0,0 +1,57 @@ +/* + KAbc2Mutt + + Copyright (c) 2003 - 2004 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of version 2 of the GNU General Public + License as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef TDEABC2MUTT_H +#define TDEABC2MUTT_H + +#include <tdeabc/stdaddressbook.h> + +class KABC2Mutt : public TQObject +{ + Q_OBJECT + + + public: + + enum Format { Aliases, Query }; + + KABC2Mutt( TQObject *parent, const char *name = 0 ); + + void setQuery( const TQString &query ) { mQuery = query; } + void setFormat( Format format ) { mFormat = format; } + void setIgnoreCase( bool ignoreCase ) { mIgnoreCase = ignoreCase; } + void setAllAddresses( bool allAddresses ) { mAllAddresses = allAddresses; } + void setAlternateKeyFormat( bool alternateKeyFormat ) { mAlternateKeyFormat = alternateKeyFormat; } + + void run(); + + private slots: + void loadingFinished(); + + private: + TQString mQuery; + Format mFormat; + bool mIgnoreCase; + bool mAllAddresses; + bool mAlternateKeyFormat; + + TDEABC::AddressBook *mAddressBook; +}; + +#endif diff --git a/tdeabc/tdeabcdistlistupdater/CMakeLists.txt b/tdeabc/tdeabcdistlistupdater/CMakeLists.txt new file mode 100644 index 000000000..ddbdd7c9d --- /dev/null +++ b/tdeabc/tdeabcdistlistupdater/CMakeLists.txt @@ -0,0 +1,42 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +tde_import( libkmime ) +tde_import( ktnef ) +tde_import( libkcal ) +tde_import( libtdepim ) + +include_directories( + ${CMAKE_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( + FILES tdeabcdistlistupdater.desktop + DESTINATION ${AUTOSTART_INSTALL_DIR} +) + + +##### tdeabcdistlistupdater (executable) #################### + +tde_add_executable( tdeabcdistlistupdater + SOURCES tdeabcdistlistupdater.cpp + LINK tdepim-shared + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/tdeabc/tdeabcdistlistupdater/Makefile.am b/tdeabc/tdeabcdistlistupdater/Makefile.am new file mode 100644 index 000000000..b60e00653 --- /dev/null +++ b/tdeabc/tdeabcdistlistupdater/Makefile.am @@ -0,0 +1,12 @@ +INCLUDES = -I$(includedir)/tdeabc -I$(top_srcdir) $(all_includes) + +METASOURCES = AUTO + +bin_PROGRAMS = tdeabcdistlistupdater + +tdeabcdistlistupdater_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor +tdeabcdistlistupdater_LDADD = $(LIB_TDEABC) $(top_builddir)/libtdepim/libtdepim.la +tdeabcdistlistupdater_SOURCES = tdeabcdistlistupdater.cpp + +autostart_DATA = tdeabcdistlistupdater.desktop +autostartdir = $(datadir)/autostart diff --git a/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.cpp b/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.cpp new file mode 100644 index 000000000..9228e1f47 --- /dev/null +++ b/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.cpp @@ -0,0 +1,95 @@ +/* + This file is part of libtdeabc. + Copyright (c) 2008 Tobias Koenig <tokoe@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <tdeaboutdata.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> +#include <ksimpleconfig.h> +#include <kdebug.h> +#include <tdeglobal.h> +#include <tdelocale.h> +#include <kstandarddirs.h> + +#include <tdeabc/stdaddressbook.h> +#include <libtdepim/distributionlist.h> + +static const TDECmdLineOptions options[] = +{ + { "disable-autostart", "Disable automatic startup on login", 0 }, + TDECmdLineLastOption +}; + +void convertDistributionLists() +{ + KSimpleConfig cfg( locateLocal( "data", "tdeabc/distlists" ) ); + const TQMap<TQString, TQString> entryMap = cfg.entryMap( "DistributionLists" ); + + if ( entryMap.isEmpty() ) // nothing to convert + return; + + TQMapConstIterator<TQString, TQString> it; + for ( it = entryMap.begin(); it != entryMap.end(); ++it ) { + const TQString listName = it.key(); + const TQStringList entries = TQStringList::split( ',', it.data(), true ); + + KPIM::DistributionList distList; + distList.setUid( TDEApplication::randomString( 10 ) ); + distList.setName( listName ); + + if ( entries.count() > 1 ) { + for ( uint i = 0; i < entries.count(); i += 2 ) { + const TQString uid = entries[ i ]; + const TQString preferredEMail = entries[ i + 1 ]; + + distList.insertEntry( uid, preferredEMail ); + } + } + + TDEABC::StdAddressBook::self()->insertAddressee( distList ); + } + + TDEABC::StdAddressBook::self()->save(); +} + +int main( int argc, char **argv ) +{ + TDEApplication::disableAutoDcopRegistration(); + + TDEAboutData aboutData( "tdeabcdistlistupdater", "Converter tool for distribution lists", "0.1" ); + aboutData.addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); + + TDECmdLineArgs::init( argc, argv, &aboutData ); + TDECmdLineArgs::addCmdLineOptions( options ); + + TDEApplication app( false, false ); + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + if ( args->isSet( "disable-autostart" ) ) { + kdDebug() << "Disable autostart." << endl; + + TDEConfig *config = app.config(); + config->setGroup( "Startup" ); + config->writeEntry( "EnableAutostart", false ); + } + + convertDistributionLists(); +} + diff --git a/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.desktop b/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.desktop new file mode 100644 index 000000000..f481a0aaf --- /dev/null +++ b/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=tdeabcdistlistupdater +Exec=tdeabcdistlistupdater --disable-autostart +Icon=misc +Type=Application +Comment=Tool to update the old distribution lists to the new ones. +Terminal=false +NoDisplay=true +X-TDE-autostart-condition=tdeabcdistlistupdaterrc:Startup:EnableAutostart:true +OnlyShowIn=TDE; |