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, 982 insertions, 147 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 @@ -188,234 +188,234 @@ void EmailClient::init() "mailhas attachments.\n")); grid_2->addWidget( inboxView, 2, 0 ); mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); grid_3 = new QGridLayout( widget_2 ); // grid_3->setSpacing(6); // grid_3->setMargin( 11 ); outboxView = new QListView( widget_2, "outboxView" ); outboxView->addColumn( tr( "To" ) ); outboxView->addColumn( tr( "Subject" ) ); outboxView->setAllColumnsShowFocus(TRUE); QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" "It keeps the queued mails to send which can be \n" "reviewed by double clicking the entry.")); grid_3->addWidget( outboxView, 0, 0 ); mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); setCentralWidget(mailboxView); } void EmailClient::initStatusBar(QWidget* parent) { statusBar = new QStatusBar(parent); statusBar->setSizeGripEnabled(FALSE); status1Label = new QLabel( tr("Idle"), statusBar); status2Label = new QLabel("", statusBar); connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), status2Label, SLOT(setText(const QString &)) ); connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), status2Label, SLOT(setText(const QString &)) ); progressBar = new QProgressBar(statusBar); connect(emailHandler, SIGNAL(mailboxSize(int)), this, SLOT(setTotalSize(int)) ); connect(emailHandler, SIGNAL(currentMailSize(int)), this, SLOT(setMailSize(int)) ); connect(emailHandler, SIGNAL(downloadedSize(int)), this, SLOT(setDownloadedSize(int)) ); statusBar->addWidget(status1Label); statusBar->addWidget(progressBar); statusBar->addWidget(status2Label); } void EmailClient::compose() { emit composeRequested(); } void EmailClient::cancel() { emailHandler->cancel(); } AddressList* EmailClient::getAdrListRef() { return addressList; } //this needs to be rewritten to syncronize with outboxView void EmailClient::enqueMail(const Email &mail) { if (accountList.count() == 0) { QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n"); return; } if (accountList.count() > 0) { currentAccount = accountList.first(); qWarning("using account " + currentAccount->name); } Email addMail = mail; addMail.from = currentAccount->name; addMail.fromMail = currentAccount->emailAddress; addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n"); item = new EmailListItem(outboxView, addMail, false); mailboxView->setCurrentTab(1); } void EmailClient::sendQuedMail() { int count = 0; 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; } //traverse listview, find messages to send if (! sending) { item = (EmailListItem *) outboxView->firstChild(); if (item != NULL) { while (item != NULL) { quedMessages.append(item->getMail()); item = (EmailListItem *) item->nextSibling(); count++; } setMailAccount(); emailHandler->sendMail(&quedMessages); sending = TRUE; sendMailButton->setEnabled(FALSE); cancelButton->setEnabled(TRUE); } else { qWarning("sendQuedMail(): no messages to send"); } } } void EmailClient::setMailAccount() { emailHandler->setAccount(*currentAccount); } void EmailClient::mailSent() { sending = FALSE; sendMailButton->setEnabled(TRUE); quedMessages.clear(); outboxView->clear(); //should be moved to an sentBox } 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; previewingMail = TRUE; getMailButton->setEnabled(FALSE); cancelButton->setEnabled(TRUE); selectAccountMenu->setEnabled(FALSE); status1Label->setText(currentAccount->accountName + " headers"); progressBar->reset(); //get any previous mails not downloaded and add to queue /*mailDownloadList.clear(); Email *mailPtr; item = (EmailListItem *) inboxView->firstChild(); while (item != NULL) { mailPtr = item->getMail(); if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); } item = (EmailListItem *) item->nextSibling(); }*/ emailHandler->getMailHeaders(); } void EmailClient::getAllNewMail() { allAccounts = TRUE; currentAccount = accountList.first(); getNewMail(); } void EmailClient::mailArrived(const Email &mail, bool fromDisk) { Enclosure *ePtr; Email newMail; int thisMailId; emailHandler->parse( mail.rawMail, lineShift, &newMail); mailconf->setGroup(newMail.id); if (fromDisk) { newMail.downloaded = mailconf->readBoolEntry("downloaded"); newMail.size = mailconf->readNumEntry("size"); newMail.serverId = mailconf->readNumEntry("serverid"); newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); } else { //mail arrived from server newMail.serverId = mail.serverId; newMail.size = mail.size; newMail.downloaded = mail.downloaded; newMail.fromAccountId = emailHandler->getAccount()->id; mailconf->writeEntry("fromaccountid", newMail.fromAccountId); } //add if read or not newMail.read = mailconf->readBoolEntry("mailread"); //check if new mail if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { thisMailId = mailIdCount; mailIdCount++; //set server count, so that if the user aborts, the new //header is not reloaded if ((currentAccount)&&(currentAccount->synchronize)) currentAccount->lastServerMailCount++; mailconf->writeEntry("internalmailid", thisMailId); mailconf->writeEntry("downloaded", newMail.downloaded); mailconf->writeEntry("size", (int) newMail.size); mailconf->writeEntry("serverid", newMail.serverId); //addressList->addContact(newMail.fromMail, newMail.from); } mailconf->writeEntry("downloaded", newMail.downloaded); QString stringMailId; stringMailId.setNum(thisMailId); //see if any attatchments needs to be stored for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { QString stringId; stringId.setNum(ePtr->id); int id = mailconf->readNumEntry("enclosureid_" + stringId); @@ -692,254 +692,254 @@ QString EmailClient::getPath(bool enclosurePath) } return (dir.path() + "/"); } void EmailClient::readSettings() { int y,acc_count; mailconf->setGroup("mailitglobal"); acc_count=mailconf->readNumEntry("Accounts",0); for (int accountPos = 0;accountPos<acc_count ; accountPos++) { mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... account.accountName = mailconf->readEntry("AccName",""); account.name = mailconf->readEntry("UserName",""); account.emailAddress = mailconf->readEntry("Email",""); account.popUserName = mailconf->readEntry("POPUser",""); account.popPasswd = mailconf->readEntryCrypt("POPPassword",""); account.popServer = mailconf->readEntry("POPServer",""); account.smtpServer = mailconf->readEntry("SMTPServer",""); account.id = mailconf->readNumEntry("AccountId",0); account.syncLimit = mailconf->readNumEntry("HeaderLimit",0); account.lastServerMailCount = 0; account.synchronize = FALSE; account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); if (account.synchronize) { mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); } accountList.append(&account); } mailconf->setGroup("mailitglobal"); if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) { mailIdCount = y; } if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) { accountIdCount = y; } } void EmailClient::saveSettings() { int acc_count=0; MailAccount *accountPtr; if (!mailconf) { qWarning("could not save settings"); return; } for (accountPtr = accountList.first(); accountPtr != 0; accountPtr = accountList.next()) { mailconf->setGroup("Account_"+QString::number(++acc_count)); mailconf->writeEntry("AccName",accountPtr->accountName ); mailconf->writeEntry("UserName",accountPtr->name); mailconf->writeEntry("Email",accountPtr->emailAddress); mailconf->writeEntry("POPUser",accountPtr->popUserName); mailconf->writeEntryCrypt("POPPassword",accountPtr->popPasswd); mailconf->writeEntry("POPServer",accountPtr->popServer); mailconf->writeEntry("SMTPServer",accountPtr->smtpServer); mailconf->writeEntry("AccountId",accountPtr->id); if (accountPtr->synchronize) { mailconf->writeEntry("Synchronize","Yes"); mailconf->writeEntry("HeaderLimit",accountPtr->syncLimit); mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); } else { mailconf->writeEntry("Synchronize", "No"); } } mailconf->setGroup("mailitglobal"); mailconf->writeEntry("Accounts",acc_count); mailconf->writeEntry("mailidcount", mailIdCount); mailconf->writeEntry("accountidcount", accountIdCount); } void EmailClient::selectAccount(int id) { if (accountList.count() > 0) { currentAccount = accountList.at(id); emit newCaption("Mailit - " + currentAccount->accountName); getNewMail(); } else { - emit newCaption("Mailit ! No account defined"); + emit newCaption( tr("Mailit ! No account defined") ); } } void EmailClient::editAccount(int id) { MailAccount *newAccount; editAccountView = new EditAccount(this, "account", TRUE); if (id == newAccountId) { //new account newAccount = new MailAccount; editAccountView->setAccount(newAccount); } else { newAccount = accountList.at(id); editAccountView->setAccount(newAccount, FALSE); } editAccountView->showMaximized(); editAccountView->exec(); if (editAccountView->result() == QDialog::Accepted) { if (id == newAccountId) { newAccount->id = accountIdCount; accountIdCount++; accountList.append(newAccount); updateAccounts(); } else { updateAccounts(); } } delete editAccountView; } void EmailClient::deleteAccount(int id) { MailAccount *newAccount; 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); updateAccounts(); break; case 1: break; } } void EmailClient::updateAccounts() { MailAccount *accountPtr; //rebuild menus, clear all first editAccountMenu->clear(); selectAccountMenu->clear(); deleteAccountMenu->clear(); - newAccountId = editAccountMenu->insertItem("New", this, + newAccountId = editAccountMenu->insertItem( tr("New"), this, SLOT(editAccount(int)) ); editAccountMenu->insertSeparator(); idCount = 0; for (accountPtr = accountList.first(); accountPtr != 0; accountPtr = accountList.next()) { editAccountMenu->insertItem(accountPtr->accountName, this, SLOT(editAccount(int)), 0, idCount); selectAccountMenu->insertItem(accountPtr->accountName, this, SLOT(selectAccount(int)), 0, idCount); deleteAccountMenu->insertItem(accountPtr->accountName, this, SLOT(deleteAccount(int)), 0, idCount); idCount++; } } void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) { Email *mPtr; Enclosure *ePtr; if (inbox) { mPtr = mailItem->getMail(); //if mail is in queue for download, remove it from //queue if possible if ( (receiving) && (mPtr->fromAccountId == currentAccount->id) ) { if ( !mPtr->downloaded ) mailDownloadList.remove(mPtr->serverId, mPtr->size); } mailconf->setGroup(mPtr->id); mailconf->clearGroup(); //delete any temporary attatchemnts storing for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) { if (ePtr->saved) { QFile::remove( (ePtr->path + ePtr->name) ); } } inboxView->takeItem(mailItem); } else { outboxView->takeItem(mailItem); } } void EmailClient::setMailSize(int size) { progressBar->reset(); progressBar->setTotalSteps(size); } void EmailClient::setTotalSize(int /*size*/) { } void EmailClient::setDownloadedSize(int size) { int total = progressBar->totalSteps(); if (size < total) { progressBar->setProgress(size); } else { progressBar->setProgress(total); } } void EmailClient::deleteItem() { bool inbox=mailboxView->currentTab()==0; QListView* box; EmailListItem* eli; // int pos; inbox ? box=inboxView : box=outboxView; eli=(EmailListItem*)box->selectedItem(); if (eli) { box->setSelected(eli->itemBelow(),true); //select the previous item deleteMail(eli,(bool&)inbox); //remove mail entry } } void EmailClient::inboxItemPressed() { // timerID=startTimer(500); } 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 @@ -1,99 +1,158 @@ /********************************************************************** ** Copyright (C) 2001 Trolltech AS. All rights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qstring.h> #include <qpe/resource.h> #include "emaillistitem.h" EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) : QListViewItem(parent) { QString temp; mail = mailIn; if (inbox) { setText(0, mail.from); } else { QStringList::Iterator it = mail.recipients.begin(); temp = *it; if (mail.recipients.count() > 1) temp += "..."; setText(0, temp); } setText(1, mail.subject); - setText(2,mail.date); + // setText(2,mail.date); + setText(2,dateFromULCString(mail.date)); if (mailIn.files.count()>0) { setPixmap(0, Resource::loadPixmap("mailit/attach")); } selected = FALSE; } Email* EmailListItem::getMail() { return &mail; } void EmailListItem::setMail(Email newMail) { mail = newMail; repaint(); } void EmailListItem::setItemSelected(bool enable) { selected = enable; setSelected(enable); repaint(); } bool EmailListItem::isItemSelected() { return selected; } void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ) { QColorGroup _cg( cg ); QColor c = _cg.text(); if ( (! mail.read) && (mail.received) ) _cg.setColor( QColorGroup::Text, Qt::blue); if (!mail.downloaded) _cg.setColor( QColorGroup::Text, Qt::red); /* if (selected) { _cg.setColor(QColorGroup::Base, Qt::blue); _cg.setColor(QColorGroup::Text, Qt::yellow); if (isSelected()) { _cg.setColor(QColorGroup::HighlightedText, Qt::yellow); } else { _cg.setColor(QColorGroup::Highlight, Qt::blue); } } */ QListViewItem::paintCell( p, _cg, column, width, alignment ); _cg.setColor( QColorGroup::Text, c ); } + +/* + * 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 @@ -1,44 +1,45 @@ /********************************************************************** ** Copyright (C) 2001 Trolltech AS. All rights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef EMAILLISTITEM_H #define EMAILLISTITEM_H #include <qlistview.h> #include "emailhandler.h" class EmailListItem: public QListViewItem { public: EmailListItem(QListView *parent, Email mailIn, bool inbox); Email* getMail(); void setMail(Email newMail); void setItemSelected(bool enable); bool isItemSelected(); bool itemSelected(); protected: void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); private: Email mail; bool selected; + QString dateFromULCString( QString ulc ); }; #endif diff --git a/noncore/net/mailit/mailit.pro b/noncore/net/mailit/mailit.pro index 5e9a83a..0224886 100644 --- a/noncore/net/mailit/mailit.pro +++ b/noncore/net/mailit/mailit.pro @@ -1,63 +1,59 @@ -TEMPLATE = app TARGET = mailit -CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = emailclient.h \ emailhandler.h \ emaillistitem.h \ mailitwindow.h \ md5.h \ popclient.h \ readmail.h \ smtpclient.h \ writemail.h \ textparser.h \ viewatt.h \ addatt.h \ editaccount.h \ maillist.h \ addresslist.h SOURCES = emailclient.cpp \ emailhandler.cpp \ emaillistitem.cpp \ mailitwindow.cpp \ main.cpp \ md5.c \ popclient.cpp \ readmail.cpp \ smtpclient.cpp \ writemail.cpp \ textparser.cpp \ viewatt.cpp \ addatt.cpp \ editaccount.cpp \ maillist.cpp \ addresslist.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie # -lssl -MOC_DIR=qpeobj -OBJECTS_DIR=qpeobj -DESTDIR=$(OPIEDIR)/bin TRANSLATIONS = ../../../i18n/de/mailit.ts \ ../../../i18n/nl/mailit.ts \ ../../../i18n/da/mailit.ts \ ../../../i18n/xx/mailit.ts \ ../../../i18n/it/mailit.ts \ ../../../i18n/en/mailit.ts \ ../../../i18n/es/mailit.ts \ ../../../i18n/fr/mailit.ts \ ../../../i18n/hu/mailit.ts \ ../../../i18n/ja/mailit.ts \ ../../../i18n/ko/mailit.ts \ ../../../i18n/no/mailit.ts \ ../../../i18n/pl/mailit.ts \ ../../../i18n/pt/mailit.ts \ ../../../i18n/pt_BR/mailit.ts \ ../../../i18n/sl/mailit.ts \ ../../../i18n/zh_CN/mailit.ts \ ../../../i18n/zh_TW/mailit.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/mailit/mailitwindow.h b/noncore/net/mailit/mailitwindow.h index e818d32..11e56b9 100644 --- a/noncore/net/mailit/mailitwindow.h +++ b/noncore/net/mailit/mailitwindow.h @@ -1,64 +1,65 @@ /********************************************************************** ** Copyright (C) 2001 Trolltech AS. All rights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef MailItWindow_H #define MailItWindow_H #include <qmainwindow.h> #include <qwidgetstack.h> #include <qevent.h> //#include <qlayout.h> #include "emailclient.h" #include "writemail.h" #include "readmail.h" #include "addresslist.h" class MailItWindow: public QMainWindow { Q_OBJECT public: + static QString appName() { return QString::fromLatin1("mailit"); } MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); ~MailItWindow(); signals: public slots: void compose(); void composeReply(Email &, bool&); void composeForward(Email &); void showEmailClient(); void viewMail(QListView *, Email *mail); void updateMailView(Email *mail); void closeEvent(QCloseEvent *e); void updateCaption(const QString &); void setDocument(const QString &); /*void reply(Email&); void replyAll(Email&); void forward(Email&); void remove(Email&);*/ private: EmailClient *emailClient; WriteMail *writeMail; ReadMail *readMail; QWidgetStack *views; QString currentCaption; bool viewingMail; }; #endif diff --git a/noncore/net/mailit/main.cpp b/noncore/net/mailit/main.cpp index 3a3e1fc..71f8877 100644 --- a/noncore/net/mailit/main.cpp +++ b/noncore/net/mailit/main.cpp @@ -1,29 +1,25 @@ /********************************************************************** ** Copyright (C) 2001 Trolltech AS. All rights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qpe/qpeapplication.h> #include "mailitwindow.h" -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 @@ -1,27 +1,16 @@ /*************************************************************************** main.cpp - description ------------------- begin : March 10, 2002 copyright : (C) 2002 by llornkcor email : ljp@llornkcor.com * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ -#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 @@ -1,157 +1,157 @@ /*************************************************************************** opieftp.cpp ------------------- ** Created: Sat Mar 9 23:33:09 2002 copyright : (C) 2002 by ljp email : ljp@llornkcor.com * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ //#define DEVELOPERS_VERSION #include "opieftp.h" extern "C" { #include "../ftplib/ftplib.h" } #include "inputDialog.h" #include <qpe/qpemenubar.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/mimetype.h> #include <qtextstream.h> #include <qpushbutton.h> #include <qtoolbutton.h> #include <qcombobox.h> #include <qlistview.h> #include <qlabel.h> #include <qprogressbar.h> #include <qspinbox.h> #include <qtabwidget.h> #include <qlayout.h> #include <qmessagebox.h> #include <qlineedit.h> #include <qlistbox.h> #include <unistd.h> #include <stdlib.h> QProgressBar *ProgressBar; static netbuf *conn=NULL; static int log_progress(netbuf *, int xfered, void *) { // int fsz = *(int *)arg; // int pct = (xfered * 100) / fsz; // printf("%3d%%\r", pct); // fflush(stdout); ProgressBar->setProgress(xfered); qApp->processEvents(); return 1; } -OpieFtp::OpieFtp( ) - : QMainWindow( ) +OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) + : QMainWindow( parent, name, fl ) { setCaption( tr( "OpieFtp" ) ); fuckeduphack=FALSE; QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2); layout->setMargin( 2); connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); QPEMenuBar *menuBar = new QPEMenuBar(this); // QPEToolBar *menuBar = new QPEToolBar(this); // menuBar->setHorizontalStretchable( TRUE ); QWMatrix matrix; QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); matrix.scale( .4, .4); unknownXpm = pix.xForm(matrix); connectionMenu = new QPopupMenu( this ); localMenu = new QPopupMenu( this ); remoteMenu = new QPopupMenu( this ); tabMenu = new QPopupMenu( this ); layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); menuBar->insertItem( tr( "Connection" ), connectionMenu); // menuBar->insertItem( tr( "Local" ), localMenu); // menuBar->insertItem( tr( "Remote" ), remoteMenu); menuBar->insertItem( tr( "View" ), tabMenu); tabMenu->insertItem( tr( "Local" ), localMenu); tabMenu->insertItem( tr( "Remote" ), remoteMenu); connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); localMenu->insertSeparator(); localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); localMenu->insertSeparator(); localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); localMenu->setCheckable(TRUE); remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); remoteMenu->insertSeparator(); remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); tabMenu->insertSeparator(); tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); tabMenu->insertSeparator(); // tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); tabMenu->setCheckable(TRUE); cdUpButton = new QToolButton( this,"cdUpButton"); cdUpButton->setPixmap(Resource::loadPixmap("up")); cdUpButton ->setFixedSize( QSize( 20, 20 ) ); connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); cdUpButton->hide(); // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); // docButton->setFixedSize( QSize( 20, 20 ) ); // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); // docButton->setFlat(TRUE); // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); homeButton = new QToolButton(this,"homeButton"); homeButton->setPixmap( Resource::loadPixmap("home")); homeButton->setFixedSize( QSize( 20, 20 ) ); connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); homeButton->hide(); TabWidget = new QTabWidget( this, "TabWidget" ); layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); // TabWidget->setTabShape(QTabWidget::Triangular); tab = new QWidget( TabWidget, "tab" ); tabLayout = new QGridLayout( tab ); tabLayout->setSpacing( 2); tabLayout->setMargin( 2); Local_View = new QListView( tab, "Local_View" ); // Local_View->setResizePolicy( QListView::AutoOneFit ); Local_View->addColumn( tr("File"),150); Local_View->addColumn( tr("Date"),-1); @@ -177,203 +177,203 @@ OpieFtp::OpieFtp( ) TabWidget->insertTab( tab, tr( "Local" ) ); tab_2 = new QWidget( TabWidget, "tab_2" ); tabLayout_2 = new QGridLayout( tab_2 ); tabLayout_2->setSpacing( 2); tabLayout_2->setMargin( 2); Remote_View = new QListView( tab_2, "Remote_View" ); Remote_View->addColumn( tr("File"),150); Remote_View->addColumn( tr("Date"),-1); // Remote_View->setColumnAlignment(1,QListView::AlignRight); Remote_View->addColumn( tr("Size"),-1); Remote_View->setColumnAlignment(2,QListView::AlignRight); Remote_View->setColumnAlignment(3,QListView::AlignCenter); Remote_View->addColumn( tr("Dir"),-1); Remote_View->setColumnAlignment(4,QListView::AlignRight); Remote_View->setAllColumnsShowFocus(TRUE); Remote_View->setMultiSelection( FALSE); Remote_View->setSelectionMode(QListView::Extended); Remote_View->setFocusPolicy(QWidget::ClickFocus); QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); connect( Remote_View, SIGNAL( clicked( QListViewItem*)), this,SLOT( remoteListClicked(QListViewItem *)) ); connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); tabLayout_2->addWidget( Remote_View, 0, 0 ); TabWidget->insertTab( tab_2, tr( "Remote" ) ); tab_3 = new QWidget( TabWidget, "tab_3" ); tabLayout_3 = new QGridLayout( tab_3 ); tabLayout_3->setSpacing( 2); tabLayout_3->setMargin( 2); TextLabel1 = new QLabel( tab_3, "TextLabel1" ); TextLabel1->setText( tr( "Username" ) ); tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); UsernameComboBox->setEditable(TRUE); tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this, SLOT( UsernameComboBoxEdited(const QString & ) )); TextLabel2 = new QLabel( tab_3, "TextLabel2" ); TextLabel2->setText( tr( "Password" ) ); tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); PasswordEdit->setEchoMode(QLineEdit::Password); tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this, SLOT( PasswordEditEdited(const QString & ) )); //PasswordEdit->setFixedWidth(85); TextLabel3 = new QLabel( tab_3, "TextLabel3" ); TextLabel3->setText( tr( "Remote server" ) ); tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); ServerComboBox->setEditable(TRUE); tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, SLOT(serverComboEdited(const QString & ) )); QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); TextLabel5->setText( tr( "Remote path" ) ); tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); remotePath = new QLineEdit( "/", tab_3, "remotePath" ); tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); TextLabel4 = new QLabel( tab_3, "TextLabel4" ); TextLabel4->setText( tr( "Port" ) ); tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); PortSpinBox->setMaxValue(32786); tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); serverListView = new QListBox( tab_3, "ServerListView" ); tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); connect( serverListView, SIGNAL( highlighted( const QString &)), 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); connectServerBtn->setToggleButton(TRUE); connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); - newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); + newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); 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); connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); tabLayout_3->addItem( spacer, 5, 0 ); TabWidget->insertTab( tab_3, tr( "Config" ) ); connect(TabWidget,SIGNAL(currentChanged(QWidget *)), this,SLOT(tabChanged(QWidget*))); currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); currentDir.setPath( QDir::currentDirPath()); // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); currentPathCombo ->setFixedWidth(220); currentPathCombo->setEditable(TRUE); currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); connect( currentPathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( currentPathComboActivated( const QString & ) ) ); connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), this,SLOT(currentPathComboChanged())); ProgressBar = new QProgressBar( this, "ProgressBar" ); layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); ProgressBar->setMaximumHeight(10); filterStr="*"; b=FALSE; populateLocalView(); readConfig(); // ServerComboBox->setCurrentItem(currentServerConfig); TabWidget->setCurrentPage(2); } OpieFtp::~OpieFtp() { } void OpieFtp::cleanUp() { if(conn) FtpQuit(conn); QString sfile=QDir::homeDirPath(); if(sfile.right(1) != "/") sfile+="/._temp"; else sfile+="._temp"; QFile file( sfile); if(file.exists()) file.remove(); Config cfg("opieftp"); cfg.setGroup("Server"); cfg.writeEntry("currentServer", currentServerConfig); exit(0); } void OpieFtp::tabChanged(QWidget *) { if (TabWidget->currentPageIndex() == 0) { currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); if(cdUpButton->isHidden()) cdUpButton->show(); if(homeButton->isHidden()) homeButton->show(); } if (TabWidget->currentPageIndex() == 1) { currentPathCombo->lineEdit()->setText( currentRemoteDir ); tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); if(cdUpButton->isHidden()) cdUpButton->show(); homeButton->hide(); } if (TabWidget->currentPageIndex() == 2) { tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); cdUpButton->hide(); homeButton->hide(); } } 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 @@ -1,142 +1,143 @@ /*************************************************************************** opieftp.h ------------------- ** Created: Sat Mar 9 23:33:09 2002 copyright : (C) 2002 by ljp email : ljp@llornkcor.com * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #ifndef OPIEFTP_H #define OPIEFTP_H #include <qvariant.h> #include <qdialog.h> #include <qmainwindow.h> #include <qdir.h> #include <qstring.h> #include <qpoint.h> #include <qpixmap.h> class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QComboBox; class QListView; class QListViewItem; class QLabel; class QProgressBar; class QSpinBox; class QTabWidget; class QWidget; class QPEToolBar; class QPEMenuBar; class QPopupMenu; class QFile; class QLineEdit; class QPushButton; class QToolButton; class QStringList; class QListBox; class QTimer; class OpieFtp : public QMainWindow { Q_OBJECT public: - OpieFtp( ); + OpieFtp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~OpieFtp(); + static QString appName() { return QString::fromLatin1("opieftp"); } QTabWidget *TabWidget; QWidget *tab, *tab_2, *tab_3; QListView *Local_View, *Remote_View; QListBox *serverListView; QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; QLineEdit *PasswordEdit, *remotePath; QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; QSpinBox* PortSpinBox; QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu; QDir currentDir; QString currentRemoteDir; QString filterStr; QListViewItem * item; QPushButton *connectServerBtn, *newServerButton;// QToolButton *cdUpButton, *homeButton, *docButton; bool b; int currentServerConfig; protected slots: void timerOut(); void upDir(); void homeButtonPushed(); void docButtonPushed(); void doAbout(); void serverComboEdited(const QString & ); void UsernameComboBoxEdited(const QString & ); void PasswordEditEdited(const QString & ); void showLocalMenu( QListViewItem *); void showRemoteMenu( QListViewItem *); void doLocalCd(); void doRemoteCd(); void localUpload(); void remoteDownload(); void newConnection(); void connector(); void disConnector(); void populateLocalView(); bool populateRemoteView(); void showHidden(); void writeConfig(); void readConfig(); void localListClicked(QListViewItem *); void remoteListClicked(QListViewItem *); void ListPressed( int, QListViewItem *, const QPoint&, int); void RemoteListPressed( int, QListViewItem *, const QPoint&, int); void localMakDir(); void localDelete(); void remoteMakDir(); void remoteDelete(); bool remoteDirList(const QString &); bool remoteChDir(const QString &); void tabChanged(QWidget*); void cleanUp(); void remoteRename(); void localRename(); void currentPathComboChanged(); void currentPathComboActivated(const QString &); void switchToLocalTab(); void switchToRemoteTab(); void switchToConfigTab(); void fillCombos(); void clearCombos(); void fillRemoteCombo(const QString&); void fillCombo(const QString &); void serverComboSelected(int); void deleteServer(); void connectorBtnToggled(bool); void NewServer(); void serverListClicked( const QString &); protected: QPixmap unknownXpm; bool fuckeduphack; QStringList remoteDirPathStringList, localDirPathStringList; QString newServerName; void nullifyCallBack(); QGridLayout* tabLayout; QGridLayout* tabLayout_2; QGridLayout* tabLayout_3; }; #endif // OPIEFTP_H 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,31 +1,29 @@ -TEMPLATE = app -CONFIG += qt warn_on release +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 DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lftplib TRANSLATIONS = ../../../i18n/de/opieftp.ts \ ../../../i18n/nl/opieftp.ts \ ../../../i18n/da/opieftp.ts \ ../../../i18n/xx/opieftp.ts \ ../../../i18n/en/opieftp.ts \ ../../../i18n/es/opieftp.ts \ ../../../i18n/fr/opieftp.ts \ ../../../i18n/hu/opieftp.ts \ ../../../i18n/ja/opieftp.ts \ ../../../i18n/ko/opieftp.ts \ ../../../i18n/no/opieftp.ts \ ../../../i18n/pl/opieftp.ts \ ../../../i18n/pt/opieftp.ts \ ../../../i18n/pt_BR/opieftp.ts \ ../../../i18n/sl/opieftp.ts \ ../../../i18n/zh_CN/opieftp.ts \ ../../../i18n/zh_TW/opieftp.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/opieirc/.cvsignore b/noncore/net/opieirc/.cvsignore index 39391f4..d5423d6 100644 --- a/noncore/net/opieirc/.cvsignore +++ b/noncore/net/opieirc/.cvsignore @@ -1,3 +1,4 @@ Makefile 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 @@ -1,10 +1,7 @@ #include <qpe/qpeapplication.h> #include "mainwindow.h" -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 @@ -1,52 +1,53 @@ /* OpieIRC - An embedded IRC client Copyright (C) 2002 Wenzel Jakob This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __MAINWINDOW_H #define __MAINWINDOW_H #include <qmainwindow.h> #include <qaction.h> #include <qlist.h> #include "mainwindow.h" #include "ircmisc.h" #include "irctab.h" class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = 0, const char *name = 0, WFlags f = 0); // IRCTabWidget getTabWidget(); void addTab(IRCTab *tab); void killTab(IRCTab *tab); + static QString appName() { return QString::fromLatin1("opieirc"); } signals: void updateScroll(); protected slots: void newConnection(); void settings(); void selected(QWidget *); void changeEvent(IRCTab *); protected: void loadSettings(); protected: IRCTabWidget *m_tabWidget; QList<IRCTab> m_tabs; }; #endif /* __MAINWINDOW_H */ diff --git a/noncore/net/opieirc/opieirc.pro b/noncore/net/opieirc/opieirc.pro index 8b09e18..537f810 100644 --- a/noncore/net/opieirc/opieirc.pro +++ b/noncore/net/opieirc/opieirc.pro @@ -1,28 +1,25 @@ -TEMPLATE = app -CONFIG = qt warn_on release -DESTDIR = $(OPIEDIR)/bin +CONFIG = qt warn_on release quick-app HEADERS = ircchannel.h ircconnection.h \ ircmessage.h \ ircmessageparser.h ircoutput.h \ ircperson.h ircserver.h ircsession.h \ mainwindow.h irctab.h ircservertab.h \ ircchanneltab.h ircchannellist.h \ ircserverlist.h ircservereditor.h \ ircquerytab.h ircsettings.h ircmisc.h SOURCES = ircchannel.cpp ircconnection.cpp \ ircmessage.cpp \ ircmessageparser.cpp ircoutput.cpp \ ircperson.cpp ircserver.cpp \ ircsession.cpp main.cpp mainwindow.cpp \ irctab.cpp ircservertab.cpp \ ircchanneltab.cpp ircchannellist.cpp \ ircserverlist.cpp ircservereditor.cpp \ ircquerytab.cpp ircsettings.cpp ircmisc.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -TARGET = opieirc - +TARGET = opieirc include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/opietooth/blue-pin/blue-pin.pro b/noncore/net/opietooth/blue-pin/blue-pin.pro index 102a937..fbf9dbe 100644 --- a/noncore/net/opietooth/blue-pin/blue-pin.pro +++ b/noncore/net/opietooth/blue-pin/blue-pin.pro @@ -1,34 +1,30 @@ -TEMPLATE = app -#CONFIG = qt warn_on debug -CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = pindlg.h SOURCES = main.cc pindlg.cc INCLUDEPATH += $(OPIEDIR)/include INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe INTERFACES = pindlgbase.ui -DESTDIR = $(OPIEDIR)/bin TARGET = bluepin TRANSLATIONS = ../../../../i18n/de/bluepin.ts \ ../../../../i18n/nl/bluepin.ts \ ../../../../i18n/da/bluepin.ts \ ../../../../i18n/xx/bluepin.ts \ ../../../../i18n/en/bluepin.ts \ ../../../../i18n/es/bluepin.ts \ ../../../../i18n/fr/bluepin.ts \ ../../../../i18n/hu/bluepin.ts \ ../../../../i18n/ja/bluepin.ts \ ../../../../i18n/ko/bluepin.ts \ ../../../../i18n/no/bluepin.ts \ ../../../../i18n/pl/bluepin.ts \ ../../../../i18n/pt/bluepin.ts \ ../../../../i18n/pt_BR/bluepin.ts \ ../../../../i18n/sl/bluepin.ts \ ../../../../i18n/zh_CN/bluepin.ts \ ../../../../i18n/zh_TW/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 @@ -1,9 +1,13 @@ Makefile Makefile.in bluetoothbase.cpp bluetoothbase.h devicedialog.cpp devicedialog.h moc_* 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 @@ -1,343 +1,360 @@ /* * bluebase.cpp * * --------------------- * * copyright : (c) 2002 by Maximilian Reiß * email : max.reiss@gmx.de * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "bluebase.h" #include "scandialog.h" #include "hciconfwrapper.h" #include "devicehandler.h" #include "btconnectionitem.h" +#include "rfcommassigndialogimpl.h" #include <remotedevice.h> #include <services.h> #include <stdlib.h> #include <qframe.h> #include <qlabel.h> #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> #include <qimage.h> #include <qpixmap.h> #include <qtabwidget.h> #include <qscrollview.h> #include <qvbox.h> #include <qmessagebox.h> #include <qcheckbox.h> #include <qlineedit.h> #include <qlistview.h> #include <qdir.h> #include <qpopupmenu.h> #include <qtimer.h> #include <qlist.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> using namespace OpieTooth; BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) : BluetoothBase( parent, name, fl ) { m_localDevice = new Manager( "hci0" ); connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); + + connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); // not good since lib is async // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); connect( ListView2, SIGNAL( clicked( QListViewItem* )), this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), this, SLOT( deviceActive( const QString& , bool ) ) ); connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ), this, SLOT( addSignalStrength( const QString&, const QString& ) ) ); // let hold be rightButtonClicked() QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); //Load all icons needed m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); m_onPix = Resource::loadPixmap( "opietooth/connected" ); m_findPix = Resource::loadPixmap( "opietooth/find" ); QPalette pal = this->palette(); QColor col = pal.color( QPalette::Active, QColorGroup::Background ); pal.setColor( QPalette::Active, QColorGroup::Button, col ); pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); pal.setColor( QPalette::Normal, QColorGroup::Button, col ); pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); this->setPalette( pal ); setCaption( tr( "Bluetooth Manager" ) ); readConfig(); initGui(); ListView2->setRootIsDecorated(true); writeToHciConfig(); // search conncetions addConnectedDevices(); addSignalStrength(); m_iconLoader = new BTIconLoader(); readSavedDevices(); } /** * Reads all options from the config file */ void BlueBase::readConfig() { Config cfg( "bluetoothmanager" ); cfg.setGroup( "bluezsettings" ); m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); } /** * Writes all options to the config file */ void BlueBase::writeConfig() { Config cfg( "bluetoothmanager" ); cfg.setGroup( "bluezsettings" ); cfg.writeEntry( "name" , m_deviceName ); cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); cfg.writeEntry( "useEncryption" , m_useEncryption ); cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); cfg.writeEntry( "enablePagescan" , m_enablePagescan ); cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); writeToHciConfig(); } /** * Modify the hcid.conf file to our needs */ void BlueBase::writeToHciConfig() { qWarning("writeToHciConfig"); HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); hciconf.load(); hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" ); hciconf.setName( m_deviceName ); hciconf.setEncrypt( m_useEncryption ); hciconf.setAuth( m_enableAuthentification ); hciconf.setPscan( m_enablePagescan ); hciconf.setIscan( m_enableInquiryscan ); hciconf.save(); } /** * Read the list of allready known devices */ void BlueBase::readSavedDevices() { QValueList<RemoteDevice> loadedDevices; DeviceHandler handler; loadedDevices = handler.load(); addSearchedDevices( loadedDevices ); } /** * Write the list of allready known devices */ void BlueBase::writeSavedDevices() { QListViewItemIterator it( ListView2 ); BTListItem* item; BTDeviceItem* device; RemoteDevice::ValueList list; for ( ; it.current(); ++it ) { item = (BTListItem*)it.current(); if(item->typeId() != BTListItem::Device ) continue; device = (BTDeviceItem*)item; list.append( device->remoteDevice() ); } /* * if not empty save the List through DeviceHandler */ if ( list.isEmpty() ) return; DeviceHandler handler; handler.save( list ); } /** * Set up the gui */ void BlueBase::initGui() { StatusLabel->setText( status() ); // maybe move it to getStatus() cryptCheckBox->setChecked( m_useEncryption ); authCheckBox->setChecked( m_enableAuthentification ); pagescanCheckBox->setChecked( m_enablePagescan ); inquiryscanCheckBox->setChecked( m_enableInquiryscan ); deviceNameLine->setText( m_deviceName ); passkeyLine->setText( m_defaultPasskey ); // set info tab setInfo(); } /** * Get the status informations and returns it * @return QString the status informations gathered */ QString BlueBase::status()const{ QString infoString = tr( "<b>Device name : </b> Ipaq" ); infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); return (infoString); } /** * Read the current values from the gui and invoke writeConfig() */ void BlueBase::applyConfigChanges() { m_deviceName = deviceNameLine->text(); m_defaultPasskey = passkeyLine->text(); m_useEncryption = cryptCheckBox->isChecked(); m_enableAuthentification = authCheckBox->isChecked(); m_enablePagescan = pagescanCheckBox->isChecked(); m_enableInquiryscan = inquiryscanCheckBox->isChecked(); writeConfig(); QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); } /** + * 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 * */ void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { BTDeviceItem * deviceItem; QValueList<RemoteDevice>::ConstIterator it; for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { if (find( (*it) )) // is already inserted continue; deviceItem = new BTDeviceItem( ListView2 , (*it) ); deviceItem->setPixmap( 1, m_findPix ); deviceItem->setExpandable ( true ); // look if device is avail. atm, async deviceActive( (*it) ); // ggf auch hier? addServicesToDevice( deviceItem ); } } /** * Action that is toggled on entrys on click */ void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { } /** * Action that are toggled on hold (mostly QPopups i guess) */ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { if (!item ) return; QPopupMenu *menu = new QPopupMenu(); int ret=0; if ( ((BTListItem*)item)->type() == "device") { QPopupMenu *groups = new QPopupMenu(); menu->insertItem( ((BTDeviceItem*)item)->name(),0 ); menu->insertSeparator(1); menu->insertItem( tr("rescan sevices"), 2); menu->insertItem( tr("to group"), groups , 3); menu->insertItem( tr("delete"), 4); ret = menu->exec( point , 0); switch(ret) { case -1: break; case 2: addServicesToDevice( (BTDeviceItem*)item ); break; case 4: // deletes childs too delete item; break; } delete groups; } /* * We got service sensitive PopupMenus in our factory * We will create one through the factory and will insert * our Separator + ShowInfo into the menu or create a new * one if the factory returns 0 * PopupMenu deletion is kind of weird. * If escaped( -1 ) or any of our items were chosen we'll * delete the PopupMenu otherwise it's the responsibility of * the PopupMenu to delete itself * */ else if ( ((BTListItem*)item)->type() == "service") { BTServiceItem* service = (BTServiceItem*)item; QMap<int, QString> list = service->services().classIdList(); QMap<int, QString>::Iterator it = list.begin(); QPopupMenu *popup =0l; if ( it != list.end() ) { qWarning("Searching id %d %s", it.key(), it.data().latin1() ); popup = m_popHelper.find( it.key(), service->services(), (BTDeviceItem*)service->parent() ); }else { qWarning("Empty"); } if ( popup == 0l ) { 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 @@ -1,97 +1,101 @@ #ifndef BLUEBASE_H #define BLUEBASE_H #include <qvariant.h> #include <qwidget.h> #include <qscrollview.h> #include <qsplitter.h> #include <qlist.h> #include <qpixmap.h> #include "bluetoothbase.h" #include "btserviceitem.h" #include "btdeviceitem.h" #include "popuphelper.h" #include "bticonloader.h" #include <remotedevice.h> #include <manager.h> class QVBox; class QHBoxLayout; class QGridLayout; class QFrame; class QLabel; class QPushButton; class QTabWidget; class QCheckBox; class BTConnectionItem; namespace OpieTooth { class BlueBase : public BluetoothBase { Q_OBJECT public: BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~BlueBase(); + static QString appName() { return QString::fromLatin1("bluetooth-manager"); } + protected: private slots: void startScan(); + private: bool find( const RemoteDevice& device ); void readConfig(); void writeConfig(); void readSavedDevices(); void writeSavedDevices(); void writeToHciConfig(); QString status()const; void initGui(); void setInfo(); PopupHelper m_popHelper; Manager *m_localDevice; QMap<QString,BTDeviceItem*> m_deviceList; void deviceActive( const RemoteDevice &device ); QString m_deviceName; QString m_defaultPasskey; bool m_useEncryption; bool m_enableAuthentification; bool m_enablePagescan; bool m_enableInquiryscan; QPixmap m_offPix; QPixmap m_onPix; QPixmap m_findPix; BTIconLoader *m_iconLoader; private slots: void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); void addServicesToDevice( BTDeviceItem *item ); void addServicesToDevice( const QString& device, Services::ValueList ); void addConnectedDevices(); void addConnectedDevices( ConnectionState::ValueList ); void startServiceActionClicked( QListViewItem *item ); void startServiceActionHold( QListViewItem *, const QPoint &, int ); void deviceActive( const QString& mac, bool connected ); void applyConfigChanges(); void addSignalStrength(); void addSignalStrength( const QString& mac, const QString& strengh ); + void rfcommDialog(); }; } #endif diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui index 9ff970f..bb906a1 100644 --- a/noncore/net/opietooth/manager/bluetoothbase.ui +++ b/noncore/net/opietooth/manager/bluetoothbase.ui @@ -1,395 +1,443 @@ <!DOCTYPE UI><UI> <class>BluetoothBase</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>BluetoothBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>224</width> - <height>320</height> + <width>258</width> + <height>407</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Form1</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>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>Status</cstring> </property> + <property stdset="1"> + <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>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Devices</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> <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> </widget> <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>PushButton2</cstring> </property> <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> <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> <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>2</number> + <number>11</number> </property> <property stdset="1"> <name>spacing</name> - <number>2</number> + <number>6</number> + </property> + <widget> + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>GroupBox1</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Bluetooh Basic Config</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>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>Layout2</cstring> + <cstring>Layout7</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>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>QLineEdit</class> + <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>deviceNameLine</cstring> + <cstring>passkeyLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Default Passkey</string> </property> </widget> - </hbox> + </vbox> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>Layout3</cstring> + <cstring>Layout5</cstring> </property> - <hbox> + <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> + <class>QLineEdit</class> <property stdset="1"> <name>name</name> - <cstring>passkeyLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Default Passkey</string> + <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>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </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>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>margin</name> <number>2</number> </property> <property stdset="1"> <name>spacing</name> <number>2</number> </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> </UI> diff --git a/noncore/net/opietooth/manager/main.cpp b/noncore/net/opietooth/manager/main.cpp index a86e36d..82aeebd 100644 --- a/noncore/net/opietooth/manager/main.cpp +++ b/noncore/net/opietooth/manager/main.cpp @@ -1,38 +1,25 @@ /* * main.cpp * * --------------------- * * begin : Sun 10 17:20:00 CEST 2002 * copyright : (c) 2002 by Maximilian Reiß * email : max.reiss@gmx.de * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "bluebase.h" #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,50 +1,50 @@ -TEMPLATE = app -CONFIG = qt warn_on debug -#CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = btconnectionitem.h btdeviceitem.h \ btserviceitem.h stdpopups.h \ popuphelper.h bluebase.h \ scandialog.h btlistitem.h \ hciconfwrapper.h bticonloader.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 SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ btserviceitem.cpp stdpopups.cpp \ popuphelper.cpp main.cpp \ bluebase.cpp scandialog.cpp \ btlistitem.cpp hciconfwrapper.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 INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopietooth -lopie -INTERFACES = bluetoothbase.ui devicedialog.ui -DESTDIR = $(OPIEDIR)/bin +INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui rfcommdialogitembase.ui + TARGET = bluetooth-manager TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ ../../../../i18n/nl/bluetooth-manager.ts \ ../../../../i18n/da/bluetooth-manager.ts \ ../../../../i18n/xx/bluetooth-manager.ts \ ../../../../i18n/en/bluetooth-manager.ts \ ../../../../i18n/es/bluetooth-manager.ts \ ../../../../i18n/fr/bluetooth-manager.ts \ ../../../../i18n/hu/bluetooth-manager.ts \ ../../../../i18n/ja/bluetooth-manager.ts \ ../../../../i18n/ko/bluetooth-manager.ts \ ../../../../i18n/no/bluetooth-manager.ts \ ../../../../i18n/pl/bluetooth-manager.ts \ ../../../../i18n/pt/bluetooth-manager.ts \ ../../../../i18n/pt_BR/bluetooth-manager.ts \ ../../../../i18n/sl/bluetooth-manager.ts \ ../../../../i18n/zh_CN/bluetooth-manager.ts \ ../../../../i18n/zh_TW/bluetooth-manager.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/opietooth/manager/rfcommassigndialogbase.ui b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui new file mode 100644 index 0000000..aefa698 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui @@ -0,0 +1,44 @@ +<!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 @@ -1,85 +1,96 @@ #include <qtimer.h> #include "pppdialog.h" #include "rfcpopup.h" +#include "rfcommassigndialogimpl.h" using namespace OpieTooth; /* * c'tor init the QAction */ -RfcCommPopup::RfcCommPopup() +RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { qWarning("RfcCommPopup c'tor"); QAction* a; + + m_item = item; + /* connect action */ a = new QAction( ); // so it's get deleted a->setText("Connect"); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); /* disconnect action */ a = new QAction( ); a->setText("Disconnect"); a->addTo( this ); connect( a, SIGNAL( activated() ) , this, SLOT( slotDisconnect() ) ); /* foo action */ a = new QAction( ); - a->setText("Foo"); + a->setText("Bind table"); a->addTo( this ); connect( a, SIGNAL( activated() ), - this, SLOT( slotFoo() ) ); + this, SLOT( slotBind() ) ); /* bar action */ a = new QAction( ); a->setText( "Bar" ); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotBar() ) ); }; RfcCommPopup::~RfcCommPopup() { /* delete m_con; delete m_dis; delete m_foo; delete m_bar; */ } void RfcCommPopup::slotConnect() { qWarning("connect"); PPPDialog pppDialog; pppDialog.showMaximized(); pppDialog.exec(); } void RfcCommPopup::slotDisconnect() { qWarning("slot disconnected"); } -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(); + } } void RfcCommPopup::slotBar() { qWarning("slotBar"); }; diff --git a/noncore/net/opietooth/manager/rfcpopup.h b/noncore/net/opietooth/manager/rfcpopup.h index c388f65..74b9117 100644 --- a/noncore/net/opietooth/manager/rfcpopup.h +++ b/noncore/net/opietooth/manager/rfcpopup.h @@ -1,36 +1,39 @@ #ifndef RFCPOPUP_H #define RFCPOPUP_H #include <qpopupmenu.h> #include <qaction.h> +#include "btdeviceitem.h" + namespace OpieTooth { /** * A simple reference implementation for * the popup helper factory. * This class derives from QPopupMenu and uses * plugged QActions to do all the nasty in it's * slots. After the work is done everything must * be deleted. */ class RfcCommPopup : public QPopupMenu { Q_OBJECT public: - RfcCommPopup(); + RfcCommPopup( OpieTooth::BTDeviceItem* ); ~RfcCommPopup(); private: QAction* m_con; QAction* m_dis; - QAction* m_foo; + QAction* m_bind; QAction* m_bar; + OpieTooth::BTDeviceItem *m_item; private slots: void slotConnect(); void slotDisconnect(); - void slotFoo(); + void slotBind(); void slotBar(); }; }; #endif diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp index 38b8ee7..e1f8396 100644 --- a/noncore/net/opietooth/manager/stdpopups.cpp +++ b/noncore/net/opietooth/manager/stdpopups.cpp @@ -1,26 +1,26 @@ #include "rfcpopup.h" #include "obexpopup.h" #include "panpopup.h" #include "dunpopup.h" #include "stdpopups.h" 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; } QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) { return new OpieTooth::ObexPopup(); } QPopupMenu* newPanPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { return new OpieTooth::PanPopup( item ); } QPopupMenu* newDunPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { return new OpieTooth::DunPopup( item ); } } diff --git a/noncore/net/ubrowser/main.cpp b/noncore/net/ubrowser/main.cpp index e4a873d..0488cfd 100644 --- a/noncore/net/ubrowser/main.cpp +++ b/noncore/net/ubrowser/main.cpp @@ -1,29 +1,24 @@ /* Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing Copyright (C) 2002 Thomas Stephens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <qpe/qpeapplication.h> #include "mainview.h" -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 @@ -1,116 +1,116 @@ /* Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing Copyright (C) 2002 Thomas Stephens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "mainview.h" -MainView::MainView(QWidget *parent, const char *name) : QMainWindow(parent, name) +MainView::MainView(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, fl) { setIcon( Resource::loadPixmap( "remote" ) ); setCaption(tr("uBrowser")); setToolBarsMovable( false ); QPEToolBar *toolbar = new QPEToolBar(this, "toolbar"); back = new QToolButton(Resource::loadPixmap("ubrowser/back"), 0, 0, 0, 0, toolbar, "back"); forward = new QToolButton(Resource::loadPixmap("ubrowser/forward"), 0, 0, 0, 0, toolbar, "forward"); home = new QToolButton(Resource::loadPixmap("ubrowser/home"), 0, 0, 0, 0, toolbar, "home"); location = new QComboBox(true, toolbar, "location"); go = new QToolButton(Resource::loadPixmap("ubrowser/go"), 0, 0, 0, 0, toolbar, "go"); toolbar->setStretchableWidget(location); toolbar->setHorizontalStretchable(true); location->setAutoCompletion( true ); addToolBar(toolbar); browser = new QTextBrowser(this, "browser"); setCentralWidget(browser); //make the button take you to the location connect(go, SIGNAL(clicked()), this, SLOT(goClicked()) ); connect(location->lineEdit(), SIGNAL(returnPressed()), this, SLOT(goClicked()) ); //make back, forward and home do their thing (isnt QTextBrowser great?) connect(back, SIGNAL(clicked()), browser, SLOT(backward()) ); connect(forward, SIGNAL(clicked()), browser, SLOT(forward()) ); connect(home, SIGNAL(clicked()), browser, SLOT(home()) ); //make back and forward buttons be enabled, only when you can go back or forward (again, i love QTextBrowser) //this doesnt seem to work, but doesnt break anything either... connect(browser, SIGNAL(backwardAvailable(bool)), back, SLOT(setOn(bool)) ); connect(browser, SIGNAL(forwardAvailable(bool)), forward, SLOT(setOn(bool)) ); //notify me when the text of the browser has changed (like when the user clicks a link) connect(browser, SIGNAL(textChanged()), this, SLOT(textChanged()) ); http = new HttpFactory(browser); if( qApp->argc() > 1 ) { char **argv = qApp->argv(); int i = 0; QString *openfile = new QString( argv[0] ); while( openfile->contains( "ubrowser" ) == 0 && i < qApp->argc() ) { i++; *openfile = argv[i]; } *openfile = argv[i+1]; if( !openfile->startsWith( "http://" ) && !openfile->startsWith( "/" ) ) { openfile->insert( 0, QDir::currentDirPath()+"/" ); } location->setEditText( *openfile ); goClicked(); } } void MainView::goClicked() { location->insertItem( location->currentText() ); if(location->currentText().startsWith("http://") ) { location->setEditText(location->currentText().lower()); browser->setMimeSourceFactory(http); printf("MainView::goClicked: using http source factory\n"); } else { browser->setMimeSourceFactory(QMimeSourceFactory::defaultFactory()); printf("MainView::goClicked: using default source factory\n"); } browser->setSource(location->currentText()); } void MainView::textChanged() { if(browser->documentTitle().isNull()) { setCaption( tr("%1 - uBrowser").arg( browser->source() ) ); } else { setCaption(tr(" - uBrowser").arg( browser->documentTitle() )); } location->setEditText(browser->source()); } void MainView::setDocument( const QString& applnk_filename ) { 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 @@ -1,52 +1,53 @@ /* Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing Copyright (C) 2002 Thomas Stephens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <qpe/resource.h> #include <qpe/qpetoolbar.h> #include <qpe/applnk.h> #include <qapplication.h> #include <qmainwindow.h> #include <qwidget.h> #include <qtextbrowser.h> #include <qtoolbutton.h> #include <qcombobox.h> #include <qlayout.h> #include <qlineedit.h> #include <qdir.h> #include <stdio.h> #include "httpfactory.h" class MainView : public QMainWindow { Q_OBJECT 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: void goClicked(); void textChanged(); void setDocument( const QString& applnk_filename ); private: QToolButton *back; QToolButton *forward; QToolButton *home; QToolButton *go; QComboBox *location; QTextBrowser *browser; HttpFactory *http; }; diff --git a/noncore/net/ubrowser/ubrowser.pro b/noncore/net/ubrowser/ubrowser.pro index a6943dd..ed00047 100644 --- a/noncore/net/ubrowser/ubrowser.pro +++ b/noncore/net/ubrowser/ubrowser.pro @@ -1,13 +1,11 @@ -TEMPLATE =app -CONFIG +=qt warn_on release -DESTDIR =../../../bin +CONFIG +=qt warn_on release quick-app HEADERS = mainview.h httpfactory.h SOURCES = main.cpp mainview.cpp httpfactory.cpp INCLUDEPATH +=../../../include DEPENDPATH +=../../../include LIBS += -lqpe TARGET = ubrowser include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 90664bb..8359acf 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp @@ -188,234 +188,234 @@ void EmailClient::init() "mailhas attachments.\n")); grid_2->addWidget( inboxView, 2, 0 ); mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); grid_3 = new QGridLayout( widget_2 ); // grid_3->setSpacing(6); // grid_3->setMargin( 11 ); outboxView = new QListView( widget_2, "outboxView" ); outboxView->addColumn( tr( "To" ) ); outboxView->addColumn( tr( "Subject" ) ); outboxView->setAllColumnsShowFocus(TRUE); QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" "It keeps the queued mails to send which can be \n" "reviewed by double clicking the entry.")); grid_3->addWidget( outboxView, 0, 0 ); mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); setCentralWidget(mailboxView); } void EmailClient::initStatusBar(QWidget* parent) { statusBar = new QStatusBar(parent); statusBar->setSizeGripEnabled(FALSE); status1Label = new QLabel( tr("Idle"), statusBar); status2Label = new QLabel("", statusBar); connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), status2Label, SLOT(setText(const QString &)) ); connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), status2Label, SLOT(setText(const QString &)) ); progressBar = new QProgressBar(statusBar); connect(emailHandler, SIGNAL(mailboxSize(int)), this, SLOT(setTotalSize(int)) ); connect(emailHandler, SIGNAL(currentMailSize(int)), this, SLOT(setMailSize(int)) ); connect(emailHandler, SIGNAL(downloadedSize(int)), this, SLOT(setDownloadedSize(int)) ); statusBar->addWidget(status1Label); statusBar->addWidget(progressBar); statusBar->addWidget(status2Label); } void EmailClient::compose() { emit composeRequested(); } void EmailClient::cancel() { emailHandler->cancel(); } AddressList* EmailClient::getAdrListRef() { return addressList; } //this needs to be rewritten to syncronize with outboxView void EmailClient::enqueMail(const Email &mail) { if (accountList.count() == 0) { QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n"); return; } if (accountList.count() > 0) { currentAccount = accountList.first(); qWarning("using account " + currentAccount->name); } Email addMail = mail; addMail.from = currentAccount->name; addMail.fromMail = currentAccount->emailAddress; addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n"); item = new EmailListItem(outboxView, addMail, false); mailboxView->setCurrentTab(1); } void EmailClient::sendQuedMail() { int count = 0; 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; } //traverse listview, find messages to send if (! sending) { item = (EmailListItem *) outboxView->firstChild(); if (item != NULL) { while (item != NULL) { quedMessages.append(item->getMail()); item = (EmailListItem *) item->nextSibling(); count++; } setMailAccount(); emailHandler->sendMail(&quedMessages); sending = TRUE; sendMailButton->setEnabled(FALSE); cancelButton->setEnabled(TRUE); } else { qWarning("sendQuedMail(): no messages to send"); } } } void EmailClient::setMailAccount() { emailHandler->setAccount(*currentAccount); } void EmailClient::mailSent() { sending = FALSE; sendMailButton->setEnabled(TRUE); quedMessages.clear(); outboxView->clear(); //should be moved to an sentBox } 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; previewingMail = TRUE; getMailButton->setEnabled(FALSE); cancelButton->setEnabled(TRUE); selectAccountMenu->setEnabled(FALSE); status1Label->setText(currentAccount->accountName + " headers"); progressBar->reset(); //get any previous mails not downloaded and add to queue /*mailDownloadList.clear(); Email *mailPtr; item = (EmailListItem *) inboxView->firstChild(); while (item != NULL) { mailPtr = item->getMail(); if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); } item = (EmailListItem *) item->nextSibling(); }*/ emailHandler->getMailHeaders(); } void EmailClient::getAllNewMail() { allAccounts = TRUE; currentAccount = accountList.first(); getNewMail(); } void EmailClient::mailArrived(const Email &mail, bool fromDisk) { Enclosure *ePtr; Email newMail; int thisMailId; emailHandler->parse( mail.rawMail, lineShift, &newMail); mailconf->setGroup(newMail.id); if (fromDisk) { newMail.downloaded = mailconf->readBoolEntry("downloaded"); newMail.size = mailconf->readNumEntry("size"); newMail.serverId = mailconf->readNumEntry("serverid"); newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); } else { //mail arrived from server newMail.serverId = mail.serverId; newMail.size = mail.size; newMail.downloaded = mail.downloaded; newMail.fromAccountId = emailHandler->getAccount()->id; mailconf->writeEntry("fromaccountid", newMail.fromAccountId); } //add if read or not newMail.read = mailconf->readBoolEntry("mailread"); //check if new mail if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { thisMailId = mailIdCount; mailIdCount++; //set server count, so that if the user aborts, the new //header is not reloaded if ((currentAccount)&&(currentAccount->synchronize)) currentAccount->lastServerMailCount++; mailconf->writeEntry("internalmailid", thisMailId); mailconf->writeEntry("downloaded", newMail.downloaded); mailconf->writeEntry("size", (int) newMail.size); mailconf->writeEntry("serverid", newMail.serverId); //addressList->addContact(newMail.fromMail, newMail.from); } mailconf->writeEntry("downloaded", newMail.downloaded); QString stringMailId; stringMailId.setNum(thisMailId); //see if any attatchments needs to be stored for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { QString stringId; stringId.setNum(ePtr->id); int id = mailconf->readNumEntry("enclosureid_" + stringId); @@ -692,254 +692,254 @@ QString EmailClient::getPath(bool enclosurePath) } return (dir.path() + "/"); } void EmailClient::readSettings() { int y,acc_count; mailconf->setGroup("mailitglobal"); acc_count=mailconf->readNumEntry("Accounts",0); for (int accountPos = 0;accountPos<acc_count ; accountPos++) { mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... account.accountName = mailconf->readEntry("AccName",""); account.name = mailconf->readEntry("UserName",""); account.emailAddress = mailconf->readEntry("Email",""); account.popUserName = mailconf->readEntry("POPUser",""); account.popPasswd = mailconf->readEntryCrypt("POPPassword",""); account.popServer = mailconf->readEntry("POPServer",""); account.smtpServer = mailconf->readEntry("SMTPServer",""); account.id = mailconf->readNumEntry("AccountId",0); account.syncLimit = mailconf->readNumEntry("HeaderLimit",0); account.lastServerMailCount = 0; account.synchronize = FALSE; account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); if (account.synchronize) { mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); } accountList.append(&account); } mailconf->setGroup("mailitglobal"); if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) { mailIdCount = y; } if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) { accountIdCount = y; } } void EmailClient::saveSettings() { int acc_count=0; MailAccount *accountPtr; if (!mailconf) { qWarning("could not save settings"); return; } for (accountPtr = accountList.first(); accountPtr != 0; accountPtr = accountList.next()) { mailconf->setGroup("Account_"+QString::number(++acc_count)); mailconf->writeEntry("AccName",accountPtr->accountName ); mailconf->writeEntry("UserName",accountPtr->name); mailconf->writeEntry("Email",accountPtr->emailAddress); mailconf->writeEntry("POPUser",accountPtr->popUserName); mailconf->writeEntryCrypt("POPPassword",accountPtr->popPasswd); mailconf->writeEntry("POPServer",accountPtr->popServer); mailconf->writeEntry("SMTPServer",accountPtr->smtpServer); mailconf->writeEntry("AccountId",accountPtr->id); if (accountPtr->synchronize) { mailconf->writeEntry("Synchronize","Yes"); mailconf->writeEntry("HeaderLimit",accountPtr->syncLimit); mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); } else { mailconf->writeEntry("Synchronize", "No"); } } mailconf->setGroup("mailitglobal"); mailconf->writeEntry("Accounts",acc_count); mailconf->writeEntry("mailidcount", mailIdCount); mailconf->writeEntry("accountidcount", accountIdCount); } void EmailClient::selectAccount(int id) { if (accountList.count() > 0) { currentAccount = accountList.at(id); emit newCaption("Mailit - " + currentAccount->accountName); getNewMail(); } else { - emit newCaption("Mailit ! No account defined"); + emit newCaption( tr("Mailit ! No account defined") ); } } void EmailClient::editAccount(int id) { MailAccount *newAccount; editAccountView = new EditAccount(this, "account", TRUE); if (id == newAccountId) { //new account newAccount = new MailAccount; editAccountView->setAccount(newAccount); } else { newAccount = accountList.at(id); editAccountView->setAccount(newAccount, FALSE); } editAccountView->showMaximized(); editAccountView->exec(); if (editAccountView->result() == QDialog::Accepted) { if (id == newAccountId) { newAccount->id = accountIdCount; accountIdCount++; accountList.append(newAccount); updateAccounts(); } else { updateAccounts(); } } delete editAccountView; } void EmailClient::deleteAccount(int id) { MailAccount *newAccount; 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); updateAccounts(); break; case 1: break; } } void EmailClient::updateAccounts() { MailAccount *accountPtr; //rebuild menus, clear all first editAccountMenu->clear(); selectAccountMenu->clear(); deleteAccountMenu->clear(); - newAccountId = editAccountMenu->insertItem("New", this, + newAccountId = editAccountMenu->insertItem( tr("New"), this, SLOT(editAccount(int)) ); editAccountMenu->insertSeparator(); idCount = 0; for (accountPtr = accountList.first(); accountPtr != 0; accountPtr = accountList.next()) { editAccountMenu->insertItem(accountPtr->accountName, this, SLOT(editAccount(int)), 0, idCount); selectAccountMenu->insertItem(accountPtr->accountName, this, SLOT(selectAccount(int)), 0, idCount); deleteAccountMenu->insertItem(accountPtr->accountName, this, SLOT(deleteAccount(int)), 0, idCount); idCount++; } } void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) { Email *mPtr; Enclosure *ePtr; if (inbox) { mPtr = mailItem->getMail(); //if mail is in queue for download, remove it from //queue if possible if ( (receiving) && (mPtr->fromAccountId == currentAccount->id) ) { if ( !mPtr->downloaded ) mailDownloadList.remove(mPtr->serverId, mPtr->size); } mailconf->setGroup(mPtr->id); mailconf->clearGroup(); //delete any temporary attatchemnts storing for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) { if (ePtr->saved) { QFile::remove( (ePtr->path + ePtr->name) ); } } inboxView->takeItem(mailItem); } else { outboxView->takeItem(mailItem); } } void EmailClient::setMailSize(int size) { progressBar->reset(); progressBar->setTotalSteps(size); } void EmailClient::setTotalSize(int /*size*/) { } void EmailClient::setDownloadedSize(int size) { int total = progressBar->totalSteps(); if (size < total) { progressBar->setProgress(size); } else { progressBar->setProgress(total); } } void EmailClient::deleteItem() { bool inbox=mailboxView->currentTab()==0; QListView* box; EmailListItem* eli; // int pos; inbox ? box=inboxView : box=outboxView; eli=(EmailListItem*)box->selectedItem(); if (eli) { box->setSelected(eli->itemBelow(),true); //select the previous item deleteMail(eli,(bool&)inbox); //remove mail entry } } void EmailClient::inboxItemPressed() { // timerID=startTimer(500); } 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 @@ -1,99 +1,158 @@ /********************************************************************** ** Copyright (C) 2001 Trolltech AS. All rights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qstring.h> #include <qpe/resource.h> #include "emaillistitem.h" EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) : QListViewItem(parent) { QString temp; mail = mailIn; if (inbox) { setText(0, mail.from); } else { QStringList::Iterator it = mail.recipients.begin(); temp = *it; if (mail.recipients.count() > 1) temp += "..."; setText(0, temp); } setText(1, mail.subject); - setText(2,mail.date); + // setText(2,mail.date); + setText(2,dateFromULCString(mail.date)); if (mailIn.files.count()>0) { setPixmap(0, Resource::loadPixmap("mailit/attach")); } selected = FALSE; } Email* EmailListItem::getMail() { return &mail; } void EmailListItem::setMail(Email newMail) { mail = newMail; repaint(); } void EmailListItem::setItemSelected(bool enable) { selected = enable; setSelected(enable); repaint(); } bool EmailListItem::isItemSelected() { return selected; } void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ) { QColorGroup _cg( cg ); QColor c = _cg.text(); if ( (! mail.read) && (mail.received) ) _cg.setColor( QColorGroup::Text, Qt::blue); if (!mail.downloaded) _cg.setColor( QColorGroup::Text, Qt::red); /* if (selected) { _cg.setColor(QColorGroup::Base, Qt::blue); _cg.setColor(QColorGroup::Text, Qt::yellow); if (isSelected()) { _cg.setColor(QColorGroup::HighlightedText, Qt::yellow); } else { _cg.setColor(QColorGroup::Highlight, Qt::blue); } } */ QListViewItem::paintCell( p, _cg, column, width, alignment ); _cg.setColor( QColorGroup::Text, c ); } + +/* + * 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 @@ -1,44 +1,45 @@ /********************************************************************** ** Copyright (C) 2001 Trolltech AS. All rights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef EMAILLISTITEM_H #define EMAILLISTITEM_H #include <qlistview.h> #include "emailhandler.h" class EmailListItem: public QListViewItem { public: EmailListItem(QListView *parent, Email mailIn, bool inbox); Email* getMail(); void setMail(Email newMail); void setItemSelected(bool enable); bool isItemSelected(); bool itemSelected(); protected: void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); private: Email mail; bool selected; + QString dateFromULCString( QString ulc ); }; #endif diff --git a/noncore/unsupported/mailit/mailit.pro b/noncore/unsupported/mailit/mailit.pro index 5e9a83a..0224886 100644 --- a/noncore/unsupported/mailit/mailit.pro +++ b/noncore/unsupported/mailit/mailit.pro @@ -1,63 +1,59 @@ -TEMPLATE = app TARGET = mailit -CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = emailclient.h \ emailhandler.h \ emaillistitem.h \ mailitwindow.h \ md5.h \ popclient.h \ readmail.h \ smtpclient.h \ writemail.h \ textparser.h \ viewatt.h \ addatt.h \ editaccount.h \ maillist.h \ addresslist.h SOURCES = emailclient.cpp \ emailhandler.cpp \ emaillistitem.cpp \ mailitwindow.cpp \ main.cpp \ md5.c \ popclient.cpp \ readmail.cpp \ smtpclient.cpp \ writemail.cpp \ textparser.cpp \ viewatt.cpp \ addatt.cpp \ editaccount.cpp \ maillist.cpp \ addresslist.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie # -lssl -MOC_DIR=qpeobj -OBJECTS_DIR=qpeobj -DESTDIR=$(OPIEDIR)/bin TRANSLATIONS = ../../../i18n/de/mailit.ts \ ../../../i18n/nl/mailit.ts \ ../../../i18n/da/mailit.ts \ ../../../i18n/xx/mailit.ts \ ../../../i18n/it/mailit.ts \ ../../../i18n/en/mailit.ts \ ../../../i18n/es/mailit.ts \ ../../../i18n/fr/mailit.ts \ ../../../i18n/hu/mailit.ts \ ../../../i18n/ja/mailit.ts \ ../../../i18n/ko/mailit.ts \ ../../../i18n/no/mailit.ts \ ../../../i18n/pl/mailit.ts \ ../../../i18n/pt/mailit.ts \ ../../../i18n/pt_BR/mailit.ts \ ../../../i18n/sl/mailit.ts \ ../../../i18n/zh_CN/mailit.ts \ ../../../i18n/zh_TW/mailit.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/unsupported/mailit/mailitwindow.h b/noncore/unsupported/mailit/mailitwindow.h index e818d32..11e56b9 100644 --- a/noncore/unsupported/mailit/mailitwindow.h +++ b/noncore/unsupported/mailit/mailitwindow.h @@ -1,64 +1,65 @@ /********************************************************************** ** Copyright (C) 2001 Trolltech AS. All rights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef MailItWindow_H #define MailItWindow_H #include <qmainwindow.h> #include <qwidgetstack.h> #include <qevent.h> //#include <qlayout.h> #include "emailclient.h" #include "writemail.h" #include "readmail.h" #include "addresslist.h" class MailItWindow: public QMainWindow { Q_OBJECT public: + static QString appName() { return QString::fromLatin1("mailit"); } MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); ~MailItWindow(); signals: public slots: void compose(); void composeReply(Email &, bool&); void composeForward(Email &); void showEmailClient(); void viewMail(QListView *, Email *mail); void updateMailView(Email *mail); void closeEvent(QCloseEvent *e); void updateCaption(const QString &); void setDocument(const QString &); /*void reply(Email&); void replyAll(Email&); void forward(Email&); void remove(Email&);*/ private: EmailClient *emailClient; WriteMail *writeMail; ReadMail *readMail; QWidgetStack *views; QString currentCaption; bool viewingMail; }; #endif diff --git a/noncore/unsupported/mailit/main.cpp b/noncore/unsupported/mailit/main.cpp index 3a3e1fc..71f8877 100644 --- a/noncore/unsupported/mailit/main.cpp +++ b/noncore/unsupported/mailit/main.cpp @@ -1,29 +1,25 @@ /********************************************************************** ** Copyright (C) 2001 Trolltech AS. All rights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qpe/qpeapplication.h> #include "mailitwindow.h" -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 |