author | mickeyl <mickeyl> | 2003-10-29 18:18:19 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-29 18:18:19 (UTC) |
commit | 1af1f1d9f398d38a2bc666cd2edff5725da7a770 (patch) (side-by-side diff) | |
tree | b3bb0d90cafc1e933b5b9297a7b2669ce3b184ea | |
parent | 35615947e11575a61456c8483e7f6d67fe59d5ed (diff) | |
download | opie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.zip opie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.tar.gz opie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.tar.bz2 |
mrege noncore/net/*
42 files changed, 1626 insertions, 791 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index 90664bb..8359acf 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp @@ -44,6 +44,6 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) -{ +{ emailHandler = new EmailHandler(); addressList = new AddressList(); - + sending = FALSE; @@ -54,9 +54,9 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) allAccounts = FALSE; - + init(); - - - + + + connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); - + connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this, @@ -65,6 +65,6 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) SLOT(popError(int,const QString &)) ); - + connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); - + connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); @@ -76,3 +76,3 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) SLOT(allMailArrived(int)) ); - + mailconf = new Config("mailit"); @@ -81,5 +81,5 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) readSettings(); - + updateAccounts(); - + lineShift = "\n"; @@ -87,5 +87,5 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) lineShift = "\r\n"; - + mailboxView->setCurrentTab(0); //ensure that inbox has focus - + /*channel = new QCopChannel( "QPE/Application/mailit", this ); @@ -106,6 +106,6 @@ EmailClient::~EmailClient() saveSettings(); - + mailconf->write(); delete mailconf; - + } @@ -115,5 +115,5 @@ void EmailClient::init() initStatusBar(this); - + setToolBarsMovable(FALSE); - + bar = new QToolBar(this); @@ -129,3 +129,3 @@ void EmailClient::init() mb->insertItem( tr( "Accounts" ), configure); - + selectAccountMenu = new QPopupMenu(mb); @@ -144,3 +144,3 @@ void EmailClient::init() getMailButton->setPopup(selectAccountMenu); - + sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); @@ -150,3 +150,3 @@ void EmailClient::init() sendMailButton->setWhatsThis("Send mail queued in the outbox"); - + composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); @@ -156,3 +156,3 @@ void EmailClient::init() composeButton->setWhatsThis("Compose a new mail"); - + cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); @@ -163,4 +163,4 @@ void EmailClient::init() cancelButton->setWhatsThis("Stop the currently active mail transfer"); - - + + deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); @@ -169,3 +169,3 @@ void EmailClient::init() deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); - + mailboxView = new OTabWidget( this, "mailboxView" ); @@ -207,5 +207,5 @@ void EmailClient::init() mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); - + setCentralWidget(mailboxView); - + } @@ -216,3 +216,3 @@ void EmailClient::initStatusBar(QWidget* parent) statusBar->setSizeGripEnabled(FALSE); - + status1Label = new QLabel( tr("Idle"), statusBar); @@ -223,3 +223,3 @@ void EmailClient::initStatusBar(QWidget* parent) status2Label, SLOT(setText(const QString &)) ); - + progressBar = new QProgressBar(statusBar); @@ -262,3 +262,3 @@ void EmailClient::enqueMail(const Email &mail) } - + if (accountList.count() > 0) { @@ -267,3 +267,3 @@ void EmailClient::enqueMail(const Email &mail) } - + Email addMail = mail; @@ -273,5 +273,5 @@ void EmailClient::enqueMail(const Email &mail) item = new EmailListItem(outboxView, addMail, false); - + mailboxView->setCurrentTab(1); - + } @@ -283,3 +283,3 @@ void EmailClient::sendQuedMail() if (accountList.count() == 0) { - QMessageBox::warning(qApp->activeWindow(), "No account selected", "You must create an account", "OK\n"); + QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n"); return; @@ -315,3 +315,3 @@ void EmailClient::mailSent() sendMailButton->setEnabled(TRUE); - + quedMessages.clear(); @@ -321,11 +321,11 @@ void EmailClient::mailSent() void EmailClient::getNewMail() { - + if (accountList.count() == 0) { - QMessageBox::warning(qApp->activeWindow(),"No account selected", - "You must create an account", "OK\n"); + QMessageBox::warning(qApp->activeWindow(),tr("No account selected"), + tr("You must create an account"), "OK\n"); return; } - + setMailAccount(); - + receiving = TRUE; @@ -335,6 +335,6 @@ void EmailClient::getNewMail() { selectAccountMenu->setEnabled(FALSE); - + status1Label->setText(currentAccount->accountName + " headers"); progressBar->reset(); - + //get any previous mails not downloaded and add to queue @@ -350,5 +350,5 @@ void EmailClient::getNewMail() { }*/ - + emailHandler->getMailHeaders(); - + } @@ -359,3 +359,3 @@ void EmailClient::getAllNewMail() currentAccount = accountList.first(); - getNewMail(); + getNewMail(); } @@ -369,6 +369,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailconf->setGroup(newMail.id); - - if (fromDisk) + + if (fromDisk) { - + newMail.downloaded = mailconf->readBoolEntry("downloaded"); @@ -377,6 +377,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); - } - else + } + else { //mail arrived from server - + newMail.serverId = mail.serverId; @@ -384,3 +384,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) newMail.downloaded = mail.downloaded; - + newMail.fromAccountId = emailHandler->getAccount()->id; @@ -388,6 +388,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) } - + //add if read or not newMail.read = mailconf->readBoolEntry("mailread"); - + //check if new mail @@ -396,3 +396,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailIdCount++; - + //set server count, so that if the user aborts, the new @@ -401,3 +401,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) currentAccount->lastServerMailCount++; - + mailconf->writeEntry("internalmailid", thisMailId); @@ -406,8 +406,8 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailconf->writeEntry("serverid", newMail.serverId); - + //addressList->addContact(newMail.fromMail, newMail.from); } - + mailconf->writeEntry("downloaded", newMail.downloaded); - + QString stringMailId; @@ -415,3 +415,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) //see if any attatchments needs to be stored - + for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { @@ -419,3 +419,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) stringId.setNum(ePtr->id); - + int id = mailconf->readNumEntry("enclosureid_" + stringId); @@ -428,3 +428,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailconf->writeEntry("installed_" + stringId, FALSE); - + ePtr->name = stringMailId + "_" + stringId; @@ -446,3 +446,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) ePtr->path = mailconf->readEntry("path_" + stringId); - } + } } @@ -451,9 +451,9 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) bool found=false; - - if (!fromDisk) + + if (!fromDisk) { - + Email *mailPtr; item = (EmailListItem *) inboxView->firstChild(); - while ((item != NULL)&&(!found)) + while ((item != NULL)&&(!found)) { @@ -474,8 +474,8 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) // item->setPixmap(0, Resource::loadPixmap("mailit/attach")); -// } +// } /*if (!newMail.downloaded) mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ - + mailboxView->setCurrentTab(0); - + } @@ -497,3 +497,3 @@ void EmailClient::allMailArrived(int /*count*/) status1Label->setText("Idle"); - + progressBar->reset(); @@ -502,3 +502,3 @@ void EmailClient::allMailArrived(int /*count*/) //} - + // all headers downloaded from server, start downloading remaining mails @@ -508,3 +508,3 @@ void EmailClient::allMailArrived(int /*count*/) - + mailboxView->setCurrentTab(0); @@ -523,3 +523,3 @@ void EmailClient::smtpError(int code, const QString & Msg) QString temp; - + if (code == ErrUnknownResponse) { @@ -535,3 +535,3 @@ void EmailClient::smtpError(int code, const QString & Msg) } - + if (code != ErrCancel) { @@ -541,3 +541,3 @@ void EmailClient::smtpError(int code, const QString & Msg) } - + sending = FALSE; @@ -551,3 +551,3 @@ void EmailClient::popError(int code, const QString & Msg) QString temp; - + if (code == ErrUnknownResponse) { @@ -564,3 +564,3 @@ void EmailClient::popError(int code, const QString & Msg) temp = tr("<qt>socket packet error</qt>"); - } + } @@ -572,3 +572,3 @@ void EmailClient::popError(int code, const QString & Msg) } - + receiving = FALSE; @@ -582,3 +582,3 @@ void EmailClient::inboxItemSelected() //killTimer(timerID); - + item = (EmailListItem*) inboxView->selectedItem(); @@ -592,3 +592,3 @@ void EmailClient::outboxItemSelected() //killTimer(timerID); - + item = (EmailListItem*) outboxView->selectedItem(); @@ -607,3 +607,3 @@ void EmailClient::readMail() QFile f(getPath(FALSE) + "inbox.txt"); - + if ( f.open(IO_ReadOnly) ) { // file opened successfully @@ -612,3 +612,3 @@ void EmailClient::readMail() f.close(); - + start = 0; @@ -619,3 +619,3 @@ void EmailClient::readMail() stop = s.length() - del.length(); - + mail.rawMail = s.mid(start, stop + del.length() - start ); @@ -625,3 +625,3 @@ void EmailClient::readMail() } - + QFile fo(getPath(FALSE) + "outbox.txt"); @@ -631,3 +631,3 @@ void EmailClient::readMail() fo.close(); - + start = 0; @@ -638,3 +638,3 @@ void EmailClient::readMail() stop = s.length() - del.length(); - + mail.rawMail = s.mid(start, stop + del.length() - start ); @@ -645,3 +645,3 @@ void EmailClient::readMail() enqueMail(mail); - + } @@ -654,3 +654,3 @@ void EmailClient::saveMail(const QString &fileName, QListView *view) Email *mail; - + if (! f.open(IO_WriteOnly) ) { @@ -664,6 +664,6 @@ void EmailClient::saveMail(const QString &fileName, QListView *view) t << mail->rawMail; - + mailconf->setGroup(mail->id); mailconf->writeEntry("mailread", mail->read); - + item = (EmailListItem *) item->nextSibling(); @@ -678,3 +678,3 @@ QString EmailClient::getPath(bool enclosurePath) QString enclosures = "enclosures"; - + QDir dir = (QString(getenv("HOME")) + "/Applications/" + basePath); @@ -682,11 +682,11 @@ QString EmailClient::getPath(bool enclosurePath) dir.mkdir( dir.path() ); - + if (enclosurePath) { dir = (QString(getenv("HOME")) + "/Applications/" + basePath + "/" + enclosures); - + if ( !dir.exists() ) dir.mkdir( dir.path() ); - + return (dir.path() + "/"); - + } @@ -698,9 +698,9 @@ void EmailClient::readSettings() int y,acc_count; - + mailconf->setGroup("mailitglobal"); acc_count=mailconf->readNumEntry("Accounts",0); - - for (int accountPos = 0;accountPos<acc_count ; accountPos++) + + for (int accountPos = 0;accountPos<acc_count ; accountPos++) { - mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... + mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... account.accountName = mailconf->readEntry("AccName",""); @@ -716,3 +716,3 @@ void EmailClient::readSettings() account.synchronize = FALSE; - + account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); @@ -720,11 +720,11 @@ void EmailClient::readSettings() { - mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); + mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); } - + accountList.append(&account); } - + mailconf->setGroup("mailitglobal"); - - if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) + + if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) { @@ -732,3 +732,3 @@ void EmailClient::readSettings() } - if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) + if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) { @@ -743,4 +743,4 @@ void EmailClient::saveSettings() - - if (!mailconf) + + if (!mailconf) { @@ -749,5 +749,5 @@ void EmailClient::saveSettings() } - + for (accountPtr = accountList.first(); accountPtr != 0; - accountPtr = accountList.next()) + accountPtr = accountList.next()) { @@ -762,3 +762,3 @@ void EmailClient::saveSettings() mailconf->writeEntry("AccountId",accountPtr->id); - if (accountPtr->synchronize) + if (accountPtr->synchronize) { @@ -767,4 +767,4 @@ void EmailClient::saveSettings() mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); - } - else + } + else { @@ -773,3 +773,3 @@ void EmailClient::saveSettings() } - + mailconf->setGroup("mailitglobal"); @@ -787,3 +787,3 @@ void EmailClient::selectAccount(int id) } else { - emit newCaption("Mailit ! No account defined"); + emit newCaption( tr("Mailit ! No account defined") ); } @@ -794,3 +794,3 @@ void EmailClient::editAccount(int id) MailAccount *newAccount; - + editAccountView = new EditAccount(this, "account", TRUE); @@ -803,6 +803,6 @@ void EmailClient::editAccount(int id) } - + editAccountView->showMaximized(); editAccountView->exec(); - + if (editAccountView->result() == QDialog::Accepted) { @@ -817,3 +817,3 @@ void EmailClient::editAccount(int id) } - + delete editAccountView; @@ -825,8 +825,8 @@ void EmailClient::deleteAccount(int id) QString message; - + newAccount = accountList.at(id); - message = "Delete account:\n" + newAccount->accountName; + message = tr("Delete account:\n") + newAccount->accountName; switch( QMessageBox::warning( this, "Mailit", message, "Yes", "No", 0, 0, 1 ) ) { - + case 0: accountList.remove(id); @@ -842,3 +842,3 @@ void EmailClient::updateAccounts() MailAccount *accountPtr; - + //rebuild menus, clear all first @@ -848,6 +848,6 @@ void EmailClient::updateAccounts() - newAccountId = editAccountMenu->insertItem("New", this, + newAccountId = editAccountMenu->insertItem( tr("New"), this, SLOT(editAccount(int)) ); editAccountMenu->insertSeparator(); - + idCount = 0; @@ -855,3 +855,3 @@ void EmailClient::updateAccounts() accountPtr = accountList.next()) { - + editAccountMenu->insertItem(accountPtr->accountName, @@ -870,7 +870,7 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) Enclosure *ePtr; - - if (inbox) + + if (inbox) { mPtr = mailItem->getMail(); - + //if mail is in queue for download, remove it from @@ -881,6 +881,6 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) } - + mailconf->setGroup(mPtr->id); mailconf->clearGroup(); - + //delete any temporary attatchemnts storing @@ -892,4 +892,4 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) inboxView->takeItem(mailItem); - } - else + } + else { @@ -907,3 +907,3 @@ void EmailClient::setTotalSize(int /*size*/) { - + } @@ -925,10 +925,10 @@ void EmailClient::deleteItem() QListView* box; - + EmailListItem* eli; // int pos; - + inbox ? box=inboxView : box=outboxView; - + eli=(EmailListItem*)box->selectedItem(); - + if (eli) @@ -936,3 +936,3 @@ void EmailClient::deleteItem() box->setSelected(eli->itemBelow(),true); //select the previous item - + deleteMail(eli,(bool&)inbox); //remove mail entry @@ -954,8 +954,8 @@ void EmailClient::inboxItemReleased() //killTimer(timerID); - - + + QPopupMenu *action = new QPopupMenu(this); - + int reply=0; - + action->insertItem(tr( "Reply To" ),this,SLOT(reply())); @@ -964,7 +964,7 @@ void EmailClient::inboxItemReleased() action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); - + action->exec(QCursor::pos()); - + if (action) delete action; - + }*/ @@ -979,3 +979,3 @@ Email* EmailClient::getCurrentMail() } - + void EmailClient::download(Email* mail) @@ -983,9 +983,9 @@ void EmailClient::download(Email* mail) MailAccount* acc=0; - + tempMailDownloadList.clear(); tempMailDownloadList.sizeInsert(mail->serverId, mail->size); - + acc=accountList.at(mail->fromAccountId-1); if (acc) - { + { emailHandler->setAccount(*acc); @@ -993,3 +993,3 @@ void EmailClient::download(Email* mail) } - else + else QMessageBox::warning(qApp->activeWindow(), @@ -1004,5 +1004,5 @@ void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/) QVBoxLayout *vbProg = new QVBoxLayout( &qd ); - + initStatusBar(&qd); - + if (statusBar==0) @@ -1020,19 +1020,19 @@ void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/) else if (msg=="compose()") - { + { QDialog qd(qApp->activeWindow(),"Getting mail",true); - + WriteMail wm(&qd,"write new mail"); QVBoxLayout vbProg( &qd ); - + wm.showMaximized(); vbProg.addWidget(&wm); - + qd.showMaximized(); - + emit composeRequested(); qd.exec(); - + QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); } - + else if (msg=="dialog()") diff --git a/noncore/net/mailit/emaillistitem.cpp b/noncore/net/mailit/emaillistitem.cpp index fc9f766..a25f93a 100644 --- a/noncore/net/mailit/emaillistitem.cpp +++ b/noncore/net/mailit/emaillistitem.cpp @@ -27,5 +27,5 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) QString temp; - + mail = mailIn; - + if (inbox) { @@ -40,4 +40,5 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) setText(1, mail.subject); - setText(2,mail.date); - + // setText(2,mail.date); + setText(2,dateFromULCString(mail.date)); + if (mailIn.files.count()>0) @@ -46,3 +47,3 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) } - + selected = FALSE; @@ -84,3 +85,3 @@ void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, _cg.setColor( QColorGroup::Text, Qt::red); - + /* if (selected) { @@ -94,3 +95,3 @@ void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, } -*/ +*/ QListViewItem::paintCell( p, _cg, column, width, alignment ); @@ -99 +100,59 @@ void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, } + +/* + * Converts an E-Mail date (ULC) RFC 2822 conform to a QDateTime. + * Returning a QString with formatting of "YYYY-MM-DD HH:MM:SS" + * (zodiac: This method was tested with more than 300 inbox mails, + * it didn't slow down the loading of mail-it.) + */ +QString EmailListItem::dateFromULCString( QString ulcDate ) +{ + QString sTemp, sTime; + int iPos, iDay, iMon=1, iYear; + + iPos=ulcDate.find(','); + if (iPos) { // it has a day-of-week + ulcDate=ulcDate.remove(0,++iPos); //.stripWhiteSpace(); + } + + QStringList dateEntries = QStringList::split(" ",ulcDate,FALSE); + QStringList::Iterator iter = dateEntries.begin(); + + // Get day as DD + iDay = (*iter++).toInt(); + + // Get month as string Mmm + sTemp = (*iter++); + if (sTemp =="Jan") {iMon=1;} else + if (sTemp =="Feb") {iMon=2;} else + if (sTemp =="Mar") {iMon=3;} else + if (sTemp =="Apr") {iMon=4;} else + if (sTemp =="May") {iMon=5;} else + if (sTemp =="Jun") {iMon=6;} else + if (sTemp =="Jul") {iMon=7;} else + if (sTemp =="Aug") {iMon=8;} else + if (sTemp =="Sep") {iMon=9;} else + if (sTemp =="Oct") {iMon=10;} else + if (sTemp =="Nov") {iMon=11;} else + if (sTemp =="Dec") {iMon=12;} + + // Get year as YYYY or YY + iYear = (*iter++).toInt(); + + QDate date = QDate(iYear, iMon, iDay); + + // Convert timestring into a QTime + QStringList timeEntries = QStringList::split(":",(*iter++),FALSE); + QStringList::Iterator iterTime = timeEntries.begin(); + iYear=(*iterTime++).toInt(); // var reuse.. *cough* + iMon=(*iterTime++).toInt(); + iDay=(*iterTime++).toInt(); + QTime time = QTime(iYear,iMon,iDay); + + return QString::number(date.year())+"-" + +QString::number(date.month()).rightJustify(2,'0')+"-" + +QString::number(date.day()).rightJustify(2,'0')+" " + +time.toString(); +} + + diff --git a/noncore/net/mailit/emaillistitem.h b/noncore/net/mailit/emaillistitem.h index 642932c..129a774 100644 --- a/noncore/net/mailit/emaillistitem.h +++ b/noncore/net/mailit/emaillistitem.h @@ -34,3 +34,3 @@ public: bool itemSelected(); - + protected: @@ -41,2 +41,3 @@ private: bool selected; + QString dateFromULCString( QString ulc ); }; diff --git a/noncore/net/mailit/mailit.pro b/noncore/net/mailit/mailit.pro index 5e9a83a..0224886 100644 --- a/noncore/net/mailit/mailit.pro +++ b/noncore/net/mailit/mailit.pro @@ -1,4 +1,3 @@ -TEMPLATE = app TARGET = mailit -CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = emailclient.h \ @@ -39,5 +38,2 @@ LIBS += -lqpe -lopie # -lssl -MOC_DIR=qpeobj -OBJECTS_DIR=qpeobj -DESTDIR=$(OPIEDIR)/bin diff --git a/noncore/net/mailit/mailitwindow.h b/noncore/net/mailit/mailitwindow.h index e818d32..11e56b9 100644 --- a/noncore/net/mailit/mailitwindow.h +++ b/noncore/net/mailit/mailitwindow.h @@ -35,2 +35,3 @@ class MailItWindow: public QMainWindow public: + static QString appName() { return QString::fromLatin1("mailit"); } MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); diff --git a/noncore/net/mailit/main.cpp b/noncore/net/mailit/main.cpp index 3a3e1fc..71f8877 100644 --- a/noncore/net/mailit/main.cpp +++ b/noncore/net/mailit/main.cpp @@ -22,8 +22,4 @@ -int main(int argc, char* argv[]) -{ - QPEApplication a( argc, argv ); - MailItWindow mw(0, 0); - a.showMainDocumentWidget(&mw); - return a.exec(); -} +#include <opie/oapplicationfactory.h> + +OPIE_EXPORT_APP( OApplicationFactory<MailItWindow> )
\ No newline at end of file diff --git a/noncore/net/opieftp/main.cpp b/noncore/net/opieftp/main.cpp index 4f5a7d4..0217e41 100644 --- a/noncore/net/opieftp/main.cpp +++ b/noncore/net/opieftp/main.cpp @@ -12,16 +12,5 @@ ***************************************************************************/ -#include <qpe/qpeapplication.h> - - - +#include <opie/oapplicationfactory.h> #include "opieftp.h" -int main(int argc, char *argv[]) -{ - QPEApplication a(argc, argv); - - OpieFtp opieftp; - a.showMainWidget( &opieftp); - return a.exec(); -} - +OPIE_EXPORT_APP( OApplicationFactory<OpieFtp> ) diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 269449e..ee7d32f 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp @@ -59,4 +59,4 @@ static int log_progress(netbuf *, int xfered, void *) -OpieFtp::OpieFtp( ) - : QMainWindow( ) +OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) + : QMainWindow( parent, name, fl ) { @@ -83,3 +83,3 @@ OpieFtp::OpieFtp( ) tabMenu = new QPopupMenu( this ); - + layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); @@ -271,4 +271,4 @@ OpieFtp::OpieFtp( ) this,SLOT( serverListClicked( const QString &) ) ); - - connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); + + connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); @@ -277,3 +277,3 @@ OpieFtp::OpieFtp( ) - newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); + newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); @@ -282,3 +282,3 @@ OpieFtp::OpieFtp( ) QPushButton *deleteServerBtn; - deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" ); + deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); @@ -321,3 +321,3 @@ OpieFtp::OpieFtp( ) // ServerComboBox->setCurrentItem(currentServerConfig); - + TabWidget->setCurrentPage(2); @@ -359,3 +359,3 @@ void OpieFtp::tabChanged(QWidget *) homeButton->show(); - + } @@ -451,3 +451,3 @@ void OpieFtp::connector() // if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) -// currentServerConfig=-1; +// currentServerConfig=-1; @@ -595,3 +595,3 @@ void OpieFtp::remoteDownload() } - Remote_View->setFocus(); + Remote_View->setFocus(); TabWidget->setCurrentPage(0); @@ -671,3 +671,3 @@ void OpieFtp::populateLocalView() QPixmap pm; - + if(isDir || fileL.find("/",0,TRUE) != -1) { @@ -731,3 +731,3 @@ bool OpieFtp::populateRemoteView( ) fileL = s.right(s.length() - month - len); - if(s.left(1) == "d") + if(s.left(1) == "d") fileL = fileL+"/"; @@ -817,4 +817,4 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) // QCopEnvelope ( "QPE/System", "notBusy()" ); - Remote_View->ensureItemVisible(Remote_View->firstChild()); - + Remote_View->ensureItemVisible(Remote_View->firstChild()); + } @@ -825,3 +825,3 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem) if(selectedItem!= NULL) { - + QString strItem=selectedItem->text(0); @@ -838,3 +838,3 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem) if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { - + if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { @@ -860,3 +860,3 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem) } - Local_View->ensureItemVisible(Local_View->firstChild()); + Local_View->ensureItemVisible(Local_View->firstChild()); } @@ -974,3 +974,3 @@ void OpieFtp::localDelete() it.current()->setSelected(FALSE); - + // QString f = Local_View->currentItem()->text(0); @@ -999,3 +999,3 @@ void OpieFtp::localDelete() break; - case 1: + case 1: // exit @@ -1007,3 +1007,3 @@ void OpieFtp::localDelete() populateLocalView(); - + } @@ -1203,6 +1203,6 @@ void OpieFtp::readConfig() currentServerConfig = cfg.readNumEntry("currentServer", -1); - + // qDebug("Reading %d", currentServerConfig); serverComboSelected( currentServerConfig-1); - + } @@ -1256,3 +1256,3 @@ void OpieFtp::writeConfig() cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); - + } @@ -1328,5 +1328,5 @@ void OpieFtp::serverComboSelected(int index) if( portInt == 0) portInt = 21; - + ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); - + PortSpinBox->setValue( portInt); @@ -1342,3 +1342,3 @@ void OpieFtp::serverComboSelected(int index) // PasswordEdit - + cfg.setGroup("Server"); @@ -1360,3 +1360,3 @@ void OpieFtp::deleteServer() servername=serverListView->currentText(); - + Config cfg("opieftp"); @@ -1495,3 +1495,3 @@ void OpieFtp::NewServer() { writeConfig(); - serverListView->insertItem( newServerName ); + serverListView->insertItem( newServerName ); serverListView->setCurrentItem( serverListView->count()); diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index 9d5d211..7bd615a 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h @@ -49,5 +49,6 @@ class OpieFtp : public QMainWindow public: - OpieFtp( ); + OpieFtp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~OpieFtp(); + static QString appName() { return QString::fromLatin1("opieftp"); } QTabWidget *TabWidget; diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro index ac16819..185c341 100644 --- a/noncore/net/opieftp/opieftp.pro +++ b/noncore/net/opieftp/opieftp.pro @@ -1,7 +1,5 @@ -TEMPLATE = app -CONFIG += qt warn_on release -HEADERS = opieftp.h inputDialog.h +CONFIG += qt warn_on release quick-app +HEADERS = opieftp.h inputDialog.h SOURCES = opieftp.cpp inputDialog.cpp main.cpp TARGET = opieftp -DESTDIR = $(OPIEDIR)/bin INCLUDEPATH += $(OPIEDIR)/include diff --git a/noncore/net/opieirc/.cvsignore b/noncore/net/opieirc/.cvsignore index 39391f4..d5423d6 100644 --- a/noncore/net/opieirc/.cvsignore +++ b/noncore/net/opieirc/.cvsignore @@ -3 +3,2 @@ Makefile.in moc_*.cpp +.moc
\ No newline at end of file diff --git a/noncore/net/opieirc/main.cpp b/noncore/net/opieirc/main.cpp index 43e63af..39acfcc 100644 --- a/noncore/net/opieirc/main.cpp +++ b/noncore/net/opieirc/main.cpp @@ -3,8 +3,5 @@ -int main(int argc, char **argv) { - QPEApplication a(argc, argv); - MainWindow mw; - a.showMainWidget(&mw); - return a.exec(); -} +#include <opie/oapplicationfactory.h> + +OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) diff --git a/noncore/net/opieirc/mainwindow.h b/noncore/net/opieirc/mainwindow.h index bd1a9ce..0f60855 100644 --- a/noncore/net/opieirc/mainwindow.h +++ b/noncore/net/opieirc/mainwindow.h @@ -37,2 +37,3 @@ public: void killTab(IRCTab *tab); + static QString appName() { return QString::fromLatin1("opieirc"); } signals: diff --git a/noncore/net/opieirc/opieirc.pro b/noncore/net/opieirc/opieirc.pro index 8b09e18..537f810 100644 --- a/noncore/net/opieirc/opieirc.pro +++ b/noncore/net/opieirc/opieirc.pro @@ -1,4 +1,2 @@ -TEMPLATE = app -CONFIG = qt warn_on release -DESTDIR = $(OPIEDIR)/bin +CONFIG = qt warn_on release quick-app HEADERS = ircchannel.h ircconnection.h \ @@ -23,5 +21,4 @@ DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -TARGET = opieirc - +TARGET = opieirc diff --git a/noncore/net/opietooth/blue-pin/blue-pin.pro b/noncore/net/opietooth/blue-pin/blue-pin.pro index 102a937..fbf9dbe 100644 --- a/noncore/net/opietooth/blue-pin/blue-pin.pro +++ b/noncore/net/opietooth/blue-pin/blue-pin.pro @@ -1,4 +1,2 @@ -TEMPLATE = app -#CONFIG = qt warn_on debug -CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = pindlg.h @@ -10,4 +8,3 @@ LIBS += -lqpe INTERFACES = pindlgbase.ui -DESTDIR = $(OPIEDIR)/bin -TARGET = bluepin +TARGET = bluepin @@ -32,3 +29,2 @@ TRANSLATIONS = ../../../../i18n/de/bluepin.ts \ - include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/opietooth/manager/.cvsignore b/noncore/net/opietooth/manager/.cvsignore index 3fb67fe..19c03a7 100644 --- a/noncore/net/opietooth/manager/.cvsignore +++ b/noncore/net/opietooth/manager/.cvsignore @@ -9 +9,5 @@ scandialog.cpp scandialog.h +rfcommassigndialogbase.cpp +rfcommassigndialogbase.h +rfcommdialogitembase.cpp +rfcommdialogitembase.h diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 54808fa..2e68984 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -22,2 +22,3 @@ #include "btconnectionitem.h" +#include "rfcommassigndialogimpl.h" @@ -61,3 +62,5 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); - // not good since lib is async + + connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); +// not good since lib is async // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), @@ -224,3 +227,3 @@ QString BlueBase::status()const{ infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); - infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); + infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); @@ -247,2 +250,16 @@ void BlueBase::applyConfigChanges() { /** + * Launch Rfcomm Bind dialog + * + */ +void BlueBase::rfcommDialog() { + RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); + + rfcommAssign.showMaximized(); + + if ( rfcommAssign.exec() == QDialog::Accepted ) { + rfcommAssign.saveConfig(); + } +} + +/** * Add fresh found devices from scan dialog to the listing diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 743062c..a8ab3db 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h @@ -42,2 +42,4 @@ namespace OpieTooth { ~BlueBase(); + + static QString appName() { return QString::fromLatin1("bluetooth-manager"); } @@ -48,3 +50,4 @@ namespace OpieTooth { void startScan(); - + + private: @@ -91,2 +94,3 @@ namespace OpieTooth { void addSignalStrength( const QString& mac, const QString& strengh ); + void rfcommDialog(); diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui index 9ff970f..bb906a1 100644 --- a/noncore/net/opietooth/manager/bluetoothbase.ui +++ b/noncore/net/opietooth/manager/bluetoothbase.ui @@ -13,4 +13,4 @@ <y>0</y> - <width>224</width> - <height>320</height> + <width>258</width> + <height>407</height> </rect> @@ -27,368 +27,416 @@ </property> - <vbox> + <widget> + <class>QTabWidget</class> <property stdset="1"> - <name>margin</name> - <number>0</number> + <name>name</name> + <cstring>Status</cstring> </property> <property stdset="1"> - <name>spacing</name> - <number>0</number> + <name>geometry</name> + <rect> + <x>1</x> + <y>1</y> + <width>245</width> + <height>289</height> + </rect> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> </property> <widget> - <class>QTabWidget</class> + <class>QWidget</class> <property stdset="1"> <name>name</name> - <cstring>Status</cstring> - </property> - <property> - <name>layoutMargin</name> - </property> - <property> - <name>layoutSpacing</name> + <cstring>tab</cstring> </property> - <widget> - <class>QWidget</class> + <attribute> + <name>title</name> + <string>Devices</string> + </attribute> + <vbox> <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> + <name>margin</name> + <number>2</number> </property> - <attribute> - <name>title</name> - <string>Devices</string> - </attribute> - <vbox> + <property stdset="1"> + <name>spacing</name> + <number>2</number> + </property> + <widget> + <class>QListView</class> + <column> + <property> + <name>text</name> + <string>Device Name</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> + <column> + <property> + <name>text</name> + <string>Online</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> <property stdset="1"> - <name>margin</name> - <number>2</number> + <name>name</name> + <cstring>ListView2</cstring> </property> + </widget> + <widget> + <class>QPushButton</class> <property stdset="1"> - <name>spacing</name> - <number>2</number> + <name>name</name> + <cstring>PushButton2</cstring> </property> - <widget> - <class>QListView</class> - <column> - <property> - <name>text</name> - <string>Device Name</string> - </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> - </property> - </column> - <column> - <property> - <name>text</name> - <string>Online</string> - </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> - </property> - </column> - <property stdset="1"> - <name>name</name> - <cstring>ListView2</cstring> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>text</name> + <string>Scan for Devices</string> + </property> + </widget> + </vbox> + </widget> + <widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>tab</cstring> + </property> + <attribute> + <name>title</name> + <string>Connections</string> + </attribute> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>2</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>2</number> + </property> + <widget> + <class>QListView</class> + <column> + <property> + <name>text</name> + <string>Device Name</string> </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>PushButton2</cstring> + <property> + <name>clickable</name> + <bool>true</bool> </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - </sizepolicy> + <property> + <name>resizeable</name> + <bool>true</bool> </property> - <property stdset="1"> + </column> + <column> + <property> <name>text</name> - <string>Scan for Devices</string> + <string>Connection type</string> </property> - </widget> - </vbox> - </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> - </property> - <attribute> - <name>title</name> - <string>Connections</string> - </attribute> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>2</number> - </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> + <column> + <property> + <name>text</name> + <string>Signal</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> <property stdset="1"> - <name>spacing</name> - <number>2</number> + <name>name</name> + <cstring>ListView4</cstring> </property> - <widget> - <class>QListView</class> - <column> - <property> - <name>text</name> - <string>Device Name</string> - </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> - </property> - </column> - <column> - <property> - <name>text</name> - <string>Connection type</string> - </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> - </property> - </column> - <column> - <property> - <name>text</name> - <string>Signal</string> - </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> - </property> - </column> - <property stdset="1"> - <name>name</name> - <cstring>ListView4</cstring> - </property> - </widget> - </vbox> - </widget> - <widget> - <class>QWidget</class> + </widget> + </vbox> + </widget> + <widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>tab</cstring> + </property> + <attribute> + <name>title</name> + <string>Config</string> + </attribute> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>11</number> + </property> <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> + <name>spacing</name> + <number>6</number> </property> - <attribute> - <name>title</name> - <string>Config</string> - </attribute> - <vbox> + <widget> + <class>QGroupBox</class> <property stdset="1"> - <name>margin</name> - <number>2</number> + <name>name</name> + <cstring>GroupBox1</cstring> </property> <property stdset="1"> - <name>spacing</name> - <number>2</number> + <name>title</name> + <string>Bluetooh Basic Config</string> </property> - <widget> - <class>QLayoutWidget</class> + <vbox> <property stdset="1"> - <name>name</name> - <cstring>Layout2</cstring> + <name>margin</name> + <number>11</number> </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>deviceNameLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Device Name</string> - </property> - </widget> - <widget> - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>deviceNameLine</cstring> - </property> - </widget> - </hbox> - </widget> - <widget> - <class>QLayoutWidget</class> <property stdset="1"> - <name>name</name> - <cstring>Layout3</cstring> + <name>spacing</name> + <number>6</number> </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> + <widget> + <class>QLayoutWidget</class> <property stdset="1"> - <name>spacing</name> - <number>6</number> + <name>name</name> + <cstring>Layout7</cstring> </property> - <widget> - <class>QLabel</class> + <hbox> <property stdset="1"> - <name>name</name> - <cstring>passkeyLabel</cstring> + <name>margin</name> + <number>0</number> </property> <property stdset="1"> - <name>text</name> - <string>Default Passkey</string> + <name>spacing</name> + <number>6</number> </property> - </widget> - <widget> - <class>QLineEdit</class> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout6</cstring> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>deviceNameLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Device Name</string> + </property> + </widget> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>passkeyLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Default Passkey</string> + </property> + </widget> + </vbox> + </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout5</cstring> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>deviceNameLine</cstring> + </property> + </widget> + <widget> + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>passkeyLine</cstring> + </property> + <property stdset="1"> + <name>echoMode</name> + <enum>Password</enum> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout5</cstring> + </property> + <vbox> <property stdset="1"> - <name>name</name> - <cstring>passkeyLine</cstring> + <name>margin</name> + <number>0</number> </property> <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> + <name>spacing</name> + <number>6</number> </property> - </widget> - </hbox> - </widget> - <widget> - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout5</cstring> - </property> - <vbox> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>authCheckBox</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>enable authentification</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>cryptCheckBox</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>enable encryption</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>pagescanCheckBox</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Enable Page scan</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>inquiryscanCheckBox</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Enable Inquiry scan</string> + </property> + </widget> + </vbox> + </widget> + <widget> + <class>QPushButton</class> <property stdset="1"> - <name>margin</name> - <number>0</number> + <name>name</name> + <cstring>configApplyButton</cstring> </property> <property stdset="1"> - <name>spacing</name> - <number>6</number> + <name>text</name> + <string>Apply</string> </property> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>authCheckBox</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>enable authentification</string> - </property> - </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>cryptCheckBox</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>enable encryption</string> - </property> - </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>pagescanCheckBox</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Enable Page scan</string> - </property> - </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>inquiryscanCheckBox</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Enable Inquiry scan</string> - </property> - </widget> - </vbox> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>configApplyButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Apply</string> - </property> - </widget> - </vbox> - </widget> - <widget> - <class>QWidget</class> + </widget> + </vbox> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>rfcommBindButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Rfcomm Bind Table</string> + </property> + </widget> + </vbox> + </widget> + <widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>tab</cstring> + </property> + <attribute> + <name>title</name> + <string>Status</string> + </attribute> + <vbox> <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> + <name>margin</name> + <number>2</number> </property> - <attribute> - <name>title</name> - <string>Status</string> - </attribute> - <vbox> + <property stdset="1"> + <name>spacing</name> + <number>2</number> + </property> + <widget> + <class>QLabel</class> <property stdset="1"> - <name>margin</name> - <number>2</number> + <name>name</name> + <cstring>StatusLabel</cstring> </property> <property stdset="1"> - <name>spacing</name> - <number>2</number> + <name>text</name> + <string>Status Label</string> </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>StatusLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Status Label</string> - </property> - </widget> - </vbox> - </widget> + </widget> + </vbox> </widget> - </vbox> + </widget> </widget> diff --git a/noncore/net/opietooth/manager/main.cpp b/noncore/net/opietooth/manager/main.cpp index a86e36d..82aeebd 100644 --- a/noncore/net/opietooth/manager/main.cpp +++ b/noncore/net/opietooth/manager/main.cpp @@ -21,18 +21,5 @@ #include <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> - -QPEApplication *BluetoothApp; - -int main( int argc, char ** argv ) { - QPEApplication a(argc, argv); - BluetoothApp=&a; - - OpieTooth::BlueBase t; - - // t.setCaption( OpieTooth::BlueBase::tr("Bluetooth Manager") ); - a.showMainWidget(&t); - - return a.exec(); -} - +OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::BlueBase> ) diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index 9841740..6ff4ebb 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro @@ -1,4 +1,2 @@ -TEMPLATE = app -CONFIG = qt warn_on debug -#CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = btconnectionitem.h btdeviceitem.h \ @@ -9,4 +7,5 @@ HEADERS = btconnectionitem.h btdeviceitem.h \ pppdialog.h obexdialog.h \ + rfcommassigndialogimpl.h rfcommassigndialogitem.h \ devicehandler.h rfcpopup.h obexpopup.h \ - rfcommhelper.h panpopup.h dunpopup.h + rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h @@ -18,5 +17,6 @@ SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ bticonloader.cpp pppdialog.cpp \ + rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \ obexdialog.cpp devicehandler.cpp \ rfcpopup.cpp obexpopup.cpp \ - rfcommhelper.cpp panpopup.cpp dunpopup.cpp + rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp INCLUDEPATH += $(OPIEDIR)/include @@ -25,5 +25,5 @@ DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopietooth -lopie -INTERFACES = bluetoothbase.ui devicedialog.ui -DESTDIR = $(OPIEDIR)/bin -TARGET = bluetooth-manager +INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui rfcommdialogitembase.ui + +TARGET = bluetooth-manager diff --git a/noncore/net/opietooth/manager/rfcommassigndialogbase.ui b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui new file mode 100644 index 0000000..aefa698 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui @@ -0,0 +1,44 @@ +<!DOCTYPE UI><UI> +<class>RfcommAssignDialogBase</class> +<widget> + <class>QDialog</class> + <property stdset="1"> + <name>name</name> + <cstring>RfcommAssignDialogBase</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>444</width> + <height>343</height> + </rect> + </property> + <property stdset="1"> + <name>caption</name> + <string>Rfcomm Bind</string> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>11</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Bind device to a interface</string> + </property> + </widget> + </vbox> +</widget> +</UI> diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp new file mode 100644 index 0000000..b5cc074 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp @@ -0,0 +1,120 @@ + +#include "rfcommassigndialogimpl.h" +#include "rfcommassigndialogitem.h" +#include "rfcommconfhandler.h" + +#include <qpe/config.h> + +#include <qlayout.h> + +using namespace OpieTooth; + +// TODO: write only the file in bluebase? +// muss rfcommd dann neu gestartet werden +// sollte rfcomm bind all nicht eh default config sein ( polled das? - d.h. sobald nen gerät in der nähe ist bindet es? + + +RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) + : RfcommAssignDialogBase( parent, name, modal, fl ) { + + m_range = 5; + + m_scrollView = new QScrollView( this ); + m_scrollView->setResizePolicy( QScrollView::AutoOneFit ); + m_scrollView->setHScrollBarMode( QScrollView::AlwaysOff ); + + RfcommAssignDialogBaseLayout->addWidget( m_scrollView ); + + m_box = new QVBox( m_scrollView->viewport() ); + m_scrollView->addChild( m_box ); + + confHandler = new RfCommConfHandler( "/etc/bluetooth/rfcomm.conf" ); + + loadConfig(); +} + +RfcommAssignDialog::~RfcommAssignDialog() { + if ( confHandler ) { + delete confHandler; + } +} + + +void RfcommAssignDialog::newDevice( const QString & mac ) { + + for ( int i = 0 ; i < m_range; i++ ) { + + QMap<QString, RfCommConfObject*>::Iterator it; + it = confHandler->foundEntries().find( QString("%1").arg( i ) ); + // make sure that rfcommX is not assigned yet + if ( it == confHandler->foundEntries().end() ) { + QDialog dialog( this, "newdevice", true, WStyle_ContextHelp ); + dialog.showMaximized(); + RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); + newDev->setIdent( i ); + newDev->setMac( mac ); + + if ( dialog.exec() == QDialog::Accepted ) { + RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); + m_itemList.insert( i , rfcomm ); + rfcomm->setIdent( i ); + rfcomm->setMac( mac ); + rfcomm->setChannel( newDev->channel() ); + rfcomm->setComment( newDev->comment() ); + qDebug( "New device set up" ); + } + } + } +} + +void RfcommAssignDialog::loadConfig() { + + //Config cfg( "bluetoothmanager-rfcommbind" ); + + for ( int i = 0 ; i < m_range; i++ ) { + // cfg.setGroup( QString("%1").arg( i ) ); + RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); + m_itemList.insert( i , rfcomm ); + rfcomm->setIdent( i ); + QMap<QString, RfCommConfObject*>::Iterator it; + it = confHandler->foundEntries().find( QString("%1").arg( i ) ); + if ( it != confHandler->foundEntries().end() ) { + qDebug( "Found key in foundEntries() " ); + rfcomm->setMac( it.data()->mac() ); + rfcomm->setChannel( it.data()->channel() ); + rfcomm->setComment( it.data()->comment() ); + } + /* Use rfcomm.conf directly for now + * rfcomm->setMac( cfg.readEntry( "mac", "" ) ); + * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) ); + * rfcomm->setComment( cfg.readEntry( "comment", "" ) ); + */ + } +} + + +void RfcommAssignDialog::saveConfig() { + + //Config cfg( "bluetoothmanager-rfcommbind" ); + + QMap< int, RfcommDialogItem*>::Iterator it; + + QMap< QString, RfCommConfObject*> outMap; + + for( it = m_itemList.begin(); it != m_itemList.end(); ++it ) { + + //cfg.setGroup( QString("%1").arg( it.key() ) ); + RfcommDialogItem *rfcomm = it.data(); + + + outMap.insert( QString( "%1").arg( it.key() ), new RfCommConfObject( it.key(), rfcomm->mac(), rfcomm->channel(), rfcomm->comment() ) ); + + + //cfg.writeEntry( "mac", rfcomm->mac() ); + //cfg.writeEntry( "channel", rfcomm->channel() ); + //cfg.writeEntry( "comment", rfcomm->comment() ); + } + + confHandler->save( outMap ); + +} diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.h b/noncore/net/opietooth/manager/rfcommassigndialogimpl.h new file mode 100644 index 0000000..9983632 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.h @@ -0,0 +1,39 @@ +#ifndef RFCOMMASSIGN +#define RFCOMMASSIGN + +#include "rfcommassigndialogbase.h" +#include "rfcommassigndialogitem.h" +#include "rfcommconfhandler.h" + +#include <qscrollview.h> +#include <qmap.h> +#include <qvbox.h> + +namespace OpieTooth { + + class RfcommAssignDialog: public RfcommAssignDialogBase { + + Q_OBJECT + + public: + + RfcommAssignDialog( QWidget* parent = 0, const char* name = 0,bool modal = 0, WFlags fl = 0 ); + ~RfcommAssignDialog(); + + void loadConfig(); + void saveConfig(); + + void newDevice( const QString & mac ); + + private: + QScrollView *m_scrollView; + // how many rfcomm devices are possible + int m_range; + QMap< int, RfcommDialogItem* > m_itemList; + QVBox *m_box; + RfCommConfHandler *confHandler; +}; + +} + +#endif diff --git a/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp new file mode 100644 index 0000000..1e7130f --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp @@ -0,0 +1,54 @@ + +#include "rfcommassigndialogitem.h" + +#include <qlineedit.h> +#include <qcombobox.h> +#include <qlabel.h> +#include <qgroupbox.h> + +using namespace OpieTooth; + + +RfcommDialogItem::RfcommDialogItem( QWidget* parent, const char* name, WFlags fl ) + : RfcommDialogItemBase( parent, name, fl ) { + +} + +RfcommDialogItem::~RfcommDialogItem() { +} + + +int RfcommDialogItem::ident() { + return m_ident; +} + +QString RfcommDialogItem::mac() { + return m_macAddress->text(); +} + +int RfcommDialogItem::channel() { + return m_channelDropdown->currentItem(); +} + +QString RfcommDialogItem::comment() { + return m_commentLine->text(); +} + +void RfcommDialogItem::setIdent( int ident ) { + m_ident = ident; + m_identLabel->setTitle( QString( "rfcomm%1").arg( ident ) ); +} + +void RfcommDialogItem::setMac( const QString &mac ) { + m_macAddress->setText( mac ); +} + +void RfcommDialogItem::setChannel( int channel ) { + m_channelDropdown->setCurrentItem( channel ); +} + +void RfcommDialogItem::setComment( const QString &comment ) { + m_commentLine->setText( comment ); +} + + diff --git a/noncore/net/opietooth/manager/rfcommassigndialogitem.h b/noncore/net/opietooth/manager/rfcommassigndialogitem.h new file mode 100644 index 0000000..34a794f --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogitem.h @@ -0,0 +1,40 @@ +#ifndef RFCOMMDIALOGITEM +#define RFCOMMDIALOGITEM + +#include "rfcommdialogitembase.h" + +#include <qwidget.h> + +namespace OpieTooth { + + class RfcommDialogItem : public RfcommDialogItemBase { + + Q_OBJECT + + public: + RfcommDialogItem( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~RfcommDialogItem(); + + // number if the rfcomm device + int ident(); + // devices mac address + QString mac(); + int channel(); + QString comment(); + + void setIdent( int ident ); + void setMac( const QString& mac ); + void setChannel( int channel ); + void setComment( const QString& comment ); + + private: + + + int m_ident; + +}; + + +} + +#endif diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.cpp b/noncore/net/opietooth/manager/rfcommconfhandler.cpp new file mode 100644 index 0000000..20453e8 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommconfhandler.cpp @@ -0,0 +1,114 @@ + +#include <qtextstream.h> + +#include "rfcommconfhandler.h" + + +using namespace OpieTooth; + +// move to lib + + +RfCommConfObject::RfCommConfObject( int number, QString mac, int channel, QString comment ) { + m_number = number; + m_mac = mac; + m_channel = channel; + m_comment = comment; + // m_foundEntries = 0; +} + +void RfCommConfObject::setNumber( int number ) { + m_number = number; +} + +void RfCommConfObject::setMac( QString mac ) { + m_mac = mac; +} + +void RfCommConfObject::setChannel( int channel ) { + m_channel = channel; +} + +void RfCommConfObject::setComment( QString comment ) { + m_comment = comment; +} + + +RfCommConfObject::~RfCommConfObject() { +} + + +RfCommConfHandler::RfCommConfHandler( const QString & filename ) { + + m_filename = filename; + load(); +} + +RfCommConfHandler::~RfCommConfHandler() { + +} + +void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) { + + QFile rfCommConf( "/tmp/test" ); + QTextStream outStream( &rfCommConf ); + if ( rfCommConf.open( IO_WriteOnly ) ) { + + QMap<QString, RfCommConfObject*>::Iterator it; + for( it = devices.begin(); it != devices.end(); ++it ) { + outStream << "rfcomm" + QString("%1").arg( it.data()->number() ) + " {\n"; + outStream << " device " + it.data()->mac() + ";\n"; + outStream << " channel " + QString( "%1" ).arg( it.data()->channel() ) + ";\n"; + outStream << " comment \"" + it.data()->comment() + "\";\n"; + outStream << "}\n\n"; + } + + rfCommConf.close(); + } +} + + +QMap<QString, RfCommConfObject*> RfCommConfHandler::foundEntries() { + return m_foundEntries; +} + +void RfCommConfHandler::load() { + + QFile rfCommConf( m_filename ); + if ( rfCommConf.open( IO_ReadOnly ) ) { + + QStringList list; + QTextStream inStream( &rfCommConf ); + list = QStringList::split( "\n", inStream.read() ); + + QString number; + QString mac; + QString channel; + QString comment; + + for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) { + + QString tmpLine = ( *line ).stripWhiteSpace(); + + if ( tmpLine.startsWith("rfcomm") ) { + QString number = tmpLine.mid( 6,1 ); + qDebug( tmpLine ); + qDebug( "TEST " + number ); + } else if ( tmpLine.startsWith( "}" ) ) { + m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) ); + } else if ( tmpLine.startsWith( "device" ) ) { + mac = tmpLine.mid( 7, 17 ); + qDebug( "mac" + mac ); + } else if ( tmpLine.startsWith( "channel" ) ) { + channel = tmpLine.mid( 8, 1 ); + qDebug ( "Channel :" + channel ); + } else if ( tmpLine.startsWith( "comment" ) ) { + comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 ); + qDebug( "Comment: " + comment ); + } + } + rfCommConf.close(); + } + save( m_foundEntries ); + qDebug( QString( "ENTries: %1").arg( m_foundEntries.count() ) ); +} diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.h b/noncore/net/opietooth/manager/rfcommconfhandler.h new file mode 100644 index 0000000..e13c833 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommconfhandler.h @@ -0,0 +1,54 @@ +#ifndef RFCOMMCONFHANDLER +#define RFCOMMCONFHANDLER + +#include <qstring.h> +#include <qfile.h> +#include <qobject.h> +#include <qmap.h> + +namespace OpieTooth { + + class RfCommConfObject { + + public: + RfCommConfObject( int number, QString mac, int channel, QString comment ); + ~RfCommConfObject(); + + void setNumber( int number ); + int number() { return m_number; }; + void setMac( QString mac ); + QString mac() { return m_mac; }; + void setChannel( int channel ); + int channel() { return m_channel; }; + void setComment( QString comment ); + QString comment() { return m_comment; }; + + + private: + int m_number; + QString m_mac; + int m_channel; + QString m_comment; + + }; + + class RfCommConfHandler { + + public: + RfCommConfHandler( const QString & filename ); + ~RfCommConfHandler(); + + void save( QMap<QString, RfCommConfObject*> devices ); + + QMap<QString, RfCommConfObject*> foundEntries(); + + private: + void load(); + + QString m_filename; + QMap<QString, RfCommConfObject*> m_foundEntries; + }; + +} + +#endif diff --git a/noncore/net/opietooth/manager/rfcommdialogitembase.ui b/noncore/net/opietooth/manager/rfcommdialogitembase.ui new file mode 100644 index 0000000..dafca52 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommdialogitembase.ui @@ -0,0 +1,216 @@ +<!DOCTYPE UI><UI> +<class>RfcommDialogItemBase</class> +<widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>RfcommDialogItemBase</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>345</width> + <height>95</height> + </rect> + </property> + <property stdset="1"> + <name>caption</name> + <string>Form2</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>0</number> + </property> + <widget> + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>m_identLabel</cstring> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>5</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>5</number> + </property> + <widget row="0" column="0" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout3</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel4</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Mac</string> + </property> + </widget> + <widget> + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>m_macAddress</cstring> + </property> + </widget> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel5</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Channel</string> + </property> + </widget> + <widget> + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>0</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>1</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>2</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>3</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>4</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>5</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>6</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>7</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>8</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>9</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>10</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>m_channelDropdown</cstring> + </property> + </widget> + </hbox> + </widget> + <widget row="1" column="0" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout4</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel3</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Comment:</string> + </property> + </widget> + <widget> + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>m_commentLine</cstring> + </property> + </widget> + </hbox> + </widget> + </grid> + </widget> + </vbox> +</widget> +</UI> diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp index cc87b6c..d95f14b 100644 --- a/noncore/net/opietooth/manager/rfcpopup.cpp +++ b/noncore/net/opietooth/manager/rfcpopup.cpp @@ -5,2 +5,3 @@ #include "rfcpopup.h" +#include "rfcommassigndialogimpl.h" @@ -11,3 +12,3 @@ using namespace OpieTooth; */ -RfcCommPopup::RfcCommPopup() +RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { @@ -17,2 +18,5 @@ RfcCommPopup::RfcCommPopup() + + m_item = item; + /* connect action */ @@ -35,6 +39,6 @@ RfcCommPopup::RfcCommPopup() a = new QAction( ); - a->setText("Foo"); + a->setText("Bind table"); a->addTo( this ); connect( a, SIGNAL( activated() ), - this, SLOT( slotFoo() ) ); + this, SLOT( slotBind() ) ); @@ -76,4 +80,11 @@ void RfcCommPopup::slotDisconnect() { -void RfcCommPopup::slotFoo() { - qWarning("slotFoo"); +void RfcCommPopup::slotBind() { + RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); + + rfcommAssign.showMaximized(); + rfcommAssign.newDevice( m_item->mac() ); + + if ( rfcommAssign.exec() == QDialog::Accepted ) { + rfcommAssign.saveConfig(); + } } diff --git a/noncore/net/opietooth/manager/rfcpopup.h b/noncore/net/opietooth/manager/rfcpopup.h index c388f65..74b9117 100644 --- a/noncore/net/opietooth/manager/rfcpopup.h +++ b/noncore/net/opietooth/manager/rfcpopup.h @@ -6,2 +6,4 @@ +#include "btdeviceitem.h" + namespace OpieTooth { @@ -18,3 +20,3 @@ namespace OpieTooth { public: - RfcCommPopup(); + RfcCommPopup( OpieTooth::BTDeviceItem* ); ~RfcCommPopup(); @@ -25,4 +27,5 @@ namespace OpieTooth { QAction* m_dis; - QAction* m_foo; + QAction* m_bind; QAction* m_bar; + OpieTooth::BTDeviceItem *m_item; private slots: @@ -30,3 +33,3 @@ namespace OpieTooth { void slotDisconnect(); - void slotFoo(); + void slotBind(); void slotBar(); diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp index 38b8ee7..e1f8396 100644 --- a/noncore/net/opietooth/manager/stdpopups.cpp +++ b/noncore/net/opietooth/manager/stdpopups.cpp @@ -11,3 +11,3 @@ extern "C" { QPopupMenu* newRfcComPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { - return new OpieTooth::RfcCommPopup(/* servive, item*/ ); // fix spellin RfComm vs. RfcComm and paramaters + return new OpieTooth::RfcCommPopup(/* servive,*/ item ); // fix spellin RfComm vs. RfcComm and paramaters //return 0l; diff --git a/noncore/net/ubrowser/main.cpp b/noncore/net/ubrowser/main.cpp index e4a873d..0488cfd 100644 --- a/noncore/net/ubrowser/main.cpp +++ b/noncore/net/ubrowser/main.cpp @@ -20,10 +20,5 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -int main( int argc, char **argv ) -{ - QPEApplication a( argc, argv ); - MainView w; - -// a.setMainWidget( &w ); - a.showMainDocumentWidget( &w ); - return a.exec(); -} +#include <opie/oapplicationfactory.h> + +OPIE_EXPORT_APP( OApplicationFactory<MainView> ) + diff --git a/noncore/net/ubrowser/mainview.cpp b/noncore/net/ubrowser/mainview.cpp index 9302f05..0d3f171 100644 --- a/noncore/net/ubrowser/mainview.cpp +++ b/noncore/net/ubrowser/mainview.cpp @@ -19,3 +19,3 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -MainView::MainView(QWidget *parent, const char *name) : QMainWindow(parent, name) +MainView::MainView(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, fl) { diff --git a/noncore/net/ubrowser/mainview.h b/noncore/net/ubrowser/mainview.h index 20e2c70..cc63729 100644 --- a/noncore/net/ubrowser/mainview.h +++ b/noncore/net/ubrowser/mainview.h @@ -38,3 +38,4 @@ class MainView : public QMainWindow public: - MainView(QWidget *parent=0, const char *name=0); + static QString appName() { return QString::fromLatin1("ubrowser"); } + MainView(QWidget *parent=0, const char *name=0, WFlags fl = 0); public slots: diff --git a/noncore/net/ubrowser/ubrowser.pro b/noncore/net/ubrowser/ubrowser.pro index a6943dd..ed00047 100644 --- a/noncore/net/ubrowser/ubrowser.pro +++ b/noncore/net/ubrowser/ubrowser.pro @@ -1,4 +1,2 @@ -TEMPLATE =app -CONFIG +=qt warn_on release -DESTDIR =../../../bin +CONFIG +=qt warn_on release quick-app HEADERS = mainview.h httpfactory.h diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 90664bb..8359acf 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp @@ -44,6 +44,6 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) -{ +{ emailHandler = new EmailHandler(); addressList = new AddressList(); - + sending = FALSE; @@ -54,9 +54,9 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) allAccounts = FALSE; - + init(); - - - + + + connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); - + connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this, @@ -65,6 +65,6 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) SLOT(popError(int,const QString &)) ); - + connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); - + connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); @@ -76,3 +76,3 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) SLOT(allMailArrived(int)) ); - + mailconf = new Config("mailit"); @@ -81,5 +81,5 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) readSettings(); - + updateAccounts(); - + lineShift = "\n"; @@ -87,5 +87,5 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) lineShift = "\r\n"; - + mailboxView->setCurrentTab(0); //ensure that inbox has focus - + /*channel = new QCopChannel( "QPE/Application/mailit", this ); @@ -106,6 +106,6 @@ EmailClient::~EmailClient() saveSettings(); - + mailconf->write(); delete mailconf; - + } @@ -115,5 +115,5 @@ void EmailClient::init() initStatusBar(this); - + setToolBarsMovable(FALSE); - + bar = new QToolBar(this); @@ -129,3 +129,3 @@ void EmailClient::init() mb->insertItem( tr( "Accounts" ), configure); - + selectAccountMenu = new QPopupMenu(mb); @@ -144,3 +144,3 @@ void EmailClient::init() getMailButton->setPopup(selectAccountMenu); - + sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); @@ -150,3 +150,3 @@ void EmailClient::init() sendMailButton->setWhatsThis("Send mail queued in the outbox"); - + composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); @@ -156,3 +156,3 @@ void EmailClient::init() composeButton->setWhatsThis("Compose a new mail"); - + cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); @@ -163,4 +163,4 @@ void EmailClient::init() cancelButton->setWhatsThis("Stop the currently active mail transfer"); - - + + deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); @@ -169,3 +169,3 @@ void EmailClient::init() deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); - + mailboxView = new OTabWidget( this, "mailboxView" ); @@ -207,5 +207,5 @@ void EmailClient::init() mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); - + setCentralWidget(mailboxView); - + } @@ -216,3 +216,3 @@ void EmailClient::initStatusBar(QWidget* parent) statusBar->setSizeGripEnabled(FALSE); - + status1Label = new QLabel( tr("Idle"), statusBar); @@ -223,3 +223,3 @@ void EmailClient::initStatusBar(QWidget* parent) status2Label, SLOT(setText(const QString &)) ); - + progressBar = new QProgressBar(statusBar); @@ -262,3 +262,3 @@ void EmailClient::enqueMail(const Email &mail) } - + if (accountList.count() > 0) { @@ -267,3 +267,3 @@ void EmailClient::enqueMail(const Email &mail) } - + Email addMail = mail; @@ -273,5 +273,5 @@ void EmailClient::enqueMail(const Email &mail) item = new EmailListItem(outboxView, addMail, false); - + mailboxView->setCurrentTab(1); - + } @@ -283,3 +283,3 @@ void EmailClient::sendQuedMail() if (accountList.count() == 0) { - QMessageBox::warning(qApp->activeWindow(), "No account selected", "You must create an account", "OK\n"); + QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n"); return; @@ -315,3 +315,3 @@ void EmailClient::mailSent() sendMailButton->setEnabled(TRUE); - + quedMessages.clear(); @@ -321,11 +321,11 @@ void EmailClient::mailSent() void EmailClient::getNewMail() { - + if (accountList.count() == 0) { - QMessageBox::warning(qApp->activeWindow(),"No account selected", - "You must create an account", "OK\n"); + QMessageBox::warning(qApp->activeWindow(),tr("No account selected"), + tr("You must create an account"), "OK\n"); return; } - + setMailAccount(); - + receiving = TRUE; @@ -335,6 +335,6 @@ void EmailClient::getNewMail() { selectAccountMenu->setEnabled(FALSE); - + status1Label->setText(currentAccount->accountName + " headers"); progressBar->reset(); - + //get any previous mails not downloaded and add to queue @@ -350,5 +350,5 @@ void EmailClient::getNewMail() { }*/ - + emailHandler->getMailHeaders(); - + } @@ -359,3 +359,3 @@ void EmailClient::getAllNewMail() currentAccount = accountList.first(); - getNewMail(); + getNewMail(); } @@ -369,6 +369,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailconf->setGroup(newMail.id); - - if (fromDisk) + + if (fromDisk) { - + newMail.downloaded = mailconf->readBoolEntry("downloaded"); @@ -377,6 +377,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); - } - else + } + else { //mail arrived from server - + newMail.serverId = mail.serverId; @@ -384,3 +384,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) newMail.downloaded = mail.downloaded; - + newMail.fromAccountId = emailHandler->getAccount()->id; @@ -388,6 +388,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) } - + //add if read or not newMail.read = mailconf->readBoolEntry("mailread"); - + //check if new mail @@ -396,3 +396,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailIdCount++; - + //set server count, so that if the user aborts, the new @@ -401,3 +401,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) currentAccount->lastServerMailCount++; - + mailconf->writeEntry("internalmailid", thisMailId); @@ -406,8 +406,8 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailconf->writeEntry("serverid", newMail.serverId); - + //addressList->addContact(newMail.fromMail, newMail.from); } - + mailconf->writeEntry("downloaded", newMail.downloaded); - + QString stringMailId; @@ -415,3 +415,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) //see if any attatchments needs to be stored - + for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { @@ -419,3 +419,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) stringId.setNum(ePtr->id); - + int id = mailconf->readNumEntry("enclosureid_" + stringId); @@ -428,3 +428,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailconf->writeEntry("installed_" + stringId, FALSE); - + ePtr->name = stringMailId + "_" + stringId; @@ -446,3 +446,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) ePtr->path = mailconf->readEntry("path_" + stringId); - } + } } @@ -451,9 +451,9 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) bool found=false; - - if (!fromDisk) + + if (!fromDisk) { - + Email *mailPtr; item = (EmailListItem *) inboxView->firstChild(); - while ((item != NULL)&&(!found)) + while ((item != NULL)&&(!found)) { @@ -474,8 +474,8 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) // item->setPixmap(0, Resource::loadPixmap("mailit/attach")); -// } +// } /*if (!newMail.downloaded) mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ - + mailboxView->setCurrentTab(0); - + } @@ -497,3 +497,3 @@ void EmailClient::allMailArrived(int /*count*/) status1Label->setText("Idle"); - + progressBar->reset(); @@ -502,3 +502,3 @@ void EmailClient::allMailArrived(int /*count*/) //} - + // all headers downloaded from server, start downloading remaining mails @@ -508,3 +508,3 @@ void EmailClient::allMailArrived(int /*count*/) - + mailboxView->setCurrentTab(0); @@ -523,3 +523,3 @@ void EmailClient::smtpError(int code, const QString & Msg) QString temp; - + if (code == ErrUnknownResponse) { @@ -535,3 +535,3 @@ void EmailClient::smtpError(int code, const QString & Msg) } - + if (code != ErrCancel) { @@ -541,3 +541,3 @@ void EmailClient::smtpError(int code, const QString & Msg) } - + sending = FALSE; @@ -551,3 +551,3 @@ void EmailClient::popError(int code, const QString & Msg) QString temp; - + if (code == ErrUnknownResponse) { @@ -564,3 +564,3 @@ void EmailClient::popError(int code, const QString & Msg) temp = tr("<qt>socket packet error</qt>"); - } + } @@ -572,3 +572,3 @@ void EmailClient::popError(int code, const QString & Msg) } - + receiving = FALSE; @@ -582,3 +582,3 @@ void EmailClient::inboxItemSelected() //killTimer(timerID); - + item = (EmailListItem*) inboxView->selectedItem(); @@ -592,3 +592,3 @@ void EmailClient::outboxItemSelected() //killTimer(timerID); - + item = (EmailListItem*) outboxView->selectedItem(); @@ -607,3 +607,3 @@ void EmailClient::readMail() QFile f(getPath(FALSE) + "inbox.txt"); - + if ( f.open(IO_ReadOnly) ) { // file opened successfully @@ -612,3 +612,3 @@ void EmailClient::readMail() f.close(); - + start = 0; @@ -619,3 +619,3 @@ void EmailClient::readMail() stop = s.length() - del.length(); - + mail.rawMail = s.mid(start, stop + del.length() - start ); @@ -625,3 +625,3 @@ void EmailClient::readMail() } - + QFile fo(getPath(FALSE) + "outbox.txt"); @@ -631,3 +631,3 @@ void EmailClient::readMail() fo.close(); - + start = 0; @@ -638,3 +638,3 @@ void EmailClient::readMail() stop = s.length() - del.length(); - + mail.rawMail = s.mid(start, stop + del.length() - start ); @@ -645,3 +645,3 @@ void EmailClient::readMail() enqueMail(mail); - + } @@ -654,3 +654,3 @@ void EmailClient::saveMail(const QString &fileName, QListView *view) Email *mail; - + if (! f.open(IO_WriteOnly) ) { @@ -664,6 +664,6 @@ void EmailClient::saveMail(const QString &fileName, QListView *view) t << mail->rawMail; - + mailconf->setGroup(mail->id); mailconf->writeEntry("mailread", mail->read); - + item = (EmailListItem *) item->nextSibling(); @@ -678,3 +678,3 @@ QString EmailClient::getPath(bool enclosurePath) QString enclosures = "enclosures"; - + QDir dir = (QString(getenv("HOME")) + "/Applications/" + basePath); @@ -682,11 +682,11 @@ QString EmailClient::getPath(bool enclosurePath) dir.mkdir( dir.path() ); - + if (enclosurePath) { dir = (QString(getenv("HOME")) + "/Applications/" + basePath + "/" + enclosures); - + if ( !dir.exists() ) dir.mkdir( dir.path() ); - + return (dir.path() + "/"); - + } @@ -698,9 +698,9 @@ void EmailClient::readSettings() int y,acc_count; - + mailconf->setGroup("mailitglobal"); acc_count=mailconf->readNumEntry("Accounts",0); - - for (int accountPos = 0;accountPos<acc_count ; accountPos++) + + for (int accountPos = 0;accountPos<acc_count ; accountPos++) { - mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... + mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... account.accountName = mailconf->readEntry("AccName",""); @@ -716,3 +716,3 @@ void EmailClient::readSettings() account.synchronize = FALSE; - + account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); @@ -720,11 +720,11 @@ void EmailClient::readSettings() { - mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); + mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); } - + accountList.append(&account); } - + mailconf->setGroup("mailitglobal"); - - if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) + + if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) { @@ -732,3 +732,3 @@ void EmailClient::readSettings() } - if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) + if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) { @@ -743,4 +743,4 @@ void EmailClient::saveSettings() - - if (!mailconf) + + if (!mailconf) { @@ -749,5 +749,5 @@ void EmailClient::saveSettings() } - + for (accountPtr = accountList.first(); accountPtr != 0; - accountPtr = accountList.next()) + accountPtr = accountList.next()) { @@ -762,3 +762,3 @@ void EmailClient::saveSettings() mailconf->writeEntry("AccountId",accountPtr->id); - if (accountPtr->synchronize) + if (accountPtr->synchronize) { @@ -767,4 +767,4 @@ void EmailClient::saveSettings() mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); - } - else + } + else { @@ -773,3 +773,3 @@ void EmailClient::saveSettings() } - + mailconf->setGroup("mailitglobal"); @@ -787,3 +787,3 @@ void EmailClient::selectAccount(int id) } else { - emit newCaption("Mailit ! No account defined"); + emit newCaption( tr("Mailit ! No account defined") ); } @@ -794,3 +794,3 @@ void EmailClient::editAccount(int id) MailAccount *newAccount; - + editAccountView = new EditAccount(this, "account", TRUE); @@ -803,6 +803,6 @@ void EmailClient::editAccount(int id) } - + editAccountView->showMaximized(); editAccountView->exec(); - + if (editAccountView->result() == QDialog::Accepted) { @@ -817,3 +817,3 @@ void EmailClient::editAccount(int id) } - + delete editAccountView; @@ -825,8 +825,8 @@ void EmailClient::deleteAccount(int id) QString message; - + newAccount = accountList.at(id); - message = "Delete account:\n" + newAccount->accountName; + message = tr("Delete account:\n") + newAccount->accountName; switch( QMessageBox::warning( this, "Mailit", message, "Yes", "No", 0, 0, 1 ) ) { - + case 0: accountList.remove(id); @@ -842,3 +842,3 @@ void EmailClient::updateAccounts() MailAccount *accountPtr; - + //rebuild menus, clear all first @@ -848,6 +848,6 @@ void EmailClient::updateAccounts() - newAccountId = editAccountMenu->insertItem("New", this, + newAccountId = editAccountMenu->insertItem( tr("New"), this, SLOT(editAccount(int)) ); editAccountMenu->insertSeparator(); - + idCount = 0; @@ -855,3 +855,3 @@ void EmailClient::updateAccounts() accountPtr = accountList.next()) { - + editAccountMenu->insertItem(accountPtr->accountName, @@ -870,7 +870,7 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) Enclosure *ePtr; - - if (inbox) + + if (inbox) { mPtr = mailItem->getMail(); - + //if mail is in queue for download, remove it from @@ -881,6 +881,6 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) } - + mailconf->setGroup(mPtr->id); mailconf->clearGroup(); - + //delete any temporary attatchemnts storing @@ -892,4 +892,4 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) inboxView->takeItem(mailItem); - } - else + } + else { @@ -907,3 +907,3 @@ void EmailClient::setTotalSize(int /*size*/) { - + } @@ -925,10 +925,10 @@ void EmailClient::deleteItem() QListView* box; - + EmailListItem* eli; // int pos; - + inbox ? box=inboxView : box=outboxView; - + eli=(EmailListItem*)box->selectedItem(); - + if (eli) @@ -936,3 +936,3 @@ void EmailClient::deleteItem() box->setSelected(eli->itemBelow(),true); //select the previous item - + deleteMail(eli,(bool&)inbox); //remove mail entry @@ -954,8 +954,8 @@ void EmailClient::inboxItemReleased() //killTimer(timerID); - - + + QPopupMenu *action = new QPopupMenu(this); - + int reply=0; - + action->insertItem(tr( "Reply To" ),this,SLOT(reply())); @@ -964,7 +964,7 @@ void EmailClient::inboxItemReleased() action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); - + action->exec(QCursor::pos()); - + if (action) delete action; - + }*/ @@ -979,3 +979,3 @@ Email* EmailClient::getCurrentMail() } - + void EmailClient::download(Email* mail) @@ -983,9 +983,9 @@ void EmailClient::download(Email* mail) MailAccount* acc=0; - + tempMailDownloadList.clear(); tempMailDownloadList.sizeInsert(mail->serverId, mail->size); - + acc=accountList.at(mail->fromAccountId-1); if (acc) - { + { emailHandler->setAccount(*acc); @@ -993,3 +993,3 @@ void EmailClient::download(Email* mail) } - else + else QMessageBox::warning(qApp->activeWindow(), @@ -1004,5 +1004,5 @@ void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/) QVBoxLayout *vbProg = new QVBoxLayout( &qd ); - + initStatusBar(&qd); - + if (statusBar==0) @@ -1020,19 +1020,19 @@ void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/) else if (msg=="compose()") - { + { QDialog qd(qApp->activeWindow(),"Getting mail",true); - + WriteMail wm(&qd,"write new mail"); QVBoxLayout vbProg( &qd ); - + wm.showMaximized(); vbProg.addWidget(&wm); - + qd.showMaximized(); - + emit composeRequested(); qd.exec(); - + QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); } - + else if (msg=="dialog()") diff --git a/noncore/unsupported/mailit/emaillistitem.cpp b/noncore/unsupported/mailit/emaillistitem.cpp index fc9f766..a25f93a 100644 --- a/noncore/unsupported/mailit/emaillistitem.cpp +++ b/noncore/unsupported/mailit/emaillistitem.cpp @@ -27,5 +27,5 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) QString temp; - + mail = mailIn; - + if (inbox) { @@ -40,4 +40,5 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) setText(1, mail.subject); - setText(2,mail.date); - + // setText(2,mail.date); + setText(2,dateFromULCString(mail.date)); + if (mailIn.files.count()>0) @@ -46,3 +47,3 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) } - + selected = FALSE; @@ -84,3 +85,3 @@ void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, _cg.setColor( QColorGroup::Text, Qt::red); - + /* if (selected) { @@ -94,3 +95,3 @@ void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, } -*/ +*/ QListViewItem::paintCell( p, _cg, column, width, alignment ); @@ -99 +100,59 @@ void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, } + +/* + * Converts an E-Mail date (ULC) RFC 2822 conform to a QDateTime. + * Returning a QString with formatting of "YYYY-MM-DD HH:MM:SS" + * (zodiac: This method was tested with more than 300 inbox mails, + * it didn't slow down the loading of mail-it.) + */ +QString EmailListItem::dateFromULCString( QString ulcDate ) +{ + QString sTemp, sTime; + int iPos, iDay, iMon=1, iYear; + + iPos=ulcDate.find(','); + if (iPos) { // it has a day-of-week + ulcDate=ulcDate.remove(0,++iPos); //.stripWhiteSpace(); + } + + QStringList dateEntries = QStringList::split(" ",ulcDate,FALSE); + QStringList::Iterator iter = dateEntries.begin(); + + // Get day as DD + iDay = (*iter++).toInt(); + + // Get month as string Mmm + sTemp = (*iter++); + if (sTemp =="Jan") {iMon=1;} else + if (sTemp =="Feb") {iMon=2;} else + if (sTemp =="Mar") {iMon=3;} else + if (sTemp =="Apr") {iMon=4;} else + if (sTemp =="May") {iMon=5;} else + if (sTemp =="Jun") {iMon=6;} else + if (sTemp =="Jul") {iMon=7;} else + if (sTemp =="Aug") {iMon=8;} else + if (sTemp =="Sep") {iMon=9;} else + if (sTemp =="Oct") {iMon=10;} else + if (sTemp =="Nov") {iMon=11;} else + if (sTemp =="Dec") {iMon=12;} + + // Get year as YYYY or YY + iYear = (*iter++).toInt(); + + QDate date = QDate(iYear, iMon, iDay); + + // Convert timestring into a QTime + QStringList timeEntries = QStringList::split(":",(*iter++),FALSE); + QStringList::Iterator iterTime = timeEntries.begin(); + iYear=(*iterTime++).toInt(); // var reuse.. *cough* + iMon=(*iterTime++).toInt(); + iDay=(*iterTime++).toInt(); + QTime time = QTime(iYear,iMon,iDay); + + return QString::number(date.year())+"-" + +QString::number(date.month()).rightJustify(2,'0')+"-" + +QString::number(date.day()).rightJustify(2,'0')+" " + +time.toString(); +} + + diff --git a/noncore/unsupported/mailit/emaillistitem.h b/noncore/unsupported/mailit/emaillistitem.h index 642932c..129a774 100644 --- a/noncore/unsupported/mailit/emaillistitem.h +++ b/noncore/unsupported/mailit/emaillistitem.h @@ -34,3 +34,3 @@ public: bool itemSelected(); - + protected: @@ -41,2 +41,3 @@ private: bool selected; + QString dateFromULCString( QString ulc ); }; diff --git a/noncore/unsupported/mailit/mailit.pro b/noncore/unsupported/mailit/mailit.pro index 5e9a83a..0224886 100644 --- a/noncore/unsupported/mailit/mailit.pro +++ b/noncore/unsupported/mailit/mailit.pro @@ -1,4 +1,3 @@ -TEMPLATE = app TARGET = mailit -CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = emailclient.h \ @@ -39,5 +38,2 @@ LIBS += -lqpe -lopie # -lssl -MOC_DIR=qpeobj -OBJECTS_DIR=qpeobj -DESTDIR=$(OPIEDIR)/bin diff --git a/noncore/unsupported/mailit/mailitwindow.h b/noncore/unsupported/mailit/mailitwindow.h index e818d32..11e56b9 100644 --- a/noncore/unsupported/mailit/mailitwindow.h +++ b/noncore/unsupported/mailit/mailitwindow.h @@ -35,2 +35,3 @@ class MailItWindow: public QMainWindow public: + static QString appName() { return QString::fromLatin1("mailit"); } MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); diff --git a/noncore/unsupported/mailit/main.cpp b/noncore/unsupported/mailit/main.cpp index 3a3e1fc..71f8877 100644 --- a/noncore/unsupported/mailit/main.cpp +++ b/noncore/unsupported/mailit/main.cpp @@ -22,8 +22,4 @@ -int main(int argc, char* argv[]) -{ - QPEApplication a( argc, argv ); - MailItWindow mw(0, 0); - a.showMainDocumentWidget(&mw); - return a.exec(); -} +#include <opie/oapplicationfactory.h> + +OPIE_EXPORT_APP( OApplicationFactory<MailItWindow> )
\ No newline at end of file |