author | kergoth <kergoth> | 2003-08-09 17:00:23 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 17:00:23 (UTC) |
commit | c33d5ec60361238e50a4a9d6e0eec03e396dce60 (patch) (side-by-side diff) | |
tree | 31c0c85dc4262044db90c7918014bc45265ef420 /noncore | |
parent | 78c296d534589835801fb6374ac9d43d44b2b1c9 (diff) | |
download | opie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.zip opie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.tar.gz opie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.tar.bz2 |
Merge from BRANCH_1_0
28 files changed, 334 insertions, 635 deletions
diff --git a/noncore/net/mailit/config.in b/noncore/net/mailit/config.in index 142b840..2b56b5f 100644 --- a/noncore/net/mailit/config.in +++ b/noncore/net/mailit/config.in @@ -1,4 +1,4 @@ config MAILIT - boolean "opie-mailit (a simple POP3 email client)" + boolean "mailit" default "n" depends ( LIBQPE || LIBQPE-X11 ) diff --git a/noncore/net/mailit/popclient.cpp b/noncore/net/mailit/popclient.cpp index 5da3bcb..1df6b2b 100644 --- a/noncore/net/mailit/popclient.cpp +++ b/noncore/net/mailit/popclient.cpp @@ -20,66 +20,67 @@ #include "popclient.h" #include "emailhandler.h" //#define APOP_TEST extern "C" { #include "md5.h" } #include <qcstring.h> PopClient::PopClient() { - + socket = new QSocket(this, "popClient"); connect(socket, SIGNAL(error(int)), this, SLOT(errorHandling(int))); connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); - + stream = new QTextStream(socket); - + receiving = FALSE; synchronize = FALSE; lastSync = 0; headerLimit = 0; + mailList = 0; preview = FALSE; } PopClient::~PopClient() { delete socket; delete stream; } void PopClient::newConnection(const QString &target, int port) { if (receiving) { qWarning("socket in use, connection refused"); return; } - + status = Init; - + socket->connectToHost(target, port); receiving = TRUE; //selected = FALSE; - + emit updateStatus(tr("DNS lookup")); } void PopClient::setAccount(const QString &popUser, const QString &popPasswd) { popUserName = popUser; popPassword = popPasswd; -} +} void PopClient::setSynchronize(int lastCount) { synchronize = TRUE; lastSync = lastCount; } void PopClient::removeSynchronize() { synchronize = FALSE; lastSync = 0; } @@ -114,98 +115,98 @@ void PopClient::errorHandlingWithMsg(int status, const QString & Msg ) } void PopClient::incomingData() { QString response, temp, temp2, timeStamp; QString md5Source; int start, end; // char *md5Digest; char md5Digest[16]; // if ( !socket->canReadLine() ) // return; - + response = socket->readLine(); - + switch(status) { //logging in case Init: { #ifdef APOP_TEST start = response.find('<',0); end = response.find('>', start); if( start >= 0 && end > start ) { timeStamp = response.mid( start , end - start + 1); md5Source = timeStamp + popPassword; - + md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]); for(int j =0;j < MD5_DIGEST_LENGTH ;j++) { printf("%x", md5Digest[j]); } - printf("\n"); + printf("\n"); // qDebug(md5Digest); *stream << "APOP " << popUserName << " " << md5Digest << "\r\n"; // qDebug("%s", stream); status = Stat; } else #endif { timeStamp = ""; *stream << "USER " << popUserName << "\r\n"; status = Pass; } - + break; } - + case Pass: { *stream << "PASS " << popPassword << "\r\n"; status = Stat; - + break; } //ask for number of messages case Stat: { if (response[0] == '+') { *stream << "STAT" << "\r\n"; - status = Mcnt; + status = Mcnt; } else errorHandlingWithMsg(ErrLoginFailed, response); break; } //get count of messages, eg "+OK 4 900.." -> int 4 case Mcnt: { if (response[0] == '+') { temp = response.replace(0, 4, ""); int x = temp.find(" ", 0); temp.truncate((uint) x); newMessages = temp.toInt(); messageCount = 1; status = List; - + if (synchronize) { //messages deleted from server, reload all if (newMessages < lastSync) lastSync = 0; messageCount = 1; } - - if (selected) { + + if (selected && mailList ) { int *ptr = mailList->first(); if (ptr != 0) { newMessages++; //to ensure no early jumpout messageCount = *ptr; - } else newMessages = 0; + } else newMessages = 0; } } else errorHandlingWithMsg(ErrUnknownResponse, response); } //Read message number x, count upwards to messageCount case List: { if (messageCount <= newMessages) { *stream << "LIST " << messageCount << "\r\n"; status = Size; temp2.setNum(newMessages - lastSync); temp.setNum(messageCount - lastSync); if (!selected) { @@ -215,55 +216,55 @@ void PopClient::incomingData() /* if ( (messageCount - lastSync) <= 0) { temp.setNum(messageCount); emit updateStatus(tr("Previous message ") + temp); } else {*/ emit updateStatus(tr("Completing message ") + temp); //} } break; } else { emit updateStatus(tr("No new Messages")); status = Quit; } - } + } //get size of message, eg "500 characters in message.." -> int 500 case Size: { if (status != Quit) { //because of idiotic switch if (response[0] == '+') { temp = response.replace(0, 4, ""); int x = temp.find(" ", 0); temp = temp.right(temp.length() - ((uint) x + 1) ); mailSize = temp.toInt(); emit currentMailSize(mailSize); - + status = Retr; } else { //qWarning(response); errorHandlingWithMsg(ErrUnknownResponse, response); } } - } + } //Read message number x, count upwards to messageCount case Retr: { if (status != Quit) { - if ((selected)||(mailSize <= headerLimit)) + if ((selected)||(mailSize <= headerLimit)) { *stream << "RETR " << messageCount << "\r\n"; } else { //only header *stream << "TOP " << messageCount << " 0\r\n"; } messageCount++; status = Ignore; break; - } } + } } case Ignore: { if (status != Quit) { //because of idiotic switch if (response[0] == '+') { message = ""; status = Read; if (!socket->canReadLine()) //sync. problems break; response = socket->readLine(); } else errorHandlingWithMsg(ErrUnknownResponse, response); } } //add all incoming lines to body. When size is reached, send @@ -277,55 +278,55 @@ void PopClient::incomingData() } emit downloadedSize(message.length()); int x = message.find("\r\n.\r\n",-5); if (x == -1) { break; } else { //message reach entire size if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active { emit newMessage(message, messageCount-1, mailSize, TRUE); } else { //incomplete mail downloaded emit newMessage(message, messageCount-1, mailSize, FALSE); } - + if ((messageCount > newMessages)||(selected)) //last message ? { status = Quit; if (selected) { //grab next from queue newMessages--; status = Quit; } } - else + else { *stream << "LIST " << messageCount << "\r\n"; status = Size; temp2.setNum(newMessages - lastSync); temp.setNum(messageCount - lastSync); emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); - + break; } } } if (status != Quit) break; } case Quit: { *stream << "Quit\r\n"; status = Done; int newM = newMessages - lastSync; if (newM > 0) { temp.setNum(newM); emit updateStatus(temp + tr(" new messages")); } else { emit updateStatus(tr("No new messages")); } - + socket->close(); receiving = FALSE; emit mailTransfered(newM); break; } } } diff --git a/noncore/net/mailit/resource.cpp b/noncore/net/mailit/resource.cpp deleted file mode 100644 index dc19880..0000000 --- a/noncore/net/mailit/resource.cpp +++ b/dev/null @@ -1,136 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia 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 "qpeapplication.h" -#include "resource.h" -#include <qdir.h> -#include <qfile.h> -#include <qregexp.h> -#include <qpixmapcache.h> -#include <qpainter.h> - -#include "inlinepics_p.h" - -/*! - \class Resource resource.h - \brief The Resource class provides access to named resources. - - The resources may be provided from files or other sources. -*/ - -/*! - \fn Resource::Resource() - \internal -*/ - -/*! - Returns the QPixmap named \a pix. You should avoid including - any filename type extension (eg. .png, .xpm). -*/ -QPixmap Resource::loadPixmap( const QString &pix ) -{ - QPixmap pm; - QString key="QPE_"+pix; - if ( !QPixmapCache::find(key,pm) ) { - pm.convertFromImage(loadImage(pix)); - QPixmapCache::insert(key,pm); - } - return pm; -} - -/*! - Returns the QBitmap named \a pix. You should avoid including - any filename type extension (eg. .png, .xpm). -*/ -QBitmap Resource::loadBitmap( const QString &pix ) -{ - QBitmap bm; - bm = loadPixmap(pix); - return bm; -} - -/*! - Returns the filename of a pixmap named \a pix. You should avoid including - any filename type extension (eg. .png, .xpm). - - Normally you will use loadPixmap() rather than this function. -*/ -QString Resource::findPixmap( const QString &pix ) -{ - QString picsPath = QPEApplication::qpeDir() + "pics/"; - - if ( QFile( picsPath + pix + ".png").exists() ) - return picsPath + pix + ".png"; - else if ( QFile( picsPath + pix + ".xpm").exists() ) - return picsPath + pix + ".xpm"; - else if ( QFile( picsPath + pix ).exists() ) - return picsPath + pix; - - //qDebug("Cannot find pixmap: %s", pix.latin1()); - return QString(); -} - -/*! - Returns a sound file for a sound named \a name. - You should avoid including any filename type extension (eg. .wav, .au, .mp3). -*/ -QString Resource::findSound( const QString &name ) -{ - QString picsPath = QPEApplication::qpeDir() + "sounds/"; - - QString result; - if ( QFile( (result = picsPath + name + ".wav") ).exists() ) - return result; - - return QString(); -} - -/*! - Returns a list of all sound names. -*/ -QStringList Resource::allSounds() -{ - QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" ); - QStringList entries = resourcedir.entryList(); - QStringList result; - for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i) - result.append((*i).replace(QRegExp("\\.wav"),"")); - return result; -} - -/*! - Returns the QImage named \a name. You should avoid including - any filename type extension (eg. .png, .xpm). -*/ -QImage Resource::loadImage( const QString &name) -{ - QImage img = qembed_findImage(name.latin1()); - if ( img.isNull() ) - return QImage(findPixmap(name)); - return img; -} - -/*! - \fn QIconSet Resource::loadIconSet( const QString &name ) - - Returns a QIconSet for the pixmap named \a name. A disabled icon is - generated that conforms to the Qtopia look & feel. You should avoid - including any filename type extension (eg. .png, .xpm). -*/ diff --git a/noncore/net/mailit/resource.h b/noncore/net/mailit/resource.h deleted file mode 100644 index 982c58a..0000000 --- a/noncore/net/mailit/resource.h +++ b/dev/null @@ -1,80 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia 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 PIXMAPLOADER_H -#define PIXMAPLOADER_H - -#include <qimage.h> -#include <qbitmap.h> -#include <qiconset.h> -#include <qstringlist.h> - -class Resource -{ -public: - Resource() {} - - static QImage loadImage( const QString &name); - - static QPixmap loadPixmap( const QString &name ); - static QBitmap loadBitmap( const QString &name ); - static QString findPixmap( const QString &name ); - - static QIconSet loadIconSet( const QString &name ); - - static QString findSound( const QString &name ); - static QStringList allSounds(); -}; - -// Inline for compatibility with SHARP ROMs -inline QIconSet Resource::loadIconSet( const QString &pix ) -{ - QImage img = loadImage( pix ); - QPixmap pm; - pm.convertFromImage( img ); - QIconSet is( pm ); - QIconSet::Size size = pm.width() <= 22 ? QIconSet::Small : QIconSet::Large; - - QPixmap dpm = loadPixmap( pix + "_disabled" ); - -#ifndef QT_NO_DEPTH_32 // have alpha-blended pixmaps - if ( dpm.isNull() ) { - QImage dimg( img.width(), img.height(), 32 ); - for ( int y = 0; y < img.height(); y++ ) { - for ( int x = 0; x < img.width(); x++ ) { - QRgb p = img.pixel( x, y ); - uint a = (p & 0xff000000) / 3; - p = (p & 0x00ffffff) | (a & 0xff000000); - dimg.setPixel( x, y, p ); - } - } - - dimg.setAlphaBuffer( TRUE ); - dpm.convertFromImage( dimg ); - } -#endif - - if ( !dpm.isNull() ) - is.setPixmap( dpm, size, QIconSet::Disabled ); - - return is; -} - - -#endif diff --git a/noncore/net/mailit/smtpclient.cpp b/noncore/net/mailit/smtpclient.cpp index 5b5ef52..51ca50b 100644 --- a/noncore/net/mailit/smtpclient.cpp +++ b/noncore/net/mailit/smtpclient.cpp @@ -95,45 +95,45 @@ void SmtpClient::incomingData() switch(status) { case Init: { if (response[0] == '2') { status = From; mailPtr = mailList.first(); *stream << "HELO there\r\n"; } else errorHandlingWithMsg(ErrUnknownResponse,response); break; } case From: { if (response[0] == '2') { qDebug(mailPtr->from); - *stream << "MAIL FROM: <" << mailPtr->from << ">\r\n"; + *stream << "MAIL FROM: " << mailPtr->from << "\r\n"; status = Recv; } else errorHandlingWithMsg(ErrUnknownResponse, response ); break; } case Recv: { if (response[0] == '2') { it = mailPtr->to.begin(); if (it == NULL) { errorHandlingWithMsg(ErrUnknownResponse,response); } - *stream << "RCPT TO: <" << *it << ">\r\n"; + *stream << "RCPT TO: " << *it << "\r\n"; status = MRcv; } else errorHandlingWithMsg(ErrUnknownResponse,response); break; } case MRcv: { if (response[0] == '2') { it++; if ( it != mailPtr->to.end() ) { - *stream << "RCPT TO: <" << *it << ">\r\n"; + *stream << "RCPT TO: " << *it << "\r\n"; break; } else { status = Data; } } else errorHandlingWithMsg(ErrUnknownResponse,response); } case Data: { if (response[0] == '2') { *stream << "DATA\r\n"; status = Body; emit updateStatus(tr("Sending: ") + mailPtr->subject); diff --git a/noncore/net/mailit/viewatt.cpp b/noncore/net/mailit/viewatt.cpp index 293e137..3515ba5 100644 --- a/noncore/net/mailit/viewatt.cpp +++ b/noncore/net/mailit/viewatt.cpp @@ -8,77 +8,77 @@ ** 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 "resource.h" +#include <qpe/resource.h> #include "viewatt.h" #include <qwhatsthis.h> #include <qpe/applnk.h> #include <qpe/mimetype.h> ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { setCaption(tr("Exploring attatchments")); setToolBarsMovable( FALSE ); bar = new QToolBar(this); installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); installButton->setWhatsThis(tr("Click here to install the attachment to your Documents")); - + listView = new QListView(this, "AttView"); listView->addColumn( tr("Attatchment") ); listView->addColumn( tr("Type") ); listView->addColumn( tr("Installed") ); setCentralWidget(listView); QWhatsThis::add(listView,QWidget::tr("This is an overview about all attachments in the mail")); } void ViewAtt::update(Email *mailIn, bool inbox) { QListViewItem *item; Enclosure *ePtr; - - + + listView->clear(); if (inbox) { bar->clear(); installButton->addTo( bar ); bar->show(); } else { bar->hide(); } - + mail = mailIn; for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { - + QString isInstalled = tr("No"); if (ePtr->installed) isInstalled = tr("Yes"); item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled); - + const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute; - + MimeType mt(mtypeDef); - + item->setPixmap(0, mt.pixmap()); /* if (ePtr->contentType == "TEXT") { actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0); actions->addTo(bar); } if (ePtr->contentType == "AUDIO") { actions = new QAction( tr("Play"), Resource::loadPixmap("SoundPlayer"), QString::null, CTRL + Key_C, this, 0); actions->addTo(bar); item->setPixmap(0, Resource::loadPixmap("play")); } @@ -87,35 +87,35 @@ void ViewAtt::update(Email *mailIn, bool inbox) actions->addTo(bar); item->setPixmap(0, Resource::loadPixmap("pixmap")); }*/ } } void ViewAtt::install() { Enclosure *ePtr, *selPtr; QListViewItem *item; QString filename; DocLnk d; - + item = listView->selectedItem(); if (item != NULL) { filename = item->text(0); selPtr = NULL; for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { if (ePtr->originalName == filename) selPtr = ePtr; } - + if (selPtr == NULL) { qWarning("Internal error, file is not installed to documents"); return; } - + d.setName(selPtr->originalName); d.setFile(selPtr->path + selPtr->name); d.setType(selPtr->contentType + "/" + selPtr->contentAttribute); d.writeLink(); selPtr->installed = TRUE; item->setText(2, tr("Yes")); } } diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro index dbccd98..ac16819 100644 --- a/noncore/net/opieftp/opieftp.pro +++ b/noncore/net/opieftp/opieftp.pro @@ -1,15 +1,15 @@ TEMPLATE = app CONFIG += qt warn_on release -HEADERS = opieftp.h inputDialog.h ftplib.h +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 \ diff --git a/noncore/net/opieirc/config.in b/noncore/net/opieirc/config.in index 30184a9..7c6949d 100644 --- a/noncore/net/opieirc/config.in +++ b/noncore/net/opieirc/config.in @@ -1,4 +1,4 @@ config OPIEIRC - boolean "opieirc" + boolean "opie-irc (chat via your favorite IRC server)" default "y" depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE diff --git a/noncore/net/opieirc/ircchannellist.cpp b/noncore/net/opieirc/ircchannellist.cpp index e592d05..566b223 100644 --- a/noncore/net/opieirc/ircchannellist.cpp +++ b/noncore/net/opieirc/ircchannellist.cpp @@ -26,12 +26,23 @@ void IRCChannelList::update() { } sort(); } bool IRCChannelList::hasPerson(QString nick) { for (unsigned int i=0; i<count(); i++) { if (text(i) == nick) return TRUE; } return FALSE; } + +bool IRCChannelList::removePerson(QString nick) { + for (unsigned int i=0; i<count(); i++) { + if (text(i) == nick){ + removeItem(i); + return TRUE; + } + } + return FALSE; +} + diff --git a/noncore/net/opieirc/ircchannellist.h b/noncore/net/opieirc/ircchannellist.h index fa3c8cd..deab649 100644 --- a/noncore/net/opieirc/ircchannellist.h +++ b/noncore/net/opieirc/ircchannellist.h @@ -20,17 +20,18 @@ #ifndef __IRCCHANNELLIST_H #define __IRCCHANNELLIST_H #include <qlistbox.h> #include "ircchannel.h" class IRCChannelList : public QListBox { public: IRCChannelList(IRCChannel *channel, QWidget *parent = 0, const char *name = 0, WFlags f = 0); void update(); bool hasPerson(QString nick); + bool removePerson(QString nick); protected: IRCChannel *m_channel; }; #endif /* __IRCCHANNELLIST_H */ diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index beb8bce..2b8b65e 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp @@ -53,24 +53,25 @@ void IRCChannelTab::scrolling(){ void IRCChannelTab::appendText(QString text) { /* not using append because it creates layout problems */ QString txt = m_textview->text() + text + "\n"; if (m_maxLines > 0 && m_lines >= m_maxLines) { int firstBreak = txt.find('\n'); if (firstBreak != -1) { txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); } } else { m_lines++; } + m_textview->ensureVisible(0, m_textview->contentsHeight()); m_textview->setText(txt); m_textview->ensureVisible(0, m_textview->contentsHeight()); emit changed(this); } IRCChannelTab::~IRCChannelTab() { m_parentTab->removeChannelTab(this); } void IRCChannelTab::processCommand() { QString text = m_field->text(); if (text.length()>0) { diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp index 6b88f34..400ff41 100644 --- a/noncore/net/opieirc/ircmessageparser.cpp +++ b/noncore/net/opieirc/ircmessageparser.cpp @@ -197,39 +197,53 @@ void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) { } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender"))); } } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel %1").arg(message->param(0).lower()) )); } } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type"))); } } void IRCMessageParser::parseLiteralNick(IRCMessage *message) { + IRCPerson mask(message->prefix()); - + /* this way of handling nick changes really sucks */ if (mask.nick() == m_session->m_server->nick()) { /* We are changing our nickname */ m_session->m_server->setNick(message->param(0)); IRCOutput output(OUTPUT_NICKCHANGE, tr("You are now known as %1").arg( message->param(0))); output.addParam(0); emit outputReady(output); } else { /* Someone else is */ IRCPerson *person = m_session->getPerson(mask.nick()); if (person) { - IRCOutput output(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg( mask.nick() ).arg( message->param(0 ))); - output.addParam(person); - emit outputReady(output); + //IRCOutput output(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg( mask.nick() ).arg( message->param(0))); + + /* new code starts here -- this removes the person from all channels */ + QList<IRCChannel> channels; + m_session->getChannelsByPerson(person, channels); + QListIterator<IRCChannel> it(channels); + for (;it.current(); ++it) { + IRCChannelPerson *chanperson = it.current()->getPerson(mask.nick()); + it.current()->removePerson(chanperson); + chanperson->person->setNick(message->param(0)); + it.current()->addPerson(chanperson); + IRCOutput output(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg( mask.nick() ).arg( message->param(0))); + output.addParam(person); + emit outputReady(output); + } + /* new code ends here */ } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nickname change of an unknown person"))); } } } void IRCMessageParser::parseLiteralQuit(IRCMessage *message) { IRCPerson mask(message->prefix()); IRCPerson *person = m_session->getPerson(mask.nick()); if (person) { QList<IRCChannel> channels; m_session->getChannelsByPerson(person, channels); @@ -388,24 +402,25 @@ void IRCMessageParser::parseLiteralMode(IRCMessage *message) { void IRCMessageParser::parseLiteralKick(IRCMessage *message) { IRCPerson mask(message->prefix()); IRCChannel *channel = m_session->getChannel(message->param(0).lower()); if (channel) { IRCChannelPerson *person = channel->getPerson(message->param(1)); if (person) { if (person->person->nick() == m_session->m_server->nick()) { m_session->removeChannel(channel); IRCOutput output(OUTPUT_SELFKICK, tr("You were kicked from ") + channel->channelname() + tr(" by ") + mask.nick() + " (" + message->param(2) + ")"); output.addParam(channel); emit outputReady(output); } else { + /* someone else got kicked */ channel->removePerson(person); IRCOutput output(OUTPUT_OTHERKICK, person->person->nick() + tr(" was kicked from ") + channel->channelname() + tr(" by ") + mask.nick()+ " (" + message->param(2) + ")"); output.addParam(channel); output.addParam(person); emit outputReady(output); } } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person kick - desynchronized?"))); } } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown channel kick - desynchronized?"))); } diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index 1d9520a..2c28507 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp @@ -113,37 +113,31 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text); } else { IRCPerson person; person.setNick(nickname); m_session->kick(((IRCChannelTab *)tab)->channel(), &person); } } } else if (command == "OP"){ QString nickname; stream >> nickname; - if (nickname.length() > 0) { - if (line.length() > 7 + nickname.length()) { - QString text = line.right(line.length()-nickname.length()-7); - IRCPerson person; - person.setNick(nickname); - m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text); - } else { + if (nickname.length() > 0) { + QString text = line.right(line.length()-nickname.length()-5); IRCPerson person; person.setNick(nickname); - m_session->kick(((IRCChannelTab *)tab)->channel(), &person); + m_session->op(((IRCChannelTab *)tab)->channel(), &person); } } - } //SEND MODES else if (command == "MODE"){ QString text = line.right(line.length()-6); if (text.length() > 0) { m_session->mode(text); } else { tab->appendText("<font color=\"" + m_errorColor + "\">/mode channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask]<br>/mode nickname {[+|-]|i|w|s|o}</font><br>"); } } //SEND RAW MESSAGE TO SERVER, COMPLETELY UNCHECKED - anything in the RFC...or really anything you want else if (command == "RAW"){ @@ -337,25 +331,37 @@ void IRCServerTab::display(IRCOutput output) { break; case OUTPUT_QUIT: { QString nick = ((IRCPerson *)output.getParam(0))->nick(); QListIterator<IRCChannelTab> it(m_channelTabs); for (; it.current(); ++it) { if (it.current()->list()->hasPerson(nick)) { it.current()->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); it.current()->list()->update(); } } } break; - case OUTPUT_OTHERJOIN: +/* case OUTPUT_NICKCHANGE: { + //WAS HERE + QString nick = ((IRCPerson *)output.getParam(0))->nick(); + QListIterator<IRCChannelTab> it(m_channelTabs); + for (; it.current(); ++it) { + if (it.current()->list()->hasPerson(nick)) { + it.current()->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); + it.current()->list()->update(); + } + } + } + break; + */ case OUTPUT_OTHERJOIN: case OUTPUT_OTHERKICK: case OUTPUT_CHANPERSONMODE: case OUTPUT_OTHERPART: { IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); channelTab->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); channelTab->list()->update(); } break; case OUTPUT_CTCP: appendText("<font color=\"" + m_notificationColor + "\">" + output.htmlMessage() + "</font><br>"); break; case OUTPUT_ERROR: diff --git a/noncore/net/opieirc/ircsession.cpp b/noncore/net/opieirc/ircsession.cpp index 1cc1ee2..6404d71 100644 --- a/noncore/net/opieirc/ircsession.cpp +++ b/noncore/net/opieirc/ircsession.cpp @@ -51,24 +51,28 @@ void IRCSession::mode(IRCPerson *person, QString message){ void IRCSession::mode(QString message){ m_connection->sendLine("MODE " + message); } void IRCSession::raw(QString message){ m_connection->sendLine(message); } void IRCSession::kick(IRCChannel *channel, IRCPerson *person) { m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :0wn3d - no reason"); } +void IRCSession::op(IRCChannel *channel, IRCPerson *person) { + m_connection->sendLine("MODE "+ channel->channelname() + " +ooo " + person->nick()); +} + void IRCSession::kick(IRCChannel *channel, IRCPerson *person, QString message) { m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :" + message); } void IRCSession::sendMessage(IRCPerson *person, QString message) { m_connection->sendLine("PRIVMSG " + person->nick() + " :" + message); } void IRCSession::sendMessage(IRCChannel *channel, QString message) { m_connection->sendLine("PRIVMSG " + channel->channelname() + " :" + message); } diff --git a/noncore/net/opieirc/ircsession.h b/noncore/net/opieirc/ircsession.h index a6a3e50..f6330d8 100644 --- a/noncore/net/opieirc/ircsession.h +++ b/noncore/net/opieirc/ircsession.h @@ -42,24 +42,25 @@ public: IRCSession(IRCServer *server); ~IRCSession(); void join(QString channel); void quit(QString message); void quit(); void raw(QString message); void topic(IRCChannel *channel, QString message); void mode(IRCChannel *channel, QString message); void mode(IRCPerson *person, QString message); void mode(QString message); void part(IRCChannel *channel); + void op(IRCChannel *channel, IRCPerson *person); void kick(IRCChannel *channel, IRCPerson *person); void kick(IRCChannel *channel, IRCPerson *person, QString message); void beginSession(); bool isSessionActive(); void endSession(); void sendMessage(IRCPerson *person, QString message); void sendMessage(IRCChannel *channel, QString message); void sendAction(IRCPerson *person, QString message); void sendAction(IRCChannel *channel, QString message); IRCChannel *getChannel(QString channelname); IRCPerson *getPerson(QString nickname); protected: diff --git a/noncore/net/opietooth/blue-pin/pindlg.cc b/noncore/net/opietooth/blue-pin/pindlg.cc index 54f096e..7d60d6c 100644 --- a/noncore/net/opietooth/blue-pin/pindlg.cc +++ b/noncore/net/opietooth/blue-pin/pindlg.cc @@ -11,24 +11,25 @@ #include "pindlg.h" using namespace OpieTooth; PinDlg::PinDlg( const QString& status, const QString& mac, QWidget* parent, const char* name ) : PinDlgBase( parent, name, WType_Modal ) { m_mac = mac; test( mac ); txtStatus->setText(status); + showMaximized(); } PinDlg::~PinDlg() { } void PinDlg::setMac( const QString& mac ) { txtStatus->setText( mac ); } QString PinDlg::pin() const{ return lnePin->text(); } void PinDlg::test( const QString& mac ) { diff --git a/noncore/net/opietooth/blue-pin/pindlg.h b/noncore/net/opietooth/blue-pin/pindlg.h index b4f5ff8..5e5a763 100644 --- a/noncore/net/opietooth/blue-pin/pindlg.h +++ b/noncore/net/opietooth/blue-pin/pindlg.h @@ -1,26 +1,29 @@ #include <qdialog.h> - #include "pindlgbase.h" namespace OpieTooth { + class PinDlg : public PinDlgBase { - Q_OBJECT + + Q_OBJECT + public: PinDlg(const QString& text, const QString& mac, QWidget* parent = 0, const char* name= 0 ); ~PinDlg(); void setMac( const QString& ); QString pin() const; + private: void test( const QString& mac ); QString m_mac; -protected slots: - void accept(); - }; + protected slots: + void accept(); + }; }; diff --git a/noncore/net/opietooth/blue-pin/pindlgbase.ui b/noncore/net/opietooth/blue-pin/pindlgbase.ui index 6966a03..889a25e 100644 --- a/noncore/net/opietooth/blue-pin/pindlgbase.ui +++ b/noncore/net/opietooth/blue-pin/pindlgbase.ui @@ -3,192 +3,268 @@ <author>zecke</author> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>Form1</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>248</width> - <height>167</height> + <width>258</width> + <height>245</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Please enter pin</string> </property> - <grid> + <vbox> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> - <widget row="0" column="0" > + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>txtStatus</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string></string> + </property> + <property stdset="1"> + <name>textFormat</name> + <enum>RichText</enum> + </property> + </widget> + <spacer> + <property> + <name>name</name> + <cstring>Spacer4_2</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Vertical</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout6</cstring> </property> - <grid> + <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> - <widget row="3" column="0" rowspan="1" colspan="3" > - <class>QLineEdit</class> + <widget> + <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>lnePin</cstring> + <cstring>TextLabel3</cstring> </property> <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> + <name>text</name> + <string>Please enter PIN:</string> </property> </widget> - <spacer row="5" column="4" > - <property> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> <name>name</name> - <cstring>Spacer2</cstring> + <cstring>Layout5</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>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>lnePin</cstring> + </property> + <property stdset="1"> + <name>echoMode</name> + <enum>Password</enum> + </property> + </widget> + <spacer> + <property> + <name>name</name> + <cstring>Spacer4</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Horizontal</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Fixed</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>21</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget> + <class>QCheckBox</class> <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> + <name>name</name> + <cstring>ckbPin</cstring> </property> <property stdset="1"> - <name>sizeType</name> - <enum>Fixed</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>16</width> - <height>20</height> - </size> + <name>text</name> + <string>Save pin</string> </property> - </spacer> - <spacer row="5" column="0" > + </widget> + </vbox> + </widget> + <spacer> + <property> + <name>name</name> + <cstring>Spacer5</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Vertical</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <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> + <spacer> <property> <name>name</name> <cstring>Spacer1</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Fixed</enum> </property> <property> <name>sizeHint</name> <size> <width>30</width> <height>20</height> </size> </property> </spacer> - <spacer row="3" column="3" > - <property> - <name>name</name> - <cstring>Spacer4</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Fixed</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>21</width> - <height>20</height> - </size> - </property> - </spacer> - <widget row="0" column="0" rowspan="1" colspan="5" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>txtStatus</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string></string> - </property> - <property stdset="1"> - <name>textFormat</name> - <enum>RichText</enum> - </property> - </widget> - <widget row="2" column="0" rowspan="1" colspan="5" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Please enter PIN:</string> - </property> - </widget> - <widget row="5" column="1" > + <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>PushButton1</cstring> </property> <property stdset="1"> <name>text</name> <string>&Ok</string> </property> </widget> - <widget row="5" column="2" rowspan="1" colspan="2" > + <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>PushButton2</cstring> </property> <property stdset="1"> <name>text</name> <string>&Cancel</string> </property> </widget> - <widget row="4" column="0" rowspan="1" colspan="5" > - <class>QCheckBox</class> - <property stdset="1"> + <spacer> + <property> <name>name</name> - <cstring>ckbPin</cstring> + <cstring>Spacer2</cstring> </property> <property stdset="1"> - <name>text</name> - <string>Save pin</string> + <name>orientation</name> + <enum>Horizontal</enum> </property> - </widget> - </grid> + <property stdset="1"> + <name>sizeType</name> + <enum>Fixed</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> </widget> - </grid> + </vbox> </widget> <connections> <connection> <sender>PushButton1</sender> <signal>clicked()</signal> <receiver>Form1</receiver> <slot>accept()</slot> </connection> <connection> <sender>PushButton2</sender> <signal>clicked()</signal> <receiver>Form1</receiver> diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 935c11a..54808fa 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -141,25 +141,25 @@ void BlueBase::writeConfig() { 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( "/bin/QtPalmtop/bin/blue-pin" ); + 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 */ diff --git a/noncore/net/ubrowser/httpfactory.cpp b/noncore/net/ubrowser/httpfactory.cpp index b57149f..369f206 100644 --- a/noncore/net/ubrowser/httpfactory.cpp +++ b/noncore/net/ubrowser/httpfactory.cpp @@ -86,63 +86,63 @@ const QMimeSource * HttpFactory::data(const QString &abs_name) const // } // comm->setStuff(host, portS, file, text, image, isImage); // socket->connectToHost(host, port); int con, bytesSent; struct sockaddr_in serverAddr; struct hostent * serverInfo = gethostbyname( host.latin1() ); if( serverInfo == NULL ) { - QMessageBox *mb = new QMessageBox("Error!", - "couldnt find ip address", + QMessageBox *mb = new QMessageBox(QObject::tr("Error!"), + QObject::tr("IP-Address not found"), QMessageBox::NoIcon, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); mb->exec(); perror("HttpFactory::data:"); return 0; } QByteArray data; // printf( "HttpFactory::data: %s\n", inet_ntoa(*((struct in_addr *)serverInfo->h_addr )) ); QString request("GET " + file + " HTTP/1.1\r\nHost: " + host + ':' + portS + "\r\nConnection: close\r\n\r\n"); con = socket( AF_INET, SOCK_STREAM, 0 ); if( con == -1 ) { - QMessageBox *mb = new QMessageBox("Error!", - "couldnt create socket", + QMessageBox *mb = new QMessageBox(QObject::tr("Error!"), + QObject::tr("Error creating socket"), QMessageBox::NoIcon, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); mb->exec(); perror("HttpFactory::data:"); return 0; } serverAddr.sin_family = AF_INET; serverAddr.sin_port = htons( port ); serverAddr.sin_addr.s_addr = inet_addr( inet_ntoa(*((struct in_addr *)serverInfo->h_addr )) ); memset( &(serverAddr.sin_zero), '\0', 8 ); if(::connect( con, (struct sockaddr *)&serverAddr, sizeof(struct sockaddr)) == -1 ) { - QMessageBox *mb = new QMessageBox("Error!", - "couldnt connect to socket", + QMessageBox *mb = new QMessageBox(QObject::tr("Error!"), + QObject::tr("Error connecting to socket"), QMessageBox::NoIcon, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); mb->exec(); perror("HttpFactory::data:"); return 0; } bytesSent = send( con, request.latin1(), request.length(), 0); // printf("HttpFactory::data: bytes written: %d out of: %d\n", bytesSent, request.length() ); diff --git a/noncore/net/ubrowser/mainview.cpp b/noncore/net/ubrowser/mainview.cpp index f68c5db..9302f05 100644 --- a/noncore/net/ubrowser/mainview.cpp +++ b/noncore/net/ubrowser/mainview.cpp @@ -11,25 +11,25 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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) { setIcon( Resource::loadPixmap( "remote" ) ); - setCaption("uBrowser"); + 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); @@ -93,29 +93,29 @@ void MainView::goClicked() { browser->setMimeSourceFactory(QMimeSourceFactory::defaultFactory()); printf("MainView::goClicked: using default source factory\n"); } browser->setSource(location->currentText()); } void MainView::textChanged() { if(browser->documentTitle().isNull()) { - setCaption(browser->source() + " - uBrowser"); + setCaption( tr("%1 - uBrowser").arg( browser->source() ) ); } else { - setCaption(browser->documentTitle() + " - uBrowser"); + setCaption(tr(" - uBrowser").arg( browser->documentTitle() )); } location->setEditText(browser->source()); } void MainView::setDocument( const QString& applnk_filename ) { DocLnk *file = new DocLnk( applnk_filename ); location->setEditText( file->file() ); goClicked(); } diff --git a/noncore/net/ubrowser/opie-ubrowser.control b/noncore/net/ubrowser/opie-ubrowser.control new file mode 100644 index 0000000..61a6cde --- a/dev/null +++ b/noncore/net/ubrowser/opie-ubrowser.control @@ -0,0 +1,10 @@ +Package: opie-ubrowser +Files: bin/ubrowser apps/Applications/ubrowser.desktop pics/ubrowser/*.png +Priority: optional +Section: opie/applications +Maintainer: Thomas Stephens <spiralman@softhome.net> +Architecture: arm +Version: 0.1-$SUB_VERSION +Depends: task-opie-minimal +License: GPL +Description: a very small web browser diff --git a/noncore/unsupported/mailit/config.in b/noncore/unsupported/mailit/config.in index 2b56b5f..142b840 100644 --- a/noncore/unsupported/mailit/config.in +++ b/noncore/unsupported/mailit/config.in @@ -1,4 +1,4 @@ config MAILIT - boolean "mailit" + boolean "opie-mailit (a simple POP3 email client)" default "n" depends ( LIBQPE || LIBQPE-X11 ) diff --git a/noncore/unsupported/mailit/popclient.cpp b/noncore/unsupported/mailit/popclient.cpp index 5da3bcb..1df6b2b 100644 --- a/noncore/unsupported/mailit/popclient.cpp +++ b/noncore/unsupported/mailit/popclient.cpp @@ -20,66 +20,67 @@ #include "popclient.h" #include "emailhandler.h" //#define APOP_TEST extern "C" { #include "md5.h" } #include <qcstring.h> PopClient::PopClient() { - + socket = new QSocket(this, "popClient"); connect(socket, SIGNAL(error(int)), this, SLOT(errorHandling(int))); connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); - + stream = new QTextStream(socket); - + receiving = FALSE; synchronize = FALSE; lastSync = 0; headerLimit = 0; + mailList = 0; preview = FALSE; } PopClient::~PopClient() { delete socket; delete stream; } void PopClient::newConnection(const QString &target, int port) { if (receiving) { qWarning("socket in use, connection refused"); return; } - + status = Init; - + socket->connectToHost(target, port); receiving = TRUE; //selected = FALSE; - + emit updateStatus(tr("DNS lookup")); } void PopClient::setAccount(const QString &popUser, const QString &popPasswd) { popUserName = popUser; popPassword = popPasswd; -} +} void PopClient::setSynchronize(int lastCount) { synchronize = TRUE; lastSync = lastCount; } void PopClient::removeSynchronize() { synchronize = FALSE; lastSync = 0; } @@ -114,98 +115,98 @@ void PopClient::errorHandlingWithMsg(int status, const QString & Msg ) } void PopClient::incomingData() { QString response, temp, temp2, timeStamp; QString md5Source; int start, end; // char *md5Digest; char md5Digest[16]; // if ( !socket->canReadLine() ) // return; - + response = socket->readLine(); - + switch(status) { //logging in case Init: { #ifdef APOP_TEST start = response.find('<',0); end = response.find('>', start); if( start >= 0 && end > start ) { timeStamp = response.mid( start , end - start + 1); md5Source = timeStamp + popPassword; - + md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]); for(int j =0;j < MD5_DIGEST_LENGTH ;j++) { printf("%x", md5Digest[j]); } - printf("\n"); + printf("\n"); // qDebug(md5Digest); *stream << "APOP " << popUserName << " " << md5Digest << "\r\n"; // qDebug("%s", stream); status = Stat; } else #endif { timeStamp = ""; *stream << "USER " << popUserName << "\r\n"; status = Pass; } - + break; } - + case Pass: { *stream << "PASS " << popPassword << "\r\n"; status = Stat; - + break; } //ask for number of messages case Stat: { if (response[0] == '+') { *stream << "STAT" << "\r\n"; - status = Mcnt; + status = Mcnt; } else errorHandlingWithMsg(ErrLoginFailed, response); break; } //get count of messages, eg "+OK 4 900.." -> int 4 case Mcnt: { if (response[0] == '+') { temp = response.replace(0, 4, ""); int x = temp.find(" ", 0); temp.truncate((uint) x); newMessages = temp.toInt(); messageCount = 1; status = List; - + if (synchronize) { //messages deleted from server, reload all if (newMessages < lastSync) lastSync = 0; messageCount = 1; } - - if (selected) { + + if (selected && mailList ) { int *ptr = mailList->first(); if (ptr != 0) { newMessages++; //to ensure no early jumpout messageCount = *ptr; - } else newMessages = 0; + } else newMessages = 0; } } else errorHandlingWithMsg(ErrUnknownResponse, response); } //Read message number x, count upwards to messageCount case List: { if (messageCount <= newMessages) { *stream << "LIST " << messageCount << "\r\n"; status = Size; temp2.setNum(newMessages - lastSync); temp.setNum(messageCount - lastSync); if (!selected) { @@ -215,55 +216,55 @@ void PopClient::incomingData() /* if ( (messageCount - lastSync) <= 0) { temp.setNum(messageCount); emit updateStatus(tr("Previous message ") + temp); } else {*/ emit updateStatus(tr("Completing message ") + temp); //} } break; } else { emit updateStatus(tr("No new Messages")); status = Quit; } - } + } //get size of message, eg "500 characters in message.." -> int 500 case Size: { if (status != Quit) { //because of idiotic switch if (response[0] == '+') { temp = response.replace(0, 4, ""); int x = temp.find(" ", 0); temp = temp.right(temp.length() - ((uint) x + 1) ); mailSize = temp.toInt(); emit currentMailSize(mailSize); - + status = Retr; } else { //qWarning(response); errorHandlingWithMsg(ErrUnknownResponse, response); } } - } + } //Read message number x, count upwards to messageCount case Retr: { if (status != Quit) { - if ((selected)||(mailSize <= headerLimit)) + if ((selected)||(mailSize <= headerLimit)) { *stream << "RETR " << messageCount << "\r\n"; } else { //only header *stream << "TOP " << messageCount << " 0\r\n"; } messageCount++; status = Ignore; break; - } } + } } case Ignore: { if (status != Quit) { //because of idiotic switch if (response[0] == '+') { message = ""; status = Read; if (!socket->canReadLine()) //sync. problems break; response = socket->readLine(); } else errorHandlingWithMsg(ErrUnknownResponse, response); } } //add all incoming lines to body. When size is reached, send @@ -277,55 +278,55 @@ void PopClient::incomingData() } emit downloadedSize(message.length()); int x = message.find("\r\n.\r\n",-5); if (x == -1) { break; } else { //message reach entire size if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active { emit newMessage(message, messageCount-1, mailSize, TRUE); } else { //incomplete mail downloaded emit newMessage(message, messageCount-1, mailSize, FALSE); } - + if ((messageCount > newMessages)||(selected)) //last message ? { status = Quit; if (selected) { //grab next from queue newMessages--; status = Quit; } } - else + else { *stream << "LIST " << messageCount << "\r\n"; status = Size; temp2.setNum(newMessages - lastSync); temp.setNum(messageCount - lastSync); emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); - + break; } } } if (status != Quit) break; } case Quit: { *stream << "Quit\r\n"; status = Done; int newM = newMessages - lastSync; if (newM > 0) { temp.setNum(newM); emit updateStatus(temp + tr(" new messages")); } else { emit updateStatus(tr("No new messages")); } - + socket->close(); receiving = FALSE; emit mailTransfered(newM); break; } } } diff --git a/noncore/unsupported/mailit/resource.cpp b/noncore/unsupported/mailit/resource.cpp deleted file mode 100644 index dc19880..0000000 --- a/noncore/unsupported/mailit/resource.cpp +++ b/dev/null @@ -1,136 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia 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 "qpeapplication.h" -#include "resource.h" -#include <qdir.h> -#include <qfile.h> -#include <qregexp.h> -#include <qpixmapcache.h> -#include <qpainter.h> - -#include "inlinepics_p.h" - -/*! - \class Resource resource.h - \brief The Resource class provides access to named resources. - - The resources may be provided from files or other sources. -*/ - -/*! - \fn Resource::Resource() - \internal -*/ - -/*! - Returns the QPixmap named \a pix. You should avoid including - any filename type extension (eg. .png, .xpm). -*/ -QPixmap Resource::loadPixmap( const QString &pix ) -{ - QPixmap pm; - QString key="QPE_"+pix; - if ( !QPixmapCache::find(key,pm) ) { - pm.convertFromImage(loadImage(pix)); - QPixmapCache::insert(key,pm); - } - return pm; -} - -/*! - Returns the QBitmap named \a pix. You should avoid including - any filename type extension (eg. .png, .xpm). -*/ -QBitmap Resource::loadBitmap( const QString &pix ) -{ - QBitmap bm; - bm = loadPixmap(pix); - return bm; -} - -/*! - Returns the filename of a pixmap named \a pix. You should avoid including - any filename type extension (eg. .png, .xpm). - - Normally you will use loadPixmap() rather than this function. -*/ -QString Resource::findPixmap( const QString &pix ) -{ - QString picsPath = QPEApplication::qpeDir() + "pics/"; - - if ( QFile( picsPath + pix + ".png").exists() ) - return picsPath + pix + ".png"; - else if ( QFile( picsPath + pix + ".xpm").exists() ) - return picsPath + pix + ".xpm"; - else if ( QFile( picsPath + pix ).exists() ) - return picsPath + pix; - - //qDebug("Cannot find pixmap: %s", pix.latin1()); - return QString(); -} - -/*! - Returns a sound file for a sound named \a name. - You should avoid including any filename type extension (eg. .wav, .au, .mp3). -*/ -QString Resource::findSound( const QString &name ) -{ - QString picsPath = QPEApplication::qpeDir() + "sounds/"; - - QString result; - if ( QFile( (result = picsPath + name + ".wav") ).exists() ) - return result; - - return QString(); -} - -/*! - Returns a list of all sound names. -*/ -QStringList Resource::allSounds() -{ - QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" ); - QStringList entries = resourcedir.entryList(); - QStringList result; - for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i) - result.append((*i).replace(QRegExp("\\.wav"),"")); - return result; -} - -/*! - Returns the QImage named \a name. You should avoid including - any filename type extension (eg. .png, .xpm). -*/ -QImage Resource::loadImage( const QString &name) -{ - QImage img = qembed_findImage(name.latin1()); - if ( img.isNull() ) - return QImage(findPixmap(name)); - return img; -} - -/*! - \fn QIconSet Resource::loadIconSet( const QString &name ) - - Returns a QIconSet for the pixmap named \a name. A disabled icon is - generated that conforms to the Qtopia look & feel. You should avoid - including any filename type extension (eg. .png, .xpm). -*/ diff --git a/noncore/unsupported/mailit/resource.h b/noncore/unsupported/mailit/resource.h deleted file mode 100644 index 982c58a..0000000 --- a/noncore/unsupported/mailit/resource.h +++ b/dev/null @@ -1,80 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia 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 PIXMAPLOADER_H -#define PIXMAPLOADER_H - -#include <qimage.h> -#include <qbitmap.h> -#include <qiconset.h> -#include <qstringlist.h> - -class Resource -{ -public: - Resource() {} - - static QImage loadImage( const QString &name); - - static QPixmap loadPixmap( const QString &name ); - static QBitmap loadBitmap( const QString &name ); - static QString findPixmap( const QString &name ); - - static QIconSet loadIconSet( const QString &name ); - - static QString findSound( const QString &name ); - static QStringList allSounds(); -}; - -// Inline for compatibility with SHARP ROMs -inline QIconSet Resource::loadIconSet( const QString &pix ) -{ - QImage img = loadImage( pix ); - QPixmap pm; - pm.convertFromImage( img ); - QIconSet is( pm ); - QIconSet::Size size = pm.width() <= 22 ? QIconSet::Small : QIconSet::Large; - - QPixmap dpm = loadPixmap( pix + "_disabled" ); - -#ifndef QT_NO_DEPTH_32 // have alpha-blended pixmaps - if ( dpm.isNull() ) { - QImage dimg( img.width(), img.height(), 32 ); - for ( int y = 0; y < img.height(); y++ ) { - for ( int x = 0; x < img.width(); x++ ) { - QRgb p = img.pixel( x, y ); - uint a = (p & 0xff000000) / 3; - p = (p & 0x00ffffff) | (a & 0xff000000); - dimg.setPixel( x, y, p ); - } - } - - dimg.setAlphaBuffer( TRUE ); - dpm.convertFromImage( dimg ); - } -#endif - - if ( !dpm.isNull() ) - is.setPixmap( dpm, size, QIconSet::Disabled ); - - return is; -} - - -#endif diff --git a/noncore/unsupported/mailit/smtpclient.cpp b/noncore/unsupported/mailit/smtpclient.cpp index 5b5ef52..51ca50b 100644 --- a/noncore/unsupported/mailit/smtpclient.cpp +++ b/noncore/unsupported/mailit/smtpclient.cpp @@ -95,45 +95,45 @@ void SmtpClient::incomingData() switch(status) { case Init: { if (response[0] == '2') { status = From; mailPtr = mailList.first(); *stream << "HELO there\r\n"; } else errorHandlingWithMsg(ErrUnknownResponse,response); break; } case From: { if (response[0] == '2') { qDebug(mailPtr->from); - *stream << "MAIL FROM: <" << mailPtr->from << ">\r\n"; + *stream << "MAIL FROM: " << mailPtr->from << "\r\n"; status = Recv; } else errorHandlingWithMsg(ErrUnknownResponse, response ); break; } case Recv: { if (response[0] == '2') { it = mailPtr->to.begin(); if (it == NULL) { errorHandlingWithMsg(ErrUnknownResponse,response); } - *stream << "RCPT TO: <" << *it << ">\r\n"; + *stream << "RCPT TO: " << *it << "\r\n"; status = MRcv; } else errorHandlingWithMsg(ErrUnknownResponse,response); break; } case MRcv: { if (response[0] == '2') { it++; if ( it != mailPtr->to.end() ) { - *stream << "RCPT TO: <" << *it << ">\r\n"; + *stream << "RCPT TO: " << *it << "\r\n"; break; } else { status = Data; } } else errorHandlingWithMsg(ErrUnknownResponse,response); } case Data: { if (response[0] == '2') { *stream << "DATA\r\n"; status = Body; emit updateStatus(tr("Sending: ") + mailPtr->subject); diff --git a/noncore/unsupported/mailit/viewatt.cpp b/noncore/unsupported/mailit/viewatt.cpp index 293e137..3515ba5 100644 --- a/noncore/unsupported/mailit/viewatt.cpp +++ b/noncore/unsupported/mailit/viewatt.cpp @@ -8,77 +8,77 @@ ** 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 "resource.h" +#include <qpe/resource.h> #include "viewatt.h" #include <qwhatsthis.h> #include <qpe/applnk.h> #include <qpe/mimetype.h> ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { setCaption(tr("Exploring attatchments")); setToolBarsMovable( FALSE ); bar = new QToolBar(this); installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); installButton->setWhatsThis(tr("Click here to install the attachment to your Documents")); - + listView = new QListView(this, "AttView"); listView->addColumn( tr("Attatchment") ); listView->addColumn( tr("Type") ); listView->addColumn( tr("Installed") ); setCentralWidget(listView); QWhatsThis::add(listView,QWidget::tr("This is an overview about all attachments in the mail")); } void ViewAtt::update(Email *mailIn, bool inbox) { QListViewItem *item; Enclosure *ePtr; - - + + listView->clear(); if (inbox) { bar->clear(); installButton->addTo( bar ); bar->show(); } else { bar->hide(); } - + mail = mailIn; for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { - + QString isInstalled = tr("No"); if (ePtr->installed) isInstalled = tr("Yes"); item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled); - + const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute; - + MimeType mt(mtypeDef); - + item->setPixmap(0, mt.pixmap()); /* if (ePtr->contentType == "TEXT") { actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0); actions->addTo(bar); } if (ePtr->contentType == "AUDIO") { actions = new QAction( tr("Play"), Resource::loadPixmap("SoundPlayer"), QString::null, CTRL + Key_C, this, 0); actions->addTo(bar); item->setPixmap(0, Resource::loadPixmap("play")); } @@ -87,35 +87,35 @@ void ViewAtt::update(Email *mailIn, bool inbox) actions->addTo(bar); item->setPixmap(0, Resource::loadPixmap("pixmap")); }*/ } } void ViewAtt::install() { Enclosure *ePtr, *selPtr; QListViewItem *item; QString filename; DocLnk d; - + item = listView->selectedItem(); if (item != NULL) { filename = item->text(0); selPtr = NULL; for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { if (ePtr->originalName == filename) selPtr = ePtr; } - + if (selPtr == NULL) { qWarning("Internal error, file is not installed to documents"); return; } - + d.setName(selPtr->originalName); d.setFile(selPtr->path + selPtr->name); d.setType(selPtr->contentType + "/" + selPtr->contentAttribute); d.writeLink(); selPtr->installed = TRUE; item->setText(2, tr("Yes")); } } |