Diffstat (limited to 'noncore/unsupported/mailit/emailclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 154 |
1 files changed, 143 insertions, 11 deletions
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 0d82a9a..ad1e0b4 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -60,6 +60,10 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
60 | SLOT(popError(int)) ); | 60 | SLOT(popError(int)) ); |
61 | 61 | ||
62 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); | 62 | connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); |
63 | connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); | 63 | connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); |
64 | |||
65 | connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); | ||
66 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); | ||
67 | |||
64 | 68 | ||
65 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, | 69 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, |
@@ -144,8 +148,24 @@ void EmailClient::init() | |||
144 | bar = new QToolBar(this); | 148 | bar = new QToolBar(this); |
145 | 149 | ||
146 | getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); | 150 | getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); |
151 | //connect(setAccountlButton, SIGNAL(activated()), this, SLOT(setCurrentAccount()) ); | ||
152 | // setAccountButton->addTo(bar); | ||
153 | //setAccountButton->addTo(mail); | ||
154 | |||
155 | /*idCount = 0; | ||
156 | |||
157 | for (MailAccount* accountPtr = accountList.first(); accountPtr != 0; | ||
158 | accountPtr = accountList.next()) { | ||
159 | |||
160 | selectAccountMenu->insertItem(accountPtr->accountName,this, SLOT(selectAccount(int)), 0, idCount); | ||
161 | idCount++; | ||
162 | }*/ | ||
163 | getMailButton->setPopup(selectAccountMenu); | ||
164 | |||
165 | |||
166 | /*getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); | ||
147 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); | 167 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); |
148 | getMailButton->addTo(bar); | 168 | getMailButton->addTo(bar);*/ |
149 | getMailButton->addTo(mail); | 169 | //getMailButton->addTo(mail); |
150 | 170 | ||
151 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); | 171 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); |
@@ -165,4 +185,8 @@ void EmailClient::init() | |||
165 | cancelButton->setEnabled(FALSE); | 185 | cancelButton->setEnabled(FALSE); |
166 | 186 | ||
187 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | ||
188 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); | ||
189 | deleteButton->addTo(bar); | ||
190 | |||
167 | mailboxView = new OTabWidget( this, "mailboxView" ); | 191 | mailboxView = new OTabWidget( this, "mailboxView" ); |
168 | 192 | ||
@@ -196,4 +220,6 @@ void EmailClient::init() | |||
196 | 220 | ||
197 | setCentralWidget(mailboxView); | 221 | setCentralWidget(mailboxView); |
222 | |||
223 | mailboxView->setCurrentTab(0); | ||
198 | } | 224 | } |
199 | 225 | ||
@@ -233,4 +259,6 @@ void EmailClient::enqueMail(const Email &mail) | |||
233 | item = new EmailListItem(outboxView, addMail, false); | 259 | item = new EmailListItem(outboxView, addMail, false); |
234 | 260 | ||
261 | mailboxView->setCurrentTab(1); | ||
262 | |||
235 | } | 263 | } |
236 | 264 | ||
@@ -297,5 +325,5 @@ void EmailClient::getNewMail() { | |||
297 | 325 | ||
298 | //get any previous mails not downloaded and add to queue | 326 | //get any previous mails not downloaded and add to queue |
299 | mailDownloadList.clear(); | 327 | /* mailDownloadList.clear(); |
300 | Email *mailPtr; | 328 | Email *mailPtr; |
301 | item = (EmailListItem *) inboxView->firstChild(); | 329 | item = (EmailListItem *) inboxView->firstChild(); |
@@ -306,5 +334,5 @@ void EmailClient::getNewMail() { | |||
306 | } | 334 | } |
307 | item = (EmailListItem *) item->nextSibling(); | 335 | item = (EmailListItem *) item->nextSibling(); |
308 | } | 336 | }*/ |
309 | 337 | ||
310 | emailHandler->getMailHeaders(); | 338 | emailHandler->getMailHeaders(); |
@@ -416,4 +444,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
416 | } | 444 | } |
417 | 445 | ||
446 | mailboxView->setCurrentTab(0); | ||
447 | |||
418 | } | 448 | } |
419 | 449 | ||
@@ -445,4 +475,6 @@ void EmailClient::allMailArrived(int count) | |||
445 | 475 | ||
446 | emailHandler->getMailByList(&mailDownloadList); | 476 | emailHandler->getMailByList(&mailDownloadList); |
477 | |||
478 | mailboxView->setCurrentTab(0); | ||
447 | } | 479 | } |
448 | 480 | ||
@@ -510,4 +542,6 @@ void EmailClient::popError(int code) | |||
510 | void EmailClient::inboxItemSelected() | 542 | void EmailClient::inboxItemSelected() |
511 | { | 543 | { |
544 | killTimer(timerID); | ||
545 | |||
512 | item = (EmailListItem*) inboxView->selectedItem(); | 546 | item = (EmailListItem*) inboxView->selectedItem(); |
513 | if (item != NULL) { | 547 | if (item != NULL) { |
@@ -518,4 +552,6 @@ void EmailClient::inboxItemSelected() | |||
518 | void EmailClient::outboxItemSelected() | 552 | void EmailClient::outboxItemSelected() |
519 | { | 553 | { |
554 | killTimer(timerID); | ||
555 | |||
520 | item = (EmailListItem*) outboxView->selectedItem(); | 556 | item = (EmailListItem*) outboxView->selectedItem(); |
521 | if (item != NULL) { | 557 | if (item != NULL) { |
@@ -693,4 +729,5 @@ void EmailClient::readSettings() | |||
693 | void EmailClient::saveSettings() | 729 | void EmailClient::saveSettings() |
694 | { | 730 | { |
731 | |||
695 | QString temp; | 732 | QString temp; |
696 | QFile f( getPath(FALSE) + "settings.txt"); | 733 | QFile f( getPath(FALSE) + "settings.txt"); |
@@ -702,5 +739,5 @@ void EmailClient::saveSettings() | |||
702 | } | 739 | } |
703 | QTextStream t(&f); | 740 | QTextStream t(&f); |
704 | t << "#Settings for QPE Mailit program\n"; | 741 | t << "#Settings for OPIE Mailit program\n"; |
705 | 742 | ||
706 | for (accountPtr = accountList.first(); accountPtr != 0; | 743 | for (accountPtr = accountList.first(); accountPtr != 0; |
@@ -812,5 +849,5 @@ void EmailClient::updateAccounts() | |||
812 | editAccountMenu->insertItem(accountPtr->accountName, | 849 | editAccountMenu->insertItem(accountPtr->accountName, |
813 | this, SLOT(editAccount(int)), 0, idCount); | 850 | this, SLOT(editAccount(int)), 0, idCount); |
814 | selectAccountMenu->insertItem(accountPtr->accountName, | 851 | selectAccountMenu->insertItem(accountPtr->accountName, |
815 | this, SLOT(selectAccount(int)), 0, idCount); | 852 | this, SLOT(selectAccount(int)), 0, idCount); |
816 | deleteAccountMenu->insertItem(accountPtr->accountName, | 853 | deleteAccountMenu->insertItem(accountPtr->accountName, |
@@ -825,5 +862,6 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | |||
825 | Enclosure *ePtr; | 862 | Enclosure *ePtr; |
826 | 863 | ||
827 | if (inbox) { | 864 | if (inbox) |
865 | { | ||
828 | mPtr = mailItem->getMail(); | 866 | mPtr = mailItem->getMail(); |
829 | 867 | ||
@@ -845,5 +883,7 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | |||
845 | } | 883 | } |
846 | inboxView->takeItem(mailItem); | 884 | inboxView->takeItem(mailItem); |
847 | } else { | 885 | } |
886 | else | ||
887 | { | ||
848 | outboxView->takeItem(mailItem); | 888 | outboxView->takeItem(mailItem); |
849 | } | 889 | } |
@@ -871,2 +911,94 @@ void EmailClient::setDownloadedSize(int size) | |||
871 | } | 911 | } |
872 | } | 912 | } |
913 | |||
914 | void EmailClient::deleteItem() | ||
915 | { | ||
916 | bool inbox=mailboxView->currentTab()==0; | ||
917 | |||
918 | EmailListItem* eli; | ||
919 | |||
920 | inbox ? eli=(EmailListItem*)inboxView->selectedItem():eli=(EmailListItem*)outboxView->selectedItem(); | ||
921 | |||
922 | if (eli) | ||
923 | deleteMail(eli,(bool&)inbox); | ||
924 | } | ||
925 | |||
926 | void EmailClient::inboxItemPressed() | ||
927 | { | ||
928 | //timerID=startTimer(500); | ||
929 | } | ||
930 | |||
931 | void EmailClient::inboxItemReleased() | ||
932 | { | ||
933 | //killTimer(timerID); | ||
934 | } | ||
935 | |||
936 | void EmailClient::timerEvent(QTimerEvent *e) | ||
937 | { | ||
938 | /*killTimer(timerID); | ||
939 | |||
940 | |||
941 | QPopupMenu *action = new QPopupMenu(this); | ||
942 | |||
943 | int reply=0; | ||
944 | |||
945 | action->insertItem(tr( "Reply To" ),this,SLOT(reply())); | ||
946 | action->insertItem( tr( "Reply All" ),this,SLOT(replyAll())); | ||
947 | action->insertItem( tr( "Forward" ), this,SLOT(forward())); | ||
948 | action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); | ||
949 | |||
950 | action->exec(QCursor::pos()); | ||
951 | |||
952 | if (action) delete action; | ||
953 | */ | ||
954 | } | ||
955 | |||
956 | Email* EmailClient::getCurrentMail() | ||
957 | { | ||
958 | EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); | ||
959 | if (eli!=NULL) | ||
960 | return eli->getMail(); | ||
961 | else | ||
962 | return NULL; | ||
963 | } | ||
964 | |||
965 | /* | ||
966 | void EmailClient::reply() | ||
967 | { | ||
968 | Email* mail=getCurrentMail(); | ||
969 | |||
970 | if (mail!=NULL) | ||
971 | { | ||
972 | emit reply(*mail); | ||
973 | } | ||
974 | } | ||
975 | |||
976 | void EmailClient::replyAll() | ||
977 | { | ||
978 | Email* mail=getCurrentMail(); | ||
979 | |||
980 | if (mail!=NULL) | ||
981 | { | ||
982 | emit replyAll(*mail); | ||
983 | } | ||
984 | } | ||
985 | |||
986 | void EmailClient::forward() | ||
987 | { | ||
988 | Email* mail=getCurrentMail(); | ||
989 | |||
990 | if (mail!=NULL) | ||
991 | { | ||
992 | emit reply(*mail); | ||
993 | } | ||
994 | } | ||
995 | |||
996 | void EmailClient::remove() | ||
997 | { | ||
998 | Email* mail=getCurrentMail(); | ||
999 | |||
1000 | if (mail!=NULL) | ||
1001 | { | ||
1002 | emit remove(*mail); | ||
1003 | } | ||
1004 | }*/ \ No newline at end of file | ||