summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/emailclient.cpp322
-rw-r--r--noncore/net/mailit/emaillistitem.cpp73
-rw-r--r--noncore/net/mailit/emaillistitem.h3
-rw-r--r--noncore/net/mailit/mailit.pro6
-rw-r--r--noncore/net/mailit/mailitwindow.h1
-rw-r--r--noncore/net/mailit/main.cpp10
-rw-r--r--noncore/net/opieftp/main.cpp15
-rw-r--r--noncore/net/opieftp/opieftp.cpp58
-rw-r--r--noncore/net/opieftp/opieftp.h3
-rw-r--r--noncore/net/opieftp/opieftp.pro6
-rw-r--r--noncore/net/opieirc/.cvsignore1
-rw-r--r--noncore/net/opieirc/main.cpp9
-rw-r--r--noncore/net/opieirc/mainwindow.h1
-rw-r--r--noncore/net/opieirc/opieirc.pro7
-rw-r--r--noncore/net/opietooth/blue-pin/blue-pin.pro8
-rw-r--r--noncore/net/opietooth/manager/.cvsignore4
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp21
-rw-r--r--noncore/net/opietooth/manager/bluebase.h6
-rw-r--r--noncore/net/opietooth/manager/bluetoothbase.ui680
-rw-r--r--noncore/net/opietooth/manager/main.cpp17
-rw-r--r--noncore/net/opietooth/manager/manager.pro16
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogbase.ui44
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp120
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogimpl.h39
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogitem.cpp54
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogitem.h40
-rw-r--r--noncore/net/opietooth/manager/rfcommconfhandler.cpp114
-rw-r--r--noncore/net/opietooth/manager/rfcommconfhandler.h54
-rw-r--r--noncore/net/opietooth/manager/rfcommdialogitembase.ui216
-rw-r--r--noncore/net/opietooth/manager/rfcpopup.cpp21
-rw-r--r--noncore/net/opietooth/manager/rfcpopup.h9
-rw-r--r--noncore/net/opietooth/manager/stdpopups.cpp2
-rw-r--r--noncore/net/ubrowser/main.cpp13
-rw-r--r--noncore/net/ubrowser/mainview.cpp2
-rw-r--r--noncore/net/ubrowser/mainview.h3
-rw-r--r--noncore/net/ubrowser/ubrowser.pro4
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp322
-rw-r--r--noncore/unsupported/mailit/emaillistitem.cpp73
-rw-r--r--noncore/unsupported/mailit/emaillistitem.h3
-rw-r--r--noncore/unsupported/mailit/mailit.pro6
-rw-r--r--noncore/unsupported/mailit/mailitwindow.h1
-rw-r--r--noncore/unsupported/mailit/main.cpp10
42 files changed, 1626 insertions, 791 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp
index 90664bb..8359acf 100644
--- a/noncore/net/mailit/emailclient.cpp
+++ b/noncore/net/mailit/emailclient.cpp
@@ -21,1022 +21,1022 @@
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include <qvbox.h> 22#include <qvbox.h>
23#include <qfile.h> 23#include <qfile.h>
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qmenubar.h> 25#include <qmenubar.h>
26#include <qaction.h> 26#include <qaction.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qpe/resource.h> 28#include <qpe/resource.h>
29#include "emailclient.h" 29#include "emailclient.h"
30#include "writemail.h" 30#include "writemail.h"
31 31
32QCollection::Item AccountList::newItem(QCollection::Item d) 32QCollection::Item AccountList::newItem(QCollection::Item d)
33{ 33{
34 return dupl( (MailAccount *) d); 34 return dupl( (MailAccount *) d);
35} 35}
36 36
37MailAccount* AccountList::dupl(MailAccount *in) 37MailAccount* AccountList::dupl(MailAccount *in)
38{ 38{
39 ac = new MailAccount(*in); 39 ac = new MailAccount(*in);
40 return ac; 40 return ac;
41} 41}
42 42
43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) 43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
44 : QMainWindow( parent, name, fl ) 44 : QMainWindow( parent, name, fl )
45{ 45{
46 emailHandler = new EmailHandler(); 46 emailHandler = new EmailHandler();
47 addressList = new AddressList(); 47 addressList = new AddressList();
48 48
49 sending = FALSE; 49 sending = FALSE;
50 receiving = FALSE; 50 receiving = FALSE;
51 previewingMail = FALSE; 51 previewingMail = FALSE;
52 mailIdCount = 1; 52 mailIdCount = 1;
53 accountIdCount = 1; 53 accountIdCount = 1;
54 allAccounts = FALSE; 54 allAccounts = FALSE;
55 55
56 init(); 56 init();
57 57
58 58
59 59
60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); 60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) );
61 61
62 connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this, 62 connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this,
63 SLOT(smtpError(int,const QString &)) ); 63 SLOT(smtpError(int,const QString &)) );
64 connect(emailHandler, SIGNAL(popError(int,const QString &)), this, 64 connect(emailHandler, SIGNAL(popError(int,const QString &)), this,
65 SLOT(popError(int,const QString &)) ); 65 SLOT(popError(int,const QString &)) );
66 66
67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); 67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); 68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
69 69
70 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); 70 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) );
71 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); 71 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) );
72 72
73 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, 73 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
74 SLOT(mailArrived(const Email &, bool)) ); 74 SLOT(mailArrived(const Email &, bool)) );
75 connect(emailHandler, SIGNAL(mailTransfered(int)), this, 75 connect(emailHandler, SIGNAL(mailTransfered(int)), this,
76 SLOT(allMailArrived(int)) ); 76 SLOT(allMailArrived(int)) );
77 77
78 mailconf = new Config("mailit"); 78 mailconf = new Config("mailit");
79 //In case Synchronize is not defined in settings.txt 79 //In case Synchronize is not defined in settings.txt
80 80
81 readSettings(); 81 readSettings();
82 82
83 updateAccounts(); 83 updateAccounts();
84 84
85 lineShift = "\n"; 85 lineShift = "\n";
86 readMail(); 86 readMail();
87 lineShift = "\r\n"; 87 lineShift = "\r\n";
88 88
89 mailboxView->setCurrentTab(0); //ensure that inbox has focus 89 mailboxView->setCurrentTab(0); //ensure that inbox has focus
90 90
91 /*channel = new QCopChannel( "QPE/Application/mailit", this ); 91 /*channel = new QCopChannel( "QPE/Application/mailit", this );
92 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 92 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
93 this, SLOT(receive(const QCString&, const QByteArray&)) );*/ 93 this, SLOT(receive(const QCString&, const QByteArray&)) );*/
94 94
95} 95}
96 96
97 97
98EmailClient::~EmailClient() 98EmailClient::~EmailClient()
99{ 99{
100 //needs to be moved from destructor to closewindow event 100 //needs to be moved from destructor to closewindow event
101 saveMail(getPath(FALSE) + "inbox.txt", inboxView); 101 saveMail(getPath(FALSE) + "inbox.txt", inboxView);
102 //does not currently work. Defining outbox in the same 102 //does not currently work. Defining outbox in the same
103 //format as inbox is not a good solution as they have 103 //format as inbox is not a good solution as they have
104 //different properties 104 //different properties
105 saveMail(getPath(FALSE) + "outbox.txt", outboxView); 105 saveMail(getPath(FALSE) + "outbox.txt", outboxView);
106 saveSettings(); 106 saveSettings();
107 107
108 mailconf->write(); 108 mailconf->write();
109 delete mailconf; 109 delete mailconf;
110 110
111} 111}
112 112
113void EmailClient::init() 113void EmailClient::init()
114{ 114{
115 initStatusBar(this); 115 initStatusBar(this);
116 116
117 setToolBarsMovable(FALSE); 117 setToolBarsMovable(FALSE);
118 118
119 bar = new QToolBar(this); 119 bar = new QToolBar(this);
120 QWhatsThis::add(bar,tr("Main operation toolbar")); 120 QWhatsThis::add(bar,tr("Main operation toolbar"));
121 bar->setHorizontalStretchable( TRUE ); 121 bar->setHorizontalStretchable( TRUE );
122 122
123 mb = new QMenuBar( bar ); 123 mb = new QMenuBar( bar );
124 124
125 QPopupMenu *mail = new QPopupMenu(mb); 125 QPopupMenu *mail = new QPopupMenu(mb);
126 mb->insertItem( tr( "&Mail" ), mail); 126 mb->insertItem( tr( "&Mail" ), mail);
127 127
128 QPopupMenu *configure = new QPopupMenu(mb); 128 QPopupMenu *configure = new QPopupMenu(mb);
129 mb->insertItem( tr( "Accounts" ), configure); 129 mb->insertItem( tr( "Accounts" ), configure);
130 130
131 selectAccountMenu = new QPopupMenu(mb); 131 selectAccountMenu = new QPopupMenu(mb);
132 editAccountMenu = new QPopupMenu(mb); 132 editAccountMenu = new QPopupMenu(mb);
133 deleteAccountMenu = new QPopupMenu(mb); 133 deleteAccountMenu = new QPopupMenu(mb);
134 134
135 mail->insertItem(tr("Get Mail in"), selectAccountMenu); 135 mail->insertItem(tr("Get Mail in"), selectAccountMenu);
136 configure->insertItem(tr("Edit account"), editAccountMenu); 136 configure->insertItem(tr("Edit account"), editAccountMenu);
137 configure->insertItem(tr("Delete account"), deleteAccountMenu); 137 configure->insertItem(tr("Delete account"), deleteAccountMenu);
138 138
139 bar = new QToolBar(this); 139 bar = new QToolBar(this);
140 140
141 getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); 141 getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar);
142 QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account.")); 142 QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account."));
143 143
144 getMailButton->setPopup(selectAccountMenu); 144 getMailButton->setPopup(selectAccountMenu);
145 145
146 sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); 146 sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0);
147 connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); 147 connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) );
148 sendMailButton->addTo(bar); 148 sendMailButton->addTo(bar);
149 sendMailButton->addTo(mail); 149 sendMailButton->addTo(mail);
150 sendMailButton->setWhatsThis("Send mail queued in the outbox"); 150 sendMailButton->setWhatsThis("Send mail queued in the outbox");
151 151
152 composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); 152 composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0);
153 connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); 153 connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) );
154 composeButton->addTo(bar); 154 composeButton->addTo(bar);
155 composeButton->addTo(mail); 155 composeButton->addTo(mail);
156 composeButton->setWhatsThis("Compose a new mail"); 156 composeButton->setWhatsThis("Compose a new mail");
157 157
158 cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); 158 cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0);
159 connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); 159 connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) );
160 cancelButton->addTo(mail); 160 cancelButton->addTo(mail);
161 cancelButton->addTo(bar); 161 cancelButton->addTo(bar);
162 cancelButton->setEnabled(FALSE); 162 cancelButton->setEnabled(FALSE);
163 cancelButton->setWhatsThis("Stop the currently active mail transfer"); 163 cancelButton->setWhatsThis("Stop the currently active mail transfer");
164 164
165 165
166 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); 166 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
167 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); 167 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
168 deleteButton->addTo(bar); 168 deleteButton->addTo(bar);
169 deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); 169 deleteButton->setWhatsThis("Remove the currently selected eMail(s)");
170 170
171 mailboxView = new OTabWidget( this, "mailboxView" ); 171 mailboxView = new OTabWidget( this, "mailboxView" );
172 172
173 QWidget* widget = new QWidget( mailboxView, "widget" ); 173 QWidget* widget = new QWidget( mailboxView, "widget" );
174 grid_2 = new QGridLayout( widget ); 174 grid_2 = new QGridLayout( widget );
175// grid_2->setSpacing(6); 175// grid_2->setSpacing(6);
176// grid_2->setMargin( 11 ); 176// grid_2->setMargin( 11 );
177 177
178 inboxView = new QListView( widget, "inboxView" ); 178 inboxView = new QListView( widget, "inboxView" );
179 inboxView->addColumn( tr( "From" ) ); 179 inboxView->addColumn( tr( "From" ) );
180 inboxView->addColumn( tr( "Subject" ) ); 180 inboxView->addColumn( tr( "Subject" ) );
181 inboxView->addColumn( tr( "Date" ) ); 181 inboxView->addColumn( tr( "Date" ) );
182 inboxView->setMinimumSize( QSize( 0, 0 ) ); 182 inboxView->setMinimumSize( QSize( 0, 0 ) );
183 inboxView->setAllColumnsShowFocus(TRUE); 183 inboxView->setAllColumnsShowFocus(TRUE);
184 QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n" 184 QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n"
185 "It keeps the fetched mail which can be \n" 185 "It keeps the fetched mail which can be \n"
186 "viewed by double clicking the entry.\n" 186 "viewed by double clicking the entry.\n"
187 "blue attachment icon shows whether this \n" 187 "blue attachment icon shows whether this \n"
188 "mailhas attachments.\n")); 188 "mailhas attachments.\n"));
189 189
190 grid_2->addWidget( inboxView, 2, 0 ); 190 grid_2->addWidget( inboxView, 2, 0 );
191 mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); 191 mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) );
192 192
193 QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); 193 QWidget* widget_2 = new QWidget( mailboxView, "widget_2" );
194 grid_3 = new QGridLayout( widget_2 ); 194 grid_3 = new QGridLayout( widget_2 );
195// grid_3->setSpacing(6); 195// grid_3->setSpacing(6);
196// grid_3->setMargin( 11 ); 196// grid_3->setMargin( 11 );
197 197
198 outboxView = new QListView( widget_2, "outboxView" ); 198 outboxView = new QListView( widget_2, "outboxView" );
199 outboxView->addColumn( tr( "To" ) ); 199 outboxView->addColumn( tr( "To" ) );
200 outboxView->addColumn( tr( "Subject" ) ); 200 outboxView->addColumn( tr( "Subject" ) );
201 outboxView->setAllColumnsShowFocus(TRUE); 201 outboxView->setAllColumnsShowFocus(TRUE);
202 202
203 QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" 203 QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n"
204 "It keeps the queued mails to send which can be \n" 204 "It keeps the queued mails to send which can be \n"
205 "reviewed by double clicking the entry.")); 205 "reviewed by double clicking the entry."));
206 grid_3->addWidget( outboxView, 0, 0 ); 206 grid_3->addWidget( outboxView, 0, 0 );
207 mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); 207 mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) );
208 208
209 setCentralWidget(mailboxView); 209 setCentralWidget(mailboxView);
210 210
211} 211}
212 212
213void EmailClient::initStatusBar(QWidget* parent) 213void EmailClient::initStatusBar(QWidget* parent)
214{ 214{
215 statusBar = new QStatusBar(parent); 215 statusBar = new QStatusBar(parent);
216 statusBar->setSizeGripEnabled(FALSE); 216 statusBar->setSizeGripEnabled(FALSE);
217 217
218 status1Label = new QLabel( tr("Idle"), statusBar); 218 status1Label = new QLabel( tr("Idle"), statusBar);
219 status2Label = new QLabel("", statusBar); 219 status2Label = new QLabel("", statusBar);
220 connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), 220 connect(emailHandler, SIGNAL(updatePopStatus(const QString &)),
221 status2Label, SLOT(setText(const QString &)) ); 221 status2Label, SLOT(setText(const QString &)) );
222 connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), 222 connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)),
223 status2Label, SLOT(setText(const QString &)) ); 223 status2Label, SLOT(setText(const QString &)) );
224 224
225 progressBar = new QProgressBar(statusBar); 225 progressBar = new QProgressBar(statusBar);
226 226
227 connect(emailHandler, SIGNAL(mailboxSize(int)), 227 connect(emailHandler, SIGNAL(mailboxSize(int)),
228 this, SLOT(setTotalSize(int)) ); 228 this, SLOT(setTotalSize(int)) );
229 connect(emailHandler, SIGNAL(currentMailSize(int)), 229 connect(emailHandler, SIGNAL(currentMailSize(int)),
230 this, SLOT(setMailSize(int)) ); 230 this, SLOT(setMailSize(int)) );
231 connect(emailHandler, SIGNAL(downloadedSize(int)), 231 connect(emailHandler, SIGNAL(downloadedSize(int)),
232 this, SLOT(setDownloadedSize(int)) ); 232 this, SLOT(setDownloadedSize(int)) );
233 233
234 statusBar->addWidget(status1Label); 234 statusBar->addWidget(status1Label);
235 statusBar->addWidget(progressBar); 235 statusBar->addWidget(progressBar);
236 statusBar->addWidget(status2Label); 236 statusBar->addWidget(status2Label);
237 237
238} 238}
239 239
240void EmailClient::compose() 240void EmailClient::compose()
241{ 241{
242 emit composeRequested(); 242 emit composeRequested();
243} 243}
244 244
245void EmailClient::cancel() 245void EmailClient::cancel()
246{ 246{
247 emailHandler->cancel(); 247 emailHandler->cancel();
248} 248}
249 249
250AddressList* EmailClient::getAdrListRef() 250AddressList* EmailClient::getAdrListRef()
251{ 251{
252 return addressList; 252 return addressList;
253} 253}
254 254
255//this needs to be rewritten to syncronize with outboxView 255//this needs to be rewritten to syncronize with outboxView
256void EmailClient::enqueMail(const Email &mail) 256void EmailClient::enqueMail(const Email &mail)
257{ 257{
258 if (accountList.count() == 0) { 258 if (accountList.count() == 0) {
259 QMessageBox::warning(qApp->activeWindow(), 259 QMessageBox::warning(qApp->activeWindow(),
260 tr("No account selected"), tr("You must create an account"), "OK\n"); 260 tr("No account selected"), tr("You must create an account"), "OK\n");
261 return; 261 return;
262 } 262 }
263 263
264 if (accountList.count() > 0) { 264 if (accountList.count() > 0) {
265 currentAccount = accountList.first(); 265 currentAccount = accountList.first();
266 qWarning("using account " + currentAccount->name); 266 qWarning("using account " + currentAccount->name);
267 } 267 }
268 268
269 Email addMail = mail; 269 Email addMail = mail;
270 addMail.from = currentAccount->name; 270 addMail.from = currentAccount->name;
271 addMail.fromMail = currentAccount->emailAddress; 271 addMail.fromMail = currentAccount->emailAddress;
272 addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n"); 272 addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n");
273 item = new EmailListItem(outboxView, addMail, false); 273 item = new EmailListItem(outboxView, addMail, false);
274 274
275 mailboxView->setCurrentTab(1); 275 mailboxView->setCurrentTab(1);
276 276
277} 277}
278 278
279void EmailClient::sendQuedMail() 279void EmailClient::sendQuedMail()
280{ 280{
281 int count = 0; 281 int count = 0;
282 282
283 if (accountList.count() == 0) { 283 if (accountList.count() == 0) {
284 QMessageBox::warning(qApp->activeWindow(), "No account selected", "You must create an account", "OK\n"); 284 QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n");
285 return; 285 return;
286 } 286 }
287 //traverse listview, find messages to send 287 //traverse listview, find messages to send
288 if (! sending) { 288 if (! sending) {
289 item = (EmailListItem *) outboxView->firstChild(); 289 item = (EmailListItem *) outboxView->firstChild();
290 if (item != NULL) { 290 if (item != NULL) {
291 while (item != NULL) { 291 while (item != NULL) {
292 quedMessages.append(item->getMail()); 292 quedMessages.append(item->getMail());
293 item = (EmailListItem *) item->nextSibling(); 293 item = (EmailListItem *) item->nextSibling();
294 count++; 294 count++;
295 } 295 }
296 setMailAccount(); 296 setMailAccount();
297 emailHandler->sendMail(&quedMessages); 297 emailHandler->sendMail(&quedMessages);
298 sending = TRUE; 298 sending = TRUE;
299 sendMailButton->setEnabled(FALSE); 299 sendMailButton->setEnabled(FALSE);
300 cancelButton->setEnabled(TRUE); 300 cancelButton->setEnabled(TRUE);
301 } else { 301 } else {
302 qWarning("sendQuedMail(): no messages to send"); 302 qWarning("sendQuedMail(): no messages to send");
303 } 303 }
304 } 304 }
305} 305}
306 306
307void EmailClient::setMailAccount() 307void EmailClient::setMailAccount()
308{ 308{
309 emailHandler->setAccount(*currentAccount); 309 emailHandler->setAccount(*currentAccount);
310} 310}
311 311
312void EmailClient::mailSent() 312void EmailClient::mailSent()
313{ 313{
314 sending = FALSE; 314 sending = FALSE;
315 sendMailButton->setEnabled(TRUE); 315 sendMailButton->setEnabled(TRUE);
316 316
317 quedMessages.clear(); 317 quedMessages.clear();
318 outboxView->clear(); //should be moved to an sentBox 318 outboxView->clear(); //should be moved to an sentBox
319} 319}
320 320
321void EmailClient::getNewMail() { 321void EmailClient::getNewMail() {
322 322
323 if (accountList.count() == 0) { 323 if (accountList.count() == 0) {
324 QMessageBox::warning(qApp->activeWindow(),"No account selected", 324 QMessageBox::warning(qApp->activeWindow(),tr("No account selected"),
325 "You must create an account", "OK\n"); 325 tr("You must create an account"), "OK\n");
326 return; 326 return;
327 } 327 }
328 328
329 setMailAccount(); 329 setMailAccount();
330 330
331 receiving = TRUE; 331 receiving = TRUE;
332 previewingMail = TRUE; 332 previewingMail = TRUE;
333 getMailButton->setEnabled(FALSE); 333 getMailButton->setEnabled(FALSE);
334 cancelButton->setEnabled(TRUE); 334 cancelButton->setEnabled(TRUE);
335 selectAccountMenu->setEnabled(FALSE); 335 selectAccountMenu->setEnabled(FALSE);
336 336
337 status1Label->setText(currentAccount->accountName + " headers"); 337 status1Label->setText(currentAccount->accountName + " headers");
338 progressBar->reset(); 338 progressBar->reset();
339 339
340 //get any previous mails not downloaded and add to queue 340 //get any previous mails not downloaded and add to queue
341 /*mailDownloadList.clear(); 341 /*mailDownloadList.clear();
342 Email *mailPtr; 342 Email *mailPtr;
343 item = (EmailListItem *) inboxView->firstChild(); 343 item = (EmailListItem *) inboxView->firstChild();
344 while (item != NULL) { 344 while (item != NULL) {
345 mailPtr = item->getMail(); 345 mailPtr = item->getMail();
346 if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { 346 if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) {
347 mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); 347 mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size);
348 } 348 }
349 item = (EmailListItem *) item->nextSibling(); 349 item = (EmailListItem *) item->nextSibling();
350 }*/ 350 }*/
351 351
352 emailHandler->getMailHeaders(); 352 emailHandler->getMailHeaders();
353 353
354} 354}
355 355
356void EmailClient::getAllNewMail() 356void EmailClient::getAllNewMail()
357{ 357{
358 allAccounts = TRUE; 358 allAccounts = TRUE;
359 currentAccount = accountList.first(); 359 currentAccount = accountList.first();
360 getNewMail(); 360 getNewMail();
361} 361}
362 362
363void EmailClient::mailArrived(const Email &mail, bool fromDisk) 363void EmailClient::mailArrived(const Email &mail, bool fromDisk)
364{ 364{
365 Enclosure *ePtr; 365 Enclosure *ePtr;
366 Email newMail; 366 Email newMail;
367 int thisMailId; 367 int thisMailId;
368 emailHandler->parse( mail.rawMail, lineShift, &newMail); 368 emailHandler->parse( mail.rawMail, lineShift, &newMail);
369 mailconf->setGroup(newMail.id); 369 mailconf->setGroup(newMail.id);
370 370
371 if (fromDisk) 371 if (fromDisk)
372 { 372 {
373 373
374 newMail.downloaded = mailconf->readBoolEntry("downloaded"); 374 newMail.downloaded = mailconf->readBoolEntry("downloaded");
375 newMail.size = mailconf->readNumEntry("size"); 375 newMail.size = mailconf->readNumEntry("size");
376 newMail.serverId = mailconf->readNumEntry("serverid"); 376 newMail.serverId = mailconf->readNumEntry("serverid");
377 newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); 377 newMail.fromAccountId = mailconf->readNumEntry("fromaccountid");
378 } 378 }
379 else 379 else
380 { //mail arrived from server 380 { //mail arrived from server
381 381
382 newMail.serverId = mail.serverId; 382 newMail.serverId = mail.serverId;
383 newMail.size = mail.size; 383 newMail.size = mail.size;
384 newMail.downloaded = mail.downloaded; 384 newMail.downloaded = mail.downloaded;
385 385
386 newMail.fromAccountId = emailHandler->getAccount()->id; 386 newMail.fromAccountId = emailHandler->getAccount()->id;
387 mailconf->writeEntry("fromaccountid", newMail.fromAccountId); 387 mailconf->writeEntry("fromaccountid", newMail.fromAccountId);
388 } 388 }
389 389
390 //add if read or not 390 //add if read or not
391 newMail.read = mailconf->readBoolEntry("mailread"); 391 newMail.read = mailconf->readBoolEntry("mailread");
392 392
393 //check if new mail 393 //check if new mail
394 if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { 394 if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) {
395 thisMailId = mailIdCount; 395 thisMailId = mailIdCount;
396 mailIdCount++; 396 mailIdCount++;
397 397
398 //set server count, so that if the user aborts, the new 398 //set server count, so that if the user aborts, the new
399 //header is not reloaded 399 //header is not reloaded
400 if ((currentAccount)&&(currentAccount->synchronize)) 400 if ((currentAccount)&&(currentAccount->synchronize))
401 currentAccount->lastServerMailCount++; 401 currentAccount->lastServerMailCount++;
402 402
403 mailconf->writeEntry("internalmailid", thisMailId); 403 mailconf->writeEntry("internalmailid", thisMailId);
404 mailconf->writeEntry("downloaded", newMail.downloaded); 404 mailconf->writeEntry("downloaded", newMail.downloaded);
405 mailconf->writeEntry("size", (int) newMail.size); 405 mailconf->writeEntry("size", (int) newMail.size);
406 mailconf->writeEntry("serverid", newMail.serverId); 406 mailconf->writeEntry("serverid", newMail.serverId);
407 407
408 //addressList->addContact(newMail.fromMail, newMail.from); 408 //addressList->addContact(newMail.fromMail, newMail.from);
409 } 409 }
410 410
411 mailconf->writeEntry("downloaded", newMail.downloaded); 411 mailconf->writeEntry("downloaded", newMail.downloaded);
412 412
413 QString stringMailId; 413 QString stringMailId;
414 stringMailId.setNum(thisMailId); 414 stringMailId.setNum(thisMailId);
415 //see if any attatchments needs to be stored 415 //see if any attatchments needs to be stored
416 416
417 for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { 417 for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) {
418 QString stringId; 418 QString stringId;
419 stringId.setNum(ePtr->id); 419 stringId.setNum(ePtr->id);
420 420
421 int id = mailconf->readNumEntry("enclosureid_" + stringId); 421 int id = mailconf->readNumEntry("enclosureid_" + stringId);
422 if (id != ePtr->id) { //new entry 422 if (id != ePtr->id) { //new entry
423 mailconf->writeEntry("enclosureid_" + stringId, ePtr->id); 423 mailconf->writeEntry("enclosureid_" + stringId, ePtr->id);
424 mailconf->writeEntry("name_" + stringId, ePtr->originalName); 424 mailconf->writeEntry("name_" + stringId, ePtr->originalName);
425 mailconf->writeEntry("contenttype_" + stringId, ePtr->contentType); 425 mailconf->writeEntry("contenttype_" + stringId, ePtr->contentType);
426 mailconf->writeEntry("contentattribute_" + stringId, ePtr->contentAttribute); 426 mailconf->writeEntry("contentattribute_" + stringId, ePtr->contentAttribute);
427 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 427 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
428 mailconf->writeEntry("installed_" + stringId, FALSE); 428 mailconf->writeEntry("installed_" + stringId, FALSE);
429 429
430 ePtr->name = stringMailId + "_" + stringId; 430 ePtr->name = stringMailId + "_" + stringId;
431 ePtr->path = getPath(TRUE); 431 ePtr->path = getPath(TRUE);
432 if (emailHandler->getEnclosure(ePtr)) { //file saved 432 if (emailHandler->getEnclosure(ePtr)) { //file saved
433 ePtr->saved = TRUE; 433 ePtr->saved = TRUE;
434 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 434 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
435 mailconf->writeEntry("filename_" + stringId, ePtr->name); 435 mailconf->writeEntry("filename_" + stringId, ePtr->name);
436 mailconf->writeEntry("path_" + stringId, ePtr->path); 436 mailconf->writeEntry("path_" + stringId, ePtr->path);
437 } else { 437 } else {
438 ePtr->saved = FALSE; 438 ePtr->saved = FALSE;
439 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 439 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
440 } 440 }
441 } else { 441 } else {
442 ePtr->saved = mailconf->readBoolEntry("saved_" + stringId); 442 ePtr->saved = mailconf->readBoolEntry("saved_" + stringId);
443 ePtr->installed = mailconf->readBoolEntry("installed_" + stringId); 443 ePtr->installed = mailconf->readBoolEntry("installed_" + stringId);
444 if (ePtr->saved) { 444 if (ePtr->saved) {
445 ePtr->name = mailconf->readEntry("filename_" + stringId); 445 ePtr->name = mailconf->readEntry("filename_" + stringId);
446 ePtr->path = mailconf->readEntry("path_" + stringId); 446 ePtr->path = mailconf->readEntry("path_" + stringId);
447 } 447 }
448 } 448 }
449 } 449 }
450 450
451 bool found=false; 451 bool found=false;
452 452
453 if (!fromDisk) 453 if (!fromDisk)
454 { 454 {
455 455
456 Email *mailPtr; 456 Email *mailPtr;
457 item = (EmailListItem *) inboxView->firstChild(); 457 item = (EmailListItem *) inboxView->firstChild();
458 while ((item != NULL)&&(!found)) 458 while ((item != NULL)&&(!found))
459 { 459 {
460 mailPtr = item->getMail(); 460 mailPtr = item->getMail();
461 if (mailPtr->id == newMail.id) { 461 if (mailPtr->id == newMail.id) {
462 item->setMail(newMail); 462 item->setMail(newMail);
463 emit mailUpdated(item->getMail()); 463 emit mailUpdated(item->getMail());
464 found = true; 464 found = true;
465 } 465 }
466 item = (EmailListItem *) item->nextSibling(); 466 item = (EmailListItem *) item->nextSibling();
467 } 467 }
468 } 468 }
469 if ((!found)||(fromDisk)) { 469 if ((!found)||(fromDisk)) {
470 item = new EmailListItem(inboxView, newMail, TRUE); 470 item = new EmailListItem(inboxView, newMail, TRUE);
471 } 471 }
472// if (item->getMail()->files.count()>0) 472// if (item->getMail()->files.count()>0)
473// { 473// {
474// item->setPixmap(0, Resource::loadPixmap("mailit/attach")); 474// item->setPixmap(0, Resource::loadPixmap("mailit/attach"));
475// } 475// }
476 /*if (!newMail.downloaded) 476 /*if (!newMail.downloaded)
477 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ 477 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/
478 478
479 mailboxView->setCurrentTab(0); 479 mailboxView->setCurrentTab(0);
480 480
481} 481}
482 482
483void EmailClient::allMailArrived(int /*count*/) 483void EmailClient::allMailArrived(int /*count*/)
484{ 484{
485 // not previewing means all mailtransfer has been done 485 // not previewing means all mailtransfer has been done
486 /*if (!previewingMail) {*/ 486 /*if (!previewingMail) {*/
487 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { 487 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) {
488 emit newCaption("Mailit - " + currentAccount->accountName); 488 emit newCaption("Mailit - " + currentAccount->accountName);
489 getNewMail(); 489 getNewMail();
490 return; 490 return;
491 } else { 491 } else {
492 allAccounts = FALSE; 492 allAccounts = FALSE;
493 receiving = FALSE; 493 receiving = FALSE;
494 getMailButton->setEnabled(TRUE); 494 getMailButton->setEnabled(TRUE);
495 cancelButton->setEnabled(FALSE); 495 cancelButton->setEnabled(FALSE);
496 selectAccountMenu->setEnabled(TRUE); 496 selectAccountMenu->setEnabled(TRUE);
497 status1Label->setText("Idle"); 497 status1Label->setText("Idle");
498 498
499 progressBar->reset(); 499 progressBar->reset();
500 return; 500 return;
501 } 501 }
502 //} 502 //}
503 503
504 // all headers downloaded from server, start downloading remaining mails 504 // all headers downloaded from server, start downloading remaining mails
505 previewingMail = FALSE; 505 previewingMail = FALSE;
506 status1Label->setText(currentAccount->accountName); 506 status1Label->setText(currentAccount->accountName);
507 progressBar->reset(); 507 progressBar->reset();
508 508
509 509
510 mailboxView->setCurrentTab(0); 510 mailboxView->setCurrentTab(0);
511} 511}
512 512
513 513
514void EmailClient::moveMailFront(Email *mailPtr) 514void EmailClient::moveMailFront(Email *mailPtr)
515{ 515{
516 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { 516 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) {
517 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); 517 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size);
518 } 518 }
519} 519}
520 520
521void EmailClient::smtpError(int code, const QString & Msg) 521void EmailClient::smtpError(int code, const QString & Msg)
522{ 522{
523 QString temp; 523 QString temp;
524 524
525 if (code == ErrUnknownResponse) { 525 if (code == ErrUnknownResponse) {
526 temp = tr("<qt>Unknown response from server</qt>"); 526 temp = tr("<qt>Unknown response from server</qt>");
527 if( ! Msg.isEmpty() ) 527 if( ! Msg.isEmpty() )
528 temp += Msg; 528 temp += Msg;
529 } else if (code == QSocket::ErrHostNotFound) { 529 } else if (code == QSocket::ErrHostNotFound) {
530 temp = tr("<qt>host not found</qt>"); 530 temp = tr("<qt>host not found</qt>");
531 } else if (code == QSocket::ErrConnectionRefused) { 531 } else if (code == QSocket::ErrConnectionRefused) {
532 temp = tr("<qt>connection refused</qt>"); 532 temp = tr("<qt>connection refused</qt>");
533 } else if (code == QSocket::ErrSocketRead) { 533 } else if (code == QSocket::ErrSocketRead) {
534 temp = tr("<qt>socket packet error</qt>"); 534 temp = tr("<qt>socket packet error</qt>");
535 } 535 }
536 536
537 if (code != ErrCancel) { 537 if (code != ErrCancel) {
538 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n"); 538 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n");
539 } else { 539 } else {
540 status2Label->setText("Aborted by user"); 540 status2Label->setText("Aborted by user");
541 } 541 }
542 542
543 sending = FALSE; 543 sending = FALSE;
544 sendMailButton->setEnabled(TRUE); 544 sendMailButton->setEnabled(TRUE);
545 cancelButton->setEnabled(FALSE); 545 cancelButton->setEnabled(FALSE);
546 quedMessages.clear(); 546 quedMessages.clear();
547} 547}
548 548
549void EmailClient::popError(int code, const QString & Msg) 549void EmailClient::popError(int code, const QString & Msg)
550{ 550{
551 QString temp; 551 QString temp;
552 552
553 if (code == ErrUnknownResponse) { 553 if (code == ErrUnknownResponse) {
554 temp = tr("<qt>Unknown response from server</qt>"); 554 temp = tr("<qt>Unknown response from server</qt>");
555 if( ! Msg.isEmpty() ) 555 if( ! Msg.isEmpty() )
556 temp += Msg; 556 temp += Msg;
557 } else if (code == ErrLoginFailed) { 557 } else if (code == ErrLoginFailed) {
558 temp = tr("<qt>Login failed\nCheck user name and password</qt>"); 558 temp = tr("<qt>Login failed\nCheck user name and password</qt>");
559 } else if (code == QSocket::ErrHostNotFound) { 559 } else if (code == QSocket::ErrHostNotFound) {
560 temp = tr("<qt>host not found</qt>"); 560 temp = tr("<qt>host not found</qt>");
561 } else if (code == QSocket::ErrConnectionRefused) { 561 } else if (code == QSocket::ErrConnectionRefused) {
562 temp = tr("<qt>connection refused</qt>"); 562 temp = tr("<qt>connection refused</qt>");
563 } else if (code == QSocket::ErrSocketRead) { 563 } else if (code == QSocket::ErrSocketRead) {
564 temp = tr("<qt>socket packet error</qt>"); 564 temp = tr("<qt>socket packet error</qt>");
565 } 565 }
566 566
567 if (code != ErrCancel) { 567 if (code != ErrCancel) {
568 QMessageBox::warning(qApp->activeWindow(), tr("Receiving error"), temp, tr("OK\n")); 568 QMessageBox::warning(qApp->activeWindow(), tr("Receiving error"), temp, tr("OK\n"));
569 569
570 } else { 570 } else {
571 status2Label->setText("Aborted by user"); 571 status2Label->setText("Aborted by user");
572 } 572 }
573 573
574 receiving = FALSE; 574 receiving = FALSE;
575 getMailButton->setEnabled(TRUE); 575 getMailButton->setEnabled(TRUE);
576 cancelButton->setEnabled(FALSE); 576 cancelButton->setEnabled(FALSE);
577 selectAccountMenu->setEnabled(TRUE); 577 selectAccountMenu->setEnabled(TRUE);
578} 578}
579 579
580void EmailClient::inboxItemSelected() 580void EmailClient::inboxItemSelected()
581{ 581{
582 //killTimer(timerID); 582 //killTimer(timerID);
583 583
584 item = (EmailListItem*) inboxView->selectedItem(); 584 item = (EmailListItem*) inboxView->selectedItem();
585 if (item != NULL) { 585 if (item != NULL) {
586 emit viewEmail(inboxView, item->getMail()); 586 emit viewEmail(inboxView, item->getMail());
587 } 587 }
588} 588}
589 589
590void EmailClient::outboxItemSelected() 590void EmailClient::outboxItemSelected()
591{ 591{
592 //killTimer(timerID); 592 //killTimer(timerID);
593 593
594 item = (EmailListItem*) outboxView->selectedItem(); 594 item = (EmailListItem*) outboxView->selectedItem();
595 if (item != NULL) { 595 if (item != NULL) {
596 emit viewEmail(outboxView, item->getMail()); 596 emit viewEmail(outboxView, item->getMail());
597 } 597 }
598 598
599} 599}
600 600
601void EmailClient::readMail() 601void EmailClient::readMail()
602{ 602{
603 Email mail; 603 Email mail;
604 int start, stop; 604 int start, stop;
605 QString s, del; 605 QString s, del;
606 606
607 QFile f(getPath(FALSE) + "inbox.txt"); 607 QFile f(getPath(FALSE) + "inbox.txt");
608 608
609 if ( f.open(IO_ReadOnly) ) { // file opened successfully 609 if ( f.open(IO_ReadOnly) ) { // file opened successfully
610 QTextStream t( &f ); // use a text stream 610 QTextStream t( &f ); // use a text stream
611 s = t.read(); 611 s = t.read();
612 f.close(); 612 f.close();
613 613
614 start = 0; 614 start = 0;
615 del = "\n.\n"; 615 del = "\n.\n";
616 while ((uint) start < s.length()) { 616 while ((uint) start < s.length()) {
617 stop = s.find(del, start); 617 stop = s.find(del, start);
618 if (stop == -1) 618 if (stop == -1)
619 stop = s.length() - del.length(); 619 stop = s.length() - del.length();
620 620
621 mail.rawMail = s.mid(start, stop + del.length() - start ); 621 mail.rawMail = s.mid(start, stop + del.length() - start );
622 start = stop + del.length(); 622 start = stop + del.length();
623 mailArrived(mail, TRUE); 623 mailArrived(mail, TRUE);
624 } 624 }
625 } 625 }
626 626
627 QFile fo(getPath(FALSE) + "outbox.txt"); 627 QFile fo(getPath(FALSE) + "outbox.txt");
628 if ( fo.open(IO_ReadOnly) ) { // file opened successfully 628 if ( fo.open(IO_ReadOnly) ) { // file opened successfully
629 QTextStream t( &fo ); // use a text stream 629 QTextStream t( &fo ); // use a text stream
630 s = t.read(); 630 s = t.read();
631 fo.close(); 631 fo.close();
632 632
633 start = 0; 633 start = 0;
634 del = "\n.\n"; 634 del = "\n.\n";
635 while ((uint) start < s.length()) { 635 while ((uint) start < s.length()) {
636 stop = s.find(del, start); 636 stop = s.find(del, start);
637 if (stop == -1) 637 if (stop == -1)
638 stop = s.length() - del.length(); 638 stop = s.length() - del.length();
639 639
640 mail.rawMail = s.mid(start, stop + del.length() - start ); 640 mail.rawMail = s.mid(start, stop + del.length() - start );
641 start = stop + del.length(); 641 start = stop + del.length();
642 emailHandler->parse(mail.rawMail, lineShift, &mail); 642 emailHandler->parse(mail.rawMail, lineShift, &mail);
643 mail.sent = false; 643 mail.sent = false;
644 mail.received = false; 644 mail.received = false;
645 enqueMail(mail); 645 enqueMail(mail);
646 646
647 } 647 }
648 } 648 }
649} 649}
650 650
651void EmailClient::saveMail(const QString &fileName, QListView *view) 651void EmailClient::saveMail(const QString &fileName, QListView *view)
652{ 652{
653 QFile f(fileName); 653 QFile f(fileName);
654 Email *mail; 654 Email *mail;
655 655
656 if (! f.open(IO_WriteOnly) ) { 656 if (! f.open(IO_WriteOnly) ) {
657 qWarning("could not open file"); 657 qWarning("could not open file");
658 return; 658 return;
659 } 659 }
660 item = (EmailListItem *) view->firstChild(); 660 item = (EmailListItem *) view->firstChild();
661 QTextStream t(&f); 661 QTextStream t(&f);
662 while (item != NULL) { 662 while (item != NULL) {
663 mail = item->getMail(); 663 mail = item->getMail();
664 t << mail->rawMail; 664 t << mail->rawMail;
665 665
666 mailconf->setGroup(mail->id); 666 mailconf->setGroup(mail->id);
667 mailconf->writeEntry("mailread", mail->read); 667 mailconf->writeEntry("mailread", mail->read);
668 668
669 item = (EmailListItem *) item->nextSibling(); 669 item = (EmailListItem *) item->nextSibling();
670 } 670 }
671 f.close(); 671 f.close();
672} 672}
673 673
674//paths for mailit, is settings, inbox, enclosures 674//paths for mailit, is settings, inbox, enclosures
675QString EmailClient::getPath(bool enclosurePath) 675QString EmailClient::getPath(bool enclosurePath)
676{ 676{
677 QString basePath = "qtmail"; 677 QString basePath = "qtmail";
678 QString enclosures = "enclosures"; 678 QString enclosures = "enclosures";
679 679
680 QDir dir = (QString(getenv("HOME")) + "/Applications/" + basePath); 680 QDir dir = (QString(getenv("HOME")) + "/Applications/" + basePath);
681 if ( !dir.exists() ) 681 if ( !dir.exists() )
682 dir.mkdir( dir.path() ); 682 dir.mkdir( dir.path() );
683 683
684 if (enclosurePath) { 684 if (enclosurePath) {
685 dir = (QString(getenv("HOME")) + "/Applications/" + basePath + "/" + enclosures); 685 dir = (QString(getenv("HOME")) + "/Applications/" + basePath + "/" + enclosures);
686 686
687 if ( !dir.exists() ) 687 if ( !dir.exists() )
688 dir.mkdir( dir.path() ); 688 dir.mkdir( dir.path() );
689 689
690 return (dir.path() + "/"); 690 return (dir.path() + "/");
691 691
692 } 692 }
693 return (dir.path() + "/"); 693 return (dir.path() + "/");
694} 694}
695 695
696void EmailClient::readSettings() 696void EmailClient::readSettings()
697{ 697{
698 int y,acc_count; 698 int y,acc_count;
699 699
700 mailconf->setGroup("mailitglobal"); 700 mailconf->setGroup("mailitglobal");
701 acc_count=mailconf->readNumEntry("Accounts",0); 701 acc_count=mailconf->readNumEntry("Accounts",0);
702 702
703 for (int accountPos = 0;accountPos<acc_count ; accountPos++) 703 for (int accountPos = 0;accountPos<acc_count ; accountPos++)
704 { 704 {
705 mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... 705 mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ...
706 account.accountName = mailconf->readEntry("AccName",""); 706 account.accountName = mailconf->readEntry("AccName","");
707 account.name = mailconf->readEntry("UserName",""); 707 account.name = mailconf->readEntry("UserName","");
708 account.emailAddress = mailconf->readEntry("Email",""); 708 account.emailAddress = mailconf->readEntry("Email","");
709 account.popUserName = mailconf->readEntry("POPUser",""); 709 account.popUserName = mailconf->readEntry("POPUser","");
710 account.popPasswd = mailconf->readEntryCrypt("POPPassword",""); 710 account.popPasswd = mailconf->readEntryCrypt("POPPassword","");
711 account.popServer = mailconf->readEntry("POPServer",""); 711 account.popServer = mailconf->readEntry("POPServer","");
712 account.smtpServer = mailconf->readEntry("SMTPServer",""); 712 account.smtpServer = mailconf->readEntry("SMTPServer","");
713 account.id = mailconf->readNumEntry("AccountId",0); 713 account.id = mailconf->readNumEntry("AccountId",0);
714 account.syncLimit = mailconf->readNumEntry("HeaderLimit",0); 714 account.syncLimit = mailconf->readNumEntry("HeaderLimit",0);
715 account.lastServerMailCount = 0; 715 account.lastServerMailCount = 0;
716 account.synchronize = FALSE; 716 account.synchronize = FALSE;
717 717
718 account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); 718 account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes");
719 if (account.synchronize) 719 if (account.synchronize)
720 { 720 {
721 mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); 721 mailconf->readNumEntry("LASTSERVERMAILCOUNT",0);
722 } 722 }
723 723
724 accountList.append(&account); 724 accountList.append(&account);
725 } 725 }
726 726
727 mailconf->setGroup("mailitglobal"); 727 mailconf->setGroup("mailitglobal");
728 728
729 if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) 729 if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1)
730 { 730 {
731 mailIdCount = y; 731 mailIdCount = y;
732 } 732 }
733 if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) 733 if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1)
734 { 734 {
735 accountIdCount = y; 735 accountIdCount = y;
736 } 736 }
737} 737}
738 738
739void EmailClient::saveSettings() 739void EmailClient::saveSettings()
740{ 740{
741 int acc_count=0; 741 int acc_count=0;
742 MailAccount *accountPtr; 742 MailAccount *accountPtr;
743 743
744 744
745 if (!mailconf) 745 if (!mailconf)
746 { 746 {
747 qWarning("could not save settings"); 747 qWarning("could not save settings");
748 return; 748 return;
749 } 749 }
750 750
751 for (accountPtr = accountList.first(); accountPtr != 0; 751 for (accountPtr = accountList.first(); accountPtr != 0;
752 accountPtr = accountList.next()) 752 accountPtr = accountList.next())
753 { 753 {
754 mailconf->setGroup("Account_"+QString::number(++acc_count)); 754 mailconf->setGroup("Account_"+QString::number(++acc_count));
755 mailconf->writeEntry("AccName",accountPtr->accountName ); 755 mailconf->writeEntry("AccName",accountPtr->accountName );
756 mailconf->writeEntry("UserName",accountPtr->name); 756 mailconf->writeEntry("UserName",accountPtr->name);
757 mailconf->writeEntry("Email",accountPtr->emailAddress); 757 mailconf->writeEntry("Email",accountPtr->emailAddress);
758 mailconf->writeEntry("POPUser",accountPtr->popUserName); 758 mailconf->writeEntry("POPUser",accountPtr->popUserName);
759 mailconf->writeEntryCrypt("POPPassword",accountPtr->popPasswd); 759 mailconf->writeEntryCrypt("POPPassword",accountPtr->popPasswd);
760 mailconf->writeEntry("POPServer",accountPtr->popServer); 760 mailconf->writeEntry("POPServer",accountPtr->popServer);
761 mailconf->writeEntry("SMTPServer",accountPtr->smtpServer); 761 mailconf->writeEntry("SMTPServer",accountPtr->smtpServer);
762 mailconf->writeEntry("AccountId",accountPtr->id); 762 mailconf->writeEntry("AccountId",accountPtr->id);
763 if (accountPtr->synchronize) 763 if (accountPtr->synchronize)
764 { 764 {
765 mailconf->writeEntry("Synchronize","Yes"); 765 mailconf->writeEntry("Synchronize","Yes");
766 mailconf->writeEntry("HeaderLimit",accountPtr->syncLimit); 766 mailconf->writeEntry("HeaderLimit",accountPtr->syncLimit);
767 mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); 767 mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount);
768 } 768 }
769 else 769 else
770 { 770 {
771 mailconf->writeEntry("Synchronize", "No"); 771 mailconf->writeEntry("Synchronize", "No");
772 } 772 }
773 } 773 }
774 774
775 mailconf->setGroup("mailitglobal"); 775 mailconf->setGroup("mailitglobal");
776 mailconf->writeEntry("Accounts",acc_count); 776 mailconf->writeEntry("Accounts",acc_count);
777 mailconf->writeEntry("mailidcount", mailIdCount); 777 mailconf->writeEntry("mailidcount", mailIdCount);
778 mailconf->writeEntry("accountidcount", accountIdCount); 778 mailconf->writeEntry("accountidcount", accountIdCount);
779} 779}
780 780
781void EmailClient::selectAccount(int id) 781void EmailClient::selectAccount(int id)
782{ 782{
783 if (accountList.count() > 0) { 783 if (accountList.count() > 0) {
784 currentAccount = accountList.at(id); 784 currentAccount = accountList.at(id);
785 emit newCaption("Mailit - " + currentAccount->accountName); 785 emit newCaption("Mailit - " + currentAccount->accountName);
786 getNewMail(); 786 getNewMail();
787 } else { 787 } else {
788 emit newCaption("Mailit ! No account defined"); 788 emit newCaption( tr("Mailit ! No account defined") );
789 } 789 }
790} 790}
791 791
792void EmailClient::editAccount(int id) 792void EmailClient::editAccount(int id)
793{ 793{
794 MailAccount *newAccount; 794 MailAccount *newAccount;
795 795
796 editAccountView = new EditAccount(this, "account", TRUE); 796 editAccountView = new EditAccount(this, "account", TRUE);
797 if (id == newAccountId) { //new account 797 if (id == newAccountId) { //new account
798 newAccount = new MailAccount; 798 newAccount = new MailAccount;
799 editAccountView->setAccount(newAccount); 799 editAccountView->setAccount(newAccount);
800 } else { 800 } else {
801 newAccount = accountList.at(id); 801 newAccount = accountList.at(id);
802 editAccountView->setAccount(newAccount, FALSE); 802 editAccountView->setAccount(newAccount, FALSE);
803 } 803 }
804 804
805 editAccountView->showMaximized(); 805 editAccountView->showMaximized();
806 editAccountView->exec(); 806 editAccountView->exec();
807 807
808 if (editAccountView->result() == QDialog::Accepted) { 808 if (editAccountView->result() == QDialog::Accepted) {
809 if (id == newAccountId) { 809 if (id == newAccountId) {
810 newAccount->id = accountIdCount; 810 newAccount->id = accountIdCount;
811 accountIdCount++; 811 accountIdCount++;
812 accountList.append(newAccount); 812 accountList.append(newAccount);
813 updateAccounts(); 813 updateAccounts();
814 } else { 814 } else {
815 updateAccounts(); 815 updateAccounts();
816 } 816 }
817 } 817 }
818 818
819 delete editAccountView; 819 delete editAccountView;
820} 820}
821 821
822void EmailClient::deleteAccount(int id) 822void EmailClient::deleteAccount(int id)
823{ 823{
824 MailAccount *newAccount; 824 MailAccount *newAccount;
825 QString message; 825 QString message;
826 826
827 newAccount = accountList.at(id); 827 newAccount = accountList.at(id);
828 message = "Delete account:\n" + newAccount->accountName; 828 message = tr("Delete account:\n") + newAccount->accountName;
829 switch( QMessageBox::warning( this, "Mailit", message, 829 switch( QMessageBox::warning( this, "Mailit", message,
830 "Yes", "No", 0, 0, 1 ) ) { 830 "Yes", "No", 0, 0, 1 ) ) {
831 831
832 case 0: accountList.remove(id); 832 case 0: accountList.remove(id);
833 updateAccounts(); 833 updateAccounts();
834 break; 834 break;
835 case 1: 835 case 1:
836 break; 836 break;
837 } 837 }
838} 838}
839 839
840void EmailClient::updateAccounts() 840void EmailClient::updateAccounts()
841{ 841{
842 MailAccount *accountPtr; 842 MailAccount *accountPtr;
843 843
844 //rebuild menus, clear all first 844 //rebuild menus, clear all first
845 editAccountMenu->clear(); 845 editAccountMenu->clear();
846 selectAccountMenu->clear(); 846 selectAccountMenu->clear();
847 deleteAccountMenu->clear(); 847 deleteAccountMenu->clear();
848 848
849 newAccountId = editAccountMenu->insertItem("New", this, 849 newAccountId = editAccountMenu->insertItem( tr("New"), this,
850 SLOT(editAccount(int)) ); 850 SLOT(editAccount(int)) );
851 editAccountMenu->insertSeparator(); 851 editAccountMenu->insertSeparator();
852 852
853 idCount = 0; 853 idCount = 0;
854 for (accountPtr = accountList.first(); accountPtr != 0; 854 for (accountPtr = accountList.first(); accountPtr != 0;
855 accountPtr = accountList.next()) { 855 accountPtr = accountList.next()) {
856 856
857 editAccountMenu->insertItem(accountPtr->accountName, 857 editAccountMenu->insertItem(accountPtr->accountName,
858 this, SLOT(editAccount(int)), 0, idCount); 858 this, SLOT(editAccount(int)), 0, idCount);
859 selectAccountMenu->insertItem(accountPtr->accountName, 859 selectAccountMenu->insertItem(accountPtr->accountName,
860 this, SLOT(selectAccount(int)), 0, idCount); 860 this, SLOT(selectAccount(int)), 0, idCount);
861 deleteAccountMenu->insertItem(accountPtr->accountName, 861 deleteAccountMenu->insertItem(accountPtr->accountName,
862 this, SLOT(deleteAccount(int)), 0, idCount); 862 this, SLOT(deleteAccount(int)), 0, idCount);
863 idCount++; 863 idCount++;
864 } 864 }
865} 865}
866 866
867void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) 867void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox)
868{ 868{
869 Email *mPtr; 869 Email *mPtr;
870 Enclosure *ePtr; 870 Enclosure *ePtr;
871 871
872 if (inbox) 872 if (inbox)
873 { 873 {
874 mPtr = mailItem->getMail(); 874 mPtr = mailItem->getMail();
875 875
876 //if mail is in queue for download, remove it from 876 //if mail is in queue for download, remove it from
877 //queue if possible 877 //queue if possible
878 if ( (receiving) && (mPtr->fromAccountId == currentAccount->id) ) { 878 if ( (receiving) && (mPtr->fromAccountId == currentAccount->id) ) {
879 if ( !mPtr->downloaded ) 879 if ( !mPtr->downloaded )
880 mailDownloadList.remove(mPtr->serverId, mPtr->size); 880 mailDownloadList.remove(mPtr->serverId, mPtr->size);
881 } 881 }
882 882
883 mailconf->setGroup(mPtr->id); 883 mailconf->setGroup(mPtr->id);
884 mailconf->clearGroup(); 884 mailconf->clearGroup();
885 885
886 //delete any temporary attatchemnts storing 886 //delete any temporary attatchemnts storing
887 for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) { 887 for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) {
888 if (ePtr->saved) { 888 if (ePtr->saved) {
889 QFile::remove( (ePtr->path + ePtr->name) ); 889 QFile::remove( (ePtr->path + ePtr->name) );
890 } 890 }
891 } 891 }
892 inboxView->takeItem(mailItem); 892 inboxView->takeItem(mailItem);
893 } 893 }
894 else 894 else
895 { 895 {
896 outboxView->takeItem(mailItem); 896 outboxView->takeItem(mailItem);
897 } 897 }
898} 898}
899 899
900void EmailClient::setMailSize(int size) 900void EmailClient::setMailSize(int size)
901{ 901{
902 progressBar->reset(); 902 progressBar->reset();
903 progressBar->setTotalSteps(size); 903 progressBar->setTotalSteps(size);
904} 904}
905 905
906void EmailClient::setTotalSize(int /*size*/) 906void EmailClient::setTotalSize(int /*size*/)
907{ 907{
908 908
909} 909}
910 910
911void EmailClient::setDownloadedSize(int size) 911void EmailClient::setDownloadedSize(int size)
912{ 912{
913 int total = progressBar->totalSteps(); 913 int total = progressBar->totalSteps();
914 914
915 if (size < total) { 915 if (size < total) {
916 progressBar->setProgress(size); 916 progressBar->setProgress(size);
917 } else { 917 } else {
918 progressBar->setProgress(total); 918 progressBar->setProgress(total);
919 } 919 }
920} 920}
921 921
922void EmailClient::deleteItem() 922void EmailClient::deleteItem()
923{ 923{
924 bool inbox=mailboxView->currentTab()==0; 924 bool inbox=mailboxView->currentTab()==0;
925 QListView* box; 925 QListView* box;
926 926
927 EmailListItem* eli; 927 EmailListItem* eli;
928 // int pos; 928 // int pos;
929 929
930 inbox ? box=inboxView : box=outboxView; 930 inbox ? box=inboxView : box=outboxView;
931 931
932 eli=(EmailListItem*)box->selectedItem(); 932 eli=(EmailListItem*)box->selectedItem();
933 933
934 if (eli) 934 if (eli)
935 { 935 {
936 box->setSelected(eli->itemBelow(),true); //select the previous item 936 box->setSelected(eli->itemBelow(),true); //select the previous item
937 937
938 deleteMail(eli,(bool&)inbox); //remove mail entry 938 deleteMail(eli,(bool&)inbox); //remove mail entry
939 } 939 }
940} 940}
941 941
942void EmailClient::inboxItemPressed() 942void EmailClient::inboxItemPressed()
943{ 943{
944// timerID=startTimer(500); 944// timerID=startTimer(500);
945} 945}
946 946
947void EmailClient::inboxItemReleased() 947void EmailClient::inboxItemReleased()
948{ 948{
949 // killTimer(timerID); 949 // killTimer(timerID);
950} 950}
951 951
952/*void EmailClient::timerEvent(QTimerEvent *e) 952/*void EmailClient::timerEvent(QTimerEvent *e)
953{ 953{
954 //killTimer(timerID); 954 //killTimer(timerID);
955 955
956 956
957 QPopupMenu *action = new QPopupMenu(this); 957 QPopupMenu *action = new QPopupMenu(this);
958 958
959 int reply=0; 959 int reply=0;
960 960
961 action->insertItem(tr( "Reply To" ),this,SLOT(reply())); 961 action->insertItem(tr( "Reply To" ),this,SLOT(reply()));
962 action->insertItem( tr( "Reply All" ),this,SLOT(replyAll())); 962 action->insertItem( tr( "Reply All" ),this,SLOT(replyAll()));
963 action->insertItem( tr( "Forward" ), this,SLOT(forward())); 963 action->insertItem( tr( "Forward" ), this,SLOT(forward()));
964 action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); 964 action->insertItem( tr( "Remove Mail" ), this,SLOT(remove()));
965 965
966 action->exec(QCursor::pos()); 966 action->exec(QCursor::pos());
967 967
968 if (action) delete action; 968 if (action) delete action;
969 969
970}*/ 970}*/
971 971
972Email* EmailClient::getCurrentMail() 972Email* EmailClient::getCurrentMail()
973{ 973{
974 EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); 974 EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem());
975 if (eli!=NULL) 975 if (eli!=NULL)
976 return eli->getMail(); 976 return eli->getMail();
977 else 977 else
978 return NULL; 978 return NULL;
979} 979}
980 980
981void EmailClient::download(Email* mail) 981void EmailClient::download(Email* mail)
982{ 982{
983 MailAccount* acc=0; 983 MailAccount* acc=0;
984 984
985 tempMailDownloadList.clear(); 985 tempMailDownloadList.clear();
986 tempMailDownloadList.sizeInsert(mail->serverId, mail->size); 986 tempMailDownloadList.sizeInsert(mail->serverId, mail->size);
987 987
988 acc=accountList.at(mail->fromAccountId-1); 988 acc=accountList.at(mail->fromAccountId-1);
989 if (acc) 989 if (acc)
990 { 990 {
991 emailHandler->setAccount(*acc); 991 emailHandler->setAccount(*acc);
992 emailHandler->getMailByList(&tempMailDownloadList); 992 emailHandler->getMailByList(&tempMailDownloadList);
993 } 993 }
994 else 994 else
995 QMessageBox::warning(qApp->activeWindow(), 995 QMessageBox::warning(qApp->activeWindow(),
996 tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); 996 tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n");
997} 997}
998 998
999void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/) 999void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/)
1000{ 1000{
1001 /*if (msg=="getMail()") 1001 /*if (msg=="getMail()")
1002 { 1002 {
1003 //QDialog qd(qApp->activeWindow(),"Getting mail",true); 1003 //QDialog qd(qApp->activeWindow(),"Getting mail",true);
1004 QVBoxLayout *vbProg = new QVBoxLayout( &qd ); 1004 QVBoxLayout *vbProg = new QVBoxLayout( &qd );
1005 1005
1006 initStatusBar(&qd); 1006 initStatusBar(&qd);
1007 1007
1008 if (statusBar==0) 1008 if (statusBar==0)
1009 { 1009 {
1010 qDebug("No Bar ..."); 1010 qDebug("No Bar ...");
1011 //statusBar=new ProgressBar(&qd); 1011 //statusBar=new ProgressBar(&qd);
1012 } 1012 }
1013 statusBar->show(); 1013 statusBar->show();
1014 vbProg->addWidget(statusBar); 1014 vbProg->addWidget(statusBar);
1015 qd.showMaximized(); 1015 qd.showMaximized();
1016 qd.show(); 1016 qd.show();
1017 emit getAllNewMail(); 1017 emit getAllNewMail();
1018 //qd.exec(); 1018 //qd.exec();
1019 } 1019 }
1020 else if (msg=="compose()") 1020 else if (msg=="compose()")
1021 { 1021 {
1022 QDialog qd(qApp->activeWindow(),"Getting mail",true); 1022 QDialog qd(qApp->activeWindow(),"Getting mail",true);
1023 1023
1024 WriteMail wm(&qd,"write new mail"); 1024 WriteMail wm(&qd,"write new mail");
1025 QVBoxLayout vbProg( &qd ); 1025 QVBoxLayout vbProg( &qd );
1026 1026
1027 wm.showMaximized(); 1027 wm.showMaximized();
1028 vbProg.addWidget(&wm); 1028 vbProg.addWidget(&wm);
1029 1029
1030 qd.showMaximized(); 1030 qd.showMaximized();
1031 1031
1032 emit composeRequested(); 1032 emit composeRequested();
1033 qd.exec(); 1033 qd.exec();
1034 1034
1035 QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); 1035 QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n");
1036 } 1036 }
1037 1037
1038 else if (msg=="dialog()") 1038 else if (msg=="dialog()")
1039 { 1039 {
1040 QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); 1040 QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n");
1041 }*/ 1041 }*/
1042} 1042}
diff --git a/noncore/net/mailit/emaillistitem.cpp b/noncore/net/mailit/emaillistitem.cpp
index fc9f766..a25f93a 100644
--- a/noncore/net/mailit/emaillistitem.cpp
+++ b/noncore/net/mailit/emaillistitem.cpp
@@ -4,96 +4,155 @@
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qstring.h> 20#include <qstring.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include "emaillistitem.h" 22#include "emaillistitem.h"
23 23
24EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) 24EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox)
25 : QListViewItem(parent) 25 : QListViewItem(parent)
26{ 26{
27 QString temp; 27 QString temp;
28 28
29 mail = mailIn; 29 mail = mailIn;
30 30
31 if (inbox) { 31 if (inbox) {
32 setText(0, mail.from); 32 setText(0, mail.from);
33 } else { 33 } else {
34 QStringList::Iterator it = mail.recipients.begin(); 34 QStringList::Iterator it = mail.recipients.begin();
35 temp = *it; 35 temp = *it;
36 if (mail.recipients.count() > 1) 36 if (mail.recipients.count() > 1)
37 temp += "..."; 37 temp += "...";
38 setText(0, temp); 38 setText(0, temp);
39 } 39 }
40 setText(1, mail.subject); 40 setText(1, mail.subject);
41 setText(2,mail.date); 41 // setText(2,mail.date);
42 42 setText(2,dateFromULCString(mail.date));
43
43 if (mailIn.files.count()>0) 44 if (mailIn.files.count()>0)
44 { 45 {
45 setPixmap(0, Resource::loadPixmap("mailit/attach")); 46 setPixmap(0, Resource::loadPixmap("mailit/attach"));
46 } 47 }
47 48
48 selected = FALSE; 49 selected = FALSE;
49} 50}
50 51
51Email* EmailListItem::getMail() 52Email* EmailListItem::getMail()
52{ 53{
53 return &mail; 54 return &mail;
54} 55}
55 56
56void EmailListItem::setMail(Email newMail) 57void EmailListItem::setMail(Email newMail)
57{ 58{
58 mail = newMail; 59 mail = newMail;
59 repaint(); 60 repaint();
60} 61}
61 62
62void EmailListItem::setItemSelected(bool enable) 63void EmailListItem::setItemSelected(bool enable)
63{ 64{
64 selected = enable; 65 selected = enable;
65 setSelected(enable); 66 setSelected(enable);
66 repaint(); 67 repaint();
67} 68}
68 69
69bool EmailListItem::isItemSelected() 70bool EmailListItem::isItemSelected()
70{ 71{
71 return selected; 72 return selected;
72} 73}
73 74
74void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, 75void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg,
75 int column, int width, int alignment ) 76 int column, int width, int alignment )
76{ 77{
77 78
78 QColorGroup _cg( cg ); 79 QColorGroup _cg( cg );
79 QColor c = _cg.text(); 80 QColor c = _cg.text();
80 81
81 if ( (! mail.read) && (mail.received) ) 82 if ( (! mail.read) && (mail.received) )
82 _cg.setColor( QColorGroup::Text, Qt::blue); 83 _cg.setColor( QColorGroup::Text, Qt::blue);
83 if (!mail.downloaded) 84 if (!mail.downloaded)
84 _cg.setColor( QColorGroup::Text, Qt::red); 85 _cg.setColor( QColorGroup::Text, Qt::red);
85 86
86/* if (selected) { 87/* if (selected) {
87 _cg.setColor(QColorGroup::Base, Qt::blue); 88 _cg.setColor(QColorGroup::Base, Qt::blue);
88 _cg.setColor(QColorGroup::Text, Qt::yellow); 89 _cg.setColor(QColorGroup::Text, Qt::yellow);
89 if (isSelected()) { 90 if (isSelected()) {
90 _cg.setColor(QColorGroup::HighlightedText, Qt::yellow); 91 _cg.setColor(QColorGroup::HighlightedText, Qt::yellow);
91 } else { 92 } else {
92 _cg.setColor(QColorGroup::Highlight, Qt::blue); 93 _cg.setColor(QColorGroup::Highlight, Qt::blue);
93 } 94 }
94 } 95 }
95*/ 96*/
96 QListViewItem::paintCell( p, _cg, column, width, alignment ); 97 QListViewItem::paintCell( p, _cg, column, width, alignment );
97 98
98 _cg.setColor( QColorGroup::Text, c ); 99 _cg.setColor( QColorGroup::Text, c );
99} 100}
101
102/*
103 * Converts an E-Mail date (ULC) RFC 2822 conform to a QDateTime.
104 * Returning a QString with formatting of "YYYY-MM-DD HH:MM:SS"
105 * (zodiac: This method was tested with more than 300 inbox mails,
106 * it didn't slow down the loading of mail-it.)
107 */
108QString EmailListItem::dateFromULCString( QString ulcDate )
109{
110 QString sTemp, sTime;
111 int iPos, iDay, iMon=1, iYear;
112
113 iPos=ulcDate.find(',');
114 if (iPos) { // it has a day-of-week
115 ulcDate=ulcDate.remove(0,++iPos); //.stripWhiteSpace();
116 }
117
118 QStringList dateEntries = QStringList::split(" ",ulcDate,FALSE);
119 QStringList::Iterator iter = dateEntries.begin();
120
121 // Get day as DD
122 iDay = (*iter++).toInt();
123
124 // Get month as string Mmm
125 sTemp = (*iter++);
126 if (sTemp =="Jan") {iMon=1;} else
127 if (sTemp =="Feb") {iMon=2;} else
128 if (sTemp =="Mar") {iMon=3;} else
129 if (sTemp =="Apr") {iMon=4;} else
130 if (sTemp =="May") {iMon=5;} else
131 if (sTemp =="Jun") {iMon=6;} else
132 if (sTemp =="Jul") {iMon=7;} else
133 if (sTemp =="Aug") {iMon=8;} else
134 if (sTemp =="Sep") {iMon=9;} else
135 if (sTemp =="Oct") {iMon=10;} else
136 if (sTemp =="Nov") {iMon=11;} else
137 if (sTemp =="Dec") {iMon=12;}
138
139 // Get year as YYYY or YY
140 iYear = (*iter++).toInt();
141
142 QDate date = QDate(iYear, iMon, iDay);
143
144 // Convert timestring into a QTime
145 QStringList timeEntries = QStringList::split(":",(*iter++),FALSE);
146 QStringList::Iterator iterTime = timeEntries.begin();
147 iYear=(*iterTime++).toInt(); // var reuse.. *cough*
148 iMon=(*iterTime++).toInt();
149 iDay=(*iterTime++).toInt();
150 QTime time = QTime(iYear,iMon,iDay);
151
152 return QString::number(date.year())+"-"
153 +QString::number(date.month()).rightJustify(2,'0')+"-"
154 +QString::number(date.day()).rightJustify(2,'0')+" "
155 +time.toString();
156}
157
158
diff --git a/noncore/net/mailit/emaillistitem.h b/noncore/net/mailit/emaillistitem.h
index 642932c..129a774 100644
--- a/noncore/net/mailit/emaillistitem.h
+++ b/noncore/net/mailit/emaillistitem.h
@@ -11,34 +11,35 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef EMAILLISTITEM_H 20#ifndef EMAILLISTITEM_H
21#define EMAILLISTITEM_H 21#define EMAILLISTITEM_H
22 22
23#include <qlistview.h> 23#include <qlistview.h>
24#include "emailhandler.h" 24#include "emailhandler.h"
25 25
26class EmailListItem: public QListViewItem 26class EmailListItem: public QListViewItem
27{ 27{
28public: 28public:
29 EmailListItem(QListView *parent, Email mailIn, bool inbox); 29 EmailListItem(QListView *parent, Email mailIn, bool inbox);
30 Email* getMail(); 30 Email* getMail();
31 void setMail(Email newMail); 31 void setMail(Email newMail);
32 void setItemSelected(bool enable); 32 void setItemSelected(bool enable);
33 bool isItemSelected(); 33 bool isItemSelected();
34 bool itemSelected(); 34 bool itemSelected();
35 35
36protected: 36protected:
37 void paintCell( QPainter *p, const QColorGroup &cg, 37 void paintCell( QPainter *p, const QColorGroup &cg,
38 int column, int width, int alignment ); 38 int column, int width, int alignment );
39private: 39private:
40 Email mail; 40 Email mail;
41 bool selected; 41 bool selected;
42 QString dateFromULCString( QString ulc );
42}; 43};
43 44
44#endif 45#endif
diff --git a/noncore/net/mailit/mailit.pro b/noncore/net/mailit/mailit.pro
index 5e9a83a..0224886 100644
--- a/noncore/net/mailit/mailit.pro
+++ b/noncore/net/mailit/mailit.pro
@@ -1,63 +1,59 @@
1TEMPLATE = app
2TARGET = mailit 1TARGET = mailit
3CONFIG = qt warn_on release 2CONFIG = qt warn_on release quick-app
4HEADERS = emailclient.h \ 3HEADERS = emailclient.h \
5 emailhandler.h \ 4 emailhandler.h \
6 emaillistitem.h \ 5 emaillistitem.h \
7 mailitwindow.h \ 6 mailitwindow.h \
8 md5.h \ 7 md5.h \
9 popclient.h \ 8 popclient.h \
10 readmail.h \ 9 readmail.h \
11 smtpclient.h \ 10 smtpclient.h \
12 writemail.h \ 11 writemail.h \
13 textparser.h \ 12 textparser.h \
14 viewatt.h \ 13 viewatt.h \
15 addatt.h \ 14 addatt.h \
16 editaccount.h \ 15 editaccount.h \
17 maillist.h \ 16 maillist.h \
18 addresslist.h 17 addresslist.h
19SOURCES = emailclient.cpp \ 18SOURCES = emailclient.cpp \
20 emailhandler.cpp \ 19 emailhandler.cpp \
21 emaillistitem.cpp \ 20 emaillistitem.cpp \
22 mailitwindow.cpp \ 21 mailitwindow.cpp \
23 main.cpp \ 22 main.cpp \
24 md5.c \ 23 md5.c \
25 popclient.cpp \ 24 popclient.cpp \
26 readmail.cpp \ 25 readmail.cpp \
27 smtpclient.cpp \ 26 smtpclient.cpp \
28 writemail.cpp \ 27 writemail.cpp \
29 textparser.cpp \ 28 textparser.cpp \
30 viewatt.cpp \ 29 viewatt.cpp \
31 addatt.cpp \ 30 addatt.cpp \
32 editaccount.cpp \ 31 editaccount.cpp \
33 maillist.cpp \ 32 maillist.cpp \
34 addresslist.cpp 33 addresslist.cpp
35 34
36INCLUDEPATH += $(OPIEDIR)/include 35INCLUDEPATH += $(OPIEDIR)/include
37DEPENDPATH += $(OPIEDIR)/include 36DEPENDPATH += $(OPIEDIR)/include
38LIBS += -lqpe -lopie 37LIBS += -lqpe -lopie
39# -lssl 38# -lssl
40MOC_DIR=qpeobj
41OBJECTS_DIR=qpeobj
42DESTDIR=$(OPIEDIR)/bin
43 39
44TRANSLATIONS = ../../../i18n/de/mailit.ts \ 40TRANSLATIONS = ../../../i18n/de/mailit.ts \
45 ../../../i18n/nl/mailit.ts \ 41 ../../../i18n/nl/mailit.ts \
46 ../../../i18n/da/mailit.ts \ 42 ../../../i18n/da/mailit.ts \
47 ../../../i18n/xx/mailit.ts \ 43 ../../../i18n/xx/mailit.ts \
48 ../../../i18n/it/mailit.ts \ 44 ../../../i18n/it/mailit.ts \
49 ../../../i18n/en/mailit.ts \ 45 ../../../i18n/en/mailit.ts \
50 ../../../i18n/es/mailit.ts \ 46 ../../../i18n/es/mailit.ts \
51 ../../../i18n/fr/mailit.ts \ 47 ../../../i18n/fr/mailit.ts \
52 ../../../i18n/hu/mailit.ts \ 48 ../../../i18n/hu/mailit.ts \
53 ../../../i18n/ja/mailit.ts \ 49 ../../../i18n/ja/mailit.ts \
54 ../../../i18n/ko/mailit.ts \ 50 ../../../i18n/ko/mailit.ts \
55 ../../../i18n/no/mailit.ts \ 51 ../../../i18n/no/mailit.ts \
56 ../../../i18n/pl/mailit.ts \ 52 ../../../i18n/pl/mailit.ts \
57 ../../../i18n/pt/mailit.ts \ 53 ../../../i18n/pt/mailit.ts \
58 ../../../i18n/pt_BR/mailit.ts \ 54 ../../../i18n/pt_BR/mailit.ts \
59 ../../../i18n/sl/mailit.ts \ 55 ../../../i18n/sl/mailit.ts \
60 ../../../i18n/zh_CN/mailit.ts \ 56 ../../../i18n/zh_CN/mailit.ts \
61 ../../../i18n/zh_TW/mailit.ts 57 ../../../i18n/zh_TW/mailit.ts
62 58
63include ( $(OPIEDIR)/include.pro ) 59include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/mailit/mailitwindow.h b/noncore/net/mailit/mailitwindow.h
index e818d32..11e56b9 100644
--- a/noncore/net/mailit/mailitwindow.h
+++ b/noncore/net/mailit/mailitwindow.h
@@ -12,48 +12,49 @@
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef MailItWindow_H 20#ifndef MailItWindow_H
21#define MailItWindow_H 21#define MailItWindow_H
22 22
23#include <qmainwindow.h> 23#include <qmainwindow.h>
24#include <qwidgetstack.h> 24#include <qwidgetstack.h>
25#include <qevent.h> 25#include <qevent.h>
26//#include <qlayout.h> 26//#include <qlayout.h>
27#include "emailclient.h" 27#include "emailclient.h"
28#include "writemail.h" 28#include "writemail.h"
29#include "readmail.h" 29#include "readmail.h"
30#include "addresslist.h" 30#include "addresslist.h"
31 31
32class MailItWindow: public QMainWindow 32class MailItWindow: public QMainWindow
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35public: 35public:
36 static QString appName() { return QString::fromLatin1("mailit"); }
36 MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 37 MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
37 ~MailItWindow(); 38 ~MailItWindow();
38 39
39signals: 40signals:
40public slots: 41public slots:
41 void compose(); 42 void compose();
42 void composeReply(Email &, bool&); 43 void composeReply(Email &, bool&);
43 void composeForward(Email &); 44 void composeForward(Email &);
44 void showEmailClient(); 45 void showEmailClient();
45 void viewMail(QListView *, Email *mail); 46 void viewMail(QListView *, Email *mail);
46 void updateMailView(Email *mail); 47 void updateMailView(Email *mail);
47 void closeEvent(QCloseEvent *e); 48 void closeEvent(QCloseEvent *e);
48 void updateCaption(const QString &); 49 void updateCaption(const QString &);
49 void setDocument(const QString &); 50 void setDocument(const QString &);
50 /*void reply(Email&); 51 /*void reply(Email&);
51 void replyAll(Email&); 52 void replyAll(Email&);
52 void forward(Email&); 53 void forward(Email&);
53 void remove(Email&);*/ 54 void remove(Email&);*/
54 55
55private: 56private:
56 EmailClient *emailClient; 57 EmailClient *emailClient;
57 WriteMail *writeMail; 58 WriteMail *writeMail;
58 ReadMail *readMail; 59 ReadMail *readMail;
59 QWidgetStack *views; 60 QWidgetStack *views;
diff --git a/noncore/net/mailit/main.cpp b/noncore/net/mailit/main.cpp
index 3a3e1fc..71f8877 100644
--- a/noncore/net/mailit/main.cpp
+++ b/noncore/net/mailit/main.cpp
@@ -1,29 +1,25 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include "mailitwindow.h" 21#include "mailitwindow.h"
22 22
23int main(int argc, char* argv[]) 23#include <opie/oapplicationfactory.h>
24{ 24
25 QPEApplication a( argc, argv ); 25OPIE_EXPORT_APP( OApplicationFactory<MailItWindow> ) \ No newline at end of file
26 MailItWindow mw(0, 0);
27 a.showMainDocumentWidget(&mw);
28 return a.exec();
29}
diff --git a/noncore/net/opieftp/main.cpp b/noncore/net/opieftp/main.cpp
index 4f5a7d4..0217e41 100644
--- a/noncore/net/opieftp/main.cpp
+++ b/noncore/net/opieftp/main.cpp
@@ -1,27 +1,16 @@
1 1
2/*************************************************************************** 2/***************************************************************************
3 main.cpp - description 3 main.cpp - description
4 ------------------- 4 -------------------
5 begin : March 10, 2002 5 begin : March 10, 2002
6 copyright : (C) 2002 by llornkcor 6 copyright : (C) 2002 by llornkcor
7 email : ljp@llornkcor.com 7 email : ljp@llornkcor.com
8 * This program is free software; you can redistribute it and/or modify * 8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by * 9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or * 10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. * 11 * (at your option) any later version. *
12 ***************************************************************************/ 12 ***************************************************************************/
13#include <qpe/qpeapplication.h> 13#include <opie/oapplicationfactory.h>
14
15
16
17#include "opieftp.h" 14#include "opieftp.h"
18 15
19int main(int argc, char *argv[]) 16OPIE_EXPORT_APP( OApplicationFactory<OpieFtp> )
20{
21 QPEApplication a(argc, argv);
22
23 OpieFtp opieftp;
24 a.showMainWidget( &opieftp);
25 return a.exec();
26}
27
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 269449e..ee7d32f 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -36,73 +36,73 @@ extern "C" {
36#include <qtabwidget.h> 36#include <qtabwidget.h>
37#include <qlayout.h> 37#include <qlayout.h>
38#include <qmessagebox.h> 38#include <qmessagebox.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qlistbox.h> 40#include <qlistbox.h>
41 41
42#include <unistd.h> 42#include <unistd.h>
43#include <stdlib.h> 43#include <stdlib.h>
44 44
45 45
46QProgressBar *ProgressBar; 46QProgressBar *ProgressBar;
47static netbuf *conn=NULL; 47static netbuf *conn=NULL;
48 48
49static int log_progress(netbuf *, int xfered, void *) 49static int log_progress(netbuf *, int xfered, void *)
50{ 50{
51// int fsz = *(int *)arg; 51// int fsz = *(int *)arg;
52// int pct = (xfered * 100) / fsz; 52// int pct = (xfered * 100) / fsz;
53// printf("%3d%%\r", pct); 53// printf("%3d%%\r", pct);
54// fflush(stdout); 54// fflush(stdout);
55 ProgressBar->setProgress(xfered); 55 ProgressBar->setProgress(xfered);
56 qApp->processEvents(); 56 qApp->processEvents();
57 return 1; 57 return 1;
58} 58}
59 59
60OpieFtp::OpieFtp( ) 60OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
61 : QMainWindow( ) 61 : QMainWindow( parent, name, fl )
62{ 62{
63 setCaption( tr( "OpieFtp" ) ); 63 setCaption( tr( "OpieFtp" ) );
64 fuckeduphack=FALSE; 64 fuckeduphack=FALSE;
65 QGridLayout *layout = new QGridLayout( this ); 65 QGridLayout *layout = new QGridLayout( this );
66 layout->setSpacing( 2); 66 layout->setSpacing( 2);
67 layout->setMargin( 2); 67 layout->setMargin( 2);
68 68
69 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 69 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
70 70
71 QPEMenuBar *menuBar = new QPEMenuBar(this); 71 QPEMenuBar *menuBar = new QPEMenuBar(this);
72// QPEToolBar *menuBar = new QPEToolBar(this); 72// QPEToolBar *menuBar = new QPEToolBar(this);
73// menuBar->setHorizontalStretchable( TRUE ); 73// menuBar->setHorizontalStretchable( TRUE );
74 74
75 QWMatrix matrix; 75 QWMatrix matrix;
76 QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); 76 QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
77 matrix.scale( .4, .4); 77 matrix.scale( .4, .4);
78 unknownXpm = pix.xForm(matrix); 78 unknownXpm = pix.xForm(matrix);
79 79
80 connectionMenu = new QPopupMenu( this ); 80 connectionMenu = new QPopupMenu( this );
81 localMenu = new QPopupMenu( this ); 81 localMenu = new QPopupMenu( this );
82 remoteMenu = new QPopupMenu( this ); 82 remoteMenu = new QPopupMenu( this );
83 tabMenu = new QPopupMenu( this ); 83 tabMenu = new QPopupMenu( this );
84 84
85 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); 85 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
86 86
87 menuBar->insertItem( tr( "Connection" ), connectionMenu); 87 menuBar->insertItem( tr( "Connection" ), connectionMenu);
88// menuBar->insertItem( tr( "Local" ), localMenu); 88// menuBar->insertItem( tr( "Local" ), localMenu);
89// menuBar->insertItem( tr( "Remote" ), remoteMenu); 89// menuBar->insertItem( tr( "Remote" ), remoteMenu);
90 menuBar->insertItem( tr( "View" ), tabMenu); 90 menuBar->insertItem( tr( "View" ), tabMenu);
91 91
92 tabMenu->insertItem( tr( "Local" ), localMenu); 92 tabMenu->insertItem( tr( "Local" ), localMenu);
93 tabMenu->insertItem( tr( "Remote" ), remoteMenu); 93 tabMenu->insertItem( tr( "Remote" ), remoteMenu);
94 94
95 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 95 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
96 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 96 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
97 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 97 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
98 98
99 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 99 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
100 localMenu->insertSeparator(); 100 localMenu->insertSeparator();
101 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 101 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
102 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 102 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
103 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 103 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
104 localMenu->insertSeparator(); 104 localMenu->insertSeparator();
105 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 105 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
106 localMenu->setCheckable(TRUE); 106 localMenu->setCheckable(TRUE);
107 107
108 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 108 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
@@ -248,137 +248,137 @@ OpieFtp::OpieFtp( )
248 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, 248 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,
249 SLOT(serverComboEdited(const QString & ) )); 249 SLOT(serverComboEdited(const QString & ) ));
250 250
251 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 251 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
252 TextLabel5->setText( tr( "Remote path" ) ); 252 TextLabel5->setText( tr( "Remote path" ) );
253 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); 253 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
254 254
255 255
256 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 256 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
257 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); 257 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
258 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 258 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
259 TextLabel4->setText( tr( "Port" ) ); 259 TextLabel4->setText( tr( "Port" ) );
260 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 260 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
261 261
262 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 262 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
263 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 263 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
264 PortSpinBox->setMaxValue(32786); 264 PortSpinBox->setMaxValue(32786);
265 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 265 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
266 266
267 serverListView = new QListBox( tab_3, "ServerListView" ); 267 serverListView = new QListBox( tab_3, "ServerListView" );
268 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); 268 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5);
269 269
270 connect( serverListView, SIGNAL( highlighted( const QString &)), 270 connect( serverListView, SIGNAL( highlighted( const QString &)),
271 this,SLOT( serverListClicked( const QString &) ) ); 271 this,SLOT( serverListClicked( const QString &) ) );
272 272
273 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); 273 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" );
274 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); 274 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1);
275 connectServerBtn->setToggleButton(TRUE); 275 connectServerBtn->setToggleButton(TRUE);
276 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); 276 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) ));
277 277
278 newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); 278 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" );
279 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); 279 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2);
280 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); 280 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() ));
281 281
282 QPushButton *deleteServerBtn; 282 QPushButton *deleteServerBtn;
283 deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" ); 283 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" );
284 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); 284 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3);
285 285
286 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); 286 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
287 287
288 288
289 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 289 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
290 tabLayout_3->addItem( spacer, 5, 0 ); 290 tabLayout_3->addItem( spacer, 5, 0 );
291 291
292 TabWidget->insertTab( tab_3, tr( "Config" ) ); 292 TabWidget->insertTab( tab_3, tr( "Config" ) );
293 293
294 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 294 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
295 this,SLOT(tabChanged(QWidget*))); 295 this,SLOT(tabChanged(QWidget*)));
296 296
297 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 297 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
298 currentDir.setPath( QDir::currentDirPath()); 298 currentDir.setPath( QDir::currentDirPath());
299// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 299// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
300 300
301 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 301 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
302 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); 302 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
303 currentPathCombo ->setFixedWidth(220); 303 currentPathCombo ->setFixedWidth(220);
304 currentPathCombo->setEditable(TRUE); 304 currentPathCombo->setEditable(TRUE);
305 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 305 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
306 306
307 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 307 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
308 this, SLOT( currentPathComboActivated( const QString & ) ) ); 308 this, SLOT( currentPathComboActivated( const QString & ) ) );
309 309
310 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 310 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
311 this,SLOT(currentPathComboChanged())); 311 this,SLOT(currentPathComboChanged()));
312 312
313 ProgressBar = new QProgressBar( this, "ProgressBar" ); 313 ProgressBar = new QProgressBar( this, "ProgressBar" );
314 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); 314 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
315 ProgressBar->setMaximumHeight(10); 315 ProgressBar->setMaximumHeight(10);
316 filterStr="*"; 316 filterStr="*";
317 b=FALSE; 317 b=FALSE;
318 populateLocalView(); 318 populateLocalView();
319 readConfig(); 319 readConfig();
320 320
321// ServerComboBox->setCurrentItem(currentServerConfig); 321// ServerComboBox->setCurrentItem(currentServerConfig);
322 322
323 TabWidget->setCurrentPage(2); 323 TabWidget->setCurrentPage(2);
324} 324}
325 325
326OpieFtp::~OpieFtp() 326OpieFtp::~OpieFtp()
327{ 327{
328} 328}
329 329
330void OpieFtp::cleanUp() 330void OpieFtp::cleanUp()
331{ 331{
332 if(conn) 332 if(conn)
333 FtpQuit(conn); 333 FtpQuit(conn);
334 QString sfile=QDir::homeDirPath(); 334 QString sfile=QDir::homeDirPath();
335 if(sfile.right(1) != "/") 335 if(sfile.right(1) != "/")
336 sfile+="/._temp"; 336 sfile+="/._temp";
337 else 337 else
338 sfile+="._temp"; 338 sfile+="._temp";
339 QFile file( sfile); 339 QFile file( sfile);
340 if(file.exists()) 340 if(file.exists())
341 file.remove(); 341 file.remove();
342 Config cfg("opieftp"); 342 Config cfg("opieftp");
343 cfg.setGroup("Server"); 343 cfg.setGroup("Server");
344 cfg.writeEntry("currentServer", currentServerConfig); 344 cfg.writeEntry("currentServer", currentServerConfig);
345 345
346 exit(0); 346 exit(0);
347} 347}
348 348
349void OpieFtp::tabChanged(QWidget *) 349void OpieFtp::tabChanged(QWidget *)
350{ 350{
351 if (TabWidget->currentPageIndex() == 0) { 351 if (TabWidget->currentPageIndex() == 0) {
352 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 352 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
353 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 353 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
354 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 354 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
355 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 355 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
356 if(cdUpButton->isHidden()) 356 if(cdUpButton->isHidden())
357 cdUpButton->show(); 357 cdUpButton->show();
358 if(homeButton->isHidden()) 358 if(homeButton->isHidden())
359 homeButton->show(); 359 homeButton->show();
360 360
361 } 361 }
362 if (TabWidget->currentPageIndex() == 1) { 362 if (TabWidget->currentPageIndex() == 1) {
363 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 363 currentPathCombo->lineEdit()->setText( currentRemoteDir );
364 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); 364 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
365 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 365 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
366 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 366 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
367 if(cdUpButton->isHidden()) 367 if(cdUpButton->isHidden())
368 cdUpButton->show(); 368 cdUpButton->show();
369 homeButton->hide(); 369 homeButton->hide();
370 370
371 } 371 }
372 if (TabWidget->currentPageIndex() == 2) { 372 if (TabWidget->currentPageIndex() == 2) {
373 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); 373 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
374 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 374 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
375 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 375 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
376 cdUpButton->hide(); 376 cdUpButton->hide();
377 homeButton->hide(); 377 homeButton->hide();
378 } 378 }
379} 379}
380 380
381void OpieFtp::newConnection() 381void OpieFtp::newConnection()
382{ 382{
383 UsernameComboBox->lineEdit()->setText(""); 383 UsernameComboBox->lineEdit()->setText("");
384 PasswordEdit->setText( "" ); 384 PasswordEdit->setText( "" );
@@ -428,49 +428,49 @@ void OpieFtp::connector()
428 connectServerBtn->setOn(FALSE); 428 connectServerBtn->setOn(FALSE);
429 connectServerBtn->setText( tr("Connect")); 429 connectServerBtn->setText( tr("Connect"));
430 return; 430 return;
431 } 431 }
432 432
433 FtpInit(); 433 FtpInit();
434 434
435 TabWidget->setCurrentPage(1); 435 TabWidget->setCurrentPage(1);
436 QString ftp_host = ServerComboBox->currentText(); 436 QString ftp_host = ServerComboBox->currentText();
437 QString ftp_user = UsernameComboBox->currentText(); 437 QString ftp_user = UsernameComboBox->currentText();
438 QString ftp_pass = PasswordEdit->text(); 438 QString ftp_pass = PasswordEdit->text();
439 QString port=PortSpinBox->cleanText(); 439 QString port=PortSpinBox->cleanText();
440 port.stripWhiteSpace(); 440 port.stripWhiteSpace();
441 441
442 Config cfg("opieftp"); 442 Config cfg("opieftp");
443 cfg.setGroup("Server"); 443 cfg.setGroup("Server");
444// int current=cfg.readNumEntry("currentServer", 1); 444// int current=cfg.readNumEntry("currentServer", 1);
445 445
446// if(ftp_host!= cfg.readEntry(QString::number( current))) 446// if(ftp_host!= cfg.readEntry(QString::number( current)))
447// currentServerConfig=-1; 447// currentServerConfig=-1;
448// cfg.setGroup(QString::number(current)); 448// cfg.setGroup(QString::number(current));
449// if( ftp_user != cfg.readEntry("Username")) 449// if( ftp_user != cfg.readEntry("Username"))
450// currentServerConfig=-1; 450// currentServerConfig=-1;
451// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) 451// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username")))
452// currentServerConfig=-1; 452// currentServerConfig=-1;
453 453
454 454
455 if(ftp_host.find("ftp://",0, TRUE) != -1 ) 455 if(ftp_host.find("ftp://",0, TRUE) != -1 )
456 ftp_host=ftp_host.right(ftp_host.length()-6); 456 ftp_host=ftp_host.right(ftp_host.length()-6);
457 ftp_host+=":"+port; 457 ftp_host+=":"+port;
458 458
459 if (!FtpConnect( ftp_host.latin1(), &conn)) { 459 if (!FtpConnect( ftp_host.latin1(), &conn)) {
460 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); 460 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host);
461 connectServerBtn->setOn(FALSE); 461 connectServerBtn->setOn(FALSE);
462 connectServerBtn->setText( tr("Connect")); 462 connectServerBtn->setText( tr("Connect"));
463 return ; 463 return ;
464 } 464 }
465 465
466 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { 466 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
467 QString msg; 467 QString msg;
468 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); 468 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn));
469 msg.replace(QRegExp(":"),"\n"); 469 msg.replace(QRegExp(":"),"\n");
470 QMessageBox::message(tr("Note"),msg); 470 QMessageBox::message(tr("Note"),msg);
471 if(conn) 471 if(conn)
472 FtpQuit(conn); 472 FtpQuit(conn);
473 connectServerBtn->setOn(FALSE); 473 connectServerBtn->setOn(FALSE);
474 connectServerBtn->setText( tr("Connect")); 474 connectServerBtn->setText( tr("Connect"));
475 return ; 475 return ;
476 } 476 }
@@ -572,49 +572,49 @@ void OpieFtp::remoteDownload()
572 QString temp; 572 QString temp;
573 temp.sprintf( remoteFile+" "+" %dkb", fsz); 573 temp.sprintf( remoteFile+" "+" %dkb", fsz);
574 574
575 ProgressBar->setTotalSteps(fsz); 575 ProgressBar->setTotalSteps(fsz);
576 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 576 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
577 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 577 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
578 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 578 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
579 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 579 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
580 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); 580 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
581 581
582 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 582 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
583 QString msg; 583 QString msg;
584 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); 584 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
585 msg.replace(QRegExp(":"),"\n"); 585 msg.replace(QRegExp(":"),"\n");
586 QMessageBox::message(tr("Note"),msg); 586 QMessageBox::message(tr("Note"),msg);
587 } 587 }
588 ProgressBar->reset(); 588 ProgressBar->reset();
589 nullifyCallBack(); 589 nullifyCallBack();
590 it.current()->setSelected(FALSE); 590 it.current()->setSelected(FALSE);
591 } 591 }
592 } 592 }
593 for ( ; it.current(); ++it ) { 593 for ( ; it.current(); ++it ) {
594 Remote_View->clearSelection(); 594 Remote_View->clearSelection();
595 } 595 }
596 Remote_View->setFocus(); 596 Remote_View->setFocus();
597 TabWidget->setCurrentPage(0); 597 TabWidget->setCurrentPage(0);
598 populateLocalView(); 598 populateLocalView();
599// QCopEnvelope ( "QPE/System", "notBusy()" ); 599// QCopEnvelope ( "QPE/System", "notBusy()" );
600} 600}
601 601
602bool OpieFtp::remoteDirList(const QString &dir) 602bool OpieFtp::remoteDirList(const QString &dir)
603{ 603{
604 QString tmp = QDir::homeDirPath(); 604 QString tmp = QDir::homeDirPath();
605 if(tmp.right(1) != "/") 605 if(tmp.right(1) != "/")
606 tmp+="/._temp"; 606 tmp+="/._temp";
607 else 607 else
608 tmp+="._temp"; 608 tmp+="._temp";
609// qDebug("Listing remote dir "+tmp); 609// qDebug("Listing remote dir "+tmp);
610// QCopEnvelope ( "QPE/System", "busy()" ); 610// QCopEnvelope ( "QPE/System", "busy()" );
611 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 611 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
612 QString msg; 612 QString msg;
613 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); 613 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
614 msg.replace(QRegExp(":"),"\n"); 614 msg.replace(QRegExp(":"),"\n");
615 QMessageBox::message(tr("Note"),msg); 615 QMessageBox::message(tr("Note"),msg);
616 return false; 616 return false;
617 } 617 }
618 populateRemoteView() ; 618 populateRemoteView() ;
619// QCopEnvelope ( "QPE/System", "notBusy()" ); 619// QCopEnvelope ( "QPE/System", "notBusy()" );
620 return true; 620 return true;
@@ -648,49 +648,49 @@ void OpieFtp::populateLocalView()
648 QFileInfoListIterator it(*list); 648 QFileInfoListIterator it(*list);
649 QFileInfo *fi; 649 QFileInfo *fi;
650 while ( (fi=it.current()) ) { 650 while ( (fi=it.current()) ) {
651 if (fi->isSymLink() ){ 651 if (fi->isSymLink() ){
652 QString symLink=fi->readLink(); 652 QString symLink=fi->readLink();
653// qDebug("Symlink detected "+symLink); 653// qDebug("Symlink detected "+symLink);
654 QFileInfo sym( symLink); 654 QFileInfo sym( symLink);
655 fileS.sprintf( "%10i", sym.size() ); 655 fileS.sprintf( "%10i", sym.size() );
656 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 656 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
657 fileDate = sym.lastModified().toString(); 657 fileDate = sym.lastModified().toString();
658 } else { 658 } else {
659// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 659// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
660 fileS.sprintf( "%10i", fi->size() ); 660 fileS.sprintf( "%10i", fi->size() );
661 fileL.sprintf( "%s",fi->fileName().data() ); 661 fileL.sprintf( "%s",fi->fileName().data() );
662 fileDate= fi->lastModified().toString(); 662 fileDate= fi->lastModified().toString();
663 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 663 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
664 fileL+="/"; 664 fileL+="/";
665 isDir=TRUE; 665 isDir=TRUE;
666// qDebug( fileL); 666// qDebug( fileL);
667 } 667 }
668 } 668 }
669 if(fileL !="./" && fi->exists()) { 669 if(fileL !="./" && fi->exists()) {
670 item = new QListViewItem( Local_View,fileL, fileDate, fileS ); 670 item = new QListViewItem( Local_View,fileL, fileDate, fileS );
671 QPixmap pm; 671 QPixmap pm;
672 672
673 if(isDir || fileL.find("/",0,TRUE) != -1) { 673 if(isDir || fileL.find("/",0,TRUE) != -1) {
674 if( !QDir( fi->filePath() ).isReadable()) 674 if( !QDir( fi->filePath() ).isReadable())
675 pm = Resource::loadPixmap( "lockedfolder" ); 675 pm = Resource::loadPixmap( "lockedfolder" );
676 else 676 else
677 pm= Resource::loadPixmap( "folder" ); 677 pm= Resource::loadPixmap( "folder" );
678 item->setPixmap( 0,pm ); 678 item->setPixmap( 0,pm );
679 } else { 679 } else {
680 if( !fi->isReadable() ) 680 if( !fi->isReadable() )
681 pm = Resource::loadPixmap( "locked" ); 681 pm = Resource::loadPixmap( "locked" );
682 else { 682 else {
683 MimeType mt(fi->filePath()); 683 MimeType mt(fi->filePath());
684 pm=mt.pixmap(); //sets the correct pixmap for mimetype 684 pm=mt.pixmap(); //sets the correct pixmap for mimetype
685 if(pm.isNull()) 685 if(pm.isNull())
686 pm = unknownXpm; 686 pm = unknownXpm;
687 } 687 }
688 } 688 }
689 if( fileL.find("->",0,TRUE) != -1) { 689 if( fileL.find("->",0,TRUE) != -1) {
690 // overlay link image 690 // overlay link image
691 pm= Resource::loadPixmap( "folder" ); 691 pm= Resource::loadPixmap( "folder" );
692 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 692 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
693 QPainter painter( &pm ); 693 QPainter painter( &pm );
694 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 694 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
695 pm.setMask( pm.createHeuristicMask( FALSE ) ); 695 pm.setMask( pm.createHeuristicMask( FALSE ) );
696 } 696 }
@@ -708,49 +708,49 @@ bool OpieFtp::populateRemoteView( )
708{ 708{
709// qDebug("populate remoteview"); 709// qDebug("populate remoteview");
710 QString sfile=QDir::homeDirPath(); 710 QString sfile=QDir::homeDirPath();
711 if(sfile.right(1) != "/") 711 if(sfile.right(1) != "/")
712 sfile+="/._temp"; 712 sfile+="/._temp";
713 else 713 else
714 sfile+="._temp"; 714 sfile+="._temp";
715 QFile file( sfile); 715 QFile file( sfile);
716 Remote_View->clear(); 716 Remote_View->clear();
717 QString s, File_Name; 717 QString s, File_Name;
718 QListViewItem *itemDir=NULL, *itemFile=NULL; 718 QListViewItem *itemDir=NULL, *itemFile=NULL;
719 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); 719 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] ");
720 QString fileL, fileS, fileDate; 720 QString fileL, fileS, fileDate;
721 if ( file.open(IO_ReadOnly)) { 721 if ( file.open(IO_ReadOnly)) {
722 QTextStream t( &file ); // use a text stream 722 QTextStream t( &file ); // use a text stream
723 while ( !t.eof()) { 723 while ( !t.eof()) {
724 s = t.readLine(); 724 s = t.readLine();
725 725
726 if(s.find("total",0,TRUE) == 0) 726 if(s.find("total",0,TRUE) == 0)
727 continue; 727 continue;
728 728
729 int len, month = monthRe.match(s, 0, &len); 729 int len, month = monthRe.match(s, 0, &len);
730 fileDate = s.mid(month + 1, len - 2); // minus spaces 730 fileDate = s.mid(month + 1, len - 2); // minus spaces
731 fileL = s.right(s.length() - month - len); 731 fileL = s.right(s.length() - month - len);
732 if(s.left(1) == "d") 732 if(s.left(1) == "d")
733 fileL = fileL+"/"; 733 fileL = fileL+"/";
734 fileS = s.mid(month - 8, 8); // FIXME 734 fileS = s.mid(month - 8, 8); // FIXME
735 fileS = fileS.stripWhiteSpace(); 735 fileS = fileS.stripWhiteSpace();
736 736
737 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { 737 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
738 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); 738 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d");
739 item->setPixmap( 0, Resource::loadPixmap( "folder" )); 739 item->setPixmap( 0, Resource::loadPixmap( "folder" ));
740// if(itemDir) 740// if(itemDir)
741 item->moveItem(itemDir); 741 item->moveItem(itemDir);
742 itemDir=item; 742 itemDir=item;
743 } else { 743 } else {
744 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); 744 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f");
745 item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); 745 item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
746// if(itemFile) 746// if(itemFile)
747 item->moveItem(itemDir); 747 item->moveItem(itemDir);
748 item->moveItem(itemFile); 748 item->moveItem(itemFile);
749 itemFile=item; 749 itemFile=item;
750 } 750 }
751 } 751 }
752 QListViewItem * item1 = new QListViewItem( Remote_View, "../"); 752 QListViewItem * item1 = new QListViewItem( Remote_View, "../");
753 item1->setPixmap( 0, Resource::loadPixmap( "folder" )); 753 item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
754 file.close(); 754 file.close();
755 if( file.exists()) 755 if( file.exists())
756 file. remove(); 756 file. remove();
@@ -794,92 +794,92 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
794 currentRemoteDir = oldRemoteCurrentDir; 794 currentRemoteDir = oldRemoteCurrentDir;
795 strItem=""; 795 strItem="";
796// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 796// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
797 } 797 }
798 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory 798 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
799 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { 799 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
800 currentRemoteDir = oldRemoteCurrentDir; 800 currentRemoteDir = oldRemoteCurrentDir;
801 strItem=""; 801 strItem="";
802// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 802// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
803 803
804 } else { 804 } else {
805 currentRemoteDir = currentRemoteDir+strItem; 805 currentRemoteDir = currentRemoteDir+strItem;
806 } 806 }
807 } else { 807 } else {
808// QCopEnvelope ( "QPE/System", "notBusy()" ); 808// QCopEnvelope ( "QPE/System", "notBusy()" );
809 return; 809 return;
810 } 810 }
811 } 811 }
812 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 812 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
813 if(currentRemoteDir.right(1) !="/") 813 if(currentRemoteDir.right(1) !="/")
814 currentRemoteDir +="/"; 814 currentRemoteDir +="/";
815 currentPathCombo->lineEdit()->setText( currentRemoteDir); 815 currentPathCombo->lineEdit()->setText( currentRemoteDir);
816 fillRemoteCombo( (const QString &)currentRemoteDir); 816 fillRemoteCombo( (const QString &)currentRemoteDir);
817// QCopEnvelope ( "QPE/System", "notBusy()" ); 817// QCopEnvelope ( "QPE/System", "notBusy()" );
818 Remote_View->ensureItemVisible(Remote_View->firstChild()); 818 Remote_View->ensureItemVisible(Remote_View->firstChild());
819 819
820 } 820 }
821} 821}
822 822
823void OpieFtp::localListClicked(QListViewItem *selectedItem) 823void OpieFtp::localListClicked(QListViewItem *selectedItem)
824{ 824{
825 if(selectedItem!= NULL) { 825 if(selectedItem!= NULL) {
826 826
827 QString strItem=selectedItem->text(0); 827 QString strItem=selectedItem->text(0);
828 QString strSize=selectedItem->text(1); 828 QString strSize=selectedItem->text(1);
829 strSize=strSize.stripWhiteSpace(); 829 strSize=strSize.stripWhiteSpace();
830 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 830 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
831 // is symlink 831 // is symlink
832 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 832 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
833 if(QDir(strItem2).exists() ) { 833 if(QDir(strItem2).exists() ) {
834 currentDir.cd(strItem2, TRUE); 834 currentDir.cd(strItem2, TRUE);
835 populateLocalView(); 835 populateLocalView();
836 } 836 }
837 } else { // not a symlink 837 } else { // not a symlink
838 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 838 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
839 839
840 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 840 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
841 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 841 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
842 currentDir.cd(strItem,FALSE); 842 currentDir.cd(strItem,FALSE);
843 populateLocalView(); 843 populateLocalView();
844 } else { 844 } else {
845 currentDir.cdUp(); 845 currentDir.cdUp();
846 populateLocalView(); 846 populateLocalView();
847 } 847 }
848 if(QDir(strItem).exists()){ 848 if(QDir(strItem).exists()){
849 currentDir.cd(strItem, TRUE); 849 currentDir.cd(strItem, TRUE);
850 populateLocalView(); 850 populateLocalView();
851 } 851 }
852 } else { 852 } else {
853 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 853 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
854 if( QFile::exists(strItem ) ) { 854 if( QFile::exists(strItem ) ) {
855 // qDebug("upload "+strItem); 855 // qDebug("upload "+strItem);
856 return; 856 return;
857 } 857 }
858 } //end not symlink 858 } //end not symlink
859 chdir(strItem.latin1()); 859 chdir(strItem.latin1());
860 } 860 }
861 Local_View->ensureItemVisible(Local_View->firstChild()); 861 Local_View->ensureItemVisible(Local_View->firstChild());
862 } 862 }
863} 863}
864 864
865void OpieFtp::doLocalCd() 865void OpieFtp::doLocalCd()
866{ 866{
867 localListClicked( Local_View->currentItem()); 867 localListClicked( Local_View->currentItem());
868} 868}
869 869
870void OpieFtp:: doRemoteCd() 870void OpieFtp:: doRemoteCd()
871{ 871{
872 remoteListClicked( Remote_View->currentItem()); 872 remoteListClicked( Remote_View->currentItem());
873 873
874} 874}
875 875
876void OpieFtp::showHidden() 876void OpieFtp::showHidden()
877{ 877{
878 if (!b) { 878 if (!b) {
879 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 879 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
880 localMenu->setItemChecked(localMenu->idAt(0),TRUE); 880 localMenu->setItemChecked(localMenu->idAt(0),TRUE);
881// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 881// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
882 b=TRUE; 882 b=TRUE;
883 883
884 } else { 884 } else {
885 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 885 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
@@ -951,82 +951,82 @@ void OpieFtp::showLocalMenu(QListViewItem * item)
951 m->exec( QCursor::pos() ); 951 m->exec( QCursor::pos() );
952 delete m; 952 delete m;
953} 953}
954 954
955void OpieFtp::localMakDir() 955void OpieFtp::localMakDir()
956{ 956{
957 InputDialog *fileDlg; 957 InputDialog *fileDlg;
958 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 958 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
959 fileDlg->exec(); 959 fileDlg->exec();
960 if( fileDlg->result() == 1 ) { 960 if( fileDlg->result() == 1 ) {
961 QString filename = fileDlg->LineEdit1->text(); 961 QString filename = fileDlg->LineEdit1->text();
962 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 962 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
963 } 963 }
964 populateLocalView(); 964 populateLocalView();
965} 965}
966 966
967void OpieFtp::localDelete() 967void OpieFtp::localDelete()
968{ 968{
969 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 969 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
970 QListViewItemIterator it( Local_View ); 970 QListViewItemIterator it( Local_View );
971 for ( ; it.current(); ++it ) { 971 for ( ; it.current(); ++it ) {
972 if ( it.current()->isSelected() ) { 972 if ( it.current()->isSelected() ) {
973 QString f = it.current()->text(0); 973 QString f = it.current()->text(0);
974 it.current()->setSelected(FALSE); 974 it.current()->setSelected(FALSE);
975 975
976// QString f = Local_View->currentItem()->text(0); 976// QString f = Local_View->currentItem()->text(0);
977 if(QDir(f).exists() ) { 977 if(QDir(f).exists() ) {
978 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 978 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
979 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { 979 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
980 case 0: { 980 case 0: {
981 f=currentDir.canonicalPath()+"/"+f; 981 f=currentDir.canonicalPath()+"/"+f;
982 QString cmd="rmdir "+f; 982 QString cmd="rmdir "+f;
983 system( cmd.latin1()); 983 system( cmd.latin1());
984 } 984 }
985 break; 985 break;
986 case 1: 986 case 1:
987 // exit 987 // exit
988 break; 988 break;
989 }; 989 };
990 990
991 } else { 991 } else {
992 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 992 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
993 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 993 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
994 case 0: { 994 case 0: {
995 f=currentDir.canonicalPath()+"/"+f; 995 f=currentDir.canonicalPath()+"/"+f;
996 QString cmd="rm "+f; 996 QString cmd="rm "+f;
997 system( cmd.latin1()); 997 system( cmd.latin1());
998 } 998 }
999 break; 999 break;
1000 case 1: 1000 case 1:
1001 // exit 1001 // exit
1002 break; 1002 break;
1003 }; 1003 };
1004 } 1004 }
1005 } 1005 }
1006 } 1006 }
1007 populateLocalView(); 1007 populateLocalView();
1008 1008
1009} 1009}
1010 1010
1011void OpieFtp::remoteMakDir() 1011void OpieFtp::remoteMakDir()
1012{ 1012{
1013 InputDialog *fileDlg; 1013 InputDialog *fileDlg;
1014 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 1014 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
1015 fileDlg->exec(); 1015 fileDlg->exec();
1016 if( fileDlg->result() == 1 ) { 1016 if( fileDlg->result() == 1 ) {
1017 QString filename = fileDlg->LineEdit1->text();//+".playlist"; 1017 QString filename = fileDlg->LineEdit1->text();//+".playlist";
1018 QString tmp=currentRemoteDir+filename; 1018 QString tmp=currentRemoteDir+filename;
1019// QCopEnvelope ( "QPE/System", "busy()" ); 1019// QCopEnvelope ( "QPE/System", "busy()" );
1020 if(FtpMkdir( tmp.latin1(), conn) == 0) { 1020 if(FtpMkdir( tmp.latin1(), conn) == 0) {
1021 QString msg; 1021 QString msg;
1022 msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); 1022 msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn));
1023 msg.replace(QRegExp(":"),"\n"); 1023 msg.replace(QRegExp(":"),"\n");
1024 QMessageBox::message(tr("Note"),msg); 1024 QMessageBox::message(tr("Note"),msg);
1025 } 1025 }
1026// QCopEnvelope ( "QPE/System", "notBusy()" ); 1026// QCopEnvelope ( "QPE/System", "notBusy()" );
1027 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1027 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1028 } 1028 }
1029} 1029}
1030 1030
1031void OpieFtp::remoteDelete() 1031void OpieFtp::remoteDelete()
1032{ 1032{
@@ -1180,52 +1180,52 @@ void OpieFtp::currentPathComboChanged()
1180 } 1180 }
1181} 1181}
1182 1182
1183void OpieFtp::switchToLocalTab() 1183void OpieFtp::switchToLocalTab()
1184{ 1184{
1185 TabWidget->setCurrentPage(0); 1185 TabWidget->setCurrentPage(0);
1186} 1186}
1187 1187
1188void OpieFtp::switchToRemoteTab() 1188void OpieFtp::switchToRemoteTab()
1189{ 1189{
1190 TabWidget->setCurrentPage(1); 1190 TabWidget->setCurrentPage(1);
1191} 1191}
1192 1192
1193void OpieFtp::switchToConfigTab() 1193void OpieFtp::switchToConfigTab()
1194{ 1194{
1195 TabWidget->setCurrentPage(2); 1195 TabWidget->setCurrentPage(2);
1196} 1196}
1197 1197
1198void OpieFtp::readConfig() 1198void OpieFtp::readConfig()
1199{ 1199{
1200 fillCombos(); 1200 fillCombos();
1201 Config cfg("opieftp"); 1201 Config cfg("opieftp");
1202 cfg.setGroup("Server"); 1202 cfg.setGroup("Server");
1203 currentServerConfig = cfg.readNumEntry("currentServer", -1); 1203 currentServerConfig = cfg.readNumEntry("currentServer", -1);
1204 1204
1205// qDebug("Reading %d", currentServerConfig); 1205// qDebug("Reading %d", currentServerConfig);
1206 serverComboSelected( currentServerConfig-1); 1206 serverComboSelected( currentServerConfig-1);
1207 1207
1208} 1208}
1209 1209
1210void OpieFtp::writeConfig() 1210void OpieFtp::writeConfig()
1211{ 1211{
1212 qDebug("write config"); 1212 qDebug("write config");
1213 Config cfg("opieftp"); 1213 Config cfg("opieftp");
1214 cfg.setGroup("Server"); 1214 cfg.setGroup("Server");
1215 1215
1216 QString username, remoteServerStr, remotePathStr, password, port, temp; 1216 QString username, remoteServerStr, remotePathStr, password, port, temp;
1217 1217
1218 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1218 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1219 1219
1220 if( currentServerConfig == -1) { 1220 if( currentServerConfig == -1) {
1221 1221
1222 for (int i = 1; i <= numberOfEntries; i++) { 1222 for (int i = 1; i <= numberOfEntries; i++) {
1223 temp.setNum(i); 1223 temp.setNum(i);
1224 cfg.setGroup("Server"); 1224 cfg.setGroup("Server");
1225 QString tempStr = cfg.readEntry( temp,""); 1225 QString tempStr = cfg.readEntry( temp,"");
1226 } 1226 }
1227 1227
1228 temp.setNum( numberOfEntries + 1); 1228 temp.setNum( numberOfEntries + 1);
1229 cfg.setGroup("Server"); 1229 cfg.setGroup("Server");
1230 1230
1231 remoteServerStr = cfg.readEntry( temp,""); 1231 remoteServerStr = cfg.readEntry( temp,"");
@@ -1233,49 +1233,49 @@ void OpieFtp::writeConfig()
1233 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1233 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1234 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1234 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1235 1235
1236 temp.setNum(numberOfEntries+1); 1236 temp.setNum(numberOfEntries+1);
1237 cfg.setGroup("Server"); 1237 cfg.setGroup("Server");
1238 1238
1239 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); 1239 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() );
1240 cfg.writeEntry("currentServer", numberOfEntries+1); 1240 cfg.writeEntry("currentServer", numberOfEntries+1);
1241 1241
1242 currentServerConfig = numberOfEntries+1; 1242 currentServerConfig = numberOfEntries+1;
1243 qDebug("setting currentserverconfig to %d", currentServerConfig); 1243 qDebug("setting currentserverconfig to %d", currentServerConfig);
1244 1244
1245 cfg.setGroup(temp); 1245 cfg.setGroup(temp);
1246 if(!newServerName.isEmpty()) 1246 if(!newServerName.isEmpty())
1247 cfg.writeEntry("ServerName", newServerName); 1247 cfg.writeEntry("ServerName", newServerName);
1248 1248
1249 cfg.writeEntry("RemotePath", remotePath->text()); 1249 cfg.writeEntry("RemotePath", remotePath->text());
1250 1250
1251 cfg.writeEntry("Username", UsernameComboBox->currentText()); 1251 cfg.writeEntry("Username", UsernameComboBox->currentText());
1252 1252
1253 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); 1253 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text());
1254 cfg.setGroup("Server"); 1254 cfg.setGroup("Server");
1255 1255
1256 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); 1256 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 ));
1257 1257
1258 } 1258 }
1259} 1259}
1260 1260
1261void OpieFtp::clearCombos() { 1261void OpieFtp::clearCombos() {
1262 qDebug("clearing"); 1262 qDebug("clearing");
1263 ServerComboBox->clear(); 1263 ServerComboBox->clear();
1264 UsernameComboBox->clear(); 1264 UsernameComboBox->clear();
1265 PasswordEdit->clear(); 1265 PasswordEdit->clear();
1266 serverListView->clear(); 1266 serverListView->clear();
1267} 1267}
1268 1268
1269 1269
1270void OpieFtp::fillCombos() 1270void OpieFtp::fillCombos()
1271{ 1271{
1272 clearCombos(); 1272 clearCombos();
1273 1273
1274 Config cfg("opieftp"); 1274 Config cfg("opieftp");
1275 cfg.setGroup("Server"); 1275 cfg.setGroup("Server");
1276 QString username, remoteServerStr, remotePathStr, password, port, temp; 1276 QString username, remoteServerStr, remotePathStr, password, port, temp;
1277 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1277 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1278 1278
1279 for (int i = 1; i <= numberOfEntries; i++) { 1279 for (int i = 1; i <= numberOfEntries; i++) {
1280 temp.setNum(i); 1280 temp.setNum(i);
1281 qDebug(temp); 1281 qDebug(temp);
@@ -1305,81 +1305,81 @@ void OpieFtp::fillCombos()
1305 1305
1306 1306
1307void OpieFtp::serverComboSelected(int index) 1307void OpieFtp::serverComboSelected(int index)
1308{ 1308{
1309 currentServerConfig = index+1; 1309 currentServerConfig = index+1;
1310 qDebug("server combo selected %d", index+1); 1310 qDebug("server combo selected %d", index+1);
1311 QString username, remoteServerStr, remotePathStr, password, port, temp; 1311 QString username, remoteServerStr, remotePathStr, password, port, temp;
1312// remoteServerStr = ServerComboBox->text(index); 1312// remoteServerStr = ServerComboBox->text(index);
1313 1313
1314 Config cfg("opieftp"); 1314 Config cfg("opieftp");
1315 cfg.setGroup("Server"); 1315 cfg.setGroup("Server");
1316// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1316// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1317 1317
1318 temp.setNum(index+1); 1318 temp.setNum(index+1);
1319 remoteServerStr = cfg.readEntry( temp,""); 1319 remoteServerStr = cfg.readEntry( temp,"");
1320 1320
1321 qDebug("Group" +temp); 1321 qDebug("Group" +temp);
1322 cfg.setGroup(temp); 1322 cfg.setGroup(temp);
1323// qDebug(temp); 1323// qDebug(temp);
1324 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1324 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1325 port = remoteServerStr.right( divider - 1); 1325 port = remoteServerStr.right( divider - 1);
1326 bool ok; 1326 bool ok;
1327 int portInt = port.toInt(&ok,10); 1327 int portInt = port.toInt(&ok,10);
1328 if( portInt == 0) portInt = 21; 1328 if( portInt == 0) portInt = 21;
1329 1329
1330 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); 1330 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE)));
1331 1331
1332 PortSpinBox->setValue( portInt); 1332 PortSpinBox->setValue( portInt);
1333 1333
1334 remotePath->setText(cfg.readEntry("RemotePath", "/")); 1334 remotePath->setText(cfg.readEntry("RemotePath", "/"));
1335 1335
1336 username = cfg.readEntry("Username", "anonymous"); 1336 username = cfg.readEntry("Username", "anonymous");
1337 UsernameComboBox->lineEdit()->setText(username); 1337 UsernameComboBox->lineEdit()->setText(username);
1338 qDebug(username); 1338 qDebug(username);
1339// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); 1339// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org"));
1340 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); 1340 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
1341// UsernameComboBox 1341// UsernameComboBox
1342// PasswordEdit 1342// PasswordEdit
1343 1343
1344 cfg.setGroup("Server"); 1344 cfg.setGroup("Server");
1345 temp.sprintf("%d",currentServerConfig); 1345 temp.sprintf("%d",currentServerConfig);
1346 cfg.writeEntry("currentServer", temp); 1346 cfg.writeEntry("currentServer", temp);
1347 1347
1348 fuckeduphack = TRUE; 1348 fuckeduphack = TRUE;
1349 serverListView->setCurrentItem( index); 1349 serverListView->setCurrentItem( index);
1350 fuckeduphack=FALSE; 1350 fuckeduphack=FALSE;
1351 qDebug("server list set selected %d",index); 1351 qDebug("server list set selected %d",index);
1352 update(); 1352 update();
1353} 1353}
1354 1354
1355void OpieFtp::deleteServer() 1355void OpieFtp::deleteServer()
1356{ 1356{
1357 QString username, remoteServerStr, remotePathStr, password, port, temp, servername; 1357 QString username, remoteServerStr, remotePathStr, password, port, temp, servername;
1358 remoteServerStr = ServerComboBox->currentText( ); 1358 remoteServerStr = ServerComboBox->currentText( );
1359 username = UsernameComboBox->currentText(); 1359 username = UsernameComboBox->currentText();
1360 servername=serverListView->currentText(); 1360 servername=serverListView->currentText();
1361 1361
1362 Config cfg("opieftp"); 1362 Config cfg("opieftp");
1363 cfg.setGroup("Server"); 1363 cfg.setGroup("Server");
1364 QString tempname; 1364 QString tempname;
1365 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1365 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1366 1366
1367 for (int i = 1; i <= numberOfEntries; i++) { 1367 for (int i = 1; i <= numberOfEntries; i++) {
1368 temp.setNum(i); 1368 temp.setNum(i);
1369// cfg.setGroup("Server"); 1369// cfg.setGroup("Server");
1370 cfg.setGroup(QString::number(i)); 1370 cfg.setGroup(QString::number(i));
1371 tempname=cfg.readEntry( "ServerName",""); 1371 tempname=cfg.readEntry( "ServerName","");
1372 1372
1373 if( tempname.find( servername,0,TRUE) != -1 ) { 1373 if( tempname.find( servername,0,TRUE) != -1 ) {
1374// servername.find( cfg.readEntry("ServerName")) != -1 && 1374// servername.find( cfg.readEntry("ServerName")) != -1 &&
1375// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && 1375// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 &&
1376// username.find( cfg.readEntry("Username")) != -1) { 1376// username.find( cfg.readEntry("Username")) != -1) {
1377 1377
1378 serverListView->removeItem(i); 1378 serverListView->removeItem(i);
1379 1379
1380 qDebug("OK DELETE "+tempname); 1380 qDebug("OK DELETE "+tempname);
1381 cfg.removeEntry(QString::number(i)); 1381 cfg.removeEntry(QString::number(i));
1382 for ( ; i <= numberOfEntries; i++) { 1382 for ( ; i <= numberOfEntries; i++) {
1383 cfg.setGroup("Server"); 1383 cfg.setGroup("Server");
1384 cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); 1384 cfg.writeEntry("Server", QString::number(numberOfEntries + 1 ));
1385 1385
@@ -1472,44 +1472,44 @@ void OpieFtp::homeButtonPushed() {
1472void OpieFtp::doAbout() { 1472void OpieFtp::doAbout() {
1473 QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n" 1473 QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n"
1474 "L.J.Potter<llornkcor@handhelds.org>\n" 1474 "L.J.Potter<llornkcor@handhelds.org>\n"
1475 "and uses ftplib copyright 1996-2000\n" 1475 "and uses ftplib copyright 1996-2000\n"
1476 "by Thomas Pfau, pfau@cnj.digex.net\n\n" 1476 "by Thomas Pfau, pfau@cnj.digex.net\n\n"
1477 "and is licensed by the GPL"); 1477 "and is licensed by the GPL");
1478} 1478}
1479 1479
1480void OpieFtp::NewServer() { 1480void OpieFtp::NewServer() {
1481 InputDialog *fileDlg; 1481 InputDialog *fileDlg;
1482 fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0); 1482 fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0);
1483 fileDlg->exec(); 1483 fileDlg->exec();
1484 Config cfg("opieftp"); 1484 Config cfg("opieftp");
1485 if( fileDlg->result() == 1 ) { 1485 if( fileDlg->result() == 1 ) {
1486 newServerName = fileDlg->LineEdit1->text(); 1486 newServerName = fileDlg->LineEdit1->text();
1487 for(int i=1;i<serverListView->count();i++) { 1487 for(int i=1;i<serverListView->count();i++) {
1488 cfg.setGroup( QString::number(i)); 1488 cfg.setGroup( QString::number(i));
1489 if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) { 1489 if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) {
1490 QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken")); 1490 QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken"));
1491 return; 1491 return;
1492 } 1492 }
1493 } 1493 }
1494 currentServerConfig =-1; 1494 currentServerConfig =-1;
1495 writeConfig(); 1495 writeConfig();
1496 serverListView->insertItem( newServerName ); 1496 serverListView->insertItem( newServerName );
1497 serverListView->setCurrentItem( serverListView->count()); 1497 serverListView->setCurrentItem( serverListView->count());
1498 } 1498 }
1499} 1499}
1500 1500
1501void OpieFtp::serverListClicked( const QString &item) { 1501void OpieFtp::serverListClicked( const QString &item) {
1502 if(item.isEmpty()) return; 1502 if(item.isEmpty()) return;
1503 Config cfg("opieftp"); 1503 Config cfg("opieftp");
1504 qDebug("highltined "+item); 1504 qDebug("highltined "+item);
1505 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1505 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1506 for (int i = 1; i <= numberOfEntries; i++) { 1506 for (int i = 1; i <= numberOfEntries; i++) {
1507 cfg.setGroup(QString::number(i)); 1507 cfg.setGroup(QString::number(i));
1508 if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack) 1508 if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack)
1509 serverComboSelected(i-1); 1509 serverComboSelected(i-1);
1510 } 1510 }
1511} 1511}
1512 1512
1513void OpieFtp::timerOut() { 1513void OpieFtp::timerOut() {
1514 1514
1515} 1515}
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h
index 9d5d211..7bd615a 100644
--- a/noncore/net/opieftp/opieftp.h
+++ b/noncore/net/opieftp/opieftp.h
@@ -26,51 +26,52 @@ class QGridLayout;
26class QComboBox; 26class QComboBox;
27class QListView; 27class QListView;
28class QListViewItem; 28class QListViewItem;
29class QLabel; 29class QLabel;
30class QProgressBar; 30class QProgressBar;
31class QSpinBox; 31class QSpinBox;
32class QTabWidget; 32class QTabWidget;
33class QWidget; 33class QWidget;
34class QPEToolBar; 34class QPEToolBar;
35class QPEMenuBar; 35class QPEMenuBar;
36class QPopupMenu; 36class QPopupMenu;
37class QFile; 37class QFile;
38class QLineEdit; 38class QLineEdit;
39class QPushButton; 39class QPushButton;
40class QToolButton; 40class QToolButton;
41class QStringList; 41class QStringList;
42class QListBox; 42class QListBox;
43class QTimer; 43class QTimer;
44 44
45class OpieFtp : public QMainWindow 45class OpieFtp : public QMainWindow
46{ 46{
47 Q_OBJECT 47 Q_OBJECT
48 48
49public: 49public:
50 OpieFtp( ); 50 OpieFtp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
51 ~OpieFtp(); 51 ~OpieFtp();
52 52
53 static QString appName() { return QString::fromLatin1("opieftp"); }
53 QTabWidget *TabWidget; 54 QTabWidget *TabWidget;
54 QWidget *tab, *tab_2, *tab_3; 55 QWidget *tab, *tab_2, *tab_3;
55 QListView *Local_View, *Remote_View; 56 QListView *Local_View, *Remote_View;
56 QListBox *serverListView; 57 QListBox *serverListView;
57 58
58 QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; 59 QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo;
59 QLineEdit *PasswordEdit, *remotePath; 60 QLineEdit *PasswordEdit, *remotePath;
60 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; 61 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;;
61 QSpinBox* PortSpinBox; 62 QSpinBox* PortSpinBox;
62 QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu; 63 QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu;
63 QDir currentDir; 64 QDir currentDir;
64 QString currentRemoteDir; 65 QString currentRemoteDir;
65 QString filterStr; 66 QString filterStr;
66 QListViewItem * item; 67 QListViewItem * item;
67 QPushButton *connectServerBtn, *newServerButton;// 68 QPushButton *connectServerBtn, *newServerButton;//
68 QToolButton *cdUpButton, *homeButton, *docButton; 69 QToolButton *cdUpButton, *homeButton, *docButton;
69 bool b; 70 bool b;
70 int currentServerConfig; 71 int currentServerConfig;
71protected slots: 72protected slots:
72 void timerOut(); 73 void timerOut();
73 void upDir(); 74 void upDir();
74 void homeButtonPushed(); 75 void homeButtonPushed();
75 void docButtonPushed(); 76 void docButtonPushed();
76 void doAbout(); 77 void doAbout();
diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro
index ac16819..185c341 100644
--- a/noncore/net/opieftp/opieftp.pro
+++ b/noncore/net/opieftp/opieftp.pro
@@ -1,30 +1,28 @@
1TEMPLATE = app 1CONFIG += qt warn_on release quick-app
2CONFIG += qt warn_on release 2HEADERS = opieftp.h inputDialog.h
3HEADERS = opieftp.h inputDialog.h
4SOURCES = opieftp.cpp inputDialog.cpp main.cpp 3SOURCES = opieftp.cpp inputDialog.cpp main.cpp
5TARGET = opieftp 4TARGET = opieftp
6DESTDIR = $(OPIEDIR)/bin
7INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe -lftplib 7LIBS += -lqpe -lftplib
10 8
11TRANSLATIONS = ../../../i18n/de/opieftp.ts \ 9TRANSLATIONS = ../../../i18n/de/opieftp.ts \
12 ../../../i18n/nl/opieftp.ts \ 10 ../../../i18n/nl/opieftp.ts \
13 ../../../i18n/da/opieftp.ts \ 11 ../../../i18n/da/opieftp.ts \
14 ../../../i18n/xx/opieftp.ts \ 12 ../../../i18n/xx/opieftp.ts \
15 ../../../i18n/en/opieftp.ts \ 13 ../../../i18n/en/opieftp.ts \
16 ../../../i18n/es/opieftp.ts \ 14 ../../../i18n/es/opieftp.ts \
17 ../../../i18n/fr/opieftp.ts \ 15 ../../../i18n/fr/opieftp.ts \
18 ../../../i18n/hu/opieftp.ts \ 16 ../../../i18n/hu/opieftp.ts \
19 ../../../i18n/ja/opieftp.ts \ 17 ../../../i18n/ja/opieftp.ts \
20 ../../../i18n/ko/opieftp.ts \ 18 ../../../i18n/ko/opieftp.ts \
21 ../../../i18n/no/opieftp.ts \ 19 ../../../i18n/no/opieftp.ts \
22 ../../../i18n/pl/opieftp.ts \ 20 ../../../i18n/pl/opieftp.ts \
23 ../../../i18n/pt/opieftp.ts \ 21 ../../../i18n/pt/opieftp.ts \
24 ../../../i18n/pt_BR/opieftp.ts \ 22 ../../../i18n/pt_BR/opieftp.ts \
25 ../../../i18n/sl/opieftp.ts \ 23 ../../../i18n/sl/opieftp.ts \
26 ../../../i18n/zh_CN/opieftp.ts \ 24 ../../../i18n/zh_CN/opieftp.ts \
27 ../../../i18n/zh_TW/opieftp.ts 25 ../../../i18n/zh_TW/opieftp.ts
28 26
29 27
30 28
diff --git a/noncore/net/opieirc/.cvsignore b/noncore/net/opieirc/.cvsignore
index 39391f4..d5423d6 100644
--- a/noncore/net/opieirc/.cvsignore
+++ b/noncore/net/opieirc/.cvsignore
@@ -1,3 +1,4 @@
1Makefile 1Makefile
2Makefile.in 2Makefile.in
3moc_*.cpp 3moc_*.cpp
4.moc \ No newline at end of file
diff --git a/noncore/net/opieirc/main.cpp b/noncore/net/opieirc/main.cpp
index 43e63af..39acfcc 100644
--- a/noncore/net/opieirc/main.cpp
+++ b/noncore/net/opieirc/main.cpp
@@ -1,10 +1,7 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include "mainwindow.h" 2#include "mainwindow.h"
3 3
4int main(int argc, char **argv) { 4#include <opie/oapplicationfactory.h>
5 QPEApplication a(argc, argv);
6 MainWindow mw;
7 a.showMainWidget(&mw);
8 return a.exec();
9}
10 5
6
7OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
diff --git a/noncore/net/opieirc/mainwindow.h b/noncore/net/opieirc/mainwindow.h
index bd1a9ce..0f60855 100644
--- a/noncore/net/opieirc/mainwindow.h
+++ b/noncore/net/opieirc/mainwindow.h
@@ -14,39 +14,40 @@
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18
19*/ 19*/
20 20
21#ifndef __MAINWINDOW_H 21#ifndef __MAINWINDOW_H
22#define __MAINWINDOW_H 22#define __MAINWINDOW_H
23 23
24#include <qmainwindow.h> 24#include <qmainwindow.h>
25#include <qaction.h> 25#include <qaction.h>
26#include <qlist.h> 26#include <qlist.h>
27#include "mainwindow.h" 27#include "mainwindow.h"
28#include "ircmisc.h" 28#include "ircmisc.h"
29#include "irctab.h" 29#include "irctab.h"
30 30
31class MainWindow : public QMainWindow { 31class MainWindow : public QMainWindow {
32 Q_OBJECT 32 Q_OBJECT
33public: 33public:
34 MainWindow(QWidget *parent = 0, const char *name = 0, WFlags f = 0); 34 MainWindow(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
35// IRCTabWidget getTabWidget(); 35// IRCTabWidget getTabWidget();
36 void addTab(IRCTab *tab); 36 void addTab(IRCTab *tab);
37 void killTab(IRCTab *tab); 37 void killTab(IRCTab *tab);
38 static QString appName() { return QString::fromLatin1("opieirc"); }
38signals: 39signals:
39 void updateScroll(); 40 void updateScroll();
40protected slots: 41protected slots:
41 void newConnection(); 42 void newConnection();
42 void settings(); 43 void settings();
43 void selected(QWidget *); 44 void selected(QWidget *);
44 void changeEvent(IRCTab *); 45 void changeEvent(IRCTab *);
45protected: 46protected:
46 void loadSettings(); 47 void loadSettings();
47protected: 48protected:
48 IRCTabWidget *m_tabWidget; 49 IRCTabWidget *m_tabWidget;
49 QList<IRCTab> m_tabs; 50 QList<IRCTab> m_tabs;
50}; 51};
51 52
52#endif /* __MAINWINDOW_H */ 53#endif /* __MAINWINDOW_H */
diff --git a/noncore/net/opieirc/opieirc.pro b/noncore/net/opieirc/opieirc.pro
index 8b09e18..537f810 100644
--- a/noncore/net/opieirc/opieirc.pro
+++ b/noncore/net/opieirc/opieirc.pro
@@ -1,28 +1,25 @@
1 TEMPLATE= app 1 CONFIG = qt warn_on release quick-app
2 CONFIG = qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS = ircchannel.h ircconnection.h \ 2 HEADERS = ircchannel.h ircconnection.h \
5 ircmessage.h \ 3 ircmessage.h \
6 ircmessageparser.h ircoutput.h \ 4 ircmessageparser.h ircoutput.h \
7 ircperson.h ircserver.h ircsession.h \ 5 ircperson.h ircserver.h ircsession.h \
8 mainwindow.h irctab.h ircservertab.h \ 6 mainwindow.h irctab.h ircservertab.h \
9 ircchanneltab.h ircchannellist.h \ 7 ircchanneltab.h ircchannellist.h \
10 ircserverlist.h ircservereditor.h \ 8 ircserverlist.h ircservereditor.h \
11 ircquerytab.h ircsettings.h ircmisc.h 9 ircquerytab.h ircsettings.h ircmisc.h
12 SOURCES = ircchannel.cpp ircconnection.cpp \ 10 SOURCES = ircchannel.cpp ircconnection.cpp \
13 ircmessage.cpp \ 11 ircmessage.cpp \
14 ircmessageparser.cpp ircoutput.cpp \ 12 ircmessageparser.cpp ircoutput.cpp \
15 ircperson.cpp ircserver.cpp \ 13 ircperson.cpp ircserver.cpp \
16 ircsession.cpp main.cpp mainwindow.cpp \ 14 ircsession.cpp main.cpp mainwindow.cpp \
17 irctab.cpp ircservertab.cpp \ 15 irctab.cpp ircservertab.cpp \
18 ircchanneltab.cpp ircchannellist.cpp \ 16 ircchanneltab.cpp ircchannellist.cpp \
19 ircserverlist.cpp ircservereditor.cpp \ 17 ircserverlist.cpp ircservereditor.cpp \
20 ircquerytab.cpp ircsettings.cpp ircmisc.cpp 18 ircquerytab.cpp ircsettings.cpp ircmisc.cpp
21INCLUDEPATH += $(OPIEDIR)/include 19INCLUDEPATH += $(OPIEDIR)/include
22 DEPENDPATH+= $(OPIEDIR)/include 20 DEPENDPATH+= $(OPIEDIR)/include
23LIBS += -lqpe -lopie 21LIBS += -lqpe -lopie
24TARGET = opieirc
25
26 22
23 TARGET= opieirc
27 24
28include ( $(OPIEDIR)/include.pro ) 25include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/opietooth/blue-pin/blue-pin.pro b/noncore/net/opietooth/blue-pin/blue-pin.pro
index 102a937..fbf9dbe 100644
--- a/noncore/net/opietooth/blue-pin/blue-pin.pro
+++ b/noncore/net/opietooth/blue-pin/blue-pin.pro
@@ -1,34 +1,30 @@
1TEMPLATE = app 1CONFIG = qt warn_on release quick-app
2#CONFIG = qt warn_on debug
3CONFIG = qt warn_on release
4HEADERS = pindlg.h 2HEADERS = pindlg.h
5SOURCES = main.cc pindlg.cc 3SOURCES = main.cc pindlg.cc
6INCLUDEPATH += $(OPIEDIR)/include 4INCLUDEPATH += $(OPIEDIR)/include
7INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib 5INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib
8DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 7LIBS += -lqpe
10INTERFACES = pindlgbase.ui 8INTERFACES = pindlgbase.ui
11 DESTDIR = $(OPIEDIR)/bin 9 TARGET = bluepin
12TARGET = bluepin
13 10
14TRANSLATIONS = ../../../../i18n/de/bluepin.ts \ 11TRANSLATIONS = ../../../../i18n/de/bluepin.ts \
15 ../../../../i18n/nl/bluepin.ts \ 12 ../../../../i18n/nl/bluepin.ts \
16 ../../../../i18n/da/bluepin.ts \ 13 ../../../../i18n/da/bluepin.ts \
17 ../../../../i18n/xx/bluepin.ts \ 14 ../../../../i18n/xx/bluepin.ts \
18 ../../../../i18n/en/bluepin.ts \ 15 ../../../../i18n/en/bluepin.ts \
19 ../../../../i18n/es/bluepin.ts \ 16 ../../../../i18n/es/bluepin.ts \
20 ../../../../i18n/fr/bluepin.ts \ 17 ../../../../i18n/fr/bluepin.ts \
21 ../../../../i18n/hu/bluepin.ts \ 18 ../../../../i18n/hu/bluepin.ts \
22 ../../../../i18n/ja/bluepin.ts \ 19 ../../../../i18n/ja/bluepin.ts \
23 ../../../../i18n/ko/bluepin.ts \ 20 ../../../../i18n/ko/bluepin.ts \
24 ../../../../i18n/no/bluepin.ts \ 21 ../../../../i18n/no/bluepin.ts \
25 ../../../../i18n/pl/bluepin.ts \ 22 ../../../../i18n/pl/bluepin.ts \
26 ../../../../i18n/pt/bluepin.ts \ 23 ../../../../i18n/pt/bluepin.ts \
27 ../../../../i18n/pt_BR/bluepin.ts \ 24 ../../../../i18n/pt_BR/bluepin.ts \
28 ../../../../i18n/sl/bluepin.ts \ 25 ../../../../i18n/sl/bluepin.ts \
29 ../../../../i18n/zh_CN/bluepin.ts \ 26 ../../../../i18n/zh_CN/bluepin.ts \
30 ../../../../i18n/zh_TW/bluepin.ts 27 ../../../../i18n/zh_TW/bluepin.ts
31 28
32 29
33
34include ( $(OPIEDIR)/include.pro ) 30include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/opietooth/manager/.cvsignore b/noncore/net/opietooth/manager/.cvsignore
index 3fb67fe..19c03a7 100644
--- a/noncore/net/opietooth/manager/.cvsignore
+++ b/noncore/net/opietooth/manager/.cvsignore
@@ -1,9 +1,13 @@
1Makefile 1Makefile
2Makefile.in 2Makefile.in
3bluetoothbase.cpp 3bluetoothbase.cpp
4bluetoothbase.h 4bluetoothbase.h
5devicedialog.cpp 5devicedialog.cpp
6devicedialog.h 6devicedialog.h
7moc_* 7moc_*
8scandialog.cpp 8scandialog.cpp
9scandialog.h 9scandialog.h
10rfcommassigndialogbase.cpp
11rfcommassigndialogbase.h
12rfcommdialogitembase.cpp
13rfcommdialogitembase.h
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 54808fa..2e68984 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -1,86 +1,89 @@
1/* 1/*
2 * bluebase.cpp * 2 * bluebase.cpp *
3 * --------------------- 3 * ---------------------
4 * 4 *
5 * copyright : (c) 2002 by Maximilian Reiß 5 * copyright : (c) 2002 by Maximilian Reiß
6 * email : max.reiss@gmx.de 6 * email : max.reiss@gmx.de
7 * 7 *
8 */ 8 */
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include "bluebase.h" 18#include "bluebase.h"
19#include "scandialog.h" 19#include "scandialog.h"
20#include "hciconfwrapper.h" 20#include "hciconfwrapper.h"
21#include "devicehandler.h" 21#include "devicehandler.h"
22#include "btconnectionitem.h" 22#include "btconnectionitem.h"
23#include "rfcommassigndialogimpl.h"
23 24
24#include <remotedevice.h> 25#include <remotedevice.h>
25#include <services.h> 26#include <services.h>
26 27
27#include <stdlib.h> 28#include <stdlib.h>
28 29
29#include <qframe.h> 30#include <qframe.h>
30#include <qlabel.h> 31#include <qlabel.h>
31#include <qpushbutton.h> 32#include <qpushbutton.h>
32#include <qlayout.h> 33#include <qlayout.h>
33#include <qvariant.h> 34#include <qvariant.h>
34#include <qimage.h> 35#include <qimage.h>
35#include <qpixmap.h> 36#include <qpixmap.h>
36#include <qtabwidget.h> 37#include <qtabwidget.h>
37#include <qscrollview.h> 38#include <qscrollview.h>
38#include <qvbox.h> 39#include <qvbox.h>
39#include <qmessagebox.h> 40#include <qmessagebox.h>
40#include <qcheckbox.h> 41#include <qcheckbox.h>
41#include <qlineedit.h> 42#include <qlineedit.h>
42#include <qlistview.h> 43#include <qlistview.h>
43#include <qdir.h> 44#include <qdir.h>
44#include <qpopupmenu.h> 45#include <qpopupmenu.h>
45#include <qtimer.h> 46#include <qtimer.h>
46#include <qlist.h> 47#include <qlist.h>
47 48
48#include <qpe/qpeapplication.h> 49#include <qpe/qpeapplication.h>
49#include <qpe/resource.h> 50#include <qpe/resource.h>
50#include <qpe/config.h> 51#include <qpe/config.h>
51 52
52 53
53using namespace OpieTooth; 54using namespace OpieTooth;
54 55
55BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 56BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
56 : BluetoothBase( parent, name, fl ) { 57 : BluetoothBase( parent, name, fl ) {
57 58
58 m_localDevice = new Manager( "hci0" ); 59 m_localDevice = new Manager( "hci0" );
59 60
60 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 61 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
61 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 62 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
62 // not good since lib is async 63
64 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) );
65// not good since lib is async
63 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), 66 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ),
64 // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); 67 // this, SLOT( addServicesToDevice( QListViewItem * ) ) );
65 connect( ListView2, SIGNAL( clicked( QListViewItem* )), 68 connect( ListView2, SIGNAL( clicked( QListViewItem* )),
66 this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); 69 this, SLOT( startServiceActionClicked( QListViewItem* ) ) );
67 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), 70 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ),
68 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); 71 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) );
69 connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), 72 connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ),
70 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); 73 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) );
71 connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), 74 connect( m_localDevice, SIGNAL( available( const QString&, bool ) ),
72 this, SLOT( deviceActive( const QString& , bool ) ) ); 75 this, SLOT( deviceActive( const QString& , bool ) ) );
73 connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), 76 connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ),
74 this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); 77 this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) );
75 connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ), 78 connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ),
76 this, SLOT( addSignalStrength( const QString&, const QString& ) ) ); 79 this, SLOT( addSignalStrength( const QString&, const QString& ) ) );
77 80
78 81
79 // let hold be rightButtonClicked() 82 // let hold be rightButtonClicked()
80 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); 83 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold);
81 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); 84 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold);
82 85
83 //Load all icons needed 86 //Load all icons needed
84 m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); 87 m_offPix = Resource::loadPixmap( "opietooth/notconnected" );
85 m_onPix = Resource::loadPixmap( "opietooth/connected" ); 88 m_onPix = Resource::loadPixmap( "opietooth/connected" );
86 m_findPix = Resource::loadPixmap( "opietooth/find" ); 89 m_findPix = Resource::loadPixmap( "opietooth/find" );
@@ -201,71 +204,85 @@ void BlueBase::writeSavedDevices() {
201 204
202/** 205/**
203 * Set up the gui 206 * Set up the gui
204 */ 207 */
205void BlueBase::initGui() { 208void BlueBase::initGui() {
206 StatusLabel->setText( status() ); // maybe move it to getStatus() 209 StatusLabel->setText( status() ); // maybe move it to getStatus()
207 cryptCheckBox->setChecked( m_useEncryption ); 210 cryptCheckBox->setChecked( m_useEncryption );
208 authCheckBox->setChecked( m_enableAuthentification ); 211 authCheckBox->setChecked( m_enableAuthentification );
209 pagescanCheckBox->setChecked( m_enablePagescan ); 212 pagescanCheckBox->setChecked( m_enablePagescan );
210 inquiryscanCheckBox->setChecked( m_enableInquiryscan ); 213 inquiryscanCheckBox->setChecked( m_enableInquiryscan );
211 deviceNameLine->setText( m_deviceName ); 214 deviceNameLine->setText( m_deviceName );
212 passkeyLine->setText( m_defaultPasskey ); 215 passkeyLine->setText( m_defaultPasskey );
213 // set info tab 216 // set info tab
214 setInfo(); 217 setInfo();
215} 218}
216 219
217 220
218/** 221/**
219 * Get the status informations and returns it 222 * Get the status informations and returns it
220 * @return QString the status informations gathered 223 * @return QString the status informations gathered
221 */ 224 */
222QString BlueBase::status()const{ 225QString BlueBase::status()const{
223 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 226 QString infoString = tr( "<b>Device name : </b> Ipaq" );
224 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 227 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
225 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 228 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
226 229
227 return (infoString); 230 return (infoString);
228} 231}
229 232
230 233
231/** 234/**
232 * Read the current values from the gui and invoke writeConfig() 235 * Read the current values from the gui and invoke writeConfig()
233 */ 236 */
234void BlueBase::applyConfigChanges() { 237void BlueBase::applyConfigChanges() {
235 m_deviceName = deviceNameLine->text(); 238 m_deviceName = deviceNameLine->text();
236 m_defaultPasskey = passkeyLine->text(); 239 m_defaultPasskey = passkeyLine->text();
237 m_useEncryption = cryptCheckBox->isChecked(); 240 m_useEncryption = cryptCheckBox->isChecked();
238 m_enableAuthentification = authCheckBox->isChecked(); 241 m_enableAuthentification = authCheckBox->isChecked();
239 m_enablePagescan = pagescanCheckBox->isChecked(); 242 m_enablePagescan = pagescanCheckBox->isChecked();
240 m_enableInquiryscan = inquiryscanCheckBox->isChecked(); 243 m_enableInquiryscan = inquiryscanCheckBox->isChecked();
241 244
242 writeConfig(); 245 writeConfig();
243 246
244 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); 247 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
245} 248}
246 249
247/** 250/**
251 * Launch Rfcomm Bind dialog
252 *
253 */
254void BlueBase::rfcommDialog() {
255 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
256
257 rfcommAssign.showMaximized();
258
259 if ( rfcommAssign.exec() == QDialog::Accepted ) {
260 rfcommAssign.saveConfig();
261 }
262}
263
264/**
248 * Add fresh found devices from scan dialog to the listing 265 * Add fresh found devices from scan dialog to the listing
249 * 266 *
250 */ 267 */
251void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { 268void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) {
252 BTDeviceItem * deviceItem; 269 BTDeviceItem * deviceItem;
253 QValueList<RemoteDevice>::ConstIterator it; 270 QValueList<RemoteDevice>::ConstIterator it;
254 271
255 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { 272 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) {
256 273
257 if (find( (*it) )) // is already inserted 274 if (find( (*it) )) // is already inserted
258 continue; 275 continue;
259 276
260 deviceItem = new BTDeviceItem( ListView2 , (*it) ); 277 deviceItem = new BTDeviceItem( ListView2 , (*it) );
261 deviceItem->setPixmap( 1, m_findPix ); 278 deviceItem->setPixmap( 1, m_findPix );
262 deviceItem->setExpandable ( true ); 279 deviceItem->setExpandable ( true );
263 280
264 // look if device is avail. atm, async 281 // look if device is avail. atm, async
265 deviceActive( (*it) ); 282 deviceActive( (*it) );
266 283
267 // ggf auch hier? 284 // ggf auch hier?
268 addServicesToDevice( deviceItem ); 285 addServicesToDevice( deviceItem );
269 } 286 }
270} 287}
271 288
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index 743062c..a8ab3db 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -19,79 +19,83 @@
19#include "bticonloader.h" 19#include "bticonloader.h"
20 20
21#include <remotedevice.h> 21#include <remotedevice.h>
22#include <manager.h> 22#include <manager.h>
23 23
24class QVBox; 24class QVBox;
25class QHBoxLayout; 25class QHBoxLayout;
26class QGridLayout; 26class QGridLayout;
27class QFrame; 27class QFrame;
28class QLabel; 28class QLabel;
29class QPushButton; 29class QPushButton;
30class QTabWidget; 30class QTabWidget;
31class QCheckBox; 31class QCheckBox;
32class BTConnectionItem; 32class BTConnectionItem;
33 33
34 34
35namespace OpieTooth { 35namespace OpieTooth {
36 36
37 class BlueBase : public BluetoothBase { 37 class BlueBase : public BluetoothBase {
38 Q_OBJECT 38 Q_OBJECT
39 39
40 public: 40 public:
41 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 41 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
42 ~BlueBase(); 42 ~BlueBase();
43
44 static QString appName() { return QString::fromLatin1("bluetooth-manager"); }
43 45
44 protected: 46 protected:
45 47
46 48
47 private slots: 49 private slots:
48 void startScan(); 50 void startScan();
49 51
52
50 private: 53 private:
51 bool find( const RemoteDevice& device ); 54 bool find( const RemoteDevice& device );
52 void readConfig(); 55 void readConfig();
53 void writeConfig(); 56 void writeConfig();
54 void readSavedDevices(); 57 void readSavedDevices();
55 void writeSavedDevices(); 58 void writeSavedDevices();
56 void writeToHciConfig(); 59 void writeToHciConfig();
57 QString status()const; 60 QString status()const;
58 void initGui(); 61 void initGui();
59 void setInfo(); 62 void setInfo();
60 63
61 PopupHelper m_popHelper; 64 PopupHelper m_popHelper;
62 Manager *m_localDevice; 65 Manager *m_localDevice;
63 QMap<QString,BTDeviceItem*> m_deviceList; 66 QMap<QString,BTDeviceItem*> m_deviceList;
64 67
65 void deviceActive( const RemoteDevice &device ); 68 void deviceActive( const RemoteDevice &device );
66 69
67 QString m_deviceName; 70 QString m_deviceName;
68 QString m_defaultPasskey; 71 QString m_defaultPasskey;
69 bool m_useEncryption; 72 bool m_useEncryption;
70 bool m_enableAuthentification; 73 bool m_enableAuthentification;
71 bool m_enablePagescan; 74 bool m_enablePagescan;
72 bool m_enableInquiryscan; 75 bool m_enableInquiryscan;
73 76
74 QPixmap m_offPix; 77 QPixmap m_offPix;
75 QPixmap m_onPix; 78 QPixmap m_onPix;
76 QPixmap m_findPix; 79 QPixmap m_findPix;
77 80
78 BTIconLoader *m_iconLoader; 81 BTIconLoader *m_iconLoader;
79 82
80 private slots: 83 private slots:
81 void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); 84 void addSearchedDevices( const QValueList<RemoteDevice> &newDevices );
82 void addServicesToDevice( BTDeviceItem *item ); 85 void addServicesToDevice( BTDeviceItem *item );
83 void addServicesToDevice( const QString& device, Services::ValueList ); 86 void addServicesToDevice( const QString& device, Services::ValueList );
84 void addConnectedDevices(); 87 void addConnectedDevices();
85 void addConnectedDevices( ConnectionState::ValueList ); 88 void addConnectedDevices( ConnectionState::ValueList );
86 void startServiceActionClicked( QListViewItem *item ); 89 void startServiceActionClicked( QListViewItem *item );
87 void startServiceActionHold( QListViewItem *, const QPoint &, int ); 90 void startServiceActionHold( QListViewItem *, const QPoint &, int );
88 void deviceActive( const QString& mac, bool connected ); 91 void deviceActive( const QString& mac, bool connected );
89 void applyConfigChanges(); 92 void applyConfigChanges();
90 void addSignalStrength(); 93 void addSignalStrength();
91 void addSignalStrength( const QString& mac, const QString& strengh ); 94 void addSignalStrength( const QString& mac, const QString& strengh );
95 void rfcommDialog();
92 96
93 }; 97 };
94 98
95} 99}
96 100
97#endif 101#endif
diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui
index 9ff970f..bb906a1 100644
--- a/noncore/net/opietooth/manager/bluetoothbase.ui
+++ b/noncore/net/opietooth/manager/bluetoothbase.ui
@@ -1,395 +1,443 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>BluetoothBase</class> 2<class>BluetoothBase</class>
3<widget> 3<widget>
4 <class>QWidget</class> 4 <class>QWidget</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>BluetoothBase</cstring> 7 <cstring>BluetoothBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>224</width> 14 <width>258</width>
15 <height>320</height> 15 <height>407</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Form1</string> 20 <string>Form1</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
28 <vbox> 28 <widget>
29 <class>QTabWidget</class>
29 <property stdset="1"> 30 <property stdset="1">
30 <name>margin</name> 31 <name>name</name>
31 <number>0</number> 32 <cstring>Status</cstring>
32 </property> 33 </property>
33 <property stdset="1"> 34 <property stdset="1">
34 <name>spacing</name> 35 <name>geometry</name>
35 <number>0</number> 36 <rect>
37 <x>1</x>
38 <y>1</y>
39 <width>245</width>
40 <height>289</height>
41 </rect>
42 </property>
43 <property>
44 <name>layoutMargin</name>
45 </property>
46 <property>
47 <name>layoutSpacing</name>
36 </property> 48 </property>
37 <widget> 49 <widget>
38 <class>QTabWidget</class> 50 <class>QWidget</class>
39 <property stdset="1"> 51 <property stdset="1">
40 <name>name</name> 52 <name>name</name>
41 <cstring>Status</cstring> 53 <cstring>tab</cstring>
42 </property>
43 <property>
44 <name>layoutMargin</name>
45 </property>
46 <property>
47 <name>layoutSpacing</name>
48 </property> 54 </property>
49 <widget> 55 <attribute>
50 <class>QWidget</class> 56 <name>title</name>
57 <string>Devices</string>
58 </attribute>
59 <vbox>
51 <property stdset="1"> 60 <property stdset="1">
52 <name>name</name> 61 <name>margin</name>
53 <cstring>tab</cstring> 62 <number>2</number>
54 </property> 63 </property>
55 <attribute> 64 <property stdset="1">
56 <name>title</name> 65 <name>spacing</name>
57 <string>Devices</string> 66 <number>2</number>
58 </attribute> 67 </property>
59 <vbox> 68 <widget>
69 <class>QListView</class>
70 <column>
71 <property>
72 <name>text</name>
73 <string>Device Name</string>
74 </property>
75 <property>
76 <name>clickable</name>
77 <bool>true</bool>
78 </property>
79 <property>
80 <name>resizeable</name>
81 <bool>true</bool>
82 </property>
83 </column>
84 <column>
85 <property>
86 <name>text</name>
87 <string>Online</string>
88 </property>
89 <property>
90 <name>clickable</name>
91 <bool>true</bool>
92 </property>
93 <property>
94 <name>resizeable</name>
95 <bool>true</bool>
96 </property>
97 </column>
60 <property stdset="1"> 98 <property stdset="1">
61 <name>margin</name> 99 <name>name</name>
62 <number>2</number> 100 <cstring>ListView2</cstring>
63 </property> 101 </property>
102 </widget>
103 <widget>
104 <class>QPushButton</class>
64 <property stdset="1"> 105 <property stdset="1">
65 <name>spacing</name> 106 <name>name</name>
66 <number>2</number> 107 <cstring>PushButton2</cstring>
67 </property> 108 </property>
68 <widget> 109 <property stdset="1">
69 <class>QListView</class> 110 <name>sizePolicy</name>
70 <column> 111 <sizepolicy>
71 <property> 112 <hsizetype>0</hsizetype>
72 <name>text</name> 113 <vsizetype>0</vsizetype>
73 <string>Device Name</string> 114 </sizepolicy>
74 </property> 115 </property>
75 <property> 116 <property stdset="1">
76 <name>clickable</name> 117 <name>text</name>
77 <bool>true</bool> 118 <string>Scan for Devices</string>
78 </property> 119 </property>
79 <property> 120 </widget>
80 <name>resizeable</name> 121 </vbox>
81 <bool>true</bool> 122 </widget>
82 </property> 123 <widget>
83 </column> 124 <class>QWidget</class>
84 <column> 125 <property stdset="1">
85 <property> 126 <name>name</name>
86 <name>text</name> 127 <cstring>tab</cstring>
87 <string>Online</string> 128 </property>
88 </property> 129 <attribute>
89 <property> 130 <name>title</name>
90 <name>clickable</name> 131 <string>Connections</string>
91 <bool>true</bool> 132 </attribute>
92 </property> 133 <vbox>
93 <property> 134 <property stdset="1">
94 <name>resizeable</name> 135 <name>margin</name>
95 <bool>true</bool> 136 <number>2</number>
96 </property> 137 </property>
97 </column> 138 <property stdset="1">
98 <property stdset="1"> 139 <name>spacing</name>
99 <name>name</name> 140 <number>2</number>
100 <cstring>ListView2</cstring> 141 </property>
142 <widget>
143 <class>QListView</class>
144 <column>
145 <property>
146 <name>text</name>
147 <string>Device Name</string>
101 </property> 148 </property>
102 </widget> 149 <property>
103 <widget> 150 <name>clickable</name>
104 <class>QPushButton</class> 151 <bool>true</bool>
105 <property stdset="1">
106 <name>name</name>
107 <cstring>PushButton2</cstring>
108 </property> 152 </property>
109 <property stdset="1"> 153 <property>
110 <name>sizePolicy</name> 154 <name>resizeable</name>
111 <sizepolicy> 155 <bool>true</bool>
112 <hsizetype>0</hsizetype>
113 <vsizetype>0</vsizetype>
114 </sizepolicy>
115 </property> 156 </property>
116 <property stdset="1"> 157 </column>
158 <column>
159 <property>
117 <name>text</name> 160 <name>text</name>
118 <string>Scan for Devices</string> 161 <string>Connection type</string>
119 </property> 162 </property>
120 </widget> 163 <property>
121 </vbox> 164 <name>clickable</name>
122 </widget> 165 <bool>true</bool>
123 <widget> 166 </property>
124 <class>QWidget</class> 167 <property>
125 <property stdset="1"> 168 <name>resizeable</name>
126 <name>name</name> 169 <bool>true</bool>
127 <cstring>tab</cstring> 170 </property>
128 </property> 171 </column>
129 <attribute> 172 <column>
130 <name>title</name> 173 <property>
131 <string>Connections</string> 174 <name>text</name>
132 </attribute> 175 <string>Signal</string>
133 <vbox> 176 </property>
134 <property stdset="1"> 177 <property>
135 <name>margin</name> 178 <name>clickable</name>
136 <number>2</number> 179 <bool>true</bool>
137 </property> 180 </property>
181 <property>
182 <name>resizeable</name>
183 <bool>true</bool>
184 </property>
185 </column>
138 <property stdset="1"> 186 <property stdset="1">
139 <name>spacing</name> 187 <name>name</name>
140 <number>2</number> 188 <cstring>ListView4</cstring>
141 </property> 189 </property>
142 <widget> 190 </widget>
143 <class>QListView</class> 191 </vbox>
144 <column> 192 </widget>
145 <property> 193 <widget>
146 <name>text</name> 194 <class>QWidget</class>
147 <string>Device Name</string> 195 <property stdset="1">
148 </property> 196 <name>name</name>
149 <property> 197 <cstring>tab</cstring>
150 <name>clickable</name> 198 </property>
151 <bool>true</bool> 199 <attribute>
152 </property> 200 <name>title</name>
153 <property> 201 <string>Config</string>
154 <name>resizeable</name> 202 </attribute>
155 <bool>true</bool> 203 <vbox>
156 </property> 204 <property stdset="1">
157 </column> 205 <name>margin</name>
158 <column> 206 <number>11</number>
159 <property> 207 </property>
160 <name>text</name>
161 <string>Connection type</string>
162 </property>
163 <property>
164 <name>clickable</name>
165 <bool>true</bool>
166 </property>
167 <property>
168 <name>resizeable</name>
169 <bool>true</bool>
170 </property>
171 </column>
172 <column>
173 <property>
174 <name>text</name>
175 <string>Signal</string>
176 </property>
177 <property>
178 <name>clickable</name>
179 <bool>true</bool>
180 </property>
181 <property>
182 <name>resizeable</name>
183 <bool>true</bool>
184 </property>
185 </column>
186 <property stdset="1">
187 <name>name</name>
188 <cstring>ListView4</cstring>
189 </property>
190 </widget>
191 </vbox>
192 </widget>
193 <widget>
194 <class>QWidget</class>
195 <property stdset="1"> 208 <property stdset="1">
196 <name>name</name> 209 <name>spacing</name>
197 <cstring>tab</cstring> 210 <number>6</number>
198 </property> 211 </property>
199 <attribute> 212 <widget>
200 <name>title</name> 213 <class>QGroupBox</class>
201 <string>Config</string>
202 </attribute>
203 <vbox>
204 <property stdset="1"> 214 <property stdset="1">
205 <name>margin</name> 215 <name>name</name>
206 <number>2</number> 216 <cstring>GroupBox1</cstring>
207 </property> 217 </property>
208 <property stdset="1"> 218 <property stdset="1">
209 <name>spacing</name> 219 <name>title</name>
210 <number>2</number> 220 <string>Bluetooh Basic Config</string>
211 </property> 221 </property>
212 <widget> 222 <vbox>
213 <class>QLayoutWidget</class>
214 <property stdset="1"> 223 <property stdset="1">
215 <name>name</name> 224 <name>margin</name>
216 <cstring>Layout2</cstring> 225 <number>11</number>
217 </property> 226 </property>
218 <hbox>
219 <property stdset="1">
220 <name>margin</name>
221 <number>0</number>
222 </property>
223 <property stdset="1">
224 <name>spacing</name>
225 <number>6</number>
226 </property>
227 <widget>
228 <class>QLabel</class>
229 <property stdset="1">
230 <name>name</name>
231 <cstring>deviceNameLabel</cstring>
232 </property>
233 <property stdset="1">
234 <name>text</name>
235 <string>Device Name</string>
236 </property>
237 </widget>
238 <widget>
239 <class>QLineEdit</class>
240 <property stdset="1">
241 <name>name</name>
242 <cstring>deviceNameLine</cstring>
243 </property>
244 </widget>
245 </hbox>
246 </widget>
247 <widget>
248 <class>QLayoutWidget</class>
249 <property stdset="1"> 227 <property stdset="1">
250 <name>name</name> 228 <name>spacing</name>
251 <cstring>Layout3</cstring> 229 <number>6</number>
252 </property> 230 </property>
253 <hbox> 231 <widget>
254 <property stdset="1"> 232 <class>QLayoutWidget</class>
255 <name>margin</name>
256 <number>0</number>
257 </property>
258 <property stdset="1"> 233 <property stdset="1">
259 <name>spacing</name> 234 <name>name</name>
260 <number>6</number> 235 <cstring>Layout7</cstring>
261 </property> 236 </property>
262 <widget> 237 <hbox>
263 <class>QLabel</class>
264 <property stdset="1"> 238 <property stdset="1">
265 <name>name</name> 239 <name>margin</name>
266 <cstring>passkeyLabel</cstring> 240 <number>0</number>
267 </property> 241 </property>
268 <property stdset="1"> 242 <property stdset="1">
269 <name>text</name> 243 <name>spacing</name>
270 <string>Default Passkey</string> 244 <number>6</number>
271 </property> 245 </property>
272 </widget> 246 <widget>
273 <widget> 247 <class>QLayoutWidget</class>
274 <class>QLineEdit</class> 248 <property stdset="1">
249 <name>name</name>
250 <cstring>Layout6</cstring>
251 </property>
252 <vbox>
253 <property stdset="1">
254 <name>margin</name>
255 <number>0</number>
256 </property>
257 <property stdset="1">
258 <name>spacing</name>
259 <number>6</number>
260 </property>
261 <widget>
262 <class>QLabel</class>
263 <property stdset="1">
264 <name>name</name>
265 <cstring>deviceNameLabel</cstring>
266 </property>
267 <property stdset="1">
268 <name>text</name>
269 <string>Device Name</string>
270 </property>
271 </widget>
272 <widget>
273 <class>QLabel</class>
274 <property stdset="1">
275 <name>name</name>
276 <cstring>passkeyLabel</cstring>
277 </property>
278 <property stdset="1">
279 <name>text</name>
280 <string>Default Passkey</string>
281 </property>
282 </widget>
283 </vbox>
284 </widget>
285 <widget>
286 <class>QLayoutWidget</class>
287 <property stdset="1">
288 <name>name</name>
289 <cstring>Layout5</cstring>
290 </property>
291 <vbox>
292 <property stdset="1">
293 <name>margin</name>
294 <number>0</number>
295 </property>
296 <property stdset="1">
297 <name>spacing</name>
298 <number>6</number>
299 </property>
300 <widget>
301 <class>QLineEdit</class>
302 <property stdset="1">
303 <name>name</name>
304 <cstring>deviceNameLine</cstring>
305 </property>
306 </widget>
307 <widget>
308 <class>QLineEdit</class>
309 <property stdset="1">
310 <name>name</name>
311 <cstring>passkeyLine</cstring>
312 </property>
313 <property stdset="1">
314 <name>echoMode</name>
315 <enum>Password</enum>
316 </property>
317 </widget>
318 </vbox>
319 </widget>
320 </hbox>
321 </widget>
322 <widget>
323 <class>QLayoutWidget</class>
324 <property stdset="1">
325 <name>name</name>
326 <cstring>Layout5</cstring>
327 </property>
328 <vbox>
275 <property stdset="1"> 329 <property stdset="1">
276 <name>name</name> 330 <name>margin</name>
277 <cstring>passkeyLine</cstring> 331 <number>0</number>
278 </property> 332 </property>
279 <property stdset="1"> 333 <property stdset="1">
280 <name>echoMode</name> 334 <name>spacing</name>
281 <enum>Password</enum> 335 <number>6</number>
282 </property> 336 </property>
283 </widget> 337 <widget>
284 </hbox> 338 <class>QCheckBox</class>
285 </widget> 339 <property stdset="1">
286 <widget> 340 <name>name</name>
287 <class>QLayoutWidget</class> 341 <cstring>authCheckBox</cstring>
288 <property stdset="1"> 342 </property>
289 <name>name</name> 343 <property stdset="1">
290 <cstring>Layout5</cstring> 344 <name>text</name>
291 </property> 345 <string>enable authentification</string>
292 <vbox> 346 </property>
347 </widget>
348 <widget>
349 <class>QCheckBox</class>
350 <property stdset="1">
351 <name>name</name>
352 <cstring>cryptCheckBox</cstring>
353 </property>
354 <property stdset="1">
355 <name>text</name>
356 <string>enable encryption</string>
357 </property>
358 </widget>
359 <widget>
360 <class>QCheckBox</class>
361 <property stdset="1">
362 <name>name</name>
363 <cstring>pagescanCheckBox</cstring>
364 </property>
365 <property stdset="1">
366 <name>text</name>
367 <string>Enable Page scan</string>
368 </property>
369 </widget>
370 <widget>
371 <class>QCheckBox</class>
372 <property stdset="1">
373 <name>name</name>
374 <cstring>inquiryscanCheckBox</cstring>
375 </property>
376 <property stdset="1">
377 <name>text</name>
378 <string>Enable Inquiry scan</string>
379 </property>
380 </widget>
381 </vbox>
382 </widget>
383 <widget>
384 <class>QPushButton</class>
293 <property stdset="1"> 385 <property stdset="1">
294 <name>margin</name> 386 <name>name</name>
295 <number>0</number> 387 <cstring>configApplyButton</cstring>
296 </property> 388 </property>
297 <property stdset="1"> 389 <property stdset="1">
298 <name>spacing</name> 390 <name>text</name>
299 <number>6</number> 391 <string>Apply</string>
300 </property> 392 </property>
301 <widget> 393 </widget>
302 <class>QCheckBox</class> 394 </vbox>
303 <property stdset="1"> 395 </widget>
304 <name>name</name> 396 <widget>
305 <cstring>authCheckBox</cstring> 397 <class>QPushButton</class>
306 </property> 398 <property stdset="1">
307 <property stdset="1"> 399 <name>name</name>
308 <name>text</name> 400 <cstring>rfcommBindButton</cstring>
309 <string>enable authentification</string> 401 </property>
310 </property> 402 <property stdset="1">
311 </widget> 403 <name>text</name>
312 <widget> 404 <string>Rfcomm Bind Table</string>
313 <class>QCheckBox</class> 405 </property>
314 <property stdset="1"> 406 </widget>
315 <name>name</name> 407 </vbox>
316 <cstring>cryptCheckBox</cstring> 408 </widget>
317 </property> 409 <widget>
318 <property stdset="1"> 410 <class>QWidget</class>
319 <name>text</name> 411 <property stdset="1">
320 <string>enable encryption</string> 412 <name>name</name>
321 </property> 413 <cstring>tab</cstring>
322 </widget> 414 </property>
323 <widget> 415 <attribute>
324 <class>QCheckBox</class> 416 <name>title</name>
325 <property stdset="1"> 417 <string>Status</string>
326 <name>name</name> 418 </attribute>
327 <cstring>pagescanCheckBox</cstring> 419 <vbox>
328 </property>
329 <property stdset="1">
330 <name>text</name>
331 <string>Enable Page scan</string>
332 </property>
333 </widget>
334 <widget>
335 <class>QCheckBox</class>
336 <property stdset="1">
337 <name>name</name>
338 <cstring>inquiryscanCheckBox</cstring>
339 </property>
340 <property stdset="1">
341 <name>text</name>
342 <string>Enable Inquiry scan</string>
343 </property>
344 </widget>
345 </vbox>
346 </widget>
347 <widget>
348 <class>QPushButton</class>
349 <property stdset="1">
350 <name>name</name>
351 <cstring>configApplyButton</cstring>
352 </property>
353 <property stdset="1">
354 <name>text</name>
355 <string>Apply</string>
356 </property>
357 </widget>
358 </vbox>
359 </widget>
360 <widget>
361 <class>QWidget</class>
362 <property stdset="1"> 420 <property stdset="1">
363 <name>name</name> 421 <name>margin</name>
364 <cstring>tab</cstring> 422 <number>2</number>
365 </property> 423 </property>
366 <attribute> 424 <property stdset="1">
367 <name>title</name> 425 <name>spacing</name>
368 <string>Status</string> 426 <number>2</number>
369 </attribute> 427 </property>
370 <vbox> 428 <widget>
429 <class>QLabel</class>
371 <property stdset="1"> 430 <property stdset="1">
372 <name>margin</name> 431 <name>name</name>
373 <number>2</number> 432 <cstring>StatusLabel</cstring>
374 </property> 433 </property>
375 <property stdset="1"> 434 <property stdset="1">
376 <name>spacing</name> 435 <name>text</name>
377 <number>2</number> 436 <string>Status Label</string>
378 </property> 437 </property>
379 <widget> 438 </widget>
380 <class>QLabel</class> 439 </vbox>
381 <property stdset="1">
382 <name>name</name>
383 <cstring>StatusLabel</cstring>
384 </property>
385 <property stdset="1">
386 <name>text</name>
387 <string>Status Label</string>
388 </property>
389 </widget>
390 </vbox>
391 </widget>
392 </widget> 440 </widget>
393 </vbox> 441 </widget>
394</widget> 442</widget>
395</UI> 443</UI>
diff --git a/noncore/net/opietooth/manager/main.cpp b/noncore/net/opietooth/manager/main.cpp
index a86e36d..82aeebd 100644
--- a/noncore/net/opietooth/manager/main.cpp
+++ b/noncore/net/opietooth/manager/main.cpp
@@ -1,38 +1,25 @@
1/* 1/*
2 * main.cpp 2 * main.cpp
3 * 3 *
4 * --------------------- 4 * ---------------------
5 * 5 *
6 * begin : Sun 10 17:20:00 CEST 2002 6 * begin : Sun 10 17:20:00 CEST 2002
7 * copyright : (c) 2002 by Maximilian Reiß 7 * copyright : (c) 2002 by Maximilian Reiß
8 * email : max.reiss@gmx.de 8 * email : max.reiss@gmx.de
9 * 9 *
10 */ 10 */
11/*************************************************************************** 11/***************************************************************************
12 * * 12 * *
13 * This program is free software; you can redistribute it and/or modify * 13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by * 14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or * 15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. * 16 * (at your option) any later version. *
17 * * 17 * *
18 ***************************************************************************/ 18 ***************************************************************************/
19 19
20#include "bluebase.h" 20#include "bluebase.h"
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include <opie/oapplicationfactory.h>
22 23
23 24OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::BlueBase> )
24QPEApplication *BluetoothApp;
25
26int main( int argc, char ** argv ) {
27 QPEApplication a(argc, argv);
28 BluetoothApp=&a;
29
30 OpieTooth::BlueBase t;
31
32 // t.setCaption( OpieTooth::BlueBase::tr("Bluetooth Manager") );
33 a.showMainWidget(&t);
34
35 return a.exec();
36}
37
38 25
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index 9841740..6ff4ebb 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -1,50 +1,50 @@
1TEMPLATE = app 1CONFIG = qt warn_on release quick-app
2CONFIG = qt warn_on debug
3#CONFIG = qt warn_on release
4HEADERS = btconnectionitem.h btdeviceitem.h \ 2HEADERS = btconnectionitem.h btdeviceitem.h \
5 btserviceitem.h stdpopups.h \ 3 btserviceitem.h stdpopups.h \
6 popuphelper.h bluebase.h \ 4 popuphelper.h bluebase.h \
7 scandialog.h btlistitem.h \ 5 scandialog.h btlistitem.h \
8 hciconfwrapper.h bticonloader.h \ 6 hciconfwrapper.h bticonloader.h \
9 pppdialog.h obexdialog.h \ 7 pppdialog.h obexdialog.h \
8 rfcommassigndialogimpl.h rfcommassigndialogitem.h \
10 devicehandler.h rfcpopup.h obexpopup.h \ 9 devicehandler.h rfcpopup.h obexpopup.h \
11 rfcommhelper.h panpopup.h dunpopup.h 10 rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h
12 11
13SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ 12SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
14 btserviceitem.cpp stdpopups.cpp \ 13 btserviceitem.cpp stdpopups.cpp \
15 popuphelper.cpp main.cpp \ 14 popuphelper.cpp main.cpp \
16 bluebase.cpp scandialog.cpp \ 15 bluebase.cpp scandialog.cpp \
17 btlistitem.cpp hciconfwrapper.cpp \ 16 btlistitem.cpp hciconfwrapper.cpp \
18 bticonloader.cpp pppdialog.cpp \ 17 bticonloader.cpp pppdialog.cpp \
18 rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \
19 obexdialog.cpp devicehandler.cpp \ 19 obexdialog.cpp devicehandler.cpp \
20 rfcpopup.cpp obexpopup.cpp \ 20 rfcpopup.cpp obexpopup.cpp \
21 rfcommhelper.cpp panpopup.cpp dunpopup.cpp 21 rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp
22INCLUDEPATH += $(OPIEDIR)/include 22INCLUDEPATH += $(OPIEDIR)/include
23INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib 23INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
24DEPENDPATH += $(OPIEDIR)/include 24DEPENDPATH += $(OPIEDIR)/include
25LIBS += -lqpe -lopietooth -lopie 25LIBS += -lqpe -lopietooth -lopie
26INTERFACES = bluetoothbase.ui devicedialog.ui 26INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui rfcommdialogitembase.ui
27DESTDIR = $(OPIEDIR)/bin 27
28TARGET = bluetooth-manager 28 TARGET = bluetooth-manager
29 29
30TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ 30TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \
31 ../../../../i18n/nl/bluetooth-manager.ts \ 31 ../../../../i18n/nl/bluetooth-manager.ts \
32 ../../../../i18n/da/bluetooth-manager.ts \ 32 ../../../../i18n/da/bluetooth-manager.ts \
33 ../../../../i18n/xx/bluetooth-manager.ts \ 33 ../../../../i18n/xx/bluetooth-manager.ts \
34 ../../../../i18n/en/bluetooth-manager.ts \ 34 ../../../../i18n/en/bluetooth-manager.ts \
35 ../../../../i18n/es/bluetooth-manager.ts \ 35 ../../../../i18n/es/bluetooth-manager.ts \
36 ../../../../i18n/fr/bluetooth-manager.ts \ 36 ../../../../i18n/fr/bluetooth-manager.ts \
37 ../../../../i18n/hu/bluetooth-manager.ts \ 37 ../../../../i18n/hu/bluetooth-manager.ts \
38 ../../../../i18n/ja/bluetooth-manager.ts \ 38 ../../../../i18n/ja/bluetooth-manager.ts \
39 ../../../../i18n/ko/bluetooth-manager.ts \ 39 ../../../../i18n/ko/bluetooth-manager.ts \
40 ../../../../i18n/no/bluetooth-manager.ts \ 40 ../../../../i18n/no/bluetooth-manager.ts \
41 ../../../../i18n/pl/bluetooth-manager.ts \ 41 ../../../../i18n/pl/bluetooth-manager.ts \
42 ../../../../i18n/pt/bluetooth-manager.ts \ 42 ../../../../i18n/pt/bluetooth-manager.ts \
43 ../../../../i18n/pt_BR/bluetooth-manager.ts \ 43 ../../../../i18n/pt_BR/bluetooth-manager.ts \
44 ../../../../i18n/sl/bluetooth-manager.ts \ 44 ../../../../i18n/sl/bluetooth-manager.ts \
45 ../../../../i18n/zh_CN/bluetooth-manager.ts \ 45 ../../../../i18n/zh_CN/bluetooth-manager.ts \
46 ../../../../i18n/zh_TW/bluetooth-manager.ts 46 ../../../../i18n/zh_TW/bluetooth-manager.ts
47 47
48 48
49 49
50include ( $(OPIEDIR)/include.pro ) 50include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogbase.ui b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui
new file mode 100644
index 0000000..aefa698
--- a/dev/null
+++ b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui
@@ -0,0 +1,44 @@
1<!DOCTYPE UI><UI>
2<class>RfcommAssignDialogBase</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>RfcommAssignDialogBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>444</width>
15 <height>343</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Rfcomm Bind</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QLabel</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>TextLabel1</cstring>
36 </property>
37 <property stdset="1">
38 <name>text</name>
39 <string>Bind device to a interface</string>
40 </property>
41 </widget>
42 </vbox>
43</widget>
44</UI>
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
new file mode 100644
index 0000000..b5cc074
--- a/dev/null
+++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
@@ -0,0 +1,120 @@
1
2#include "rfcommassigndialogimpl.h"
3#include "rfcommassigndialogitem.h"
4#include "rfcommconfhandler.h"
5
6#include <qpe/config.h>
7
8#include <qlayout.h>
9
10using namespace OpieTooth;
11
12// TODO: write only the file in bluebase?
13// muss rfcommd dann neu gestartet werden
14// sollte rfcomm bind all nicht eh default config sein ( polled das? - d.h. sobald nen gerät in der nähe ist bindet es?
15
16
17RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
18 : RfcommAssignDialogBase( parent, name, modal, fl ) {
19
20 m_range = 5;
21
22 m_scrollView = new QScrollView( this );
23 m_scrollView->setResizePolicy( QScrollView::AutoOneFit );
24 m_scrollView->setHScrollBarMode( QScrollView::AlwaysOff );
25
26 RfcommAssignDialogBaseLayout->addWidget( m_scrollView );
27
28 m_box = new QVBox( m_scrollView->viewport() );
29 m_scrollView->addChild( m_box );
30
31 confHandler = new RfCommConfHandler( "/etc/bluetooth/rfcomm.conf" );
32
33 loadConfig();
34}
35
36RfcommAssignDialog::~RfcommAssignDialog() {
37 if ( confHandler ) {
38 delete confHandler;
39 }
40}
41
42
43void RfcommAssignDialog::newDevice( const QString & mac ) {
44
45 for ( int i = 0 ; i < m_range; i++ ) {
46
47 QMap<QString, RfCommConfObject*>::Iterator it;
48 it = confHandler->foundEntries().find( QString("%1").arg( i ) );
49 // make sure that rfcommX is not assigned yet
50 if ( it == confHandler->foundEntries().end() ) {
51 QDialog dialog( this, "newdevice", true, WStyle_ContextHelp );
52 dialog.showMaximized();
53 RfcommDialogItem *newDev = new RfcommDialogItem( &dialog );
54 newDev->setIdent( i );
55 newDev->setMac( mac );
56
57 if ( dialog.exec() == QDialog::Accepted ) {
58 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box );
59 m_itemList.insert( i , rfcomm );
60 rfcomm->setIdent( i );
61 rfcomm->setMac( mac );
62 rfcomm->setChannel( newDev->channel() );
63 rfcomm->setComment( newDev->comment() );
64 qDebug( "New device set up" );
65 }
66 }
67 }
68}
69
70void RfcommAssignDialog::loadConfig() {
71
72 //Config cfg( "bluetoothmanager-rfcommbind" );
73
74 for ( int i = 0 ; i < m_range; i++ ) {
75 // cfg.setGroup( QString("%1").arg( i ) );
76 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box );
77 m_itemList.insert( i , rfcomm );
78 rfcomm->setIdent( i );
79 QMap<QString, RfCommConfObject*>::Iterator it;
80 it = confHandler->foundEntries().find( QString("%1").arg( i ) );
81 if ( it != confHandler->foundEntries().end() ) {
82 qDebug( "Found key in foundEntries() " );
83 rfcomm->setMac( it.data()->mac() );
84 rfcomm->setChannel( it.data()->channel() );
85 rfcomm->setComment( it.data()->comment() );
86 }
87 /* Use rfcomm.conf directly for now
88 * rfcomm->setMac( cfg.readEntry( "mac", "" ) );
89 * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) );
90 * rfcomm->setComment( cfg.readEntry( "comment", "" ) );
91 */
92 }
93}
94
95
96void RfcommAssignDialog::saveConfig() {
97
98 //Config cfg( "bluetoothmanager-rfcommbind" );
99
100 QMap< int, RfcommDialogItem*>::Iterator it;
101
102 QMap< QString, RfCommConfObject*> outMap;
103
104 for( it = m_itemList.begin(); it != m_itemList.end(); ++it ) {
105
106 //cfg.setGroup( QString("%1").arg( it.key() ) );
107 RfcommDialogItem *rfcomm = it.data();
108
109
110 outMap.insert( QString( "%1").arg( it.key() ), new RfCommConfObject( it.key(), rfcomm->mac(), rfcomm->channel(), rfcomm->comment() ) );
111
112
113 //cfg.writeEntry( "mac", rfcomm->mac() );
114 //cfg.writeEntry( "channel", rfcomm->channel() );
115 //cfg.writeEntry( "comment", rfcomm->comment() );
116 }
117
118 confHandler->save( outMap );
119
120}
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.h b/noncore/net/opietooth/manager/rfcommassigndialogimpl.h
new file mode 100644
index 0000000..9983632
--- a/dev/null
+++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.h
@@ -0,0 +1,39 @@
1#ifndef RFCOMMASSIGN
2#define RFCOMMASSIGN
3
4#include "rfcommassigndialogbase.h"
5#include "rfcommassigndialogitem.h"
6#include "rfcommconfhandler.h"
7
8#include <qscrollview.h>
9#include <qmap.h>
10#include <qvbox.h>
11
12namespace OpieTooth {
13
14 class RfcommAssignDialog: public RfcommAssignDialogBase {
15
16 Q_OBJECT
17
18 public:
19
20 RfcommAssignDialog( QWidget* parent = 0, const char* name = 0,bool modal = 0, WFlags fl = 0 );
21 ~RfcommAssignDialog();
22
23 void loadConfig();
24 void saveConfig();
25
26 void newDevice( const QString & mac );
27
28 private:
29 QScrollView *m_scrollView;
30 // how many rfcomm devices are possible
31 int m_range;
32 QMap< int, RfcommDialogItem* > m_itemList;
33 QVBox *m_box;
34 RfCommConfHandler *confHandler;
35};
36
37}
38
39#endif
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp
new file mode 100644
index 0000000..1e7130f
--- a/dev/null
+++ b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp
@@ -0,0 +1,54 @@
1
2#include "rfcommassigndialogitem.h"
3
4#include <qlineedit.h>
5#include <qcombobox.h>
6#include <qlabel.h>
7#include <qgroupbox.h>
8
9using namespace OpieTooth;
10
11
12RfcommDialogItem::RfcommDialogItem( QWidget* parent, const char* name, WFlags fl )
13 : RfcommDialogItemBase( parent, name, fl ) {
14
15}
16
17RfcommDialogItem::~RfcommDialogItem() {
18}
19
20
21int RfcommDialogItem::ident() {
22 return m_ident;
23}
24
25QString RfcommDialogItem::mac() {
26 return m_macAddress->text();
27}
28
29int RfcommDialogItem::channel() {
30 return m_channelDropdown->currentItem();
31}
32
33QString RfcommDialogItem::comment() {
34 return m_commentLine->text();
35}
36
37void RfcommDialogItem::setIdent( int ident ) {
38 m_ident = ident;
39 m_identLabel->setTitle( QString( "rfcomm%1").arg( ident ) );
40}
41
42void RfcommDialogItem::setMac( const QString &mac ) {
43 m_macAddress->setText( mac );
44}
45
46void RfcommDialogItem::setChannel( int channel ) {
47 m_channelDropdown->setCurrentItem( channel );
48}
49
50void RfcommDialogItem::setComment( const QString &comment ) {
51 m_commentLine->setText( comment );
52}
53
54
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogitem.h b/noncore/net/opietooth/manager/rfcommassigndialogitem.h
new file mode 100644
index 0000000..34a794f
--- a/dev/null
+++ b/noncore/net/opietooth/manager/rfcommassigndialogitem.h
@@ -0,0 +1,40 @@
1#ifndef RFCOMMDIALOGITEM
2#define RFCOMMDIALOGITEM
3
4#include "rfcommdialogitembase.h"
5
6#include <qwidget.h>
7
8namespace OpieTooth {
9
10 class RfcommDialogItem : public RfcommDialogItemBase {
11
12 Q_OBJECT
13
14 public:
15 RfcommDialogItem( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
16 ~RfcommDialogItem();
17
18 // number if the rfcomm device
19 int ident();
20 // devices mac address
21 QString mac();
22 int channel();
23 QString comment();
24
25 void setIdent( int ident );
26 void setMac( const QString& mac );
27 void setChannel( int channel );
28 void setComment( const QString& comment );
29
30 private:
31
32
33 int m_ident;
34
35};
36
37
38}
39
40#endif
diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.cpp b/noncore/net/opietooth/manager/rfcommconfhandler.cpp
new file mode 100644
index 0000000..20453e8
--- a/dev/null
+++ b/noncore/net/opietooth/manager/rfcommconfhandler.cpp
@@ -0,0 +1,114 @@
1
2#include <qtextstream.h>
3
4#include "rfcommconfhandler.h"
5
6
7using namespace OpieTooth;
8
9// move to lib
10
11
12RfCommConfObject::RfCommConfObject( int number, QString mac, int channel, QString comment ) {
13 m_number = number;
14 m_mac = mac;
15 m_channel = channel;
16 m_comment = comment;
17 // m_foundEntries = 0;
18}
19
20void RfCommConfObject::setNumber( int number ) {
21 m_number = number;
22}
23
24void RfCommConfObject::setMac( QString mac ) {
25 m_mac = mac;
26}
27
28void RfCommConfObject::setChannel( int channel ) {
29 m_channel = channel;
30}
31
32void RfCommConfObject::setComment( QString comment ) {
33 m_comment = comment;
34}
35
36
37RfCommConfObject::~RfCommConfObject() {
38}
39
40
41RfCommConfHandler::RfCommConfHandler( const QString & filename ) {
42
43 m_filename = filename;
44 load();
45}
46
47RfCommConfHandler::~RfCommConfHandler() {
48
49}
50
51void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) {
52
53 QFile rfCommConf( "/tmp/test" );
54 QTextStream outStream( &rfCommConf );
55 if ( rfCommConf.open( IO_WriteOnly ) ) {
56
57 QMap<QString, RfCommConfObject*>::Iterator it;
58 for( it = devices.begin(); it != devices.end(); ++it ) {
59 outStream << "rfcomm" + QString("%1").arg( it.data()->number() ) + " {\n";
60 outStream << " device " + it.data()->mac() + ";\n";
61 outStream << " channel " + QString( "%1" ).arg( it.data()->channel() ) + ";\n";
62 outStream << " comment \"" + it.data()->comment() + "\";\n";
63 outStream << "}\n\n";
64 }
65
66 rfCommConf.close();
67 }
68}
69
70
71QMap<QString, RfCommConfObject*> RfCommConfHandler::foundEntries() {
72 return m_foundEntries;
73}
74
75void RfCommConfHandler::load() {
76
77 QFile rfCommConf( m_filename );
78 if ( rfCommConf.open( IO_ReadOnly ) ) {
79
80 QStringList list;
81 QTextStream inStream( &rfCommConf );
82 list = QStringList::split( "\n", inStream.read() );
83
84 QString number;
85 QString mac;
86 QString channel;
87 QString comment;
88
89 for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) {
90
91 QString tmpLine = ( *line ).stripWhiteSpace();
92
93 if ( tmpLine.startsWith("rfcomm") ) {
94 QString number = tmpLine.mid( 6,1 );
95 qDebug( tmpLine );
96 qDebug( "TEST " + number );
97 } else if ( tmpLine.startsWith( "}" ) ) {
98 m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) );
99 } else if ( tmpLine.startsWith( "device" ) ) {
100 mac = tmpLine.mid( 7, 17 );
101 qDebug( "mac" + mac );
102 } else if ( tmpLine.startsWith( "channel" ) ) {
103 channel = tmpLine.mid( 8, 1 );
104 qDebug ( "Channel :" + channel );
105 } else if ( tmpLine.startsWith( "comment" ) ) {
106 comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 );
107 qDebug( "Comment: " + comment );
108 }
109 }
110 rfCommConf.close();
111 }
112 save( m_foundEntries );
113 qDebug( QString( "ENTries: %1").arg( m_foundEntries.count() ) );
114}
diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.h b/noncore/net/opietooth/manager/rfcommconfhandler.h
new file mode 100644
index 0000000..e13c833
--- a/dev/null
+++ b/noncore/net/opietooth/manager/rfcommconfhandler.h
@@ -0,0 +1,54 @@
1#ifndef RFCOMMCONFHANDLER
2#define RFCOMMCONFHANDLER
3
4#include <qstring.h>
5#include <qfile.h>
6#include <qobject.h>
7#include <qmap.h>
8
9namespace OpieTooth {
10
11 class RfCommConfObject {
12
13 public:
14 RfCommConfObject( int number, QString mac, int channel, QString comment );
15 ~RfCommConfObject();
16
17 void setNumber( int number );
18 int number() { return m_number; };
19 void setMac( QString mac );
20 QString mac() { return m_mac; };
21 void setChannel( int channel );
22 int channel() { return m_channel; };
23 void setComment( QString comment );
24 QString comment() { return m_comment; };
25
26
27 private:
28 int m_number;
29 QString m_mac;
30 int m_channel;
31 QString m_comment;
32
33 };
34
35 class RfCommConfHandler {
36
37 public:
38 RfCommConfHandler( const QString & filename );
39 ~RfCommConfHandler();
40
41 void save( QMap<QString, RfCommConfObject*> devices );
42
43 QMap<QString, RfCommConfObject*> foundEntries();
44
45 private:
46 void load();
47
48 QString m_filename;
49 QMap<QString, RfCommConfObject*> m_foundEntries;
50 };
51
52}
53
54#endif
diff --git a/noncore/net/opietooth/manager/rfcommdialogitembase.ui b/noncore/net/opietooth/manager/rfcommdialogitembase.ui
new file mode 100644
index 0000000..dafca52
--- a/dev/null
+++ b/noncore/net/opietooth/manager/rfcommdialogitembase.ui
@@ -0,0 +1,216 @@
1<!DOCTYPE UI><UI>
2<class>RfcommDialogItemBase</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>RfcommDialogItemBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>345</width>
15 <height>95</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Form2</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>0</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>0</number>
36 </property>
37 <widget>
38 <class>QGroupBox</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>m_identLabel</cstring>
42 </property>
43 <property>
44 <name>layoutMargin</name>
45 </property>
46 <property>
47 <name>layoutSpacing</name>
48 </property>
49 <grid>
50 <property stdset="1">
51 <name>margin</name>
52 <number>5</number>
53 </property>
54 <property stdset="1">
55 <name>spacing</name>
56 <number>5</number>
57 </property>
58 <widget row="0" column="0" >
59 <class>QLayoutWidget</class>
60 <property stdset="1">
61 <name>name</name>
62 <cstring>Layout3</cstring>
63 </property>
64 <hbox>
65 <property stdset="1">
66 <name>margin</name>
67 <number>0</number>
68 </property>
69 <property stdset="1">
70 <name>spacing</name>
71 <number>6</number>
72 </property>
73 <widget>
74 <class>QLabel</class>
75 <property stdset="1">
76 <name>name</name>
77 <cstring>TextLabel4</cstring>
78 </property>
79 <property stdset="1">
80 <name>text</name>
81 <string>Mac</string>
82 </property>
83 </widget>
84 <widget>
85 <class>QLineEdit</class>
86 <property stdset="1">
87 <name>name</name>
88 <cstring>m_macAddress</cstring>
89 </property>
90 </widget>
91 <widget>
92 <class>QLabel</class>
93 <property stdset="1">
94 <name>name</name>
95 <cstring>TextLabel5</cstring>
96 </property>
97 <property stdset="1">
98 <name>text</name>
99 <string>Channel</string>
100 </property>
101 </widget>
102 <widget>
103 <class>QComboBox</class>
104 <item>
105 <property>
106 <name>text</name>
107 <string>0</string>
108 </property>
109 </item>
110 <item>
111 <property>
112 <name>text</name>
113 <string>1</string>
114 </property>
115 </item>
116 <item>
117 <property>
118 <name>text</name>
119 <string>2</string>
120 </property>
121 </item>
122 <item>
123 <property>
124 <name>text</name>
125 <string>3</string>
126 </property>
127 </item>
128 <item>
129 <property>
130 <name>text</name>
131 <string>4</string>
132 </property>
133 </item>
134 <item>
135 <property>
136 <name>text</name>
137 <string>5</string>
138 </property>
139 </item>
140 <item>
141 <property>
142 <name>text</name>
143 <string>6</string>
144 </property>
145 </item>
146 <item>
147 <property>
148 <name>text</name>
149 <string>7</string>
150 </property>
151 </item>
152 <item>
153 <property>
154 <name>text</name>
155 <string>8</string>
156 </property>
157 </item>
158 <item>
159 <property>
160 <name>text</name>
161 <string>9</string>
162 </property>
163 </item>
164 <item>
165 <property>
166 <name>text</name>
167 <string>10</string>
168 </property>
169 </item>
170 <property stdset="1">
171 <name>name</name>
172 <cstring>m_channelDropdown</cstring>
173 </property>
174 </widget>
175 </hbox>
176 </widget>
177 <widget row="1" column="0" >
178 <class>QLayoutWidget</class>
179 <property stdset="1">
180 <name>name</name>
181 <cstring>Layout4</cstring>
182 </property>
183 <hbox>
184 <property stdset="1">
185 <name>margin</name>
186 <number>0</number>
187 </property>
188 <property stdset="1">
189 <name>spacing</name>
190 <number>6</number>
191 </property>
192 <widget>
193 <class>QLabel</class>
194 <property stdset="1">
195 <name>name</name>
196 <cstring>TextLabel3</cstring>
197 </property>
198 <property stdset="1">
199 <name>text</name>
200 <string>Comment:</string>
201 </property>
202 </widget>
203 <widget>
204 <class>QLineEdit</class>
205 <property stdset="1">
206 <name>name</name>
207 <cstring>m_commentLine</cstring>
208 </property>
209 </widget>
210 </hbox>
211 </widget>
212 </grid>
213 </widget>
214 </vbox>
215</widget>
216</UI>
diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp
index cc87b6c..d95f14b 100644
--- a/noncore/net/opietooth/manager/rfcpopup.cpp
+++ b/noncore/net/opietooth/manager/rfcpopup.cpp
@@ -1,85 +1,96 @@
1 1
2#include <qtimer.h> 2#include <qtimer.h>
3 3
4#include "pppdialog.h" 4#include "pppdialog.h"
5#include "rfcpopup.h" 5#include "rfcpopup.h"
6#include "rfcommassigndialogimpl.h"
6 7
7using namespace OpieTooth; 8using namespace OpieTooth;
8 9
9/* 10/*
10 * c'tor init the QAction 11 * c'tor init the QAction
11 */ 12 */
12RfcCommPopup::RfcCommPopup() 13RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
13 : QPopupMenu() { 14 : QPopupMenu() {
14 qWarning("RfcCommPopup c'tor"); 15 qWarning("RfcCommPopup c'tor");
15 16
16 QAction* a; 17 QAction* a;
17 18
19
20 m_item = item;
21
18 /* connect action */ 22 /* connect action */
19 a = new QAction( ); // so it's get deleted 23 a = new QAction( ); // so it's get deleted
20 a->setText("Connect"); 24 a->setText("Connect");
21 a->addTo( this ); 25 a->addTo( this );
22 connect( a, SIGNAL( activated() ), 26 connect( a, SIGNAL( activated() ),
23 this, SLOT( slotConnect() ) ); 27 this, SLOT( slotConnect() ) );
24 28
25 29
26 /* disconnect action */ 30 /* disconnect action */
27 a = new QAction( ); 31 a = new QAction( );
28 a->setText("Disconnect"); 32 a->setText("Disconnect");
29 a->addTo( this ); 33 a->addTo( this );
30 connect( a, SIGNAL( activated() ) , 34 connect( a, SIGNAL( activated() ) ,
31 this, SLOT( slotDisconnect() ) ); 35 this, SLOT( slotDisconnect() ) );
32 36
33 37
34 /* foo action */ 38 /* foo action */
35 a = new QAction( ); 39 a = new QAction( );
36 a->setText("Foo"); 40 a->setText("Bind table");
37 a->addTo( this ); 41 a->addTo( this );
38 connect( a, SIGNAL( activated() ), 42 connect( a, SIGNAL( activated() ),
39 this, SLOT( slotFoo() ) ); 43 this, SLOT( slotBind() ) );
40 44
41 45
42 /* bar action */ 46 /* bar action */
43 a = new QAction( ); 47 a = new QAction( );
44 a->setText( "Bar" ); 48 a->setText( "Bar" );
45 a->addTo( this ); 49 a->addTo( this );
46 connect( a, SIGNAL( activated() ), 50 connect( a, SIGNAL( activated() ),
47 this, SLOT( slotBar() ) ); 51 this, SLOT( slotBar() ) );
48 52
49}; 53};
50 54
51 55
52RfcCommPopup::~RfcCommPopup() { 56RfcCommPopup::~RfcCommPopup() {
53/* delete m_con; 57/* delete m_con;
54 delete m_dis; 58 delete m_dis;
55 delete m_foo; 59 delete m_foo;
56 delete m_bar; */ 60 delete m_bar; */
57} 61}
58 62
59 63
60void RfcCommPopup::slotConnect() { 64void RfcCommPopup::slotConnect() {
61 65
62 qWarning("connect"); 66 qWarning("connect");
63 67
64 68
65 69
66 PPPDialog pppDialog; 70 PPPDialog pppDialog;
67 pppDialog.showMaximized(); 71 pppDialog.showMaximized();
68 pppDialog.exec(); 72 pppDialog.exec();
69} 73}
70 74
71 75
72void RfcCommPopup::slotDisconnect() { 76void RfcCommPopup::slotDisconnect() {
73 qWarning("slot disconnected"); 77 qWarning("slot disconnected");
74} 78}
75 79
76 80
77void RfcCommPopup::slotFoo() { 81void RfcCommPopup::slotBind() {
78 qWarning("slotFoo"); 82 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
83
84 rfcommAssign.showMaximized();
85 rfcommAssign.newDevice( m_item->mac() );
86
87 if ( rfcommAssign.exec() == QDialog::Accepted ) {
88 rfcommAssign.saveConfig();
89 }
79} 90}
80 91
81 92
82void RfcCommPopup::slotBar() { 93void RfcCommPopup::slotBar() {
83 qWarning("slotBar"); 94 qWarning("slotBar");
84}; 95};
85 96
diff --git a/noncore/net/opietooth/manager/rfcpopup.h b/noncore/net/opietooth/manager/rfcpopup.h
index c388f65..74b9117 100644
--- a/noncore/net/opietooth/manager/rfcpopup.h
+++ b/noncore/net/opietooth/manager/rfcpopup.h
@@ -1,36 +1,39 @@
1#ifndef RFCPOPUP_H 1#ifndef RFCPOPUP_H
2#define RFCPOPUP_H 2#define RFCPOPUP_H
3 3
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qaction.h> 5#include <qaction.h>
6 6
7#include "btdeviceitem.h"
8
7namespace OpieTooth { 9namespace OpieTooth {
8 /** 10 /**
9 * A simple reference implementation for 11 * A simple reference implementation for
10 * the popup helper factory. 12 * the popup helper factory.
11 * This class derives from QPopupMenu and uses 13 * This class derives from QPopupMenu and uses
12 * plugged QActions to do all the nasty in it's 14 * plugged QActions to do all the nasty in it's
13 * slots. After the work is done everything must 15 * slots. After the work is done everything must
14 * be deleted. 16 * be deleted.
15 */ 17 */
16 class RfcCommPopup : public QPopupMenu { 18 class RfcCommPopup : public QPopupMenu {
17 Q_OBJECT 19 Q_OBJECT
18 public: 20 public:
19 RfcCommPopup(); 21 RfcCommPopup( OpieTooth::BTDeviceItem* );
20 ~RfcCommPopup(); 22 ~RfcCommPopup();
21 23
22 24
23 private: 25 private:
24 QAction* m_con; 26 QAction* m_con;
25 QAction* m_dis; 27 QAction* m_dis;
26 QAction* m_foo; 28 QAction* m_bind;
27 QAction* m_bar; 29 QAction* m_bar;
30 OpieTooth::BTDeviceItem *m_item;
28 private slots: 31 private slots:
29 void slotConnect(); 32 void slotConnect();
30 void slotDisconnect(); 33 void slotDisconnect();
31 void slotFoo(); 34 void slotBind();
32 void slotBar(); 35 void slotBar();
33 }; 36 };
34}; 37};
35 38
36#endif 39#endif
diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp
index 38b8ee7..e1f8396 100644
--- a/noncore/net/opietooth/manager/stdpopups.cpp
+++ b/noncore/net/opietooth/manager/stdpopups.cpp
@@ -1,26 +1,26 @@
1 1
2#include "rfcpopup.h" 2#include "rfcpopup.h"
3#include "obexpopup.h" 3#include "obexpopup.h"
4#include "panpopup.h" 4#include "panpopup.h"
5#include "dunpopup.h" 5#include "dunpopup.h"
6 6
7#include "stdpopups.h" 7#include "stdpopups.h"
8 8
9extern "C" { 9extern "C" {
10 10
11 QPopupMenu* newRfcComPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { 11 QPopupMenu* newRfcComPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
12 return new OpieTooth::RfcCommPopup(/* servive, item*/ ); // fix spellin RfComm vs. RfcComm and paramaters 12 return new OpieTooth::RfcCommPopup(/* servive,*/ item ); // fix spellin RfComm vs. RfcComm and paramaters
13 //return 0l; 13 //return 0l;
14 } 14 }
15 QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) { 15 QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) {
16 return new OpieTooth::ObexPopup(); 16 return new OpieTooth::ObexPopup();
17 } 17 }
18 QPopupMenu* newPanPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { 18 QPopupMenu* newPanPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
19 return new OpieTooth::PanPopup( item ); 19 return new OpieTooth::PanPopup( item );
20 } 20 }
21 21
22 QPopupMenu* newDunPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { 22 QPopupMenu* newDunPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) {
23 return new OpieTooth::DunPopup( item ); 23 return new OpieTooth::DunPopup( item );
24 } 24 }
25} 25}
26 26
diff --git a/noncore/net/ubrowser/main.cpp b/noncore/net/ubrowser/main.cpp
index e4a873d..0488cfd 100644
--- a/noncore/net/ubrowser/main.cpp
+++ b/noncore/net/ubrowser/main.cpp
@@ -1,29 +1,24 @@
1/* 1/*
2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing 2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing
3Copyright (C) 2002 Thomas Stephens 3Copyright (C) 2002 Thomas Stephens
4 4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public 5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later 6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version. 7version.
8 8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details. 11Public License for more details.
12 12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free 13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/ 15*/
16 16
17#include <qpe/qpeapplication.h> 17#include <qpe/qpeapplication.h>
18 18
19#include "mainview.h" 19#include "mainview.h"
20 20
21int main( int argc, char **argv ) 21#include <opie/oapplicationfactory.h>
22{ 22
23 QPEApplication a( argc, argv ); 23OPIE_EXPORT_APP( OApplicationFactory<MainView> )
24 MainView w; 24
25
26 //a.setMainWidget( &w );
27 a.showMainDocumentWidget( &w );
28 return a.exec();
29}
diff --git a/noncore/net/ubrowser/mainview.cpp b/noncore/net/ubrowser/mainview.cpp
index 9302f05..0d3f171 100644
--- a/noncore/net/ubrowser/mainview.cpp
+++ b/noncore/net/ubrowser/mainview.cpp
@@ -1,44 +1,44 @@
1/* 1/*
2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing 2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing
3Copyright (C) 2002 Thomas Stephens 3Copyright (C) 2002 Thomas Stephens
4 4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public 5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later 6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version. 7version.
8 8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details. 11Public License for more details.
12 12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free 13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/ 15*/
16 16
17 17
18#include "mainview.h" 18#include "mainview.h"
19 19
20MainView::MainView(QWidget *parent, const char *name) : QMainWindow(parent, name) 20MainView::MainView(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, fl)
21{ 21{
22 setIcon( Resource::loadPixmap( "remote" ) ); 22 setIcon( Resource::loadPixmap( "remote" ) );
23 setCaption(tr("uBrowser")); 23 setCaption(tr("uBrowser"));
24 24
25 setToolBarsMovable( false ); 25 setToolBarsMovable( false );
26 26
27 QPEToolBar *toolbar = new QPEToolBar(this, "toolbar"); 27 QPEToolBar *toolbar = new QPEToolBar(this, "toolbar");
28 back = new QToolButton(Resource::loadPixmap("ubrowser/back"), 0, 0, 0, 0, toolbar, "back"); 28 back = new QToolButton(Resource::loadPixmap("ubrowser/back"), 0, 0, 0, 0, toolbar, "back");
29 forward = new QToolButton(Resource::loadPixmap("ubrowser/forward"), 0, 0, 0, 0, toolbar, "forward"); 29 forward = new QToolButton(Resource::loadPixmap("ubrowser/forward"), 0, 0, 0, 0, toolbar, "forward");
30 home = new QToolButton(Resource::loadPixmap("ubrowser/home"), 0, 0, 0, 0, toolbar, "home"); 30 home = new QToolButton(Resource::loadPixmap("ubrowser/home"), 0, 0, 0, 0, toolbar, "home");
31 location = new QComboBox(true, toolbar, "location"); 31 location = new QComboBox(true, toolbar, "location");
32 go = new QToolButton(Resource::loadPixmap("ubrowser/go"), 0, 0, 0, 0, toolbar, "go"); 32 go = new QToolButton(Resource::loadPixmap("ubrowser/go"), 0, 0, 0, 0, toolbar, "go");
33 33
34 toolbar->setStretchableWidget(location); 34 toolbar->setStretchableWidget(location);
35 toolbar->setHorizontalStretchable(true); 35 toolbar->setHorizontalStretchable(true);
36 location->setAutoCompletion( true ); 36 location->setAutoCompletion( true );
37 37
38 addToolBar(toolbar); 38 addToolBar(toolbar);
39 39
40 browser = new QTextBrowser(this, "browser"); 40 browser = new QTextBrowser(this, "browser");
41 setCentralWidget(browser); 41 setCentralWidget(browser);
42 42
43//make the button take you to the location 43//make the button take you to the location
44 connect(go, SIGNAL(clicked()), this, SLOT(goClicked()) ); 44 connect(go, SIGNAL(clicked()), this, SLOT(goClicked()) );
diff --git a/noncore/net/ubrowser/mainview.h b/noncore/net/ubrowser/mainview.h
index 20e2c70..cc63729 100644
--- a/noncore/net/ubrowser/mainview.h
+++ b/noncore/net/ubrowser/mainview.h
@@ -15,38 +15,39 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/ 15*/
16 16
17#include <qpe/resource.h> 17#include <qpe/resource.h>
18#include <qpe/qpetoolbar.h> 18#include <qpe/qpetoolbar.h>
19#include <qpe/applnk.h> 19#include <qpe/applnk.h>
20 20
21#include <qapplication.h> 21#include <qapplication.h>
22#include <qmainwindow.h> 22#include <qmainwindow.h>
23#include <qwidget.h> 23#include <qwidget.h>
24#include <qtextbrowser.h> 24#include <qtextbrowser.h>
25#include <qtoolbutton.h> 25#include <qtoolbutton.h>
26#include <qcombobox.h> 26#include <qcombobox.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qdir.h> 29#include <qdir.h>
30 30
31#include <stdio.h> 31#include <stdio.h>
32 32
33#include "httpfactory.h" 33#include "httpfactory.h"
34 34
35class MainView : public QMainWindow 35class MainView : public QMainWindow
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38public: 38public:
39 MainView(QWidget *parent=0, const char *name=0); 39 static QString appName() { return QString::fromLatin1("ubrowser"); }
40 MainView(QWidget *parent=0, const char *name=0, WFlags fl = 0);
40public slots: 41public slots:
41 void goClicked(); 42 void goClicked();
42 void textChanged(); 43 void textChanged();
43 void setDocument( const QString& applnk_filename ); 44 void setDocument( const QString& applnk_filename );
44private: 45private:
45 QToolButton *back; 46 QToolButton *back;
46 QToolButton *forward; 47 QToolButton *forward;
47 QToolButton *home; 48 QToolButton *home;
48 QToolButton *go; 49 QToolButton *go;
49 QComboBox *location; 50 QComboBox *location;
50 QTextBrowser *browser; 51 QTextBrowser *browser;
51 HttpFactory *http; 52 HttpFactory *http;
52}; 53};
diff --git a/noncore/net/ubrowser/ubrowser.pro b/noncore/net/ubrowser/ubrowser.pro
index a6943dd..ed00047 100644
--- a/noncore/net/ubrowser/ubrowser.pro
+++ b/noncore/net/ubrowser/ubrowser.pro
@@ -1,13 +1,11 @@
1 TEMPLATE=app 1 CONFIG +=qt warn_on release quick-app
2 CONFIG +=qt warn_on release
3 DESTDIR =../../../bin
4 HEADERS = mainview.h httpfactory.h 2 HEADERS = mainview.h httpfactory.h
5 SOURCES = main.cpp mainview.cpp httpfactory.cpp 3 SOURCES = main.cpp mainview.cpp httpfactory.cpp
6 INCLUDEPATH+=../../../include 4 INCLUDEPATH+=../../../include
7 DEPENDPATH+=../../../include 5 DEPENDPATH+=../../../include
8 LIBS += -lqpe 6 LIBS += -lqpe
9TARGET = ubrowser 7TARGET = ubrowser
10 8
11 9
12 10
13include ( $(OPIEDIR)/include.pro ) 11include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp
index 90664bb..8359acf 100644
--- a/noncore/unsupported/mailit/emailclient.cpp
+++ b/noncore/unsupported/mailit/emailclient.cpp
@@ -21,1022 +21,1022 @@
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include <qvbox.h> 22#include <qvbox.h>
23#include <qfile.h> 23#include <qfile.h>
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qmenubar.h> 25#include <qmenubar.h>
26#include <qaction.h> 26#include <qaction.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qpe/resource.h> 28#include <qpe/resource.h>
29#include "emailclient.h" 29#include "emailclient.h"
30#include "writemail.h" 30#include "writemail.h"
31 31
32QCollection::Item AccountList::newItem(QCollection::Item d) 32QCollection::Item AccountList::newItem(QCollection::Item d)
33{ 33{
34 return dupl( (MailAccount *) d); 34 return dupl( (MailAccount *) d);
35} 35}
36 36
37MailAccount* AccountList::dupl(MailAccount *in) 37MailAccount* AccountList::dupl(MailAccount *in)
38{ 38{
39 ac = new MailAccount(*in); 39 ac = new MailAccount(*in);
40 return ac; 40 return ac;
41} 41}
42 42
43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) 43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
44 : QMainWindow( parent, name, fl ) 44 : QMainWindow( parent, name, fl )
45{ 45{
46 emailHandler = new EmailHandler(); 46 emailHandler = new EmailHandler();
47 addressList = new AddressList(); 47 addressList = new AddressList();
48 48
49 sending = FALSE; 49 sending = FALSE;
50 receiving = FALSE; 50 receiving = FALSE;
51 previewingMail = FALSE; 51 previewingMail = FALSE;
52 mailIdCount = 1; 52 mailIdCount = 1;
53 accountIdCount = 1; 53 accountIdCount = 1;
54 allAccounts = FALSE; 54 allAccounts = FALSE;
55 55
56 init(); 56 init();
57 57
58 58
59 59
60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); 60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) );
61 61
62 connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this, 62 connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this,
63 SLOT(smtpError(int,const QString &)) ); 63 SLOT(smtpError(int,const QString &)) );
64 connect(emailHandler, SIGNAL(popError(int,const QString &)), this, 64 connect(emailHandler, SIGNAL(popError(int,const QString &)), this,
65 SLOT(popError(int,const QString &)) ); 65 SLOT(popError(int,const QString &)) );
66 66
67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); 67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); 68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
69 69
70 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); 70 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) );
71 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); 71 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) );
72 72
73 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, 73 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
74 SLOT(mailArrived(const Email &, bool)) ); 74 SLOT(mailArrived(const Email &, bool)) );
75 connect(emailHandler, SIGNAL(mailTransfered(int)), this, 75 connect(emailHandler, SIGNAL(mailTransfered(int)), this,
76 SLOT(allMailArrived(int)) ); 76 SLOT(allMailArrived(int)) );
77 77
78 mailconf = new Config("mailit"); 78 mailconf = new Config("mailit");
79 //In case Synchronize is not defined in settings.txt 79 //In case Synchronize is not defined in settings.txt
80 80
81 readSettings(); 81 readSettings();
82 82
83 updateAccounts(); 83 updateAccounts();
84 84
85 lineShift = "\n"; 85 lineShift = "\n";
86 readMail(); 86 readMail();
87 lineShift = "\r\n"; 87 lineShift = "\r\n";
88 88
89 mailboxView->setCurrentTab(0); //ensure that inbox has focus 89 mailboxView->setCurrentTab(0); //ensure that inbox has focus
90 90
91 /*channel = new QCopChannel( "QPE/Application/mailit", this ); 91 /*channel = new QCopChannel( "QPE/Application/mailit", this );
92 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 92 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
93 this, SLOT(receive(const QCString&, const QByteArray&)) );*/ 93 this, SLOT(receive(const QCString&, const QByteArray&)) );*/
94 94
95} 95}
96 96
97 97
98EmailClient::~EmailClient() 98EmailClient::~EmailClient()
99{ 99{
100 //needs to be moved from destructor to closewindow event 100 //needs to be moved from destructor to closewindow event
101 saveMail(getPath(FALSE) + "inbox.txt", inboxView); 101 saveMail(getPath(FALSE) + "inbox.txt", inboxView);
102 //does not currently work. Defining outbox in the same 102 //does not currently work. Defining outbox in the same
103 //format as inbox is not a good solution as they have 103 //format as inbox is not a good solution as they have
104 //different properties 104 //different properties
105 saveMail(getPath(FALSE) + "outbox.txt", outboxView); 105 saveMail(getPath(FALSE) + "outbox.txt", outboxView);
106 saveSettings(); 106 saveSettings();
107 107
108 mailconf->write(); 108 mailconf->write();
109 delete mailconf; 109 delete mailconf;
110 110
111} 111}
112 112
113void EmailClient::init() 113void EmailClient::init()
114{ 114{
115 initStatusBar(this); 115 initStatusBar(this);
116 116
117 setToolBarsMovable(FALSE); 117 setToolBarsMovable(FALSE);
118 118
119 bar = new QToolBar(this); 119 bar = new QToolBar(this);
120 QWhatsThis::add(bar,tr("Main operation toolbar")); 120 QWhatsThis::add(bar,tr("Main operation toolbar"));
121 bar->setHorizontalStretchable( TRUE ); 121 bar->setHorizontalStretchable( TRUE );
122 122
123 mb = new QMenuBar( bar ); 123 mb = new QMenuBar( bar );
124 124
125 QPopupMenu *mail = new QPopupMenu(mb); 125 QPopupMenu *mail = new QPopupMenu(mb);
126 mb->insertItem( tr( "&Mail" ), mail); 126 mb->insertItem( tr( "&Mail" ), mail);
127 127
128 QPopupMenu *configure = new QPopupMenu(mb); 128 QPopupMenu *configure = new QPopupMenu(mb);
129 mb->insertItem( tr( "Accounts" ), configure); 129 mb->insertItem( tr( "Accounts" ), configure);
130 130
131 selectAccountMenu = new QPopupMenu(mb); 131 selectAccountMenu = new QPopupMenu(mb);
132 editAccountMenu = new QPopupMenu(mb); 132 editAccountMenu = new QPopupMenu(mb);
133 deleteAccountMenu = new QPopupMenu(mb); 133 deleteAccountMenu = new QPopupMenu(mb);
134 134
135 mail->insertItem(tr("Get Mail in"), selectAccountMenu); 135 mail->insertItem(tr("Get Mail in"), selectAccountMenu);
136 configure->insertItem(tr("Edit account"), editAccountMenu); 136 configure->insertItem(tr("Edit account"), editAccountMenu);
137 configure->insertItem(tr("Delete account"), deleteAccountMenu); 137 configure->insertItem(tr("Delete account"), deleteAccountMenu);
138 138
139 bar = new QToolBar(this); 139 bar = new QToolBar(this);
140 140
141 getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); 141 getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar);
142 QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account.")); 142 QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account."));
143 143
144 getMailButton->setPopup(selectAccountMenu); 144 getMailButton->setPopup(selectAccountMenu);
145 145
146 sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); 146 sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0);
147 connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); 147 connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) );
148 sendMailButton->addTo(bar); 148 sendMailButton->addTo(bar);
149 sendMailButton->addTo(mail); 149 sendMailButton->addTo(mail);
150 sendMailButton->setWhatsThis("Send mail queued in the outbox"); 150 sendMailButton->setWhatsThis("Send mail queued in the outbox");
151 151
152 composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); 152 composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0);
153 connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); 153 connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) );
154 composeButton->addTo(bar); 154 composeButton->addTo(bar);
155 composeButton->addTo(mail); 155 composeButton->addTo(mail);
156 composeButton->setWhatsThis("Compose a new mail"); 156 composeButton->setWhatsThis("Compose a new mail");
157 157
158 cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); 158 cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0);
159 connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); 159 connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) );
160 cancelButton->addTo(mail); 160 cancelButton->addTo(mail);
161 cancelButton->addTo(bar); 161 cancelButton->addTo(bar);
162 cancelButton->setEnabled(FALSE); 162 cancelButton->setEnabled(FALSE);
163 cancelButton->setWhatsThis("Stop the currently active mail transfer"); 163 cancelButton->setWhatsThis("Stop the currently active mail transfer");
164 164
165 165
166 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); 166 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
167 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); 167 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
168 deleteButton->addTo(bar); 168 deleteButton->addTo(bar);
169 deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); 169 deleteButton->setWhatsThis("Remove the currently selected eMail(s)");
170 170
171 mailboxView = new OTabWidget( this, "mailboxView" ); 171 mailboxView = new OTabWidget( this, "mailboxView" );
172 172
173 QWidget* widget = new QWidget( mailboxView, "widget" ); 173 QWidget* widget = new QWidget( mailboxView, "widget" );
174 grid_2 = new QGridLayout( widget ); 174 grid_2 = new QGridLayout( widget );
175// grid_2->setSpacing(6); 175// grid_2->setSpacing(6);
176// grid_2->setMargin( 11 ); 176// grid_2->setMargin( 11 );
177 177
178 inboxView = new QListView( widget, "inboxView" ); 178 inboxView = new QListView( widget, "inboxView" );
179 inboxView->addColumn( tr( "From" ) ); 179 inboxView->addColumn( tr( "From" ) );
180 inboxView->addColumn( tr( "Subject" ) ); 180 inboxView->addColumn( tr( "Subject" ) );
181 inboxView->addColumn( tr( "Date" ) ); 181 inboxView->addColumn( tr( "Date" ) );
182 inboxView->setMinimumSize( QSize( 0, 0 ) ); 182 inboxView->setMinimumSize( QSize( 0, 0 ) );
183 inboxView->setAllColumnsShowFocus(TRUE); 183 inboxView->setAllColumnsShowFocus(TRUE);
184 QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n" 184 QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n"
185 "It keeps the fetched mail which can be \n" 185 "It keeps the fetched mail which can be \n"
186 "viewed by double clicking the entry.\n" 186 "viewed by double clicking the entry.\n"
187 "blue attachment icon shows whether this \n" 187 "blue attachment icon shows whether this \n"
188 "mailhas attachments.\n")); 188 "mailhas attachments.\n"));
189 189
190 grid_2->addWidget( inboxView, 2, 0 ); 190 grid_2->addWidget( inboxView, 2, 0 );
191 mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); 191 mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) );
192 192
193 QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); 193 QWidget* widget_2 = new QWidget( mailboxView, "widget_2" );
194 grid_3 = new QGridLayout( widget_2 ); 194 grid_3 = new QGridLayout( widget_2 );
195// grid_3->setSpacing(6); 195// grid_3->setSpacing(6);
196// grid_3->setMargin( 11 ); 196// grid_3->setMargin( 11 );
197 197
198 outboxView = new QListView( widget_2, "outboxView" ); 198 outboxView = new QListView( widget_2, "outboxView" );
199 outboxView->addColumn( tr( "To" ) ); 199 outboxView->addColumn( tr( "To" ) );
200 outboxView->addColumn( tr( "Subject" ) ); 200 outboxView->addColumn( tr( "Subject" ) );
201 outboxView->setAllColumnsShowFocus(TRUE); 201 outboxView->setAllColumnsShowFocus(TRUE);
202 202
203 QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" 203 QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n"
204 "It keeps the queued mails to send which can be \n" 204 "It keeps the queued mails to send which can be \n"
205 "reviewed by double clicking the entry.")); 205 "reviewed by double clicking the entry."));
206 grid_3->addWidget( outboxView, 0, 0 ); 206 grid_3->addWidget( outboxView, 0, 0 );
207 mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); 207 mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) );
208 208
209 setCentralWidget(mailboxView); 209 setCentralWidget(mailboxView);
210 210
211} 211}
212 212
213void EmailClient::initStatusBar(QWidget* parent) 213void EmailClient::initStatusBar(QWidget* parent)
214{ 214{
215 statusBar = new QStatusBar(parent); 215 statusBar = new QStatusBar(parent);
216 statusBar->setSizeGripEnabled(FALSE); 216 statusBar->setSizeGripEnabled(FALSE);
217 217
218 status1Label = new QLabel( tr("Idle"), statusBar); 218 status1Label = new QLabel( tr("Idle"), statusBar);
219 status2Label = new QLabel("", statusBar); 219 status2Label = new QLabel("", statusBar);
220 connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), 220 connect(emailHandler, SIGNAL(updatePopStatus(const QString &)),
221 status2Label, SLOT(setText(const QString &)) ); 221 status2Label, SLOT(setText(const QString &)) );
222 connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), 222 connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)),
223 status2Label, SLOT(setText(const QString &)) ); 223 status2Label, SLOT(setText(const QString &)) );
224 224
225 progressBar = new QProgressBar(statusBar); 225 progressBar = new QProgressBar(statusBar);
226 226
227 connect(emailHandler, SIGNAL(mailboxSize(int)), 227 connect(emailHandler, SIGNAL(mailboxSize(int)),
228 this, SLOT(setTotalSize(int)) ); 228 this, SLOT(setTotalSize(int)) );
229 connect(emailHandler, SIGNAL(currentMailSize(int)), 229 connect(emailHandler, SIGNAL(currentMailSize(int)),
230 this, SLOT(setMailSize(int)) ); 230 this, SLOT(setMailSize(int)) );
231 connect(emailHandler, SIGNAL(downloadedSize(int)), 231 connect(emailHandler, SIGNAL(downloadedSize(int)),
232 this, SLOT(setDownloadedSize(int)) ); 232 this, SLOT(setDownloadedSize(int)) );
233 233
234 statusBar->addWidget(status1Label); 234 statusBar->addWidget(status1Label);
235 statusBar->addWidget(progressBar); 235 statusBar->addWidget(progressBar);
236 statusBar->addWidget(status2Label); 236 statusBar->addWidget(status2Label);
237 237
238} 238}
239 239
240void EmailClient::compose() 240void EmailClient::compose()
241{ 241{
242 emit composeRequested(); 242 emit composeRequested();
243} 243}
244 244
245void EmailClient::cancel() 245void EmailClient::cancel()
246{ 246{
247 emailHandler->cancel(); 247 emailHandler->cancel();
248} 248}
249 249
250AddressList* EmailClient::getAdrListRef() 250AddressList* EmailClient::getAdrListRef()
251{ 251{
252 return addressList; 252 return addressList;
253} 253}
254 254
255//this needs to be rewritten to syncronize with outboxView 255//this needs to be rewritten to syncronize with outboxView
256void EmailClient::enqueMail(const Email &mail) 256void EmailClient::enqueMail(const Email &mail)
257{ 257{
258 if (accountList.count() == 0) { 258 if (accountList.count() == 0) {
259 QMessageBox::warning(qApp->activeWindow(), 259 QMessageBox::warning(qApp->activeWindow(),
260 tr("No account selected"), tr("You must create an account"), "OK\n"); 260 tr("No account selected"), tr("You must create an account"), "OK\n");
261 return; 261 return;
262 } 262 }
263 263
264 if (accountList.count() > 0) { 264 if (accountList.count() > 0) {
265 currentAccount = accountList.first(); 265 currentAccount = accountList.first();
266 qWarning("using account " + currentAccount->name); 266 qWarning("using account " + currentAccount->name);
267 } 267 }
268 268
269 Email addMail = mail; 269 Email addMail = mail;
270 addMail.from = currentAccount->name; 270 addMail.from = currentAccount->name;
271 addMail.fromMail = currentAccount->emailAddress; 271 addMail.fromMail = currentAccount->emailAddress;
272 addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n"); 272 addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n");
273 item = new EmailListItem(outboxView, addMail, false); 273 item = new EmailListItem(outboxView, addMail, false);
274 274
275 mailboxView->setCurrentTab(1); 275 mailboxView->setCurrentTab(1);
276 276
277} 277}
278 278
279void EmailClient::sendQuedMail() 279void EmailClient::sendQuedMail()
280{ 280{
281 int count = 0; 281 int count = 0;
282 282
283 if (accountList.count() == 0) { 283 if (accountList.count() == 0) {
284 QMessageBox::warning(qApp->activeWindow(), "No account selected", "You must create an account", "OK\n"); 284 QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n");
285 return; 285 return;
286 } 286 }
287 //traverse listview, find messages to send 287 //traverse listview, find messages to send
288 if (! sending) { 288 if (! sending) {
289 item = (EmailListItem *) outboxView->firstChild(); 289 item = (EmailListItem *) outboxView->firstChild();
290 if (item != NULL) { 290 if (item != NULL) {
291 while (item != NULL) { 291 while (item != NULL) {
292 quedMessages.append(item->getMail()); 292 quedMessages.append(item->getMail());
293 item = (EmailListItem *) item->nextSibling(); 293 item = (EmailListItem *) item->nextSibling();
294 count++; 294 count++;
295 } 295 }
296 setMailAccount(); 296 setMailAccount();
297 emailHandler->sendMail(&quedMessages); 297 emailHandler->sendMail(&quedMessages);
298 sending = TRUE; 298 sending = TRUE;
299 sendMailButton->setEnabled(FALSE); 299 sendMailButton->setEnabled(FALSE);
300 cancelButton->setEnabled(TRUE); 300 cancelButton->setEnabled(TRUE);
301 } else { 301 } else {
302 qWarning("sendQuedMail(): no messages to send"); 302 qWarning("sendQuedMail(): no messages to send");
303 } 303 }
304 } 304 }
305} 305}
306 306
307void EmailClient::setMailAccount() 307void EmailClient::setMailAccount()
308{ 308{
309 emailHandler->setAccount(*currentAccount); 309 emailHandler->setAccount(*currentAccount);
310} 310}
311 311
312void EmailClient::mailSent() 312void EmailClient::mailSent()
313{ 313{
314 sending = FALSE; 314 sending = FALSE;
315 sendMailButton->setEnabled(TRUE); 315 sendMailButton->setEnabled(TRUE);
316 316
317 quedMessages.clear(); 317 quedMessages.clear();
318 outboxView->clear(); //should be moved to an sentBox 318 outboxView->clear(); //should be moved to an sentBox
319} 319}
320 320
321void EmailClient::getNewMail() { 321void EmailClient::getNewMail() {
322 322
323 if (accountList.count() == 0) { 323 if (accountList.count() == 0) {
324 QMessageBox::warning(qApp->activeWindow(),"No account selected", 324 QMessageBox::warning(qApp->activeWindow(),tr("No account selected"),
325 "You must create an account", "OK\n"); 325 tr("You must create an account"), "OK\n");
326 return; 326 return;
327 } 327 }
328 328
329 setMailAccount(); 329 setMailAccount();
330 330
331 receiving = TRUE; 331 receiving = TRUE;
332 previewingMail = TRUE; 332 previewingMail = TRUE;
333 getMailButton->setEnabled(FALSE); 333 getMailButton->setEnabled(FALSE);
334 cancelButton->setEnabled(TRUE); 334 cancelButton->setEnabled(TRUE);
335 selectAccountMenu->setEnabled(FALSE); 335 selectAccountMenu->setEnabled(FALSE);
336 336
337 status1Label->setText(currentAccount->accountName + " headers"); 337 status1Label->setText(currentAccount->accountName + " headers");
338 progressBar->reset(); 338 progressBar->reset();
339 339
340 //get any previous mails not downloaded and add to queue 340 //get any previous mails not downloaded and add to queue
341 /*mailDownloadList.clear(); 341 /*mailDownloadList.clear();
342 Email *mailPtr; 342 Email *mailPtr;
343 item = (EmailListItem *) inboxView->firstChild(); 343 item = (EmailListItem *) inboxView->firstChild();
344 while (item != NULL) { 344 while (item != NULL) {
345 mailPtr = item->getMail(); 345 mailPtr = item->getMail();
346 if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { 346 if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) {
347 mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); 347 mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size);
348 } 348 }
349 item = (EmailListItem *) item->nextSibling(); 349 item = (EmailListItem *) item->nextSibling();
350 }*/ 350 }*/
351 351
352 emailHandler->getMailHeaders(); 352 emailHandler->getMailHeaders();
353 353
354} 354}
355 355
356void EmailClient::getAllNewMail() 356void EmailClient::getAllNewMail()
357{ 357{
358 allAccounts = TRUE; 358 allAccounts = TRUE;
359 currentAccount = accountList.first(); 359 currentAccount = accountList.first();
360 getNewMail(); 360 getNewMail();
361} 361}
362 362
363void EmailClient::mailArrived(const Email &mail, bool fromDisk) 363void EmailClient::mailArrived(const Email &mail, bool fromDisk)
364{ 364{
365 Enclosure *ePtr; 365 Enclosure *ePtr;
366 Email newMail; 366 Email newMail;
367 int thisMailId; 367 int thisMailId;
368 emailHandler->parse( mail.rawMail, lineShift, &newMail); 368 emailHandler->parse( mail.rawMail, lineShift, &newMail);
369 mailconf->setGroup(newMail.id); 369 mailconf->setGroup(newMail.id);
370 370
371 if (fromDisk) 371 if (fromDisk)
372 { 372 {
373 373
374 newMail.downloaded = mailconf->readBoolEntry("downloaded"); 374 newMail.downloaded = mailconf->readBoolEntry("downloaded");
375 newMail.size = mailconf->readNumEntry("size"); 375 newMail.size = mailconf->readNumEntry("size");
376 newMail.serverId = mailconf->readNumEntry("serverid"); 376 newMail.serverId = mailconf->readNumEntry("serverid");
377 newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); 377 newMail.fromAccountId = mailconf->readNumEntry("fromaccountid");
378 } 378 }
379 else 379 else
380 { //mail arrived from server 380 { //mail arrived from server
381 381
382 newMail.serverId = mail.serverId; 382 newMail.serverId = mail.serverId;
383 newMail.size = mail.size; 383 newMail.size = mail.size;
384 newMail.downloaded = mail.downloaded; 384 newMail.downloaded = mail.downloaded;
385 385
386 newMail.fromAccountId = emailHandler->getAccount()->id; 386 newMail.fromAccountId = emailHandler->getAccount()->id;
387 mailconf->writeEntry("fromaccountid", newMail.fromAccountId); 387 mailconf->writeEntry("fromaccountid", newMail.fromAccountId);
388 } 388 }
389 389
390 //add if read or not 390 //add if read or not
391 newMail.read = mailconf->readBoolEntry("mailread"); 391 newMail.read = mailconf->readBoolEntry("mailread");
392 392
393 //check if new mail 393 //check if new mail
394 if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { 394 if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) {
395 thisMailId = mailIdCount; 395 thisMailId = mailIdCount;
396 mailIdCount++; 396 mailIdCount++;
397 397
398 //set server count, so that if the user aborts, the new 398 //set server count, so that if the user aborts, the new
399 //header is not reloaded 399 //header is not reloaded
400 if ((currentAccount)&&(currentAccount->synchronize)) 400 if ((currentAccount)&&(currentAccount->synchronize))
401 currentAccount->lastServerMailCount++; 401 currentAccount->lastServerMailCount++;
402 402
403 mailconf->writeEntry("internalmailid", thisMailId); 403 mailconf->writeEntry("internalmailid", thisMailId);
404 mailconf->writeEntry("downloaded", newMail.downloaded); 404 mailconf->writeEntry("downloaded", newMail.downloaded);
405 mailconf->writeEntry("size", (int) newMail.size); 405 mailconf->writeEntry("size", (int) newMail.size);
406 mailconf->writeEntry("serverid", newMail.serverId); 406 mailconf->writeEntry("serverid", newMail.serverId);
407 407
408 //addressList->addContact(newMail.fromMail, newMail.from); 408 //addressList->addContact(newMail.fromMail, newMail.from);
409 } 409 }
410 410
411 mailconf->writeEntry("downloaded", newMail.downloaded); 411 mailconf->writeEntry("downloaded", newMail.downloaded);
412 412
413 QString stringMailId; 413 QString stringMailId;
414 stringMailId.setNum(thisMailId); 414 stringMailId.setNum(thisMailId);
415 //see if any attatchments needs to be stored 415 //see if any attatchments needs to be stored
416 416
417 for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { 417 for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) {
418 QString stringId; 418 QString stringId;
419 stringId.setNum(ePtr->id); 419 stringId.setNum(ePtr->id);
420 420
421 int id = mailconf->readNumEntry("enclosureid_" + stringId); 421 int id = mailconf->readNumEntry("enclosureid_" + stringId);
422 if (id != ePtr->id) { //new entry 422 if (id != ePtr->id) { //new entry
423 mailconf->writeEntry("enclosureid_" + stringId, ePtr->id); 423 mailconf->writeEntry("enclosureid_" + stringId, ePtr->id);
424 mailconf->writeEntry("name_" + stringId, ePtr->originalName); 424 mailconf->writeEntry("name_" + stringId, ePtr->originalName);
425 mailconf->writeEntry("contenttype_" + stringId, ePtr->contentType); 425 mailconf->writeEntry("contenttype_" + stringId, ePtr->contentType);
426 mailconf->writeEntry("contentattribute_" + stringId, ePtr->contentAttribute); 426 mailconf->writeEntry("contentattribute_" + stringId, ePtr->contentAttribute);
427 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 427 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
428 mailconf->writeEntry("installed_" + stringId, FALSE); 428 mailconf->writeEntry("installed_" + stringId, FALSE);
429 429
430 ePtr->name = stringMailId + "_" + stringId; 430 ePtr->name = stringMailId + "_" + stringId;
431 ePtr->path = getPath(TRUE); 431 ePtr->path = getPath(TRUE);
432 if (emailHandler->getEnclosure(ePtr)) { //file saved 432 if (emailHandler->getEnclosure(ePtr)) { //file saved
433 ePtr->saved = TRUE; 433 ePtr->saved = TRUE;
434 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 434 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
435 mailconf->writeEntry("filename_" + stringId, ePtr->name); 435 mailconf->writeEntry("filename_" + stringId, ePtr->name);
436 mailconf->writeEntry("path_" + stringId, ePtr->path); 436 mailconf->writeEntry("path_" + stringId, ePtr->path);
437 } else { 437 } else {
438 ePtr->saved = FALSE; 438 ePtr->saved = FALSE;
439 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 439 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
440 } 440 }
441 } else { 441 } else {
442 ePtr->saved = mailconf->readBoolEntry("saved_" + stringId); 442 ePtr->saved = mailconf->readBoolEntry("saved_" + stringId);
443 ePtr->installed = mailconf->readBoolEntry("installed_" + stringId); 443 ePtr->installed = mailconf->readBoolEntry("installed_" + stringId);
444 if (ePtr->saved) { 444 if (ePtr->saved) {
445 ePtr->name = mailconf->readEntry("filename_" + stringId); 445 ePtr->name = mailconf->readEntry("filename_" + stringId);
446 ePtr->path = mailconf->readEntry("path_" + stringId); 446 ePtr->path = mailconf->readEntry("path_" + stringId);
447 } 447 }
448 } 448 }
449 } 449 }
450 450
451 bool found=false; 451 bool found=false;
452 452
453 if (!fromDisk) 453 if (!fromDisk)
454 { 454 {
455 455
456 Email *mailPtr; 456 Email *mailPtr;
457 item = (EmailListItem *) inboxView->firstChild(); 457 item = (EmailListItem *) inboxView->firstChild();
458 while ((item != NULL)&&(!found)) 458 while ((item != NULL)&&(!found))
459 { 459 {
460 mailPtr = item->getMail(); 460 mailPtr = item->getMail();
461 if (mailPtr->id == newMail.id) { 461 if (mailPtr->id == newMail.id) {
462 item->setMail(newMail); 462 item->setMail(newMail);
463 emit mailUpdated(item->getMail()); 463 emit mailUpdated(item->getMail());
464 found = true; 464 found = true;
465 } 465 }
466 item = (EmailListItem *) item->nextSibling(); 466 item = (EmailListItem *) item->nextSibling();
467 } 467 }
468 } 468 }
469 if ((!found)||(fromDisk)) { 469 if ((!found)||(fromDisk)) {
470 item = new EmailListItem(inboxView, newMail, TRUE); 470 item = new EmailListItem(inboxView, newMail, TRUE);
471 } 471 }
472// if (item->getMail()->files.count()>0) 472// if (item->getMail()->files.count()>0)
473// { 473// {
474// item->setPixmap(0, Resource::loadPixmap("mailit/attach")); 474// item->setPixmap(0, Resource::loadPixmap("mailit/attach"));
475// } 475// }
476 /*if (!newMail.downloaded) 476 /*if (!newMail.downloaded)
477 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ 477 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/
478 478
479 mailboxView->setCurrentTab(0); 479 mailboxView->setCurrentTab(0);
480 480
481} 481}
482 482
483void EmailClient::allMailArrived(int /*count*/) 483void EmailClient::allMailArrived(int /*count*/)
484{ 484{
485 // not previewing means all mailtransfer has been done 485 // not previewing means all mailtransfer has been done
486 /*if (!previewingMail) {*/ 486 /*if (!previewingMail) {*/
487 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { 487 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) {
488 emit newCaption("Mailit - " + currentAccount->accountName); 488 emit newCaption("Mailit - " + currentAccount->accountName);
489 getNewMail(); 489 getNewMail();
490 return; 490 return;
491 } else { 491 } else {
492 allAccounts = FALSE; 492 allAccounts = FALSE;
493 receiving = FALSE; 493 receiving = FALSE;
494 getMailButton->setEnabled(TRUE); 494 getMailButton->setEnabled(TRUE);
495 cancelButton->setEnabled(FALSE); 495 cancelButton->setEnabled(FALSE);
496 selectAccountMenu->setEnabled(TRUE); 496 selectAccountMenu->setEnabled(TRUE);
497 status1Label->setText("Idle"); 497 status1Label->setText("Idle");
498 498
499 progressBar->reset(); 499 progressBar->reset();
500 return; 500 return;
501 } 501 }
502 //} 502 //}
503 503
504 // all headers downloaded from server, start downloading remaining mails 504 // all headers downloaded from server, start downloading remaining mails
505 previewingMail = FALSE; 505 previewingMail = FALSE;
506 status1Label->setText(currentAccount->accountName); 506 status1Label->setText(currentAccount->accountName);
507 progressBar->reset(); 507 progressBar->reset();
508 508
509 509
510 mailboxView->setCurrentTab(0); 510 mailboxView->setCurrentTab(0);
511} 511}
512 512
513 513
514void EmailClient::moveMailFront(Email *mailPtr) 514void EmailClient::moveMailFront(Email *mailPtr)
515{ 515{
516 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { 516 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) {
517 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); 517 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size);
518 } 518 }
519} 519}
520 520
521void EmailClient::smtpError(int code, const QString & Msg) 521void EmailClient::smtpError(int code, const QString & Msg)
522{ 522{
523 QString temp; 523 QString temp;
524 524
525 if (code == ErrUnknownResponse) { 525 if (code == ErrUnknownResponse) {
526 temp = tr("<qt>Unknown response from server</qt>"); 526 temp = tr("<qt>Unknown response from server</qt>");
527 if( ! Msg.isEmpty() ) 527 if( ! Msg.isEmpty() )
528 temp += Msg; 528 temp += Msg;
529 } else if (code == QSocket::ErrHostNotFound) { 529 } else if (code == QSocket::ErrHostNotFound) {
530 temp = tr("<qt>host not found</qt>"); 530 temp = tr("<qt>host not found</qt>");
531 } else if (code == QSocket::ErrConnectionRefused) { 531 } else if (code == QSocket::ErrConnectionRefused) {
532 temp = tr("<qt>connection refused</qt>"); 532 temp = tr("<qt>connection refused</qt>");
533 } else if (code == QSocket::ErrSocketRead) { 533 } else if (code == QSocket::ErrSocketRead) {
534 temp = tr("<qt>socket packet error</qt>"); 534 temp = tr("<qt>socket packet error</qt>");
535 } 535 }
536 536
537 if (code != ErrCancel) { 537 if (code != ErrCancel) {
538 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n"); 538 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n");
539 } else { 539 } else {
540 status2Label->setText("Aborted by user"); 540 status2Label->setText("Aborted by user");
541 } 541 }
542 542
543 sending = FALSE; 543 sending = FALSE;
544 sendMailButton->setEnabled(TRUE); 544 sendMailButton->setEnabled(TRUE);
545 cancelButton->setEnabled(FALSE); 545 cancelButton->setEnabled(FALSE);
546 quedMessages.clear(); 546 quedMessages.clear();
547} 547}
548 548
549void EmailClient::popError(int code, const QString & Msg) 549void EmailClient::popError(int code, const QString & Msg)
550{ 550{
551 QString temp; 551 QString temp;
552 552
553 if (code == ErrUnknownResponse) { 553 if (code == ErrUnknownResponse) {
554 temp = tr("<qt>Unknown response from server</qt>"); 554 temp = tr("<qt>Unknown response from server</qt>");
555 if( ! Msg.isEmpty() ) 555 if( ! Msg.isEmpty() )
556 temp += Msg; 556 temp += Msg;
557 } else if (code == ErrLoginFailed) { 557 } else if (code == ErrLoginFailed) {
558 temp = tr("<qt>Login failed\nCheck user name and password</qt>"); 558 temp = tr("<qt>Login failed\nCheck user name and password</qt>");
559 } else if (code == QSocket::ErrHostNotFound) { 559 } else if (code == QSocket::ErrHostNotFound) {
560 temp = tr("<qt>host not found</qt>"); 560 temp = tr("<qt>host not found</qt>");
561 } else if (code == QSocket::ErrConnectionRefused) { 561 } else if (code == QSocket::ErrConnectionRefused) {
562 temp = tr("<qt>connection refused</qt>"); 562 temp = tr("<qt>connection refused</qt>");
563 } else if (code == QSocket::ErrSocketRead) { 563 } else if (code == QSocket::ErrSocketRead) {
564 temp = tr("<qt>socket packet error</qt>"); 564 temp = tr("<qt>socket packet error</qt>");
565 } 565 }
566 566
567 if (code != ErrCancel) { 567 if (code != ErrCancel) {
568 QMessageBox::warning(qApp->activeWindow(), tr("Receiving error"), temp, tr("OK\n")); 568 QMessageBox::warning(qApp->activeWindow(), tr("Receiving error"), temp, tr("OK\n"));
569 569
570 } else { 570 } else {
571 status2Label->setText("Aborted by user"); 571 status2Label->setText("Aborted by user");
572 } 572 }
573 573
574 receiving = FALSE; 574 receiving = FALSE;
575 getMailButton->setEnabled(TRUE); 575 getMailButton->setEnabled(TRUE);
576 cancelButton->setEnabled(FALSE); 576 cancelButton->setEnabled(FALSE);
577 selectAccountMenu->setEnabled(TRUE); 577 selectAccountMenu->setEnabled(TRUE);
578} 578}
579 579
580void EmailClient::inboxItemSelected() 580void EmailClient::inboxItemSelected()
581{ 581{
582 //killTimer(timerID); 582 //killTimer(timerID);
583 583
584 item = (EmailListItem*) inboxView->selectedItem(); 584 item = (EmailListItem*) inboxView->selectedItem();
585 if (item != NULL) { 585 if (item != NULL) {
586 emit viewEmail(inboxView, item->getMail()); 586 emit viewEmail(inboxView, item->getMail());
587 } 587 }
588} 588}
589 589
590void EmailClient::outboxItemSelected() 590void EmailClient::outboxItemSelected()
591{ 591{
592 //killTimer(timerID); 592 //killTimer(timerID);
593 593
594 item = (EmailListItem*) outboxView->selectedItem(); 594 item = (EmailListItem*) outboxView->selectedItem();
595 if (item != NULL) { 595 if (item != NULL) {
596 emit viewEmail(outboxView, item->getMail()); 596 emit viewEmail(outboxView, item->getMail());
597 } 597 }
598 598
599} 599}
600 600
601void EmailClient::readMail() 601void EmailClient::readMail()
602{ 602{
603 Email mail; 603 Email mail;
604 int start, stop; 604 int start, stop;
605 QString s, del; 605 QString s, del;
606 606
607 QFile f(getPath(FALSE) + "inbox.txt"); 607 QFile f(getPath(FALSE) + "inbox.txt");
608 608
609 if ( f.open(IO_ReadOnly) ) { // file opened successfully 609 if ( f.open(IO_ReadOnly) ) { // file opened successfully
610 QTextStream t( &f ); // use a text stream 610 QTextStream t( &f ); // use a text stream
611 s = t.read(); 611 s = t.read();
612 f.close(); 612 f.close();
613 613
614 start = 0; 614 start = 0;
615 del = "\n.\n"; 615 del = "\n.\n";
616 while ((uint) start < s.length()) { 616 while ((uint) start < s.length()) {
617 stop = s.find(del, start); 617 stop = s.find(del, start);
618 if (stop == -1) 618 if (stop == -1)
619 stop = s.length() - del.length(); 619 stop = s.length() - del.length();
620 620
621 mail.rawMail = s.mid(start, stop + del.length() - start ); 621 mail.rawMail = s.mid(start, stop + del.length() - start );
622 start = stop + del.length(); 622 start = stop + del.length();
623 mailArrived(mail, TRUE); 623 mailArrived(mail, TRUE);
624 } 624 }
625 } 625 }
626 626
627 QFile fo(getPath(FALSE) + "outbox.txt"); 627 QFile fo(getPath(FALSE) + "outbox.txt");
628 if ( fo.open(IO_ReadOnly) ) { // file opened successfully 628 if ( fo.open(IO_ReadOnly) ) { // file opened successfully
629 QTextStream t( &fo ); // use a text stream 629 QTextStream t( &fo ); // use a text stream
630 s = t.read(); 630 s = t.read();
631 fo.close(); 631 fo.close();
632 632
633 start = 0; 633 start = 0;
634 del = "\n.\n"; 634 del = "\n.\n";
635 while ((uint) start < s.length()) { 635 while ((uint) start < s.length()) {
636 stop = s.find(del, start); 636 stop = s.find(del, start);
637 if (stop == -1) 637 if (stop == -1)
638 stop = s.length() - del.length(); 638 stop = s.length() - del.length();
639 639
640 mail.rawMail = s.mid(start, stop + del.length() - start ); 640 mail.rawMail = s.mid(start, stop + del.length() - start );
641 start = stop + del.length(); 641 start = stop + del.length();
642 emailHandler->parse(mail.rawMail, lineShift, &mail); 642 emailHandler->parse(mail.rawMail, lineShift, &mail);
643 mail.sent = false; 643 mail.sent = false;
644 mail.received = false; 644 mail.received = false;
645 enqueMail(mail); 645 enqueMail(mail);
646 646
647 } 647 }
648 } 648 }
649} 649}
650 650
651void EmailClient::saveMail(const QString &fileName, QListView *view) 651void EmailClient::saveMail(const QString &fileName, QListView *view)
652{ 652{
653 QFile f(fileName); 653 QFile f(fileName);
654 Email *mail; 654 Email *mail;
655 655
656 if (! f.open(IO_WriteOnly) ) { 656 if (! f.open(IO_WriteOnly) ) {
657 qWarning("could not open file"); 657 qWarning("could not open file");
658 return; 658 return;
659 } 659 }
660 item = (EmailListItem *) view->firstChild(); 660 item = (EmailListItem *) view->firstChild();
661 QTextStream t(&f); 661 QTextStream t(&f);
662 while (item != NULL) { 662 while (item != NULL) {
663 mail = item->getMail(); 663 mail = item->getMail();
664 t << mail->rawMail; 664 t << mail->rawMail;
665 665
666 mailconf->setGroup(mail->id); 666 mailconf->setGroup(mail->id);
667 mailconf->writeEntry("mailread", mail->read); 667 mailconf->writeEntry("mailread", mail->read);
668 668
669 item = (EmailListItem *) item->nextSibling(); 669 item = (EmailListItem *) item->nextSibling();
670 } 670 }
671 f.close(); 671 f.close();
672} 672}
673 673
674//paths for mailit, is settings, inbox, enclosures 674//paths for mailit, is settings, inbox, enclosures
675QString EmailClient::getPath(bool enclosurePath) 675QString EmailClient::getPath(bool enclosurePath)
676{ 676{
677 QString basePath = "qtmail"; 677 QString basePath = "qtmail";
678 QString enclosures = "enclosures"; 678 QString enclosures = "enclosures";
679 679
680 QDir dir = (QString(getenv("HOME")) + "/Applications/" + basePath); 680 QDir dir = (QString(getenv("HOME")) + "/Applications/" + basePath);
681 if ( !dir.exists() ) 681 if ( !dir.exists() )
682 dir.mkdir( dir.path() ); 682 dir.mkdir( dir.path() );
683 683
684 if (enclosurePath) { 684 if (enclosurePath) {
685 dir = (QString(getenv("HOME")) + "/Applications/" + basePath + "/" + enclosures); 685 dir = (QString(getenv("HOME")) + "/Applications/" + basePath + "/" + enclosures);
686 686
687 if ( !dir.exists() ) 687 if ( !dir.exists() )
688 dir.mkdir( dir.path() ); 688 dir.mkdir( dir.path() );
689 689
690 return (dir.path() + "/"); 690 return (dir.path() + "/");
691 691
692 } 692 }
693 return (dir.path() + "/"); 693 return (dir.path() + "/");
694} 694}
695 695
696void EmailClient::readSettings() 696void EmailClient::readSettings()
697{ 697{
698 int y,acc_count; 698 int y,acc_count;
699 699
700 mailconf->setGroup("mailitglobal"); 700 mailconf->setGroup("mailitglobal");
701 acc_count=mailconf->readNumEntry("Accounts",0); 701 acc_count=mailconf->readNumEntry("Accounts",0);
702 702
703 for (int accountPos = 0;accountPos<acc_count ; accountPos++) 703 for (int accountPos = 0;accountPos<acc_count ; accountPos++)
704 { 704 {
705 mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... 705 mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ...
706 account.accountName = mailconf->readEntry("AccName",""); 706 account.accountName = mailconf->readEntry("AccName","");
707 account.name = mailconf->readEntry("UserName",""); 707 account.name = mailconf->readEntry("UserName","");
708 account.emailAddress = mailconf->readEntry("Email",""); 708 account.emailAddress = mailconf->readEntry("Email","");
709 account.popUserName = mailconf->readEntry("POPUser",""); 709 account.popUserName = mailconf->readEntry("POPUser","");
710 account.popPasswd = mailconf->readEntryCrypt("POPPassword",""); 710 account.popPasswd = mailconf->readEntryCrypt("POPPassword","");
711 account.popServer = mailconf->readEntry("POPServer",""); 711 account.popServer = mailconf->readEntry("POPServer","");
712 account.smtpServer = mailconf->readEntry("SMTPServer",""); 712 account.smtpServer = mailconf->readEntry("SMTPServer","");
713 account.id = mailconf->readNumEntry("AccountId",0); 713 account.id = mailconf->readNumEntry("AccountId",0);
714 account.syncLimit = mailconf->readNumEntry("HeaderLimit",0); 714 account.syncLimit = mailconf->readNumEntry("HeaderLimit",0);
715 account.lastServerMailCount = 0; 715 account.lastServerMailCount = 0;
716 account.synchronize = FALSE; 716 account.synchronize = FALSE;
717 717
718 account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); 718 account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes");
719 if (account.synchronize) 719 if (account.synchronize)
720 { 720 {
721 mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); 721 mailconf->readNumEntry("LASTSERVERMAILCOUNT",0);
722 } 722 }
723 723
724 accountList.append(&account); 724 accountList.append(&account);
725 } 725 }
726 726
727 mailconf->setGroup("mailitglobal"); 727 mailconf->setGroup("mailitglobal");
728 728
729 if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) 729 if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1)
730 { 730 {
731 mailIdCount = y; 731 mailIdCount = y;
732 } 732 }
733 if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) 733 if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1)
734 { 734 {
735 accountIdCount = y; 735 accountIdCount = y;
736 } 736 }
737} 737}
738 738
739void EmailClient::saveSettings() 739void EmailClient::saveSettings()
740{ 740{
741 int acc_count=0; 741 int acc_count=0;
742 MailAccount *accountPtr; 742 MailAccount *accountPtr;
743 743
744 744
745 if (!mailconf) 745 if (!mailconf)
746 { 746 {
747 qWarning("could not save settings"); 747 qWarning("could not save settings");
748 return; 748 return;
749 } 749 }
750 750
751 for (accountPtr = accountList.first(); accountPtr != 0; 751 for (accountPtr = accountList.first(); accountPtr != 0;
752 accountPtr = accountList.next()) 752 accountPtr = accountList.next())
753 { 753 {
754 mailconf->setGroup("Account_"+QString::number(++acc_count)); 754 mailconf->setGroup("Account_"+QString::number(++acc_count));
755 mailconf->writeEntry("AccName",accountPtr->accountName ); 755 mailconf->writeEntry("AccName",accountPtr->accountName );
756 mailconf->writeEntry("UserName",accountPtr->name); 756 mailconf->writeEntry("UserName",accountPtr->name);
757 mailconf->writeEntry("Email",accountPtr->emailAddress); 757 mailconf->writeEntry("Email",accountPtr->emailAddress);
758 mailconf->writeEntry("POPUser",accountPtr->popUserName); 758 mailconf->writeEntry("POPUser",accountPtr->popUserName);
759 mailconf->writeEntryCrypt("POPPassword",accountPtr->popPasswd); 759 mailconf->writeEntryCrypt("POPPassword",accountPtr->popPasswd);
760 mailconf->writeEntry("POPServer",accountPtr->popServer); 760 mailconf->writeEntry("POPServer",accountPtr->popServer);
761 mailconf->writeEntry("SMTPServer",accountPtr->smtpServer); 761 mailconf->writeEntry("SMTPServer",accountPtr->smtpServer);
762 mailconf->writeEntry("AccountId",accountPtr->id); 762 mailconf->writeEntry("AccountId",accountPtr->id);
763 if (accountPtr->synchronize) 763 if (accountPtr->synchronize)
764 { 764 {
765 mailconf->writeEntry("Synchronize","Yes"); 765 mailconf->writeEntry("Synchronize","Yes");
766 mailconf->writeEntry("HeaderLimit",accountPtr->syncLimit); 766 mailconf->writeEntry("HeaderLimit",accountPtr->syncLimit);
767 mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); 767 mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount);
768 } 768 }
769 else 769 else
770 { 770 {
771 mailconf->writeEntry("Synchronize", "No"); 771 mailconf->writeEntry("Synchronize", "No");
772 } 772 }
773 } 773 }
774 774
775 mailconf->setGroup("mailitglobal"); 775 mailconf->setGroup("mailitglobal");
776 mailconf->writeEntry("Accounts",acc_count); 776 mailconf->writeEntry("Accounts",acc_count);
777 mailconf->writeEntry("mailidcount", mailIdCount); 777 mailconf->writeEntry("mailidcount", mailIdCount);
778 mailconf->writeEntry("accountidcount", accountIdCount); 778 mailconf->writeEntry("accountidcount", accountIdCount);
779} 779}
780 780
781void EmailClient::selectAccount(int id) 781void EmailClient::selectAccount(int id)
782{ 782{
783 if (accountList.count() > 0) { 783 if (accountList.count() > 0) {
784 currentAccount = accountList.at(id); 784 currentAccount = accountList.at(id);
785 emit newCaption("Mailit - " + currentAccount->accountName); 785 emit newCaption("Mailit - " + currentAccount->accountName);
786 getNewMail(); 786 getNewMail();
787 } else { 787 } else {
788 emit newCaption("Mailit ! No account defined"); 788 emit newCaption( tr("Mailit ! No account defined") );
789 } 789 }
790} 790}
791 791
792void EmailClient::editAccount(int id) 792void EmailClient::editAccount(int id)
793{ 793{
794 MailAccount *newAccount; 794 MailAccount *newAccount;
795 795
796 editAccountView = new EditAccount(this, "account", TRUE); 796 editAccountView = new EditAccount(this, "account", TRUE);
797 if (id == newAccountId) { //new account 797 if (id == newAccountId) { //new account
798 newAccount = new MailAccount; 798 newAccount = new MailAccount;
799 editAccountView->setAccount(newAccount); 799 editAccountView->setAccount(newAccount);
800 } else { 800 } else {
801 newAccount = accountList.at(id); 801 newAccount = accountList.at(id);
802 editAccountView->setAccount(newAccount, FALSE); 802 editAccountView->setAccount(newAccount, FALSE);
803 } 803 }
804 804
805 editAccountView->showMaximized(); 805 editAccountView->showMaximized();
806 editAccountView->exec(); 806 editAccountView->exec();
807 807
808 if (editAccountView->result() == QDialog::Accepted) { 808 if (editAccountView->result() == QDialog::Accepted) {
809 if (id == newAccountId) { 809 if (id == newAccountId) {
810 newAccount->id = accountIdCount; 810 newAccount->id = accountIdCount;
811 accountIdCount++; 811 accountIdCount++;
812 accountList.append(newAccount); 812 accountList.append(newAccount);
813 updateAccounts(); 813 updateAccounts();
814 } else { 814 } else {
815 updateAccounts(); 815 updateAccounts();
816 } 816 }
817 } 817 }
818 818
819 delete editAccountView; 819 delete editAccountView;
820} 820}
821 821
822void EmailClient::deleteAccount(int id) 822void EmailClient::deleteAccount(int id)
823{ 823{
824 MailAccount *newAccount; 824 MailAccount *newAccount;
825 QString message; 825 QString message;
826 826
827 newAccount = accountList.at(id); 827 newAccount = accountList.at(id);
828 message = "Delete account:\n" + newAccount->accountName; 828 message = tr("Delete account:\n") + newAccount->accountName;
829 switch( QMessageBox::warning( this, "Mailit", message, 829 switch( QMessageBox::warning( this, "Mailit", message,
830 "Yes", "No", 0, 0, 1 ) ) { 830 "Yes", "No", 0, 0, 1 ) ) {
831 831
832 case 0: accountList.remove(id); 832 case 0: accountList.remove(id);
833 updateAccounts(); 833 updateAccounts();
834 break; 834 break;
835 case 1: 835 case 1:
836 break; 836 break;
837 } 837 }
838} 838}
839 839
840void EmailClient::updateAccounts() 840void EmailClient::updateAccounts()
841{ 841{
842 MailAccount *accountPtr; 842 MailAccount *accountPtr;
843 843
844 //rebuild menus, clear all first 844 //rebuild menus, clear all first
845 editAccountMenu->clear(); 845 editAccountMenu->clear();
846 selectAccountMenu->clear(); 846 selectAccountMenu->clear();
847 deleteAccountMenu->clear(); 847 deleteAccountMenu->clear();
848 848
849 newAccountId = editAccountMenu->insertItem("New", this, 849 newAccountId = editAccountMenu->insertItem( tr("New"), this,
850 SLOT(editAccount(int)) ); 850 SLOT(editAccount(int)) );
851 editAccountMenu->insertSeparator(); 851 editAccountMenu->insertSeparator();
852 852
853 idCount = 0; 853 idCount = 0;
854 for (accountPtr = accountList.first(); accountPtr != 0; 854 for (accountPtr = accountList.first(); accountPtr != 0;
855 accountPtr = accountList.next()) { 855 accountPtr = accountList.next()) {
856 856
857 editAccountMenu->insertItem(accountPtr->accountName, 857 editAccountMenu->insertItem(accountPtr->accountName,
858 this, SLOT(editAccount(int)), 0, idCount); 858 this, SLOT(editAccount(int)), 0, idCount);
859 selectAccountMenu->insertItem(accountPtr->accountName, 859 selectAccountMenu->insertItem(accountPtr->accountName,
860 this, SLOT(selectAccount(int)), 0, idCount); 860 this, SLOT(selectAccount(int)), 0, idCount);
861 deleteAccountMenu->insertItem(accountPtr->accountName, 861 deleteAccountMenu->insertItem(accountPtr->accountName,
862 this, SLOT(deleteAccount(int)), 0, idCount); 862 this, SLOT(deleteAccount(int)), 0, idCount);
863 idCount++; 863 idCount++;
864 } 864 }
865} 865}
866 866
867void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) 867void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox)
868{ 868{
869 Email *mPtr; 869 Email *mPtr;
870 Enclosure *ePtr; 870 Enclosure *ePtr;
871 871
872 if (inbox) 872 if (inbox)
873 { 873 {
874 mPtr = mailItem->getMail(); 874 mPtr = mailItem->getMail();
875 875
876 //if mail is in queue for download, remove it from 876 //if mail is in queue for download, remove it from
877 //queue if possible 877 //queue if possible
878 if ( (receiving) && (mPtr->fromAccountId == currentAccount->id) ) { 878 if ( (receiving) && (mPtr->fromAccountId == currentAccount->id) ) {
879 if ( !mPtr->downloaded ) 879 if ( !mPtr->downloaded )
880 mailDownloadList.remove(mPtr->serverId, mPtr->size); 880 mailDownloadList.remove(mPtr->serverId, mPtr->size);
881 } 881 }
882 882
883 mailconf->setGroup(mPtr->id); 883 mailconf->setGroup(mPtr->id);
884 mailconf->clearGroup(); 884 mailconf->clearGroup();
885 885
886 //delete any temporary attatchemnts storing 886 //delete any temporary attatchemnts storing
887 for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) { 887 for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) {
888 if (ePtr->saved) { 888 if (ePtr->saved) {
889 QFile::remove( (ePtr->path + ePtr->name) ); 889 QFile::remove( (ePtr->path + ePtr->name) );
890 } 890 }
891 } 891 }
892 inboxView->takeItem(mailItem); 892 inboxView->takeItem(mailItem);
893 } 893 }
894 else 894 else
895 { 895 {
896 outboxView->takeItem(mailItem); 896 outboxView->takeItem(mailItem);
897 } 897 }
898} 898}
899 899
900void EmailClient::setMailSize(int size) 900void EmailClient::setMailSize(int size)
901{ 901{
902 progressBar->reset(); 902 progressBar->reset();
903 progressBar->setTotalSteps(size); 903 progressBar->setTotalSteps(size);
904} 904}
905 905
906void EmailClient::setTotalSize(int /*size*/) 906void EmailClient::setTotalSize(int /*size*/)
907{ 907{
908 908
909} 909}
910 910
911void EmailClient::setDownloadedSize(int size) 911void EmailClient::setDownloadedSize(int size)
912{ 912{
913 int total = progressBar->totalSteps(); 913 int total = progressBar->totalSteps();
914 914
915 if (size < total) { 915 if (size < total) {
916 progressBar->setProgress(size); 916 progressBar->setProgress(size);
917 } else { 917 } else {
918 progressBar->setProgress(total); 918 progressBar->setProgress(total);
919 } 919 }
920} 920}
921 921
922void EmailClient::deleteItem() 922void EmailClient::deleteItem()
923{ 923{
924 bool inbox=mailboxView->currentTab()==0; 924 bool inbox=mailboxView->currentTab()==0;
925 QListView* box; 925 QListView* box;
926 926
927 EmailListItem* eli; 927 EmailListItem* eli;
928 // int pos; 928 // int pos;
929 929
930 inbox ? box=inboxView : box=outboxView; 930 inbox ? box=inboxView : box=outboxView;
931 931
932 eli=(EmailListItem*)box->selectedItem(); 932 eli=(EmailListItem*)box->selectedItem();
933 933
934 if (eli) 934 if (eli)
935 { 935 {
936 box->setSelected(eli->itemBelow(),true); //select the previous item 936 box->setSelected(eli->itemBelow(),true); //select the previous item
937 937
938 deleteMail(eli,(bool&)inbox); //remove mail entry 938 deleteMail(eli,(bool&)inbox); //remove mail entry
939 } 939 }
940} 940}
941 941
942void EmailClient::inboxItemPressed() 942void EmailClient::inboxItemPressed()
943{ 943{
944// timerID=startTimer(500); 944// timerID=startTimer(500);
945} 945}
946 946
947void EmailClient::inboxItemReleased() 947void EmailClient::inboxItemReleased()
948{ 948{
949 // killTimer(timerID); 949 // killTimer(timerID);
950} 950}
951 951
952/*void EmailClient::timerEvent(QTimerEvent *e) 952/*void EmailClient::timerEvent(QTimerEvent *e)
953{ 953{
954 //killTimer(timerID); 954 //killTimer(timerID);
955 955
956 956
957 QPopupMenu *action = new QPopupMenu(this); 957 QPopupMenu *action = new QPopupMenu(this);
958 958
959 int reply=0; 959 int reply=0;
960 960
961 action->insertItem(tr( "Reply To" ),this,SLOT(reply())); 961 action->insertItem(tr( "Reply To" ),this,SLOT(reply()));
962 action->insertItem( tr( "Reply All" ),this,SLOT(replyAll())); 962 action->insertItem( tr( "Reply All" ),this,SLOT(replyAll()));
963 action->insertItem( tr( "Forward" ), this,SLOT(forward())); 963 action->insertItem( tr( "Forward" ), this,SLOT(forward()));
964 action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); 964 action->insertItem( tr( "Remove Mail" ), this,SLOT(remove()));
965 965
966 action->exec(QCursor::pos()); 966 action->exec(QCursor::pos());
967 967
968 if (action) delete action; 968 if (action) delete action;
969 969
970}*/ 970}*/
971 971
972Email* EmailClient::getCurrentMail() 972Email* EmailClient::getCurrentMail()
973{ 973{
974 EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); 974 EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem());
975 if (eli!=NULL) 975 if (eli!=NULL)
976 return eli->getMail(); 976 return eli->getMail();
977 else 977 else
978 return NULL; 978 return NULL;
979} 979}
980 980
981void EmailClient::download(Email* mail) 981void EmailClient::download(Email* mail)
982{ 982{
983 MailAccount* acc=0; 983 MailAccount* acc=0;
984 984
985 tempMailDownloadList.clear(); 985 tempMailDownloadList.clear();
986 tempMailDownloadList.sizeInsert(mail->serverId, mail->size); 986 tempMailDownloadList.sizeInsert(mail->serverId, mail->size);
987 987
988 acc=accountList.at(mail->fromAccountId-1); 988 acc=accountList.at(mail->fromAccountId-1);
989 if (acc) 989 if (acc)
990 { 990 {
991 emailHandler->setAccount(*acc); 991 emailHandler->setAccount(*acc);
992 emailHandler->getMailByList(&tempMailDownloadList); 992 emailHandler->getMailByList(&tempMailDownloadList);
993 } 993 }
994 else 994 else
995 QMessageBox::warning(qApp->activeWindow(), 995 QMessageBox::warning(qApp->activeWindow(),
996 tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); 996 tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n");
997} 997}
998 998
999void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/) 999void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/)
1000{ 1000{
1001 /*if (msg=="getMail()") 1001 /*if (msg=="getMail()")
1002 { 1002 {
1003 //QDialog qd(qApp->activeWindow(),"Getting mail",true); 1003 //QDialog qd(qApp->activeWindow(),"Getting mail",true);
1004 QVBoxLayout *vbProg = new QVBoxLayout( &qd ); 1004 QVBoxLayout *vbProg = new QVBoxLayout( &qd );
1005 1005
1006 initStatusBar(&qd); 1006 initStatusBar(&qd);
1007 1007
1008 if (statusBar==0) 1008 if (statusBar==0)
1009 { 1009 {
1010 qDebug("No Bar ..."); 1010 qDebug("No Bar ...");
1011 //statusBar=new ProgressBar(&qd); 1011 //statusBar=new ProgressBar(&qd);
1012 } 1012 }
1013 statusBar->show(); 1013 statusBar->show();
1014 vbProg->addWidget(statusBar); 1014 vbProg->addWidget(statusBar);
1015 qd.showMaximized(); 1015 qd.showMaximized();
1016 qd.show(); 1016 qd.show();
1017 emit getAllNewMail(); 1017 emit getAllNewMail();
1018 //qd.exec(); 1018 //qd.exec();
1019 } 1019 }
1020 else if (msg=="compose()") 1020 else if (msg=="compose()")
1021 { 1021 {
1022 QDialog qd(qApp->activeWindow(),"Getting mail",true); 1022 QDialog qd(qApp->activeWindow(),"Getting mail",true);
1023 1023
1024 WriteMail wm(&qd,"write new mail"); 1024 WriteMail wm(&qd,"write new mail");
1025 QVBoxLayout vbProg( &qd ); 1025 QVBoxLayout vbProg( &qd );
1026 1026
1027 wm.showMaximized(); 1027 wm.showMaximized();
1028 vbProg.addWidget(&wm); 1028 vbProg.addWidget(&wm);
1029 1029
1030 qd.showMaximized(); 1030 qd.showMaximized();
1031 1031
1032 emit composeRequested(); 1032 emit composeRequested();
1033 qd.exec(); 1033 qd.exec();
1034 1034
1035 QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); 1035 QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n");
1036 } 1036 }
1037 1037
1038 else if (msg=="dialog()") 1038 else if (msg=="dialog()")
1039 { 1039 {
1040 QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); 1040 QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n");
1041 }*/ 1041 }*/
1042} 1042}
diff --git a/noncore/unsupported/mailit/emaillistitem.cpp b/noncore/unsupported/mailit/emaillistitem.cpp
index fc9f766..a25f93a 100644
--- a/noncore/unsupported/mailit/emaillistitem.cpp
+++ b/noncore/unsupported/mailit/emaillistitem.cpp
@@ -4,96 +4,155 @@
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qstring.h> 20#include <qstring.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include "emaillistitem.h" 22#include "emaillistitem.h"
23 23
24EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) 24EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox)
25 : QListViewItem(parent) 25 : QListViewItem(parent)
26{ 26{
27 QString temp; 27 QString temp;
28 28
29 mail = mailIn; 29 mail = mailIn;
30 30
31 if (inbox) { 31 if (inbox) {
32 setText(0, mail.from); 32 setText(0, mail.from);
33 } else { 33 } else {
34 QStringList::Iterator it = mail.recipients.begin(); 34 QStringList::Iterator it = mail.recipients.begin();
35 temp = *it; 35 temp = *it;
36 if (mail.recipients.count() > 1) 36 if (mail.recipients.count() > 1)
37 temp += "..."; 37 temp += "...";
38 setText(0, temp); 38 setText(0, temp);
39 } 39 }
40 setText(1, mail.subject); 40 setText(1, mail.subject);
41 setText(2,mail.date); 41 // setText(2,mail.date);
42 42 setText(2,dateFromULCString(mail.date));
43
43 if (mailIn.files.count()>0) 44 if (mailIn.files.count()>0)
44 { 45 {
45 setPixmap(0, Resource::loadPixmap("mailit/attach")); 46 setPixmap(0, Resource::loadPixmap("mailit/attach"));
46 } 47 }
47 48
48 selected = FALSE; 49 selected = FALSE;
49} 50}
50 51
51Email* EmailListItem::getMail() 52Email* EmailListItem::getMail()
52{ 53{
53 return &mail; 54 return &mail;
54} 55}
55 56
56void EmailListItem::setMail(Email newMail) 57void EmailListItem::setMail(Email newMail)
57{ 58{
58 mail = newMail; 59 mail = newMail;
59 repaint(); 60 repaint();
60} 61}
61 62
62void EmailListItem::setItemSelected(bool enable) 63void EmailListItem::setItemSelected(bool enable)
63{ 64{
64 selected = enable; 65 selected = enable;
65 setSelected(enable); 66 setSelected(enable);
66 repaint(); 67 repaint();
67} 68}
68 69
69bool EmailListItem::isItemSelected() 70bool EmailListItem::isItemSelected()
70{ 71{
71 return selected; 72 return selected;
72} 73}
73 74
74void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, 75void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg,
75 int column, int width, int alignment ) 76 int column, int width, int alignment )
76{ 77{
77 78
78 QColorGroup _cg( cg ); 79 QColorGroup _cg( cg );
79 QColor c = _cg.text(); 80 QColor c = _cg.text();
80 81
81 if ( (! mail.read) && (mail.received) ) 82 if ( (! mail.read) && (mail.received) )
82 _cg.setColor( QColorGroup::Text, Qt::blue); 83 _cg.setColor( QColorGroup::Text, Qt::blue);
83 if (!mail.downloaded) 84 if (!mail.downloaded)
84 _cg.setColor( QColorGroup::Text, Qt::red); 85 _cg.setColor( QColorGroup::Text, Qt::red);
85 86
86/* if (selected) { 87/* if (selected) {
87 _cg.setColor(QColorGroup::Base, Qt::blue); 88 _cg.setColor(QColorGroup::Base, Qt::blue);
88 _cg.setColor(QColorGroup::Text, Qt::yellow); 89 _cg.setColor(QColorGroup::Text, Qt::yellow);
89 if (isSelected()) { 90 if (isSelected()) {
90 _cg.setColor(QColorGroup::HighlightedText, Qt::yellow); 91 _cg.setColor(QColorGroup::HighlightedText, Qt::yellow);
91 } else { 92 } else {
92 _cg.setColor(QColorGroup::Highlight, Qt::blue); 93 _cg.setColor(QColorGroup::Highlight, Qt::blue);
93 } 94 }
94 } 95 }
95*/ 96*/
96 QListViewItem::paintCell( p, _cg, column, width, alignment ); 97 QListViewItem::paintCell( p, _cg, column, width, alignment );
97 98
98 _cg.setColor( QColorGroup::Text, c ); 99 _cg.setColor( QColorGroup::Text, c );
99} 100}
101
102/*
103 * Converts an E-Mail date (ULC) RFC 2822 conform to a QDateTime.
104 * Returning a QString with formatting of "YYYY-MM-DD HH:MM:SS"
105 * (zodiac: This method was tested with more than 300 inbox mails,
106 * it didn't slow down the loading of mail-it.)
107 */
108QString EmailListItem::dateFromULCString( QString ulcDate )
109{
110 QString sTemp, sTime;
111 int iPos, iDay, iMon=1, iYear;
112
113 iPos=ulcDate.find(',');
114 if (iPos) { // it has a day-of-week
115 ulcDate=ulcDate.remove(0,++iPos); //.stripWhiteSpace();
116 }
117
118 QStringList dateEntries = QStringList::split(" ",ulcDate,FALSE);
119 QStringList::Iterator iter = dateEntries.begin();
120
121 // Get day as DD
122 iDay = (*iter++).toInt();
123
124 // Get month as string Mmm
125 sTemp = (*iter++);
126 if (sTemp =="Jan") {iMon=1;} else
127 if (sTemp =="Feb") {iMon=2;} else
128 if (sTemp =="Mar") {iMon=3;} else
129 if (sTemp =="Apr") {iMon=4;} else
130 if (sTemp =="May") {iMon=5;} else
131 if (sTemp =="Jun") {iMon=6;} else
132 if (sTemp =="Jul") {iMon=7;} else
133 if (sTemp =="Aug") {iMon=8;} else
134 if (sTemp =="Sep") {iMon=9;} else
135 if (sTemp =="Oct") {iMon=10;} else
136 if (sTemp =="Nov") {iMon=11;} else
137 if (sTemp =="Dec") {iMon=12;}
138
139 // Get year as YYYY or YY
140 iYear = (*iter++).toInt();
141
142 QDate date = QDate(iYear, iMon, iDay);
143
144 // Convert timestring into a QTime
145 QStringList timeEntries = QStringList::split(":",(*iter++),FALSE);
146 QStringList::Iterator iterTime = timeEntries.begin();
147 iYear=(*iterTime++).toInt(); // var reuse.. *cough*
148 iMon=(*iterTime++).toInt();
149 iDay=(*iterTime++).toInt();
150 QTime time = QTime(iYear,iMon,iDay);
151
152 return QString::number(date.year())+"-"
153 +QString::number(date.month()).rightJustify(2,'0')+"-"
154 +QString::number(date.day()).rightJustify(2,'0')+" "
155 +time.toString();
156}
157
158
diff --git a/noncore/unsupported/mailit/emaillistitem.h b/noncore/unsupported/mailit/emaillistitem.h
index 642932c..129a774 100644
--- a/noncore/unsupported/mailit/emaillistitem.h
+++ b/noncore/unsupported/mailit/emaillistitem.h
@@ -11,34 +11,35 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef EMAILLISTITEM_H 20#ifndef EMAILLISTITEM_H
21#define EMAILLISTITEM_H 21#define EMAILLISTITEM_H
22 22
23#include <qlistview.h> 23#include <qlistview.h>
24#include "emailhandler.h" 24#include "emailhandler.h"
25 25
26class EmailListItem: public QListViewItem 26class EmailListItem: public QListViewItem
27{ 27{
28public: 28public:
29 EmailListItem(QListView *parent, Email mailIn, bool inbox); 29 EmailListItem(QListView *parent, Email mailIn, bool inbox);
30 Email* getMail(); 30 Email* getMail();
31 void setMail(Email newMail); 31 void setMail(Email newMail);
32 void setItemSelected(bool enable); 32 void setItemSelected(bool enable);
33 bool isItemSelected(); 33 bool isItemSelected();
34 bool itemSelected(); 34 bool itemSelected();
35 35
36protected: 36protected:
37 void paintCell( QPainter *p, const QColorGroup &cg, 37 void paintCell( QPainter *p, const QColorGroup &cg,
38 int column, int width, int alignment ); 38 int column, int width, int alignment );
39private: 39private:
40 Email mail; 40 Email mail;
41 bool selected; 41 bool selected;
42 QString dateFromULCString( QString ulc );
42}; 43};
43 44
44#endif 45#endif
diff --git a/noncore/unsupported/mailit/mailit.pro b/noncore/unsupported/mailit/mailit.pro
index 5e9a83a..0224886 100644
--- a/noncore/unsupported/mailit/mailit.pro
+++ b/noncore/unsupported/mailit/mailit.pro
@@ -1,63 +1,59 @@
1TEMPLATE = app
2TARGET = mailit 1TARGET = mailit
3CONFIG = qt warn_on release 2CONFIG = qt warn_on release quick-app
4HEADERS = emailclient.h \ 3HEADERS = emailclient.h \
5 emailhandler.h \ 4 emailhandler.h \
6 emaillistitem.h \ 5 emaillistitem.h \
7 mailitwindow.h \ 6 mailitwindow.h \
8 md5.h \ 7 md5.h \
9 popclient.h \ 8 popclient.h \
10 readmail.h \ 9 readmail.h \
11 smtpclient.h \ 10 smtpclient.h \
12 writemail.h \ 11 writemail.h \
13 textparser.h \ 12 textparser.h \
14 viewatt.h \ 13 viewatt.h \
15 addatt.h \ 14 addatt.h \
16 editaccount.h \ 15 editaccount.h \
17 maillist.h \ 16 maillist.h \
18 addresslist.h 17 addresslist.h
19SOURCES = emailclient.cpp \ 18SOURCES = emailclient.cpp \
20 emailhandler.cpp \ 19 emailhandler.cpp \
21 emaillistitem.cpp \ 20 emaillistitem.cpp \
22 mailitwindow.cpp \ 21 mailitwindow.cpp \
23 main.cpp \ 22 main.cpp \
24 md5.c \ 23 md5.c \
25 popclient.cpp \ 24 popclient.cpp \
26 readmail.cpp \ 25 readmail.cpp \
27 smtpclient.cpp \ 26 smtpclient.cpp \
28 writemail.cpp \ 27 writemail.cpp \
29 textparser.cpp \ 28 textparser.cpp \
30 viewatt.cpp \ 29 viewatt.cpp \
31 addatt.cpp \ 30 addatt.cpp \
32 editaccount.cpp \ 31 editaccount.cpp \
33 maillist.cpp \ 32 maillist.cpp \
34 addresslist.cpp 33 addresslist.cpp
35 34
36INCLUDEPATH += $(OPIEDIR)/include 35INCLUDEPATH += $(OPIEDIR)/include
37DEPENDPATH += $(OPIEDIR)/include 36DEPENDPATH += $(OPIEDIR)/include
38LIBS += -lqpe -lopie 37LIBS += -lqpe -lopie
39# -lssl 38# -lssl
40MOC_DIR=qpeobj
41OBJECTS_DIR=qpeobj
42DESTDIR=$(OPIEDIR)/bin
43 39
44TRANSLATIONS = ../../../i18n/de/mailit.ts \ 40TRANSLATIONS = ../../../i18n/de/mailit.ts \
45 ../../../i18n/nl/mailit.ts \ 41 ../../../i18n/nl/mailit.ts \
46 ../../../i18n/da/mailit.ts \ 42 ../../../i18n/da/mailit.ts \
47 ../../../i18n/xx/mailit.ts \ 43 ../../../i18n/xx/mailit.ts \
48 ../../../i18n/it/mailit.ts \ 44 ../../../i18n/it/mailit.ts \
49 ../../../i18n/en/mailit.ts \ 45 ../../../i18n/en/mailit.ts \
50 ../../../i18n/es/mailit.ts \ 46 ../../../i18n/es/mailit.ts \
51 ../../../i18n/fr/mailit.ts \ 47 ../../../i18n/fr/mailit.ts \
52 ../../../i18n/hu/mailit.ts \ 48 ../../../i18n/hu/mailit.ts \
53 ../../../i18n/ja/mailit.ts \ 49 ../../../i18n/ja/mailit.ts \
54 ../../../i18n/ko/mailit.ts \ 50 ../../../i18n/ko/mailit.ts \
55 ../../../i18n/no/mailit.ts \ 51 ../../../i18n/no/mailit.ts \
56 ../../../i18n/pl/mailit.ts \ 52 ../../../i18n/pl/mailit.ts \
57 ../../../i18n/pt/mailit.ts \ 53 ../../../i18n/pt/mailit.ts \
58 ../../../i18n/pt_BR/mailit.ts \ 54 ../../../i18n/pt_BR/mailit.ts \
59 ../../../i18n/sl/mailit.ts \ 55 ../../../i18n/sl/mailit.ts \
60 ../../../i18n/zh_CN/mailit.ts \ 56 ../../../i18n/zh_CN/mailit.ts \
61 ../../../i18n/zh_TW/mailit.ts 57 ../../../i18n/zh_TW/mailit.ts
62 58
63include ( $(OPIEDIR)/include.pro ) 59include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/unsupported/mailit/mailitwindow.h b/noncore/unsupported/mailit/mailitwindow.h
index e818d32..11e56b9 100644
--- a/noncore/unsupported/mailit/mailitwindow.h
+++ b/noncore/unsupported/mailit/mailitwindow.h
@@ -12,48 +12,49 @@
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef MailItWindow_H 20#ifndef MailItWindow_H
21#define MailItWindow_H 21#define MailItWindow_H
22 22
23#include <qmainwindow.h> 23#include <qmainwindow.h>
24#include <qwidgetstack.h> 24#include <qwidgetstack.h>
25#include <qevent.h> 25#include <qevent.h>
26//#include <qlayout.h> 26//#include <qlayout.h>
27#include "emailclient.h" 27#include "emailclient.h"
28#include "writemail.h" 28#include "writemail.h"
29#include "readmail.h" 29#include "readmail.h"
30#include "addresslist.h" 30#include "addresslist.h"
31 31
32class MailItWindow: public QMainWindow 32class MailItWindow: public QMainWindow
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35public: 35public:
36 static QString appName() { return QString::fromLatin1("mailit"); }
36 MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 37 MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
37 ~MailItWindow(); 38 ~MailItWindow();
38 39
39signals: 40signals:
40public slots: 41public slots:
41 void compose(); 42 void compose();
42 void composeReply(Email &, bool&); 43 void composeReply(Email &, bool&);
43 void composeForward(Email &); 44 void composeForward(Email &);
44 void showEmailClient(); 45 void showEmailClient();
45 void viewMail(QListView *, Email *mail); 46 void viewMail(QListView *, Email *mail);
46 void updateMailView(Email *mail); 47 void updateMailView(Email *mail);
47 void closeEvent(QCloseEvent *e); 48 void closeEvent(QCloseEvent *e);
48 void updateCaption(const QString &); 49 void updateCaption(const QString &);
49 void setDocument(const QString &); 50 void setDocument(const QString &);
50 /*void reply(Email&); 51 /*void reply(Email&);
51 void replyAll(Email&); 52 void replyAll(Email&);
52 void forward(Email&); 53 void forward(Email&);
53 void remove(Email&);*/ 54 void remove(Email&);*/
54 55
55private: 56private:
56 EmailClient *emailClient; 57 EmailClient *emailClient;
57 WriteMail *writeMail; 58 WriteMail *writeMail;
58 ReadMail *readMail; 59 ReadMail *readMail;
59 QWidgetStack *views; 60 QWidgetStack *views;
diff --git a/noncore/unsupported/mailit/main.cpp b/noncore/unsupported/mailit/main.cpp
index 3a3e1fc..71f8877 100644
--- a/noncore/unsupported/mailit/main.cpp
+++ b/noncore/unsupported/mailit/main.cpp
@@ -1,29 +1,25 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include "mailitwindow.h" 21#include "mailitwindow.h"
22 22
23int main(int argc, char* argv[]) 23#include <opie/oapplicationfactory.h>
24{ 24
25 QPEApplication a( argc, argv ); 25OPIE_EXPORT_APP( OApplicationFactory<MailItWindow> ) \ No newline at end of file
26 MailItWindow mw(0, 0);
27 a.showMainDocumentWidget(&mw);
28 return a.exec();
29}