-rw-r--r-- | noncore/net/linphone/qlinphone.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/accountview.cpp | 8 | ||||
-rw-r--r-- | noncore/net/mail/composemail.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 18 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mhwrapper.cpp | 8 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 16 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 6 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 46 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsession.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/startdunconnection.cpp | 8 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/startpanconnection.cpp | 16 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 32 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexdialog.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/pppdialog.cpp | 6 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 4 |
18 files changed, 92 insertions, 92 deletions
diff --git a/noncore/net/linphone/qlinphone.cpp b/noncore/net/linphone/qlinphone.cpp index 3cc2ebc..ba4ee5f 100644 --- a/noncore/net/linphone/qlinphone.cpp +++ b/noncore/net/linphone/qlinphone.cpp | |||
@@ -19,192 +19,192 @@ | |||
19 | #include <qlineedit.h> | 19 | #include <qlineedit.h> |
20 | #include <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qwidget.h> | 21 | #include <qwidget.h> |
22 | #include <qslider.h> | 22 | #include <qslider.h> |
23 | #include <qtabwidget.h> | 23 | #include <qtabwidget.h> |
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
26 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <linphonecore.h> | 28 | #include <linphonecore.h> |
29 | 29 | ||
30 | extern "C" { | 30 | extern "C" { |
31 | static void stub(LinphoneCore*lc, char*msg) {} | 31 | static void stub(LinphoneCore*lc, char*msg) {} |
32 | 32 | ||
33 | static void qt_show(LinphoneCore *lc) { | 33 | static void qt_show(LinphoneCore *lc) { |
34 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; | 34 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; |
35 | w->pushGuiTask(new ShowTask(w)); | 35 | w->pushGuiTask(new ShowTask(w)); |
36 | } | 36 | } |
37 | 37 | ||
38 | static void qt_inv_recv(LinphoneCore *lc, char *from) { | 38 | static void qt_inv_recv(LinphoneCore *lc, char *from) { |
39 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; | 39 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; |
40 | QString tmp(from); | 40 | QString tmp(from); |
41 | w->pushGuiTask(new InviteReceivedTask(w,tmp)); | 41 | w->pushGuiTask(new InviteReceivedTask(w,tmp)); |
42 | } | 42 | } |
43 | 43 | ||
44 | static void qt_display_status(LinphoneCore *lc, char *status) { | 44 | static void qt_display_status(LinphoneCore *lc, char *status) { |
45 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; | 45 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; |
46 | QString tmp(status); | 46 | QString tmp(status); |
47 | w->pushGuiTask(new UpdateStatusBarTask(w,tmp)); | 47 | w->pushGuiTask(new UpdateStatusBarTask(w,tmp)); |
48 | } | 48 | } |
49 | static void qt_display_message(LinphoneCore *lc, char *message) { | 49 | static void qt_display_message(LinphoneCore *lc, char *message) { |
50 | QString qmsg(message); | 50 | QString qmsg(message); |
51 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; | 51 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; |
52 | w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Info)); | 52 | w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Info)); |
53 | } | 53 | } |
54 | static void qt_display_warning(LinphoneCore *lc, char *message) { | 54 | static void qt_display_warning(LinphoneCore *lc, char *message) { |
55 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; | 55 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; |
56 | QString qmsg(message); | 56 | QString qmsg(message); |
57 | w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Warn)); | 57 | w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Warn)); |
58 | } | 58 | } |
59 | static void qt_display_url(LinphoneCore *lc, char *message, char *url) { | 59 | static void qt_display_url(LinphoneCore *lc, char *message, char *url) { |
60 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; | 60 | QLinphoneMainWidget *w=(QLinphoneMainWidget*)lc->data; |
61 | QString qmsg=QString(message)+QString(url); | 61 | QString qmsg=QString(message)+QString(url); |
62 | w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Info)); | 62 | w->pushGuiTask(new DisplayMessageTask(w,qmsg,DisplayMessageTask::Info)); |
63 | } | 63 | } |
64 | static void qt_notify_recv(LinphoneCore *lc, const char *url, const char *status) { | 64 | static void qt_notify_recv(LinphoneCore *lc, const char *url, const char *status) { |
65 | } | 65 | } |
66 | 66 | ||
67 | LinphoneCoreVTable lcvtable={ | 67 | LinphoneCoreVTable lcvtable={ |
68 | show: | 68 | show: |
69 | qt_show, | 69 | qt_show, |
70 | inv_recv: | 70 | inv_recv: |
71 | qt_inv_recv, | 71 | qt_inv_recv, |
72 | bye_recv : | 72 | bye_recv : |
73 | stub, | 73 | stub, |
74 | notify_recv : | 74 | notify_recv : |
75 | qt_notify_recv, | 75 | qt_notify_recv, |
76 | display_status : | 76 | display_status : |
77 | qt_display_status, | 77 | qt_display_status, |
78 | display_message : | 78 | display_message : |
79 | qt_display_message, | 79 | qt_display_message, |
80 | display_warning : | 80 | display_warning : |
81 | qt_display_warning, | 81 | qt_display_warning, |
82 | display_url : | 82 | display_url : |
83 | qt_display_url, | 83 | qt_display_url, |
84 | display_question : | 84 | display_question : |
85 | stub | 85 | stub |
86 | }; | 86 | }; |
87 | 87 | ||
88 | 88 | ||
89 | } //extern "C" | 89 | } //extern "C" |
90 | 90 | ||
91 | void UpdateStatusBarTask::execute() { | 91 | void UpdateStatusBarTask::execute() { |
92 | static_cast<QLinphoneMainWidget*>(_w)->displayStatus(_msg); | 92 | static_cast<QLinphoneMainWidget*>(_w)->displayStatus(_msg); |
93 | } | 93 | } |
94 | 94 | ||
95 | void InviteReceivedTask::execute() { | 95 | void InviteReceivedTask::execute() { |
96 | static_cast<QLinphoneMainWidget*>(_w)->inviteReceived(_msg); | 96 | static_cast<QLinphoneMainWidget*>(_w)->inviteReceived(_msg); |
97 | } | 97 | } |
98 | 98 | ||
99 | void DisplayMessageTask::execute() { | 99 | void DisplayMessageTask::execute() { |
100 | switch(_msgtype) { | 100 | switch(_msgtype) { |
101 | case Info: | 101 | case Info: |
102 | QMessageBox::information(0,QObject::tr("Information"),_msg); | 102 | QMessageBox::information(0,QObject::tr("Information"),_msg); |
103 | break; | 103 | break; |
104 | case Warn: | 104 | case Warn: |
105 | QMessageBox::warning(0,QObject::tr("Warning"),_msg); | 105 | QMessageBox::warning(0,QObject::tr("Warning"),_msg); |
106 | break; | 106 | break; |
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | QLinphoneMainWidget::QLinphoneMainWidget(QWidget* parent , const char* name , WFlags fl ) : | 110 | QLinphoneMainWidget::QLinphoneMainWidget(QWidget* parent , const char* name , WFlags fl ) : |
111 | _QLinphoneMainWidget( parent, name, fl ) { | 111 | _QLinphoneMainWidget( parent, name, fl ) { |
112 | 112 | ||
113 | readConfig(); | 113 | readConfig(); |
114 | createLinphoneCore(); | 114 | createLinphoneCore(); |
115 | connect( CheckBox1, SIGNAL( toggled( bool ) ), this, SLOT( slotHide( bool ) ) ); | 115 | connect( CheckBox1, SIGNAL( toggled(bool) ), this, SLOT( slotHide(bool) ) ); |
116 | CheckBox1->setChecked( true ); | 116 | CheckBox1->setChecked( true ); |
117 | } | 117 | } |
118 | 118 | ||
119 | QLinphoneMainWidget::~QLinphoneMainWidget() { | 119 | QLinphoneMainWidget::~QLinphoneMainWidget() { |
120 | linphone_core_destroy(_core); | 120 | linphone_core_destroy(_core); |
121 | writeConfig(); | 121 | writeConfig(); |
122 | } | 122 | } |
123 | 123 | ||
124 | void QLinphoneMainWidget::slotHide( bool show ) { | 124 | void QLinphoneMainWidget::slotHide( bool show ) { |
125 | if ( show ) { | 125 | if ( show ) { |
126 | TabWidget2->show(); | 126 | TabWidget2->show(); |
127 | } else { | 127 | } else { |
128 | TabWidget2->hide(); | 128 | TabWidget2->hide(); |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | void QLinphoneMainWidget::callOrAccept() { | 132 | void QLinphoneMainWidget::callOrAccept() { |
133 | if (linphone_core_inc_invite_pending(_core)) { | 133 | if (linphone_core_inc_invite_pending(_core)) { |
134 | linphone_core_accept_dialog(_core,NULL); | 134 | linphone_core_accept_dialog(_core,NULL); |
135 | return; | 135 | return; |
136 | } | 136 | } |
137 | QString url=sip_url->text(); | 137 | QString url=sip_url->text(); |
138 | linphone_core_invite(_core,(char*)url.ascii()); | 138 | linphone_core_invite(_core,(char*)url.ascii()); |
139 | } | 139 | } |
140 | void QLinphoneMainWidget::terminateCall() { | 140 | void QLinphoneMainWidget::terminateCall() { |
141 | linphone_core_terminate_dialog(_core,NULL); | 141 | linphone_core_terminate_dialog(_core,NULL); |
142 | } | 142 | } |
143 | 143 | ||
144 | void QLinphoneMainWidget::inviteReceived(QString &tmp) { | 144 | void QLinphoneMainWidget::inviteReceived(QString &tmp) { |
145 | sip_url->setText(tmp); | 145 | sip_url->setText(tmp); |
146 | } | 146 | } |
147 | 147 | ||
148 | void QLinphoneMainWidget::displayStatus(QString &msg) { | 148 | void QLinphoneMainWidget::displayStatus(QString &msg) { |
149 | status_bar->setText(msg); | 149 | status_bar->setText(msg); |
150 | } | 150 | } |
151 | 151 | ||
152 | void QLinphoneMainWidget::pushGuiTask(GuiTask* g) { | 152 | void QLinphoneMainWidget::pushGuiTask(GuiTask* g) { |
153 | _mutex.lock(); | 153 | _mutex.lock(); |
154 | _actionq.enqueue(g); | 154 | _actionq.enqueue(g); |
155 | _mutex.unlock(); | 155 | _mutex.unlock(); |
156 | printf("New action added to task list.\n"); | 156 | printf("New action added to task list.\n"); |
157 | } | 157 | } |
158 | 158 | ||
159 | void QLinphoneMainWidget::processGuiTasks() { | 159 | void QLinphoneMainWidget::processGuiTasks() { |
160 | GuiTask *g; | 160 | GuiTask *g; |
161 | _mutex.lock(); | 161 | _mutex.lock(); |
162 | while(!_actionq.isEmpty()) { | 162 | while(!_actionq.isEmpty()) { |
163 | g=_actionq.dequeue(); | 163 | g=_actionq.dequeue(); |
164 | printf("Executing action...\n"); | 164 | printf("Executing action...\n"); |
165 | g->execute(); | 165 | g->execute(); |
166 | delete g; | 166 | delete g; |
167 | } | 167 | } |
168 | _mutex.unlock(); | 168 | _mutex.unlock(); |
169 | } | 169 | } |
170 | 170 | ||
171 | void QLinphoneMainWidget::timerEvent(QTimerEvent *t) { | 171 | void QLinphoneMainWidget::timerEvent(QTimerEvent *t) { |
172 | processGuiTasks(); | 172 | processGuiTasks(); |
173 | } | 173 | } |
174 | 174 | ||
175 | void QLinphoneMainWidget::readConfig() { | 175 | void QLinphoneMainWidget::readConfig() { |
176 | Config cfg( "opie-phone" ); | 176 | Config cfg( "opie-phone" ); |
177 | cfg.setGroup( "audio" ); | 177 | cfg.setGroup( "audio" ); |
178 | SliderInput->setValue( cfg.readNumEntry( "rec_lev", 50 ) ); | 178 | SliderInput->setValue( cfg.readNumEntry( "rec_lev", 50 ) ); |
179 | SliderOutput->setValue( cfg.readNumEntry( "play_lev", 50 ) ); | 179 | SliderOutput->setValue( cfg.readNumEntry( "play_lev", 50 ) ); |
180 | } | 180 | } |
181 | 181 | ||
182 | void QLinphoneMainWidget::writeConfig() { | 182 | void QLinphoneMainWidget::writeConfig() { |
183 | Config cfg( "opie-phone" ); | 183 | Config cfg( "opie-phone" ); |
184 | cfg.setGroup( "audio" ); | 184 | cfg.setGroup( "audio" ); |
185 | cfg.writeEntry( "rec_lev", SliderInput->value() ); | 185 | cfg.writeEntry( "rec_lev", SliderInput->value() ); |
186 | cfg.writeEntry( "playlev", SliderOutput->value() ); | 186 | cfg.writeEntry( "playlev", SliderOutput->value() ); |
187 | } | 187 | } |
188 | 188 | ||
189 | void QLinphoneMainWidget::helpAbout() { | 189 | void QLinphoneMainWidget::helpAbout() { |
190 | QMessageBox::about(this,tr("About Linphone"),tr("QT version of linphone\nJuly 2003 - Made in old Europe.")); | 190 | QMessageBox::about(this,tr("About Linphone"),tr("QT version of linphone\nJuly 2003 - Made in old Europe.")); |
191 | } | 191 | } |
192 | 192 | ||
193 | void QLinphoneMainWidget::createLinphoneCore() { | 193 | void QLinphoneMainWidget::createLinphoneCore() { |
194 | if ( _core ) { | 194 | if ( _core ) { |
195 | linphone_core_destroy(_core); | 195 | linphone_core_destroy(_core); |
196 | } | 196 | } |
197 | 197 | ||
198 | gchar *home=getenv("HOME"); | 198 | gchar *home=getenv("HOME"); |
199 | gchar *suffix="/Settings/opie-phone.conf"; | 199 | gchar *suffix="/Settings/opie-phone.conf"; |
200 | if (home==0) | 200 | if (home==0) |
201 | home=strdup("/root"); | 201 | home=strdup("/root"); |
202 | gchar *config=new char[strlen(home)+strlen(suffix)+2]; | 202 | gchar *config=new char[strlen(home)+strlen(suffix)+2]; |
203 | sprintf(config,"%s/%s",home,suffix); | 203 | sprintf(config,"%s/%s",home,suffix); |
204 | /* tracing for osip */ | 204 | /* tracing for osip */ |
205 | TRACE_INITIALIZE((trace_level_t)5,stdout); | 205 | TRACE_INITIALIZE((trace_level_t)5,stdout); |
206 | _core=linphone_core_new(&lcvtable,config,(gpointer)this); | 206 | _core=linphone_core_new(&lcvtable,config,(gpointer)this); |
207 | delete [] config; | 207 | delete [] config; |
208 | startTimer(10); | 208 | startTimer(10); |
209 | } | 209 | } |
210 | 210 | ||
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index c2185f2..64557ee 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -1,119 +1,119 @@ | |||
1 | 1 | ||
2 | #include "accountview.h" | 2 | #include "accountview.h" |
3 | #include "accountitem.h" | 3 | #include "accountitem.h" |
4 | #include "selectstore.h" | 4 | #include "selectstore.h" |
5 | 5 | ||
6 | /* OPIE */ | 6 | /* OPIE */ |
7 | #include <libmailwrapper/settings.h> | 7 | #include <libmailwrapper/settings.h> |
8 | #include <libmailwrapper/mailwrapper.h> | 8 | #include <libmailwrapper/mailwrapper.h> |
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | #include <libmailwrapper/abstractmail.h> | 10 | #include <libmailwrapper/abstractmail.h> |
11 | #include <qpe/qpeapplication.h> | 11 | #include <qpe/qpeapplication.h> |
12 | 12 | ||
13 | /* QT */ | 13 | /* QT */ |
14 | #include <qmessagebox.h> | 14 | #include <qmessagebox.h> |
15 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
16 | 16 | ||
17 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 17 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
18 | : QListView( parent, name, flags ) | 18 | : QListView( parent, name, flags ) |
19 | { | 19 | { |
20 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), | 20 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), |
21 | SLOT( refresh( QListViewItem * ) ) ); | 21 | SLOT( refresh(QListViewItem*) ) ); |
22 | connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, | 22 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
23 | SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); | 23 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); |
24 | setSorting(0); | 24 | setSorting(0); |
25 | } | 25 | } |
26 | 26 | ||
27 | AccountView::~AccountView() | 27 | AccountView::~AccountView() |
28 | { | 28 | { |
29 | imapAccounts.clear(); | 29 | imapAccounts.clear(); |
30 | mhAccounts.clear(); | 30 | mhAccounts.clear(); |
31 | } | 31 | } |
32 | 32 | ||
33 | void AccountView::slotContextMenu(int id) | 33 | void AccountView::slotContextMenu(int id) |
34 | { | 34 | { |
35 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 35 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
36 | if (!view) return; | 36 | if (!view) return; |
37 | view->contextMenuSelected(id); | 37 | view->contextMenuSelected(id); |
38 | } | 38 | } |
39 | 39 | ||
40 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 40 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) |
41 | { | 41 | { |
42 | if (button==1) {return;} | 42 | if (button==1) {return;} |
43 | if (!item) return; | 43 | if (!item) return; |
44 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 44 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
45 | QPopupMenu*m = view->getContextMenu(); | 45 | QPopupMenu*m = view->getContextMenu(); |
46 | if (!m) return; | 46 | if (!m) return; |
47 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 47 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
48 | m->setFocus(); | 48 | m->setFocus(); |
49 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 49 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
50 | delete m; | 50 | delete m; |
51 | } | 51 | } |
52 | 52 | ||
53 | void AccountView::populate( QList<Account> list ) | 53 | void AccountView::populate( QList<Account> list ) |
54 | { | 54 | { |
55 | clear(); | 55 | clear(); |
56 | 56 | ||
57 | imapAccounts.clear(); | 57 | imapAccounts.clear(); |
58 | mhAccounts.clear(); | 58 | mhAccounts.clear(); |
59 | 59 | ||
60 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 60 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
61 | 61 | ||
62 | Account *it; | 62 | Account *it; |
63 | for ( it = list.first(); it; it = list.next() ) | 63 | for ( it = list.first(); it; it = list.next() ) |
64 | { | 64 | { |
65 | if ( it->getType().compare( "IMAP" ) == 0 ) | 65 | if ( it->getType().compare( "IMAP" ) == 0 ) |
66 | { | 66 | { |
67 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 67 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
68 | qDebug( "added IMAP " + imap->getAccountName() ); | 68 | qDebug( "added IMAP " + imap->getAccountName() ); |
69 | imapAccounts.append(new IMAPviewItem( imap, this )); | 69 | imapAccounts.append(new IMAPviewItem( imap, this )); |
70 | } | 70 | } |
71 | else if ( it->getType().compare( "POP3" ) == 0 ) | 71 | else if ( it->getType().compare( "POP3" ) == 0 ) |
72 | { | 72 | { |
73 | POP3account *pop3 = static_cast<POP3account *>(it); | 73 | POP3account *pop3 = static_cast<POP3account *>(it); |
74 | qDebug( "added POP3 " + pop3->getAccountName() ); | 74 | qDebug( "added POP3 " + pop3->getAccountName() ); |
75 | /* must not be hold 'cause it isn't required */ | 75 | /* must not be hold 'cause it isn't required */ |
76 | (void) new POP3viewItem( pop3, this ); | 76 | (void) new POP3viewItem( pop3, this ); |
77 | } | 77 | } |
78 | else if ( it->getType().compare( "NNTP" ) == 0 ) | 78 | else if ( it->getType().compare( "NNTP" ) == 0 ) |
79 | { | 79 | { |
80 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 80 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
81 | qDebug( "added NNTP " + nntp->getAccountName() ); | 81 | qDebug( "added NNTP " + nntp->getAccountName() ); |
82 | /* must not be hold 'cause it isn't required */ | 82 | /* must not be hold 'cause it isn't required */ |
83 | (void) new NNTPviewItem( nntp, this ); | 83 | (void) new NNTPviewItem( nntp, this ); |
84 | } | 84 | } |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | void AccountView::refresh(QListViewItem *item) | 88 | void AccountView::refresh(QListViewItem *item) |
89 | { | 89 | { |
90 | 90 | ||
91 | qDebug("AccountView refresh..."); | 91 | qDebug("AccountView refresh..."); |
92 | if ( item ) | 92 | if ( item ) |
93 | { | 93 | { |
94 | m_currentItem = item; | 94 | m_currentItem = item; |
95 | QList<RecMail> headerlist; | 95 | QList<RecMail> headerlist; |
96 | headerlist.setAutoDelete(true); | 96 | headerlist.setAutoDelete(true); |
97 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 97 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
98 | view->refresh(headerlist); | 98 | view->refresh(headerlist); |
99 | emit refreshMailview(&headerlist); | 99 | emit refreshMailview(&headerlist); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | void AccountView::refreshCurrent() | 103 | void AccountView::refreshCurrent() |
104 | { | 104 | { |
105 | m_currentItem = currentItem(); | 105 | m_currentItem = currentItem(); |
106 | if ( !m_currentItem ) return; | 106 | if ( !m_currentItem ) return; |
107 | QList<RecMail> headerlist; | 107 | QList<RecMail> headerlist; |
108 | headerlist.setAutoDelete(true); | 108 | headerlist.setAutoDelete(true); |
109 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 109 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
110 | view->refresh(headerlist); | 110 | view->refresh(headerlist); |
111 | emit refreshMailview(&headerlist); | 111 | emit refreshMailview(&headerlist); |
112 | } | 112 | } |
113 | 113 | ||
114 | void AccountView::refreshAll() | 114 | void AccountView::refreshAll() |
115 | { | 115 | { |
116 | } | 116 | } |
117 | 117 | ||
118 | RecBody AccountView::fetchBody(const RecMail&aMail) | 118 | RecBody AccountView::fetchBody(const RecMail&aMail) |
119 | { | 119 | { |
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 6708779..f51a8fe 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp | |||
@@ -1,161 +1,161 @@ | |||
1 | #include <qt.h> | 1 | #include <qt.h> |
2 | 2 | ||
3 | #include <opie2/ofiledialog.h> | 3 | #include <opie2/ofiledialog.h> |
4 | #include <qpe/resource.h> | 4 | #include <qpe/resource.h> |
5 | #include <qpe/config.h> | 5 | #include <qpe/config.h> |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | #include <qpe/contact.h> | 7 | #include <qpe/contact.h> |
8 | 8 | ||
9 | #include "composemail.h" | 9 | #include "composemail.h" |
10 | 10 | ||
11 | #include <libmailwrapper/smtpwrapper.h> | 11 | #include <libmailwrapper/smtpwrapper.h> |
12 | 12 | ||
13 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 13 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
14 | : ComposeMailUI( parent, name, modal, flags ) | 14 | : ComposeMailUI( parent, name, modal, flags ) |
15 | { | 15 | { |
16 | settings = s; | 16 | settings = s; |
17 | 17 | ||
18 | QString vfilename = Global::applicationFileName("addressbook", | 18 | QString vfilename = Global::applicationFileName("addressbook", |
19 | "businesscard.vcf"); | 19 | "businesscard.vcf"); |
20 | Contact c; | 20 | Contact c; |
21 | if (QFile::exists(vfilename)) { | 21 | if (QFile::exists(vfilename)) { |
22 | c = Contact::readVCard( vfilename )[0]; | 22 | c = Contact::readVCard( vfilename )[0]; |
23 | } | 23 | } |
24 | 24 | ||
25 | QStringList mails = c.emailList(); | 25 | QStringList mails = c.emailList(); |
26 | QString defmail = c.defaultEmail(); | 26 | QString defmail = c.defaultEmail(); |
27 | 27 | ||
28 | if (defmail.length()!=0) { | 28 | if (defmail.length()!=0) { |
29 | fromBox->insertItem(defmail); | 29 | fromBox->insertItem(defmail); |
30 | } | 30 | } |
31 | QStringList::ConstIterator sit = mails.begin(); | 31 | QStringList::ConstIterator sit = mails.begin(); |
32 | for (;sit!=mails.end();++sit) { | 32 | for (;sit!=mails.end();++sit) { |
33 | if ( (*sit)==defmail) | 33 | if ( (*sit)==defmail) |
34 | continue; | 34 | continue; |
35 | fromBox->insertItem((*sit)); | 35 | fromBox->insertItem((*sit)); |
36 | } | 36 | } |
37 | senderNameEdit->setText(c.firstName()+" "+c.lastName()); | 37 | senderNameEdit->setText(c.firstName()+" "+c.lastName()); |
38 | Config cfg( "mail" ); | 38 | Config cfg( "mail" ); |
39 | cfg.setGroup( "Compose" ); | 39 | cfg.setGroup( "Compose" ); |
40 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 40 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
41 | 41 | ||
42 | attList->addColumn( tr( "Name" ) ); | 42 | attList->addColumn( tr( "Name" ) ); |
43 | attList->addColumn( tr( "Size" ) ); | 43 | attList->addColumn( tr( "Size" ) ); |
44 | 44 | ||
45 | QList<Account> accounts = settings->getAccounts(); | 45 | QList<Account> accounts = settings->getAccounts(); |
46 | 46 | ||
47 | Account *it; | 47 | Account *it; |
48 | for ( it = accounts.first(); it; it = accounts.next() ) { | 48 | for ( it = accounts.first(); it; it = accounts.next() ) { |
49 | if ( it->getType().compare( "SMTP" ) == 0 ) { | 49 | if ( it->getType().compare( "SMTP" ) == 0 ) { |
50 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 50 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
51 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 51 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
52 | smtpAccounts.append( smtp ); | 52 | smtpAccounts.append( smtp ); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | if ( smtpAccounts.count() > 0 ) { | 56 | if ( smtpAccounts.count() > 0 ) { |
57 | fillValues( smtpAccountBox->currentItem() ); | 57 | fillValues( smtpAccountBox->currentItem() ); |
58 | } else { | 58 | } else { |
59 | QMessageBox::information( this, tr( "Problem" ), | 59 | QMessageBox::information( this, tr( "Problem" ), |
60 | tr( "<p>Please create an SMTP account first.</p>" ), | 60 | tr( "<p>Please create an SMTP account first.</p>" ), |
61 | tr( "Ok" ) ); | 61 | tr( "Ok" ) ); |
62 | return; | 62 | return; |
63 | } | 63 | } |
64 | 64 | ||
65 | connect( smtpAccountBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); | 65 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
66 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 66 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
67 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 67 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
68 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 68 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
69 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 69 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
70 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 70 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
71 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 71 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
72 | } | 72 | } |
73 | 73 | ||
74 | void ComposeMail::pickAddress( QLineEdit *line ) | 74 | void ComposeMail::pickAddress( QLineEdit *line ) |
75 | { | 75 | { |
76 | QString names = AddressPicker::getNames(); | 76 | QString names = AddressPicker::getNames(); |
77 | if ( line->text().isEmpty() ) { | 77 | if ( line->text().isEmpty() ) { |
78 | line->setText( names ); | 78 | line->setText( names ); |
79 | } else if ( !names.isEmpty() ) { | 79 | } else if ( !names.isEmpty() ) { |
80 | line->setText( line->text() + ", " + names ); | 80 | line->setText( line->text() + ", " + names ); |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | void ComposeMail::setTo( const QString & to ) | 85 | void ComposeMail::setTo( const QString & to ) |
86 | { | 86 | { |
87 | /* QString toline; | 87 | /* QString toline; |
88 | QStringList toEntry = to; | 88 | QStringList toEntry = to; |
89 | for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) { | 89 | for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) { |
90 | toline += (*it); | 90 | toline += (*it); |
91 | } | 91 | } |
92 | toLine->setText( toline ); | 92 | toLine->setText( toline ); |
93 | */ | 93 | */ |
94 | toLine->setText( to ); | 94 | toLine->setText( to ); |
95 | } | 95 | } |
96 | 96 | ||
97 | void ComposeMail::setSubject( const QString & subject ) | 97 | void ComposeMail::setSubject( const QString & subject ) |
98 | { | 98 | { |
99 | subjectLine->setText( subject ); | 99 | subjectLine->setText( subject ); |
100 | } | 100 | } |
101 | 101 | ||
102 | void ComposeMail::setInReplyTo( const QString & messageId ) | 102 | void ComposeMail::setInReplyTo( const QString & messageId ) |
103 | { | 103 | { |
104 | 104 | ||
105 | } | 105 | } |
106 | 106 | ||
107 | void ComposeMail::setMessage( const QString & text ) | 107 | void ComposeMail::setMessage( const QString & text ) |
108 | { | 108 | { |
109 | message->setText( text ); | 109 | message->setText( text ); |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | void ComposeMail::pickAddressTo() | 113 | void ComposeMail::pickAddressTo() |
114 | { | 114 | { |
115 | pickAddress( toLine ); | 115 | pickAddress( toLine ); |
116 | } | 116 | } |
117 | 117 | ||
118 | void ComposeMail::pickAddressCC() | 118 | void ComposeMail::pickAddressCC() |
119 | { | 119 | { |
120 | pickAddress( ccLine ); | 120 | pickAddress( ccLine ); |
121 | } | 121 | } |
122 | 122 | ||
123 | void ComposeMail::pickAddressBCC() | 123 | void ComposeMail::pickAddressBCC() |
124 | { | 124 | { |
125 | pickAddress( bccLine ); | 125 | pickAddress( bccLine ); |
126 | } | 126 | } |
127 | 127 | ||
128 | void ComposeMail::pickAddressReply() | 128 | void ComposeMail::pickAddressReply() |
129 | { | 129 | { |
130 | pickAddress( replyLine ); | 130 | pickAddress( replyLine ); |
131 | } | 131 | } |
132 | 132 | ||
133 | void ComposeMail::fillValues( int current ) | 133 | void ComposeMail::fillValues( int current ) |
134 | { | 134 | { |
135 | #if 0 | 135 | #if 0 |
136 | SMTPaccount *smtp = smtpAccounts.at( current ); | 136 | SMTPaccount *smtp = smtpAccounts.at( current ); |
137 | ccLine->clear(); | 137 | ccLine->clear(); |
138 | if ( smtp->getUseCC() ) { | 138 | if ( smtp->getUseCC() ) { |
139 | ccLine->setText( smtp->getCC() ); | 139 | ccLine->setText( smtp->getCC() ); |
140 | } | 140 | } |
141 | bccLine->clear(); | 141 | bccLine->clear(); |
142 | if ( smtp->getUseBCC() ) { | 142 | if ( smtp->getUseBCC() ) { |
143 | bccLine->setText( smtp->getBCC() ); | 143 | bccLine->setText( smtp->getBCC() ); |
144 | } | 144 | } |
145 | replyLine->clear(); | 145 | replyLine->clear(); |
146 | if ( smtp->getUseReply() ) { | 146 | if ( smtp->getUseReply() ) { |
147 | replyLine->setText( smtp->getReply() ); | 147 | replyLine->setText( smtp->getReply() ); |
148 | } | 148 | } |
149 | sigMultiLine->setText( smtp->getSignature() ); | 149 | sigMultiLine->setText( smtp->getSignature() ); |
150 | #endif | 150 | #endif |
151 | } | 151 | } |
152 | 152 | ||
153 | void ComposeMail::slotAdjustColumns() | 153 | void ComposeMail::slotAdjustColumns() |
154 | { | 154 | { |
155 | int currPage = tabWidget->currentPageIndex(); | 155 | int currPage = tabWidget->currentPageIndex(); |
156 | 156 | ||
157 | tabWidget->showPage( attachTab ); | 157 | tabWidget->showPage( attachTab ); |
158 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 158 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
159 | attList->setColumnWidth( 1, 80 ); | 159 | attList->setColumnWidth( 1, 80 ); |
160 | 160 | ||
161 | tabWidget->setCurrentPage( currPage ); | 161 | tabWidget->setCurrentPage( currPage ); |
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 60bffa5..edeb1de 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp | |||
@@ -191,342 +191,342 @@ void EditAccounts::slotDeleteAccount( Account *account ) | |||
191 | 191 | ||
192 | void EditAccounts::slotEditMail() | 192 | void EditAccounts::slotEditMail() |
193 | { | 193 | { |
194 | qDebug( "Edit Mail Account" ); | 194 | qDebug( "Edit Mail Account" ); |
195 | if ( !mailList->currentItem() ) | 195 | if ( !mailList->currentItem() ) |
196 | { | 196 | { |
197 | QMessageBox::information( this, tr( "Error" ), | 197 | QMessageBox::information( this, tr( "Error" ), |
198 | tr( "<p>Please select an account.</p>" ), | 198 | tr( "<p>Please select an account.</p>" ), |
199 | tr( "Ok" ) ); | 199 | tr( "Ok" ) ); |
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | 202 | ||
203 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 203 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
204 | slotEditAccount( a ); | 204 | slotEditAccount( a ); |
205 | } | 205 | } |
206 | 206 | ||
207 | void EditAccounts::slotDeleteMail() | 207 | void EditAccounts::slotDeleteMail() |
208 | { | 208 | { |
209 | if ( !mailList->currentItem() ) | 209 | if ( !mailList->currentItem() ) |
210 | { | 210 | { |
211 | QMessageBox::information( this, tr( "Error" ), | 211 | QMessageBox::information( this, tr( "Error" ), |
212 | tr( "<p>Please select an account.</p>" ), | 212 | tr( "<p>Please select an account.</p>" ), |
213 | tr( "Ok" ) ); | 213 | tr( "Ok" ) ); |
214 | return; | 214 | return; |
215 | } | 215 | } |
216 | 216 | ||
217 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 217 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
218 | slotDeleteAccount( a ); | 218 | slotDeleteAccount( a ); |
219 | } | 219 | } |
220 | 220 | ||
221 | void EditAccounts::slotNewNews() | 221 | void EditAccounts::slotNewNews() |
222 | { | 222 | { |
223 | qDebug( "New News Account" ); | 223 | qDebug( "New News Account" ); |
224 | slotNewAccount( "NNTP" ); | 224 | slotNewAccount( "NNTP" ); |
225 | } | 225 | } |
226 | 226 | ||
227 | void EditAccounts::slotEditNews() | 227 | void EditAccounts::slotEditNews() |
228 | { | 228 | { |
229 | qDebug( "Edit News Account" ); | 229 | qDebug( "Edit News Account" ); |
230 | if ( !newsList->currentItem() ) | 230 | if ( !newsList->currentItem() ) |
231 | { | 231 | { |
232 | QMessageBox::information( this, tr( "Error" ), | 232 | QMessageBox::information( this, tr( "Error" ), |
233 | tr( "<p>Please select an account.</p>" ), | 233 | tr( "<p>Please select an account.</p>" ), |
234 | tr( "Ok" ) ); | 234 | tr( "Ok" ) ); |
235 | return; | 235 | return; |
236 | } | 236 | } |
237 | 237 | ||
238 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); | 238 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); |
239 | slotEditAccount( a ); | 239 | slotEditAccount( a ); |
240 | } | 240 | } |
241 | 241 | ||
242 | void EditAccounts::slotDeleteNews() | 242 | void EditAccounts::slotDeleteNews() |
243 | { | 243 | { |
244 | qDebug( "Delete News Account" ); | 244 | qDebug( "Delete News Account" ); |
245 | if ( !newsList->currentItem() ) | 245 | if ( !newsList->currentItem() ) |
246 | { | 246 | { |
247 | QMessageBox::information( this, tr( "Error" ), | 247 | QMessageBox::information( this, tr( "Error" ), |
248 | tr( "<p>Please select an account.</p>" ), | 248 | tr( "<p>Please select an account.</p>" ), |
249 | tr( "Ok" ) ); | 249 | tr( "Ok" ) ); |
250 | return; | 250 | return; |
251 | } | 251 | } |
252 | 252 | ||
253 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); | 253 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); |
254 | slotDeleteAccount( a ); | 254 | slotDeleteAccount( a ); |
255 | } | 255 | } |
256 | 256 | ||
257 | void EditAccounts::slotAdjustColumns() | 257 | void EditAccounts::slotAdjustColumns() |
258 | { | 258 | { |
259 | int currPage = configTab->currentPageIndex(); | 259 | int currPage = configTab->currentPageIndex(); |
260 | 260 | ||
261 | configTab->showPage( mailTab ); | 261 | configTab->showPage( mailTab ); |
262 | mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); | 262 | mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); |
263 | mailList->setColumnWidth( 1, 50 ); | 263 | mailList->setColumnWidth( 1, 50 ); |
264 | 264 | ||
265 | configTab->showPage( newsTab ); | 265 | configTab->showPage( newsTab ); |
266 | newsList->setColumnWidth( 0, newsList->visibleWidth() ); | 266 | newsList->setColumnWidth( 0, newsList->visibleWidth() ); |
267 | 267 | ||
268 | configTab->setCurrentPage( currPage ); | 268 | configTab->setCurrentPage( currPage ); |
269 | } | 269 | } |
270 | 270 | ||
271 | void EditAccounts::accept() | 271 | void EditAccounts::accept() |
272 | { | 272 | { |
273 | settings->saveAccounts(); | 273 | settings->saveAccounts(); |
274 | 274 | ||
275 | QDialog::accept(); | 275 | QDialog::accept(); |
276 | } | 276 | } |
277 | 277 | ||
278 | /** | 278 | /** |
279 | * SelectMailType | 279 | * SelectMailType |
280 | */ | 280 | */ |
281 | 281 | ||
282 | SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) | 282 | SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) |
283 | : SelectMailTypeUI( parent, name, modal, flags ) | 283 | : SelectMailTypeUI( parent, name, modal, flags ) |
284 | { | 284 | { |
285 | selected = selection; | 285 | selected = selection; |
286 | selected->replace( 0, selected->length(), typeBox->currentText() ); | 286 | selected->replace( 0, selected->length(), typeBox->currentText() ); |
287 | connect( typeBox, SIGNAL( activated( const QString & ) ), SLOT( slotSelection( const QString & ) ) ); | 287 | connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); |
288 | } | 288 | } |
289 | 289 | ||
290 | void SelectMailType::slotSelection( const QString &sel ) | 290 | void SelectMailType::slotSelection( const QString &sel ) |
291 | { | 291 | { |
292 | selected->replace( 0, selected->length(), sel ); | 292 | selected->replace( 0, selected->length(), sel ); |
293 | } | 293 | } |
294 | 294 | ||
295 | /** | 295 | /** |
296 | * IMAPconfig | 296 | * IMAPconfig |
297 | */ | 297 | */ |
298 | 298 | ||
299 | IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 299 | IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
300 | : IMAPconfigUI( parent, name, modal, flags ) | 300 | : IMAPconfigUI( parent, name, modal, flags ) |
301 | { | 301 | { |
302 | data = account; | 302 | data = account; |
303 | 303 | ||
304 | fillValues(); | 304 | fillValues(); |
305 | 305 | ||
306 | connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); | 306 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
307 | ComboBox1->insertItem( "Only if available", 0 ); | 307 | ComboBox1->insertItem( "Only if available", 0 ); |
308 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 308 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
309 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 309 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
310 | ComboBox1->insertItem( "Run command instead", 3 ); | 310 | ComboBox1->insertItem( "Run command instead", 3 ); |
311 | CommandEdit->hide(); | 311 | CommandEdit->hide(); |
312 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 312 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
313 | } | 313 | } |
314 | 314 | ||
315 | void IMAPconfig::slotConnectionToggle( int index ) | 315 | void IMAPconfig::slotConnectionToggle( int index ) |
316 | { | 316 | { |
317 | if ( index == 2 ) | 317 | if ( index == 2 ) |
318 | { | 318 | { |
319 | portLine->setText( IMAP_SSL_PORT ); | 319 | portLine->setText( IMAP_SSL_PORT ); |
320 | } | 320 | } |
321 | else if ( index == 3 ) | 321 | else if ( index == 3 ) |
322 | { | 322 | { |
323 | portLine->setText( IMAP_PORT ); | 323 | portLine->setText( IMAP_PORT ); |
324 | CommandEdit->show(); | 324 | CommandEdit->show(); |
325 | } | 325 | } |
326 | else | 326 | else |
327 | { | 327 | { |
328 | portLine->setText( IMAP_PORT ); | 328 | portLine->setText( IMAP_PORT ); |
329 | } | 329 | } |
330 | } | 330 | } |
331 | 331 | ||
332 | void IMAPconfig::fillValues() | 332 | void IMAPconfig::fillValues() |
333 | { | 333 | { |
334 | accountLine->setText( data->getAccountName() ); | 334 | accountLine->setText( data->getAccountName() ); |
335 | serverLine->setText( data->getServer() ); | 335 | serverLine->setText( data->getServer() ); |
336 | portLine->setText( data->getPort() ); | 336 | portLine->setText( data->getPort() ); |
337 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 337 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
338 | userLine->setText( data->getUser() ); | 338 | userLine->setText( data->getUser() ); |
339 | passLine->setText( data->getPassword() ); | 339 | passLine->setText( data->getPassword() ); |
340 | prefixLine->setText(data->getPrefix()); | 340 | prefixLine->setText(data->getPrefix()); |
341 | } | 341 | } |
342 | 342 | ||
343 | void IMAPconfig::accept() | 343 | void IMAPconfig::accept() |
344 | { | 344 | { |
345 | data->setAccountName( accountLine->text() ); | 345 | data->setAccountName( accountLine->text() ); |
346 | data->setServer( serverLine->text() ); | 346 | data->setServer( serverLine->text() ); |
347 | data->setPort( portLine->text() ); | 347 | data->setPort( portLine->text() ); |
348 | data->setConnectionType( ComboBox1->currentItem() ); | 348 | data->setConnectionType( ComboBox1->currentItem() ); |
349 | data->setUser( userLine->text() ); | 349 | data->setUser( userLine->text() ); |
350 | data->setPassword( passLine->text() ); | 350 | data->setPassword( passLine->text() ); |
351 | data->setPrefix(prefixLine->text()); | 351 | data->setPrefix(prefixLine->text()); |
352 | 352 | ||
353 | QDialog::accept(); | 353 | QDialog::accept(); |
354 | } | 354 | } |
355 | 355 | ||
356 | /** | 356 | /** |
357 | * POP3config | 357 | * POP3config |
358 | */ | 358 | */ |
359 | 359 | ||
360 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 360 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
361 | : POP3configUI( parent, name, modal, flags ) | 361 | : POP3configUI( parent, name, modal, flags ) |
362 | { | 362 | { |
363 | data = account; | 363 | data = account; |
364 | fillValues(); | 364 | fillValues(); |
365 | 365 | ||
366 | connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); | 366 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
367 | ComboBox1->insertItem( "Only if available", 0 ); | 367 | ComboBox1->insertItem( "Only if available", 0 ); |
368 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 368 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
369 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 369 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
370 | ComboBox1->insertItem( "Run command instead", 3 ); | 370 | ComboBox1->insertItem( "Run command instead", 3 ); |
371 | CommandEdit->hide(); | 371 | CommandEdit->hide(); |
372 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 372 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
373 | } | 373 | } |
374 | 374 | ||
375 | void POP3config::slotConnectionToggle( int index ) | 375 | void POP3config::slotConnectionToggle( int index ) |
376 | { | 376 | { |
377 | // 2 is ssl connection | 377 | // 2 is ssl connection |
378 | if ( index == 2 ) | 378 | if ( index == 2 ) |
379 | { | 379 | { |
380 | portLine->setText( POP3_SSL_PORT ); | 380 | portLine->setText( POP3_SSL_PORT ); |
381 | } | 381 | } |
382 | else if ( index == 3 ) | 382 | else if ( index == 3 ) |
383 | { | 383 | { |
384 | portLine->setText( POP3_PORT ); | 384 | portLine->setText( POP3_PORT ); |
385 | CommandEdit->show(); | 385 | CommandEdit->show(); |
386 | } | 386 | } |
387 | else | 387 | else |
388 | { | 388 | { |
389 | portLine->setText( POP3_PORT ); | 389 | portLine->setText( POP3_PORT ); |
390 | } | 390 | } |
391 | } | 391 | } |
392 | 392 | ||
393 | void POP3config::fillValues() | 393 | void POP3config::fillValues() |
394 | { | 394 | { |
395 | accountLine->setText( data->getAccountName() ); | 395 | accountLine->setText( data->getAccountName() ); |
396 | serverLine->setText( data->getServer() ); | 396 | serverLine->setText( data->getServer() ); |
397 | portLine->setText( data->getPort() ); | 397 | portLine->setText( data->getPort() ); |
398 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 398 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
399 | userLine->setText( data->getUser() ); | 399 | userLine->setText( data->getUser() ); |
400 | passLine->setText( data->getPassword() ); | 400 | passLine->setText( data->getPassword() ); |
401 | } | 401 | } |
402 | 402 | ||
403 | void POP3config::accept() | 403 | void POP3config::accept() |
404 | { | 404 | { |
405 | data->setAccountName( accountLine->text() ); | 405 | data->setAccountName( accountLine->text() ); |
406 | data->setServer( serverLine->text() ); | 406 | data->setServer( serverLine->text() ); |
407 | data->setPort( portLine->text() ); | 407 | data->setPort( portLine->text() ); |
408 | data->setConnectionType( ComboBox1->currentItem() ); | 408 | data->setConnectionType( ComboBox1->currentItem() ); |
409 | data->setUser( userLine->text() ); | 409 | data->setUser( userLine->text() ); |
410 | data->setPassword( passLine->text() ); | 410 | data->setPassword( passLine->text() ); |
411 | 411 | ||
412 | QDialog::accept(); | 412 | QDialog::accept(); |
413 | } | 413 | } |
414 | 414 | ||
415 | /** | 415 | /** |
416 | * SMTPconfig | 416 | * SMTPconfig |
417 | */ | 417 | */ |
418 | 418 | ||
419 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 419 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
420 | : SMTPconfigUI( parent, name, modal, flags ) | 420 | : SMTPconfigUI( parent, name, modal, flags ) |
421 | { | 421 | { |
422 | data = account; | 422 | data = account; |
423 | 423 | ||
424 | connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); | 424 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
425 | connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); | 425 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
426 | 426 | ||
427 | fillValues(); | 427 | fillValues(); |
428 | 428 | ||
429 | connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); | 429 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
430 | ComboBox1->insertItem( "Only if available", 0 ); | 430 | ComboBox1->insertItem( "Only if available", 0 ); |
431 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 431 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
432 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 432 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
433 | ComboBox1->insertItem( "Run command instead", 3 ); | 433 | ComboBox1->insertItem( "Run command instead", 3 ); |
434 | CommandEdit->hide(); | 434 | CommandEdit->hide(); |
435 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 435 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
436 | } | 436 | } |
437 | 437 | ||
438 | void SMTPconfig::slotConnectionToggle( int index ) | 438 | void SMTPconfig::slotConnectionToggle( int index ) |
439 | { | 439 | { |
440 | // 2 is ssl connection | 440 | // 2 is ssl connection |
441 | if ( index == 2 ) | 441 | if ( index == 2 ) |
442 | { | 442 | { |
443 | portLine->setText( SMTP_SSL_PORT ); | 443 | portLine->setText( SMTP_SSL_PORT ); |
444 | } | 444 | } |
445 | else if ( index == 3 ) | 445 | else if ( index == 3 ) |
446 | { | 446 | { |
447 | portLine->setText( SMTP_PORT ); | 447 | portLine->setText( SMTP_PORT ); |
448 | CommandEdit->show(); | 448 | CommandEdit->show(); |
449 | } | 449 | } |
450 | else | 450 | else |
451 | { | 451 | { |
452 | portLine->setText( SMTP_PORT ); | 452 | portLine->setText( SMTP_PORT ); |
453 | } | 453 | } |
454 | } | 454 | } |
455 | 455 | ||
456 | void SMTPconfig::fillValues() | 456 | void SMTPconfig::fillValues() |
457 | { | 457 | { |
458 | accountLine->setText( data->getAccountName() ); | 458 | accountLine->setText( data->getAccountName() ); |
459 | serverLine->setText( data->getServer() ); | 459 | serverLine->setText( data->getServer() ); |
460 | portLine->setText( data->getPort() ); | 460 | portLine->setText( data->getPort() ); |
461 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 461 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
462 | loginBox->setChecked( data->getLogin() ); | 462 | loginBox->setChecked( data->getLogin() ); |
463 | userLine->setText( data->getUser() ); | 463 | userLine->setText( data->getUser() ); |
464 | passLine->setText( data->getPassword() ); | 464 | passLine->setText( data->getPassword() ); |
465 | } | 465 | } |
466 | 466 | ||
467 | void SMTPconfig::accept() | 467 | void SMTPconfig::accept() |
468 | { | 468 | { |
469 | data->setAccountName( accountLine->text() ); | 469 | data->setAccountName( accountLine->text() ); |
470 | data->setServer( serverLine->text() ); | 470 | data->setServer( serverLine->text() ); |
471 | data->setPort( portLine->text() ); | 471 | data->setPort( portLine->text() ); |
472 | data->setConnectionType( ComboBox1->currentItem() ); | 472 | data->setConnectionType( ComboBox1->currentItem() ); |
473 | data->setLogin( loginBox->isChecked() ); | 473 | data->setLogin( loginBox->isChecked() ); |
474 | data->setUser( userLine->text() ); | 474 | data->setUser( userLine->text() ); |
475 | data->setPassword( passLine->text() ); | 475 | data->setPassword( passLine->text() ); |
476 | 476 | ||
477 | QDialog::accept(); | 477 | QDialog::accept(); |
478 | } | 478 | } |
479 | 479 | ||
480 | /** | 480 | /** |
481 | * NNTPconfig | 481 | * NNTPconfig |
482 | */ | 482 | */ |
483 | 483 | ||
484 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 484 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
485 | : NNTPconfigUI( parent, name, modal, flags ) | 485 | : NNTPconfigUI( parent, name, modal, flags ) |
486 | { | 486 | { |
487 | data = account; | 487 | data = account; |
488 | 488 | ||
489 | connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); | 489 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
490 | connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); | 490 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
491 | 491 | ||
492 | fillValues(); | 492 | fillValues(); |
493 | 493 | ||
494 | connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); | 494 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); |
495 | } | 495 | } |
496 | 496 | ||
497 | void NNTPconfig::slotSSL( bool enabled ) | 497 | void NNTPconfig::slotSSL( bool enabled ) |
498 | { | 498 | { |
499 | if ( enabled ) | 499 | if ( enabled ) |
500 | { | 500 | { |
501 | portLine->setText( NNTP_SSL_PORT ); | 501 | portLine->setText( NNTP_SSL_PORT ); |
502 | } | 502 | } |
503 | else | 503 | else |
504 | { | 504 | { |
505 | portLine->setText( NNTP_PORT ); | 505 | portLine->setText( NNTP_PORT ); |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | void NNTPconfig::fillValues() | 509 | void NNTPconfig::fillValues() |
510 | { | 510 | { |
511 | accountLine->setText( data->getAccountName() ); | 511 | accountLine->setText( data->getAccountName() ); |
512 | serverLine->setText( data->getServer() ); | 512 | serverLine->setText( data->getServer() ); |
513 | portLine->setText( data->getPort() ); | 513 | portLine->setText( data->getPort() ); |
514 | sslBox->setChecked( data->getSSL() ); | 514 | sslBox->setChecked( data->getSSL() ); |
515 | loginBox->setChecked( data->getLogin() ); | 515 | loginBox->setChecked( data->getLogin() ); |
516 | userLine->setText( data->getUser() ); | 516 | userLine->setText( data->getUser() ); |
517 | passLine->setText( data->getPassword() ); | 517 | passLine->setText( data->getPassword() ); |
518 | } | 518 | } |
519 | 519 | ||
520 | void NNTPconfig::accept() | 520 | void NNTPconfig::accept() |
521 | { | 521 | { |
522 | data->setAccountName( accountLine->text() ); | 522 | data->setAccountName( accountLine->text() ); |
523 | data->setServer( serverLine->text() ); | 523 | data->setServer( serverLine->text() ); |
524 | data->setPort( portLine->text() ); | 524 | data->setPort( portLine->text() ); |
525 | data->setSSL( sslBox->isChecked() ); | 525 | data->setSSL( sslBox->isChecked() ); |
526 | data->setLogin( loginBox->isChecked() ); | 526 | data->setLogin( loginBox->isChecked() ); |
527 | data->setUser( userLine->text() ); | 527 | data->setUser( userLine->text() ); |
528 | data->setPassword( passLine->text() ); | 528 | data->setPassword( passLine->text() ); |
529 | 529 | ||
530 | QDialog::accept(); | 530 | QDialog::accept(); |
531 | } | 531 | } |
532 | 532 | ||
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index dfc00d8..df7f773 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp | |||
@@ -229,196 +229,196 @@ encodedString* MHwrapper::fetchRawBody(const RecMail&mail) | |||
229 | if (r!=MAIL_NO_ERROR) { | 229 | if (r!=MAIL_NO_ERROR) { |
230 | qDebug("error selecting folder!"); | 230 | qDebug("error selecting folder!"); |
231 | return result; | 231 | return result; |
232 | } | 232 | } |
233 | r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg); | 233 | r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg); |
234 | if (r != MAIL_NO_ERROR) { | 234 | if (r != MAIL_NO_ERROR) { |
235 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); | 235 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); |
236 | return 0; | 236 | return 0; |
237 | } | 237 | } |
238 | r = mailmessage_fetch(msg,&data,&size); | 238 | r = mailmessage_fetch(msg,&data,&size); |
239 | if (r != MAIL_NO_ERROR) { | 239 | if (r != MAIL_NO_ERROR) { |
240 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); | 240 | Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); |
241 | if (msg) mailmessage_free(msg); | 241 | if (msg) mailmessage_free(msg); |
242 | return 0; | 242 | return 0; |
243 | } | 243 | } |
244 | result = new encodedString(data,size); | 244 | result = new encodedString(data,size); |
245 | if (msg) mailmessage_free(msg); | 245 | if (msg) mailmessage_free(msg); |
246 | return result; | 246 | return result; |
247 | } | 247 | } |
248 | 248 | ||
249 | void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) | 249 | void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) |
250 | { | 250 | { |
251 | QString f = buildPath(mailbox); | 251 | QString f = buildPath(mailbox); |
252 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 252 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
253 | if (r!=MAIL_NO_ERROR) { | 253 | if (r!=MAIL_NO_ERROR) { |
254 | qDebug("deleteMails: error selecting folder!"); | 254 | qDebug("deleteMails: error selecting folder!"); |
255 | return; | 255 | return; |
256 | } | 256 | } |
257 | RecMail*c = 0; | 257 | RecMail*c = 0; |
258 | for (unsigned int i=0; i < target.count();++i) { | 258 | for (unsigned int i=0; i < target.count();++i) { |
259 | c = target.at(i); | 259 | c = target.at(i); |
260 | r = mailsession_remove_message(m_storage->sto_session,c->getNumber()); | 260 | r = mailsession_remove_message(m_storage->sto_session,c->getNumber()); |
261 | if (r != MAIL_NO_ERROR) { | 261 | if (r != MAIL_NO_ERROR) { |
262 | qDebug("error deleting mail"); | 262 | qDebug("error deleting mail"); |
263 | break; | 263 | break; |
264 | } | 264 | } |
265 | } | 265 | } |
266 | } | 266 | } |
267 | 267 | ||
268 | int MHwrapper::deleteAllMail(const Folder*tfolder) | 268 | int MHwrapper::deleteAllMail(const Folder*tfolder) |
269 | { | 269 | { |
270 | init_storage(); | 270 | init_storage(); |
271 | if (!m_storage) { | 271 | if (!m_storage) { |
272 | return 0; | 272 | return 0; |
273 | } | 273 | } |
274 | int res = 1; | 274 | int res = 1; |
275 | if (!tfolder) return 0; | 275 | if (!tfolder) return 0; |
276 | int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); | 276 | int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); |
277 | if (r!=MAIL_NO_ERROR) { | 277 | if (r!=MAIL_NO_ERROR) { |
278 | qDebug("error selecting folder!"); | 278 | qDebug("error selecting folder!"); |
279 | return 0; | 279 | return 0; |
280 | } | 280 | } |
281 | mailmessage_list*l=0; | 281 | mailmessage_list*l=0; |
282 | r = mailsession_get_messages_list(m_storage->sto_session,&l); | 282 | r = mailsession_get_messages_list(m_storage->sto_session,&l); |
283 | if (r != MAIL_NO_ERROR) { | 283 | if (r != MAIL_NO_ERROR) { |
284 | qDebug("Error message list"); | 284 | qDebug("Error message list"); |
285 | res = 0; | 285 | res = 0; |
286 | } | 286 | } |
287 | unsigned j = 0; | 287 | unsigned j = 0; |
288 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { | 288 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { |
289 | mailmessage * msg; | 289 | mailmessage * msg; |
290 | msg = (mailmessage*)carray_get(l->msg_tab, i); | 290 | msg = (mailmessage*)carray_get(l->msg_tab, i); |
291 | j = msg->msg_index; | 291 | j = msg->msg_index; |
292 | r = mailsession_remove_message(m_storage->sto_session,j); | 292 | r = mailsession_remove_message(m_storage->sto_session,j); |
293 | if (r != MAIL_NO_ERROR) { | 293 | if (r != MAIL_NO_ERROR) { |
294 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | 294 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); |
295 | res = 0; | 295 | res = 0; |
296 | break; | 296 | break; |
297 | } | 297 | } |
298 | } | 298 | } |
299 | if (l) mailmessage_list_free(l); | 299 | if (l) mailmessage_list_free(l); |
300 | return res; | 300 | return res; |
301 | } | 301 | } |
302 | 302 | ||
303 | int MHwrapper::deleteMbox(const Folder*tfolder) | 303 | int MHwrapper::deleteMbox(const Folder*tfolder) |
304 | { | 304 | { |
305 | init_storage(); | 305 | init_storage(); |
306 | if (!m_storage) { | 306 | if (!m_storage) { |
307 | return 0; | 307 | return 0; |
308 | } | 308 | } |
309 | if (!tfolder) return 0; | 309 | if (!tfolder) return 0; |
310 | if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; | 310 | if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; |
311 | 311 | ||
312 | int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); | 312 | int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); |
313 | 313 | ||
314 | if (r != MAIL_NO_ERROR) { | 314 | if (r != MAIL_NO_ERROR) { |
315 | qDebug("error deleting mail box"); | 315 | qDebug("error deleting mail box"); |
316 | return 0; | 316 | return 0; |
317 | } | 317 | } |
318 | QString cmd = "rm -rf "+tfolder->getName(); | 318 | QString cmd = "rm -rf "+tfolder->getName(); |
319 | QStringList command; | 319 | QStringList command; |
320 | command << "/bin/sh"; | 320 | command << "/bin/sh"; |
321 | command << "-c"; | 321 | command << "-c"; |
322 | command << cmd.latin1(); | 322 | command << cmd.latin1(); |
323 | OProcess *process = new OProcess(); | 323 | OProcess *process = new OProcess(); |
324 | 324 | ||
325 | connect(process, SIGNAL(processExited(OProcess *)), | 325 | connect(process, SIGNAL(processExited(OProcess*)), |
326 | this, SLOT( processEnded(OProcess *))); | 326 | this, SLOT( processEnded(OProcess*))); |
327 | connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), | 327 | connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)), |
328 | this, SLOT( oprocessStderr(OProcess *, char *, int))); | 328 | this, SLOT( oprocessStderr(OProcess*,char*,int))); |
329 | 329 | ||
330 | *process << command; | 330 | *process << command; |
331 | removeMboxfailed = false; | 331 | removeMboxfailed = false; |
332 | if(!process->start(OProcess::Block, OProcess::All) ) { | 332 | if(!process->start(OProcess::Block, OProcess::All) ) { |
333 | qDebug("could not start process"); | 333 | qDebug("could not start process"); |
334 | return 0; | 334 | return 0; |
335 | } | 335 | } |
336 | qDebug("mail box deleted"); | 336 | qDebug("mail box deleted"); |
337 | return 1; | 337 | return 1; |
338 | } | 338 | } |
339 | 339 | ||
340 | void MHwrapper::processEnded(OProcess *p) | 340 | void MHwrapper::processEnded(OProcess *p) |
341 | { | 341 | { |
342 | if (p) delete p; | 342 | if (p) delete p; |
343 | } | 343 | } |
344 | 344 | ||
345 | void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) | 345 | void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) |
346 | { | 346 | { |
347 | QString lineStr = buffer; | 347 | QString lineStr = buffer; |
348 | QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); | 348 | QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); |
349 | removeMboxfailed = true; | 349 | removeMboxfailed = true; |
350 | } | 350 | } |
351 | 351 | ||
352 | void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | 352 | void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) |
353 | { | 353 | { |
354 | init_storage(); | 354 | init_storage(); |
355 | if (!m_storage) { | 355 | if (!m_storage) { |
356 | return; | 356 | return; |
357 | } | 357 | } |
358 | target_stat.message_count = 0; | 358 | target_stat.message_count = 0; |
359 | target_stat.message_unseen = 0; | 359 | target_stat.message_unseen = 0; |
360 | target_stat.message_recent = 0; | 360 | target_stat.message_recent = 0; |
361 | QString f = buildPath(mailbox); | 361 | QString f = buildPath(mailbox); |
362 | int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, | 362 | int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, |
363 | &target_stat.message_recent,&target_stat.message_unseen); | 363 | &target_stat.message_recent,&target_stat.message_unseen); |
364 | if (r != MAIL_NO_ERROR) { | 364 | if (r != MAIL_NO_ERROR) { |
365 | Global::statusMessage(tr("Error retrieving status")); | 365 | Global::statusMessage(tr("Error retrieving status")); |
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | const QString&MHwrapper::getType()const | 369 | const QString&MHwrapper::getType()const |
370 | { | 370 | { |
371 | return wrapperType; | 371 | return wrapperType; |
372 | } | 372 | } |
373 | 373 | ||
374 | const QString&MHwrapper::getName()const | 374 | const QString&MHwrapper::getName()const |
375 | { | 375 | { |
376 | return MHName; | 376 | return MHName; |
377 | } | 377 | } |
378 | void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 378 | void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
379 | { | 379 | { |
380 | init_storage(); | 380 | init_storage(); |
381 | if (!m_storage) { | 381 | if (!m_storage) { |
382 | return; | 382 | return; |
383 | } | 383 | } |
384 | if (targetWrapper != this) { | 384 | if (targetWrapper != this) { |
385 | qDebug("Using generic"); | 385 | qDebug("Using generic"); |
386 | Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); | 386 | Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); |
387 | return; | 387 | return; |
388 | } | 388 | } |
389 | qDebug("Using internal routines for move/copy"); | 389 | qDebug("Using internal routines for move/copy"); |
390 | QString tf = buildPath(targetFolder); | 390 | QString tf = buildPath(targetFolder); |
391 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); | 391 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); |
392 | if (r != MAIL_NO_ERROR) { | 392 | if (r != MAIL_NO_ERROR) { |
393 | qDebug("Error selecting source mailbox"); | 393 | qDebug("Error selecting source mailbox"); |
394 | return; | 394 | return; |
395 | } | 395 | } |
396 | if (moveit) { | 396 | if (moveit) { |
397 | r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); | 397 | r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); |
398 | } else { | 398 | } else { |
399 | r = mailsession_copy_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); | 399 | r = mailsession_copy_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); |
400 | } | 400 | } |
401 | if (r != MAIL_NO_ERROR) { | 401 | if (r != MAIL_NO_ERROR) { |
402 | qDebug("Error copy/moving mail internal (%i)",r); | 402 | qDebug("Error copy/moving mail internal (%i)",r); |
403 | } | 403 | } |
404 | } | 404 | } |
405 | 405 | ||
406 | void MHwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 406 | void MHwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
407 | { | 407 | { |
408 | init_storage(); | 408 | init_storage(); |
409 | if (!m_storage) { | 409 | if (!m_storage) { |
410 | return; | 410 | return; |
411 | } | 411 | } |
412 | if (targetWrapper != this) { | 412 | if (targetWrapper != this) { |
413 | qDebug("Using generic"); | 413 | qDebug("Using generic"); |
414 | Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); | 414 | Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); |
415 | return; | 415 | return; |
416 | } | 416 | } |
417 | if (!fromFolder) return; | 417 | if (!fromFolder) return; |
418 | int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); | 418 | int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); |
419 | if (r!=MAIL_NO_ERROR) { | 419 | if (r!=MAIL_NO_ERROR) { |
420 | qDebug("error selecting source folder!"); | 420 | qDebug("error selecting source folder!"); |
421 | return; | 421 | return; |
422 | } | 422 | } |
423 | QString tf = buildPath(targetFolder); | 423 | QString tf = buildPath(targetFolder); |
424 | mailmessage_list*l=0; | 424 | mailmessage_list*l=0; |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index a3c68ae..d75d52a 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -1,131 +1,131 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <sys/stat.h> | 2 | #include <sys/stat.h> |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <qdir.h> | 7 | #include <qdir.h> |
8 | #include <qt.h> | 8 | #include <qt.h> |
9 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
10 | 10 | ||
11 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
12 | #include <qpe/qcopenvelope_qws.h> | 12 | #include <qpe/qcopenvelope_qws.h> |
13 | 13 | ||
14 | #include <libetpan/libetpan.h> | 14 | #include <libetpan/libetpan.h> |
15 | 15 | ||
16 | #include "smtpwrapper.h" | 16 | #include "smtpwrapper.h" |
17 | #include "mailwrapper.h" | 17 | #include "mailwrapper.h" |
18 | #include "abstractmail.h" | 18 | #include "abstractmail.h" |
19 | #include "logindialog.h" | 19 | #include "logindialog.h" |
20 | #include "mailtypes.h" | 20 | #include "mailtypes.h" |
21 | #include "sendmailprogress.h" | 21 | #include "sendmailprogress.h" |
22 | 22 | ||
23 | const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; | 23 | const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; |
24 | 24 | ||
25 | progressMailSend*SMTPwrapper::sendProgress = 0; | 25 | progressMailSend*SMTPwrapper::sendProgress = 0; |
26 | 26 | ||
27 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) | 27 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) |
28 | : QObject() | 28 | : QObject() |
29 | { | 29 | { |
30 | m_SmtpAccount = aSmtp; | 30 | m_SmtpAccount = aSmtp; |
31 | Config cfg( "mail" ); | 31 | Config cfg( "mail" ); |
32 | cfg.setGroup( "Status" ); | 32 | cfg.setGroup( "Status" ); |
33 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); | 33 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); |
34 | emit queuedMails( m_queuedMail ); | 34 | emit queuedMails( m_queuedMail ); |
35 | connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); | 35 | connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); |
36 | m_smtp = 0; | 36 | m_smtp = 0; |
37 | } | 37 | } |
38 | 38 | ||
39 | SMTPwrapper::~SMTPwrapper() | 39 | SMTPwrapper::~SMTPwrapper() |
40 | { | 40 | { |
41 | disc_server(); | 41 | disc_server(); |
42 | } | 42 | } |
43 | 43 | ||
44 | void SMTPwrapper::emitQCop( int queued ) { | 44 | void SMTPwrapper::emitQCop( int queued ) { |
45 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); | 45 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); |
46 | env << queued; | 46 | env << queued; |
47 | } | 47 | } |
48 | 48 | ||
49 | QString SMTPwrapper::mailsmtpError( int errnum ) { | 49 | QString SMTPwrapper::mailsmtpError( int errnum ) { |
50 | switch ( errnum ) { | 50 | switch ( errnum ) { |
51 | case MAILSMTP_NO_ERROR: | 51 | case MAILSMTP_NO_ERROR: |
52 | return tr( "No error" ); | 52 | return tr( "No error" ); |
53 | case MAILSMTP_ERROR_UNEXPECTED_CODE: | 53 | case MAILSMTP_ERROR_UNEXPECTED_CODE: |
54 | return tr( "Unexpected error code" ); | 54 | return tr( "Unexpected error code" ); |
55 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: | 55 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: |
56 | return tr( "Service not available" ); | 56 | return tr( "Service not available" ); |
57 | case MAILSMTP_ERROR_STREAM: | 57 | case MAILSMTP_ERROR_STREAM: |
58 | return tr( "Stream error" ); | 58 | return tr( "Stream error" ); |
59 | case MAILSMTP_ERROR_HOSTNAME: | 59 | case MAILSMTP_ERROR_HOSTNAME: |
60 | return tr( "gethostname() failed" ); | 60 | return tr( "gethostname() failed" ); |
61 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: | 61 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: |
62 | return tr( "Not implemented" ); | 62 | return tr( "Not implemented" ); |
63 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: | 63 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: |
64 | return tr( "Error, action not taken" ); | 64 | return tr( "Error, action not taken" ); |
65 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: | 65 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: |
66 | return tr( "Data exceeds storage allocation" ); | 66 | return tr( "Data exceeds storage allocation" ); |
67 | case MAILSMTP_ERROR_IN_PROCESSING: | 67 | case MAILSMTP_ERROR_IN_PROCESSING: |
68 | return tr( "Error in processing" ); | 68 | return tr( "Error in processing" ); |
69 | case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: | 69 | case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: |
70 | return tr( "Starttls not supported" ); | 70 | return tr( "Starttls not supported" ); |
71 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: | 71 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: |
72 | // return tr( "Insufficient system storage" ); | 72 | // return tr( "Insufficient system storage" ); |
73 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: | 73 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: |
74 | return tr( "Mailbox unavailable" ); | 74 | return tr( "Mailbox unavailable" ); |
75 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: | 75 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: |
76 | return tr( "Mailbox name not allowed" ); | 76 | return tr( "Mailbox name not allowed" ); |
77 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: | 77 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: |
78 | return tr( "Bad command sequence" ); | 78 | return tr( "Bad command sequence" ); |
79 | case MAILSMTP_ERROR_USER_NOT_LOCAL: | 79 | case MAILSMTP_ERROR_USER_NOT_LOCAL: |
80 | return tr( "User not local" ); | 80 | return tr( "User not local" ); |
81 | case MAILSMTP_ERROR_TRANSACTION_FAILED: | 81 | case MAILSMTP_ERROR_TRANSACTION_FAILED: |
82 | return tr( "Transaction failed" ); | 82 | return tr( "Transaction failed" ); |
83 | case MAILSMTP_ERROR_MEMORY: | 83 | case MAILSMTP_ERROR_MEMORY: |
84 | return tr( "Memory error" ); | 84 | return tr( "Memory error" ); |
85 | case MAILSMTP_ERROR_CONNECTION_REFUSED: | 85 | case MAILSMTP_ERROR_CONNECTION_REFUSED: |
86 | return tr( "Connection refused" ); | 86 | return tr( "Connection refused" ); |
87 | default: | 87 | default: |
88 | return tr( "Unknown error code" ); | 88 | return tr( "Unknown error code" ); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) { | 92 | mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) { |
93 | return mailimf_mailbox_new( strdup( name.latin1() ), | 93 | return mailimf_mailbox_new( strdup( name.latin1() ), |
94 | strdup( mail.latin1() ) ); | 94 | strdup( mail.latin1() ) ); |
95 | } | 95 | } |
96 | 96 | ||
97 | mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) { | 97 | mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) { |
98 | mailimf_address_list *addresses; | 98 | mailimf_address_list *addresses; |
99 | 99 | ||
100 | if ( addr.isEmpty() ) | 100 | if ( addr.isEmpty() ) |
101 | return NULL; | 101 | return NULL; |
102 | 102 | ||
103 | addresses = mailimf_address_list_new_empty(); | 103 | addresses = mailimf_address_list_new_empty(); |
104 | 104 | ||
105 | bool literal_open = false; | 105 | bool literal_open = false; |
106 | unsigned int startpos = 0; | 106 | unsigned int startpos = 0; |
107 | QStringList list; | 107 | QStringList list; |
108 | QString s; | 108 | QString s; |
109 | unsigned int i = 0; | 109 | unsigned int i = 0; |
110 | for (; i < addr.length();++i) { | 110 | for (; i < addr.length();++i) { |
111 | switch (addr[i]) { | 111 | switch (addr[i]) { |
112 | case '\"': | 112 | case '\"': |
113 | literal_open = !literal_open; | 113 | literal_open = !literal_open; |
114 | break; | 114 | break; |
115 | case ',': | 115 | case ',': |
116 | if (!literal_open) { | 116 | if (!literal_open) { |
117 | s = addr.mid(startpos,i-startpos); | 117 | s = addr.mid(startpos,i-startpos); |
118 | if (!s.isEmpty()) { | 118 | if (!s.isEmpty()) { |
119 | list.append(s); | 119 | list.append(s); |
120 | qDebug("Appended %s",s.latin1()); | 120 | qDebug("Appended %s",s.latin1()); |
121 | } | 121 | } |
122 | // !!!! this is a MUST BE! | 122 | // !!!! this is a MUST BE! |
123 | startpos = ++i; | 123 | startpos = ++i; |
124 | } | 124 | } |
125 | break; | 125 | break; |
126 | default: | 126 | default: |
127 | break; | 127 | break; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | s = addr.mid(startpos,i-startpos); | 130 | s = addr.mid(startpos,i-startpos); |
131 | if (!s.isEmpty()) { | 131 | if (!s.isEmpty()) { |
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 2a1f90d..3f34fe7 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -1,217 +1,217 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qvbox.h> | 2 | #include <qvbox.h> |
3 | #include <qheader.h> | 3 | #include <qheader.h> |
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | 7 | ||
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | #include <qpe/resource.h> | 9 | #include <qpe/resource.h> |
10 | 10 | ||
11 | #include "defines.h" | 11 | #include "defines.h" |
12 | #include "mainwindow.h" | 12 | #include "mainwindow.h" |
13 | 13 | ||
14 | 14 | ||
15 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 15 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
16 | : QMainWindow( parent, name, flags ) | 16 | : QMainWindow( parent, name, flags ) |
17 | { | 17 | { |
18 | 18 | ||
19 | setCaption( tr( "Mail" ) ); | 19 | setCaption( tr( "Mail" ) ); |
20 | setToolBarsMovable( false ); | 20 | setToolBarsMovable( false ); |
21 | 21 | ||
22 | toolBar = new QToolBar( this ); | 22 | toolBar = new QToolBar( this ); |
23 | menuBar = new QMenuBar( toolBar ); | 23 | menuBar = new QMenuBar( toolBar ); |
24 | mailMenu = new QPopupMenu( menuBar ); | 24 | mailMenu = new QPopupMenu( menuBar ); |
25 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 25 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
26 | settingsMenu = new QPopupMenu( menuBar ); | 26 | settingsMenu = new QPopupMenu( menuBar ); |
27 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 27 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
28 | 28 | ||
29 | addToolBar( toolBar ); | 29 | addToolBar( toolBar ); |
30 | toolBar->setHorizontalStretchable( true ); | 30 | toolBar->setHorizontalStretchable( true ); |
31 | 31 | ||
32 | QLabel *spacer = new QLabel( toolBar ); | 32 | QLabel *spacer = new QLabel( toolBar ); |
33 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 33 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
34 | toolBar->setStretchableWidget( spacer ); | 34 | toolBar->setStretchableWidget( spacer ); |
35 | 35 | ||
36 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, | 36 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, |
37 | 0, 0, this ); | 37 | 0, 0, this ); |
38 | composeMail->addTo( toolBar ); | 38 | composeMail->addTo( toolBar ); |
39 | composeMail->addTo( mailMenu ); | 39 | composeMail->addTo( mailMenu ); |
40 | 40 | ||
41 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, | 41 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, |
42 | 0, 0, this ); | 42 | 0, 0, this ); |
43 | sendQueued->addTo( toolBar ); | 43 | sendQueued->addTo( toolBar ); |
44 | sendQueued->addTo( mailMenu ); | 44 | sendQueued->addTo( mailMenu ); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 47 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
48 | 0, 0, this ); | 48 | 0, 0, this ); |
49 | syncFolders->addTo( toolBar ); | 49 | syncFolders->addTo( toolBar ); |
50 | syncFolders->addTo( mailMenu ); | 50 | syncFolders->addTo( mailMenu ); |
51 | */ | 51 | */ |
52 | 52 | ||
53 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, | 53 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, |
54 | 0, 0, this, 0, true ); | 54 | 0, 0, this, 0, true ); |
55 | showFolders->addTo( toolBar ); | 55 | showFolders->addTo( toolBar ); |
56 | showFolders->addTo( mailMenu ); | 56 | showFolders->addTo( mailMenu ); |
57 | showFolders->setOn( true ); | 57 | showFolders->setOn( true ); |
58 | connect(showFolders, SIGNAL( toggled( bool ) ), | 58 | connect(showFolders, SIGNAL( toggled(bool) ), |
59 | SLOT( slotShowFolders( bool ) ) ); | 59 | SLOT( slotShowFolders(bool) ) ); |
60 | 60 | ||
61 | /* | 61 | /* |
62 | searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), | 62 | searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), |
63 | 0, 0, this ); | 63 | 0, 0, this ); |
64 | searchMails->addTo( toolBar ); | 64 | searchMails->addTo( toolBar ); |
65 | searchMails->addTo( mailMenu ); | 65 | searchMails->addTo( mailMenu ); |
66 | */ | 66 | */ |
67 | 67 | ||
68 | deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); | 68 | deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); |
69 | deleteMails->addTo( toolBar ); | 69 | deleteMails->addTo( toolBar ); |
70 | deleteMails->addTo( mailMenu ); | 70 | deleteMails->addTo( mailMenu ); |
71 | connect( deleteMails, SIGNAL( activated() ), | 71 | connect( deleteMails, SIGNAL( activated() ), |
72 | SLOT( slotDeleteMail() ) ); | 72 | SLOT( slotDeleteMail() ) ); |
73 | 73 | ||
74 | editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , | 74 | editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , |
75 | 0, 0, this ); | 75 | 0, 0, this ); |
76 | editSettings->addTo( settingsMenu ); | 76 | editSettings->addTo( settingsMenu ); |
77 | connect( editSettings, SIGNAL( activated() ), | 77 | connect( editSettings, SIGNAL( activated() ), |
78 | SLOT( slotEditSettings() ) ); | 78 | SLOT( slotEditSettings() ) ); |
79 | editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , | 79 | editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , |
80 | 0, 0, this ); | 80 | 0, 0, this ); |
81 | editAccounts->addTo( settingsMenu ); | 81 | editAccounts->addTo( settingsMenu ); |
82 | 82 | ||
83 | //setCentralWidget( view ); | 83 | //setCentralWidget( view ); |
84 | 84 | ||
85 | QVBox* wrapperBox = new QVBox( this ); | 85 | QVBox* wrapperBox = new QVBox( this ); |
86 | setCentralWidget( wrapperBox ); | 86 | setCentralWidget( wrapperBox ); |
87 | 87 | ||
88 | QWidget *view = new QWidget( wrapperBox ); | 88 | QWidget *view = new QWidget( wrapperBox ); |
89 | 89 | ||
90 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); | 90 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); |
91 | 91 | ||
92 | folderView = new AccountView( view ); | 92 | folderView = new AccountView( view ); |
93 | folderView->header()->hide(); | 93 | folderView->header()->hide(); |
94 | folderView->setRootIsDecorated( true ); | 94 | folderView->setRootIsDecorated( true ); |
95 | folderView->addColumn( tr( "Mailbox" ) ); | 95 | folderView->addColumn( tr( "Mailbox" ) ); |
96 | 96 | ||
97 | layout->addWidget( folderView ); | 97 | layout->addWidget( folderView ); |
98 | 98 | ||
99 | mailView = new QListView( view ); | 99 | mailView = new QListView( view ); |
100 | mailView->addColumn( tr( "" ) ); | 100 | mailView->addColumn( tr( "" ) ); |
101 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 101 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
102 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 102 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
103 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 103 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
104 | mailView->addColumn( tr( "Date" )); | 104 | mailView->addColumn( tr( "Date" )); |
105 | mailView->setAllColumnsShowFocus(true); | 105 | mailView->setAllColumnsShowFocus(true); |
106 | mailView->setSorting(-1); | 106 | mailView->setSorting(-1); |
107 | 107 | ||
108 | statusWidget = new StatusWidget( wrapperBox ); | 108 | statusWidget = new StatusWidget( wrapperBox ); |
109 | statusWidget->hide(); | 109 | statusWidget->hide(); |
110 | 110 | ||
111 | layout->addWidget( mailView ); | 111 | layout->addWidget( mailView ); |
112 | layout->setStretchFactor( folderView, 1 ); | 112 | layout->setStretchFactor( folderView, 1 ); |
113 | layout->setStretchFactor( mailView, 2 ); | 113 | layout->setStretchFactor( mailView, 2 ); |
114 | 114 | ||
115 | slotAdjustLayout(); | 115 | slotAdjustLayout(); |
116 | 116 | ||
117 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 117 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
118 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 118 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
119 | 119 | ||
120 | connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, | 120 | connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, |
121 | SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); | 121 | SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) ); |
122 | connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, | 122 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
123 | SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); | 123 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
124 | connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); | 124 | connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); |
125 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 125 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
126 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 126 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
127 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 127 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
128 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 128 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
129 | // Added by Stefan Eilers to allow starting by addressbook.. | 129 | // Added by Stefan Eilers to allow starting by addressbook.. |
130 | // copied from old mail2 | 130 | // copied from old mail2 |
131 | #if !defined(QT_NO_COP) | 131 | #if !defined(QT_NO_COP) |
132 | connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), | 132 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), |
133 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); | 133 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
134 | #endif | 134 | #endif |
135 | 135 | ||
136 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 136 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
137 | } | 137 | } |
138 | 138 | ||
139 | MainWindow::~MainWindow() | 139 | MainWindow::~MainWindow() |
140 | { | 140 | { |
141 | } | 141 | } |
142 | 142 | ||
143 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 143 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
144 | { | 144 | { |
145 | qDebug("appMessage not reached"); | 145 | qDebug("appMessage not reached"); |
146 | } | 146 | } |
147 | 147 | ||
148 | void MainWindow::slotAdjustLayout() { | 148 | void MainWindow::slotAdjustLayout() { |
149 | 149 | ||
150 | QWidget *d = QApplication::desktop(); | 150 | QWidget *d = QApplication::desktop(); |
151 | 151 | ||
152 | if ( d->width() < d->height() ) { | 152 | if ( d->width() < d->height() ) { |
153 | layout->setDirection( QBoxLayout::TopToBottom ); | 153 | layout->setDirection( QBoxLayout::TopToBottom ); |
154 | } else { | 154 | } else { |
155 | layout->setDirection( QBoxLayout::LeftToRight ); | 155 | layout->setDirection( QBoxLayout::LeftToRight ); |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | void MainWindow::slotAdjustColumns() | 159 | void MainWindow::slotAdjustColumns() |
160 | { | 160 | { |
161 | bool hidden = folderView->isHidden(); | 161 | bool hidden = folderView->isHidden(); |
162 | if ( hidden ) folderView->show(); | 162 | if ( hidden ) folderView->show(); |
163 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 163 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
164 | if ( hidden ) folderView->hide(); | 164 | if ( hidden ) folderView->hide(); |
165 | 165 | ||
166 | mailView->setColumnWidth( 0, 10 ); | 166 | mailView->setColumnWidth( 0, 10 ); |
167 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); | 167 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); |
168 | mailView->setColumnWidth( 2, 80 ); | 168 | mailView->setColumnWidth( 2, 80 ); |
169 | mailView->setColumnWidth( 3, 50 ); | 169 | mailView->setColumnWidth( 3, 50 ); |
170 | mailView->setColumnWidth( 4, 50 ); | 170 | mailView->setColumnWidth( 4, 50 ); |
171 | } | 171 | } |
172 | 172 | ||
173 | void MainWindow::slotEditSettings() | 173 | void MainWindow::slotEditSettings() |
174 | { | 174 | { |
175 | } | 175 | } |
176 | 176 | ||
177 | void MainWindow::slotShowFolders( bool ) | 177 | void MainWindow::slotShowFolders( bool ) |
178 | { | 178 | { |
179 | qDebug( "slotShowFolders not reached" ); | 179 | qDebug( "slotShowFolders not reached" ); |
180 | } | 180 | } |
181 | 181 | ||
182 | void MainWindow::refreshMailView(QList<RecMail>*) | 182 | void MainWindow::refreshMailView(QList<RecMail>*) |
183 | { | 183 | { |
184 | qDebug( "refreshMailView not reached" ); | 184 | qDebug( "refreshMailView not reached" ); |
185 | } | 185 | } |
186 | 186 | ||
187 | void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) | 187 | void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) |
188 | { | 188 | { |
189 | qDebug( "mailLeftClicked not reached" ); | 189 | qDebug( "mailLeftClicked not reached" ); |
190 | } | 190 | } |
191 | 191 | ||
192 | void MainWindow::displayMail() | 192 | void MainWindow::displayMail() |
193 | { | 193 | { |
194 | qDebug("displayMail not reached"); | 194 | qDebug("displayMail not reached"); |
195 | } | 195 | } |
196 | 196 | ||
197 | void MainWindow::slotDeleteMail() | 197 | void MainWindow::slotDeleteMail() |
198 | { | 198 | { |
199 | qDebug("deleteMail not reached"); | 199 | qDebug("deleteMail not reached"); |
200 | } | 200 | } |
201 | 201 | ||
202 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) | 202 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) |
203 | { | 203 | { |
204 | qDebug("mailHold not reached"); | 204 | qDebug("mailHold not reached"); |
205 | } | 205 | } |
206 | 206 | ||
207 | void MainWindow::slotSendQueued() | 207 | void MainWindow::slotSendQueued() |
208 | { | 208 | { |
209 | } | 209 | } |
210 | 210 | ||
211 | void MainWindow::slotEditAccounts() | 211 | void MainWindow::slotEditAccounts() |
212 | { | 212 | { |
213 | } | 213 | } |
214 | 214 | ||
215 | void MainWindow::slotComposeMail() | 215 | void MainWindow::slotComposeMail() |
216 | { | 216 | { |
217 | } | 217 | } |
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index f015228..8636957 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -192,197 +192,197 @@ void ViewMail::slotShowHtml( bool state ) | |||
192 | { | 192 | { |
193 | m_showHtml = state; | 193 | m_showHtml = state; |
194 | setText(); | 194 | setText(); |
195 | } | 195 | } |
196 | 196 | ||
197 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) | 197 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) |
198 | { | 198 | { |
199 | if (!item ) | 199 | if (!item ) |
200 | return; | 200 | return; |
201 | 201 | ||
202 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 202 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
203 | { | 203 | { |
204 | setText(); | 204 | setText(); |
205 | return; | 205 | return; |
206 | } | 206 | } |
207 | QPopupMenu *menu = new QPopupMenu(); | 207 | QPopupMenu *menu = new QPopupMenu(); |
208 | int ret=0; | 208 | int ret=0; |
209 | 209 | ||
210 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) | 210 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) |
211 | { | 211 | { |
212 | menu->insertItem( tr( "Show Text" ), 1 ); | 212 | menu->insertItem( tr( "Show Text" ), 1 ); |
213 | } | 213 | } |
214 | menu->insertItem( tr( "Save Attachment" ), 0 ); | 214 | menu->insertItem( tr( "Save Attachment" ), 0 ); |
215 | menu->insertSeparator(1); | 215 | menu->insertSeparator(1); |
216 | 216 | ||
217 | ret = menu->exec( point, 0 ); | 217 | ret = menu->exec( point, 0 ); |
218 | 218 | ||
219 | switch(ret) | 219 | switch(ret) |
220 | { | 220 | { |
221 | case 0: | 221 | case 0: |
222 | { | 222 | { |
223 | MimeTypes types; | 223 | MimeTypes types; |
224 | types.insert( "all", "*" ); | 224 | types.insert( "all", "*" ); |
225 | QString str = Opie::OFileDialog::getSaveFileName( 1, | 225 | QString str = Opie::OFileDialog::getSaveFileName( 1, |
226 | "/", item->text( 2 ) , types, 0 ); | 226 | "/", item->text( 2 ) , types, 0 ); |
227 | 227 | ||
228 | if( !str.isEmpty() ) | 228 | if( !str.isEmpty() ) |
229 | { | 229 | { |
230 | encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 230 | encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
231 | if (content) | 231 | if (content) |
232 | { | 232 | { |
233 | QFile output(str); | 233 | QFile output(str); |
234 | output.open(IO_WriteOnly); | 234 | output.open(IO_WriteOnly); |
235 | output.writeBlock(content->Content(),content->Length()); | 235 | output.writeBlock(content->Content(),content->Length()); |
236 | output.close(); | 236 | output.close(); |
237 | delete content; | 237 | delete content; |
238 | } | 238 | } |
239 | } | 239 | } |
240 | } | 240 | } |
241 | break ; | 241 | break ; |
242 | 242 | ||
243 | case 1: | 243 | case 1: |
244 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 244 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
245 | { | 245 | { |
246 | setText(); | 246 | setText(); |
247 | } | 247 | } |
248 | else | 248 | else |
249 | { | 249 | { |
250 | if ( m_recMail.Wrapper() != 0l ) | 250 | if ( m_recMail.Wrapper() != 0l ) |
251 | { // make sure that there is a wrapper , even after delete or simular actions | 251 | { // make sure that there is a wrapper , even after delete or simular actions |
252 | browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 252 | browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
253 | } | 253 | } |
254 | } | 254 | } |
255 | break; | 255 | break; |
256 | } | 256 | } |
257 | delete menu; | 257 | delete menu; |
258 | } | 258 | } |
259 | 259 | ||
260 | 260 | ||
261 | void ViewMail::setMail( RecMail mail ) | 261 | void ViewMail::setMail( RecMail mail ) |
262 | { | 262 | { |
263 | 263 | ||
264 | m_recMail = mail; | 264 | m_recMail = mail; |
265 | 265 | ||
266 | m_mail[0] = mail.getFrom(); | 266 | m_mail[0] = mail.getFrom(); |
267 | m_mail[1] = mail.getSubject(); | 267 | m_mail[1] = mail.getSubject(); |
268 | m_mail[3] = mail.getDate(); | 268 | m_mail[3] = mail.getDate(); |
269 | m_mail[4] = mail.Msgid(); | 269 | m_mail[4] = mail.Msgid(); |
270 | 270 | ||
271 | m_mail2[0] = mail.To(); | 271 | m_mail2[0] = mail.To(); |
272 | m_mail2[1] = mail.CC(); | 272 | m_mail2[1] = mail.CC(); |
273 | m_mail2[2] = mail.Bcc(); | 273 | m_mail2[2] = mail.Bcc(); |
274 | 274 | ||
275 | setText(); | 275 | setText(); |
276 | } | 276 | } |
277 | 277 | ||
278 | 278 | ||
279 | 279 | ||
280 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 280 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
281 | : ViewMailBase(parent, name, fl), _inLoop(false) | 281 | : ViewMailBase(parent, name, fl), _inLoop(false) |
282 | { | 282 | { |
283 | m_gotBody = false; | 283 | m_gotBody = false; |
284 | deleted = false; | 284 | deleted = false; |
285 | 285 | ||
286 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); | 286 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); |
287 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); | 287 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); |
288 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) ); | 288 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); |
289 | connect( showHtml, SIGNAL( toggled( bool ) ), SLOT( slotShowHtml( bool ) ) ); | 289 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); |
290 | 290 | ||
291 | attachments->setEnabled(m_gotBody); | 291 | attachments->setEnabled(m_gotBody); |
292 | connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); | 292 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); |
293 | 293 | ||
294 | readConfig(); | 294 | readConfig(); |
295 | attachments->setSorting(-1); | 295 | attachments->setSorting(-1); |
296 | } | 296 | } |
297 | 297 | ||
298 | void ViewMail::readConfig() | 298 | void ViewMail::readConfig() |
299 | { | 299 | { |
300 | Config cfg( "mail" ); | 300 | Config cfg( "mail" ); |
301 | cfg.setGroup( "Settings" ); | 301 | cfg.setGroup( "Settings" ); |
302 | m_showHtml = cfg.readBoolEntry( "showHtml", false ); | 302 | m_showHtml = cfg.readBoolEntry( "showHtml", false ); |
303 | showHtml->setOn( m_showHtml ); | 303 | showHtml->setOn( m_showHtml ); |
304 | } | 304 | } |
305 | 305 | ||
306 | void ViewMail::setText() | 306 | void ViewMail::setText() |
307 | { | 307 | { |
308 | 308 | ||
309 | QString toString; | 309 | QString toString; |
310 | QString ccString; | 310 | QString ccString; |
311 | QString bccString; | 311 | QString bccString; |
312 | 312 | ||
313 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) | 313 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) |
314 | { | 314 | { |
315 | toString += (*it); | 315 | toString += (*it); |
316 | } | 316 | } |
317 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) | 317 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) |
318 | { | 318 | { |
319 | ccString += (*it); | 319 | ccString += (*it); |
320 | } | 320 | } |
321 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) | 321 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) |
322 | { | 322 | { |
323 | bccString += (*it); | 323 | bccString += (*it); |
324 | } | 324 | } |
325 | 325 | ||
326 | setCaption( caption().arg( m_mail[0] ) ); | 326 | setCaption( caption().arg( m_mail[0] ) ); |
327 | 327 | ||
328 | m_mailHtml = "<html><body>" | 328 | m_mailHtml = "<html><body>" |
329 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" | 329 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" |
330 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" | 330 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" |
331 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" | 331 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" |
332 | "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" | 332 | "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" |
333 | "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + | 333 | "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + |
334 | tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" | 334 | tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" |
335 | "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + | 335 | "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + |
336 | "</td></tr></table><font face=fixed>"; | 336 | "</td></tr></table><font face=fixed>"; |
337 | 337 | ||
338 | if ( !m_showHtml ) | 338 | if ( !m_showHtml ) |
339 | { | 339 | { |
340 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); | 340 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); |
341 | } | 341 | } |
342 | else | 342 | else |
343 | { | 343 | { |
344 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); | 344 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); |
345 | } | 345 | } |
346 | // remove later in favor of a real handling | 346 | // remove later in favor of a real handling |
347 | m_gotBody = true; | 347 | m_gotBody = true; |
348 | } | 348 | } |
349 | 349 | ||
350 | 350 | ||
351 | ViewMail::~ViewMail() | 351 | ViewMail::~ViewMail() |
352 | { | 352 | { |
353 | m_recMail.Wrapper()->cleanMimeCache(); | 353 | m_recMail.Wrapper()->cleanMimeCache(); |
354 | hide(); | 354 | hide(); |
355 | } | 355 | } |
356 | 356 | ||
357 | void ViewMail::hide() | 357 | void ViewMail::hide() |
358 | { | 358 | { |
359 | QWidget::hide(); | 359 | QWidget::hide(); |
360 | 360 | ||
361 | if (_inLoop) | 361 | if (_inLoop) |
362 | { | 362 | { |
363 | _inLoop = false; | 363 | _inLoop = false; |
364 | qApp->exit_loop(); | 364 | qApp->exit_loop(); |
365 | 365 | ||
366 | } | 366 | } |
367 | 367 | ||
368 | } | 368 | } |
369 | 369 | ||
370 | void ViewMail::exec() | 370 | void ViewMail::exec() |
371 | { | 371 | { |
372 | show(); | 372 | show(); |
373 | 373 | ||
374 | if (!_inLoop) | 374 | if (!_inLoop) |
375 | { | 375 | { |
376 | _inLoop = true; | 376 | _inLoop = true; |
377 | qApp->enter_loop(); | 377 | qApp->enter_loop(); |
378 | } | 378 | } |
379 | 379 | ||
380 | } | 380 | } |
381 | 381 | ||
382 | QString ViewMail::deHtml(const QString &string) | 382 | QString ViewMail::deHtml(const QString &string) |
383 | { | 383 | { |
384 | QString string_ = string; | 384 | QString string_ = string; |
385 | string_.replace(QRegExp("&"), "&"); | 385 | string_.replace(QRegExp("&"), "&"); |
386 | string_.replace(QRegExp("<"), "<"); | 386 | string_.replace(QRegExp("<"), "<"); |
387 | string_.replace(QRegExp(">"), ">"); | 387 | string_.replace(QRegExp(">"), ">"); |
388 | string_.replace(QRegExp("\\n"), "<br>"); | 388 | string_.replace(QRegExp("\\n"), "<br>"); |
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 4064549..4c39569 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -83,333 +83,333 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) | |||
83 | QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); | 83 | QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); |
84 | matrix.scale( .4, .4); | 84 | matrix.scale( .4, .4); |
85 | unknownXpm = pix.xForm(matrix); | 85 | unknownXpm = pix.xForm(matrix); |
86 | 86 | ||
87 | connectionMenu = new QPopupMenu( this ); | 87 | connectionMenu = new QPopupMenu( this ); |
88 | localMenu = new QPopupMenu( this ); | 88 | localMenu = new QPopupMenu( this ); |
89 | remoteMenu = new QPopupMenu( this ); | 89 | remoteMenu = new QPopupMenu( this ); |
90 | tabMenu = new QPopupMenu( this ); | 90 | tabMenu = new QPopupMenu( this ); |
91 | 91 | ||
92 | //#if 0 | 92 | //#if 0 |
93 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); | 93 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); |
94 | //#endif | 94 | //#endif |
95 | 95 | ||
96 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 96 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
97 | // menuBar->insertItem( tr( "Local" ), localMenu); | 97 | // menuBar->insertItem( tr( "Local" ), localMenu); |
98 | // menuBar->insertItem( tr( "Remote" ), remoteMenu); | 98 | // menuBar->insertItem( tr( "Remote" ), remoteMenu); |
99 | menuBar->insertItem( tr( "View" ), tabMenu); | 99 | menuBar->insertItem( tr( "View" ), tabMenu); |
100 | 100 | ||
101 | tabMenu->insertItem( tr( "Local" ), localMenu); | 101 | tabMenu->insertItem( tr( "Local" ), localMenu); |
102 | tabMenu->insertItem( tr( "Remote" ), remoteMenu); | 102 | tabMenu->insertItem( tr( "Remote" ), remoteMenu); |
103 | 103 | ||
104 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 104 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
105 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 105 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
106 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 106 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
107 | 107 | ||
108 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 108 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
109 | localMenu->insertSeparator(); | 109 | localMenu->insertSeparator(); |
110 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 110 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
111 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 111 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
112 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 112 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
113 | localMenu->insertSeparator(); | 113 | localMenu->insertSeparator(); |
114 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 114 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
115 | localMenu->setCheckable(TRUE); | 115 | localMenu->setCheckable(TRUE); |
116 | 116 | ||
117 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 117 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
118 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 118 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
119 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 119 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
120 | remoteMenu->insertSeparator(); | 120 | remoteMenu->insertSeparator(); |
121 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 121 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
122 | 122 | ||
123 | tabMenu->insertSeparator(); | 123 | tabMenu->insertSeparator(); |
124 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 124 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
125 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 125 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
126 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 126 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
127 | tabMenu->insertSeparator(); | 127 | tabMenu->insertSeparator(); |
128 | // tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 128 | // tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
129 | tabMenu->setCheckable(TRUE); | 129 | tabMenu->setCheckable(TRUE); |
130 | 130 | ||
131 | 131 | ||
132 | cdUpButton = new QToolButton( view,"cdUpButton"); | 132 | cdUpButton = new QToolButton( view,"cdUpButton"); |
133 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 133 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
134 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 134 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
135 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 135 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
136 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); | 136 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); |
137 | cdUpButton->hide(); | 137 | cdUpButton->hide(); |
138 | 138 | ||
139 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton"); | 139 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton"); |
140 | // docButton->setFixedSize( QSize( 20, 20 ) ); | 140 | // docButton->setFixedSize( QSize( 20, 20 ) ); |
141 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 141 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
142 | // docButton->setFlat(TRUE); | 142 | // docButton->setFlat(TRUE); |
143 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); | 143 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); |
144 | 144 | ||
145 | homeButton = new QToolButton(view,"homeButton"); | 145 | homeButton = new QToolButton(view,"homeButton"); |
146 | homeButton->setPixmap( Resource::loadPixmap("home")); | 146 | homeButton->setPixmap( Resource::loadPixmap("home")); |
147 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 147 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
148 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 148 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
149 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); | 149 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); |
150 | homeButton->hide(); | 150 | homeButton->hide(); |
151 | 151 | ||
152 | TabWidget = new QTabWidget( view, "TabWidget" ); | 152 | TabWidget = new QTabWidget( view, "TabWidget" ); |
153 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); | 153 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); |
154 | 154 | ||
155 | // TabWidget->setTabShape(QTabWidget::Triangular); | 155 | // TabWidget->setTabShape(QTabWidget::Triangular); |
156 | 156 | ||
157 | tab = new QWidget( TabWidget, "tab" ); | 157 | tab = new QWidget( TabWidget, "tab" ); |
158 | tabLayout = new QGridLayout( tab ); | 158 | tabLayout = new QGridLayout( tab ); |
159 | tabLayout->setSpacing( 2); | 159 | tabLayout->setSpacing( 2); |
160 | tabLayout->setMargin( 2); | 160 | tabLayout->setMargin( 2); |
161 | 161 | ||
162 | Local_View = new QListView( tab, "Local_View" ); | 162 | Local_View = new QListView( tab, "Local_View" ); |
163 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 163 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
164 | Local_View->addColumn( tr("File"),150); | 164 | Local_View->addColumn( tr("File"),150); |
165 | Local_View->addColumn( tr("Date"),-1); | 165 | Local_View->addColumn( tr("Date"),-1); |
166 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 166 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
167 | Local_View->addColumn( tr("Size"),-1); | 167 | Local_View->addColumn( tr("Size"),-1); |
168 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 168 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
169 | Local_View->setAllColumnsShowFocus(TRUE); | 169 | Local_View->setAllColumnsShowFocus(TRUE); |
170 | 170 | ||
171 | Local_View->setMultiSelection( TRUE); | 171 | Local_View->setMultiSelection( TRUE); |
172 | Local_View->setSelectionMode(QListView::Extended); | 172 | Local_View->setSelectionMode(QListView::Extended); |
173 | Local_View->setFocusPolicy(QWidget::ClickFocus); | 173 | Local_View->setFocusPolicy(QWidget::ClickFocus); |
174 | 174 | ||
175 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 175 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
176 | 176 | ||
177 | tabLayout->addWidget( Local_View, 0, 0 ); | 177 | tabLayout->addWidget( Local_View, 0, 0 ); |
178 | 178 | ||
179 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 179 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), |
180 | this,SLOT( localListClicked(QListViewItem *)) ); | 180 | this,SLOT( localListClicked(QListViewItem*)) ); |
181 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 181 | // connect( Local_View, SIGNAL( doubleClicked(QListViewItem*)), |
182 | // this,SLOT( localListClicked(QListViewItem *)) ); | 182 | // this,SLOT( localListClicked(QListViewItem*)) ); |
183 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 183 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
184 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 184 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
185 | 185 | ||
186 | TabWidget->insertTab( tab, tr( "Local" ) ); | 186 | TabWidget->insertTab( tab, tr( "Local" ) ); |
187 | 187 | ||
188 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 188 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
189 | tabLayout_2 = new QGridLayout( tab_2 ); | 189 | tabLayout_2 = new QGridLayout( tab_2 ); |
190 | tabLayout_2->setSpacing( 2); | 190 | tabLayout_2->setSpacing( 2); |
191 | tabLayout_2->setMargin( 2); | 191 | tabLayout_2->setMargin( 2); |
192 | 192 | ||
193 | Remote_View = new QListView( tab_2, "Remote_View" ); | 193 | Remote_View = new QListView( tab_2, "Remote_View" ); |
194 | Remote_View->addColumn( tr("File"),150); | 194 | Remote_View->addColumn( tr("File"),150); |
195 | Remote_View->addColumn( tr("Date"),-1); | 195 | Remote_View->addColumn( tr("Date"),-1); |
196 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); | 196 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); |
197 | Remote_View->addColumn( tr("Size"),-1); | 197 | Remote_View->addColumn( tr("Size"),-1); |
198 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 198 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
199 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); | 199 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); |
200 | Remote_View->addColumn( tr("Dir"),-1); | 200 | Remote_View->addColumn( tr("Dir"),-1); |
201 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 201 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
202 | Remote_View->setAllColumnsShowFocus(TRUE); | 202 | Remote_View->setAllColumnsShowFocus(TRUE); |
203 | 203 | ||
204 | Remote_View->setMultiSelection( FALSE); | 204 | Remote_View->setMultiSelection( FALSE); |
205 | Remote_View->setSelectionMode(QListView::Extended); | 205 | Remote_View->setSelectionMode(QListView::Extended); |
206 | Remote_View->setFocusPolicy(QWidget::ClickFocus); | 206 | Remote_View->setFocusPolicy(QWidget::ClickFocus); |
207 | 207 | ||
208 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 208 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
209 | 209 | ||
210 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 210 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), |
211 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 211 | this,SLOT( remoteListClicked(QListViewItem*)) ); |
212 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 212 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
213 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 213 | this,SLOT( RemoteListPressed(int,QListViewItem*,const QPoint&,int)) ); |
214 | 214 | ||
215 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 215 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
216 | 216 | ||
217 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 217 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
218 | 218 | ||
219 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 219 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
220 | tabLayout_3 = new QGridLayout( tab_3 ); | 220 | tabLayout_3 = new QGridLayout( tab_3 ); |
221 | tabLayout_3->setSpacing( 2); | 221 | tabLayout_3->setSpacing( 2); |
222 | tabLayout_3->setMargin( 2); | 222 | tabLayout_3->setMargin( 2); |
223 | 223 | ||
224 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 224 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
225 | TextLabel1->setText( tr( "Username" ) ); | 225 | TextLabel1->setText( tr( "Username" ) ); |
226 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 226 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
227 | 227 | ||
228 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 228 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
229 | UsernameComboBox->setEditable(TRUE); | 229 | UsernameComboBox->setEditable(TRUE); |
230 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 230 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
231 | 231 | ||
232 | connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this, | 232 | connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this, |
233 | SLOT( UsernameComboBoxEdited(const QString & ) )); | 233 | SLOT( UsernameComboBoxEdited(const QString&) )); |
234 | 234 | ||
235 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 235 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
236 | TextLabel2->setText( tr( "Password" ) ); | 236 | TextLabel2->setText( tr( "Password" ) ); |
237 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 237 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
238 | 238 | ||
239 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 239 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
240 | PasswordEdit->setEchoMode(QLineEdit::Password); | 240 | PasswordEdit->setEchoMode(QLineEdit::Password); |
241 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 241 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
242 | 242 | ||
243 | connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this, | 243 | connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this, |
244 | SLOT( PasswordEditEdited(const QString & ) )); | 244 | SLOT( PasswordEditEdited(const QString&) )); |
245 | 245 | ||
246 | //PasswordEdit->setFixedWidth(85); | 246 | //PasswordEdit->setFixedWidth(85); |
247 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 247 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
248 | TextLabel3->setText( tr( "Remote server" ) ); | 248 | TextLabel3->setText( tr( "Remote server" ) ); |
249 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 249 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
250 | 250 | ||
251 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 251 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
252 | ServerComboBox->setEditable(TRUE); | 252 | ServerComboBox->setEditable(TRUE); |
253 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 253 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
254 | 254 | ||
255 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); | 255 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) )); |
256 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, | 256 | connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this, |
257 | SLOT(serverComboEdited(const QString & ) )); | 257 | SLOT(serverComboEdited(const QString&) )); |
258 | 258 | ||
259 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 259 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
260 | TextLabel5->setText( tr( "Remote path" ) ); | 260 | TextLabel5->setText( tr( "Remote path" ) ); |
261 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 261 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
262 | 262 | ||
263 | 263 | ||
264 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 264 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
265 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 265 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
266 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 266 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
267 | TextLabel4->setText( tr( "Port" ) ); | 267 | TextLabel4->setText( tr( "Port" ) ); |
268 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 268 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
269 | 269 | ||
270 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 270 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
271 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 271 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
272 | PortSpinBox->setMaxValue(32786); | 272 | PortSpinBox->setMaxValue(32786); |
273 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 273 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
274 | 274 | ||
275 | serverListView = new QListBox( tab_3, "ServerListView" ); | 275 | serverListView = new QListBox( tab_3, "ServerListView" ); |
276 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); | 276 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); |
277 | 277 | ||
278 | connect( serverListView, SIGNAL( highlighted( const QString &)), | 278 | connect( serverListView, SIGNAL( highlighted(const QString&)), |
279 | this,SLOT( serverListClicked( const QString &) ) ); | 279 | this,SLOT( serverListClicked(const QString&) ) ); |
280 | 280 | ||
281 | connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); | 281 | connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); |
282 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); | 282 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); |
283 | connectServerBtn->setToggleButton(TRUE); | 283 | connectServerBtn->setToggleButton(TRUE); |
284 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); | 284 | connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) )); |
285 | 285 | ||
286 | newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); | 286 | newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); |
287 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); | 287 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); |
288 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); | 288 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); |
289 | 289 | ||
290 | QPushButton *deleteServerBtn; | 290 | QPushButton *deleteServerBtn; |
291 | deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); | 291 | deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); |
292 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); | 292 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); |
293 | 293 | ||
294 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 294 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
295 | 295 | ||
296 | 296 | ||
297 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 297 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
298 | tabLayout_3->addItem( spacer, 5, 0 ); | 298 | tabLayout_3->addItem( spacer, 5, 0 ); |
299 | 299 | ||
300 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 300 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
301 | 301 | ||
302 | #if 0 | 302 | #if 0 |
303 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 303 | connect(TabWidget,SIGNAL(currentChanged(QWidget*)), |
304 | this,SLOT(tabChanged(QWidget*))); | 304 | this,SLOT(tabChanged(QWidget*))); |
305 | #endif | 305 | #endif |
306 | 306 | ||
307 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 307 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
308 | currentDir.setPath( QDir::currentDirPath()); | 308 | currentDir.setPath( QDir::currentDirPath()); |
309 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 309 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
310 | 310 | ||
311 | currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); | 311 | currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); |
312 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); | 312 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); |
313 | currentPathCombo ->setFixedWidth(220); | 313 | currentPathCombo ->setFixedWidth(220); |
314 | currentPathCombo->setEditable(TRUE); | 314 | currentPathCombo->setEditable(TRUE); |
315 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 315 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
316 | 316 | ||
317 | #if 0 | 317 | #if 0 |
318 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 318 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), |
319 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 319 | this, SLOT( currentPathComboActivated(const QString&) ) ); |
320 | 320 | ||
321 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 321 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
322 | this,SLOT(currentPathComboChanged())); | 322 | this,SLOT(currentPathComboChanged())); |
323 | #endif | 323 | #endif |
324 | ProgressBar = new QProgressBar( view, "ProgressBar" ); | 324 | ProgressBar = new QProgressBar( view, "ProgressBar" ); |
325 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 325 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
326 | ProgressBar->setMaximumHeight(10); | 326 | ProgressBar->setMaximumHeight(10); |
327 | filterStr="*"; | 327 | filterStr="*"; |
328 | b=FALSE; | 328 | b=FALSE; |
329 | #if 0 | 329 | #if 0 |
330 | populateLocalView(); | 330 | populateLocalView(); |
331 | #endif | 331 | #endif |
332 | readConfig(); | 332 | readConfig(); |
333 | 333 | ||
334 | // ServerComboBox->setCurrentItem(currentServerConfig); | 334 | // ServerComboBox->setCurrentItem(currentServerConfig); |
335 | 335 | ||
336 | TabWidget->setCurrentPage(2); | 336 | TabWidget->setCurrentPage(2); |
337 | qDebug("Constructor done"); | 337 | qDebug("Constructor done"); |
338 | } | 338 | } |
339 | 339 | ||
340 | OpieFtp::~OpieFtp() | 340 | OpieFtp::~OpieFtp() |
341 | { | 341 | { |
342 | } | 342 | } |
343 | 343 | ||
344 | void OpieFtp::cleanUp() | 344 | void OpieFtp::cleanUp() |
345 | { | 345 | { |
346 | if(conn) | 346 | if(conn) |
347 | FtpQuit(conn); | 347 | FtpQuit(conn); |
348 | QString sfile=QDir::homeDirPath(); | 348 | QString sfile=QDir::homeDirPath(); |
349 | if(sfile.right(1) != "/") | 349 | if(sfile.right(1) != "/") |
350 | sfile+="/._temp"; | 350 | sfile+="/._temp"; |
351 | else | 351 | else |
352 | sfile+="._temp"; | 352 | sfile+="._temp"; |
353 | QFile file( sfile); | 353 | QFile file( sfile); |
354 | if(file.exists()) | 354 | if(file.exists()) |
355 | file.remove(); | 355 | file.remove(); |
356 | Config cfg("opieftp"); | 356 | Config cfg("opieftp"); |
357 | cfg.setGroup("Server"); | 357 | cfg.setGroup("Server"); |
358 | cfg.writeEntry("currentServer", currentServerConfig); | 358 | cfg.writeEntry("currentServer", currentServerConfig); |
359 | 359 | ||
360 | exit(0); | 360 | exit(0); |
361 | } | 361 | } |
362 | 362 | ||
363 | void OpieFtp::tabChanged(QWidget *) | 363 | void OpieFtp::tabChanged(QWidget *) |
364 | { | 364 | { |
365 | if (TabWidget->currentPageIndex() == 0) { | 365 | if (TabWidget->currentPageIndex() == 0) { |
366 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 366 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
367 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 367 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
368 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 368 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
369 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 369 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
370 | if(cdUpButton->isHidden()) | 370 | if(cdUpButton->isHidden()) |
371 | cdUpButton->show(); | 371 | cdUpButton->show(); |
372 | if(homeButton->isHidden()) | 372 | if(homeButton->isHidden()) |
373 | homeButton->show(); | 373 | homeButton->show(); |
374 | 374 | ||
375 | } | 375 | } |
376 | if (TabWidget->currentPageIndex() == 1) { | 376 | if (TabWidget->currentPageIndex() == 1) { |
377 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 377 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
378 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 378 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
379 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 379 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
380 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 380 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
381 | if(cdUpButton->isHidden()) | 381 | if(cdUpButton->isHidden()) |
382 | cdUpButton->show(); | 382 | cdUpButton->show(); |
383 | homeButton->hide(); | 383 | homeButton->hide(); |
384 | 384 | ||
385 | } | 385 | } |
386 | if (TabWidget->currentPageIndex() == 2) { | 386 | if (TabWidget->currentPageIndex() == 2) { |
387 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 387 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
388 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 388 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
389 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 389 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
390 | cdUpButton->hide(); | 390 | cdUpButton->hide(); |
391 | homeButton->hide(); | 391 | homeButton->hide(); |
392 | } | 392 | } |
393 | } | 393 | } |
394 | 394 | ||
395 | void OpieFtp::newConnection() | 395 | void OpieFtp::newConnection() |
396 | { | 396 | { |
397 | UsernameComboBox->lineEdit()->setText(""); | 397 | UsernameComboBox->lineEdit()->setText(""); |
398 | PasswordEdit->setText( "" ); | 398 | PasswordEdit->setText( "" ); |
399 | ServerComboBox->lineEdit()->setText( ""); | 399 | ServerComboBox->lineEdit()->setText( ""); |
400 | remotePath->setText( currentRemoteDir = "/"); | 400 | remotePath->setText( currentRemoteDir = "/"); |
401 | PortSpinBox->setValue( 21); | 401 | PortSpinBox->setValue( 21); |
402 | TabWidget->setCurrentPage(2); | 402 | TabWidget->setCurrentPage(2); |
403 | } | 403 | } |
404 | 404 | ||
405 | void OpieFtp::serverComboEdited(const QString & ) | 405 | void OpieFtp::serverComboEdited(const QString & ) |
406 | { | 406 | { |
407 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { | 407 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { |
408 | // qDebug("ServerComboEdited"); | 408 | // qDebug("ServerComboEdited"); |
409 | // // currentServerConfig = -1; | 409 | // // currentServerConfig = -1; |
410 | // } | 410 | // } |
411 | } | 411 | } |
412 | 412 | ||
413 | void OpieFtp::UsernameComboBoxEdited(const QString &) { | 413 | void OpieFtp::UsernameComboBoxEdited(const QString &) { |
414 | // currentServerConfig = -1; | 414 | // currentServerConfig = -1; |
415 | } | 415 | } |
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index b0771f6..667e977 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp | |||
@@ -1,127 +1,127 @@ | |||
1 | #include <qpe/resource.h> | 1 | #include <qpe/resource.h> |
2 | #include <qwhatsthis.h> | 2 | #include <qwhatsthis.h> |
3 | #include <qhbox.h> | 3 | #include <qhbox.h> |
4 | #include "ircchanneltab.h" | 4 | #include "ircchanneltab.h" |
5 | #include "ircservertab.h" | 5 | #include "ircservertab.h" |
6 | 6 | ||
7 | IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { | 7 | IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { |
8 | m_mainWindow = mainWindow; | 8 | m_mainWindow = mainWindow; |
9 | m_parentTab = parentTab; | 9 | m_parentTab = parentTab; |
10 | m_channel = channel; | 10 | m_channel = channel; |
11 | m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); | 11 | m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); |
12 | QHBox *hbox = new QHBox(this); | 12 | QHBox *hbox = new QHBox(this); |
13 | m_textview = new QTextView(hbox); | 13 | m_textview = new QTextView(hbox); |
14 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); | 14 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); |
15 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 15 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
16 | m_listVisible = TRUE; | 16 | m_listVisible = TRUE; |
17 | m_listButton = new QPushButton(">", m_textview); | 17 | m_listButton = new QPushButton(">", m_textview); |
18 | m_textview->setCornerWidget(m_listButton); | 18 | m_textview->setCornerWidget(m_listButton); |
19 | m_textview->setTextFormat(RichText); | 19 | m_textview->setTextFormat(RichText); |
20 | QWhatsThis::add(m_textview, tr("Channel discussion")); | 20 | QWhatsThis::add(m_textview, tr("Channel discussion")); |
21 | connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList())); | 21 | connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList())); |
22 | m_list = new IRCChannelList(m_channel, hbox); | 22 | m_list = new IRCChannelList(m_channel, hbox); |
23 | m_list->update(); | 23 | m_list->update(); |
24 | m_list->setMaximumWidth(LISTWIDTH); | 24 | m_list->setMaximumWidth(LISTWIDTH); |
25 | m_field = new IRCHistoryLineEdit(this); | 25 | m_field = new IRCHistoryLineEdit(this); |
26 | QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); | 26 | QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); |
27 | m_popup = new QPopupMenu(m_list); | 27 | m_popup = new QPopupMenu(m_list); |
28 | m_lines = 0; | 28 | m_lines = 0; |
29 | /* Required so that embedded-style "right" clicks work */ | 29 | /* Required so that embedded-style "right" clicks work */ |
30 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); | 30 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); |
31 | connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); | 31 | connect(m_list, SIGNAL(mouseButtonPressed(int,QListBoxItem*,const QPoint&)), this, SLOT(mouseButtonPressed(int,QListBoxItem*,const QPoint&))); |
32 | /* Construct the popup menu */ | 32 | /* Construct the popup menu */ |
33 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); | 33 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); |
34 | m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); | 34 | m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); |
35 | m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); | 35 | m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); |
36 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); | 36 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); |
37 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); | 37 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); |
38 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); | 38 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); |
39 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); | 39 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); |
40 | m_layout->add(hbox); | 40 | m_layout->add(hbox); |
41 | hbox->show(); | 41 | hbox->show(); |
42 | m_layout->add(m_field); | 42 | m_layout->add(m_field); |
43 | m_field->setFocus(); | 43 | m_field->setFocus(); |
44 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 44 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
45 | settingsChanged(); | 45 | settingsChanged(); |
46 | } | 46 | } |
47 | 47 | ||
48 | void IRCChannelTab::scrolling(){ | 48 | void IRCChannelTab::scrolling(){ |
49 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 49 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
50 | } | 50 | } |
51 | 51 | ||
52 | void IRCChannelTab::appendText(QString text) { | 52 | void IRCChannelTab::appendText(QString text) { |
53 | /* not using append because it creates layout problems */ | 53 | /* not using append because it creates layout problems */ |
54 | QString txt = m_textview->text() + text + "\n"; | 54 | QString txt = m_textview->text() + text + "\n"; |
55 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | 55 | if (m_maxLines > 0 && m_lines >= m_maxLines) { |
56 | int firstBreak = txt.find('\n'); | 56 | int firstBreak = txt.find('\n'); |
57 | if (firstBreak != -1) { | 57 | if (firstBreak != -1) { |
58 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | 58 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); |
59 | } | 59 | } |
60 | } else { | 60 | } else { |
61 | m_lines++; | 61 | m_lines++; |
62 | } | 62 | } |
63 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 63 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
64 | m_textview->setText(txt); | 64 | m_textview->setText(txt); |
65 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 65 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
66 | emit changed(this); | 66 | emit changed(this); |
67 | } | 67 | } |
68 | 68 | ||
69 | IRCChannelTab::~IRCChannelTab() { | 69 | IRCChannelTab::~IRCChannelTab() { |
70 | m_parentTab->removeChannelTab(this); | 70 | m_parentTab->removeChannelTab(this); |
71 | } | 71 | } |
72 | 72 | ||
73 | void IRCChannelTab::processCommand() { | 73 | void IRCChannelTab::processCommand() { |
74 | QString text = m_field->text(); | 74 | QString text = m_field->text(); |
75 | if (text.length()>0) { | 75 | if (text.length()>0) { |
76 | if (session()->isSessionActive()) { | 76 | if (session()->isSessionActive()) { |
77 | if (text.startsWith("/") && !text.startsWith("//")) { | 77 | if (text.startsWith("/") && !text.startsWith("//")) { |
78 | /* Command mode */ | 78 | /* Command mode */ |
79 | m_parentTab->executeCommand(this, text);; | 79 | m_parentTab->executeCommand(this, text);; |
80 | } else { | 80 | } else { |
81 | if (text.startsWith("//")) | 81 | if (text.startsWith("//")) |
82 | text = text.right(text.length()-1); | 82 | text = text.right(text.length()-1); |
83 | session()->sendMessage(m_channel, m_field->text()); | 83 | session()->sendMessage(m_channel, m_field->text()); |
84 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">> "+IRCOutput::toHTML(m_field->text())+"</font><br>"); | 84 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">> "+IRCOutput::toHTML(m_field->text())+"</font><br>"); |
85 | } | 85 | } |
86 | } else { | 86 | } else { |
87 | appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); | 87 | appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | m_field->clear(); | 90 | m_field->clear(); |
91 | } | 91 | } |
92 | 92 | ||
93 | void IRCChannelTab::settingsChanged() { | 93 | void IRCChannelTab::settingsChanged() { |
94 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 94 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
95 | m_lines = 0; | 95 | m_lines = 0; |
96 | } | 96 | } |
97 | 97 | ||
98 | void IRCChannelTab::toggleList() { | 98 | void IRCChannelTab::toggleList() { |
99 | if (m_listVisible) { | 99 | if (m_listVisible) { |
100 | m_list->setMaximumWidth(0); | 100 | m_list->setMaximumWidth(0); |
101 | m_listButton->setText("<"); | 101 | m_listButton->setText("<"); |
102 | } else { | 102 | } else { |
103 | m_list->setMaximumWidth(LISTWIDTH); | 103 | m_list->setMaximumWidth(LISTWIDTH); |
104 | m_listButton->setText(">"); | 104 | m_listButton->setText(">"); |
105 | } | 105 | } |
106 | m_listVisible = !m_listVisible; | 106 | m_listVisible = !m_listVisible; |
107 | } | 107 | } |
108 | 108 | ||
109 | void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &point) { | 109 | void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &point) { |
110 | switch (mouse) { | 110 | switch (mouse) { |
111 | case 1: | 111 | case 1: |
112 | break; | 112 | break; |
113 | case 2: | 113 | case 2: |
114 | m_popup->popup(point); | 114 | m_popup->popup(point); |
115 | break; | 115 | break; |
116 | }; | 116 | }; |
117 | } | 117 | } |
118 | 118 | ||
119 | void IRCChannelTab::popupQuery() { | 119 | void IRCChannelTab::popupQuery() { |
120 | if (m_list->currentItem() != -1) { | 120 | if (m_list->currentItem() != -1) { |
121 | IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text()); | 121 | IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text()); |
122 | if (person) { | 122 | if (person) { |
123 | IRCQueryTab *tab = m_parentTab->getTabForQuery(person); | 123 | IRCQueryTab *tab = m_parentTab->getTabForQuery(person); |
124 | if (!tab) { | 124 | if (!tab) { |
125 | tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent()); | 125 | tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent()); |
126 | m_parentTab->addQueryTab(tab); | 126 | m_parentTab->addQueryTab(tab); |
127 | m_mainWindow->addTab(tab); | 127 | m_mainWindow->addTab(tab); |
diff --git a/noncore/net/opieirc/ircsession.cpp b/noncore/net/opieirc/ircsession.cpp index 6404d71..3b176d0 100644 --- a/noncore/net/opieirc/ircsession.cpp +++ b/noncore/net/opieirc/ircsession.cpp | |||
@@ -1,105 +1,105 @@ | |||
1 | #include "ircsession.h" | 1 | #include "ircsession.h" |
2 | #include "ircmessageparser.h" | 2 | #include "ircmessageparser.h" |
3 | #include "ircversion.h" | 3 | #include "ircversion.h" |
4 | 4 | ||
5 | IRCSession::IRCSession(IRCServer *server) { | 5 | IRCSession::IRCSession(IRCServer *server) { |
6 | m_server = server; | 6 | m_server = server; |
7 | m_connection = new IRCConnection(m_server); | 7 | m_connection = new IRCConnection(m_server); |
8 | m_parser = new IRCMessageParser(this); | 8 | m_parser = new IRCMessageParser(this); |
9 | connect(m_connection, SIGNAL(messageArrived(IRCMessage *)), this, SLOT(handleMessage(IRCMessage *))); | 9 | connect(m_connection, SIGNAL(messageArrived(IRCMessage*)), this, SLOT(handleMessage(IRCMessage*))); |
10 | connect(m_parser, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); | 10 | connect(m_parser, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); |
11 | connect(m_connection, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); | 11 | connect(m_connection, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); |
12 | } | 12 | } |
13 | 13 | ||
14 | IRCSession::~IRCSession() { | 14 | IRCSession::~IRCSession() { |
15 | /* We want this to get deleted automatically */ | 15 | /* We want this to get deleted automatically */ |
16 | m_channels.setAutoDelete(TRUE); | 16 | m_channels.setAutoDelete(TRUE); |
17 | m_people.setAutoDelete(TRUE); | 17 | m_people.setAutoDelete(TRUE); |
18 | 18 | ||
19 | delete m_parser; | 19 | delete m_parser; |
20 | delete m_connection; | 20 | delete m_connection; |
21 | } | 21 | } |
22 | 22 | ||
23 | void IRCSession::beginSession() { | 23 | void IRCSession::beginSession() { |
24 | m_connection->doConnect(); | 24 | m_connection->doConnect(); |
25 | } | 25 | } |
26 | 26 | ||
27 | void IRCSession::join(QString channelname) { | 27 | void IRCSession::join(QString channelname) { |
28 | m_connection->sendLine("JOIN "+channelname); | 28 | m_connection->sendLine("JOIN "+channelname); |
29 | } | 29 | } |
30 | 30 | ||
31 | void IRCSession::quit(){ | 31 | void IRCSession::quit(){ |
32 | m_connection->sendLine("QUIT :[OI] I'm too good to need a reason"); | 32 | m_connection->sendLine("QUIT :[OI] I'm too good to need a reason"); |
33 | } | 33 | } |
34 | 34 | ||
35 | void IRCSession::quit(QString message){ | 35 | void IRCSession::quit(QString message){ |
36 | m_connection->sendLine("QUIT :" + message); | 36 | m_connection->sendLine("QUIT :" + message); |
37 | } | 37 | } |
38 | 38 | ||
39 | void IRCSession::topic(IRCChannel *channel, QString message){ | 39 | void IRCSession::topic(IRCChannel *channel, QString message){ |
40 | m_connection->sendLine("TOPIC :" + channel->channelname() + " " + message); | 40 | m_connection->sendLine("TOPIC :" + channel->channelname() + " " + message); |
41 | } | 41 | } |
42 | 42 | ||
43 | void IRCSession::mode(IRCChannel *channel, QString message){ | 43 | void IRCSession::mode(IRCChannel *channel, QString message){ |
44 | m_connection->sendLine("MODE " + channel->channelname() + " " + message); | 44 | m_connection->sendLine("MODE " + channel->channelname() + " " + message); |
45 | } | 45 | } |
46 | 46 | ||
47 | void IRCSession::mode(IRCPerson *person, QString message){ | 47 | void IRCSession::mode(IRCPerson *person, QString message){ |
48 | m_connection->sendLine("MODE " + person->nick() + " " + message); | 48 | m_connection->sendLine("MODE " + person->nick() + " " + message); |
49 | } | 49 | } |
50 | 50 | ||
51 | void IRCSession::mode(QString message){ | 51 | void IRCSession::mode(QString message){ |
52 | m_connection->sendLine("MODE " + message); | 52 | m_connection->sendLine("MODE " + message); |
53 | } | 53 | } |
54 | 54 | ||
55 | void IRCSession::raw(QString message){ | 55 | void IRCSession::raw(QString message){ |
56 | m_connection->sendLine(message); | 56 | m_connection->sendLine(message); |
57 | } | 57 | } |
58 | 58 | ||
59 | void IRCSession::kick(IRCChannel *channel, IRCPerson *person) { | 59 | void IRCSession::kick(IRCChannel *channel, IRCPerson *person) { |
60 | m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :0wn3d - no reason"); | 60 | m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :0wn3d - no reason"); |
61 | } | 61 | } |
62 | 62 | ||
63 | void IRCSession::op(IRCChannel *channel, IRCPerson *person) { | 63 | void IRCSession::op(IRCChannel *channel, IRCPerson *person) { |
64 | m_connection->sendLine("MODE "+ channel->channelname() + " +ooo " + person->nick()); | 64 | m_connection->sendLine("MODE "+ channel->channelname() + " +ooo " + person->nick()); |
65 | } | 65 | } |
66 | 66 | ||
67 | void IRCSession::kick(IRCChannel *channel, IRCPerson *person, QString message) { | 67 | void IRCSession::kick(IRCChannel *channel, IRCPerson *person, QString message) { |
68 | m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :" + message); | 68 | m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :" + message); |
69 | } | 69 | } |
70 | 70 | ||
71 | void IRCSession::sendMessage(IRCPerson *person, QString message) { | 71 | void IRCSession::sendMessage(IRCPerson *person, QString message) { |
72 | m_connection->sendLine("PRIVMSG " + person->nick() + " :" + message); | 72 | m_connection->sendLine("PRIVMSG " + person->nick() + " :" + message); |
73 | } | 73 | } |
74 | 74 | ||
75 | void IRCSession::sendMessage(IRCChannel *channel, QString message) { | 75 | void IRCSession::sendMessage(IRCChannel *channel, QString message) { |
76 | m_connection->sendLine("PRIVMSG " + channel->channelname() + " :" + message); | 76 | m_connection->sendLine("PRIVMSG " + channel->channelname() + " :" + message); |
77 | } | 77 | } |
78 | 78 | ||
79 | void IRCSession::sendAction(IRCChannel *channel, QString message) { | 79 | void IRCSession::sendAction(IRCChannel *channel, QString message) { |
80 | m_connection->sendLine("PRIVMSG " + channel->channelname() + " :\001ACTION " + message + "\001"); | 80 | m_connection->sendLine("PRIVMSG " + channel->channelname() + " :\001ACTION " + message + "\001"); |
81 | } | 81 | } |
82 | 82 | ||
83 | void IRCSession::sendAction(IRCPerson *person, QString message) { | 83 | void IRCSession::sendAction(IRCPerson *person, QString message) { |
84 | m_connection->sendLine("PRIVMSG " + person->nick() + " :\001ACTION " + message + "\001"); | 84 | m_connection->sendLine("PRIVMSG " + person->nick() + " :\001ACTION " + message + "\001"); |
85 | } | 85 | } |
86 | 86 | ||
87 | bool IRCSession::isSessionActive() { | 87 | bool IRCSession::isSessionActive() { |
88 | return m_connection->isConnected(); | 88 | return m_connection->isConnected(); |
89 | } | 89 | } |
90 | 90 | ||
91 | void IRCSession::endSession() { | 91 | void IRCSession::endSession() { |
92 | if (m_connection->isLoggedIn()) | 92 | if (m_connection->isLoggedIn()) |
93 | m_connection->sendLine("QUIT :" APP_VERSION); | 93 | m_connection->sendLine("QUIT :" APP_VERSION); |
94 | else | 94 | else |
95 | m_connection->close(); | 95 | m_connection->close(); |
96 | } | 96 | } |
97 | 97 | ||
98 | void IRCSession::part(IRCChannel *channel) { | 98 | void IRCSession::part(IRCChannel *channel) { |
99 | m_connection->sendLine("PART " + channel->channelname() + " :" + APP_VERSION); | 99 | m_connection->sendLine("PART " + channel->channelname() + " :" + APP_VERSION); |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | IRCChannel *IRCSession::getChannel(QString channelname) { | 103 | IRCChannel *IRCSession::getChannel(QString channelname) { |
104 | QListIterator<IRCChannel> it(m_channels); | 104 | QListIterator<IRCChannel> it(m_channels); |
105 | for (; it.current(); ++it) { | 105 | for (; it.current(); ++it) { |
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index 7414154..0923a11 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp | |||
@@ -1,91 +1,91 @@ | |||
1 | #include <qmenubar.h> | 1 | #include <qmenubar.h> |
2 | #include <qpe/resource.h> | 2 | #include <qpe/resource.h> |
3 | #include <qwhatsthis.h> | 3 | #include <qwhatsthis.h> |
4 | 4 | ||
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include "ircservertab.h" | 6 | #include "ircservertab.h" |
7 | #include "ircserverlist.h" | 7 | #include "ircserverlist.h" |
8 | #include "ircsettings.h" | 8 | #include "ircsettings.h" |
9 | 9 | ||
10 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 10 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
11 | setCaption(tr("IRC Client")); | 11 | setCaption(tr("IRC Client")); |
12 | m_tabWidget = new IRCTabWidget(this); | 12 | m_tabWidget = new IRCTabWidget(this); |
13 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); | 13 | QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); |
14 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); | 14 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*))); |
15 | setCentralWidget(m_tabWidget); | 15 | setCentralWidget(m_tabWidget); |
16 | setToolBarsMovable(FALSE); | 16 | setToolBarsMovable(FALSE); |
17 | QMenuBar *menuBar = new QMenuBar(this); | 17 | QMenuBar *menuBar = new QMenuBar(this); |
18 | QPopupMenu *irc = new QPopupMenu(this); | 18 | QPopupMenu *irc = new QPopupMenu(this); |
19 | menuBar->insertItem(tr("IRC"), irc); | 19 | menuBar->insertItem(tr("IRC"), irc); |
20 | QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); | 20 | QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); |
21 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); | 21 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); |
22 | a->setWhatsThis(tr("Create a new connection to an IRC server")); | 22 | a->setWhatsThis(tr("Create a new connection to an IRC server")); |
23 | a->addTo(irc); | 23 | a->addTo(irc); |
24 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); | 24 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); |
25 | a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); | 25 | a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); |
26 | connect(a, SIGNAL(activated()), this, SLOT(settings())); | 26 | connect(a, SIGNAL(activated()), this, SLOT(settings())); |
27 | a->addTo(irc); | 27 | a->addTo(irc); |
28 | loadSettings(); | 28 | loadSettings(); |
29 | } | 29 | } |
30 | 30 | ||
31 | /*IRCTabWidget MainWindow::getTabWidget(){ | 31 | /*IRCTabWidget MainWindow::getTabWidget(){ |
32 | return m_tabWidget; | 32 | return m_tabWidget; |
33 | } */ | 33 | } */ |
34 | 34 | ||
35 | void MainWindow::loadSettings() { | 35 | void MainWindow::loadSettings() { |
36 | Config config("OpieIRC"); | 36 | Config config("OpieIRC"); |
37 | config.setGroup("OpieIRC"); | 37 | config.setGroup("OpieIRC"); |
38 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); | 38 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); |
39 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); | 39 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); |
40 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); | 40 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); |
41 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); | 41 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); |
42 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); | 42 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); |
43 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); | 43 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); |
44 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); | 44 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); |
45 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); | 45 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); |
46 | } | 46 | } |
47 | 47 | ||
48 | void MainWindow::selected(QWidget *) { | 48 | void MainWindow::selected(QWidget *) { |
49 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); | 49 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); |
50 | emit updateScroll(); | 50 | emit updateScroll(); |
51 | } | 51 | } |
52 | 52 | ||
53 | void MainWindow::addTab(IRCTab *tab) { | 53 | void MainWindow::addTab(IRCTab *tab) { |
54 | connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); | 54 | connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*))); |
55 | m_tabWidget->addTab(tab, tab->title()); | 55 | m_tabWidget->addTab(tab, tab->title()); |
56 | m_tabWidget->showPage(tab); | 56 | m_tabWidget->showPage(tab); |
57 | tab->setID(m_tabWidget->currentPageIndex()); | 57 | tab->setID(m_tabWidget->currentPageIndex()); |
58 | m_tabs.append(tab); | 58 | m_tabs.append(tab); |
59 | } | 59 | } |
60 | 60 | ||
61 | void MainWindow::changeEvent(IRCTab *tab) { | 61 | void MainWindow::changeEvent(IRCTab *tab) { |
62 | if (tab->id() != m_tabWidget->currentPageIndex()) | 62 | if (tab->id() != m_tabWidget->currentPageIndex()) |
63 | m_tabWidget->setTabColor(tab->id(), blue); | 63 | m_tabWidget->setTabColor(tab->id(), blue); |
64 | } | 64 | } |
65 | 65 | ||
66 | void MainWindow::killTab(IRCTab *tab) { | 66 | void MainWindow::killTab(IRCTab *tab) { |
67 | m_tabWidget->removePage(tab); | 67 | m_tabWidget->removePage(tab); |
68 | m_tabs.remove(tab); | 68 | m_tabs.remove(tab); |
69 | /* there might be nicer ways to do this .. */ | 69 | /* there might be nicer ways to do this .. */ |
70 | delete tab; | 70 | delete tab; |
71 | } | 71 | } |
72 | 72 | ||
73 | void MainWindow::newConnection() { | 73 | void MainWindow::newConnection() { |
74 | IRCServerList list(this, "ServerList", TRUE); | 74 | IRCServerList list(this, "ServerList", TRUE); |
75 | if (list.exec() == QDialog::Accepted && list.hasServer()) { | 75 | if (list.exec() == QDialog::Accepted && list.hasServer()) { |
76 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); | 76 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); |
77 | addTab(serverTab); | 77 | addTab(serverTab); |
78 | serverTab->doConnect(); | 78 | serverTab->doConnect(); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | void MainWindow::settings() { | 82 | void MainWindow::settings() { |
83 | IRCSettings settings(this, "Settings", TRUE); | 83 | IRCSettings settings(this, "Settings", TRUE); |
84 | if (settings.exec() == QDialog::Accepted) { | 84 | if (settings.exec() == QDialog::Accepted) { |
85 | QListIterator<IRCTab> it(m_tabs); | 85 | QListIterator<IRCTab> it(m_tabs); |
86 | for (; it.current(); ++it) { | 86 | for (; it.current(); ++it) { |
87 | /* Inform all tabs about the new settings */ | 87 | /* Inform all tabs about the new settings */ |
88 | it.current()->settingsChanged(); | 88 | it.current()->settingsChanged(); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | } | 91 | } |
diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp index 6b6d247..c3850eb 100644 --- a/noncore/net/opietooth/lib/startdunconnection.cpp +++ b/noncore/net/opietooth/lib/startdunconnection.cpp | |||
@@ -1,67 +1,67 @@ | |||
1 | 1 | ||
2 | #include "startdunconnection.h" | 2 | #include "startdunconnection.h" |
3 | 3 | ||
4 | using namespace OpieTooth; | 4 | using namespace OpieTooth; |
5 | 5 | ||
6 | 6 | ||
7 | StartDunConnection::StartDunConnection() { | 7 | StartDunConnection::StartDunConnection() { |
8 | m_dunConnect = 0l; | 8 | m_dunConnect = 0l; |
9 | setConnectionType(); | 9 | setConnectionType(); |
10 | } | 10 | } |
11 | 11 | ||
12 | StartDunConnection::~StartDunConnection() { | 12 | StartDunConnection::~StartDunConnection() { |
13 | delete m_dunConnect; | 13 | delete m_dunConnect; |
14 | } | 14 | } |
15 | 15 | ||
16 | StartDunConnection::StartDunConnection( QString mac ) { | 16 | StartDunConnection::StartDunConnection( QString mac ) { |
17 | m_dunConnect = 0l; | 17 | m_dunConnect = 0l; |
18 | m_mac = mac; | 18 | m_mac = mac; |
19 | setConnectionType(); | 19 | setConnectionType(); |
20 | } | 20 | } |
21 | 21 | ||
22 | void StartDunConnection::setName( QString name ) { | 22 | void StartDunConnection::setName( QString name ) { |
23 | m_name = name; | 23 | m_name = name; |
24 | } | 24 | } |
25 | 25 | ||
26 | QString StartDunConnection::name() { | 26 | QString StartDunConnection::name() { |
27 | return m_name; | 27 | return m_name; |
28 | } | 28 | } |
29 | 29 | ||
30 | void StartDunConnection::setConnectionType() { | 30 | void StartDunConnection::setConnectionType() { |
31 | m_connectionType = Pan; | 31 | m_connectionType = Pan; |
32 | } | 32 | } |
33 | 33 | ||
34 | StartConnection::ConnectionType StartDunConnection::type() { | 34 | StartConnection::ConnectionType StartDunConnection::type() { |
35 | return m_connectionType; | 35 | return m_connectionType; |
36 | } | 36 | } |
37 | 37 | ||
38 | void StartDunConnection::start() { | 38 | void StartDunConnection::start() { |
39 | m_dunConnect = new OProcess(); | 39 | m_dunConnect = new OProcess(); |
40 | *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; | 40 | *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; |
41 | 41 | ||
42 | connect( m_dunConnect, SIGNAL( processExited( OProcess* ) ) , | 42 | connect( m_dunConnect, SIGNAL( processExited(OProcess*) ) , |
43 | this, SLOT( slotExited( OProcess* ) ) ); | 43 | this, SLOT( slotExited(OProcess*) ) ); |
44 | connect( m_dunConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), | 44 | connect( m_dunConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), |
45 | this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); | 45 | this, SLOT( slotStdOut(OProcess*,char*,int) ) ); |
46 | if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 46 | if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
47 | qWarning( "could not start" ); | 47 | qWarning( "could not start" ); |
48 | delete m_dunConnect; | 48 | delete m_dunConnect; |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | 52 | ||
53 | void StartDunConnection::slotExited( OProcess* proc ) { | 53 | void StartDunConnection::slotExited( OProcess* proc ) { |
54 | delete m_dunConnect; | 54 | delete m_dunConnect; |
55 | } | 55 | } |
56 | 56 | ||
57 | void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) | 57 | void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) |
58 | {} | 58 | {} |
59 | 59 | ||
60 | 60 | ||
61 | void StartDunConnection::stop() { | 61 | void StartDunConnection::stop() { |
62 | if ( m_dunConnect ) { | 62 | if ( m_dunConnect ) { |
63 | delete m_dunConnect; | 63 | delete m_dunConnect; |
64 | m_dunConnect = 0l; | 64 | m_dunConnect = 0l; |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp index 6e0ab7e..a42b407 100644 --- a/noncore/net/opietooth/lib/startpanconnection.cpp +++ b/noncore/net/opietooth/lib/startpanconnection.cpp | |||
@@ -1,82 +1,82 @@ | |||
1 | 1 | ||
2 | #include "startpanconnection.h" | 2 | #include "startpanconnection.h" |
3 | 3 | ||
4 | using namespace OpieTooth; | 4 | using namespace OpieTooth; |
5 | 5 | ||
6 | 6 | ||
7 | StartPanConnection::StartPanConnection() { | 7 | StartPanConnection::StartPanConnection() { |
8 | m_panConnect = 0l; | 8 | m_panConnect = 0l; |
9 | setConnectionType(); | 9 | setConnectionType(); |
10 | } | 10 | } |
11 | 11 | ||
12 | StartPanConnection::~StartPanConnection() { | 12 | StartPanConnection::~StartPanConnection() { |
13 | delete m_panConnect; | 13 | delete m_panConnect; |
14 | } | 14 | } |
15 | 15 | ||
16 | StartPanConnection::StartPanConnection( QString mac ) { | 16 | StartPanConnection::StartPanConnection( QString mac ) { |
17 | m_panConnect = 0l; | 17 | m_panConnect = 0l; |
18 | m_mac = mac; | 18 | m_mac = mac; |
19 | setConnectionType(); | 19 | setConnectionType(); |
20 | } | 20 | } |
21 | 21 | ||
22 | void StartPanConnection::setName( QString name ) { | 22 | void StartPanConnection::setName( QString name ) { |
23 | m_name = name; | 23 | m_name = name; |
24 | } | 24 | } |
25 | 25 | ||
26 | QString StartPanConnection::name() { | 26 | QString StartPanConnection::name() { |
27 | return m_name; | 27 | return m_name; |
28 | } | 28 | } |
29 | 29 | ||
30 | void StartPanConnection::setConnectionType() { | 30 | void StartPanConnection::setConnectionType() { |
31 | m_connectionType = Pan; | 31 | m_connectionType = Pan; |
32 | } | 32 | } |
33 | 33 | ||
34 | StartConnection::ConnectionType StartPanConnection::type() { | 34 | StartConnection::ConnectionType StartPanConnection::type() { |
35 | return m_connectionType; | 35 | return m_connectionType; |
36 | } | 36 | } |
37 | 37 | ||
38 | void StartPanConnection::start() { | 38 | void StartPanConnection::start() { |
39 | m_panConnect = new OProcess(); | 39 | m_panConnect = new OProcess(); |
40 | qDebug( "IM START " + m_mac ); | 40 | qDebug( "IM START " + m_mac ); |
41 | *m_panConnect << "pand" << "--connect" << m_mac; | 41 | *m_panConnect << "pand" << "--connect" << m_mac; |
42 | 42 | ||
43 | connect( m_panConnect, SIGNAL( processExited( OProcess* ) ) , | 43 | connect( m_panConnect, SIGNAL( processExited(OProcess*) ) , |
44 | this, SLOT( slotExited( OProcess* ) ) ); | 44 | this, SLOT( slotExited(OProcess*) ) ); |
45 | connect( m_panConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), | 45 | connect( m_panConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), |
46 | this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); | 46 | this, SLOT( slotStdOut(OProcess*,char*,int) ) ); |
47 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 47 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
48 | qWarning( "could not start" ); | 48 | qWarning( "could not start" ); |
49 | delete m_panConnect; | 49 | delete m_panConnect; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | void StartPanConnection::slotExited( OProcess* proc ) { | 54 | void StartPanConnection::slotExited( OProcess* proc ) { |
55 | delete m_panConnect; | 55 | delete m_panConnect; |
56 | m_panConnect = 0l; | 56 | m_panConnect = 0l; |
57 | } | 57 | } |
58 | 58 | ||
59 | void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) | 59 | void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) |
60 | {} | 60 | {} |
61 | 61 | ||
62 | 62 | ||
63 | void StartPanConnection::stop() { | 63 | void StartPanConnection::stop() { |
64 | if ( m_panConnect ) { | 64 | if ( m_panConnect ) { |
65 | delete m_panConnect; | 65 | delete m_panConnect; |
66 | m_panConnect = 0l; | 66 | m_panConnect = 0l; |
67 | } | 67 | } |
68 | m_panConnect = new OProcess(); | 68 | m_panConnect = new OProcess(); |
69 | qDebug("IM STOP " + m_mac); | 69 | qDebug("IM STOP " + m_mac); |
70 | 70 | ||
71 | *m_panConnect << "pand" << "--kill" << m_mac; | 71 | *m_panConnect << "pand" << "--kill" << m_mac; |
72 | 72 | ||
73 | connect( m_panConnect, SIGNAL( processExited( OProcess* ) ) , | 73 | connect( m_panConnect, SIGNAL( processExited(OProcess*) ) , |
74 | this, SLOT( slotExited( OProcess* ) ) ); | 74 | this, SLOT( slotExited(OProcess*) ) ); |
75 | connect( m_panConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), | 75 | connect( m_panConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), |
76 | this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); | 76 | this, SLOT( slotStdOut(OProcess*,char*,int) ) ); |
77 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 77 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
78 | qWarning( "could not stop" ); | 78 | qWarning( "could not stop" ); |
79 | delete m_panConnect; | 79 | delete m_panConnect; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 0ea45d2..29030ab 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -1,177 +1,177 @@ | |||
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 | #include "rfcommassigndialogimpl.h" |
24 | 24 | ||
25 | /* OPIE */ | 25 | /* OPIE */ |
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/resource.h> | 27 | #include <qpe/resource.h> |
28 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | 29 | ||
30 | /* QT */ | 30 | /* QT */ |
31 | #include <qframe.h> | 31 | #include <qframe.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qvariant.h> | 35 | #include <qvariant.h> |
36 | #include <qimage.h> | 36 | #include <qimage.h> |
37 | #include <qpixmap.h> | 37 | #include <qpixmap.h> |
38 | #include <qtabwidget.h> | 38 | #include <qtabwidget.h> |
39 | #include <qscrollview.h> | 39 | #include <qscrollview.h> |
40 | #include <qvbox.h> | 40 | #include <qvbox.h> |
41 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
42 | #include <qcheckbox.h> | 42 | #include <qcheckbox.h> |
43 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
44 | #include <qlistview.h> | 44 | #include <qlistview.h> |
45 | #include <qdir.h> | 45 | #include <qdir.h> |
46 | #include <qpopupmenu.h> | 46 | #include <qpopupmenu.h> |
47 | #include <qtimer.h> | 47 | #include <qtimer.h> |
48 | #include <qlist.h> | 48 | #include <qlist.h> |
49 | 49 | ||
50 | /* STD */ | 50 | /* STD */ |
51 | #include <remotedevice.h> | 51 | #include <remotedevice.h> |
52 | #include <services.h> | 52 | #include <services.h> |
53 | #include <stdlib.h> | 53 | #include <stdlib.h> |
54 | 54 | ||
55 | using namespace OpieTooth; | 55 | using namespace OpieTooth; |
56 | 56 | ||
57 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 57 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
58 | : BluetoothBase( parent, name, fl ) | 58 | : BluetoothBase( parent, name, fl ) |
59 | { | 59 | { |
60 | 60 | ||
61 | m_localDevice = new Manager( "hci0" ); | 61 | m_localDevice = new Manager( "hci0" ); |
62 | 62 | ||
63 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); | 63 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); |
64 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); | 64 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); |
65 | 65 | ||
66 | connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); | 66 | connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); |
67 | // not good since lib is async | 67 | // not good since lib is async |
68 | // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), | 68 | // connect( ListView2, SIGNAL( expanded(QListViewItem*) ), |
69 | // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); | 69 | // this, SLOT( addServicesToDevice(QListViewItem*) ) ); |
70 | connect( ListView2, SIGNAL( clicked( QListViewItem* )), | 70 | connect( ListView2, SIGNAL( clicked(QListViewItem*)), |
71 | this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); | 71 | this, SLOT( startServiceActionClicked(QListViewItem*) ) ); |
72 | connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), | 72 | connect( ListView2, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), |
73 | this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); | 73 | this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) ); |
74 | connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), | 74 | connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ), |
75 | this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); | 75 | this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) ); |
76 | connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), | 76 | connect( m_localDevice, SIGNAL( available(const QString&,bool) ), |
77 | this, SLOT( deviceActive( const QString& , bool ) ) ); | 77 | this, SLOT( deviceActive(const QString&,bool) ) ); |
78 | connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), | 78 | connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), |
79 | this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); | 79 | this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); |
80 | connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ), | 80 | connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), |
81 | this, SLOT( addSignalStrength( const QString&, const QString& ) ) ); | 81 | this, SLOT( addSignalStrength(const QString&,const QString&) ) ); |
82 | 82 | ||
83 | 83 | ||
84 | // let hold be rightButtonClicked() | 84 | // let hold be rightButtonClicked() |
85 | QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); | 85 | QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); |
86 | QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); | 86 | QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); |
87 | 87 | ||
88 | //Load all icons needed | 88 | //Load all icons needed |
89 | m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); | 89 | m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); |
90 | m_onPix = Resource::loadPixmap( "opietooth/connected" ); | 90 | m_onPix = Resource::loadPixmap( "opietooth/connected" ); |
91 | m_findPix = Resource::loadPixmap( "opietooth/find" ); | 91 | m_findPix = Resource::loadPixmap( "opietooth/find" ); |
92 | 92 | ||
93 | QPalette pal = this->palette(); | 93 | QPalette pal = this->palette(); |
94 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); | 94 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); |
95 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); | 95 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); |
96 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); | 96 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); |
97 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); | 97 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); |
98 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); | 98 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); |
99 | this->setPalette( pal ); | 99 | this->setPalette( pal ); |
100 | 100 | ||
101 | setCaption( tr( "Bluetooth Manager" ) ); | 101 | setCaption( tr( "Bluetooth Manager" ) ); |
102 | 102 | ||
103 | readConfig(); | 103 | readConfig(); |
104 | initGui(); | 104 | initGui(); |
105 | 105 | ||
106 | ListView2->setRootIsDecorated(true); | 106 | ListView2->setRootIsDecorated(true); |
107 | 107 | ||
108 | 108 | ||
109 | writeToHciConfig(); | 109 | writeToHciConfig(); |
110 | // search conncetions | 110 | // search conncetions |
111 | addConnectedDevices(); | 111 | addConnectedDevices(); |
112 | addSignalStrength(); | 112 | addSignalStrength(); |
113 | m_iconLoader = new BTIconLoader(); | 113 | m_iconLoader = new BTIconLoader(); |
114 | readSavedDevices(); | 114 | readSavedDevices(); |
115 | } | 115 | } |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * Reads all options from the config file | 118 | * Reads all options from the config file |
119 | */ | 119 | */ |
120 | void BlueBase::readConfig() | 120 | void BlueBase::readConfig() |
121 | { | 121 | { |
122 | 122 | ||
123 | Config cfg( "bluetoothmanager" ); | 123 | Config cfg( "bluetoothmanager" ); |
124 | cfg.setGroup( "bluezsettings" ); | 124 | cfg.setGroup( "bluezsettings" ); |
125 | 125 | ||
126 | m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with | 126 | m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with |
127 | m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak | 127 | m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak |
128 | m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); | 128 | m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); |
129 | m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); | 129 | m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); |
130 | m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); | 130 | m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); |
131 | m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); | 131 | m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); |
132 | } | 132 | } |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * Writes all options to the config file | 135 | * Writes all options to the config file |
136 | */ | 136 | */ |
137 | void BlueBase::writeConfig() | 137 | void BlueBase::writeConfig() |
138 | { | 138 | { |
139 | 139 | ||
140 | Config cfg( "bluetoothmanager" ); | 140 | Config cfg( "bluetoothmanager" ); |
141 | cfg.setGroup( "bluezsettings" ); | 141 | cfg.setGroup( "bluezsettings" ); |
142 | 142 | ||
143 | cfg.writeEntry( "name" , m_deviceName ); | 143 | cfg.writeEntry( "name" , m_deviceName ); |
144 | cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); | 144 | cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); |
145 | cfg.writeEntry( "useEncryption" , m_useEncryption ); | 145 | cfg.writeEntry( "useEncryption" , m_useEncryption ); |
146 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); | 146 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); |
147 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); | 147 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); |
148 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); | 148 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); |
149 | 149 | ||
150 | writeToHciConfig(); | 150 | writeToHciConfig(); |
151 | } | 151 | } |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Modify the hcid.conf file to our needs | 154 | * Modify the hcid.conf file to our needs |
155 | */ | 155 | */ |
156 | void BlueBase::writeToHciConfig() | 156 | void BlueBase::writeToHciConfig() |
157 | { | 157 | { |
158 | qWarning("writeToHciConfig"); | 158 | qWarning("writeToHciConfig"); |
159 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); | 159 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); |
160 | hciconf.load(); | 160 | hciconf.load(); |
161 | hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" ); | 161 | hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" ); |
162 | hciconf.setName( m_deviceName ); | 162 | hciconf.setName( m_deviceName ); |
163 | hciconf.setEncrypt( m_useEncryption ); | 163 | hciconf.setEncrypt( m_useEncryption ); |
164 | hciconf.setAuth( m_enableAuthentification ); | 164 | hciconf.setAuth( m_enableAuthentification ); |
165 | hciconf.setPscan( m_enablePagescan ); | 165 | hciconf.setPscan( m_enablePagescan ); |
166 | hciconf.setIscan( m_enableInquiryscan ); | 166 | hciconf.setIscan( m_enableInquiryscan ); |
167 | hciconf.save(); | 167 | hciconf.save(); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | /** | 171 | /** |
172 | * Read the list of allready known devices | 172 | * Read the list of allready known devices |
173 | */ | 173 | */ |
174 | void BlueBase::readSavedDevices() | 174 | void BlueBase::readSavedDevices() |
175 | { | 175 | { |
176 | 176 | ||
177 | QValueList<RemoteDevice> loadedDevices; | 177 | QValueList<RemoteDevice> loadedDevices; |
@@ -544,145 +544,145 @@ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) | |||
544 | 544 | ||
545 | if ( found == false ) | 545 | if ( found == false ) |
546 | { | 546 | { |
547 | connectionItem = new BTConnectionItem( ListView4, (*it) ); | 547 | connectionItem = new BTConnectionItem( ListView4, (*it) ); |
548 | 548 | ||
549 | if( m_deviceList.find((*it).mac()).data() ) | 549 | if( m_deviceList.find((*it).mac()).data() ) |
550 | { | 550 | { |
551 | connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); | 551 | connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); |
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | } | 555 | } |
556 | 556 | ||
557 | QListViewItemIterator it2( ListView4 ); | 557 | QListViewItemIterator it2( ListView4 ); |
558 | for ( ; it2.current(); ++it2 ) | 558 | for ( ; it2.current(); ++it2 ) |
559 | { | 559 | { |
560 | bool found = false; | 560 | bool found = false; |
561 | for (it = connectionList.begin(); it != connectionList.end(); ++it) | 561 | for (it = connectionList.begin(); it != connectionList.end(); ++it) |
562 | { | 562 | { |
563 | if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) | 563 | if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) |
564 | { | 564 | { |
565 | found = true; | 565 | found = true; |
566 | } | 566 | } |
567 | } | 567 | } |
568 | 568 | ||
569 | if ( !found ) | 569 | if ( !found ) |
570 | { | 570 | { |
571 | delete it2.current(); | 571 | delete it2.current(); |
572 | } | 572 | } |
573 | 573 | ||
574 | } | 574 | } |
575 | 575 | ||
576 | 576 | ||
577 | } | 577 | } |
578 | else | 578 | else |
579 | { | 579 | { |
580 | ListView4->clear(); | 580 | ListView4->clear(); |
581 | ConnectionState con; | 581 | ConnectionState con; |
582 | con.setMac( tr("No connections found") ); | 582 | con.setMac( tr("No connections found") ); |
583 | connectionItem = new BTConnectionItem( ListView4 , con ); | 583 | connectionItem = new BTConnectionItem( ListView4 , con ); |
584 | } | 584 | } |
585 | 585 | ||
586 | // recall connection search after some time | 586 | // recall connection search after some time |
587 | QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); | 587 | QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); |
588 | } | 588 | } |
589 | 589 | ||
590 | 590 | ||
591 | /** | 591 | /** |
592 | * Find out if a device can currently be reached | 592 | * Find out if a device can currently be reached |
593 | * @param device | 593 | * @param device |
594 | */ | 594 | */ |
595 | void BlueBase::deviceActive( const RemoteDevice &device ) | 595 | void BlueBase::deviceActive( const RemoteDevice &device ) |
596 | { | 596 | { |
597 | // search by mac, async, gets a signal back | 597 | // search by mac, async, gets a signal back |
598 | // We should have a BTDeviceItem there or where does it get added to the map -zecke | 598 | // We should have a BTDeviceItem there or where does it get added to the map -zecke |
599 | m_localDevice->isAvailable( device.mac() ); | 599 | m_localDevice->isAvailable( device.mac() ); |
600 | } | 600 | } |
601 | 601 | ||
602 | 602 | ||
603 | /** | 603 | /** |
604 | * The signal catcher. Set the avail. status on device. | 604 | * The signal catcher. Set the avail. status on device. |
605 | * @param device - the mac address | 605 | * @param device - the mac address |
606 | * @param connected - if it is avail. or not | 606 | * @param connected - if it is avail. or not |
607 | */ | 607 | */ |
608 | void BlueBase::deviceActive( const QString& device, bool connected ) | 608 | void BlueBase::deviceActive( const QString& device, bool connected ) |
609 | { | 609 | { |
610 | qDebug("deviceActive slot"); | 610 | qDebug("deviceActive slot"); |
611 | 611 | ||
612 | QMap<QString,BTDeviceItem*>::Iterator it; | 612 | QMap<QString,BTDeviceItem*>::Iterator it; |
613 | 613 | ||
614 | it = m_deviceList.find( device ); | 614 | it = m_deviceList.find( device ); |
615 | if( it == m_deviceList.end() ) | 615 | if( it == m_deviceList.end() ) |
616 | return; | 616 | return; |
617 | 617 | ||
618 | BTDeviceItem* deviceItem = it.data(); | 618 | BTDeviceItem* deviceItem = it.data(); |
619 | 619 | ||
620 | 620 | ||
621 | if ( connected ) | 621 | if ( connected ) |
622 | { | 622 | { |
623 | deviceItem->setPixmap( 1, m_onPix ); | 623 | deviceItem->setPixmap( 1, m_onPix ); |
624 | } | 624 | } |
625 | else | 625 | else |
626 | { | 626 | { |
627 | deviceItem->setPixmap( 1, m_offPix ); | 627 | deviceItem->setPixmap( 1, m_offPix ); |
628 | } | 628 | } |
629 | m_deviceList.remove( it ); | 629 | m_deviceList.remove( it ); |
630 | } | 630 | } |
631 | 631 | ||
632 | 632 | ||
633 | /** | 633 | /** |
634 | * Open the "scan for devices" dialog | 634 | * Open the "scan for devices" dialog |
635 | */ | 635 | */ |
636 | void BlueBase::startScan() | 636 | void BlueBase::startScan() |
637 | { | 637 | { |
638 | ScanDialog *scan = new ScanDialog( this, "ScanDialog", | 638 | ScanDialog *scan = new ScanDialog( this, "ScanDialog", |
639 | true, WDestructiveClose ); | 639 | true, WDestructiveClose ); |
640 | QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), | 640 | QObject::connect( scan, SIGNAL( selectedDevices(const QValueList<RemoteDevice>&) ), |
641 | this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); | 641 | this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) ); |
642 | 642 | ||
643 | QPEApplication::showDialog( scan ); | 643 | QPEApplication::showDialog( scan ); |
644 | } | 644 | } |
645 | 645 | ||
646 | 646 | ||
647 | /** | 647 | /** |
648 | * Set the informations about the local device in information Tab | 648 | * Set the informations about the local device in information Tab |
649 | */ | 649 | */ |
650 | void BlueBase::setInfo() | 650 | void BlueBase::setInfo() |
651 | { | 651 | { |
652 | StatusLabel->setText( status() ); | 652 | StatusLabel->setText( status() ); |
653 | } | 653 | } |
654 | 654 | ||
655 | 655 | ||
656 | /** | 656 | /** |
657 | * Decontructor | 657 | * Decontructor |
658 | */ | 658 | */ |
659 | BlueBase::~BlueBase() | 659 | BlueBase::~BlueBase() |
660 | { | 660 | { |
661 | writeSavedDevices(); | 661 | writeSavedDevices(); |
662 | delete m_iconLoader; | 662 | delete m_iconLoader; |
663 | } | 663 | } |
664 | 664 | ||
665 | 665 | ||
666 | /** | 666 | /** |
667 | * find searches the ListView for a BTDeviceItem containig | 667 | * find searches the ListView for a BTDeviceItem containig |
668 | * the same Device if found return true else false | 668 | * the same Device if found return true else false |
669 | * @param dev RemoteDevice to find | 669 | * @param dev RemoteDevice to find |
670 | * @return returns true if found | 670 | * @return returns true if found |
671 | */ | 671 | */ |
672 | bool BlueBase::find( const RemoteDevice& rem ) | 672 | bool BlueBase::find( const RemoteDevice& rem ) |
673 | { | 673 | { |
674 | QListViewItemIterator it( ListView2 ); | 674 | QListViewItemIterator it( ListView2 ); |
675 | BTListItem* item; | 675 | BTListItem* item; |
676 | BTDeviceItem* device; | 676 | BTDeviceItem* device; |
677 | for (; it.current(); ++it ) | 677 | for (; it.current(); ++it ) |
678 | { | 678 | { |
679 | item = (BTListItem*) it.current(); | 679 | item = (BTListItem*) it.current(); |
680 | if ( item->typeId() != BTListItem::Device ) | 680 | if ( item->typeId() != BTListItem::Device ) |
681 | continue; | 681 | continue; |
682 | 682 | ||
683 | device = (BTDeviceItem*)item; | 683 | device = (BTDeviceItem*)item; |
684 | if ( rem.equals( device->remoteDevice() ) ) | 684 | if ( rem.equals( device->remoteDevice() ) ) |
685 | return true; | 685 | return true; |
686 | } | 686 | } |
687 | return false; // not found | 687 | return false; // not found |
688 | } | 688 | } |
diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp index 15973d4..46a0e3d 100644 --- a/noncore/net/opietooth/manager/obexdialog.cpp +++ b/noncore/net/opietooth/manager/obexdialog.cpp | |||
@@ -1,86 +1,86 @@ | |||
1 | 1 | ||
2 | #include "obexdialog.h" | 2 | #include "obexdialog.h" |
3 | #include <qpushbutton.h> | 3 | #include <qpushbutton.h> |
4 | #include <qmultilineedit.h> | 4 | #include <qmultilineedit.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qfileinfo.h> | 8 | #include <qfileinfo.h> |
9 | 9 | ||
10 | #include <qpe/resource.h> | 10 | #include <qpe/resource.h> |
11 | 11 | ||
12 | #include <opie/oprocess.h> | 12 | #include <opie/oprocess.h> |
13 | #include <opie/ofiledialog.h> | 13 | #include <opie/ofiledialog.h> |
14 | 14 | ||
15 | using namespace OpieTooth; | 15 | using namespace OpieTooth; |
16 | 16 | ||
17 | ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) | 17 | ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) |
18 | : QDialog( parent, name, modal, fl ) { | 18 | : QDialog( parent, name, modal, fl ) { |
19 | 19 | ||
20 | if ( !name ) | 20 | if ( !name ) |
21 | setName( "ObexDialog" ); | 21 | setName( "ObexDialog" ); |
22 | setCaption( tr( "beam files " ) ) ; | 22 | setCaption( tr( "beam files " ) ) ; |
23 | 23 | ||
24 | m_device = device; | 24 | m_device = device; |
25 | 25 | ||
26 | layout = new QVBoxLayout( this ); | 26 | layout = new QVBoxLayout( this ); |
27 | 27 | ||
28 | QLabel* info = new QLabel( this ); | 28 | QLabel* info = new QLabel( this ); |
29 | info->setText( tr("Which file should be beamed?") ); | 29 | info->setText( tr("Which file should be beamed?") ); |
30 | 30 | ||
31 | cmdLine = new QLineEdit( this ); | 31 | cmdLine = new QLineEdit( this ); |
32 | 32 | ||
33 | QPushButton *browserButton; | 33 | QPushButton *browserButton; |
34 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); | 34 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); |
35 | connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); | 35 | connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); |
36 | 36 | ||
37 | chNameLine = new QLineEdit( this ); | 37 | chNameLine = new QLineEdit( this ); |
38 | 38 | ||
39 | sendButton = new QPushButton( this ); | 39 | sendButton = new QPushButton( this ); |
40 | sendButton->setText( tr( "Send" ) ); | 40 | sendButton->setText( tr( "Send" ) ); |
41 | 41 | ||
42 | layout->addWidget(info); | 42 | layout->addWidget(info); |
43 | layout->addWidget(cmdLine); | 43 | layout->addWidget(cmdLine); |
44 | layout->addWidget(browserButton); | 44 | layout->addWidget(browserButton); |
45 | layout->addWidget(chNameLine); | 45 | layout->addWidget(chNameLine); |
46 | layout->addWidget(sendButton); | 46 | layout->addWidget(sendButton); |
47 | 47 | ||
48 | connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); | 48 | connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); |
49 | 49 | ||
50 | } | 50 | } |
51 | 51 | ||
52 | ObexDialog::~ObexDialog() { | 52 | ObexDialog::~ObexDialog() { |
53 | } | 53 | } |
54 | 54 | ||
55 | void ObexDialog::browse() { | 55 | void ObexDialog::browse() { |
56 | 56 | ||
57 | MimeTypes types; | 57 | MimeTypes types; |
58 | QStringList all; | 58 | QStringList all; |
59 | all << "*/*"; | 59 | all << "*/*"; |
60 | types.insert("All Files", all ); | 60 | types.insert("All Files", all ); |
61 | 61 | ||
62 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); | 62 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); |
63 | cmdLine->setText( str ); | 63 | cmdLine->setText( str ); |
64 | 64 | ||
65 | } | 65 | } |
66 | 66 | ||
67 | void ObexDialog::sendData() { | 67 | void ObexDialog::sendData() { |
68 | QString fileURL = cmdLine->text(); | 68 | QString fileURL = cmdLine->text(); |
69 | QString file = QFileInfo( fileURL ).fileName(); | 69 | QString file = QFileInfo( fileURL ).fileName(); |
70 | QString modifiedName = chNameLine->text(); | 70 | QString modifiedName = chNameLine->text(); |
71 | 71 | ||
72 | // vom popupmenu beziehen | 72 | // vom popupmenu beziehen |
73 | OProcess* obexSend = new OProcess(); | 73 | OProcess* obexSend = new OProcess(); |
74 | if ( !modifiedName.isEmpty() ) { | 74 | if ( !modifiedName.isEmpty() ) { |
75 | *obexSend << "ussp-push" << m_device << fileURL << modifiedName; | 75 | *obexSend << "ussp-push" << m_device << fileURL << modifiedName; |
76 | } else { | 76 | } else { |
77 | *obexSend << "ussp-push" << m_device << fileURL << file; | 77 | *obexSend << "ussp-push" << m_device << fileURL << file; |
78 | } | 78 | } |
79 | if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { | 79 | if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { |
80 | qWarning("could not start"); | 80 | qWarning("could not start"); |
81 | delete obexSend; | 81 | delete obexSend; |
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | 85 | ||
86 | } | 86 | } |
diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp index 1f347ce..4e58552 100644 --- a/noncore/net/opietooth/manager/pppdialog.cpp +++ b/noncore/net/opietooth/manager/pppdialog.cpp | |||
@@ -1,68 +1,68 @@ | |||
1 | 1 | ||
2 | #include "pppdialog.h" | 2 | #include "pppdialog.h" |
3 | #include <qpushbutton.h> | 3 | #include <qpushbutton.h> |
4 | #include <qmultilineedit.h> | 4 | #include <qmultilineedit.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <opie/oprocess.h> | 8 | #include <opie/oprocess.h> |
9 | 9 | ||
10 | using namespace OpieTooth; | 10 | using namespace OpieTooth; |
11 | 11 | ||
12 | PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) | 12 | PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) |
13 | : QDialog( parent, name, modal, fl ) { | 13 | : QDialog( parent, name, modal, fl ) { |
14 | 14 | ||
15 | if ( !name ) | 15 | if ( !name ) |
16 | setName( "PPPDialog" ); | 16 | setName( "PPPDialog" ); |
17 | setCaption( tr( "ppp connection " ) ) ; | 17 | setCaption( tr( "ppp connection " ) ) ; |
18 | 18 | ||
19 | m_device = device; | 19 | m_device = device; |
20 | 20 | ||
21 | layout = new QVBoxLayout( this ); | 21 | layout = new QVBoxLayout( this ); |
22 | 22 | ||
23 | QLabel* info = new QLabel( this ); | 23 | QLabel* info = new QLabel( this ); |
24 | info->setText( tr("Enter an ppp script name:") ); | 24 | info->setText( tr("Enter an ppp script name:") ); |
25 | 25 | ||
26 | cmdLine = new QLineEdit( this ); | 26 | cmdLine = new QLineEdit( this ); |
27 | 27 | ||
28 | outPut = new QMultiLineEdit( this ); | 28 | outPut = new QMultiLineEdit( this ); |
29 | QFont outPut_font( outPut->font() ); | 29 | QFont outPut_font( outPut->font() ); |
30 | outPut_font.setPointSize( 8 ); | 30 | outPut_font.setPointSize( 8 ); |
31 | outPut->setFont( outPut_font ); | 31 | outPut->setFont( outPut_font ); |
32 | outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); | 32 | outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); |
33 | 33 | ||
34 | connectButton = new QPushButton( this ); | 34 | connectButton = new QPushButton( this ); |
35 | connectButton->setText( tr( "Connect" ) ); | 35 | connectButton->setText( tr( "Connect" ) ); |
36 | 36 | ||
37 | layout->addWidget(info); | 37 | layout->addWidget(info); |
38 | layout->addWidget(cmdLine); | 38 | layout->addWidget(cmdLine); |
39 | layout->addWidget(outPut); | 39 | layout->addWidget(outPut); |
40 | layout->addWidget(connectButton); | 40 | layout->addWidget(connectButton); |
41 | 41 | ||
42 | connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); | 42 | connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); |
43 | 43 | ||
44 | } | 44 | } |
45 | 45 | ||
46 | PPPDialog::~PPPDialog() { | 46 | PPPDialog::~PPPDialog() { |
47 | } | 47 | } |
48 | 48 | ||
49 | void PPPDialog::connectToDevice() { | 49 | void PPPDialog::connectToDevice() { |
50 | outPut->clear(); | 50 | outPut->clear(); |
51 | // vom popupmenu beziehen | 51 | // vom popupmenu beziehen |
52 | QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); | 52 | QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); |
53 | OProcess* pppDial = new OProcess(); | 53 | OProcess* pppDial = new OProcess(); |
54 | *pppDial << "pppd" << m_device << "call" << connectScript; | 54 | *pppDial << "pppd" << m_device << "call" << connectScript; |
55 | connect( pppDial, SIGNAL(receivedStdout(OProcess*, char*, int ) ), | 55 | connect( pppDial, SIGNAL(receivedStdout(OProcess*,char*,int) ), |
56 | this, SLOT(fillOutPut(OProcess*, char*, int ) ) ); | 56 | this, SLOT(fillOutPut(OProcess*,char*,int) ) ); |
57 | if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { | 57 | if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { |
58 | qWarning("could not start"); | 58 | qWarning("could not start"); |
59 | delete pppDial; | 59 | delete pppDial; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { | 63 | void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { |
64 | QCString str(cha, len ); | 64 | QCString str(cha, len ); |
65 | outPut->insertLine( str ); | 65 | outPut->insertLine( str ); |
66 | delete pppDial; | 66 | delete pppDial; |
67 | } | 67 | } |
68 | 68 | ||
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index de4f742..c8ea3e3 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp | |||
@@ -1,161 +1,161 @@ | |||
1 | /* main.cpp | 1 | /* main.cpp |
2 | * | 2 | * |
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 | 18 | ||
19 | #include "scandialog.h" | 19 | #include "scandialog.h" |
20 | 20 | ||
21 | #include <qheader.h> | 21 | #include <qheader.h> |
22 | #include <qlistview.h> | 22 | #include <qlistview.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qvariant.h> | 25 | #include <qvariant.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qprogressbar.h> | 28 | #include <qprogressbar.h> |
29 | #include <qlist.h> | 29 | #include <qlist.h> |
30 | 30 | ||
31 | #include <manager.h> | 31 | #include <manager.h> |
32 | #include <device.h> | 32 | #include <device.h> |
33 | 33 | ||
34 | 34 | ||
35 | namespace OpieTooth { | 35 | namespace OpieTooth { |
36 | 36 | ||
37 | #include <remotedevice.h> | 37 | #include <remotedevice.h> |
38 | 38 | ||
39 | /** | 39 | /** |
40 | */ | 40 | */ |
41 | ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 41 | ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
42 | : QDialog( parent, name, modal, fl ) { | 42 | : QDialog( parent, name, modal, fl ) { |
43 | 43 | ||
44 | setCaption( tr( "Scan for devices" ) ); | 44 | setCaption( tr( "Scan for devices" ) ); |
45 | 45 | ||
46 | Layout11 = new QVBoxLayout( this ); | 46 | Layout11 = new QVBoxLayout( this ); |
47 | Layout11->setSpacing( 6 ); | 47 | Layout11->setSpacing( 6 ); |
48 | Layout11->setMargin( 0 ); | 48 | Layout11->setMargin( 0 ); |
49 | 49 | ||
50 | progress = new QProgressBar( this, "progbar"); | 50 | progress = new QProgressBar( this, "progbar"); |
51 | progress->setTotalSteps(20); | 51 | progress->setTotalSteps(20); |
52 | 52 | ||
53 | StartStopButton = new QPushButton( this, "StartButton" ); | 53 | StartStopButton = new QPushButton( this, "StartButton" ); |
54 | StartStopButton->setText( tr( "Start scan" ) ); | 54 | StartStopButton->setText( tr( "Start scan" ) ); |
55 | 55 | ||
56 | ListView1 = new QListView( this, "ListView1" ); | 56 | ListView1 = new QListView( this, "ListView1" ); |
57 | 57 | ||
58 | //ListView1->addColumn( tr( "Add" ) ); | 58 | //ListView1->addColumn( tr( "Add" ) ); |
59 | ListView1->addColumn( tr( "Add Device" ) ); | 59 | ListView1->addColumn( tr( "Add Device" ) ); |
60 | //ListView1->addColumn( tr( "Type" ) ); | 60 | //ListView1->addColumn( tr( "Type" ) ); |
61 | 61 | ||
62 | Layout11->addWidget( ListView1 ); | 62 | Layout11->addWidget( ListView1 ); |
63 | Layout11->addWidget( progress ); | 63 | Layout11->addWidget( progress ); |
64 | Layout11->addWidget( StartStopButton ); | 64 | Layout11->addWidget( StartStopButton ); |
65 | 65 | ||
66 | localDevice = new Manager( "hci0" ); | 66 | localDevice = new Manager( "hci0" ); |
67 | 67 | ||
68 | connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); | 68 | connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); |
69 | connect( localDevice, SIGNAL( foundDevices( const QString& , RemoteDevice::ValueList ) ), | 69 | connect( localDevice, SIGNAL( foundDevices(const QString&,RemoteDevice::ValueList) ), |
70 | this, SLOT( fillList( const QString& , RemoteDevice::ValueList ) ) ) ; | 70 | this, SLOT( fillList(const QString&,RemoteDevice::ValueList) ) ) ; |
71 | 71 | ||
72 | progressStat = 0; | 72 | progressStat = 0; |
73 | m_search = false; | 73 | m_search = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | // hack, make cleaner later | 76 | // hack, make cleaner later |
77 | void ScanDialog::progressTimer() { | 77 | void ScanDialog::progressTimer() { |
78 | 78 | ||
79 | progressStat++; | 79 | progressStat++; |
80 | if ( progressStat++ < 20 && m_search ) { | 80 | if ( progressStat++ < 20 && m_search ) { |
81 | QTimer::singleShot( 2000, this, SLOT( progressTimer() ) ); | 81 | QTimer::singleShot( 2000, this, SLOT( progressTimer() ) ); |
82 | progress->setProgress( progressStat++ ); | 82 | progress->setProgress( progressStat++ ); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | void ScanDialog::accept() { | 86 | void ScanDialog::accept() { |
87 | emitToManager(); | 87 | emitToManager(); |
88 | QDialog::accept(); | 88 | QDialog::accept(); |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | void ScanDialog::startSearch() { | 92 | void ScanDialog::startSearch() { |
93 | if ( m_search ) { | 93 | if ( m_search ) { |
94 | stopSearch(); | 94 | stopSearch(); |
95 | return; | 95 | return; |
96 | } | 96 | } |
97 | m_search = true; | 97 | m_search = true; |
98 | progress->setProgress(0); | 98 | progress->setProgress(0); |
99 | progressStat = 0; | 99 | progressStat = 0; |
100 | 100 | ||
101 | // empty list before a new scan | 101 | // empty list before a new scan |
102 | ListView1->clear(); | 102 | ListView1->clear(); |
103 | 103 | ||
104 | progressTimer(); | 104 | progressTimer(); |
105 | // when finished, it emmite foundDevices() | 105 | // when finished, it emmite foundDevices() |
106 | // checken ob initialisiert , qcop ans applet. | 106 | // checken ob initialisiert , qcop ans applet. |
107 | StartStopButton->setText( tr( "Stop scan" ) ); | 107 | StartStopButton->setText( tr( "Stop scan" ) ); |
108 | 108 | ||
109 | localDevice->searchDevices(); | 109 | localDevice->searchDevices(); |
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | void ScanDialog::stopSearch() { | 113 | void ScanDialog::stopSearch() { |
114 | m_search = true; | 114 | m_search = true; |
115 | } | 115 | } |
116 | 116 | ||
117 | void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { | 117 | void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { |
118 | progress->setProgress(0); | 118 | progress->setProgress(0); |
119 | progressStat = 0; | 119 | progressStat = 0; |
120 | QCheckListItem * deviceItem; | 120 | QCheckListItem * deviceItem; |
121 | 121 | ||
122 | RemoteDevice::ValueList::Iterator it; | 122 | RemoteDevice::ValueList::Iterator it; |
123 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { | 123 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { |
124 | 124 | ||
125 | deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox ); | 125 | deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox ); |
126 | deviceItem->setText( 1, (*it).mac() ); | 126 | deviceItem->setText( 1, (*it).mac() ); |
127 | } | 127 | } |
128 | m_search = false; | 128 | m_search = false; |
129 | StartStopButton->setText( tr( "Start scan" ) ); | 129 | StartStopButton->setText( tr( "Start scan" ) ); |
130 | } | 130 | } |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Iterates trough the items, and collects the checked items. | 133 | * Iterates trough the items, and collects the checked items. |
134 | * Then it emits it, so the manager can connect to the signal to fill the listing. | 134 | * Then it emits it, so the manager can connect to the signal to fill the listing. |
135 | */ | 135 | */ |
136 | void ScanDialog::emitToManager() { | 136 | void ScanDialog::emitToManager() { |
137 | 137 | ||
138 | if (!ListView1) { | 138 | if (!ListView1) { |
139 | return; | 139 | return; |
140 | } | 140 | } |
141 | 141 | ||
142 | QValueList<RemoteDevice> deviceList; | 142 | QValueList<RemoteDevice> deviceList; |
143 | 143 | ||
144 | QListViewItemIterator it( ListView1 ); | 144 | QListViewItemIterator it( ListView1 ); |
145 | for ( ; it.current(); ++it ) { | 145 | for ( ; it.current(); ++it ) { |
146 | if ( ( (QCheckListItem*)it.current() )->isOn() ) { | 146 | if ( ( (QCheckListItem*)it.current() )->isOn() ) { |
147 | RemoteDevice device( it.current()->text(1), it.current()->text(0) ); | 147 | RemoteDevice device( it.current()->text(1), it.current()->text(0) ); |
148 | deviceList.append( device ); | 148 | deviceList.append( device ); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | emit selectedDevices( deviceList ); | 151 | emit selectedDevices( deviceList ); |
152 | } | 152 | } |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * Cleanup | 155 | * Cleanup |
156 | */ | 156 | */ |
157 | ScanDialog::~ScanDialog() { | 157 | ScanDialog::~ScanDialog() { |
158 | qWarning("delete scan dialog"); | 158 | qWarning("delete scan dialog"); |
159 | delete localDevice; | 159 | delete localDevice; |
160 | } | 160 | } |
161 | } | 161 | } |