summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-07 22:51:29 (UTC)
committer zautrix <zautrix>2004-09-07 22:51:29 (UTC)
commit2676646d4744ccceab1063dc02d772a26a203c61 (patch) (unidiff)
tree0a0d5261b9a804a29b61a38f68339979051282e2
parent64a8ef1629f523df3006de5cb2b9882a50d96a05 (diff)
downloadkdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.zip
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.gz
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.bz2
Implemented Ompi - kapi connection
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/stdaddressbook.cpp12
-rw-r--r--kaddressbook/kabcore.cpp22
-rw-r--r--kmicromail/composemail.cpp99
-rw-r--r--kmicromail/composemail.h8
-rw-r--r--kmicromail/main.cpp5
-rw-r--r--kmicromail/mainwindow.cpp2
-rw-r--r--kmicromail/opiemail.cpp1
-rw-r--r--korganizer/koeventviewer.cpp2
8 files changed, 121 insertions, 30 deletions
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index 9f38f08..ec47a4e 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -50,37 +50,32 @@ QString StdAddressBook::fileName()
50QString StdAddressBook::directoryName() 50QString StdAddressBook::directoryName()
51{ 51{
52 return locateLocal( "data", "kabc/stdvcf" ); 52 return locateLocal( "data", "kabc/stdvcf" );
53} 53}
54 54
55void StdAddressBook::handleCrash() 55void StdAddressBook::handleCrash()
56{ 56{
57 StdAddressBook::self()->cleanUp(); 57 StdAddressBook::self()->cleanUp();
58} 58}
59 59
60StdAddressBook *StdAddressBook::self() 60StdAddressBook *StdAddressBook::self()
61{ 61{
62 62
63 if ( !mSelf ) 63 if ( !mSelf )
64 { 64 {
65 QString appdir = StdAddressBook::setTempAppDir(); 65 QString appdir = StdAddressBook::setTempAppDir();
66 qDebug("****************************************************** ");
67 qDebug("****************************************************** ");
68 qDebug("****************************************************** ");
69 qDebug("****************************************************** ");
70 qDebug("****************************************************** ");
71// US im am not sure why I have to use the other format here?? 66// US im am not sure why I have to use the other format here??
72#ifdef KAB_EMBEDDED 67#ifdef KAB_EMBEDDED
73 mSelf = addressBookDeleter.setObject( new StdAddressBook ); 68 mSelf = addressBookDeleter.setObject( new StdAddressBook );
74#else //KAB_EMBEDDED 69#else //KAB_EMBEDDED
75 addressBookDeleter.setObject( mSelf, new StdAddressBook ); 70 addressBookDeleter.setObject( mSelf, new StdAddressBook );
76#endif //KAB_EMBEDDED 71#endif //KAB_EMBEDDED
77 KStandardDirs::setAppDir( appdir ); 72 KStandardDirs::setAppDir( appdir );
78 } 73 }
79 74
80 return mSelf; 75 return mSelf;
81} 76}
82 77
83QString StdAddressBook::setTempAppDir() 78QString StdAddressBook::setTempAppDir()
84{ 79{
85 QString appDIR = KStandardDirs::appDir(); 80 QString appDIR = KStandardDirs::appDir();
86#ifdef DESKTOP_VERSION 81#ifdef DESKTOP_VERSION
@@ -90,39 +85,32 @@ QString StdAddressBook::setTempAppDir()
90 else 85 else
91 appdir += "/kaddressbook/"; 86 appdir += "/kaddressbook/";
92 KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); 87 KStandardDirs::setAppDir( QDir::convertSeparators( appdir ));
93#else 88#else
94 QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook"; 89 QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook";
95 90
96 KStandardDirs::setAppDir( appdir ); 91 KStandardDirs::setAppDir( appdir );
97#endif 92#endif
98 93
99 return appDIR; 94 return appDIR;
100} 95}
101StdAddressBook *StdAddressBook::self( bool onlyFastResources ) 96StdAddressBook *StdAddressBook::self( bool onlyFastResources )
102{ 97{
103 98
104 if ( !mSelf ) 99 if ( !mSelf )
105 { 100 {
106 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
107 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
108 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
109 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
110 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
111 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
112 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
113 QString appdir =StdAddressBook::setTempAppDir(); 101 QString appdir =StdAddressBook::setTempAppDir();
114#ifdef KAB_EMBEDDED 102#ifdef KAB_EMBEDDED
115 mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); 103 mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) );
116#else //KAB_EMBEDDED 104#else //KAB_EMBEDDED
117 addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); 105 addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) );
118#endif //KAB_EMBEDDED 106#endif //KAB_EMBEDDED
119 KStandardDirs::setAppDir( appdir ); 107 KStandardDirs::setAppDir( appdir );
120 } 108 }
121 return mSelf; 109 return mSelf;
122} 110}
123 111
124StdAddressBook::StdAddressBook() 112StdAddressBook::StdAddressBook()
125 : AddressBook( "kabcrc" ) 113 : AddressBook( "kabcrc" )
126{ 114{
127 115
128 init( false ); 116 init( false );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2f9f1df..6522ccc 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2030,34 +2030,52 @@ void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QSt
2030 { 2030 {
2031 nameList.append(list[i].realName()); 2031 nameList.append(list[i].realName());
2032 emailList.append(list[i].preferredEmail()); 2032 emailList.append(list[i].preferredEmail());
2033 uidList.append(list[i].uid()); 2033 uidList.append(list[i].uid());
2034 } 2034 }
2035 2035
2036 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2036 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2037 2037
2038} 2038}
2039 2039
2040/* this method will be called through the QCop interface from other apps to show details of a contact. 2040/* this method will be called through the QCop interface from other apps to show details of a contact.
2041 */ 2041 */
2042void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2042void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2043{ 2043{
2044 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2044 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2045 2045
2046 QString foundUid = QString::null; 2046 QString foundUid = QString::null;
2047 if (uid.isEmpty()) 2047 if ( ! uid.isEmpty() ) {
2048 Addressee adrr = mAddressBook->findByUid( uid );
2049 if ( !adrr.isEmpty() ) {
2050 foundUid = uid;
2051 if ( email == "sendbacklist" ) {
2052 QStringList nameList;
2053 QStringList emailList;
2054 QStringList uidList;
2055 nameList.append(adrr.realName());
2056 emailList = adrr.emails();
2057 uidList.append( adrr.preferredEmail());
2058 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2059 }
2060 }
2061 }
2062
2063 if ( email == "sendback" )
2064 return;
2065 if (foundUid.isEmpty())
2048 { 2066 {
2049 //find the uid of the person first 2067 //find the uid of the person first
2050 Addressee::List namelist; 2068 Addressee::List namelist;
2051 Addressee::List emaillist; 2069 Addressee::List emaillist;
2052 2070
2053 if (!name.isEmpty()) 2071 if (!name.isEmpty())
2054 namelist = mAddressBook->findByName( name ); 2072 namelist = mAddressBook->findByName( name );
2055 2073
2056 if (!email.isEmpty()) 2074 if (!email.isEmpty())
2057 emaillist = mAddressBook->findByEmail( email ); 2075 emaillist = mAddressBook->findByEmail( email );
2058 qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2076 qDebug("count %d %d ", namelist.count(),emaillist.count() );
2059 //check if we have a match in Namelist and Emaillist 2077 //check if we have a match in Namelist and Emaillist
2060 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2078 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2061 foundUid = emaillist[0].uid(); 2079 foundUid = emaillist[0].uid();
2062 } 2080 }
2063 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2081 else if ((namelist.count() > 0) && (emaillist.count() == 0))
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 654cfc0..5f446fa 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -16,60 +16,73 @@
16#include <qpe/global.h> 16#include <qpe/global.h>
17//#include <qpe/contact.h> 17//#include <qpe/contact.h>
18 18
19 19
20#include <qcombobox.h> 20#include <qcombobox.h>
21#include <qcheckbox.h> 21#include <qcheckbox.h>
22#include <qtimer.h> 22#include <qtimer.h>
23#include <qmessagebox.h> 23#include <qmessagebox.h>
24#include <qpushbutton.h> 24#include <qpushbutton.h>
25#include <qmultilineedit.h> 25#include <qmultilineedit.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qtabwidget.h> 27#include <qtabwidget.h>
28#include <qlistview.h> 28#include <qlistview.h>
29#include <kabc/addresseedialog.h> 29#include <kabc/addresseedialog.h>
30#include <kabc/stdaddressbook.h> 30#include <kabc/stdaddressbook.h>
31#include <kabc/addressee.h> 31#include <kabc/addressee.h>
32 32#ifdef DESKTOP_VERSION
33#include <kabc/addresseedialog.h>
34#else //DESKTOP_VERSION
35#include <libkdepim/externalapphandler.h>
36#endif //DESKTOP_VERSION
33 37
34 38
35//using namespace Opie::Core; 39//using namespace Opie::Core;
36//using namespace Opie::Ui; 40//using namespace Opie::Ui;
37ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 41ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
38 : ComposeMailUI( parent, name, modal, flags ) 42 : ComposeMailUI( parent, name, modal, flags )
39{ 43{
40 44
45 mPickLineEdit = 0;
46 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
47 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
41 settings = s; 48 settings = s;
42 m_replyid = ""; 49 m_replyid = "";
50 KConfig config( locateLocal("config", "kabcrc") );
51 config.setGroup( "General" );
52 QString whoami_uid = config.readEntry( "WhoAmI" );
53 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
54#ifdef DESKTOP_VERSION
43 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 55 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
44 QStringList mails = con.emails(); 56 QStringList mails = con.emails();
45 QString defmail = con.preferredEmail(); 57 QString defmail = con.preferredEmail();
46 if ( mails.count() == 0) 58 if ( mails.count() == 0)
47 QMessageBox::information( 0, tr( "Hint" ), 59 QMessageBox::information( 0, tr( "Hint" ),
48 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 60 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
49 tr( "Ok" ) ); 61 tr( "Ok" ) );
50 if (defmail.length()!=0) { 62 if (defmail.length()!=0) {
51 fromBox->insertItem(defmail); 63 fromBox->insertItem(defmail);
52 } 64 }
53 QStringList::ConstIterator sit = mails.begin(); 65 QStringList::ConstIterator sit = mails.begin();
54 for (;sit!=mails.end();++sit) { 66 for (;sit!=mails.end();++sit) {
55 if ( (*sit)==defmail) 67 if ( (*sit)==defmail)
56 continue; 68 continue;
57 fromBox->insertItem((*sit)); 69 fromBox->insertItem((*sit));
58 } 70 }
59 senderNameEdit->setText(con.formattedName()); 71 senderNameEdit->setText(con.formattedName());
72#endif
60 Config cfg( "mail" ); 73 Config cfg( "mail" );
61 cfg.setGroup( "Compose" ); 74 cfg.setGroup( "Compose" );
62 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 75 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
63 76
64 attList->addColumn( tr( "Name" ) ); 77 attList->addColumn( tr( "Name" ) );
65 attList->addColumn( tr( "Size" ) ); 78 attList->addColumn( tr( "Size" ) );
66 79
67 QList<Account> accounts = settings->getAccounts(); 80 QList<Account> accounts = settings->getAccounts();
68 81
69 Account *it; 82 Account *it;
70 for ( it = accounts.first(); it; it = accounts.next() ) { 83 for ( it = accounts.first(); it; it = accounts.next() ) {
71 if ( it->getType()==MAILLIB::A_SMTP ) { 84 if ( it->getType()==MAILLIB::A_SMTP ) {
72 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 85 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
73 smtpAccountBox->insertItem( smtp->getAccountName() ); 86 smtpAccountBox->insertItem( smtp->getAccountName() );
74 smtpAccounts.append( smtp ); 87 smtpAccounts.append( smtp );
75 } 88 }
@@ -78,35 +91,38 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
78 fillValues( smtpAccountBox->currentItem() ); 91 fillValues( smtpAccountBox->currentItem() );
79 } else { 92 } else {
80 QMessageBox::information( 0, tr( "Problem" ), 93 QMessageBox::information( 0, tr( "Problem" ),
81 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), 94 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
82 tr( "Ok" ) ); 95 tr( "Ok" ) );
83 return; 96 return;
84 } 97 }
85 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 98 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
86 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 99 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
87 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 100 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
88 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 101 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
89 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 102 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
90 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 103 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
91 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 104 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
92 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 105 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
93 mMail = 0; 106 mMail = 0;
94 warnAttach = true; 107 warnAttach = true;
95 108
96} 109}
110
111
112
97void ComposeMail::saveAsDraft() 113void ComposeMail::saveAsDraft()
98{ 114{
99 115
100 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 116 Opie::Core::OSmartPointer<Mail> mail= new Mail();
101 mail->setMail(fromBox->currentText()); 117 mail->setMail(fromBox->currentText());
102 mail->setTo( toLine->text() ); 118 mail->setTo( toLine->text() );
103 mail->setName(senderNameEdit->text()); 119 mail->setName(senderNameEdit->text());
104 mail->setCC( ccLine->text() ); 120 mail->setCC( ccLine->text() );
105 mail->setBCC( bccLine->text() ); 121 mail->setBCC( bccLine->text() );
106 mail->setReply( replyLine->text() ); 122 mail->setReply( replyLine->text() );
107 mail->setSubject( subjectLine->text() ); 123 mail->setSubject( subjectLine->text() );
108 if (!m_replyid.isEmpty()) { 124 if (!m_replyid.isEmpty()) {
109 QStringList ids; 125 QStringList ids;
110 ids.append(m_replyid); 126 ids.append(m_replyid);
111 mail->setInreply(ids); 127 mail->setInreply(ids);
112 } 128 }
@@ -127,95 +143,156 @@ void ComposeMail::saveAsDraft()
127 if ( warnAttach ) 143 if ( warnAttach )
128 QMessageBox::warning(0,tr("Store message"), 144 QMessageBox::warning(0,tr("Store message"),
129 tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); 145 tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
130 warnAttach = false; 146 warnAttach = false;
131 } 147 }
132 setStatus( tr("Mail saved as draft!") ); 148 setStatus( tr("Mail saved as draft!") );
133} 149}
134void ComposeMail::clearStatus() 150void ComposeMail::clearStatus()
135{ 151{
136 topLevelWidget()->setCaption( tr("Compose mail") ); 152 topLevelWidget()->setCaption( tr("Compose mail") );
137} 153}
138void ComposeMail::setStatus( QString status ) 154void ComposeMail::setStatus( QString status )
139{ 155{
140 topLevelWidget()->setCaption( status ); 156 topLevelWidget()->setCaption( status );
141 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; 157 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
142} 158}
143void ComposeMail::pickAddress( QLineEdit *line ) 159void ComposeMail::pickAddress( )
144{ 160{
161
162 QLineEdit *line = mPickLineEdit;
163 if ( line == 0 )
164 return;
165#ifdef DESKTOP_VERSION
145 //qDebug(" ComposeMail::pickAddress "); 166 //qDebug(" ComposeMail::pickAddress ");
146 QString names ;//= AddressPicker::getNames(); 167 QString names ;//= AddressPicker::getNames();
147 168
148 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 169 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
149 uint i=0; 170 uint i=0;
150 for (i=0; i < list.count(); i++) { 171 for (i=0; i < list.count(); i++) {
151 if ( !list[i].preferredEmail().isEmpty()) { 172 if ( !list[i].preferredEmail().isEmpty()) {
152 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 173 if ( ! names.isEmpty() )
153 if ( i < list.count() -1 )
154 names+= ","; 174 names+= ",";
175 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
176
155 } 177 }
156 } 178 }
157 179
158 180
159 if ( line->text().isEmpty() ) { 181 if ( line->text().isEmpty() ) {
160 line->setText( names ); 182 line->setText( names );
161 } else if ( !names.isEmpty() ) { 183 } else if ( !names.isEmpty() ) {
162 line->setText( line->text() + ", " + names ); 184 line->setText( line->text() + ", " + names );
163 } 185 }
186#else
187 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
188 // the result should now arrive through method insertAttendees
189#endif
190}
191//the map includes name/email pairs, that comes from Ka/Pi
192void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
193{
194 qDebug("ComposeMail::insertAttendees ");
195 raise();
196
197 if ( mPickLineEdit == 0 ) { //whoami received
198
199 QString defmail = uidList[0];
200 if ( emailList.count() == 0 )
201 QMessageBox::information( 0, tr( "Hint" ),
202 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
203 tr( "Ok" ) );
204 if (defmail.length()!=0) {
205 fromBox->insertItem(defmail);
206 }
207 QStringList::ConstIterator sit = emailList.begin();
208 int pref = 0;
209 for (;sit!=emailList.end();++sit) {
210 if ( (*sit)==defmail)
211 continue;
212 fromBox->insertItem((*sit));
213 }
214 senderNameEdit->setText(nameList[0]);
215 return;
216 }
217 QString names ;
218 QLineEdit *line = mPickLineEdit;
219 if (uid == this->name())
220 {
221 for ( int i = 0; i < nameList.count(); i++)
222 {
223 QString _name = nameList[i];
224 QString _email = emailList[i];
225 QString _uid = uidList[i];
226 if ( ! _email.isEmpty() ) {
227 if ( ! names.isEmpty() )
228 names+= ",";
229 names+= "\""+_name +"\"<" +_email +">";
230 }
231 }
232 }
233 if ( line->text().isEmpty() ) {
234 line->setText( names );
235 } else if ( !names.isEmpty() ) {
236 line->setText( line->text() + ", " + names );
237 }
164} 238}
165
166 239
167void ComposeMail::setTo( const QString & to ) 240void ComposeMail::setTo( const QString & to )
168{ 241{
169 toLine->setText( to ); 242 toLine->setText( to );
170} 243}
171 244
172void ComposeMail::setSubject( const QString & subject ) 245void ComposeMail::setSubject( const QString & subject )
173{ 246{
174 subjectLine->setText( subject ); 247 subjectLine->setText( subject );
175} 248}
176 249
177void ComposeMail::setInReplyTo( const QString & messageId ) 250void ComposeMail::setInReplyTo( const QString & messageId )
178{ 251{
179 m_replyid = messageId; 252 m_replyid = messageId;
180} 253}
181 254
182void ComposeMail::setMessage( const QString & text ) 255void ComposeMail::setMessage( const QString & text )
183{ 256{
184 message->setText( text ); 257 message->setText( text );
185} 258}
186 259
187 260
188void ComposeMail::pickAddressTo() 261void ComposeMail::pickAddressTo()
189{ 262{
190 pickAddress( toLine ); 263 mPickLineEdit = toLine;
264 pickAddress( );
191} 265}
192 266
193void ComposeMail::pickAddressCC() 267void ComposeMail::pickAddressCC()
194{ 268{
195 pickAddress( ccLine ); 269 mPickLineEdit = ccLine;
270 pickAddress( );
196} 271}
197 272
198void ComposeMail::pickAddressBCC() 273void ComposeMail::pickAddressBCC()
199{ 274{
200 pickAddress( bccLine ); 275 mPickLineEdit = bccLine;
276 pickAddress( );
201} 277}
202 278
203void ComposeMail::pickAddressReply() 279void ComposeMail::pickAddressReply()
204{ 280{
205 pickAddress( replyLine ); 281 mPickLineEdit = replyLine;
282 pickAddress( );
206} 283}
207 284
208void ComposeMail::fillValues( int ) 285void ComposeMail::fillValues( int )
209{ 286{
210#if 0 287#if 0
211 SMTPaccount *smtp = smtpAccounts.at( current ); 288 SMTPaccount *smtp = smtpAccounts.at( current );
212 ccLine->clear(); 289 ccLine->clear();
213 if ( smtp->getUseCC() ) { 290 if ( smtp->getUseCC() ) {
214 ccLine->setText( smtp->getCC() ); 291 ccLine->setText( smtp->getCC() );
215 } 292 }
216 bccLine->clear(); 293 bccLine->clear();
217 if ( smtp->getUseBCC() ) { 294 if ( smtp->getUseBCC() ) {
218 bccLine->setText( smtp->getBCC() ); 295 bccLine->setText( smtp->getBCC() );
219 } 296 }
220 replyLine->clear(); 297 replyLine->clear();
221 if ( smtp->getUseReply() ) { 298 if ( smtp->getUseReply() ) {
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h
index 876b597..657f665 100644
--- a/kmicromail/composemail.h
+++ b/kmicromail/composemail.h
@@ -21,63 +21,67 @@ public:
21 AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); 21 AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
22 static QString getNames(); 22 static QString getNames();
23 23
24protected: 24protected:
25 QString selectedNames; 25 QString selectedNames;
26 void accept(); 26 void accept();
27 27
28}; 28};
29#endif 29#endif
30class RecMail; 30class RecMail;
31 31
32class ComposeMail : public ComposeMailUI 32class ComposeMail : public ComposeMailUI
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35 35
36public: 36public:
37
37 ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); 38 ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
38 virtual ~ComposeMail(); 39 virtual ~ComposeMail();
39 40
40 void reEditMail(const Opie::Core::OSmartPointer<RecMail>&current); 41 void reEditMail(const Opie::Core::OSmartPointer<RecMail>&current);
41 42
42public slots: 43public slots:
43 void slotAdjustColumns(); 44 void slotAdjustColumns();
44 45
45 void setTo( const QString & to ); 46 void setTo( const QString & to );
46 void setSubject( const QString & subject ); 47 void setSubject( const QString & subject );
47 void setInReplyTo( const QString & messageId ); 48 void setInReplyTo( const QString & messageId );
48 void setMessage( const QString & text ); 49 void setMessage( const QString & text );
50 void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
51
49 52
50protected slots: 53protected slots:
51 void accept(); 54 void accept();
52 void reject(); 55 void reject();
53 56
54private slots: 57private slots:
55 void fillValues( int current ); 58 void fillValues( int current );
56 void pickAddress( QLineEdit *line ); 59 void pickAddress();
57 void pickAddressTo(); 60 void pickAddressTo();
58 void pickAddressCC(); 61 void pickAddressCC();
59 void pickAddressBCC(); 62 void pickAddressBCC();
60 void pickAddressReply(); 63 void pickAddressReply();
61 void saveAsDraft(); 64 void saveAsDraft();
62 void addAttachment(); 65 void addAttachment();
63 void removeAttachment(); 66 void removeAttachment();
64 void clearStatus(); 67 void clearStatus();
65 void setStatus( QString ); 68 void setStatus( QString );
66 69
67protected: 70protected:
71 QLineEdit* mPickLineEdit;
68 Opie::Core::OSmartPointer<Mail> mMail; 72 Opie::Core::OSmartPointer<Mail> mMail;
69 Settings *settings; 73 Settings *settings;
70 QList<SMTPaccount> smtpAccounts; 74 QList<SMTPaccount> smtpAccounts;
71 QString m_replyid; 75 QString m_replyid;
72 bool warnAttach; 76 bool warnAttach;
73}; 77};
74 78
75class AttachViewItem : public QListViewItem 79class AttachViewItem : public QListViewItem
76{ 80{
77public: 81public:
78 AttachViewItem( QListView *parent, Attachment *att ); 82 AttachViewItem( QListView *parent, Attachment *att );
79 Attachment *getAttachment() { return attachment; } 83 Attachment *getAttachment() { return attachment; }
80 84
81private: 85private:
82 Attachment *attachment; 86 Attachment *attachment;
83 87
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp
index 22f1200..a3e1b86 100644
--- a/kmicromail/main.cpp
+++ b/kmicromail/main.cpp
@@ -1,20 +1,22 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3
3#ifndef DESKTOP_VERSION 4#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
6#include <libkdepim/externalapphandler.h>
5#include <stdlib.h> 7#include <stdlib.h>
6#else 8#else
7#include <qapplication.h> 9#include <qapplication.h>
8#include <qstring.h> 10#include <qstring.h>
9#include <qwindowsstyle.h> 11#include <qwindowsstyle.h>
10#include <qplatinumstyle.h> 12#include <qplatinumstyle.h>
11#include <qsgistyle.h> 13#include <qsgistyle.h>
12#endif 14#endif
13#include "opiemail.h" 15#include "opiemail.h"
14#include <qdir.h> 16#include <qdir.h>
15#include <kstandarddirs.h> 17#include <kstandarddirs.h>
16#include <kglobal.h> 18#include <kglobal.h>
17#include <stdio.h> 19#include <stdio.h>
18#include "mainwindow.h" 20#include "mainwindow.h"
19 21
20using namespace Opie::Core; 22using namespace Opie::Core;
@@ -31,28 +33,29 @@ int main( int argc, char **argv ) {
31 KGlobal::setAppName( "kmicromail" ); 33 KGlobal::setAppName( "kmicromail" );
32 QString fileName ; 34 QString fileName ;
33#ifndef DESKTOP_VERSION 35#ifndef DESKTOP_VERSION
34 fileName = getenv("QPEDIR"); 36 fileName = getenv("QPEDIR");
35 if ( QApplication::desktop()->width() > 320 ) 37 if ( QApplication::desktop()->width() > 320 )
36 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/"); 38 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/");
37 else 39 else
38 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/"); 40 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/");
39#else 41#else
40 fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/"; 42 fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/";
41 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 43 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
42#endif 44#endif
43 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail"))); 45 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail")));
44 OpieMail mw; 46 OpieMail mw;
45#ifndef DESKTOP_VERSION 47#ifndef DESKTOP_VERSION
46 //qDebug("CONNECT "); 48 //qDebug("CONNECT ");
47 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); 49 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& )));
50 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
48 a.showMainWidget(&mw ); 51 a.showMainWidget(&mw );
49#else 52#else
50 a.setMainWidget(&mw ); 53 a.setMainWidget(&mw );
51 mw.show(); 54 mw.show();
52 //m.resize( 800, 600 ); 55 //m.resize( 800, 600 );
53 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 56 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
54#endif 57#endif
55 int rv = a.exec(); 58 int rv = a.exec();
56 return rv; 59 return rv;
57 60
58} 61}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 704a9ab..6df95c6 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -11,33 +11,33 @@
11 11
12#ifndef DESKTOP_VERSION 12#ifndef DESKTOP_VERSION
13#include <qpe/qpeapplication.h> 13#include <qpe/qpeapplication.h>
14#endif 14#endif
15#include "defines.h" 15#include "defines.h"
16#include "mainwindow.h" 16#include "mainwindow.h"
17#include <KDGanttMinimizeSplitter.h> 17#include <KDGanttMinimizeSplitter.h>
18 18
19 19
20#include <kabc/stdaddressbook.h> 20#include <kabc/stdaddressbook.h>
21 21
22MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 22MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
23 : QMainWindow( parent, name ) //, flags ) 23 : QMainWindow( parent, name ) //, flags )
24{ 24{
25 setCaption( tr( "KOpieMail/Pi" ) ); 25 setCaption( tr( "KOpieMail/Pi" ) );
26 setToolBarsMovable( false ); 26 setToolBarsMovable( false );
27 KABC::StdAddressBook::self(); 27 //KABC::StdAddressBook::self();
28 toolBar = new QToolBar( this ); 28 toolBar = new QToolBar( this );
29 menuBar = new QMenuBar( toolBar ); 29 menuBar = new QMenuBar( toolBar );
30 mailMenu = new QPopupMenu( menuBar ); 30 mailMenu = new QPopupMenu( menuBar );
31 menuBar->insertItem( tr( "Mail" ), mailMenu ); 31 menuBar->insertItem( tr( "Mail" ), mailMenu );
32 settingsMenu = new QPopupMenu( menuBar ); 32 settingsMenu = new QPopupMenu( menuBar );
33 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 33 menuBar->insertItem( tr( "Settings" ), settingsMenu );
34 34
35 addToolBar( toolBar ); 35 addToolBar( toolBar );
36 toolBar->setHorizontalStretchable( true ); 36 toolBar->setHorizontalStretchable( true );
37 37
38 38
39 39
40 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), 40 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"),
41 0, 0, this ); 41 0, 0, this );
42 composeMail->addTo( toolBar ); 42 composeMail->addTo( toolBar );
43 composeMail->addTo( mailMenu ); 43 composeMail->addTo( mailMenu );
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 251f15a..3e560c5 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -91,32 +91,33 @@ void OpieMail::slotwriteMail2(const QString& namemail )
91 if ( namemail.find( " <") > 1 ) { 91 if ( namemail.find( " <") > 1 ) {
92 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 92 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
93 } else 93 } else
94 if ( namemail.find( "<") > 1 ) { 94 if ( namemail.find( "<") > 1 ) {
95 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 95 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
96 } 96 }
97 int sub = to.find( ">:"); 97 int sub = to.find( ">:");
98 if ( sub > 0 ) { 98 if ( sub > 0 ) {
99 compose.setTo( to.left(sub+1) ); 99 compose.setTo( to.left(sub+1) );
100 compose.setSubject( to.mid(sub+2) ); 100 compose.setSubject( to.mid(sub+2) );
101 } else 101 } else
102 compose.setTo( to ); 102 compose.setTo( to );
103 } 103 }
104 compose.slotAdjustColumns(); 104 compose.slotAdjustColumns();
105 compose.showMaximized(); 105 compose.showMaximized();
106 compose.exec(); 106 compose.exec();
107 raise();
107 //qDebug("retttich "); 108 //qDebug("retttich ");
108} 109}
109void OpieMail::slotwriteMail(const QString&name,const QString&email) 110void OpieMail::slotwriteMail(const QString&name,const QString&email)
110{ 111{
111 // qDebug("OpieMail::slotwriteMail "); 112 // qDebug("OpieMail::slotwriteMail ");
112 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); 113 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
113 if (!email.isEmpty()) 114 if (!email.isEmpty())
114 { 115 {
115 if (!name.isEmpty()) 116 if (!name.isEmpty())
116 { 117 {
117 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 118 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
118 } 119 }
119 else 120 else
120 { 121 {
121 compose.setTo(email); 122 compose.setTo(email);
122 } 123 }
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 0866939..2f538c4 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -96,33 +96,33 @@ void KOEventViewer::setSource(const QString& n)
96 dia.resize( 400,400); 96 dia.resize( 400,400);
97 97
98 } 98 }
99 dia.exec(); 99 dia.exec();
100 break; 100 break;
101 } 101 }
102 } 102 }
103 return; 103 return;
104 } 104 }
105#else 105#else
106 { 106 {
107 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 107 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
108 if (attendees.count()) { 108 if (attendees.count()) {
109 Attendee *a; 109 Attendee *a;
110 for(a=attendees.first();a;a=attendees.next()) { 110 for(a=attendees.first();a;a=attendees.next()) {
111 if ( "uid:"+a->uid() == n ) { 111 if ( "uid:"+a->uid() == n ) {
112 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), ""); 112 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid());
113 return; 113 return;
114 } 114 }
115 } 115 }
116 } 116 }
117 return; 117 return;
118 } 118 }
119 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 119 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
120 // the result should now arrive through method insertAttendees 120 // the result should now arrive through method insertAttendees
121 //QString uid = "uid:"+(*it).uid(); 121 //QString uid = "uid:"+(*it).uid();
122#endif 122#endif
123 if ( n.left(6) == "mailto" ) { 123 if ( n.left(6) == "mailto" ) {
124 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); 124 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
125#ifndef DESKTOP_VERSION 125#ifndef DESKTOP_VERSION
126 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); 126 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
127 e << n.mid(7); 127 e << n.mid(7);
128#endif 128#endif