author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (side-by-side diff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
232 files changed, 2793 insertions, 2569 deletions
diff --git a/noncore/applets/autorotateapplet/autorotate.cpp b/noncore/applets/autorotateapplet/autorotate.cpp index ae7fbd0..34802fb 100644 --- a/noncore/applets/autorotateapplet/autorotate.cpp +++ b/noncore/applets/autorotateapplet/autorotate.cpp @@ -4,34 +4,34 @@ * based on the cardmon applet by Max Reiss * * * 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 "autorotate.h" /* OPIE */ -#include <opie2/odevice.h> +#include <opie2/odebug.h> #include <opie2/otaskbarapplet.h> #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/resource.h> +using namespace Opie::Core; /* QT */ #include <qpainter.h> -using namespace Opie::Ui; AutoRotate::AutoRotate(QWidget * parent):QWidget(parent) { setFixedWidth( AppLnk::smallIconSize() ); setFixedHeight( AppLnk::smallIconSize() ); enabledPm.convertFromImage( Resource::loadImage("autorotate/rotate").smoothScale( height(), width() ) ); disabledPm.convertFromImage( Resource::loadImage("autorotate/norotate").smoothScale( height(), width() ) ); repaint(true); popupMenu = 0; show(); } @@ -78,20 +78,20 @@ void AutoRotate::setRotateEnabled(bool status) cfg.setGroup( "Appearance" ); cfg.writeEntry( "rotateEnabled", status ); } bool AutoRotate::isRotateEnabled() { Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); bool res = cfg.readBoolEntry( "rotateEnabled" ); if (res ) - qDebug("Enabled"); + odebug << "Enabled" << oendl; else - qDebug("Disabled"); + odebug << "Disabled" << oendl; return res; } -EXPORT_OPIE_APPLET_v1( AutoRotate ) +EXPORT_OPIE_APPLET_v1( AutoRotate ) diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp index 9416db3..a71078f 100644 --- a/noncore/applets/memoryapplet/swapfile.cpp +++ b/noncore/applets/memoryapplet/swapfile.cpp @@ -11,80 +11,85 @@ ** 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 "swapfile.h" +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/resource.h> +using namespace Opie::Core; + +/* QT */ #include <qfile.h> #include <qtextstream.h> #include <qlabel.h> #include <qtimer.h> #include <qlayout.h> #include <qpushbutton.h> #include <qhbuttongroup.h> #include <qradiobutton.h> #include <qlineedit.h> #include <qprogressbar.h> #include <qcombobox.h> #include <qvgroupbox.h> #include <qhbox.h> #include <qmessagebox.h> +#include <qcopchannel_qws.h> + +/* STD */ #include <stdio.h> #include <stdlib.h> #include <string.h> - -#include <qcopchannel_qws.h> -#include <qpe/resource.h> - #include <unistd.h> #include <fcntl.h> #include <sys/vfs.h> #include <mntent.h> #include <unistd.h> #include <sys/types.h> Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) : QWidget( parent, name, f ) { // are we running as root? isRoot = geteuid() == 0; - QVBoxLayout* vb = new QVBoxLayout(this, 5); + QVBoxLayout* vb = new QVBoxLayout(this, 5); QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this); cfsdRBG->setRadioButtonExclusive(true); - vb->addWidget(cfsdRBG); + vb->addWidget(cfsdRBG); ramRB = new QRadioButton(tr("RAM"), cfsdRBG); cfRB = new QRadioButton(tr("CF Card"), cfsdRBG); sdRB = new QRadioButton(tr("SD Card"), cfsdRBG); QHBox *hb1 = new QHBox(this); hb1->setSpacing(5); swapPath1 = new QLineEdit(hb1); swapPath1->setEnabled(false); QPushButton* swapOn = new QPushButton(tr(" On "), hb1); QPushButton* swapOff = new QPushButton(tr(" Off "), hb1); vb->addWidget(hb1); QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this); - vb->addWidget(box1); + vb->addWidget(box1); QHBox *hb2 = new QHBox(box1); hb2->setSpacing(5); QPushButton* mkSwap = new QPushButton(tr("Generate"), hb2); QPushButton* rmSwap = new QPushButton(tr("Remove"), hb2); QHBox *hb3 = new QHBox(box1); hb3->setSpacing(5); swapSize = new QComboBox(hb3); swapSize->insertStringList(QStringList::split(",", tr("2 Mb,4 Mb,6 Mb,8 Mb"))); mkswapProgress = new QProgressBar(3, hb3); @@ -204,25 +209,25 @@ void Swapfile::getStatusPcmcia() if (cardWas1 != cardInPcmcia1) { if (cardInPcmcia1) { cfRB->setEnabled(TRUE); } else { cfRB->setChecked(FALSE); cfRB->setEnabled(FALSE); } } } } else { // no file found - qDebug("no file found"); + odebug << "no file found" << oendl; cardInPcmcia0 = FALSE; cardInPcmcia1 = FALSE; } Swapfile::cfsdchecked(); } void Swapfile::getStatusSd() { bool cardWas = cardInSd; // remember last state cardInSd = FALSE; diff --git a/noncore/applets/networkapplet/networkapplet.cpp b/noncore/applets/networkapplet/networkapplet.cpp index 5eb5ad2..534a8d0 100644 --- a/noncore/applets/networkapplet/networkapplet.cpp +++ b/noncore/applets/networkapplet/networkapplet.cpp @@ -27,35 +27,37 @@ Boston, MA 02111-1307, USA. */ #include "networkapplet.h" /* OPIE */ #include <opie2/odebug.h> #include <opie2/onetwork.h> #include <opie2/otaskbarapplet.h> #include <qpe/applnk.h> #include <qpe/resource.h> -#include <qpainter.h> +using namespace Opie::Core; +using namespace Opie::Ui; +using namespace Opie::Net; /* QT */ +#include <qpainter.h> #include <qlabel.h> #include <qlayout.h> #include <qobjectlist.h> +/* STD */ #include <assert.h> -using namespace Opie::Ui; -using namespace Opie::Net; IfaceUpDownButton::IfaceUpDownButton( QWidget* parent, const char* name ) :QToolButton( parent, name ) { _iface = ONetwork::instance()->interface( name ); assert( _iface ); setToggleButton( true ); //setAutoRaise( true ); setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) ); setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) ); setOn( _iface->isUp() ); //setFixedWidth( 16 ); connect( this, SIGNAL( clicked() ), this, SLOT( clicked() ) ); @@ -158,61 +160,61 @@ QString NetworkAppletControl::guessDevice( ONetworkInterface* iface ) if ( QString( iface->name() ).contains( "ir" ) ) return "networksettings/irda"; //TODO: Insert neat symbol and check for tunnel devices return "networksettings/lan"; } void NetworkAppletControl::showEvent( QShowEvent* e ) { - qDebug( "showEvent" ); + odebug << "showEvent" << oendl; build(); QWidget::showEvent( e ); } void NetworkAppletControl::hideEvent( QHideEvent* e ) { - qDebug( "hideEvent" ); + odebug << "hideEvent" << oendl; QWidget::hideEvent( e ); delete l; // delete all child widgets from this frame QObjectList* list = const_cast<QObjectList*>( children() ); QObjectListIt it(*list); QObject* obj; while ( (obj=it.current()) ) { ++it; delete obj; } list = const_cast<QObjectList*>( children() ); if ( list ) - qWarning( "D'oh! We still have %d children...", list->count() ); + owarn << "D'oh! We still have " << list->count() << " children..." << oendl; // renew layout l = new QVBoxLayout( this, 4, 2 ); resize( 0, 0 ); } QSize NetworkAppletControl::sizeHint() const { ONetwork::instance()->synchronize(); // rebuild interface database - qDebug( "sizeHint (#ifaces=%d)", ONetwork::instance()->count() ); + odebug << "sizeHint (#ifaces=" << ONetwork::instance()->count() << ")" << oendl; return QSize( 14+35+105+14 + 8, ONetwork::instance()->count() * 26 ); } NetworkApplet::NetworkApplet( QWidget *parent, const char *name ) :OTaskbarApplet( parent, name ) { setFixedHeight( AppLnk::smallIconSize() ); setFixedWidth( AppLnk::smallIconSize() ); _pixmap.convertFromImage( Resource::loadImage( "networkapplet/network" ).smoothScale( height(), width() ) ); _control = new NetworkAppletControl( this, "control" ); } diff --git a/noncore/applets/notesapplet/config.in b/noncore/applets/notesapplet/config.in index 27a8187..c92c1d5 100644 --- a/noncore/applets/notesapplet/config.in +++ b/noncore/applets/notesapplet/config.in @@ -1,4 +1,4 @@ config NOTESAPPLET boolean "opie-notesapplet (quick note taking applet)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 13f7cf3..b3e72a7 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp @@ -6,56 +6,58 @@ ** 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. ** **********************************************************************/ #include "notes.h" -#include <qapplication.h> -#include <stdlib.h> -#include <qstringlist.h> - +/* OPIE */ +#include <opie2/odebug.h> #include <opie2/otaskbarapplet.h> #include <qpe/filemanager.h> #include <qpe/qpeapplication.h> #include <qpe/timestring.h> #include <qpe/applnk.h> #include <qpe/ir.h> #include <qpe/config.h> +using namespace Opie::Core; +using namespace Opie::Ui; -// #include <qsocket.h> -// #include <qclipboard.h> +/* QT */ #include <qmultilineedit.h> #include <qlistbox.h> #include <qpopupmenu.h> #include <qmessagebox.h> - +#include <qapplication.h> #include <qdir.h> #include <qfile.h> #include <qpoint.h> #include <qpushbutton.h> #include <qpainter.h> #include <qlayout.h> #include <qframe.h> #include <qpixmap.h> #include <qstring.h> +#include <qstringlist.h> #include <qtimer.h> +/* STD */ +#include <stdlib.h> + /* XPM */ -using namespace Opie::Ui; static char * notes_xpm[] = { "16 16 11 1", " c None", ". c #000000", "+ c #7F7F7F", "@ c #BFBFBF", "# c #BFC1FF", "$ c #FF0000", "% c #FFFFFF", "& c #00037F", "* c #0006FF", "= c #0005BF", @@ -75,27 +77,27 @@ static char * notes_xpm[] = { " ..=**=#&=&=.. ", " ..=*=&=.. ", " ..=.. ", " . "}; NotesControl::NotesControl( QWidget *, const char * ) : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop ) // : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) { QDir d( QDir::homeDirPath()+"/notes"); if( !d.exists()) { - qDebug("make dir"); + odebug << "make dir" << oendl; if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) - qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed"); + odebug << "<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed" << oendl; } Config cfg("Notes"); cfg.setGroup("Options"); showMax = cfg.readBoolEntry("ShowMax", false); setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); loaded=false; edited=false; doPopulate=true; isNew=false; QVBox *vbox = new QVBox( this, "Vlayout" ); QHBox *hbox = new QHBox( this, "HLayout" ); @@ -156,55 +158,55 @@ void NotesControl::slotDeleteButtonClicked() { switch ( QMessageBox::warning(this,tr("Delete?") ,tr("Do you really want to<BR><B> delete</B> this note ?") ,tr("Yes"),tr("No"),0,1,1) ) { case 0: slotDeleteButton(); break; }; } void NotesControl::slotDeleteButton() { QString selectedText = box->currentText(); - qDebug("deleting "+selectedText); + odebug << "deleting "+selectedText << oendl; if( !selectedText.isEmpty()) { Config cfg("Notes"); cfg.setGroup("Docs"); int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); QString entryName, entryName2;; for ( int i = 0; i < noOfFiles; i++ ) { entryName.sprintf( "File%i", i + 1 ); if(selectedText == cfg.readEntry( entryName )) { - qDebug("removing %s, %d", selectedText.latin1(), i); + odebug << "removing " << selectedText.latin1() << ", " << i << "" << oendl; for ( int j = i; j < noOfFiles; j++ ) { entryName.sprintf( "File%i", i + 1 ); entryName2.sprintf( "File%i", i + 2 ); QString temp = cfg.readEntry(entryName2); - qDebug("move "+temp); + odebug << "move "+temp << oendl; cfg.writeEntry(entryName, temp); i++; } cfg.writeEntry("NumberOfFiles", noOfFiles-1 ); entryName.sprintf( "File%i", noOfFiles ); cfg.removeEntry(entryName); cfg.write(); DocLnk nf(selectedText); nf.removeFiles(); QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; - qDebug(fi); + odebug << fi << oendl; QFile f( fi); - if( !f.remove()) qDebug(".desktop file not removed"); + if( !f.remove()) odebug << ".desktop file not removed" << oendl; } } view->clear(); populateBox(); } } void NotesControl::slotNewButton() { if(edited) save(); view->clear(); @@ -274,81 +276,81 @@ void NotesControl::focusOutEvent ( QFocusEvent * e) { if(!loaded) { populateBox(); load(); } } QWidget::focusOutEvent(e); } void NotesControl::save() { Config cfg("Notes"); cfg.setGroup("Docs"); if( edited) { -// qDebug("is edited"); +// odebug << "is edited" << oendl; QString rt = view->text(); if( rt.length()>1) { QString pt = rt.simplifyWhiteSpace(); int i = pt.find( ' ', pt.find( ' ' )+2 ); QString docname = pt; if ( i > 0 ) docname = pt.left(i); // remove "." at the beginning while( docname.startsWith( "." ) ) docname = docname.mid( 1 ); docname.replace( QRegExp("/"), "_" ); // cut the length. filenames longer than that don't make sense // and something goes wrong when they get too long. if ( docname.length() > 40 ) docname = docname.left(40); if ( docname.isEmpty() ) docname = "Empty Text"; -// qDebug(docname); +// odebug << docname << oendl; if( oldDocName != docname) { int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); QString entryName; entryName.sprintf( "File%i", noOfFiles + 1 ); cfg.writeEntry( entryName,docname ); cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); cfg.write(); } // else -// qDebug("oldname equals docname"); +// odebug << "oldname equals docname" << oendl; doc = new DocLnk(docname); if(QFile(doc->linkFile()).exists()) - qDebug("puppie"); + odebug << "puppie" << oendl; doc->setType("text/plain"); doc->setName(docname); QString temp = docname.replace( QRegExp(" "), "_" ); doc->setFile( QDir::homeDirPath()+"/notes/"+temp); FileManager fm; if ( !fm.saveFile( *doc, rt ) ) { } oldDocName=docname; edited=false; -// qDebug("save"); +// odebug << "save" << oendl; if (doPopulate) populateBox(); } cfg.writeEntry( "LastDoc",oldDocName ); cfg.write(); } } void NotesControl::populateBox() { box->clear(); -// qDebug("populate"); +// odebug << "populate" << oendl; Config cfg("Notes"); cfg.setGroup("Docs"); int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); QStringList list; QString entryName; for ( int i = 0; i < noOfFiles; i++ ) { entryName.sprintf( "File%i", i + 1 ); list.append(cfg.readEntry( entryName )); } list.sort(); box->insertStringList(list,-1); doPopulate=false; @@ -365,25 +367,25 @@ void NotesControl::load() { nf.setType("text/plain"); nf.setFile(lastDoc); loadDoc(nf); loaded=true; oldDocName=lastDoc; cfg.writeEntry( "LastDoc",oldDocName ); cfg.write(); } } void NotesControl::load(const QString & file) { - qDebug("loading "+file); + odebug << "loading "+file << oendl; QString name = file; QString temp; if( !QFile( QDir::homeDirPath()+"/"+file).exists() ) temp = QDir::homeDirPath()+"/notes/"+ name.replace( QRegExp(" "), "_" ); else temp = name; if(!loaded) { DocLnk nf; nf.setType("text/plain"); nf.setFile( temp); if(!temp.isEmpty()) loadDoc(nf); @@ -392,25 +394,25 @@ void NotesControl::load(const QString & file) { // view->setFocus(); oldDocName=file; Config cfg("Notes"); cfg.setGroup("Docs"); cfg.writeEntry( "LastDoc",oldDocName ); cfg.write(); } void NotesControl::loadDoc( const DocLnk &f) { FileManager fm; QString txt; if ( !fm.loadFile( f, txt ) ) { - qDebug("could not load file "+f.file()); + odebug << "could not load file "+f.file() << oendl; return; } view->setText(txt); } void NotesControl::slotViewEdited() { if(loaded) { edited=true; } } @@ -426,25 +428,25 @@ void NotesControl::slotShowMax() { void NotesControl::slotSearch() { int boxCount = box->count(); for(int i=0;i< boxCount;i++) { } } // void NotesControl::keyReleaseEvent( QKeyEvent *e) { // switch ( e->state() ) { // case ControlButton: // if(e->key() == Key_C) { //copy -// qDebug("copy"); +// odebug << "copy" << oendl; // QClipboard *cb = QApplication::clipboard(); // QString text; // // Copy text from the clipboard (paste) // text = cb->text(); // } // if(e->key() == Key_X) { //cut // } // if(e->key() == Key_V) { //paste // QClipboard *cb = QApplication::clipboard(); // QString text; // //view @@ -473,28 +475,28 @@ int NotesApplet::position() return 6; } void NotesApplet::mousePressEvent( QMouseEvent *) { if( !vc->isHidden()) { vc->doPopulate=false; vc->save(); vc->close(); } else { // vc = new NotesControl; // QPoint curPos = mapToGlobal( rect().topLeft() ); if(vc->showMax) { - qDebug("show max"); + odebug << "show max" << oendl; vc->showMaximized(); } else { - qDebug("no show max"); + odebug << "no show max" << oendl; QWidget *wid = QPEApplication::desktop(); QRect rect = QApplication::desktop()->geometry(); vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180); vc->move ( (rect.center()/2) - (vc->rect().center()/2)); // vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28); } vc->show(); vc->doPopulate=true; vc->populateBox(); vc->doPopulate=false; vc->loaded=false; diff --git a/noncore/applets/notesapplet/notesapplet.pro b/noncore/applets/notesapplet/notesapplet.pro index 44e5b34..c3f9b1c 100644 --- a/noncore/applets/notesapplet/notesapplet.pro +++ b/noncore/applets/notesapplet/notesapplet.pro @@ -1,12 +1,12 @@ -TEMPLATE = lib -CONFIG += qt plugin warn_on -HEADERS = notes.h -SOURCES = notes.cpp -TARGET = notesapplet -DESTDIR = $(OPIEDIR)/plugins/applets +TEMPLATE = lib +CONFIG += qt plugin warn_on +HEADERS = notes.h +SOURCES = notes.cpp +TARGET = notesapplet +DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -VERSION = 1.0.0 +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe -lopiecore2 +VERSION = 1.0.1 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp index 0491a86..364f3ad 100644 --- a/noncore/applets/wirelessapplet/wireless.cpp +++ b/noncore/applets/wirelessapplet/wireless.cpp @@ -7,53 +7,55 @@ ** 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. ** **********************************************************************/ #include "wireless.h" #include "mgraph.h" #include "advancedconfig.h" /* OPIE */ +#include <opie2/odebug.h> #include <opie2/onetwork.h> #include <opie2/otaskbarapplet.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; +using namespace Opie::Ui; +using namespace Opie::Net; /* QT */ #include <qradiobutton.h> #include <qpushbutton.h> #include <qpainter.h> #include <qlabel.h> #include <qslider.h> #include <qbuttongroup.h> #include <qlayout.h> #include <qfile.h> #include <qtextstream.h> /* STD */ #include <math.h> #include <sys/types.h> #include <signal.h> #if defined (__GNUC__) && (__GNUC__ < 3) #define round qRound #endif //#define MDEBUG #undef MDEBUG -using namespace Opie::Ui; -using namespace Opie::Net; WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) { readConfig(); writeConfigEntry( "UpdateFrequency", updateFrequency ); setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); /* status label */ @@ -198,84 +200,84 @@ void WirelessApplet::checkInterface() ONetwork* net = ONetwork::instance(); net->synchronize(); ONetwork::InterfaceIterator it = net->iterator(); while ( it.current() && !it.current()->isWireless() ) ++it; if ( it.current() && it.current()->isWireless() ) interface = static_cast<OWirelessNetworkInterface*>( it.current() ); if ( interface ) { #ifdef MDEBUG - qDebug( "WIFIAPPLET: using interface '%s'", ( const char* ) interface->name() ); + odebug << "WIFIAPPLET: using interface '" << ( const char* ) interface->name() << "'" << oendl; #endif } else { #ifdef MDEBUG - qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" ); + odebug << "WIFIAPPLET: D'oh! No Wireless interface present... :(" << oendl; #endif hide(); } } void WirelessApplet::renewDHCP() { #ifdef MDEBUG - qDebug( "WIFIAPPLET: Going to request a DHCP configuration renew." ); + odebug << "WIFIAPPLET: Going to request a DHCP configuration renew." << oendl; #endif QString pidfile; if ( !interface ) return ; QString ifacename( interface->name() ); // At first we are trying dhcpcd pidfile.sprintf( "/var/run/dhcpcd-%s.pid", ( const char* ) ifacename ); #ifdef MDEBUG - qDebug( "WIFIAPPLET: dhcpcd pidfile is '%s'", ( const char* ) pidfile ); + odebug << "WIFIAPPLET: dhcpcd pidfile is '" << ( const char* ) pidfile << "'" << oendl; #endif int pid; QFile pfile( pidfile ); bool hasFile = pfile.open( IO_ReadOnly ); QTextStream s( &pfile ); if ( hasFile ) { s >> pid; #ifdef MDEBUG - qDebug( "WIFIAPPLET: sent SIGALARM to pid %d", pid ); + odebug << "WIFIAPPLET: sent SIGALARM to pid " << pid << "" << oendl; #endif kill( pid, SIGALRM ); return ; } // No dhcpcd, so we are trying udhcpc #ifdef MDEBUG - qDebug( "WIFIAPPLET: dhcpcd not available." ); + odebug << "WIFIAPPLET: dhcpcd not available." << oendl; #endif pidfile.sprintf( "/var/run/udhcpc.%s.pid", ( const char* ) ifacename ); #ifdef MDEBUG - qDebug( "WIFIAPPLET: udhcpc pidfile is '%s'", ( const char* ) pidfile ); + odebug << "WIFIAPPLET: udhcpc pidfile is '" << ( const char* ) pidfile << "'" << oendl; #endif QFile pfile2( pidfile ); hasFile = pfile2.open( IO_ReadOnly ); QTextStream s2( &pfile2 ); if ( hasFile ) { s2 >> pid; #ifdef MDEBUG - qDebug( "WIFIAPPLET: sent SIGUSR1 to pid %d", pid ); + odebug << "WIFIAPPLET: sent SIGUSR1 to pid " << pid << "" << oendl; #endif kill( pid, SIGUSR1 ); return ; } } void WirelessApplet::updateDHCPConfig( bool ESSID, bool FREQ, bool AP, bool MODE ) { rocESSID = ESSID; rocFREQ = FREQ; rocAP = AP; rocMODE = MODE; @@ -294,42 +296,42 @@ void WirelessApplet::updateDelayChange( int delay ) void WirelessApplet::displayStyleChange( int style ) { visualStyle = style; repaint(); } WirelessApplet::~WirelessApplet() {} void WirelessApplet::timerEvent( QTimerEvent* ) { #ifdef MDEBUG - qDebug( "WirelessApplet::timerEvent" ); + odebug << "WirelessApplet::timerEvent" << oendl; #endif if ( interface ) { if ( !ONetwork::instance()->isPresent( (const char*) interface->name() ) ) { #ifdef MDEBUG - qDebug( "WIFIAPPLET: Interface no longer present." ); + odebug << "WIFIAPPLET: Interface no longer present." << oendl; #endif interface = 0L; mustRepaint(); return; } if ( mustRepaint() ) { #ifdef MDEBUG - qDebug( "WIFIAPPLET: A value has changed -> repainting." ); + odebug << "WIFIAPPLET: A value has changed -> repainting." << oendl; #endif repaint(); } if ( status->isVisible() ) { updatePopupWindow(); } } else { checkInterface(); @@ -347,32 +349,32 @@ void WirelessApplet::mousePressEvent( QMouseEvent * ) bool WirelessApplet::mustRepaint() { // check if there are enough changes to justify a (flickering) repaint // has the interface changed? if ( interface != oldiface ) { oldiface = interface; if ( interface ) { #ifdef MDEBUG - qDebug( "WIFIAPPLET: We had no interface but now we have one! :-)" ); + odebug << "WIFIAPPLET: We had no interface but now we have one! :-)" << oendl; #endif show(); } else { #ifdef MDEBUG - qDebug( "WIFIAPPLET: We had a interface but now we don't have one! ;-(" ); + odebug << "WIFIAPPLET: We had a interface but now we don't have one! ;-(" << oendl; #endif hide(); return true; } } int rings = numberOfRings(); if ( rings != oldrings ) { oldrings = rings; return true; @@ -386,46 +388,46 @@ bool WirelessApplet::mustRepaint() || ( signalH != oldsignalH ) || ( qualityH != oldqualityH ) ) { oldnoiseH = noiseH; oldsignalH = signalH; oldqualityH = qualityH; return true; } if ( rocESSID && ( oldESSID != interface->SSID() ) ) { #ifdef MDEBUG - qDebug( "WIFIAPPLET: ESSID has changed." ); + odebug << "WIFIAPPLET: ESSID has changed." << oendl; #endif renewDHCP(); } else if ( rocFREQ && ( oldFREQ != interface->frequency() ) ) { #ifdef MDEBUG - qDebug( "WIFIAPPLET: FREQ has changed." ); + odebug << "WIFIAPPLET: FREQ has changed." << oendl; #endif renewDHCP(); } else if ( rocAP && ( oldAP != interface->associatedAP().toString() ) ) { #ifdef MDEBUG - qDebug( "WIFIAPPLET: AP has changed." ); + odebug << "WIFIAPPLET: AP has changed." << oendl; #endif renewDHCP(); } else if ( rocMODE && ( oldMODE != interface->mode() ) ) { #ifdef MDEBUG - qDebug( "WIFIAPPLET: MODE has changed." ); + odebug << "WIFIAPPLET: MODE has changed." << oendl; #endif renewDHCP(); } oldESSID = interface->SSID(); oldMODE = interface->mode(); oldFREQ = interface->frequency(); oldAP = interface->associatedAP().toString(); return false; } @@ -441,25 +443,25 @@ void WirelessApplet::updatePopupWindow() freqString.sprintf( "%.3f GHz", interface->frequency() ); status->statusLabel->setText( "Station: " + interface->nickName() + "<br>" + "ESSID: " + interface->SSID() + "<br>" + "MODE: " + interface->mode() + "<br>" + "FREQ: " + freqString + "<br>" + cell + " " + interface->associatedAP().toString() ); } int WirelessApplet::numberOfRings() { if ( !interface ) return -1; int qualityH = interface->signalStrength(); - qDebug( "quality = %d", qualityH ); + odebug << "quality = " << qualityH << "" << oendl; if ( qualityH < 1 ) return -1; if ( qualityH < 20 ) return 0; if ( qualityH < 40 ) return 1; if ( qualityH < 60 ) return 2; if ( qualityH < 65 ) return 3; return 4; } void WirelessApplet::paintEvent( QPaintEvent* ) { QPainter p( this ); int h = height(); @@ -472,25 +474,25 @@ void WirelessApplet::paintEvent( QPaintEvent* ) p.drawLine( w-m, h-m-1, m, h-m-1 ); int rings = numberOfRings(); if ( rings == -1 ) { p.setPen( QPen( QColor( 200, 20, 20 ), 2 ) ); p.drawLine( w/2-m-m, h/2-m-m, w/2+m+m, h/2+m+m ); p.drawLine( w/2+m+m, h/2-m-m, w/2-m-m, h/2+m+m ); return; } - qDebug( "WirelessApplet: painting %d rings", rings ); + odebug << "WirelessApplet: painting " << rings << " rings" << oendl; int radius = 2; int rstep = 4; int maxrings = w/rstep; p.setPen( QColor( 200, 20, 20 ) ); for ( int i = 0; i < rings; ++i ) { p.drawEllipse( w/2 - radius/2, h/3 - radius/2, radius, radius ); radius += rstep; }; diff --git a/noncore/applets/zkbapplet/zkbwidget.cpp b/noncore/applets/zkbapplet/zkbwidget.cpp index 3acff1e..13d554c 100644 --- a/noncore/applets/zkbapplet/zkbwidget.cpp +++ b/noncore/applets/zkbapplet/zkbwidget.cpp @@ -85,25 +85,25 @@ bool ZkbWidget::loadKeymap() { hide(); } else { show(); } return true; } QSize ZkbWidget::sizeHint() const { return QSize(AppLnk::smallIconSize(),AppLnk::smallIconSize()); } void ZkbWidget::stateChanged(const QString& s) { -// qDebug("stateChanged: %s\n", (const char*) s.utf8()); +// odebug << "stateChanged: " << (const char*) s.utf8() << "\n" << oendl; setText(s); } void ZkbWidget::labelChanged(int id) { if (id == 0) { keymap->disable(); setPixmap(disabled); return; } keymap->enable(); diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index a60d6ce..a47edd8 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -62,53 +62,53 @@ AdvancedFm::~AdvancedFm() { void AdvancedFm::cleanUp() { QString sfile=QDir::homeDirPath(); if(sfile.right(1) != "/") sfile+="/._temp"; else sfile+="._temp"; QFile file( sfile); if(file.exists()) file.remove(); } void AdvancedFm::tabChanged(QWidget *) { -// qWarning("tab changed"); +// owarn << "tab changed" << oendl; QString path = CurrentDir()->canonicalPath(); currentPathCombo->lineEdit()->setText( path ); if(whichTab == 1) { viewMenu->setItemChecked(viewMenu->idAt(0), true); viewMenu->setItemChecked(viewMenu->idAt(1), false); } else { viewMenu->setItemChecked(viewMenu->idAt(0), false); viewMenu->setItemChecked(viewMenu->idAt(1), true); } QString fs= getFileSystemType( (const QString &) path); setCaption(tr("AdvancedFm :: ")+fs+" :: " +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); chdir( path.latin1()); } void AdvancedFm::populateView() { -// qWarning("PopulateView"); +// owarn << "PopulateView" << oendl; QPixmap pm; QListView *thisView = CurrentView(); QDir *thisDir = CurrentDir(); QString path = thisDir->canonicalPath(); -//qWarning("path is "+path); +//owarn << "path is "+path << oendl; thisView->clear(); thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); thisDir->setMatchAllDirs(TRUE); thisDir->setNameFilter(filterStr); QString fileL, fileS, fileDate; QString fs= getFileSystemType((const QString &) path); setCaption(tr("AdvancedFm :: ")+fs+" :: " +checkDiskSpace((const QString &) path)+ tr(" kB free") ); bool isDir=FALSE; const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); QFileInfoListIterator it(*list); QFileInfo *fi; @@ -151,87 +151,87 @@ void AdvancedFm::populateView() { } else if( !fi->isReadable() ) { pm = Resource::loadPixmap( "locked" ); } else { //everything else goes by mimetype MimeType mt(fi->filePath()); pm=mt.pixmap(); //sets the correct pixmap for mimetype if(pm.isNull()) { pm = unknownXpm; } } if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { - // qDebug(" overlay link image"); + // odebug << " overlay link image" << oendl; pm= Resource::loadPixmap( "advancedfm/symlink" ); // pm= Resource::loadPixmap( "folder" ); // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); // QPainter painter( &pm ); // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); // pm.setMask( pm.createHeuristicMask( FALSE ) ); } item->setPixmap( 0,pm); } isDir=FALSE; ++it; } if( path.find("dev",0,TRUE) != -1) { struct stat buf; dev_t devT; DIR *dir; struct dirent *mydirent; if((dir = opendir( path.latin1())) != NULL) while ((mydirent = readdir(dir)) != NULL) { lstat( mydirent->d_name, &buf); -// qDebug(mydirent->d_name); +// odebug << mydirent->d_name << oendl; fileL.sprintf("%s", mydirent->d_name); devT = buf.st_dev; fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); fileDate.sprintf("%s", ctime( &buf.st_mtime)); if( fileL.find(".") == -1 ) { item= new QListViewItem( thisView, fileL, fileS, fileDate); pm = unknownXpm; item->setPixmap( 0,pm); } } closedir(dir); } thisView->setSorting( 3,FALSE); fillCombo( (const QString &) path ); } void AdvancedFm::rePopulate() { populateView(); setOtherTabCurrent(); populateView(); // int tmpTab = whichTab; -// // qDebug("%d", tmpTab); +// // odebug << "" << tmpTab << "" << oendl; // for(int i =1; i < 3; i++) { // TabWidget->setCurrentWidget(i - 1); // populateView(); // } // TabWidget->setCurrentWidget( tmpTab - 1); } void AdvancedFm::ListClicked(QListViewItem *selectedItem) { -//qWarning("listclicked"); +//owarn << "listclicked" << oendl; if(selectedItem) { QString strItem=selectedItem->text(0); -// qWarning(strItem); +// owarn << strItem << oendl; QString strSize=selectedItem->text(1); strSize=strSize.stripWhiteSpace(); bool isDirectory = false; QString strItem2; if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink strItem2 = dealWithSymName((const QString&)strItem); if(QDir(strItem2).exists() ) strItem = strItem2; } if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { @@ -258,31 +258,31 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in cancelRename(); } } break; case 2: menuTimer.start( 500, TRUE ); break; }; } void AdvancedFm::switchToLocalTab() { -//qWarning("switch to local view"); +//owarn << "switch to local view" << oendl; TabWidget->setCurrentWidget(0); Local_View->setFocus(); } void AdvancedFm::switchToRemoteTab() { -//qWarning("switch to local view"); +//owarn << "switch to local view" << oendl; TabWidget->setCurrentWidget(1); Remote_View->setFocus(); } void AdvancedFm::readConfig() { Config cfg("AdvancedFm"); } void AdvancedFm::writeConfig() { Config cfg("AdvancedFm"); } @@ -320,25 +320,25 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) { populateView(); update(); } QStringList AdvancedFm::getPath() { QStringList strList; QListView *thisView=CurrentView(); QList<QListViewItem> * getSelectedItems( QListView * thisView ); QListViewItemIterator it( thisView ); for ( ; it.current(); ++it ) { if ( it.current()->isSelected() ) { strList << it.current()->text(0); -// qDebug(it.current()->text(0)); +// odebug << it.current()->text(0) << oendl; } } return strList; } void AdvancedFm::homeButtonPushed() { QString current = QDir::homeDirPath(); chdir( current.latin1() ); CurrentDir()->cd( current, TRUE); populateView(); update(); } @@ -371,25 +371,25 @@ void AdvancedFm::CFButtonPushed() { update(); } void AdvancedFm::doAbout() { QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" "is copyright 2002-2003 by\n" "L.J.Potter<llornkcor@handhelds.org>\n" "and is licensed by the GPL")); } void AdvancedFm::keyPressEvent( QKeyEvent *e) { -// qWarning("key %d", e->key()); +// owarn << "key " << e->key() << "" << oendl; // if( CurrentView()->hasFocus() ) { switch ( e->key() ) { case Key_Left: upDir(); break; case Key_Next: break; case Key_Return: case Key_Enter: navigateToSelected(); break; @@ -629,25 +629,25 @@ QString AdvancedFm::checkDiskSpace(const QString &path) { } return ""; } void AdvancedFm::addToDocs() { QStringList strListPaths = getPath(); QDir *thisDir = CurrentDir(); if( strListPaths.count() > 0) { QString curFile; for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { curFile = thisDir->canonicalPath()+"/"+(*it); -// qDebug(curFile); +// odebug << curFile << oendl; QFileInfo fi(curFile); DocLnk f; // curFile.replace(QRegExp("\\..*"),""); f.setName(fi.baseName() ); f.setFile( curFile); f.writeLink(); } } } void AdvancedFm::customDirsToMenu() { @@ -702,25 +702,25 @@ void AdvancedFm::addCustomDir() { } if(addIt) { menuButton->insertItem(dir); // customDirMenu->insertItem(dir); list << dir; } cfg.writeEntry("CustomDir", list, ','); cfg.write(); } void AdvancedFm::removeCustomDir() { -// qDebug("remove custom dir"); +// odebug << "remove custom dir" << oendl; Config cfg("AdvancedFm"); cfg.setGroup("Menu"); QString dir; QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); QStringList list2; dir = CurrentDir()->canonicalPath(); int ramble=2; // int ramble=-24; //first remove list if(list.grep(dir,true).isEmpty()) { QMessageBox::message(tr( "AdvancedFm" ), tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); @@ -737,25 +737,25 @@ void AdvancedFm::removeCustomDir() { ramble++; // ramble--; } cfg.writeEntry("CustomDir", list2, ','); cfg.write(); } // customDirsToMenu(); } void AdvancedFm::gotoCustomDir(const QString &dir) { -// qDebug("gotoCustomDir(const QString &dir) " +dir ); +// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; // QString curDir = dir; // QDir *thisDir = CurrentDir(); // if( curDir.isEmpty()) { // } if( dir == s_addBookmark) { addCustomDir(); } if( dir == s_removeBookmark) { removeCustomDir( ); } else { gotoDirectory( dir); // if(QDir( curDir).exists() ) @@ -778,68 +778,68 @@ QDir *AdvancedFm::CurrentDir() { } QDir *AdvancedFm::OtherDir() { if ( whichTab == 1) { return ¤tRemoteDir; } else { return ¤tDir; } } QListView * AdvancedFm::CurrentView() { if ( whichTab == 1) { -// qWarning("CurrentView Tab 1"); +// owarn << "CurrentView Tab 1" << oendl; return Local_View; } else { -// qWarning("CurrentView Tab 2"); +// owarn << "CurrentView Tab 2" << oendl; return Remote_View; } } QListView * AdvancedFm::OtherView() { if ( whichTab == 1) return Remote_View; else return Local_View; } void AdvancedFm::setOtherTabCurrent() { -// qWarning("setOtherTabCurrent() %d", whichTab); +// owarn << "setOtherTabCurrent() " << whichTab << "" << oendl; if ( whichTab == 1) { TabWidget->setCurrentWidget(1); } else { TabWidget->setCurrentWidget(0); } OtherView()->setFocus(); OtherView()->setSelected( CurrentView()->firstChild(), true); } void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { -// qDebug("qcop message "+msg ); +// odebug << "qcop message "+msg << oendl; QDataStream stream ( data, IO_ReadOnly ); if ( msg == "openDirectory(QString)" ) { -// qDebug("received"); +// odebug << "received" << oendl; QString file; stream >> file; gotoDirectory( (const QString &) file); } } void AdvancedFm::setDocument(const QString &file) { gotoDirectory( file); } void AdvancedFm::gotoDirectory(const QString &file) { -// qWarning("goto dir "+file); +// owarn << "goto dir "+file << oendl; QString curDir = file; QDir *thisDir = CurrentDir(); if(QDir( curDir).exists() ) { thisDir->setPath( curDir ); chdir( curDir.latin1() ); thisDir->cd( curDir, TRUE); populateView(); } else if(QFileInfo(curDir).exists()) { QFileInfo fileInfo(curDir); curDir=fileInfo.dirPath(); if(QDir( curDir).exists() ) { @@ -857,25 +857,25 @@ void AdvancedFm::findFile(const QString &fileName) { QFileInfo fi(fileName); QListView *thisView = CurrentView(); QListViewItemIterator it( thisView ); for ( ; it.current(); ++it ) { if(it.current()->text(0) == fi.fileName()) { it.current()->setSelected(true); thisView->ensureItemVisible(it.current()); } } } void AdvancedFm::slotSwitchMenu(int ) { -// qDebug("Switch %d", item); +// odebug << "Switch " << item << "" << oendl; // viewMenu->setItemChecked(item, true); } void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) { tabChanged( w); if( w == Local_View) { Remote_View->clearFocus(); } else { Local_View->clearFocus(); } } diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index 716343d..f1c518e 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro @@ -1,35 +1,15 @@ TEMPLATE = app -CONFIG += qt warn_on quick-app -# CONFIG += qt warn_on +CONFIG += qt warn_on quick-app HEADERS = advancedfm.h filePermissions.h output.h SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp TARGET = advancedfm INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopiecore2 -lopieui2 - -TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ - ../../../i18n/nl/advancedfm.ts \ - ../../../i18n/da/advancedfm.ts \ - ../../../i18n/xx/advancedfm.ts \ - ../../../i18n/en/advancedfm.ts \ - ../../../i18n/es/advancedfm.ts \ - ../../../i18n/fr/advancedfm.ts \ - ../../../i18n/hu/advancedfm.ts \ - ../../../i18n/ja/advancedfm.ts \ - ../../../i18n/ko/advancedfm.ts \ - ../../../i18n/no/advancedfm.ts \ - ../../../i18n/pl/advancedfm.ts \ - ../../../i18n/pt/advancedfm.ts \ - ../../../i18n/pt_BR/advancedfm.ts \ - ../../../i18n/sl/advancedfm.ts \ - ../../../i18n/zh_CN/advancedfm.ts \ - ../../../i18n/zh_TW/advancedfm.ts - +LIBS += -lqpe -lopiecore2 -lopieui2 !contains(CONFIG,quick-app) { DESTDIR = $(OPIEDIR)/bin DEFINES += NOQUICKLAUNCH } include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 2997c55..29335f8 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp @@ -2,41 +2,45 @@ advancedfmData.cpp ------------------- ** Created: Mon 09-23-2002 13:24:11 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. * ***************************************************************************/ #include "advancedfm.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/storage.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/menubutton.h> +using namespace Opie::Core; +using namespace Opie::Ui; +/* QT */ #include <qlayout.h> #include <qhbox.h> #include <qmenubar.h> #include <qcombobox.h> #include <qtoolbutton.h> #include <qlineedit.h> #include <qlistview.h> +/* STD */ #include <sys/utsname.h> - -using namespace Opie::Ui; void AdvancedFm::init() { b = false; setCaption( tr( "AdvancedFm" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); layout->setSpacing( 2); layout->setMargin( 0); // squeeze QMenuBar *menuBar = new QMenuBar(this); menuBar->setMargin( 0 ); // squeeze fileMenu = new QPopupMenu( this ); viewMenu = new QPopupMenu( this ); @@ -210,29 +214,29 @@ void AdvancedFm::init() { TabWidget->insertTab( tab_3, tr( "Remote" ) ); */ /////////////// if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) zaurusDevice=TRUE; else zaurusDevice=FALSE; if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { - qDebug("not have sd"); + odebug << "not have sd" << oendl; sdButton->hide(); } if( !StorageInfo::hasCf() ) { - qDebug("not have cf"); + odebug << "not have cf" << oendl; cfButton->hide(); } currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); currentDir.setPath( QDir::currentDirPath()); currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); currentRemoteDir.setPath( QDir::currentDirPath()); // b = TRUE; filterStr="*"; showMenuHidden(); diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 81a4318..d34f330 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -1,839 +1,842 @@ -/***************************************************************************
- AdvancedFm.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. *
- ***************************************************************************/
-#include "advancedfm.h"
-#include "output.h"
-#include "filePermissions.h"
-
-#include <qpe/lnkproperties.h>
-#include <qpe/qpeapplication.h>
-#include <qpe/applnk.h>
-
-#include <qmessagebox.h>
-
-
-#include <qpopupmenu.h>
-#include <qlistview.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <sys/sendfile.h>
-#include <fcntl.h>
-
-
-using namespace Opie::Core;
-using namespace Opie::Core;
-void AdvancedFm::doDirChange() {
- QString pathItem = CurrentView()->currentItem()->text(0);
- if( pathItem == "../") {
- ListClicked( CurrentView()->currentItem());
- } else {
- if( pathItem.find(" -> ",0,TRUE) != -1)
- pathItem = dealWithSymName((const QString&)pathItem)+"/";
-// qWarning(pathItem);
- gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
- }
-}
-
-void AdvancedFm::showMenuHidden() {
- if (b) {
- CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
- OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
- fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
- } else {
- CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
- OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
- fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
- }
- b = !b;
- populateView();
-}
-
-void AdvancedFm::showHidden() {
- if (b) {
- CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
- OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
- } else {
- CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
- OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
- }
- populateView();
-}
-
-QString AdvancedFm::dealWithSymName(const QString &fileName) {
- QString strItem = fileName;
- return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
-}
-
-void AdvancedFm::runThis() {
- if( !CurrentView()->currentItem()) return;
- QString fs;
- QDir *thisDir = CurrentDir();
-
- QString curFile = CurrentView()->currentItem()->text(0);
- QString path = thisDir->canonicalPath();
-
- if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
-
- curFile = dealWithSymName((const QString&)curFile);
-
- if(curFile != "../") {
-
- fs = getFileSystemType((const QString &) path);
- QFileInfo fileInfo( path + "/" + curFile);
-// qDebug( fileInfo.owner());
-
- if( (fileInfo.permission( QFileInfo::ExeUser)
- | fileInfo.permission( QFileInfo::ExeGroup)
- | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
- | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
- QCopEnvelope e("QPE/System", "execute(QString)" );
- e << curFile;
- } else {
- curFile = path + "/" + curFile;
- DocLnk nf(curFile);
- QString execStr = nf.exec();
-// qDebug( execStr);
- if( execStr.isEmpty() ) {
- } else {
- nf.execute();
- }
- }
- }
-}
-
-void AdvancedFm::runText() {
- if( !CurrentView()->currentItem()) return;
- QString curFile = CurrentView()->currentItem()->text(0);
- if(curFile != "../") {
- if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
- curFile = dealWithSymName((const QString&)curFile);
- curFile = CurrentDir()->canonicalPath()+"/"+curFile;
- QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
- e << curFile;
- }
-}
-
-void AdvancedFm::makeDir() {
- InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
- fileDlg->exec();
- if( fileDlg->result() == 1 ) {
- QDir *thisDir = CurrentDir();
- QString filename = fileDlg->LineEdit1->text();
- thisDir->mkdir( thisDir->canonicalPath()+"/"+filename);
- }
- populateView();
-}
-
-void AdvancedFm::doDelete() {
- QStringList curFileList = getPath();
- bool doMsg=true;
- int count = curFileList.count();
- if( count > 0) {
- if(count > 1 ) {
- QString msg;
- msg=tr("Really delete\n%1 files?").arg(count);
- switch ( QMessageBox::warning(this,tr("Delete"),msg
- ,tr("Yes"),tr("No"),0,0,1) )
- {
- case 0:
- doMsg=false;
- break;
- case 1:
- return;
- break;
- };
- }
-
- QString myFile;
-
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- myFile = (*it);
- if( myFile.find(" -> ",0,TRUE) != -1)
- myFile = myFile.left( myFile.find(" -> ",0,TRUE));
-
- QString f = CurrentDir()->canonicalPath();
- if(f.right(1).find("/",0,TRUE) == -1)
- f += "/";
- f += myFile;
- if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
- //if file is a directory
-
- switch ( QMessageBox::warning( this, tr("Delete Directory?"),
- tr("Really delete %1\nand all it's contents ?" ).arg( f ) ,
- tr("Yes"), tr("No"), 0, 0, 1) ) {
- case 0:
- {
- f=f.left(f.length()-1);
- QString cmd="rm -rf "+f;
- startProcess( (const QString)cmd.latin1() );
- populateView();
- }
- break;
- case 1:
- // exit
- break;
- };
-
- } else {
- if(doMsg) {
- switch ( QMessageBox::warning(this,tr("Delete"),
- tr("Really delete\n%1?").arg( myFile ),
- tr("Yes"), tr("No"), 0, 0, 1) ) {
- case 1:
- return;
- break;
- };
- }
-
- QString cmd="rm "+f;
- QFile file(f);
- QFileInfo fi(myFile);
- if( fi.fileName().find("../",0,TRUE)==-1) {
-// qDebug("remove link files "+myFile);
-
-// DocLnk lnk(f);
- DocLnk *lnk;
- lnk = new DocLnk(f);
-// qDebug("Deleting doclnk " + lnk->linkFile());
- if(lnk->isValid())
- lnk->removeLinkFile();
- // delete lnk;
- file.remove();
- }
- }
- }
- }
- populateView();
-}
-
-void AdvancedFm::filePerms() {
- QStringList curFileList = getPath();
- QString filePath;
-
- filePath = CurrentDir()->canonicalPath()+"/";
-
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- filePermissions *filePerm;
- filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
- QPEApplication::execDialog( filePerm );
- if( filePerm )
- delete filePerm;
- }
- populateView();
-}
-
-void AdvancedFm::doProperties() {
-#if defined(QT_QWS_OPIE)
-
- QStringList curFileList = getPath();
-
- QString filePath;
- filePath = CurrentDir()->canonicalPath()+"/";
-
-// qDebug("%d",curFileList.count());
-
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
-// qDebug((filePath+*it));
- DocLnk lnk( (filePath+*it));
- LnkProperties prop( &lnk );
- QPEApplication::execDialog( &prop );
- }
-#endif
-
-}
-
-void AdvancedFm::upDir() {
- QDir *thisDir = CurrentDir();
- QString current = thisDir->canonicalPath();
- QDir dir(current);
- dir.cdUp();
- current = dir.canonicalPath();
- chdir( current.latin1() );
- thisDir->cd( current, TRUE);
-
- populateView();
- update();
-}
-
-void AdvancedFm::copy() {
- qApp->processEvents();
- QStringList curFileList = getPath();
-
- QDir *thisDir = CurrentDir();
- QDir *thatDir = OtherDir();
-
- bool doMsg=true;
- int count=curFileList.count();
- if( count > 0) {
- if(count > 1 ){
- QString msg;
- msg=tr("Really copy\n%1 files?").arg(count);
- switch ( QMessageBox::warning(this,tr("Copy"),msg
- ,tr("Yes"),tr("No"),0,0,1) )
- {
- case 0:
- doMsg=false;
- break;
- case 1:
- return;
- break;
- };
- }
-
- QString curFile, item, destFile;
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- item=(*it);
- if(item.find("->",0,TRUE)) //symlink
- item = item.left(item.find("->",0,TRUE));
-
- curFile = thisDir->canonicalPath()+"/"+ item;
- destFile = thatDir->canonicalPath()+"/"+ item;
-
-// qDebug("Destination file is "+destFile);
-// qDebug("CurrentFile file is " + curFile);
-
- QFile f(destFile);
- if( f.exists()) {
- if(doMsg) {
- switch ( QMessageBox::warning(this,tr("File Exists!"),
- tr("%1 exists. Ok to overwrite?").arg( item ),
- tr("Yes"),tr("No"),0,0,1) ) {
- case 1:
- return;
- break;
- };
- }
- f.remove();
- }
-
- if( !copyFile( curFile, destFile) ) {
- QMessageBox::message("AdvancedFm",
- tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) );
- return;
- }
- }
- setOtherTabCurrent();
- rePopulate();
- }
-}
-
-void AdvancedFm::copyAs() {
- qApp->processEvents();
-
- QStringList curFileList = getPath();
- QString curFile, item;
- InputDialog *fileDlg;
-
- QDir *thisDir = CurrentDir();
- QDir *thatDir = OtherDir();
-
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- QString destFile;
- item=(*it);
- curFile = thisDir->canonicalPath()+"/"+(*it);
- fileDlg = new InputDialog( this, tr("Copy "+curFile+" As"), TRUE, 0);
-
- fileDlg->setInputText((const QString &) destFile );
- fileDlg->exec();
-
- if( fileDlg->result() == 1 ) {
- QString filename = fileDlg->LineEdit1->text();
- destFile = thatDir->canonicalPath()+"/"+filename;
-
- QFile f( destFile);
- if( f.exists()) {
- switch (QMessageBox::warning(this,tr("File Exists!"),
- item+tr("\nexists. Ok to overwrite?"),
- tr("Yes"),tr("No"),0,0,1) ) {
- case 0:
- f.remove();
- break;
- case 1:
- return;
- break;
- };
- }
- if( !copyFile( curFile, destFile) ) {
- QMessageBox::message("AdvancedFm",tr("Could not copy\n")
- +curFile +tr("to\n")+destFile);
- return;
- }
- }
- delete fileDlg;
-
- }
- rePopulate();
- setOtherTabCurrent();
-}
-
-void AdvancedFm::copySameDir() {
- qApp->processEvents();
- QStringList curFileList = getPath();
- QString curFile, item, destFile;
- InputDialog *fileDlg;
-
- QDir *thisDir = CurrentDir();
-
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- item=(*it);
- curFile = thisDir->canonicalPath()+"/"+ item;
-
- fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
- fileDlg->setInputText((const QString &) destFile );
- fileDlg->exec();
-
- if( fileDlg->result() == 1 ) {
-
- QString filename = fileDlg->LineEdit1->text();
- destFile = thisDir->canonicalPath()+"/"+filename;
-
- QFile f(destFile);
- if( f.exists()) {
- switch (QMessageBox::warning(this,tr("Delete"),
- destFile+tr(" already exists.\nDo you really want to delete it?"),
- tr("Yes"),tr("No"),0,0,1) ) {
- case 0:
-
- f.remove();
- break;
- case 1:
- return;
- break;
- };
- }
- if(!copyFile( curFile,destFile) ) {
- QMessageBox::message("AdvancedFm",tr("Could not copy\n")
- +curFile +tr("to\n")+destFile);
- return;
- }
-
-// qDebug("copy "+curFile+" as "+destFile);
- }
- delete fileDlg;
- }
- rePopulate();
-}
-
-void AdvancedFm::move() {
- qApp->processEvents();
-
- QStringList curFileList = getPath();
- if( curFileList.count() > 0) {
- QString curFile, destFile, item;
-
- QDir *thisDir = CurrentDir();
- QDir *thatDir = OtherDir();
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- item=(*it);
- QString destFile = thatDir->canonicalPath();
-
- if(destFile.right(1).find("/",0,TRUE) == -1)
- destFile+="/";
- destFile += item;
-// qDebug("Destination file is "+destFile);
-
- curFile = thisDir->canonicalPath();
- if(curFile.right(1).find("/",0,TRUE) == -1)
- curFile +="/";
- curFile+= item;
-// qDebug("CurrentFile file is " + curFile);
-
- if(QFileInfo(curFile).isDir()) {
- moveDirectory( curFile, destFile );
- rePopulate();
- return;
- }
-
- QFile f( curFile);
- if( f.exists()) {
- if( !copyFile( curFile, destFile) ) {
- QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
- return;
- } else
- QFile::remove(curFile);
- }
- }
-
- }
- rePopulate();
- setOtherTabCurrent();
-}
-
-bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) {
- int err = 0;
- if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src;
- err = system((const char*)cmd);
- } else
- err = -1;
-
- if(err!=0) {
- QMessageBox::message(tr("Note"),tr("Could not move\n") + src);
- return false;
- }
- return true;
-}
-
-bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) {
-
- QString cmd = "/bin/cp -fpR " + src + " " + dest;
- qWarning(cmd);
- int err = system( (const char *) cmd );
- if ( err != 0 ) {
- QMessageBox::message("AdvancedFm",
- tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) );
- return false;
- }
-
- return true;
-}
-
-
-bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
-
-
- if(QFileInfo(src).isDir()) {
- if( copyDirectory( src, dest )) {
- setOtherTabCurrent();
- populateView();
- return true;
- }
- else
- return false;
- }
-
-
- bool success = true;
- struct stat status;
- QFile srcFile(src);
- QFile destFile(dest);
- int err=0;
- int read_fd=0;
- int write_fd=0;
- struct stat stat_buf;
- off_t offset = 0;
- if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
-// qWarning("open failed");
- return success = false;
- }
- read_fd = srcFile.handle();
- if(read_fd != -1) {
- fstat (read_fd, &stat_buf);
- if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
-// qWarning("destfile open failed");
- return success = false;
- }
- write_fd = destFile.handle();
- if(write_fd != -1) {
- err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
- if( err == -1) {
- QString msg;
- switch(err) {
- case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. ";
- case EINVAL: msg = "Descriptor is not valid or locked. ";
- case ENOMEM: msg = "Insufficient memory to read from in_fd.";
- case EIO: msg = "Unspecified error while reading from in_fd.";
- };
- success = false;
-// qWarning(msg);
- }
- } else {
- success = false;
- }
- } else {
- success = false;
- }
- srcFile.close();
- destFile.close();
- // Set file permissions
- if( stat( (const char *) src, &status ) == 0 ) {
- chmod( (const char *) dest, status.st_mode );
- }
-
- return success;
-}
-
-void AdvancedFm::runCommand() {
- if( !CurrentView()->currentItem()) return;
- QDir *thisDir = CurrentDir();
-
- QString curFile;
- curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
-
- InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
- fileDlg->setInputText(curFile);
- fileDlg->exec();
- //QString command;
-
- if( fileDlg->result() == 1 ) {
-// qDebug(fileDlg->LineEdit1->text());
- QStringList command;
-
- command << "/bin/sh";
- command << "-c";
- command << fileDlg->LineEdit1->text();
- Output *outDlg;
- outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
- QPEApplication::execDialog( outDlg );
- qApp->processEvents();
-
- }
-}
-
-void AdvancedFm::runCommandStd() {
- if( !CurrentView()->currentItem()) return;
- QString curFile;
- QDir *thisDir = CurrentDir();
- QListView *thisView = CurrentView();
- if( thisView->currentItem())
- curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
-
- InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
- fileDlg->setInputText(curFile);
- fileDlg->exec();
-
- if( fileDlg->result() == 1 ) {
- qApp->processEvents();
- startProcess( (const QString)fileDlg->LineEdit1->text().latin1());
- }
-}
-
-void AdvancedFm::fileStatus() {
- if( !CurrentView()->currentItem()) return;
- QString curFile;
- curFile = CurrentView()->currentItem()->text(0);
-
- QStringList command;
- command << "/bin/sh";
- command << "-c";
- command << "stat -l "+ curFile;
-
- Output *outDlg;
- outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
- QPEApplication::execDialog( outDlg );
- qApp->processEvents();
-}
-
-
-void AdvancedFm::mkDir() {
- makeDir();
-}
-
-void AdvancedFm::rn() {
- renameIt();
-}
-
-void AdvancedFm::del() {
- doDelete();
-}
-
-void AdvancedFm::mkSym() {
- QString cmd;
- QStringList curFileList = getPath();
- if( curFileList.count() > 0) {
- QDir *thisDir = CurrentDir();
- QDir * thatDir = OtherDir();
-
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
-
- QString destName = thatDir->canonicalPath()+"/"+(*it);
- if(destName.right(1) == "/") {
- destName = destName.left( destName.length() -1);
- }
-
- QString curFile = thisDir->canonicalPath()+"/"+(*it);
-
- if( curFile.right(1) == "/") {
- curFile = curFile.left( curFile.length() -1);
- }
-
- cmd = "ln -s "+curFile+" "+destName;
-// qDebug(cmd);
- startProcess( (const QString)cmd );
- }
- rePopulate();
- setOtherTabCurrent();
- }
-}
-
-void AdvancedFm::doBeam() {
- Ir ir;
- if(!ir.supported()) {
- } else {
- QStringList curFileList = getPath();
- if( curFileList.count() > 0) {
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- QString curFile = (*it);
- QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile;
- if( curFilePath.right(1) == "/") {
- curFilePath = curFilePath.left( curFilePath.length() -1);
- }
- Ir *file = new Ir(this, "IR");
- connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*)));
- file->send( curFilePath, curFile );
- }
- }
- }
-}
-
-void AdvancedFm::fileBeamFinished( Ir *) {
- QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
-}
-
-void AdvancedFm::selectAll() {
- QListView *thisView = CurrentView();
- thisView->selectAll(true);
- thisView->setSelected( thisView->firstChild(),false);
-}
-
-void AdvancedFm::startProcess(const QString & cmd) {
- QStringList command;
- OProcess *process;
- process = new OProcess();
- connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
- this, SLOT( processEnded(Opie::Core::OProcess*)));
-
- connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
- this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
-
- command << "/bin/sh";
- command << "-c";
- command << cmd.latin1();
- *process << command;
- if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
- qDebug("could not start process");
-}
-
-void AdvancedFm::processEnded(OProcess *) {
- rePopulate();
-}
-
-void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
-// qWarning("received stderrt %d bytes", buflen);
-
- QString lineStr = buffer;
- QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
-}
-
-bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
- if ( o->inherits( "QLineEdit" ) ) {
- if ( e->type() == QEvent::KeyPress ) {
- QKeyEvent *ke = (QKeyEvent*)e;
- if ( ke->key() == Key_Return ||
- ke->key() == Key_Enter ) {
- okRename();
- return true;
- }
- else if ( ke->key() == Key_Escape ) {
- cancelRename();
- return true;
- }
- }
- else if ( e->type() == QEvent::FocusOut ) {
- cancelRename();
- return true;
- }
- }
- if ( o->inherits( "QListView" ) ) {
- if ( e->type() == QEvent::FocusIn ) {
- if( o == Local_View) { //keep track of which view
- whichTab=1;
- }
- else {
- whichTab=2;
- }
- }
- OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
- }
-
- return QWidget::eventFilter( o, e );
-}
-
-
-void AdvancedFm::cancelRename() {
-// qDebug("cancel rename");
- QListView * view;
- view = CurrentView();
-
- bool resetFocus = view->viewport()->focusProxy() == renameBox;
- delete renameBox;
- renameBox = 0;
- if ( resetFocus ) {
- view->viewport()->setFocusProxy( view);
- view->setFocus();
- }
-}
-
-void AdvancedFm::doRename(QListView * view) {
- if( !CurrentView()->currentItem()) return;
-
- QRect r = view->itemRect( view->currentItem( ));
- r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
- r.setX( view->contentsX() );
-
- if ( r.width() > view->visibleWidth() )
- r.setWidth( view->visibleWidth() );
-
- renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
- renameBox->setFrame(true);
-
- renameBox->setText( view->currentItem()->text(0) );
-
- renameBox->selectAll();
- renameBox->installEventFilter( this );
-
- view->addChild( renameBox, r.x(), r.y() );
-
- renameBox->resize( r.size() );
-
- view->viewport()->setFocusProxy( renameBox );
-
- renameBox->setFocus();
- renameBox->show();
-}
-
-
-void AdvancedFm::renameIt() {
- if( !CurrentView()->currentItem()) return;
-
- QListView *thisView = CurrentView();
- oldName = thisView->currentItem()->text(0);
- doRename( thisView );
-}
-
-void AdvancedFm::okRename() {
- if( !renameBox) return;
-
- QString newName = renameBox->text();
- cancelRename();
- QListView * view = CurrentView();
- QString path = CurrentDir()->canonicalPath() + "/";
- oldName = path + oldName;
- newName = path + newName;
- if( rename( oldName.latin1(), newName.latin1())== -1)
- QMessageBox::message(tr("Note"),tr("Could not rename"));
- else
- oldName = "";
- QListViewItem *item = view->currentItem();
- view->takeItem( item );
- delete item;
- rePopulate();
-}
-
-void AdvancedFm::openSearch() {
- QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
-}
+/*************************************************************************** + AdvancedFm.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. * + ***************************************************************************/ + +#include "advancedfm.h" +#include "output.h" +#include "filePermissions.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/lnkproperties.h> +#include <qpe/qpeapplication.h> +#include <qpe/applnk.h> +using namespace Opie::Core; + +/* QT*/ + +#include <qmessagebox.h> +#include <qpopupmenu.h> +#include <qlistview.h> + +/* STD */ + +#include <errno.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/stat.h> +#include <dirent.h> +#include <sys/sendfile.h> +#include <fcntl.h> + +void AdvancedFm::doDirChange() { + QString pathItem = CurrentView()->currentItem()->text(0); + if( pathItem == "../") { + ListClicked( CurrentView()->currentItem()); + } else { + if( pathItem.find(" -> ",0,TRUE) != -1) + pathItem = dealWithSymName((const QString&)pathItem)+"/"; +// owarn << pathItem << oendl; + gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); + } +} + +void AdvancedFm::showMenuHidden() { + if (b) { + CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); + } else { + CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); + } + b = !b; + populateView(); +} + +void AdvancedFm::showHidden() { + if (b) { + CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + } else { + CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + } + populateView(); +} + +QString AdvancedFm::dealWithSymName(const QString &fileName) { + QString strItem = fileName; + return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); +} + +void AdvancedFm::runThis() { + if( !CurrentView()->currentItem()) return; + QString fs; + QDir *thisDir = CurrentDir(); + + QString curFile = CurrentView()->currentItem()->text(0); + QString path = thisDir->canonicalPath(); + + if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink + + curFile = dealWithSymName((const QString&)curFile); + + if(curFile != "../") { + + fs = getFileSystemType((const QString &) path); + QFileInfo fileInfo( path + "/" + curFile); +// odebug << fileInfo.owner() << oendl; + + if( (fileInfo.permission( QFileInfo::ExeUser) + | fileInfo.permission( QFileInfo::ExeGroup) + | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { + | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { + QCopEnvelope e("QPE/System", "execute(QString)" ); + e << curFile; + } else { + curFile = path + "/" + curFile; + DocLnk nf(curFile); + QString execStr = nf.exec(); +// odebug << execStr << oendl; + if( execStr.isEmpty() ) { + } else { + nf.execute(); + } + } + } +} + +void AdvancedFm::runText() { + if( !CurrentView()->currentItem()) return; + QString curFile = CurrentView()->currentItem()->text(0); + if(curFile != "../") { + if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink + curFile = dealWithSymName((const QString&)curFile); + curFile = CurrentDir()->canonicalPath()+"/"+curFile; + QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); + e << curFile; + } +} + +void AdvancedFm::makeDir() { + InputDialog *fileDlg; + fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); + fileDlg->exec(); + if( fileDlg->result() == 1 ) { + QDir *thisDir = CurrentDir(); + QString filename = fileDlg->LineEdit1->text(); + thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); + } + populateView(); +} + +void AdvancedFm::doDelete() { + QStringList curFileList = getPath(); + bool doMsg=true; + int count = curFileList.count(); + if( count > 0) { + if(count > 1 ) { + QString msg; + msg=tr("Really delete\n%1 files?").arg(count); + switch ( QMessageBox::warning(this,tr("Delete"),msg + ,tr("Yes"),tr("No"),0,0,1) ) + { + case 0: + doMsg=false; + break; + case 1: + return; + break; + }; + } + + QString myFile; + + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { + myFile = (*it); + if( myFile.find(" -> ",0,TRUE) != -1) + myFile = myFile.left( myFile.find(" -> ",0,TRUE)); + + QString f = CurrentDir()->canonicalPath(); + if(f.right(1).find("/",0,TRUE) == -1) + f += "/"; + f += myFile; + if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { + //if file is a directory + + switch ( QMessageBox::warning( this, tr("Delete Directory?"), + tr("Really delete %1\nand all it's contents ?" ).arg( f ) , + tr("Yes"), tr("No"), 0, 0, 1) ) { + case 0: + { + f=f.left(f.length()-1); + QString cmd="rm -rf "+f; + startProcess( (const QString)cmd.latin1() ); + populateView(); + } + break; + case 1: + // exit + break; + }; + + } else { + if(doMsg) { + switch ( QMessageBox::warning(this,tr("Delete"), + tr("Really delete\n%1?").arg( myFile ), + tr("Yes"), tr("No"), 0, 0, 1) ) { + case 1: + return; + break; + }; + } + + QString cmd="rm "+f; + QFile file(f); + QFileInfo fi(myFile); + if( fi.fileName().find("../",0,TRUE)==-1) { +// odebug << "remove link files "+myFile << oendl; + +// DocLnk lnk(f); + DocLnk *lnk; + lnk = new DocLnk(f); +// odebug << "Deleting doclnk " + lnk->linkFile() << oendl; + if(lnk->isValid()) + lnk->removeLinkFile(); + // delete lnk; + file.remove(); + } + } + } + } + populateView(); +} + +void AdvancedFm::filePerms() { + QStringList curFileList = getPath(); + QString filePath; + + filePath = CurrentDir()->canonicalPath()+"/"; + + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { + filePermissions *filePerm; + filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); + QPEApplication::execDialog( filePerm ); + if( filePerm ) + delete filePerm; + } + populateView(); +} + +void AdvancedFm::doProperties() { +#if defined(QT_QWS_OPIE) + + QStringList curFileList = getPath(); + + QString filePath; + filePath = CurrentDir()->canonicalPath()+"/"; + +// odebug << "" << curFileList.count() << "" << oendl; + + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { +// odebug << (filePath+*it) << oendl; + DocLnk lnk( (filePath+*it)); + LnkProperties prop( &lnk ); + QPEApplication::execDialog( &prop ); + } +#endif + +} + +void AdvancedFm::upDir() { + QDir *thisDir = CurrentDir(); + QString current = thisDir->canonicalPath(); + QDir dir(current); + dir.cdUp(); + current = dir.canonicalPath(); + chdir( current.latin1() ); + thisDir->cd( current, TRUE); + + populateView(); + update(); +} + +void AdvancedFm::copy() { + qApp->processEvents(); + QStringList curFileList = getPath(); + + QDir *thisDir = CurrentDir(); + QDir *thatDir = OtherDir(); + + bool doMsg=true; + int count=curFileList.count(); + if( count > 0) { + if(count > 1 ){ + QString msg; + msg=tr("Really copy\n%1 files?").arg(count); + switch ( QMessageBox::warning(this,tr("Copy"),msg + ,tr("Yes"),tr("No"),0,0,1) ) + { + case 0: + doMsg=false; + break; + case 1: + return; + break; + }; + } + + QString curFile, item, destFile; + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { + item=(*it); + if(item.find("->",0,TRUE)) //symlink + item = item.left(item.find("->",0,TRUE)); + + curFile = thisDir->canonicalPath()+"/"+ item; + destFile = thatDir->canonicalPath()+"/"+ item; + +// odebug << "Destination file is "+destFile << oendl; +// odebug << "CurrentFile file is " + curFile << oendl; + + QFile f(destFile); + if( f.exists()) { + if(doMsg) { + switch ( QMessageBox::warning(this,tr("File Exists!"), + tr("%1 exists. Ok to overwrite?").arg( item ), + tr("Yes"),tr("No"),0,0,1) ) { + case 1: + return; + break; + }; + } + f.remove(); + } + + if( !copyFile( curFile, destFile) ) { + QMessageBox::message("AdvancedFm", + tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); + return; + } + } + setOtherTabCurrent(); + rePopulate(); + } +} + +void AdvancedFm::copyAs() { + qApp->processEvents(); + + QStringList curFileList = getPath(); + QString curFile, item; + InputDialog *fileDlg; + + QDir *thisDir = CurrentDir(); + QDir *thatDir = OtherDir(); + + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { + QString destFile; + item=(*it); + curFile = thisDir->canonicalPath()+"/"+(*it); + fileDlg = new InputDialog( this, tr("Copy "+curFile+" As"), TRUE, 0); + + fileDlg->setInputText((const QString &) destFile ); + fileDlg->exec(); + + if( fileDlg->result() == 1 ) { + QString filename = fileDlg->LineEdit1->text(); + destFile = thatDir->canonicalPath()+"/"+filename; + + QFile f( destFile); + if( f.exists()) { + switch (QMessageBox::warning(this,tr("File Exists!"), + item+tr("\nexists. Ok to overwrite?"), + tr("Yes"),tr("No"),0,0,1) ) { + case 0: + f.remove(); + break; + case 1: + return; + break; + }; + } + if( !copyFile( curFile, destFile) ) { + QMessageBox::message("AdvancedFm",tr("Could not copy\n") + +curFile +tr("to\n")+destFile); + return; + } + } + delete fileDlg; + + } + rePopulate(); + setOtherTabCurrent(); +} + +void AdvancedFm::copySameDir() { + qApp->processEvents(); + QStringList curFileList = getPath(); + QString curFile, item, destFile; + InputDialog *fileDlg; + + QDir *thisDir = CurrentDir(); + + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { + item=(*it); + curFile = thisDir->canonicalPath()+"/"+ item; + + fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); + fileDlg->setInputText((const QString &) destFile ); + fileDlg->exec(); + + if( fileDlg->result() == 1 ) { + + QString filename = fileDlg->LineEdit1->text(); + destFile = thisDir->canonicalPath()+"/"+filename; + + QFile f(destFile); + if( f.exists()) { + switch (QMessageBox::warning(this,tr("Delete"), + destFile+tr(" already exists.\nDo you really want to delete it?"), + tr("Yes"),tr("No"),0,0,1) ) { + case 0: + + f.remove(); + break; + case 1: + return; + break; + }; + } + if(!copyFile( curFile,destFile) ) { + QMessageBox::message("AdvancedFm",tr("Could not copy\n") + +curFile +tr("to\n")+destFile); + return; + } + +// odebug << "copy "+curFile+" as "+destFile << oendl; + } + delete fileDlg; + } + rePopulate(); +} + +void AdvancedFm::move() { + qApp->processEvents(); + + QStringList curFileList = getPath(); + if( curFileList.count() > 0) { + QString curFile, destFile, item; + + QDir *thisDir = CurrentDir(); + QDir *thatDir = OtherDir(); + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { + item=(*it); + QString destFile = thatDir->canonicalPath(); + + if(destFile.right(1).find("/",0,TRUE) == -1) + destFile+="/"; + destFile += item; +// odebug << "Destination file is "+destFile << oendl; + + curFile = thisDir->canonicalPath(); + if(curFile.right(1).find("/",0,TRUE) == -1) + curFile +="/"; + curFile+= item; +// odebug << "CurrentFile file is " + curFile << oendl; + + if(QFileInfo(curFile).isDir()) { + moveDirectory( curFile, destFile ); + rePopulate(); + return; + } + + QFile f( curFile); + if( f.exists()) { + if( !copyFile( curFile, destFile) ) { + QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); + return; + } else + QFile::remove(curFile); + } + } + + } + rePopulate(); + setOtherTabCurrent(); +} + +bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { + int err = 0; + if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; + err = system((const char*)cmd); + } else + err = -1; + + if(err!=0) { + QMessageBox::message(tr("Note"),tr("Could not move\n") + src); + return false; + } + return true; +} + +bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { + + QString cmd = "/bin/cp -fpR " + src + " " + dest; + owarn << cmd << oendl; + int err = system( (const char *) cmd ); + if ( err != 0 ) { + QMessageBox::message("AdvancedFm", + tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); + return false; + } + + return true; +} + + +bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { + + + if(QFileInfo(src).isDir()) { + if( copyDirectory( src, dest )) { + setOtherTabCurrent(); + populateView(); + return true; + } + else + return false; + } + + + bool success = true; + struct stat status; + QFile srcFile(src); + QFile destFile(dest); + int err=0; + int read_fd=0; + int write_fd=0; + struct stat stat_buf; + off_t offset = 0; + if(!srcFile.open( IO_ReadOnly|IO_Raw)) { +// owarn << "open failed" << oendl; + return success = false; + } + read_fd = srcFile.handle(); + if(read_fd != -1) { + fstat (read_fd, &stat_buf); + if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { +// owarn << "destfile open failed" << oendl; + return success = false; + } + write_fd = destFile.handle(); + if(write_fd != -1) { + err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); + if( err == -1) { + QString msg; + switch(err) { + case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; + case EINVAL: msg = "Descriptor is not valid or locked. "; + case ENOMEM: msg = "Insufficient memory to read from in_fd."; + case EIO: msg = "Unspecified error while reading from in_fd."; + }; + success = false; +// owarn << msg << oendl; + } + } else { + success = false; + } + } else { + success = false; + } + srcFile.close(); + destFile.close(); + // Set file permissions + if( stat( (const char *) src, &status ) == 0 ) { + chmod( (const char *) dest, status.st_mode ); + } + + return success; +} + +void AdvancedFm::runCommand() { + if( !CurrentView()->currentItem()) return; + QDir *thisDir = CurrentDir(); + + QString curFile; + curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); + + InputDialog *fileDlg; + fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); + fileDlg->setInputText(curFile); + fileDlg->exec(); + //QString command; + + if( fileDlg->result() == 1 ) { +// odebug << fileDlg->LineEdit1->text() << oendl; + QStringList command; + + command << "/bin/sh"; + command << "-c"; + command << fileDlg->LineEdit1->text(); + Output *outDlg; + outDlg = new Output( command, this, tr("AdvancedFm Output"), true); + QPEApplication::execDialog( outDlg ); + qApp->processEvents(); + + } +} + +void AdvancedFm::runCommandStd() { + if( !CurrentView()->currentItem()) return; + QString curFile; + QDir *thisDir = CurrentDir(); + QListView *thisView = CurrentView(); + if( thisView->currentItem()) + curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); + + InputDialog *fileDlg; + fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); + fileDlg->setInputText(curFile); + fileDlg->exec(); + + if( fileDlg->result() == 1 ) { + qApp->processEvents(); + startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); + } +} + +void AdvancedFm::fileStatus() { + if( !CurrentView()->currentItem()) return; + QString curFile; + curFile = CurrentView()->currentItem()->text(0); + + QStringList command; + command << "/bin/sh"; + command << "-c"; + command << "stat -l "+ curFile; + + Output *outDlg; + outDlg = new Output( command, this, tr("AdvancedFm Output"), true); + QPEApplication::execDialog( outDlg ); + qApp->processEvents(); +} + + +void AdvancedFm::mkDir() { + makeDir(); +} + +void AdvancedFm::rn() { + renameIt(); +} + +void AdvancedFm::del() { + doDelete(); +} + +void AdvancedFm::mkSym() { + QString cmd; + QStringList curFileList = getPath(); + if( curFileList.count() > 0) { + QDir *thisDir = CurrentDir(); + QDir * thatDir = OtherDir(); + + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { + + QString destName = thatDir->canonicalPath()+"/"+(*it); + if(destName.right(1) == "/") { + destName = destName.left( destName.length() -1); + } + + QString curFile = thisDir->canonicalPath()+"/"+(*it); + + if( curFile.right(1) == "/") { + curFile = curFile.left( curFile.length() -1); + } + + cmd = "ln -s "+curFile+" "+destName; +// odebug << cmd << oendl; + startProcess( (const QString)cmd ); + } + rePopulate(); + setOtherTabCurrent(); + } +} + +void AdvancedFm::doBeam() { + Ir ir; + if(!ir.supported()) { + } else { + QStringList curFileList = getPath(); + if( curFileList.count() > 0) { + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { + QString curFile = (*it); + QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; + if( curFilePath.right(1) == "/") { + curFilePath = curFilePath.left( curFilePath.length() -1); + } + Ir *file = new Ir(this, "IR"); + connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); + file->send( curFilePath, curFile ); + } + } + } +} + +void AdvancedFm::fileBeamFinished( Ir *) { + QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); +} + +void AdvancedFm::selectAll() { + QListView *thisView = CurrentView(); + thisView->selectAll(true); + thisView->setSelected( thisView->firstChild(),false); +} + +void AdvancedFm::startProcess(const QString & cmd) { + QStringList command; + OProcess *process; + process = new OProcess(); + connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), + this, SLOT( processEnded(Opie::Core::OProcess*))); + + connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), + this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); + + command << "/bin/sh"; + command << "-c"; + command << cmd.latin1(); + *process << command; + if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) + odebug << "could not start process" << oendl; +} + +void AdvancedFm::processEnded(OProcess *) { + rePopulate(); +} + +void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { +// owarn << "received stderrt " << buflen << " bytes" << oendl; + + QString lineStr = buffer; + QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); +} + +bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { + if ( o->inherits( "QLineEdit" ) ) { + if ( e->type() == QEvent::KeyPress ) { + QKeyEvent *ke = (QKeyEvent*)e; + if ( ke->key() == Key_Return || + ke->key() == Key_Enter ) { + okRename(); + return true; + } + else if ( ke->key() == Key_Escape ) { + cancelRename(); + return true; + } + } + else if ( e->type() == QEvent::FocusOut ) { + cancelRename(); + return true; + } + } + if ( o->inherits( "QListView" ) ) { + if ( e->type() == QEvent::FocusIn ) { + if( o == Local_View) { //keep track of which view + whichTab=1; + } + else { + whichTab=2; + } + } + OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection + } + + return QWidget::eventFilter( o, e ); +} + + +void AdvancedFm::cancelRename() { +// odebug << "cancel rename" << oendl; + QListView * view; + view = CurrentView(); + + bool resetFocus = view->viewport()->focusProxy() == renameBox; + delete renameBox; + renameBox = 0; + if ( resetFocus ) { + view->viewport()->setFocusProxy( view); + view->setFocus(); + } +} + +void AdvancedFm::doRename(QListView * view) { + if( !CurrentView()->currentItem()) return; + + QRect r = view->itemRect( view->currentItem( )); + r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); + r.setX( view->contentsX() ); + + if ( r.width() > view->visibleWidth() ) + r.setWidth( view->visibleWidth() ); + + renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); + renameBox->setFrame(true); + + renameBox->setText( view->currentItem()->text(0) ); + + renameBox->selectAll(); + renameBox->installEventFilter( this ); + + view->addChild( renameBox, r.x(), r.y() ); + + renameBox->resize( r.size() ); + + view->viewport()->setFocusProxy( renameBox ); + + renameBox->setFocus(); + renameBox->show(); +} + + +void AdvancedFm::renameIt() { + if( !CurrentView()->currentItem()) return; + + QListView *thisView = CurrentView(); + oldName = thisView->currentItem()->text(0); + doRename( thisView ); +} + +void AdvancedFm::okRename() { + if( !renameBox) return; + + QString newName = renameBox->text(); + cancelRename(); + QListView * view = CurrentView(); + QString path = CurrentDir()->canonicalPath() + "/"; + oldName = path + oldName; + newName = path + newName; + if( rename( oldName.latin1(), newName.latin1())== -1) + QMessageBox::message(tr("Note"),tr("Could not rename")); + else + oldName = ""; + QListViewItem *item = view->currentItem(); + view->takeItem( item ); + delete item; + rePopulate(); +} + +void AdvancedFm::openSearch() { + QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); +} diff --git a/noncore/apps/advancedfm/filePermissions.cpp b/noncore/apps/advancedfm/filePermissions.cpp index 9698de7..b7d48e8 100644 --- a/noncore/apps/advancedfm/filePermissions.cpp +++ b/noncore/apps/advancedfm/filePermissions.cpp @@ -23,25 +23,25 @@ #include <unistd.h> #include <sys/stat.h> #include <stdlib.h> #include <sys/types.h> #include <pwd.h> #include <grp.h> filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( tr("filePermissions") ); -// qDebug("FilePermissions "+fileName); +// odebug << "FilePermissions "+fileName << oendl; /* resize( 236, 210 ); setMaximumSize( QSize( 236, 210 ) ); */ setCaption( tr( "Set File Permissions" ) ); TextLabel1 = new QLabel( this, "TextLabel1" ); TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); TextLabel1->setText( tr( "Set file permissions for:" ) ); LineEdit1 = new QLineEdit( this, "LineEdit1" ); LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) ); LineEdit1->setReadOnly(true); diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp index 6906298..8c585f4 100644 --- a/noncore/apps/advancedfm/output.cpp +++ b/noncore/apps/advancedfm/output.cpp @@ -1,32 +1,35 @@ /**************************************************************************** ** outputEdit.cpp ** ** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> ****************************************************************************/ #include "output.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> #include <qpe/applnk.h> +using namespace Opie::Core; +/* QT */ #include <qfile.h> #include <qmultilineedit.h> #include <qpushbutton.h> #include <qlayout.h> +/* STD */ #include <errno.h> /* XPM */ -using namespace Opie::Core; -using namespace Opie::Core; static char * filesave_xpm[] = { "16 16 78 1", " c None", ". c #343434", "+ c #A0A0A0", "@ c #565656", "# c #9E9E9E", "$ c #525252", "% c #929292", "& c #676767", "* c #848484", "= c #666666", @@ -112,25 +115,25 @@ static char * filesave_xpm[] = { "CzDEvEv;;DssF$ ", "G.H{E{E{IxsJ$+ ", " +...vEKxzLM ", " +...z]n$ ", " +... "}; Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog( parent, name, modal, fl ) { QStringList cmmds; // cmmds=QStringList::split( " ", commands, false); cmmds=commands; -// qDebug("count %d", cmmds.count()); +// odebug << "count " << cmmds.count() << "" << oendl; if ( !name ) setName( tr("Output")); resize( 196, 269 ); setCaption( name ); OutputLayout = new QGridLayout( this ); OutputLayout->setSpacing( 2); OutputLayout->setMargin( 2); QPushButton *docButton; docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); docButton->setFixedSize( QSize( 20, 20 ) ); @@ -148,25 +151,25 @@ Output::Output( const QStringList commands, QWidget* parent, const char* name, connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), this, SLOT(commandStdout(Opie::Core::OProcess*,char*,int))); connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT(commandStderr(Opie::Core::OProcess*,char*,int))); // connect( , SIGNAL(received(const QByteArray&)), // this, SLOT(commandStdin(const QByteArray&))); // * proc << commands.latin1(); for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) { - qDebug( "%s", (*it).latin1() ); + odebug << "" << (*it).latin1() << "" << oendl; * proc << (*it).latin1(); } if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { OutputEdit->append(tr("Process could not start") ); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); perror("Error: "); QString errorMsg=tr("Error\n")+(QString)strerror(errno); OutputEdit->append( errorMsg); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); } @@ -177,67 +180,67 @@ Output::~Output() { void Output::saveOutput() { InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = QPEApplication::documentDir(); if(filename.right(1).find('/') == -1) filename+="/"; QString name = fileDlg->LineEdit1->text(); filename+="text/plain/"+name; - qDebug(filename); + odebug << filename << oendl; QFile f(filename); f.open( IO_WriteOnly); if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { DocLnk lnk; lnk.setName(name); //sets file name lnk.setFile(filename); //sets File property lnk.setType("text/plain"); if(!lnk.writeLink()) { - qDebug("Writing doclink did not work"); + odebug << "Writing doclink did not work" << oendl; } } else - qWarning("Could not write file"); + owarn << "Could not write file" << oendl; f.close(); } } void Output::commandStdout(OProcess*, char *buffer, int buflen) { - qWarning("received stdout %d bytes", buflen); + owarn << "received stdout " << buflen << " bytes" << oendl; // QByteArray data(buflen); // data.fill(*buffer, buflen); // for (uint i = 0; i < data.count(); i++ ) { // printf("%c", buffer[i] ); // } // printf("\n"); QString lineStr = buffer; lineStr=lineStr.left(lineStr.length()-1); OutputEdit->append(lineStr); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); } void Output::commandStdin( const QByteArray &data) { - qWarning("received stdin %d bytes", data.size()); + owarn << "received stdin " << data.size() << " bytes" << oendl; // recieved data from the io layer goes to sz proc->writeStdin(data.data(), data.size()); } void Output::commandStderr(OProcess*, char *buffer, int buflen) { - qWarning("received stderrt %d bytes", buflen); + owarn << "received stderrt " << buflen << " bytes" << oendl; QString lineStr = buffer; // lineStr=lineStr.left(lineStr.length()-1); OutputEdit->append(lineStr); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); } void Output::processFinished() { delete proc; OutputEdit->append( tr("\nFinished\n") ); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); diff --git a/noncore/apps/checkbook/checkbook.pro b/noncore/apps/checkbook/checkbook.pro index 34641f4..1472df6 100644 --- a/noncore/apps/checkbook/checkbook.pro +++ b/noncore/apps/checkbook/checkbook.pro @@ -1,13 +1,13 @@ -CONFIG = qt warn_on quick-app +CONFIG = qt warn_on quick-app HEADERS = mainwindow.h \ cbinfo.h \ traninfo.h \ graphinfo.h \ configuration.h \ password.h \ checkbook.h \ transaction.h \ tabledef.h \ listedit.h \ cfg.h \ graph.h diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp index d00e305..5026c9d 100644 --- a/noncore/apps/checkbook/listedit.cpp +++ b/noncore/apps/checkbook/listedit.cpp @@ -18,32 +18,37 @@ ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "listedit.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/resource.h> +using namespace Opie::Core; + +/* QT */ #include <qlayout.h> #include <qlineedit.h> #include <qlistview.h> #include <qwidgetstack.h> #include <qcombobox.h> #include <qpushbutton.h> -#include <qpe/resource.h> - // --- ListEdit --------------------------------------------------------------- ListEdit::ListEdit( QWidget *parent, const char *sName ) : QWidget(parent, sName), TableDef(sName) { // get font height int fh = fontMetrics().height(); // create layout QGridLayout *layout=new QGridLayout(this); layout->setSpacing( 2 ); layout->setMargin( 4 ); @@ -293,25 +298,25 @@ void ListEdit::slotClick(QListViewItem *itm, const QPoint &pnt, int col) _box->setCurrentItem(i); i=-1; break; } i++; } if( i>=0 ) { _box->insertItem( _currentItem->text(_currentColumn) ); _box->setCurrentItem(i); } _stack->raiseWidget(_box); } else { - qDebug( "Unsupported column type for column %s", (const char *)pDef->getName() ); + odebug << "Unsupported column type for column " << (const char *)pDef->getName() << "" << oendl; _typeEdit->setText(""); _stack->raiseWidget(_typeEdit); } } // --- addColumnDef ----------------------------------------------------------- void ListEdit::addColumnDef(ColumnDef *pDef) { _typeTable->addColumn( pDef->getName() ); _vColumns.append(pDef); } diff --git a/noncore/apps/checkbook/tabledef.cpp b/noncore/apps/checkbook/tabledef.cpp index 9a42308..745cd80 100644 --- a/noncore/apps/checkbook/tabledef.cpp +++ b/noncore/apps/checkbook/tabledef.cpp @@ -19,46 +19,48 @@ ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "tabledef.h" +#include <opie2/odebug.h> +using namespace Opie::Core; // --- ColumnDef -------------------------------------------------------------- ColumnDef::ColumnDef(const char *sName, ColumnType type, const char *sNewValue) { _sName=sName; _type=type; _sNewValue=sNewValue; } // --- addColumnValue --------------------------------------------------------- void ColumnDef::addColumnValue(const QString &sValue) { if( (_type & 0x00ffffff) !=typeList ) - qDebug("Column %s is not a list", (const char *)_sName); + odebug << "Column " << (const char *)_sName << " is not a list" << oendl; else _valueList.append(sValue); } void ColumnDef::addColumnValue(const char *sValue) { if( (_type & 0x00ffffff)!=typeList ) - qDebug("Column %s is not a list", (const char *)_sName); + odebug << "Column " << (const char *)_sName << " is not a list" << oendl; else _valueList.append(sValue); } // --- TableDef --------------------------------------------------------------- TableDef::TableDef(const char *sName) { _sName=sName; _vColumns.setAutoDelete(TRUE); } diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp index 1b08b24..aafb588 100644 --- a/noncore/apps/checkbook/transaction.cpp +++ b/noncore/apps/checkbook/transaction.cpp @@ -22,26 +22,30 @@ -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "transaction.h" #include "traninfo.h" #include "cfg.h" #include "checkbook.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/datebookmonth.h> +using namespace Opie::Core; +/* QT */ #include <qbuttongroup.h> #include <qcombobox.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qmultilineedit.h> #include <qradiobutton.h> #include <qwhatsthis.h> Transaction::Transaction( QWidget *parent, bool bNew, const QString &acctname, TranInfo *info, Cfg *pCfg ) : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) @@ -323,15 +327,15 @@ void Transaction::slotActivated(const QString &arg ) if( pTi ) { initFromInfo( pTi, true ); amtEdit->setFocus(); amtEdit->setSelection(0, amtEdit->text().length() ); amtEdit->setCursorPosition(0); } } } // slotNotNew ----------------------------------------------------------------- void Transaction::slotNotNew() { - qDebug("Not new"); + odebug << "Not new" << oendl; _bNew=false; } diff --git a/noncore/apps/confedit/confedit.pro b/noncore/apps/confedit/confedit.pro index 5a71680..785c588 100644 --- a/noncore/apps/confedit/confedit.pro +++ b/noncore/apps/confedit/confedit.pro @@ -1,21 +1,9 @@ -CONFIG = qt warn_on quick-app -HEADERS = mainwindow.h listviewconfdir.h listviewitemconffile.h listviewitemconfigentry.h editwidget.h listviewitemconf.h -SOURCES = main.cpp mainwindow.cpp listviewconfdir.cpp listviewitemconffile.cpp listviewitemconfigentry.cpp editwidget.cpp listviewitemconf.cpp -INCLUDEPATH += $(OPIEDIR)/include +CONFIG = qt warn_on quick-app +HEADERS = mainwindow.h listviewconfdir.h listviewitemconffile.h listviewitemconfigentry.h editwidget.h listviewitemconf.h +SOURCES = main.cpp mainwindow.cpp listviewconfdir.cpp listviewitemconffile.cpp listviewitemconfigentry.cpp editwidget.cpp listviewitemconf.cpp +INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -INTERFACES = -LIBS += -lopiecore2 +LIBS += -lqpe -lopiecore2 TARGET = confedit -!contains( platform, x11 ) { - - include ( $(OPIEDIR)/include.pro ) - LIBS += -lqpe -} - -contains( platform, x11 ) { - LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib -} - - - +include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/confedit/config.in b/noncore/apps/confedit/config.in index e377307..d7682dc 100644 --- a/noncore/apps/confedit/config.in +++ b/noncore/apps/confedit/config.in @@ -1,4 +1,4 @@ config CONFEDIT - boolean "opie-confeditor (generic editor for all Opie settings)" + boolean "opie-confedit (generic editor for all Opie settings)" default "y" depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE diff --git a/noncore/apps/confedit/listviewconfdir.cpp b/noncore/apps/confedit/listviewconfdir.cpp index 0c2feeb..33bffe1 100644 --- a/noncore/apps/confedit/listviewconfdir.cpp +++ b/noncore/apps/confedit/listviewconfdir.cpp @@ -1,61 +1,65 @@ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // (c) 2002 Patrick S. Vogtp <tille@handhelds.org> #include "listviewconfdir.h" +#include "listviewitemconffile.h" -#include <qmessagebox.h> +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; -#include "listviewitemconffile.h" +/* QT */ +#include <qmessagebox.h> ListViewConfDir::ListViewConfDir(QString settingsPath, QWidget *parent, const char *name ) : QListView(parent,name), confDir(settingsPath) { setRootIsDecorated( true ); addColumn(tr("Files")); if (!confDir.isReadable()) QMessageBox::critical(this,tr("Could not open"),tr("The directory ")+settingsPath+tr(" could not be opened."),1,0); readConfFiles(); connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); } ListViewConfDir::~ListViewConfDir() { } void ListViewConfDir::readConfFiles() { - confDir.setFilter( QDir::Files | QDir::NoSymLinks ); + confDir.setFilter( QDir::Files | QDir::NoSymLinks ); confDir.setSorting( QDir::Name ); confDir.setNameFilter("*.conf"); const QFileInfoList *list = confDir.entryInfoList(); QFileInfoListIterator it( *list ); QFileInfo *fi; ListViewItemConfFile *fileEntry; while ( (fi=it.current()) ) { - qDebug( "opening: >%s<", fi->fileName().data() ); + odebug << "opening: >" << fi->fileName().data() << "<" << oendl; fileEntry = new ListViewItemConfFile( fi, this ); QListViewItem *dummy = new QListViewItem(fileEntry, "dummy"); ++it; } } void ListViewConfDir::expand(QListViewItem *item) { ((ListViewItemConf*)item)->expand(); } diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp index 1ff2c44..2958cf5 100644 --- a/noncore/apps/confedit/listviewitemconffile.cpp +++ b/noncore/apps/confedit/listviewitemconffile.cpp @@ -1,91 +1,97 @@ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "listviewitemconffile.h" +#include "listviewitemconfigentry.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qmessagebox.h> #include <qtextstream.h> -#include "listviewitemconfigentry.h" #define tr QObject::tr ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent) : ListViewItemConf(parent), _valid(false) { confFileInfo = file; -// parseFile(); + // parseFile(); displayText(); } ListViewItemConfFile::~ListViewItemConfFile() { } void ListViewItemConfFile::displayText() { setText(0,(_changed?"*":"")+confFileInfo->fileName()); } QString ListViewItemConfFile::fileName() { return confFileInfo->fileName(); } void ListViewItemConfFile::parseFile() { - //qDebug("ListViewItemConfFile::parseFile BEGIN"); - QFile confFile(confFileInfo->absFilePath()); + //odebug << "ListViewItemConfFile::parseFile BEGIN" << oendl; + QFile confFile(confFileInfo->absFilePath()); if(! confFile.open(IO_ReadOnly)) QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); QTextStream t( &confFile ); QString s; QString group; ListViewItemConfigEntry *groupItem; ListViewItemConfigEntry *item; while ( !t.atEnd() ) { s = t.readLine().stripWhiteSpace(); - //qDebug( "line: >%s<\n", s.latin1() ); + //odebug << "line: >" << s.latin1() << "<\n" << oendl; if (s.contains("<?xml")) { _valid = false; break; }else if ( s[0] == '[' && s[s.length()-1] == ']' ) { - // qDebug("got group"+s); + // odebug << "got group"+s << oendl; group = s.mid(1,s.length()-2); if (!groupItem) groupItem = new ListViewItemConfigEntry(this, tr("no group") ); groupItem = new ListViewItemConfigEntry(this, group ); insertItem( groupItem ); } else if ( int pos = s.find('=') ) { -// qDebug("got key"+s); - if (!groupItem) qDebug("PANIK NO GROUP! >%s<",group.latin1()); +// odebug << "got key"+s << oendl; + if (!groupItem) odebug << "PANIK NO GROUP! >" << group.latin1() << "<" << oendl; item = new ListViewItemConfigEntry(this, group, s ); groupItem->insertItem( item ); } } confFile.close(); setExpandable( _valid ); -// qDebug("ListViewItemConfFile::parseFile END"); +// odebug << "ListViewItemConfFile::parseFile END" << oendl; } void ListViewItemConfFile::remove() { QFile::remove(confFileInfo->absFilePath()); QFile::remove(backupFileName()); delete this; } void ListViewItemConfFile::revert() { diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp index 6ef1043..4b04c97 100644 --- a/noncore/apps/confedit/mainwindow.cpp +++ b/noncore/apps/confedit/mainwindow.cpp @@ -2,52 +2,55 @@ * * * 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. * * * ***************************************************************************/ // (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "mainwindow.h" +#include "listviewconfdir.h" +#include "listviewitemconfigentry.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> -#include "listviewconfdir.h" -#include "listviewitemconfigentry.h" - - MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0) { setCaption( tr("Conf File Editor") ); // setBaseSize( qApp->globalStrut() ); setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); mainLayout = new QVBoxLayout( this ); mainLayout->setSpacing( 0 ); mainLayout->setMargin( 0 ); - qDebug("creating settingList"); + odebug << "creating settingList" << oendl; settingList = new ListViewConfDir( QDir::homeDirPath() + "/Settings", this, "settingslist"); settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); mainLayout->addWidget( settingList, 0); - qDebug("creating editor"); + odebug << "creating editor" << oendl; editor = new EditWidget(this); editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) ); mainLayout->addWidget( editor, 1 ); editor->layoutType( ListViewItemConf::File ); makeMenu(); connect(settingList, SIGNAL( pressed(QListViewItem*) ), this, SLOT(setCurrent(QListViewItem*))); connect( settingList, SIGNAL( clicked(QListViewItem*) ), this, SLOT( stopTimer(QListViewItem*) ) ); @@ -89,25 +92,25 @@ void MainWindow::makeMenu() connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); } MainWindow::~MainWindow() { } void MainWindow::setCurrent(QListViewItem *item) { -// qDebug("MainWindow::setCurrent"); +// odebug << "MainWindow::setCurrent" << oendl; if (!item) return; _item = (ListViewItemConf*) item; if (!_item) return; popupTimer->start( 750, true ); if (_item->getType() == ListViewItemConf::File) { editor->layoutType(EditWidget::File); _currentItem=0; _fileItem = (ListViewItemConfFile*)item; return; } _fileItem = 0; @@ -165,25 +168,25 @@ void MainWindow::revertConfFile() if (!_item) return; _item->revert(); } void MainWindow::removeConfFile() { if (!_item) return; _item->remove(); } void MainWindow::showPopup() { -qDebug("showPopup"); +odebug << "showPopup" << oendl; if (!_item) return; popupActionRevert->setEnabled(_item->revertable()); popupActionSave->setEnabled(_item->isChanged()); if (_fileItem) { popupActionSave->setEnabled(_fileItem->isChanged()); popupMenuFile->popup( QCursor::pos() ); }else if(_currentItem) { popupMenuEntry->popup( QCursor::pos() ); } } diff --git a/noncore/apps/keyz-cfg/cfgfile.cpp b/noncore/apps/keyz-cfg/cfgfile.cpp index b0dc968..81d1ee1 100644 --- a/noncore/apps/keyz-cfg/cfgfile.cpp +++ b/noncore/apps/keyz-cfg/cfgfile.cpp @@ -1,15 +1,21 @@ -#include <qmessagebox.h> #include "cfgfile.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ +#include <qmessagebox.h> + // CfgEntry implementation CfgEntry::CfgEntry() { } CfgEntry::CfgEntry(const QString& f, const QString& l): file(f), label(l) { } const QString& CfgEntry::getFile() const { return file; } @@ -86,36 +92,36 @@ bool CfgParser::load(QString file, CfgFile& cfg) { QXmlSimpleReader reader; CfgHandler p(*this); reader.setErrorHandler(this); reader.setContentHandler(&p); err = ""; ardelay = -1; arperiod = -1; reader.parse(is); if (!err.isEmpty()) { - qDebug(err); + odebug << err << oendl; return false; } QMap<QString, QString>::Iterator fit, lit; for(uint i = 0; i < includeList.count(); i++) { QString file = *includeList.at(i); fit = includes.find(file); QString prefix = fit.data(); QString label = ""; - qDebug("include: file=" + fit.key() + ", prefix=" + fit.data()); + odebug << "include: file=" + fit.key() + ", prefix=" + fit.data() << oendl; lit = labels.find(prefix+":*"); if (lit != labels.end()) { label = lit.data(); } cfg.replaceEntry(file, label); } if (ardelay != -1) { cfg.setAutorepeatDelay(ardelay); } diff --git a/noncore/apps/keyz-cfg/config.in b/noncore/apps/keyz-cfg/config.in index 29a10f5..8e1be2d 100644 --- a/noncore/apps/keyz-cfg/config.in +++ b/noncore/apps/keyz-cfg/config.in @@ -1,4 +1,4 @@ config KEYZCFG boolean "keyz-cfg (configuration tool for keyz applet)" default "n" - depends ( LIBQPE || LIBQPE-X11 ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE diff --git a/noncore/apps/keyz-cfg/keyz-cfg.pro b/noncore/apps/keyz-cfg/keyz-cfg.pro index 44bbb5f..7ac604b 100644 --- a/noncore/apps/keyz-cfg/keyz-cfg.pro +++ b/noncore/apps/keyz-cfg/keyz-cfg.pro @@ -1,24 +1,24 @@ TEMPLATE = app DESTDIR = $(OPIEDIR)/bin CONFIG = qt warn_on HEADERS = zkb.h \ - zkbcfg.h \ - zkbnames.h \ - zkbxml.h \ - cfgdlg.h \ - cfgfile.h + zkbcfg.h \ + zkbnames.h \ + zkbxml.h \ + cfgdlg.h \ + cfgfile.h SOURCES = main.cpp \ cfgdlg.cpp \ cfgfile.cpp \ zkb.cpp \ zkbcfg.cpp \ - zkbnames.cpp \ - zkbxml.cpp + zkbnames.cpp \ + zkbxml.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 TARGET = keyz-cfg include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/keyz-cfg/zkb.cpp b/noncore/apps/keyz-cfg/zkb.cpp index f315d4b..8382615 100644 --- a/noncore/apps/keyz-cfg/zkb.cpp +++ b/noncore/apps/keyz-cfg/zkb.cpp @@ -355,25 +355,25 @@ State* Keymap::getStateByLabel(const QString& label) { QString name = lit.data(); int n = name.find(":*"); if (n>=0 && n==(int)(name.length()-2)) { name=name.left(name.length() - 1); n = currentStateName.findRev(":"); if (n >= 0) { name += currentStateName.mid(n+1); } } -// qDebug("look for: %s\n", (const char*) name.utf8()); +// odebug << "look for: " << (const char*) name.utf8() << "\n" << oendl; QMap<QString, State*>::Iterator sit = states.find(name); if (sit != states.end()) { state = sit.data(); } return state; } bool Keymap::addState(const QString& name, State* state) { if (states.find(name) != states.end()) { return false; } @@ -407,25 +407,25 @@ bool Keymap::setCurrentState(State* state) { qDebug("state changed: %s\n", (const char*) currentStateName.utf8()); if (!lsmapInSync) { generateLabelStateMaps(); } QMap<State*, QString>::Iterator tit; tit = stateLabelMap.find(state); if (tit != stateLabelMap.end()) { currentLabel = tit.data(); } else { -// qDebug("no label for: " + currentStateName + "\n"); +// odebug << "no label for: " + currentStateName + "\n" << oendl; currentLabel = ""; } return true; } } return false; } bool Keymap::removeState(const QString& name, bool force) { QMap<QString, State*>::Iterator it = states.find(name); diff --git a/noncore/apps/keyz-cfg/zkbcfg.cpp b/noncore/apps/keyz-cfg/zkbcfg.cpp index 0992b9a..f1d53ba 100644 --- a/noncore/apps/keyz-cfg/zkbcfg.cpp +++ b/noncore/apps/keyz-cfg/zkbcfg.cpp @@ -1,46 +1,49 @@ -#include <qfileinfo.h> - #include "zkbcfg.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ +#include <qfileinfo.h> // Implementation of XkbConfig class ZkbConfig::ZkbConfig(const QString& dir):path(dir) { } ZkbConfig::~ZkbConfig() { } bool ZkbConfig::load(const QString& file, Keymap& keymap, const QString& prefix) { bool ret; QFile f(path+"/"+file); QFileInfo fi(f); - qDebug("start loading file=%s\n", (const char*) file.utf8()); + odebug << "start loading file=" << (const char*) file.utf8() << "\n" << oendl; if (includedFiles.find(fi.absFilePath()) != includedFiles.end()) { return false; } includedFiles.insert(fi.absFilePath(), 1); QXmlInputSource is(f); QXmlSimpleReader reader; ZkbHandler h(*this, keymap, prefix); reader.setContentHandler(&h); reader.setErrorHandler(this); ret = reader.parse(is); includedFiles.remove(fi.absFilePath()); - qDebug("end loading file=%s : status=%s\n", (const char*) file.utf8(), - (const char*) err.utf8()); + odebug << "end loading file=" << file.utf8() << ": status=" << err.utf8() << oendl; return ret; } bool ZkbConfig::warning(const QXmlParseException& e) { QString tmp; tmp.sprintf("%d: warning: %s\n", e.lineNumber(), (const char*) e.message().utf8()); err += tmp; return true; @@ -113,25 +116,25 @@ bool ZkbHandler::startLabelElement(const QString& label, return false; } return true; } bool ZkbHandler::startStateElement(const QString& name, const QString& parentName, bool dflt) { currentStateName = prefix + name; currentState = keymap.getStateByName(currentStateName); -// qDebug("state name=%s\n", (const char*) currentStateName.utf8()); +// odebug << "state name=" << (const char*) currentStateName.utf8() << "\n" << oendl; State* parent = 0; if (!parentName.isEmpty()) { QString pn = prefix + parentName; parent = keymap.getStateByName(pn); if (parent == 0) { err = currentStateName + ": undefined parent state: " + pn; return false; } } diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp index e6cb515..59fc242 100644 --- a/noncore/apps/opie-bartender/bartender.cpp +++ b/noncore/apps/opie-bartender/bartender.cpp @@ -7,49 +7,52 @@ * 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 "bartender.h" #include "showdrinks.h" #include "inputDialog.h" #include "searchresults.h" #include "bac.h" -#include <qtoolbar.h> -#include <qmenubar.h> -//#include <opie2/colorpopupmenu.h> +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> +using namespace Opie::Core; +/* QT */ #include <qlineedit.h> #include <qdir.h> #include <qpushbutton.h> #include <qlistbox.h> #include <qmultilineedit.h> #include <qmessagebox.h> #include <qtextstream.h> #include <qaction.h> #include <qheader.h> #include <qlistview.h> #include <qlayout.h> +#include <qtoolbar.h> +#include <qmenubar.h> +/* STD */ #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <errno.h> - Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { if ( !name ) setName( "Bartender" ); QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2); layout->setMargin( 2); connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); setCaption( tr( "Bartender" ) ); ToolBar1 = new QToolBar( this, "ToolBar1" ); @@ -135,52 +138,52 @@ void Bartender::initDrinkDb() { } void Bartender::fillList() { dbFile.at(1); DrinkView->clear(); int i=0; QListViewItem * item ; QTextStream t( &dbFile); QString s; while ( !t.eof()) { s = t.readLine(); if(s.find("#",0,TRUE) != -1) { -// qDebug(s.right(s.length()-2)); +// odebug << s.right(s.length()-2) << oendl; item= new QListViewItem( DrinkView, 0 ); item->setText( 0, s.right(s.length()-2)); i++; } } - qDebug("there are currently %d of drinks", i); + odebug << "there are currently " << i << " of drinks" << oendl; } void Bartender::fileNew() { New_Drink *newDrinks; newDrinks = new New_Drink(this,"New Drink....", TRUE); QString newName, newIng; QPEApplication::execDialog( newDrinks ); newName = newDrinks->LineEdit1->text(); newIng= newDrinks->MultiLineEdit1->text(); if(dbFile.isOpen()) dbFile.close(); if ( !dbFile.open( IO_WriteOnly| IO_Append)) { QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); return; } if(newDrinks ->result() == 1 ) { QString newDrink="\n# "+newName+"\n"; newDrink.append(newIng+"\n"); - qDebug("writing "+newDrink); + odebug << "writing "+newDrink << oendl; dbFile.writeBlock( newDrink.latin1(), newDrink.length()); clearList(); dbFile.close(); initDrinkDb(); } delete newDrinks; } void Bartender::showDrink(int mouse, QListViewItem * item, const QPoint&, int) { switch (mouse) { case 1: @@ -198,25 +201,25 @@ void Bartender::showDrink( QListViewItem *item) { Show_Drink *showDrinks; QString myDrink=item->text(0); showDrinks = new Show_Drink(this, myDrink, TRUE); QTextStream t( &dbFile); QString s, s2; while ( !t.eof()) { s = t.readLine(); if(s.find( myDrink, 0, TRUE) != -1) { for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { s2 = t.readLine(); if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { -// qDebug(s2); +// odebug << s2 << oendl; showDrinks->MultiLineEdit1->append(s2); } if( dbFile.atEnd() ) break; } } } QPEApplication::execDialog( showDrinks ); if(showDrinks ->result() ==0) { doEdit(); } delete showDrinks; @@ -239,25 +242,25 @@ void Bartender::askSearch() { void Bartender::doSearchByName() { // if( DrinkView->currentItem() == NULL) return; QStringList searchList; QString searchForDrinkName; InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Find by Drink Name"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { searchForDrinkName = fileDlg->LineEdit1->text(); QListViewItemIterator it( DrinkView ); for ( ; it.current(); ++it ) { if ( it.current()->text(0).find( searchForDrinkName, 0, TRUE) != -1 ) { -// qDebug( it.current()->text(0)); +// odebug << it.current()->text(0) << oendl; searchList.append(it.current()->text(0)); } } if(searchList.count() >0) showSearchResult(searchList); else QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+searchForDrinkName); }//end Inputdialog delete fileDlg; } void Bartender::doSearchByDrink() { @@ -270,28 +273,28 @@ void Bartender::doSearchByDrink() { fileDlg->exec(); if( fileDlg->result() == 1 ) { searchForDrinkName = fileDlg->LineEdit1->text(); dbFile.at(0); QTextStream t( &dbFile); QString s, s2; while ( !t.eof()) { s = t.readLine(); if(s.find("#",0,TRUE) != -1) { lastDrinkName=s.right(s.length()-2); -// qDebug("last drink name "+lastDrinkName); +// odebug << "last drink name "+lastDrinkName << oendl; } else if( s.find( searchForDrinkName ,0, FALSE) != -1 && lastDrinkName != tempName ) { -// qDebug("appending "+lastDrinkName); +// odebug << "appending "+lastDrinkName << oendl; searchList.append( lastDrinkName); tempName=lastDrinkName; } // if( dbFile.atEnd() ) break; } //oef if(searchList.count() >0) showSearchResult(searchList); else QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+ searchForDrinkName); } delete fileDlg; @@ -304,25 +307,25 @@ void Bartender::showSearchResult(QStringList &searchList) { searchList.sort(); searchDlg = new Search_Results(this, "Search Results", TRUE); searchDlg->ListBox1->insertStringList( searchList,-1); QPEApplication::execDialog( searchDlg ); if( searchDlg->result() == 1 ) { result= searchDlg->ListBox1->currentText(); } QListViewItemIterator it2( DrinkView ); for ( ; it2.current(); ++it2 ) { if ( it2.current()->text(0)== result ) { -// qDebug( it2.current()->text(0)); +// odebug << it2.current()->text(0) << oendl; showDrink(it2.current()); } } delete searchDlg; } void Bartender::doEdit() { if(DrinkView->currentItem() == NULL) { fileNew(); } QString myDrink; @@ -334,25 +337,25 @@ void Bartender::doEdit() { QString newName, newIng; QPEApplication::showDialog( newDrinks ); QTextStream t( &dbFile); QString s, s2; while ( !t.eof()) { s = t.readLine(); if(s.find( myDrink, 0, TRUE) != -1) { foundAt = dbFile.at() - (s.length()+1); for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { s2 = t.readLine(); if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { -// qDebug(s2); +// odebug << s2 << oendl; newDrinks->MultiLineEdit1->append(s2); newDrinks->LineEdit1->setText(myDrink); } if( dbFile.atEnd() ) break; } } } newDrinks->exec(); newName = newDrinks->LineEdit1->text(); newIng= newDrinks->MultiLineEdit1->text(); if( newDrinks ->result() == 1 ) { @@ -361,25 +364,25 @@ void Bartender::doEdit() { if ( !dbFile.open( IO_ReadWrite )) { QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); return; } int fd = dbFile.handle(); lseek( fd, foundAt, SEEK_SET); // dbFile.at( foundAt); #warning FIXME problems with editing drinks db ////////// FIXME write to user file QString newDrink="# "+newName+"\n"; newDrink.append(newIng+"\n"); - qDebug("writing "+newDrink); + odebug << "writing "+newDrink << oendl; dbFile.writeBlock( newDrink.latin1(), newDrink.length()); clearList(); dbFile.flush(); initDrinkDb(); } } void Bartender::clearList() { DrinkView->clear(); } @@ -388,45 +391,45 @@ void Bartender::doBac() { BacDialog *bacDlg; bacDlg = new BacDialog(this,"BAC",TRUE); QPEApplication::execDialog( bacDlg ); delete bacDlg; } void Bartender::openCurrentDrink() { if(DrinkView->currentItem() == NULL) return; showDrink(DrinkView->currentItem()); } void Bartender::fileMenuActivated( int item) { - qDebug("Item %d", item); + odebug << "Item " << item << "" << oendl; switch(item) { case -3: // new -3 fileNew(); break; case -4:// open -4 openCurrentDrink(); break; case -5:// drink -5 doSearchByName(); break; case -6:// alcohol -6 doSearchByDrink(); break; } } void Bartender::editMenuActivated(int item) { - qDebug("Item %d", item); + odebug << "Item " << item << "" << oendl; /* edit -8 */ switch(item) { case -8: doEdit() ; break; } } diff --git a/noncore/apps/opie-bartender/bartender.pro b/noncore/apps/opie-bartender/bartender.pro index 4ad3c31..41fc0e5 100644 --- a/noncore/apps/opie-bartender/bartender.pro +++ b/noncore/apps/opie-bartender/bartender.pro @@ -1,12 +1,11 @@ TEMPLATE = app -#CONFIG = qt warn_on CONFIG = qt warn_on HEADERS = bartender.h newdrinks.h showdrinks.h inputDialog.h searchresults.h bac.h SOURCES = main.cpp bartender.cpp newdrinks.cpp showdrinks.cpp inputDialog.cpp searchresults.cpp bac.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -DESTDIR = $(OPIEDIR)/bin -TARGET = bartender +LIBS += -lqpe -lopiecore2 +DESTDIR = $(OPIEDIR)/bin +TARGET = bartender include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/opie-bartender/config.in b/noncore/apps/opie-bartender/config.in index c6ca2e6..c39a7d6 100644 --- a/noncore/apps/opie-bartender/config.in +++ b/noncore/apps/opie-bartender/config.in @@ -1,4 +1,5 @@ config BARTENDER boolean "bartender - bar receipe and blood alcohol estimator" default "n" - depends ( LIBQPE || LIBQPE-X11 ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE + diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index a37f980..6d57703 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp @@ -54,59 +54,63 @@ other by the operating system. One may think of them as two serial devices linked by a null-modem cable. Being based on devices the number of simultanous instances of this class is (globally) limited by the number of those device pairs, which is 256. Another technic are UNIX 98 PTY's. These are supported also, and prefered over the (obsolete) predecessor. There's a sinister ioctl(2), signal(2) and job control stuff nessesary to make everything work as it should. */ +#include "procctl.h" +#include "MyPty.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qsocketnotifier.h> #include <qfile.h> +/* STD */ #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <fcntl.h> #include <unistd.h> #include <termios.h> #include <sys/types.h> #include <sys/ioctl.h> #include <sys/wait.h> #ifdef HAVE_OPENPTY #include <pty.h> #endif -#include "procctl.h" -#include "MyPty.h" - - #undef VERBOSE_DEBUG /* -------------------------------------------------------------------------- */ /*! Informs the client program about the actual size of the window. */ void MyPty::setSize(int lines, int columns) { - qWarning("setting size"); + owarn << "setting size" << oendl; struct winsize wsize; wsize.ws_row = (unsigned short)lines; wsize.ws_col = (unsigned short)columns; if(m_fd < 0) return; ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); } void MyPty::donePty() { // This is code from the Qt DumbTerminal example diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp index e535296..d168a5e 100644 --- a/noncore/apps/opie-console/TEWidget.cpp +++ b/noncore/apps/opie-console/TEWidget.cpp @@ -1020,25 +1020,25 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) static_cast<QKeyEvent *>( e )->ignore(); return true; } if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) return FALSE; // not us if ( e->type() == QEvent::Wheel) { QApplication::sendEvent(scrollbar, e); } #ifdef FAKE_CTRL_AND_ALT static bool control = FALSE; static bool alt = FALSE; -// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); +// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl; bool dele=FALSE; if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { QKeyEvent* ke = (QKeyEvent*)e; bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); switch (ke->key()) { case Key_F9: // let this be "Control" control = keydown; e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); dele=TRUE; break; case Key_F13: // let this be "Alt" alt = keydown; @@ -1059,29 +1059,29 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) ke->ascii(), ke->state()|AltButton, ke->text()); dele=TRUE; } } } #endif if ( e->type() == QEvent::KeyPress ) { QKeyEvent* ke = (QKeyEvent*)e; actSel=0; // Key stroke implies a screen update, so TEWidget won't // know where the current selection is. -// qDebug("key pressed is 0x%x",ke->key()); +// odebug << "key pressed is 0x" << ke->key() << "" << oendl; if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker -// qDebug("key pressed 2 is 0x%x",ke->key()); +// odebug << "key pressed 2 is 0x" << ke->key() << "" << oendl; emitText("\\"); // expose } else emit keyPressedSignal(ke); // expose ke->accept(); #ifdef FAKE_CTRL_AND_ALT if ( dele ) delete e; #endif return true; // stop the event } if ( e->type() == QEvent::Enter ) { QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), this, SLOT(onClearSelection()) ); diff --git a/noncore/apps/opie-console/TEmulation.cpp b/noncore/apps/opie-console/TEmulation.cpp index d0169d7..6ff73af 100644 --- a/noncore/apps/opie-console/TEmulation.cpp +++ b/noncore/apps/opie-console/TEmulation.cpp @@ -61,24 +61,30 @@ producing the illusion of a permanent and immediate display operation. As a sort of catch-all needed for cases where none of the above conditions catch, the screen refresh is also triggered by a count of incoming bulks (`bulk_incnt'). */ /* FIXME - evtl. the bulk operations could be made more transparent. */ #include "TEmulation.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* STD */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> /* ------------------------------------------------------------------------- */ /* */ /* TEmulation */ /* */ /* ------------------------------------------------------------------------- */ #define CNTL(c) ((c)-'@') @@ -195,25 +201,25 @@ void TEmulation::onRcvChar(int c) /* ------------------------------------------------------------------------- */ /* */ /* Keyboard Handling */ /* */ /* ------------------------------------------------------------------------- */ /*! */ void TEmulation::onKeyPress( QKeyEvent* ev ) { - qWarning("onKeyPress,...."); + owarn << "onKeyPress,...." << oendl; if (!connected) return; // someone else gets the keys if (scr->getHistCursor() != scr->getHistLines()); scr->setHistCursor(scr->getHistLines()); if (!ev->text().isEmpty()) { // A block of text // Note that the text is proper unicode. // We should do a conversion here, but since this // routine will never be used, we simply emit plain ascii. emit sndBlock(ev->text().ascii(),ev->text().length()); } else if (ev->ascii()>0) { unsigned char c[1]; diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp index 8e91b9e..c998f96 100644 --- a/noncore/apps/opie-console/atconfigdialog.cpp +++ b/noncore/apps/opie-console/atconfigdialog.cpp @@ -1,25 +1,28 @@ +#include "atconfigdialog.h" +#include "io_modem.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qlineedit.h> #include <qspinbox.h> #include <qlayout.h> #include <qcombobox.h> #include <qtabwidget.h> #include <qlabel.h> #include <qscrollview.h> -#include "atconfigdialog.h" -#include "io_modem.h" - - ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { setCaption( tr( "Dialing parameter setup" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); QTabWidget *tabWidget = new QTabWidget( this ); tabWidget->addTab( tab0( this ), tr("Settings1") ); tabWidget->addTab( tab1( this ), tr("Settings2") ); @@ -143,25 +146,25 @@ QWidget* ATConfigDialog::tab1( QWidget* parent ) { multiLineUntagBox = new QComboBox( returnWidget ); layout->addWidget( multiLineUntagLabel, 6, 0 ); layout->addWidget( multiLineUntagBox, 6, 1 ); multiLineUntagBox->insertItem( tr("No") ); multiLineUntagBox->insertItem( tr("Yes") ); return returnWidget; } void ATConfigDialog::readConfig( const Profile& config ) { - qWarning("config in atconfigdialog"); + owarn << "config in atconfigdialog" << oendl; initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) ); hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) ); diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index 67ad10e..7010594 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp @@ -1,29 +1,34 @@ #include "dialer.h" +#include "io_modem.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; +/* QT */ #include <qlayout.h> #include <qprogressbar.h> #include <qlabel.h> #include <qpushbutton.h> #include <qapp.h> #include <qtimer.h> #include <qmessagebox.h> +/* STD */ #include <unistd.h> #include <string.h> #include <fcntl.h> #include <errno.h> -#include "io_modem.h" - // State machine: | When an error occurs, we don't have to // | reset everything. // (init) <------+ | But if the user wants to reset, // | | | we stop dialing immediately. // v | | // (options) ----+ | Following the state machine is necessary // | \ | to get determinable results. // v ^ | // (dial) ----+ | // | ^ | // v | | // (online) --+ | @@ -95,25 +100,25 @@ void Dialer::slotCancel() if(state != state_online) { usercancel = 1; reset(); } else { accept(); } } void Dialer::reset() { - qWarning("reset"); + owarn << "reset" << oendl; switchState(state_cancel); } void Dialer::slotAutostart() { //state = state_preinit; dial(m_profile.readEntry("Number")); } void Dialer::dial(const QString& number) { while(state != state_online) @@ -127,67 +132,67 @@ void Dialer::dial(const QString& number) } if(usercancel) { // modem hangup trydial(QString::null); reject(); } } void Dialer::trydial(const QString& number) { - qWarning("TryDial:%s", number.latin1() ); + owarn << "TryDial:" << number.latin1() << "" << oendl; if(state != state_cancel) switchState(state_preinit); if(cleanshutdown) { - qWarning("HangupString " + m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING)); + owarn << "HangupString " << m_profile.readEntry("HangupString") << oendl; send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r"); } if(state != state_cancel) { switchState(state_init); -// qWarning("Init String " + m_profile.readEntry("InitString") ); +// owarn << "Init String " + m_profile.readEntry("InitString") << oendl; send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r"); QString response2 = receive(); if(!response2.contains("\nOK\r")) reset(); } /* if(state != state_cancel) { switchState(state_options); - qWarning("ATM3l3"); + owarn << "ATM3l3" << oendl; send("ATM3L3\r"); QString response3 = receive(); if(!response3.contains("\nOK\r")) reset(); } */ if(state != state_cancel) { switchState(state_dialtone); send("ATX1\r"); QString response4 = receive(); if(!response4.contains("\nOK\r")) reset(); } if(state != state_cancel) { - qWarning("progress"); + owarn << "progress" << oendl; switchState(state_dialing); // send(QString("ATDT %1\r").arg(number)); send(QString("%1 %2\r").arg(m_profile.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 )) .arg(number)); QString response5 = receive(); if(!response5.contains("CONNECT") ) { if(response5.contains("BUSY")) switchState(state_dialing); else @@ -205,25 +210,25 @@ void Dialer::trydial(const QString& number) { state = state_online; slotCancel(); } } void Dialer::send(const QString& msg) { QString m = msg; int bytes; QString termination; - qWarning("Sending: %s", m.latin1()); + owarn << "Sending: " << m.latin1() << "" << oendl; /* termination = "\r"; //termination = m_profile.readEntry("Termination"); if(termination == "\n") m = m + "\n"; else if(termination == "\r") m = m + "\r"; else m = m + "\r\n"; */ m = m.replace(QRegExp("\n"), "\r"); bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); if(bytes < 0) { @@ -238,29 +243,29 @@ QString Dialer::receive() int ret; int counter = 0; while(1) { ret = ::read(m_fd, buffer, sizeof(buffer)); if(ret > 0) { for(int i = 0; i < ret; i++) buffer[i] = buffer[i] & 0x7F; buffer[ret] = 0; - qWarning("Got: %s", buffer); + owarn << "Got: " << buffer << "" << oendl; buf.append(QString(buffer)); if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) { - //qWarning("Receiving: '%s'", buf.latin1()); + //owarn << "Receiving: '" << buf.latin1() << "'" << oendl; cleanshutdown = 1; return buf; }else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) { cleanshutdown = 1; return QString::null; } } else if(ret < 0) { if(errno != EAGAIN) reset(); else if(!(counter++ % 100)) qApp->processEvents(); } diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 99d069f..89b70c6 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp @@ -1,19 +1,21 @@ - #include "TEmuVt102.h" - #include "profile.h" #include "emulation_handler.h" #include "script.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) : QObject(0, name ) { m_teWid = new TEWidget( parent, "TerminalMain"); // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) // use setWrapAt(80) for normal console with scrollbar setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); m_teWid->setMinimumSize(150, 70 ); m_script = 0; parent->resize( m_teWid->calcSize(80, 24 ) ); m_teEmu = new TEmuVt102(m_teWid ); @@ -119,53 +121,53 @@ QColor EmulationHandler::foreColor(int col) { QColor co; /* we need to switch it */ switch( col ) { default: case Profile::White: /* color is black */ co = Qt::white; break; case Profile::Black: co = Qt::black; break; case Profile::Green: - qWarning("Foreground green"); + owarn << "Foreground green" << oendl; co = Qt::green; break; case Profile::Orange: - qWarning("Foreground orange"); + owarn << "Foreground orange" << oendl; co.setRgb( 231, 184, 98 ); break; } return co; } QColor EmulationHandler::backColor(int col ) { QColor co; /* we need to switch it */ switch( col ) { default: case Profile::White: /* color is white */ co = Qt::black; break; case Profile::Black: co = Qt::white; break; case Profile::Green: - qWarning("Background black"); + owarn << "Background black" << oendl; co = Qt::black; break; case Profile::Orange: - qWarning("Background black"); + owarn << "Background black" << oendl; co = Qt::black; break; } return co; } QPushButton* EmulationHandler::cornerButton() { return m_teWid->cornerButton(); } diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp index ad8ecba..4688551 100644 --- a/noncore/apps/opie-console/emulation_widget.cpp +++ b/noncore/apps/opie-console/emulation_widget.cpp @@ -215,27 +215,27 @@ void EmulationWidget::paintEvent( QPaintEvent* pe ) drawAttrString( unistr, painter, QRect( m_blX+tLx+f_width*x,m_bY+tLy+f_height*y,f_width*len,f_height ), m_image[loc(x ,y )], pm != 0l, false ); x +=len -1; } delete [] disstrU; drawFrame( &painter ); painter.end(); } void EmulationWidget::calcGeometry() { m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() ); - qDebug( QString(" TEST").arg( contentsRect().width() ) ); - qDebug( QString(" TEST").arg( contentsRect().height() ) ); - qDebug("NEUER TESTT!!!!!!!!"); + odebug << QString(" TEST").arg( contentsRect().width() ) << oendl; + odebug << QString(" TEST").arg( contentsRect().height() ) << oendl; + odebug << "NEUER TESTT!!!!!!!!" << oendl; switch( scrollLoc ) { case SCRNONE : m_columns = ( contentsRect().width() -2 * rimX ) / f_width; m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2; m_brX = m_blX; m_scrollbar->hide(); break; case SCRLEFT : m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; m_brX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; @@ -249,39 +249,39 @@ void EmulationWidget::calcGeometry() m_brX = m_blX; m_scrollbar->move( contentsRect().topRight() - QPoint (m_scrollbar->width()-1,0 ) ); m_scrollbar->show(); break; } m_lines = ( contentsRect().height() - 2 * rimY ) / f_height; m_bY = ( contentsRect().height() - (m_lines * f_height ) ) / 2; } void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear ) { - qWarning("Color1 %s", color_table[attr.b].color.name().latin1() ); + owarn << "Color1 " << color_table[attr.b].color.name().latin1() << "" << oendl; if ( usePixmap && color_table[attr.b].transparent ) { painter.setBackgroundMode( TransparentMode ); if ( clear ) erase( rect ); } else { if ( blinking ) painter.fillRect( rect, color_table[attr.b].color ); else { painter.setBackgroundMode( OpaqueMode ); - qWarning("Color %s", color_table[attr.b].color.name().latin1() ); + owarn << "Color " << color_table[attr.b].color.name().latin1() << "" << oendl; painter.setBackgroundColor( color_table[attr.b].color ); } } if ( color_table[attr.f].bold ) painter.setPen( QColor( 0x8F, 0x00, 0x00 ) ); else painter.setPen( color_table[attr.f].color ); painter.drawText( rect.x(), rect.y() + f_ascent, string ); } diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index eb32551..6613183 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp @@ -1,14 +1,19 @@ #include "function_keyboard.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qlayout.h> #include <qlistbox.h> #include <qlabel.h> #include <qdir.h> #define DEFAULT_ROWS 2 #define DEFAULT_COLS 12 /* FunctionKeyboard {{{1 */ FunctionKeyboard::FunctionKeyboard(QWidget *parent) : QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), @@ -28,25 +33,25 @@ FunctionKeyboard::FunctionKeyboard(QWidget *parent) : QString handle = "r" + QString::number(r) + "c" + QString::number(c); QStringList value_list = conf.readListEntry( handle, '|'); if (value_list.isEmpty()) continue; keys.insert( handle, FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) ); } - //qWarning("loaded %d keys", keys.count()); + //owarn << "loaded " << keys.count() << " keys" << oendl; */ if (keys.isEmpty()) loadDefaults(); } FunctionKeyboard::~FunctionKeyboard() {} void FunctionKeyboard::changeRows(int r) { numRows = r; @@ -247,25 +252,25 @@ void FunctionKeyboard::loadDefaults() { keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); } /* FunctionKeyboardConfig {{{1 */ FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) : ProfileDialogKeyWidget(name, parent, na), selectedRow(0), selectedCol(0) { - qWarning("FunctionKeyboardConfig"); + owarn << "FunctionKeyboardConfig" << oendl; kb = new FunctionKeyboard(this); connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool))); QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this); QLabel *l = new QLabel("Rows", dimentions); m_rowBox = new QSpinBox(1, 15, 1, dimentions); connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); l = new QLabel("Columns", dimentions); m_colBox = new QSpinBox(1, 15, 1, dimentions); diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp index a29fa8e..c102427 100644 --- a/noncore/apps/opie-console/io_bt.cpp +++ b/noncore/apps/opie-console/io_bt.cpp @@ -1,16 +1,19 @@ #include "io_bt.h" +/* OPIE */ +#include <opie2/odebug.h> using namespace Opie::Core; + IOBt::IOBt( const Profile &config ) : IOSerial( config ) { m_attach = 0; } IOBt::~IOBt() { if ( m_attach ) { delete m_attach; } } @@ -34,25 +37,25 @@ bool IOBt::open() { // hciattach here m_attach = new OProcess(); *m_attach << "hciattach /dev/ttyS2 any 57600"; // then start hcid, then rcfomm handling (m_mac) connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), this, SLOT( slotExited(Opie::Core::OProcess*) ) ); if ( m_attach->start() ) { ret = IOSerial::open(); } else { - qWarning("could not attach to device"); + owarn << "could not attach to device" << oendl; delete m_attach; m_attach = 0; } } else { // directly to the normal serial // TODO: look first if the connection really exists. ( is set up ) ret =IOSerial::open(); } return ret; } @@ -80,14 +83,14 @@ void IOBt::slotExited( OProcess* proc ){ delete proc; } QBitArray IOBt::supports() const { return QBitArray( 3 ); } bool IOBt::isConnected() { return false; } void IOBt::send(const QByteArray &data) { - qDebug( "Please overload me..." ); + odebug << "Please overload me..." << oendl; } diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp index 07c2b62..38542f5 100644 --- a/noncore/apps/opie-console/io_irda.cpp +++ b/noncore/apps/opie-console/io_irda.cpp @@ -1,16 +1,18 @@ - #include "io_irda.h" +/* OPIE */ +#include <opie2/odebug.h> using namespace Opie::Core; + IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { m_attach = 0; } IOIrda::~IOIrda() { if ( m_attach ) { delete m_attach; } } @@ -26,25 +28,25 @@ bool IOIrda::open() { // irdaattach here m_attach = new OProcess(); *m_attach << "irattach /dev/ttyS2 -s"; connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), this, SLOT( slotExited(Opie::Core::OProcess*) ) ); if ( m_attach->start() ) { ret= IOSerial::open(); } else { // emit error!!! - qWarning("could not attach to device"); + owarn << "could not attach to device" << oendl; delete m_attach; m_attach = 0l; } return ret; } void IOIrda::reload( const Profile &config ) { m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); @@ -65,14 +67,14 @@ void IOIrda::slotExited(OProcess* proc ){ delete proc; } QBitArray IOIrda::supports()const { return QBitArray( 3 ); } bool IOIrda::isConnected() { return false; } void IOIrda::send(const QByteArray &data) { - qDebug( "Please overload me..." ); + odebug << "Please overload me..." << oendl; } diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp index b74d076..c499dfe 100644 --- a/noncore/apps/opie-console/io_modem.cpp +++ b/noncore/apps/opie-console/io_modem.cpp @@ -1,27 +1,27 @@ #include "io_modem.h" - #include "dialer.h" +/* OPIE */ +#include <opie2/odebug.h> using namespace Opie::Core; -using namespace Opie::Core; + IOModem::IOModem( const Profile &profile ) : IOSerial( profile ) { m_profile = profile; } IOModem::~IOModem() { - } void IOModem::close() { // Hangup, discarding result // int fd = rawIO(); internDetach(); Dialer d(m_profile, m_fd); d.setHangupOnly(); //d.exec(); internAttach(); // closeRawIO(fd); @@ -95,14 +95,14 @@ void IOModem::slotExited(OProcess* proc ){ delete proc; } QBitArray IOModem::supports()const { return QBitArray( 3 ); } bool IOModem::isConnected() { return false; } void IOModem::send(const QByteArray &data) { - qDebug( "Please overload me..." ); + odebug << "Please overload me..." << oendl; } diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp index dfb2f83..1bd4338 100644 --- a/noncore/apps/opie-console/main.cpp +++ b/noncore/apps/opie-console/main.cpp @@ -82,25 +82,25 @@ void FixIt::fixIt() { file.writeBlock(m_file,strlen(m_file) ); } file.close(); ::kill( SIGHUP, 1 ); } #endif int main(int argc, char **argv) { // too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; QPEApplication app( argc, argv ); #ifdef FSCKED_DISTRIBUTION - qWarning("fscked"); + owarn << "fscked" << oendl; FixIt it; it.fixIt(); #endif MainWindow mw; mw.setCaption(QObject::tr("Opie Console") ); app.showMainWidget( &mw ); int ap = app.exec(); #ifdef FSCKED_DISTRIBUTION /* should add a signal handler too */ diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 06a8f7d..b403b4d 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -1,39 +1,42 @@ -#include <assert.h> - -#include <qaction.h> -#include <qmenubar.h> -#include <qtoolbar.h> -#include <qmessagebox.h> -#include <qwhatsthis.h> -#include <qfileinfo.h> - -#include <qpe/filemanager.h> - -#include <opie2/ofiledialog.h> - #include "TEmulation.h" #include "profileeditordialog.h" #include "configdialog.h" #include "default.h" #include "profilemanager.h" #include "mainwindow.h" #include "tabwidget.h" #include "transferdialog.h" #include "function_keyboard.h" #include "emulation_handler.h" #include "script.h" - +/* OPIE */ +#include <opie2/odebug.h> +#include <opie2/ofiledialog.h> +#include <qpe/filemanager.h> +using namespace Opie::Core; using namespace Opie::Ui; + +/* QT */ +#include <qaction.h> +#include <qmenubar.h> +#include <qtoolbar.h> +#include <qmessagebox.h> +#include <qwhatsthis.h> +#include <qfileinfo.h> + +/* STD */ +#include <assert.h> + MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { KeyTrans::loadAll(); for (int i = 0; i < KeyTrans::count(); i++ ) { KeyTrans* s = KeyTrans::find(i ); assert( s ); } m_factory = new MetaFactory(); Default def(m_factory); m_sessions.setAutoDelete( TRUE ); m_curSession = 0; m_manager = new ProfileManager( m_factory ); m_manager->load(); @@ -437,31 +440,31 @@ void MainWindow::slotConfigure() { /* * we will remove * this window from the tabwidget * remove it from the list * delete it * and set the currentSession() */ void MainWindow::slotClose() { if (!currentSession() ) return; Session* ses = currentSession(); - qWarning("removing! currentSession %s", currentSession()->name().latin1() ); + owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl; /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ m_curSession = NULL; tabWidget()->remove( /*currentSession()*/ses ); /*it's autodelete */ m_sessions.remove( ses ); - qWarning("after remove!!"); + owarn << "after remove!!" << oendl; if (!currentSession() ) { m_connect->setEnabled( false ); m_disconnect->setEnabled( false ); m_terminate->setEnabled( false ); m_transfer->setEnabled( false ); m_recordScript->setEnabled( false ); m_saveScript->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); m_fullscreen->setEnabled( false ); m_wrap->setEnabled( false ); m_closewindow->setEnabled( false ); @@ -561,34 +564,34 @@ void MainWindow::slotOpenKeb(bool state) { void MainWindow::slotOpenButtons( bool state ) { if ( state ) { m_buttonBar->show(); } else { m_buttonBar->hide(); } } void MainWindow::slotSessionChanged( Session* ses ) { - qWarning("changed!"); + owarn << "changed!" << oendl; if(m_curSession) if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); if(ses) if(ses->transferDialog()) ses->transferDialog()->show(); if ( ses ) { m_curSession = ses; - qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); + odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; if ( m_curSession->layer()->isConnected() ) { m_connect->setEnabled( false ); m_disconnect->setEnabled( true ); m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); m_scripts->setItemEnabled(m_runScript_id, true); } else { m_connect->setEnabled( true ); m_disconnect->setEnabled( false ); m_recordScript->setEnabled( false ); m_saveScript->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index 3466e3a..9fdaf73 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp @@ -1,24 +1,27 @@ +#include "modemconfigwidget.h" +#include "dialdialog.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; +/* QT */ #include <qlabel.h> #include <qlayout.h> #include <qcombobox.h> #include <qpushbutton.h> #include <qhbox.h> -#include "modemconfigwidget.h" -#include "dialdialog.h" - namespace { void setCurrent( const QString& str, QComboBox* bo ) { uint b = bo->count(); for (int i = 0; i < bo->count(); i++ ) { if ( bo->text(i) == str ) { bo->setCurrentItem( i ); return; } } bo->insertItem( str ); bo->setCurrentItem( b ); } @@ -126,25 +129,25 @@ void ModemConfigWidget::load( const Profile& prof ) { if ( sbits == 2) { m_base->setStop( IOLayerBase::Stop_Two ); } else if ( sbits == 15 ) { m_base->setStop( IOLayerBase::Stop_OnePointFive ); } else { m_base->setStop( IOLayerBase::Stop_One ); } atConf->readConfig( prof ); if ( prof.readEntry( "Device" ).isEmpty() ) { - qWarning("device empty!"); + owarn << "device empty!" << oendl; return; } setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); } /* * save speed, * flow, * parity */ diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index 7a15828..f7e33e9 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro @@ -1,16 +1,14 @@ TEMPLATE = app -TMAKE_CXXFLAGS += -DHAVE_OPENPTY CONFIG += qt warn_on -#CONFIG = qt DESTDIR = $(OPIEDIR)/bin HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ file_layer.h filetransfer.h \ metafactory.h \ session.h \ mainwindow.h \ profile.h \ profileconfig.h \ profilemanager.h \ tabwidget.h \ configdialog.h \ keytrans.h \ @@ -61,16 +59,16 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ emulation_handler.cpp TEHistory.cpp \ TEScreen.cpp TEWidget.cpp \ TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ consoleconfigwidget.cpp INTERFACES = configurebase.ui editbase.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -lopieui2 -lutil TARGET = opie-console - +DEFINES += HAVE_OPENPTY include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp index fbc5306..f505998 100644 --- a/noncore/apps/opie-console/sz_transfer.cpp +++ b/noncore/apps/opie-console/sz_transfer.cpp @@ -32,55 +32,55 @@ void SzTransfer::sendFile(const QString& file) { connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), this, SLOT(SzReceivedStdout(Opie::Core::OProcess*,char*,int))); connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT(SzReceivedStderr(Opie::Core::OProcess*,char*,int))); connect(layer(), SIGNAL(received(const QByteArray&)), this, SLOT(receivedStdin(const QByteArray&))); proc->start(OProcess::NotifyOnExit, OProcess::All); } void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { - qWarning("recieved from sz on stdout %d bytes", buflen); + owarn << "recieved from sz on stdout " << buflen << " bytes" << oendl; QByteArray data(buflen); data.fill(*buffer, buflen); for (uint i = 0; i < data.count(); i++ ) { printf("%c", buffer[i] ); } printf("\n"); // send out through the io layer layer()->send(data); } void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { // parse and show data in a progress dialog/widget printf("stderr:\n"); //for (int i = 0; i < length; i++) // printf("%c", buffer[i]); //printf("\n"); } void SzTransfer::receivedStdin(const QByteArray &data) { - qWarning("recieved from io_serial %d bytes", data.size()); + owarn << "recieved from io_serial " << data.size() << " bytes" << oendl; // recieved data from the io layer goes to sz proc->writeStdin(data.data(), data.size()); } void SzTransfer::sent() { - qWarning("sent file"); + owarn << "sent file" << oendl; //setcbreak(0); /* default */ delete proc; disconnect(layer(), SIGNAL(received(const QByteArray&)), this, SLOT(receivedStdin(const QByteArray&))); } diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp index 6429e3c..41a91ed 100644 --- a/noncore/apps/opie-console/tabwidget.cpp +++ b/noncore/apps/opie-console/tabwidget.cpp @@ -1,27 +1,30 @@ - #include "tabwidget.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; using namespace Opie::Ui; + TabWidget::TabWidget( QWidget* parent, const char* name ) : OTabWidget( parent, name ) { connect(this, SIGNAL( currentChanged(QWidget*) ), this, SLOT( slotCurChanged(QWidget*) ) ); } TabWidget::~TabWidget() { } void TabWidget::add( Session* ses ) { - qWarning("session ses " + ses->name() ); + owarn << "session ses " + ses->name() << oendl; if ( !ses->widgetStack() ) return; //reparent( ses->widgetStack(), QPoint() ); addTab( ses->widgetStack(), "console/konsole", ses->name() ); //addTab( ses->widgetStack(), ses->name() ); m_map.insert( ses->widgetStack(), ses ); } void TabWidget::remove( Session* ses ) { m_map.remove( ses->widgetStack() ); removePage( ses->widgetStack() ); } diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp index 6870487..087476b 100644 --- a/noncore/apps/opie-console/terminalwidget.cpp +++ b/noncore/apps/opie-console/terminalwidget.cpp @@ -1,22 +1,27 @@ +#include "terminalwidget.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qlabel.h> #include <qcheckbox.h> #include <qcombobox.h> #include <qradiobutton.h> #include <qhgroupbox.h> #include <qhbuttongroup.h> #include <qlayout.h> -#include "terminalwidget.h" - namespace { enum TermIds { id_term_vt100 = 0, id_term_vt102, id_term_linux, id_term_xterm }; enum ColourIds { id_term_black, id_term_white, id_term_green, @@ -60,25 +65,25 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, m_typeBox->add( m_terminal ); m_typeBox->add( m_terminalBox ); m_lroot->add( m_groupSize ); m_colorBox->add( m_colorLabel ); m_colorBox->add( m_colorCmb ); m_lroot->add( m_groupConv ); m_lroot->add( m_groupOptions ); m_lroot->addStretch( 0 ); // Fill in some options - qWarning("Options for terminal box"); + owarn << "Options for terminal box" << oendl; m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); m_colorCmb->insertItem( tr("black on white"), id_term_black ); m_colorCmb->insertItem( tr("white on black"), id_term_white ); m_colorCmb->insertItem( tr("green on black"), id_term_green ); m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); // signals + slots diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp index df27055..45fd11d 100644 --- a/noncore/apps/opie-console/test/senderui.cpp +++ b/noncore/apps/opie-console/test/senderui.cpp @@ -17,63 +17,63 @@ using namespace Opie::Core; using namespace Opie::Core; SenderUI::SenderUI() : Sender() { /* we do that manually */ Profile prof; QString str = "/dev/bty0"; prof.writeEntry("Device",str ); prof.writeEntry("Baud", 19200 ); - qWarning("prof " + prof.readEntry("Device") + " " + str); + owarn << "prof " + prof.readEntry("Device") + " " + str << oendl; ser = new IOSerial(prof); connect(ser, SIGNAL(received(const QByteArray&) ), this, SLOT(got(const QByteArray&) ) ); if ( ser->open() ) - qWarning("opened!!!"); + owarn << "opened!!!" << oendl; else - qWarning("could not open"); + owarn << "could not open" << oendl; } SenderUI::~SenderUI() { } void SenderUI::slotSendFile() { sz = new FileTransfer(FileTransfer::SY, ser); sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); connect (sz, SIGNAL(sent()), this, SLOT(fileTransComplete())); } void SenderUI::slotSend() { QCString str = MultiLineEdit1->text().utf8(); - qWarning("sending: %s", str.data() ); + owarn << "sending: " << str.data() << "" << oendl; str = str.replace( QRegExp("\n"), "\r"); ser->send( str ); } void SenderUI::got(const QByteArray& ar) { - qWarning("got:"); + owarn << "got:" << oendl; for ( uint i = 0; i < ar.count(); i++ ) { printf("%c", ar[i] ); } printf("\n"); } void SenderUI::fileTransComplete() { - qWarning("file transfer complete"); + owarn << "file transfer complete" << oendl; } void SenderUI::send() { } void SenderUI::slotRev(){ -qWarning("Going to receive!"); +owarn << "Going to receive!" << oendl; FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); rev->receive(); } diff --git a/noncore/apps/opie-console/widget.cpp b/noncore/apps/opie-console/widget.cpp index e17dfd4..c51983f 100644 --- a/noncore/apps/opie-console/widget.cpp +++ b/noncore/apps/opie-console/widget.cpp @@ -986,25 +986,25 @@ bool Widget::eventFilter( QObject *obj, QEvent *e ) static_cast<QKeyEvent *>( e )->ignore(); return true; } if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) return FALSE; // not us if ( e->type() == QEvent::Wheel) { QApplication::sendEvent(scrollbar, e); } #ifdef FAKE_CTRL_AND_ALT static bool control = FALSE; static bool alt = FALSE; -// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); +// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl; bool dele=FALSE; if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { QKeyEvent* ke = (QKeyEvent*)e; bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); switch (ke->key()) { case Key_F9: // let this be "Control" control = keydown; e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); dele=TRUE; break; case Key_F13: // let this be "Alt" alt = keydown; @@ -1025,29 +1025,29 @@ bool Widget::eventFilter( QObject *obj, QEvent *e ) ke->ascii(), ke->state()|AltButton, ke->text()); dele=TRUE; } } } #endif if ( e->type() == QEvent::KeyPress ) { QKeyEvent* ke = (QKeyEvent*)e; actSel=0; // Key stroke implies a screen update, so Widget won't // know where the current selection is. -// qDebug("key pressed is 0x%x",ke->key()); +// odebug << "key pressed is 0x" << ke->key() << "" << oendl; if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker -// qDebug("key pressed 2 is 0x%x",ke->key()); +// odebug << "key pressed 2 is 0x" << ke->key() << "" << oendl; emitText("\\"); // expose } else emit keyPressedSignal(ke); // expose ke->accept(); #ifdef FAKE_CTRL_AND_ALT if ( dele ) delete e; #endif return true; // stop the event } if ( e->type() == QEvent::Enter ) { QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), this, SLOT(onClearSelection()) ); diff --git a/noncore/apps/opie-console/widget_layer.cpp b/noncore/apps/opie-console/widget_layer.cpp index 96dda1c..ab25919 100644 --- a/noncore/apps/opie-console/widget_layer.cpp +++ b/noncore/apps/opie-console/widget_layer.cpp @@ -66,25 +66,25 @@ bool WidgetLayer::eventFilter( QObject *obj, QEvent *e ) { if ( (e->type() == QEvent::Accel || e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { static_cast<QKeyEvent *>( e )->ignore(); return true; } if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) return false; // not us #ifdef FAKE_CTRL_AND_ALT static bool control = false; static bool alt = false; -// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); +// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl; bool dele = false; if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { QKeyEvent* ke = (QKeyEvent*)e; bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); switch (ke->key()) { case Key_F9: // let this be "Control" control = keydown; e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); dele=TRUE; break; case Key_F13: // let this be "Alt" alt = keydown; @@ -106,25 +106,25 @@ QChar(a,0)); ke->ascii(), ke->state()|AltButton, ke->text()); dele=TRUE; } } } #endif if ( e->type() == QEvent::KeyPress ) { QKeyEvent* ke = (QKeyEvent*)e; //actSel=0; // Key stroke implies a screen update, so Widget won't // know where the current selection is. -// qDebug("key pressed is 0x%x",ke->key()); +// odebug << "key pressed is 0x" << ke->key() << "" << oendl; if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker insertText("\\"); // expose } else emit keyPressed( ke ); // expose ke->accept(); #ifdef FAKE_CTRL_AND_ALT if ( dele ) delete e; #endif return true; // stop the event } return QFrame::eventFilter( obj, e ); diff --git a/noncore/apps/opie-write/mainwindow.cpp b/noncore/apps/opie-write/mainwindow.cpp index 90e1a70..aa03060 100644 --- a/noncore/apps/opie-write/mainwindow.cpp +++ b/noncore/apps/opie-write/mainwindow.cpp @@ -11,30 +11,34 @@ ** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR ** PURPOSE. ** ** email sales@trolltech.com for information about Qtopia License ** Agreements. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "mainwindow.h" + +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/fileselector.h> #include <qpe/applnk.h> #include <qpe/resource.h> #include <qpe/fontdatabase.h> +using namespace Opie::Core; -//#include "qspellchecker.h" +/* QT */ #include "qtextedit.h" #include <qaction.h> #include <qtoolbar.h> #include <qtoolbutton.h> #include <qtabwidget.h> #include <qapplication.h> #include <qfontdatabase.h> #include <qcombobox.h> #include <qlineedit.h> #include <qfileinfo.h> #include <qfile.h> #include <qfiledialog.h> @@ -435,56 +439,56 @@ void MainWindow::fileOpen() { save(); editorStack->raiseWidget( fileSelector ); fileSelector->reread(); hideEditTools(); fileSelector->setNewVisible( TRUE ); clear(); updateCaption(); } void MainWindow::fileRevert() { - qDebug( "QMainWindow::fileRevert needs to be done" ); + odebug << "QMainWindow::fileRevert needs to be done" << oendl; } void MainWindow::fileNew() { editor->setTextFormat( Qt::RichText ); save(); newFile(DocLnk()); } void MainWindow::insertTable() { - qDebug( "MainWindow::insertTable() needs to be done" ); + odebug << "MainWindow::insertTable() needs to be done" << oendl; } void MainWindow::newFile( const DocLnk &dl ) { DocLnk nf = dl; nf.setType( "text/html" ); clear(); editorStack->raiseWidget( editor ); editor->viewport()->setFocus(); doc = new DocLnk( nf ); updateCaption(); } void MainWindow::openFile( const DocLnk &dl ) { FileManager fm; QString txt; if ( !fm.loadFile( dl, txt ) ) - qDebug( "couldn't open file" ); + odebug << "couldn't open file" << oendl; clear(); editorStack->raiseWidget( editor ); editor->viewport()->setFocus(); doc = new DocLnk( dl ); editor->setText( txt ); editor->setModified( FALSE ); updateCaption(); } void MainWindow::showEditTools( void ) { tbMenu->show(); diff --git a/noncore/apps/opie-write/opie-write.pro b/noncore/apps/opie-write/opie-write.pro index 044ce7e..8e514d4 100644 --- a/noncore/apps/opie-write/opie-write.pro +++ b/noncore/apps/opie-write/opie-write.pro @@ -1,15 +1,14 @@ -CONFIG += qt warn on quick-app - +CONFIG += qt warn on quick-app HEADERS = qcleanuphandler.h \ qcomplextext_p.h \ qrichtext_p.h \ qstylesheet.h \ qtextedit.h \ mainwindow.h SOURCES = qcomplextext.cpp \ qstylesheet.cpp \ qrichtext_p.cpp \ qrichtext.cpp \ diff --git a/noncore/apps/opie-write/qcomplextext.cpp b/noncore/apps/opie-write/qcomplextext.cpp index 473f184..00a91c5 100644 --- a/noncore/apps/opie-write/qcomplextext.cpp +++ b/noncore/apps/opie-write/qcomplextext.cpp @@ -97,43 +97,43 @@ QBidiContext::~QBidiContext() previous and left with next in the above rules ;-) */ /* Two small helper functions for arabic shaping. They get the next shape causing character on either side of the char in question. Implements rule R1. leftChar() returns true if the char to the left is a left join-causing char rightChar() returns true if the char to the right is a right join-causing char */ static inline const QChar *prevChar( const QString &str, int pos ) { - //qDebug("leftChar: pos=%d", pos); + //odebug << "leftChar: pos=" << pos << "" << oendl; pos--; const QChar *ch = str.unicode() + pos; while( pos > -1 ) { if( !ch->isMark() ) return ch; pos--; ch--; } return &QChar::replacement; } static inline const QChar *nextChar( const QString &str, int pos) { pos++; int len = str.length(); const QChar *ch = str.unicode() + pos; while( pos < len ) { - //qDebug("rightChar: %d isLetter=%d, joining=%d", pos, ch.isLetter(), ch.joining()); + //odebug << "rightChar: " << pos << " isLetter=" << ch.isLetter() << ", joining=" << ch.joining() << "" << oendl; if( !ch->isMark() ) return ch; // assume it's a transparent char, this might not be 100% correct pos++; ch++; } return &QChar::replacement; } static inline bool prevVisualCharJoins( const QString &str, int pos) { return ( prevChar( str, pos )->joining() != QChar::OtherJoining ); diff --git a/noncore/apps/opie-write/qrichtext.cpp b/noncore/apps/opie-write/qrichtext.cpp index b77a0fc..c27eb1e 100644 --- a/noncore/apps/opie-write/qrichtext.cpp +++ b/noncore/apps/opie-write/qrichtext.cpp @@ -28,29 +28,35 @@ ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for ** information about Qt Commercial License Agreements. ** See http://www.trolltech.com/qpl/ for QPL licensing information. ** 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 "qrichtext_p.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include "qdragobject.h" #include "qpaintdevicemetrics.h" #include "qdrawutil.h" #include "qcleanuphandler.h" +/* STD */ #include <stdlib.h> using namespace Qt3; static QTextCursor* richTextExportStart = 0; static QTextCursor* richTextExportEnd = 0; static QTextFormatCollection *qFormatCollection = 0; const int border_tolerance = 2; #ifdef Q_WS_WIN @@ -175,25 +181,25 @@ QTextDeleteCommand::~QTextDeleteCommand() { for ( int i = 0; i < (int)text.size(); ++i ) { if ( text[ i ].format() ) text[ i ].format()->removeRef(); } text.resize( 0 ); } QTextCursor *QTextDeleteCommand::execute( QTextCursor *c ) { QTextParagraph *s = doc ? doc->paragAt( id ) : parag; if ( !s ) { - qWarning( "can't locate parag at %d, last parag: %d", id, doc->lastParagraph()->paragId() ); + owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl; return 0; } cursor.setParagraph( s ); cursor.setIndex( index ); int len = text.size(); if ( c ) *c = cursor; if ( doc ) { doc->setSelectionStart( QTextDocument::Temp, cursor ); for ( int i = 0; i < len; ++i ) cursor.gotoNextLetter(); @@ -203,25 +209,25 @@ QTextCursor *QTextDeleteCommand::execute( QTextCursor *c ) *c = cursor; } else { s->remove( index, len ); } return c; } QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c ) { QTextParagraph *s = doc ? doc->paragAt( id ) : parag; if ( !s ) { - qWarning( "can't locate parag at %d, last parag: %d", id, doc->lastParagraph()->paragId() ); + owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl; return 0; } cursor.setParagraph( s ); cursor.setIndex( index ); QString str = QTextString::toString( text ); cursor.insert( str, TRUE, &text ); cursor.setParagraph( s ); cursor.setIndex( index ); if ( c ) { c->setParagraph( s ); c->setIndex( index ); @@ -1535,28 +1541,28 @@ void QTextDocument::setRichTextInternal( const QString &text, QTextCursor* curso curpar->setAlignment( curtag.alignment ); custom = parseTable( attr, format, doc, length, pos, curpar ); } else if ( tagname == "qt" || tagname == "body" ) { if ( attr.contains( "bgcolor" ) ) { QBrush *b = new QBrush( QColor( attr["bgcolor"] ) ); setPaper( b ); } if ( attr.contains( "background" ) ) { QImage img; QString bg = attr["background"]; const QMimeSource* m = factory_->data( bg, contxt ); if ( !m ) { - qWarning("QRichText: no mimesource for %s", bg.latin1() ); + owarn << "QRichText: no mimesource for " << bg.latin1() << "" << oendl; } else { if ( !QImageDrag::decode( m, img ) ) { - qWarning("QTextImage: cannot decode %s", bg.latin1() ); + owarn << "QTextImage: cannot decode " << bg.latin1() << "" << oendl; } } if ( !img.isNull() ) { QPixmap pm; pm.convertFromImage( img ); QBrush *b = new QBrush( QColor(), pm ); setPaper( b ); } } if ( attr.contains( "text" ) ) { QColor c( attr["text"] ); if ( formatCollection()->defaultFormat()->color() != c ) { @@ -2143,25 +2149,25 @@ QString QTextDocument::richText() const s += QString::number( formatCollection()->defaultFormat()->font().pointSize() ); s += "pt;font-family:"; s += formatCollection()->defaultFormat()->font().family(); s +="\">"; } QTextParagraph* p = fParag; QStyleSheetItem* item_p = styleSheet()->item("p"); QStyleSheetItem* item_ul = styleSheet()->item("ul"); QStyleSheetItem* item_ol = styleSheet()->item("ol"); QStyleSheetItem* item_li = styleSheet()->item("li"); if ( !item_p || !item_ul || !item_ol || !item_li ) { - qWarning( "QTextEdit: cannot export HTML due to insufficient stylesheet (lack of p, ul, ol, or li)" ); + owarn << "QTextEdit: cannot export HTML due to insufficient stylesheet (lack of p, ul, ol, or li)" << oendl; return QString::null; } int pastListDepth = 0; int listDepth = 0; int futureListDepth = 0; QMemArray<int> listStyles(10); while ( p ) { listDepth = p->listDepth(); if ( listDepth < pastListDepth ) { for ( int i = listDepth+1; i <= pastListDepth; i++ ) s += list_is_ordered( listStyles[i] ) ? "</ol>" : "</ul>"; @@ -4087,25 +4093,25 @@ int QTextParagraph::lineHeightOfChar( int i, int *bl, int *y ) const if ( i >= it.key() ) { if ( bl ) *bl = ( *it )->baseLine; if ( y ) *y = ( *it )->y; return ( *it )->h; } if ( it == lineStarts.begin() ) break; --it; } - qWarning( "QTextParagraph::lineHeightOfChar: couldn't find lh for %d", i ); + owarn << "QTextParagraph::lineHeightOfChar: couldn't find lh for " << i << "" << oendl; return 15; } QTextStringChar *QTextParagraph::lineStartOfChar( int i, int *index, int *line ) const { if ( !isValid() ) ( (QTextParagraph*)this )->format(); int l = (int)lineStarts.count() - 1; QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.end(); --it; for ( ;; ) { @@ -4113,25 +4119,25 @@ QTextStringChar *QTextParagraph::lineStartOfChar( int i, int *index, int *line ) if ( index ) *index = it.key(); if ( line ) *line = l; return &str->at( it.key() ); } if ( it == lineStarts.begin() ) break; --it; --l; } - qWarning( "QTextParagraph::lineStartOfChar: couldn't find %d", i ); + owarn << "QTextParagraph::lineStartOfChar: couldn't find " << i << "" << oendl; return 0; } int QTextParagraph::lines() const { if ( !isValid() ) ( (QTextParagraph*)this )->format(); return (int)lineStarts.count(); } QTextStringChar *QTextParagraph::lineStartOfLine( int line, int *index ) const @@ -4140,25 +4146,25 @@ QTextStringChar *QTextParagraph::lineStartOfLine( int line, int *index ) const ( (QTextParagraph*)this )->format(); if ( line >= 0 && line < (int)lineStarts.count() ) { QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin(); while ( line-- > 0 ) ++it; int i = it.key(); if ( index ) *index = i; return &str->at( i ); } - qWarning( "QTextParagraph::lineStartOfLine: couldn't find %d", line ); + owarn << "QTextParagraph::lineStartOfLine: couldn't find " << line << "" << oendl; return 0; } int QTextParagraph::leftGap() const { if ( !isValid() ) ( (QTextParagraph*)this )->format(); int line = 0; int x = str->at(0).x; /* set x to x of first char */ if ( str->isBidi() ) { for ( int i = 1; i < str->length()-1; ++i ) @@ -5688,25 +5694,25 @@ QTextFormat *QTextFormatCollection::format( const QFont &f, const QColor &c ) if ( cachedFormat ) { cachedFormat->addRef(); return cachedFormat; } if ( key == defFormat->key() ) return defFormat; cachedFormat = createFormat( f, c ); cachedFormat->collection = this; cKey.insert( cachedFormat->key(), cachedFormat ); if ( cachedFormat->key() != key ) - qWarning("ASSERT: keys for format not identical: '%s '%s'", cachedFormat->key().latin1(), key.latin1() ); + owarn << "ASSERT: keys for format not identical: '" << cachedFormat->key().latin1() << " '" << key.latin1() << "'" << oendl; return cachedFormat; } void QTextFormatCollection::remove( QTextFormat *f ) { if ( lastFormat == f ) lastFormat = 0; if ( cres == f ) cres = 0; if ( cachedFormat == f ) cachedFormat = 0; cKey.remove( f->key() ); @@ -6074,29 +6080,29 @@ QTextImage::QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, co pixmap_map = new QMap<QString, QPixmapInt>; if ( pixmap_map->contains( imgId ) ) { QPixmapInt& pmi = pixmap_map->operator[](imgId); pm = pmi.pm; pmi.ref++; width = pm.width(); height = pm.height(); } else { QImage img; const QMimeSource* m = factory.data( imageName, context ); if ( !m ) { - qWarning("QTextImage: no mimesource for %s", imageName.latin1() ); + owarn << "QTextImage: no mimesource for " << imageName.latin1() << "" << oendl; } else { if ( !QImageDrag::decode( m, img ) ) { - qWarning("QTextImage: cannot decode %s", imageName.latin1() ); + owarn << "QTextImage: cannot decode " << imageName.latin1() << "" << oendl; } } if ( !img.isNull() ) { if ( width == 0 ) { width = img.width(); if ( height != 0 ) { width = img.width() * height / img.height(); } } if ( height == 0 ) { height = img.height(); diff --git a/noncore/apps/opie-write/qrichtext_p.cpp b/noncore/apps/opie-write/qrichtext_p.cpp index 6783e0b..2e8b09c 100644 --- a/noncore/apps/opie-write/qrichtext_p.cpp +++ b/noncore/apps/opie-write/qrichtext_p.cpp @@ -26,24 +26,27 @@ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for ** information about Qt Commercial License Agreements. ** See http://www.trolltech.com/qpl/ for QPL licensing information. ** 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 <opie2/odebug.h> +using namespace Opie::Core; + #include "qrichtext_p.h" using namespace Qt3; QTextCommand::~QTextCommand() {} QTextCommand::Commands QTextCommand::type() const { return Invalid; } QTextCustomItem::~QTextCustomItem() {} void QTextCustomItem::adjustToPainter( QPainter* p){ if ( p ) width = 0; } QTextCustomItem::Placement QTextCustomItem::placement() const { return PlaceInline; } @@ -128,25 +131,25 @@ QTextDocument *QTextCursor::document() const } void QTextCursor::gotoPosition( QTextParagraph* p, int index ) { if ( para && p != para ) { while ( para->document() != p->document() && !indices.isEmpty() ) pop(); Q_ASSERT( indices.isEmpty() || para->document() == p->document() ); } para = p; if ( index < 0 || index >= para->length() ) { #if defined(QT_CHECK_RANGE) - qWarning( "QTextCursor::gotoParagraph Index: %d out of range", index ); + owarn << "QTextCursor::gotoParagraph Index: " << index << " out of range" << oendl; #endif index = index < 0 ? 0 : para->length() - 1; } tmpIndex = -1; idx = index; } bool QTextDocument::hasSelection( int id, bool visible ) const { return ( selections.find( id ) != selections.end() && ( !visible || @@ -468,74 +471,74 @@ bool QTextParagraph::fullSelected( int id ) const { if ( !mSelections ) return FALSE; QMap<int, QTextParagraphSelection>::ConstIterator it = mSelections->find( id ); if ( it == mSelections->end() ) return FALSE; return ( *it ).start == 0 && ( *it ).end == str->length() - 1; } int QTextParagraph::lineY( int l ) const { if ( l > (int)lineStarts.count() - 1 ) { - qWarning( "QTextParagraph::lineY: line %d out of range!", l ); + owarn << "QTextParagraph::lineY: line " << l << " out of range!" << oendl; return 0; } if ( !isValid() ) ( (QTextParagraph*)this )->format(); QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin(); while ( l-- > 0 ) ++it; return ( *it )->y; } int QTextParagraph::lineBaseLine( int l ) const { if ( l > (int)lineStarts.count() - 1 ) { - qWarning( "QTextParagraph::lineBaseLine: line %d out of range!", l ); + owarn << "QTextParagraph::lineBaseLine: line " << l << " out of range!" << oendl; return 10; } if ( !isValid() ) ( (QTextParagraph*)this )->format(); QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin(); while ( l-- > 0 ) ++it; return ( *it )->baseLine; } int QTextParagraph::lineHeight( int l ) const { if ( l > (int)lineStarts.count() - 1 ) { - qWarning( "QTextParagraph::lineHeight: line %d out of range!", l ); + owarn << "QTextParagraph::lineHeight: line " << l << " out of range!" << oendl; return 15; } if ( !isValid() ) ( (QTextParagraph*)this )->format(); QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin(); while ( l-- > 0 ) ++it; return ( *it )->h; } void QTextParagraph::lineInfo( int l, int &y, int &h, int &bl ) const { if ( l > (int)lineStarts.count() - 1 ) { - qWarning( "QTextParagraph::lineInfo: line %d out of range!", l ); - qDebug( "%d %d", (int)lineStarts.count() - 1, l ); + owarn << "QTextParagraph::lineInfo: line " << l << " out of range!" << oendl; + odebug << "" << (int)lineStarts.count() - 1 << " " << l << "" << oendl; y = 0; h = 15; bl = 10; return; } if ( !isValid() ) ( (QTextParagraph*)this )->format(); QMap<int, QTextLineStart*>::ConstIterator it = lineStarts.begin(); while ( l-- > 0 ) ++it; diff --git a/noncore/apps/qashmoney/accountdisplay.cpp b/noncore/apps/qashmoney/accountdisplay.cpp index 0fe5b09..046d997 100755 --- a/noncore/apps/qashmoney/accountdisplay.cpp +++ b/noncore/apps/qashmoney/accountdisplay.cpp @@ -1,21 +1,26 @@ -#include <qmessagebox.h> -#include <qheader.h> - #include "accountdisplay.h" #include "newaccount.h" #include "transaction.h" #include "transferdialog.h" #include "transfer.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ +#include <qmessagebox.h> +#include <qheader.h> + extern Account *account; extern Transaction *transaction; extern Transfer *transfer; extern Preferences *preferences; AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) { cleared = 0; firstline = new QHBox ( this ); firstline->setSpacing ( 2 ); @@ -258,25 +263,25 @@ void AccountDisplay::getTransferAccounts ( QListViewItem * item ) // enter today's date in the date box as default QDate today = QDate::currentDate (); int defaultday = today.day(); int defaultmonth = today.month(); int defaultyear = today.year(); td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); if ( td->exec() == QDialog::Accepted ) { // set the cleared integer if the checkbox is checked if ( td->clearedcheckbox->isChecked() == TRUE ) cleared = 1; - qDebug("Year from transferdialog = %i",td->getYear()); + odebug << "Year from transferdialog = " << td->getYear() << "" << oendl; // add the transfer with a new date if its been edited or use the default date if ( td->getDateEdited () == TRUE ) transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared ); else transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared ); // update account balances of both accounts and parents if necessary account->updateAccountBalance ( firstaccountid ); if ( account->getParentAccountID ( firstaccountid ) != -1 ) account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) ); account->updateAccountBalance ( secondaccountid ); if ( account->getParentAccountID ( secondaccountid ) != -1 ) diff --git a/noncore/apps/qashmoney/config.in b/noncore/apps/qashmoney/config.in index 91739fe..aeed298 100644 --- a/noncore/apps/qashmoney/config.in +++ b/noncore/apps/qashmoney/config.in @@ -1,4 +1,4 @@ config QASHMONEY boolean "opie-qashmoney (money manager)" default "n" - depends ( LIBQPE || LIBQPE-X11 ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE diff --git a/noncore/apps/qashmoney/qashmoney.pro b/noncore/apps/qashmoney/qashmoney.pro index 6ad3db3..8a4302f 100755 --- a/noncore/apps/qashmoney/qashmoney.pro +++ b/noncore/apps/qashmoney/qashmoney.pro @@ -34,16 +34,16 @@ SOURCES = qashmoney.cpp \ calculator.cpp \ datepicker.cpp \ main.cpp \ budget.cpp \ budgetdisplay.cpp \ currency.cpp INCLUDEPATH = $(OPIEDIR)/include DEPENDPATH = $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/bin unix:LIBS += -lm -LIBS += -lqpe -lqte -lsqlite +LIBS += -lqpe -lopiecore2 -lsqlite include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp index dbf9370..6e544ba 100644 --- a/noncore/apps/tableviewer/db/common.cpp +++ b/noncore/apps/tableviewer/db/common.cpp @@ -8,33 +8,41 @@ ** 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 <stdlib.h> +#include "common.h" +#include "datacache.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/timestring.h> +using namespace Opie::Core; + +/* QT */ #include <qstring.h> #include <qheader.h> #include <qvector.h> #include <qdatetime.h> -#include <qpe/timestring.h> -#include "common.h" -#include "datacache.h" + +/* STD */ #include <assert.h> +#include <stdlib.h> static const int del_flag = 0x1; static const int new_flag = 0x2; /* Helper function */ int parseNextNumber(QString *q) { QChar c; uint i; int result = 0; bool found_digits = FALSE; @@ -303,25 +311,25 @@ void TVVariant::load(QDataStream &s ) s >> *x; d->value.ptr = x; } break; case Int: { int x; s >> x; d->value.i = x; } break; default: - qFatal("Unrecognized data type"); + ofatal << "Unrecognized data type" << oendl; } } void TVVariant::save( QDataStream &s ) const { s << type(); switch( d->typ ) { case String: s << *((QString *)d->value.ptr); break; case Date: @@ -1069,25 +1077,25 @@ QDataStream &operator<<( QDataStream &s, const DataElem &d) return s; } QDataStream &operator>>( QDataStream &s, DataElem &d) { int i; int size; TVVariant t; int index = 0; s >> size; /* redundent data but makes streaming easier */ if (size != d.getNumFields()) { - qWarning("DataSize mis-match"); + owarn << "DataSize mis-match" << oendl; return s; /* sanity check failed.. don't load */ } for(i = 0; i < size; i++) { s >> (Q_UINT16)index; s >> t; d.setField(index, t); } return s; } /*! Returns the number of possible (not valid) fields in the data element */ @@ -1368,25 +1376,25 @@ bool DataElem::contains(int i, TVVariant v) const QString qs2 = v.toString().lower(); if (qs1.contains(qs2) > 0) return TRUE; break; } /* meaningless for ints */ /* meaningless for time */ /* meaningless for dates */ case TVVariant::Int: case TVVariant::Time: case TVVariant::Date: break; default: - qWarning("Tried to compare unknown data type"); + owarn << "Tried to compare unknown data type" << oendl; } return FALSE; } bool DataElem::startsWith(int i, TVVariant v) const { if (!hasValidValue(i)) return FALSE; if (getField(i).type() != v.type()) return FALSE; switch(getField(i).type()) { @@ -1394,25 +1402,25 @@ bool DataElem::startsWith(int i, TVVariant v) const QString qs1 = getField(i).toString().lower(); QString qs2 = v.toString().lower(); return qs1.startsWith(qs2); } /* meaningless for ints */ /* meaningless for time */ /* meaningless for dates */ case TVVariant::Int: case TVVariant::Time: case TVVariant::Date: return FALSE; default: - qWarning("Tried to compare unknown data type"); + owarn << "Tried to compare unknown data type" << oendl; } return FALSE; } bool DataElem::endsWith(int i, TVVariant v) const { if (!hasValidValue(i)) return FALSE; if (getField(i).type() != v.type()) return FALSE; switch(getField(i).type()) { @@ -1420,25 +1428,25 @@ bool DataElem::endsWith(int i, TVVariant v) const QString qs1 = getField(i).toString().lower(); QString qs2 = v.toString().lower(); return qs1.startsWith(qs2); } /* meaningless for ints */ /* meaningless for time */ /* meaningless for dates */ case TVVariant::Int: case TVVariant::Time: case TVVariant::Date: return FALSE; default: - qWarning("Tried to compare unknown data type"); + owarn << "Tried to compare unknown data type" << oendl; } return FALSE; } /*! Determins which of the first to parameters are closer to the third, target parameter. \return <UL> <LI>TRUE if the first element is a closer match to the target than the second element</LI> @@ -1452,19 +1460,19 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column) if(!d1) return FALSE; if (!d1->hasValidValue(column)) return FALSE; if(!target.isValid()) return FALSE; type = d1->getField(column).type(); if(d2) { if (type != d2->getField(column).type()) { /* can't do compare */ - qWarning("Tried to compare two incompatable types"); + owarn << "Tried to compare two incompatable types" << oendl; return FALSE; } return target.closer(d1->getField(column), d2->getField(column)); } return target.close(d1->getField(column)); } diff --git a/noncore/apps/tableviewer/db/datacache.cpp b/noncore/apps/tableviewer/db/datacache.cpp index 7c14eef..6380e1b 100644 --- a/noncore/apps/tableviewer/db/datacache.cpp +++ b/noncore/apps/tableviewer/db/datacache.cpp @@ -17,27 +17,35 @@ ** not clear to you. ** **********************************************************************/ /* * This file is used to load the xml files that represent the database. * The main requirment for said file is each data entry must contain a key, * otherwise any other data headings are allowed. */ #include "datacache.h" #include "xmlsource.h" #include "csvsource.h" -#include <stdlib.h> + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qheader.h> +/* STD */ +#include <stdlib.h> + #define INIT_TABLE_SIZE 128 /*! \class DBStore datastore.h \brief The DBStore class is the class responsible for storing, sorting and searching the data loaded by the application */ /*! Constructs a DBStore item @@ -141,25 +149,25 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source) \param delm An already allocated and initialized data element to be added */ void DBStore::addItem(DataElem *delem) { addItemInternal(delem); } void DBStore::addItemInternal(DataElem *delem) { /* if already full, don't over fill, do a qWarning though */ if (full) { - qWarning("Attempted to add items to already full table"); + owarn << "Attempted to add items to already full table" << oendl; return; } master_table.insert(number_elems, delem); current_elem = number_elems; number_elems++; if(number_elems >= table_size) { /* filled current table, double if we can */ table_size = table_size << 1; diff --git a/noncore/apps/tableviewer/db/xmlsource.cpp b/noncore/apps/tableviewer/db/xmlsource.cpp index 94fec36..4ca6aee 100644 --- a/noncore/apps/tableviewer/db/xmlsource.cpp +++ b/noncore/apps/tableviewer/db/xmlsource.cpp @@ -9,30 +9,36 @@ ** 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 "xmlsource.h" -#include <qdict.h> -#include <stdlib.h> -#include <qtextstream.h> #include "../xmlencodeattr.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; +/* QT */ +#include <qdict.h> +#include <qtextstream.h> + +/* STD */ +#include <stdlib.h> DBXml::DBXml(DBStore *d) { dstore = d; } QString DBXml::type() { return "xml"; } bool DBXml::openSource(QIODevice *inDev) @@ -131,25 +137,25 @@ DBXmlHandler::DBXmlHandler(DBStore *ds) current_keyrep = 0; } /*! Destroys the DBXmlHandler */ DBXmlHandler::~DBXmlHandler() { } QString DBXmlHandler::errorProtocol() { - qWarning("Error reading file"); + owarn << "Error reading file" << oendl; return errorProt; } bool DBXmlHandler::startDocument() { errorProt = ""; state = StateInit; return TRUE; } bool DBXmlHandler::startElement(const QString&, const QString&, const QString& qName, const QXmlAttributes& atts) @@ -163,49 +169,49 @@ bool DBXmlHandler::startElement(const QString&, const QString&, if (state == StateDocument && qName == "header") { state = StateHeader; if (current_keyrep) delete current_keyrep; current_keyrep = new KeyList(); return TRUE; } if (state == StateHeader && qName == "key") { /* Ok, adding a new key to our KeyList TODO */ state = StateKey; last_key_type = TVVariant::String; key = atts.value("name"); if (key.isEmpty()) { - qWarning("empty key name"); + owarn << "empty key name" << oendl; return FALSE; } if(!atts.value("type").isEmpty()) last_key_type = TVVariant::nameToType(atts.value("type")); return TRUE; } if (state == StateDocument && qName == "record") { state = StateRecord; current_data = new DataElem(data_store); // Now expecting a <record> tag return TRUE; } if (state == StateRecord) { state = StateField; /* the qName is the name of a key */ if (!keyIndexList[qName]) { /* invalid key, we failed */ - qWarning("Invalid key in record"); + owarn << "Invalid key in record" << oendl; return FALSE; } keyIndex = *keyIndexList[qName]; return TRUE; } - qWarning("Unable to determine tag type"); + owarn << "Unable to determine tag type" << oendl; return FALSE; } bool DBXmlHandler::endElement(const QString&, const QString&, const QString& qName) { switch(state) { case StateField: // TODO checks 'could' be done of the popped value state = StateRecord; break; case StateKey: @@ -216,25 +222,25 @@ bool DBXmlHandler::endElement(const QString&, const QString&, data_store->setKeys(current_keyrep); state = StateDocument; break; case StateRecord: data_store->addItem(current_data); state = StateDocument; break; case StateDocument: // we are done... break; default: // should only get a 'endElement' from one of the above states. - qWarning("Invalid end tag"); + owarn << "Invalid end tag" << oendl; return FALSE; break; } return TRUE; } bool DBXmlHandler::characters(const QString& ch) { // this is where the 'between tag' stuff happens. // e.g. the stuff between tags. QString ch_simplified = ch.simplifyWhiteSpace(); @@ -245,53 +251,53 @@ bool DBXmlHandler::characters(const QString& ch) int *tmp_val = new int; /* We just grabbed the display name of a key */ *tmp_val = current_keyrep->addKey(ch_simplified, last_key_type); keyIndexList.insert(key, tmp_val); return TRUE; } if (state == StateField) { /* Ok, need to add data here */ current_data->setField(keyIndex, ch_simplified); return TRUE; } - qWarning("Junk characters found... ignored"); + owarn << "Junk characters found... ignored" << oendl; return TRUE; } QString DBXmlHandler::errorString() { return "the document is not in the expected file format"; } bool DBXmlHandler::warning(const QXmlParseException& exception) { errorProt += QString("warning parsing error: %1 in line %2, column %3\n" ) .arg(exception.message()) .arg(exception.lineNumber()) .arg(exception.columnNumber()); - qWarning(errorProt); + owarn << errorProt << oendl; return QXmlDefaultHandler::fatalError(exception); } bool DBXmlHandler::error(const QXmlParseException& exception) { errorProt += QString("error parsing error: %1 in line %2, column %3\n" ) .arg(exception.message()) .arg(exception.lineNumber()) .arg(exception.columnNumber()); - qWarning(errorProt); + owarn << errorProt << oendl; return QXmlDefaultHandler::fatalError(exception); } bool DBXmlHandler::fatalError(const QXmlParseException& exception) { errorProt += QString("fatal parsing error: %1 in line %2, column %3\n" ) .arg(exception.message()) .arg(exception.lineNumber()) .arg(exception.columnNumber()); - qWarning(errorProt); + owarn << errorProt << oendl; return QXmlDefaultHandler::fatalError(exception); } diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp index 102b94c..9538cb3 100644 --- a/noncore/apps/tableviewer/tableviewer.cpp +++ b/noncore/apps/tableviewer/tableviewer.cpp @@ -9,45 +9,47 @@ ** 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. ** **********************************************************************/ -/* local includes */ #include "tableviewer.h" #include "ui/tvbrowseview.h" #include "ui/tvfilterview.h" #include "ui/tvlistview.h" #include "ui/tveditview.h" #include "ui/tvkeyedit.h" #include "db/datacache.h" -/* QPE includes */ +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/fileselector.h> #include <qpe/resource.h> -#include <qtoolbar.h> +using namespace Opie::Core; -/* QTE includes */ +/* QT */ #include <qmenubar.h> +#include <qtoolbar.h> #include <qpopupmenu.h> #include <qapplication.h> #include <qwidgetstack.h> #include <qlayout.h> #include <qbuffer.h> + /*! \class TableViewerWindow \brief The main window widget of the application This is the main widget of the table viewer application. It is the co-ordination point. */ /*! Constructs a new TableViewerWindow */ TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f) @@ -192,25 +194,25 @@ void TableViewerWindow::selectDocument() fileSelector->reread(); } void TableViewerWindow::saveDocument() { if(!dirty) return; FileManager fm; QIODevice *dev = fm.saveFile(doc); if(!ds->saveSource(dev, doc.type())){ - qWarning("Save unsuccessful"); + owarn << "Save unsuccessful" << oendl; return; } dev->close(); dirty = FALSE; } void TableViewerWindow::newDocument() { DocLnk nf; nf.setType("text/x-xml-tableviewer"); nf.setName("table"); @@ -279,25 +281,25 @@ void TableViewerWindow::openDocument(const DocLnk &f) listView->first(); ts.current_elem = listView->getCurrentData(); browseView->rebuildData(); listView->rebuildData(); QString scratch = "Table Viewer";/* later take from constant */ scratch += " - "; scratch += ds->getName(); setCaption(tr(scratch)); dirty = FALSE; } else { - qWarning(tr("could not load Document")); + owarn << tr("could not load Document") << oendl; } dev->close(); } /*! Moves to the first item of the current table */ void TableViewerWindow::firstItem() { listView->first(); ts.current_elem = listView->getCurrentData(); browseView->rebuildData(); diff --git a/noncore/apps/tableviewer/tableviewer.pro b/noncore/apps/tableviewer/tableviewer.pro index 1de23bb..564f50f 100644 --- a/noncore/apps/tableviewer/tableviewer.pro +++ b/noncore/apps/tableviewer/tableviewer.pro @@ -1,13 +1,13 @@ -CONFIG = qt warn_on quick-app +CONFIG = qt warn_on quick-app SUBDIRS = db ui HEADERS = tableviewer.h \ xmlencodeattr.h \ ui/commonwidgets.h \ ui/tvbrowseview.h \ ui/tvlistview.h \ ui/tvfilterview.h \ ui/tveditview.h \ ui/browsekeyentry.h \ ui/filterkeyentry.h \ ui/tvkeyedit.h \ db/datacache.h \ @@ -22,17 +22,17 @@ SOURCES = main.cpp \ ui/tvfilterview.cpp \ ui/browsekeyentry.cpp \ ui/filterkeyentry.cpp \ ui/tvlistview.cpp \ ui/tveditview.cpp \ ui/tvkeyedit.cpp \ db/datacache.cpp \ db/xmlsource.cpp \ db/csvsource.cpp \ db/common.cpp INTERFACES = ui/tvkeyedit_gen.ui TARGET = tableviewer -INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopiecore2 +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe -lopiecore2 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/tableviewer/ui/tvlistview.cpp b/noncore/apps/tableviewer/ui/tvlistview.cpp index b10ff1d..c3e6432 100644 --- a/noncore/apps/tableviewer/ui/tvlistview.cpp +++ b/noncore/apps/tableviewer/ui/tvlistview.cpp @@ -8,26 +8,33 @@ ** 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 "tvlistview.h" #include "../db/common.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qtoolbutton.h> #include <qlistview.h> #include <qlayout.h> void TVListViewPrivate::setColumnWidth(int column, int width) { if(width > 70) width = 70; QListView::setColumnWidth(column, width); } void TVListViewPrivate::setSorting(int column, bool increasing) { @@ -154,25 +161,25 @@ void TVListView::clearItems() delete it; it = new QListViewItemIterator(listViewDisplay); } void TVListView::first() { delete it; it = new QListViewItemIterator(listViewDisplay); } void TVListView::last() { - qWarning("TVListView::last not yet implemented"); + owarn << "TVListView::last not yet implemented" << oendl; } void TVListView::next() { QListViewItemIterator tmp = *it; (*it)++; if (!it->current()) { *it = tmp; } } void TVListView::previous() diff --git a/noncore/apps/tinykate/libkate/libkate.pro b/noncore/apps/tinykate/libkate/libkate.pro index 11ee275..1552dff 100644 --- a/noncore/apps/tinykate/libkate/libkate.pro +++ b/noncore/apps/tinykate/libkate/libkate.pro @@ -1,90 +1,87 @@ TEMPLATE = lib -CONFIG = qt warn_on -HEADERS = microkde/kapplication.h \ - kateconfig.h \ - microkde/kdebug.h \ - microkde/kdialog.h \ - microkde/kdialogbase.h \ - microkde/kfiledialog.h \ - microkde/kglobal.h \ - microkde/kiconloader.h \ - microkde/klineedit.h \ - microkde/klocale.h \ - microkde/kmessagebox.h \ - microkde/kprinter.h \ - microkde/krestrictedline.h \ - microkde/kseparator.h \ - microkde/kstandarddirs.h \ - microkde/ktempfile.h \ - microkde/kunload.h \ - microkde/kurlrequester.h \ - microkde/kfontdialog.h \ - microkde/krun.h \ - microkde/knumvalidator.h \ - microkde/kstaticdeleter.h \ - microkde/klistview.h \ - microkde/kglobalsettings.h \ - microkde/kcolorbtn.h \ - \ +CONFIG = qt warn_on +HEADERS = microkde/kapplication.h \ + kateconfig.h \ + microkde/kdebug.h \ + microkde/kdialog.h \ + microkde/kdialogbase.h \ + microkde/kfiledialog.h \ + microkde/kglobal.h \ + microkde/kiconloader.h \ + microkde/klineedit.h \ + microkde/klocale.h \ + microkde/kmessagebox.h \ + microkde/kprinter.h \ + microkde/krestrictedline.h \ + microkde/kseparator.h \ + microkde/kstandarddirs.h \ + microkde/ktempfile.h \ + microkde/kunload.h \ + microkde/kurlrequester.h \ + microkde/kfontdialog.h \ + microkde/krun.h \ + microkde/knumvalidator.h \ + microkde/kstaticdeleter.h \ + microkde/klistview.h \ + microkde/kglobalsettings.h \ + microkde/kcolorbtn.h \ \ - qt3back/qregexp3.h \ - microkde/ksharedptr.h \ - document/katebuffer.h document/katedialogs.h \ - document/katetextline.h \ - document/katecmd.h \ - document/katehighlight.h \ - document/katecmds.h document/katedocument.h \ - document/katesyntaxdocument.h \ - view/kateundohistory.h \ - view/kateview.h \ - view/kateviewdialog.h \ - interfaces/view.h \ - interfaces/document.h \ - ktexteditor/ktexteditor.h + qt3back/qregexp3.h \ + microkde/ksharedptr.h \ + document/katebuffer.h document/katedialogs.h \ + document/katetextline.h \ + document/katecmd.h \ + document/katehighlight.h \ + document/katecmds.h document/katedocument.h \ + document/katesyntaxdocument.h \ + view/kateundohistory.h \ + view/kateview.h \ + view/kateviewdialog.h \ + interfaces/view.h \ + interfaces/document.h \ + ktexteditor/ktexteditor.h -SOURCES = microkde/kapplication.cpp \ - microkde/kdialogbase.cpp \ - kateconfig.cpp \ - microkde/klocale.cpp \ - microkde/kmessagebox.cpp \ - microkde/kprocess.cpp \ - microkde/kstandarddirs.cpp \ - microkde/ktempfile.cpp \ - microkde/kurlrequester.cpp \ - microkde/kfontdialog.cpp \ - microkde/krun.cpp \ - microkde/knumvalidator.cpp \ - microkde/kglobal.cpp \ - microkde/kglobalsettings.cpp \ - microkde/kcolorbtn.cpp \ - \ - \ - qt3back/qregexp3.cpp \ - ktexteditor/ktexteditor.cpp \ - document/katebuffer.cpp document/katedialogs.cpp \ - document/katehighlight.cpp \ - document/katecmd.cpp \ - document/katesyntaxdocument.cpp document/katecmds.cpp \ - document/katedocument.cpp document/katetextline.cpp \ - view/kateundohistory.cpp \ - view/kateview.cpp \ - view/kateviewdialog.cpp \ - interfaces/interfaces.cpp - -INTERFACES = -INCLUDEPATH += $(OPIEDIR)/include \ +SOURCES = microkde/kapplication.cpp \ + microkde/kdialogbase.cpp \ + kateconfig.cpp \ + microkde/klocale.cpp \ + microkde/kmessagebox.cpp \ + microkde/kprocess.cpp \ + microkde/kstandarddirs.cpp \ + microkde/ktempfile.cpp \ + microkde/kurlrequester.cpp \ + microkde/kfontdialog.cpp \ + microkde/krun.cpp \ + microkde/knumvalidator.cpp \ + microkde/kglobal.cpp \ + microkde/kglobalsettings.cpp \ + microkde/kcolorbtn.cpp \ + \ + qt3back/qregexp3.cpp \ + ktexteditor/ktexteditor.cpp \ + document/katebuffer.cpp document/katedialogs.cpp \ + document/katehighlight.cpp \ + document/katecmd.cpp \ + document/katesyntaxdocument.cpp document/katecmds.cpp \ + document/katedocument.cpp document/katetextline.cpp \ + view/kateundohistory.cpp \ + view/kateview.cpp \ + view/kateviewdialog.cpp \ + interfaces/interfaces.cpp +INTERFACES = +INCLUDEPATH += $(OPIEDIR)/include \ $(OPIEDIR)/noncore/apps/tinykate/libkate \ $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lqtaux2 -lopiecore2 -lopieui2 -TARGET = tinykate +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe -lqtaux2 -lopiecore2 -lopieui2 +TARGET = tinykate INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/lib$(PROJMAK) include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/tinykate/tinykate.pro b/noncore/apps/tinykate/tinykate.pro index 6f4baa8..d34e519 100644 --- a/noncore/apps/tinykate/tinykate.pro +++ b/noncore/apps/tinykate/tinykate.pro @@ -1,22 +1,20 @@ -TEMPLATE = app -CONFIG = qt warn_on quick-app +TEMPLATE = app +CONFIG = qt warn_on quick-app DESTDIR = $(OPIEDIR)/bin HEADERS = tinykate.h SOURCES = tinykate.cpp main.cpp -INTERFACES = INCLUDEPATH += $(OPIEDIR)/include \ - $(OPIEDIR)/noncore/apps/tinykate/libkate \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back - -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -ltinykate -lopiecore2 -lopieui2 -TARGET = kate + $(OPIEDIR)/noncore/apps/tinykate/libkate \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe -ltinykate -lopiecore2 -lopieui2 +TARGET = kate include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/zsafe/config.in b/noncore/apps/zsafe/config.in index 6e321f3..b6d3ffe 100644 --- a/noncore/apps/zsafe/config.in +++ b/noncore/apps/zsafe/config.in @@ -1,5 +1,5 @@ config ZSAFE boolean "zsafe (Zaurus Password Manager)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI diff --git a/noncore/apps/zsafe/scqtfiledlg.cpp b/noncore/apps/zsafe/scqtfiledlg.cpp index 52b8d0d..c67bbd5 100644 --- a/noncore/apps/zsafe/scqtfiledlg.cpp +++ b/noncore/apps/zsafe/scqtfiledlg.cpp @@ -1,22 +1,19 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'scqtfiledlg.ui' -** -** Created: Sun Jun 8 15:51:12 2003 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ #include "scqtfiledlg.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qcombobox.h> #include <qlineedit.h> #include <qlistview.h> #include <qtoolbutton.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> static const char* const image0_data[] = { "24 16 3 1", ". c None", "# c #000040", @@ -207,50 +204,50 @@ ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags } /* * Destroys the object and frees any allocated resources */ ScQtFileDlg::~ScQtFileDlg() { // no need to delete child widgets, Qt does it all for us } void ScQtFileDlg::slotCancel() { - qWarning( "ScQtFileDlg::slotCancel(): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotCancel(): Not implemented yet!" << oendl; } void ScQtFileDlg::slotDirComboBoxChanged( int ) { - qWarning( "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" << oendl; } void ScQtFileDlg::slotDoubleClicked(QListViewItem *) { - qWarning( "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" << oendl; } void ScQtFileDlg::slotFileTextChanged( const QString & ) { - qWarning( "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" << oendl; } void ScQtFileDlg::slotMkDir() { - qWarning( "ScQtFileDlg::slotMkDir(): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotMkDir(): Not implemented yet!" << oendl; } void ScQtFileDlg::slotOK() { - qWarning( "ScQtFileDlg::slotOK(): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotOK(): Not implemented yet!" << oendl; } void ScQtFileDlg::slotSelectionChanged(QListViewItem *) { - qWarning( "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" << oendl; } void ScQtFileDlg::slotTypeComboBoxChanged( int ) { - qWarning( "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" << oendl; } diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 3df55eb..bf8f7f4 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -20,35 +20,34 @@ #include "zsafe.h" #include "newdialog.h" #include "searchdialog.h" #include "categorydialog.h" #include "passworddialog.h" #include "infoform.h" #include "zlistview.h" #include "shadedlistitem.h" #ifndef DESKTOP #ifndef NO_OPIE #include <opie2/ofiledialog.h> - +#include <opie2/odebug.h> +using namespace Opie::Core; using namespace Opie::Ui; #else #include "scqtfileedit.h" #endif #endif #include <qclipboard.h> -#include <stdio.h> - #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #ifndef WIN32 #include <unistd.h> #endif #include <string.h> #include <errno.h> #include <qmenubar.h> #include <qpopupmenu.h> @@ -2060,45 +2059,43 @@ int ZSafe::loadInit(const char* _filename, const char *password) return PWERR_OPEN; buffer = (char *)malloc(load_buffer_length); for (j = 0; password[j] != '\0'; j++) { key[j] = password[j]; } keylength = j; krc2->rc2_expandkey (key, keylength, 128); #ifndef WIN32 size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); #else - printf ("LoadInit() read1"); size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); #endif if (size < 8) return PWERR_DATA; for (count = 0; count < 4; count++) { count2 = count << 1; iv[count] = charbuf[count2] << 8; iv[count] += charbuf[count2 + 1]; } size = 0; bufferIndex = 0; #ifndef WIN32 while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { while (count < 8) { count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8); #else - printf ("LoadInit() read2"); while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) { while (count < 8) { count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); #endif if (count2 == 0) { return PWERR_DATA; } count += count2; } /* while (count < 8) */ size += 8; for (count2 = 0; count2 < 8; count2 += 2) { @@ -2250,25 +2247,25 @@ bool ZSafe::saveDocument(const char* _filename, strcpy(entry[i++], "password"); entry[i] = (char*)malloc(strlen("comment")+1); strcpy(entry[i++], "comment"); entry[i] = (char*)malloc(strlen("field5")+1); strcpy(entry[i++], "field5"); entry[i] = (char*)malloc(strlen("field6")+1); strcpy(entry[i++], "field6"); retval = saveEntry(entry); for (int z=0; z<i; z++) free(entry[z]); if (retval == PWERR_DATA) { - qWarning("1: Error writing file, contents not saved"); + owarn << "1: Error writing file, contents not saved" << oendl; saveFinalize(); return false; } // #ifndef WIN32 conf->writeEntry(APP_KEY+"valzsafe", 1); // #endif saveConf(); } QListViewItem *i; // step through all categories for (i = ListView->firstChild(); @@ -2294,34 +2291,34 @@ bool ZSafe::saveDocument(const char* _filename, strcpy(entry[j++], si->text(3).utf8()); entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1); strcpy(entry[j++], si->text(4).utf8()); entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); strcpy(entry[j++], si->text(5).utf8()); retval = saveEntry(entry); for (int z=0; z<j; z++) { free(entry[z]); } if (retval == PWERR_DATA) { - qWarning("1: Error writing file, contents not saved"); + owarn << "1: Error writing file, contents not saved" << oendl; saveFinalize(); return false; } } } if (saveFinalize() == PWERR_DATA) { - qWarning("2: Error writing file, contents not saved"); + owarn << "2: Error writing file, contents not saved" << oendl; return false; } else { #ifndef DESKTOP Global::statusMessage (tr("Password file saved.")); #endif modified = false; return true; } } PasswordForm *newPwdDialog; bool newPwdDialogResult = false; @@ -3181,25 +3178,25 @@ void ZSafe::editCategory() categories.remove (category); // #ifndef WIN32 conf->removeEntry(category); // #endif saveConf(); } category = dialog->CategoryField->currentText(); icon = dialog->IconField->currentText()+".png"; if (cat) { - qWarning("Category found"); + owarn << "Category found" << oendl; // if (!icon.isEmpty() && !icon.isNull()) if (icon != "predefined.png") { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); if (pix) { // save the full pixmap name into the config file // #ifndef WIN32 conf->writeEntry(APP_KEY+category, icon); diff --git a/noncore/apps/zsafe/zsafe.pro b/noncore/apps/zsafe/zsafe.pro index 72c8fe9..3cae706 100644 --- a/noncore/apps/zsafe/zsafe.pro +++ b/noncore/apps/zsafe/zsafe.pro @@ -1,17 +1,17 @@ -TEMPLATE = app -CONFIG = qt warn_on +TEMPLATE = app +CONFIG = qt warn_on DESTDIR = $(OPIEDIR)/bin HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \ scqtfiledlg.h SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \ categorylist.cpp zlistview.cpp shadedlistitem.cpp\ scqtfileedit.cpp scqtfileedit.moc.cpp \ scqtfiledlg.cpp -INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui -INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include -LIBS += -Wl,-rpath,$(OPIEDIR)/lib -L$(OPIEDIR)/lib -lqpe -lopiecore2 -lopieui2 -TARGET = zsafe +INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe -lopiecore2 -lopieui2 +TARGET = zsafe include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/comm/keypebble/config.in b/noncore/comm/keypebble/config.in index 20384aa..8a800b9 100644 --- a/noncore/comm/keypebble/config.in +++ b/noncore/comm/keypebble/config.in @@ -1,4 +1,4 @@ config KEYPEBBLE boolean "opie-keypebble (Virtual Network Computing VNC viewer)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE diff --git a/noncore/comm/keypebble/keypebble.pro b/noncore/comm/keypebble/keypebble.pro index 3515016..7631e4e 100644 --- a/noncore/comm/keypebble/keypebble.pro +++ b/noncore/comm/keypebble/keypebble.pro @@ -1,35 +1,34 @@ -CONFIG += qt warn_on quick-app +CONFIG += qt warn_on quick-app HEADERS = d3des.h \ krfbbuffer.h \ krfbcanvas.h \ krfbconnection.h \ krfbdecoder.h \ krfblogin.h \ krfbserver.h \ krfbserverinfo.h \ kvnc.h \ kvncconndlg.h \ kvncbookmarkdlg.h \ vncauth.h SOURCES = d3des.c \ vncauth.c \ krfbbuffer.cpp \ krfbcanvas.cpp \ krfbconnection.cpp \ krfbdecoder.cpp \ krfblogin.cpp \ krfbserver.cpp \ kvnc.cpp \ kvncconndlg.cpp \ kvncbookmarkdlg.cpp \ main.cpp -INTERFACES = kvncconndlgbase.ui \ - kvncbookmarkdlgbase.ui +INTERFACES = kvncconndlgbase.ui kvncbookmarkdlgbase.ui -INCLUDEPATH += $(OPIEDIR)/include +INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 TARGET = keypebble include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/comm/keypebble/krfbbuffer.cpp b/noncore/comm/keypebble/krfbbuffer.cpp index 4cec0c2..4b29612 100644 --- a/noncore/comm/keypebble/krfbbuffer.cpp +++ b/noncore/comm/keypebble/krfbbuffer.cpp @@ -1,25 +1,33 @@ -#include <assert.h> -#include <qimage.h> -#include <qpainter.h> -#include <qapplication.h> #include "krfbdecoder.h" #include "krfbbuffer.h" #include "krfbconnection.h" #include "krfbserverinfo.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ +#include <qimage.h> +#include <qpainter.h> +#include <qapplication.h> + +/* STD */ +#include <assert.h> + // // Endian stuff // -#ifndef KDE_USE_FINAL +#ifndef OPIE_NO_DEBUG const int endianTest = 1; #endif #define Swap16IfLE(s) \ (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) #define Swap32IfLE(l) \ (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ (((l) & 0x00ff0000) >> 8) | \ (((l) & 0x0000ff00) << 8) | \ (((l) & 0x000000ff) << 24)) : (l)) @@ -30,60 +38,60 @@ KRFBBuffer::KRFBBuffer( KRFBDecoder *decoder, assert( decoder ); this->decoder = decoder; pix = new QPixmap(); } KRFBBuffer::~KRFBBuffer() { delete pix; } void KRFBBuffer::resize( int w, int h ) { - qWarning( "Resizing buffer" ); + owarn << "Resizing buffer" << oendl; pix->resize( w, h ); QPalette pal = qApp->palette(); pix->fill( pal.active().base() ); emit sizeChanged( w, h ); } void KRFBBuffer::soundBell() { emit bell(); } void KRFBBuffer::mouseEvent( QMouseEvent *e ) { decoder->sendMouseEvent( e ); } void KRFBBuffer::keyPressEvent( QKeyEvent *e ) { - qWarning( "Buffer got a key" ); + owarn << "Buffer got a key" << oendl; decoder->sendKeyPressEvent( e ); } void KRFBBuffer::keyReleaseEvent( QKeyEvent *e ) { decoder->sendKeyReleaseEvent( e ); } void KRFBBuffer::copyRect( int srcX, int srcY, int destX, int destY, int w, int h ) { -// qWarning( "Got copy rect" ); +// owarn << "Got copy rect" << oendl; bitBlt( pix, destX, destY, pix, srcX, srcY, w, h, CopyROP ); emit updated( destX, destY, w, h ); } void KRFBBuffer::drawRawRectChunk( void *data, int x, int y, int w, int h ) { QImage img( w, h, 32 ); int scaleFactor=decoder->con->options()->scaleFactor; int redMax = Swap16IfLE( decoder->format->redMax ); diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp index cd1fda0..b3525df 100644 --- a/noncore/comm/keypebble/krfbcanvas.cpp +++ b/noncore/comm/keypebble/krfbcanvas.cpp @@ -1,18 +1,22 @@ #include "krfbconnection.h" #include "krfbcanvas.h" #include "krfbbuffer.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; +/* QT */ #include <qclipboard.h> KRFBCanvas::KRFBCanvas( QWidget *parent, const char *name ) : QScrollView( parent, name ) { connection_ = new KRFBConnection(); connect( connection_, SIGNAL( loggedIn() ), this, SLOT( loggedIn() ) ); loggedIn_ = false; //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold); @@ -33,25 +37,25 @@ void KRFBCanvas::openConnection(KRFBServer server) { QCString host = server.hostname.latin1(); password=server.password; connection_->connectTo( server); } void KRFBCanvas::openURL( const QUrl &url ) { if ( loggedIn_ ) { - qWarning( "openURL invoked when logged in\n" ); + owarn << "openURL invoked when logged in\n" << oendl; return; } QCString host = url.host().latin1(); int display = url.port(); // connection_->connectTo( host, display ); } void KRFBCanvas::closeConnection() { loggedIn_ = false; @@ -65,25 +69,25 @@ void KRFBCanvas::closeConnection() void KRFBCanvas::bell() { if ( connection_->options()->deIconify ) { topLevelWidget()->raise(); topLevelWidget()->show(); } } void KRFBCanvas::loggedIn() { - qWarning( "Ok, we're logged in" ); + owarn << "Ok, we're logged in" << oendl; // // Get ready for action // loggedIn_ = true; viewport()->setMouseTracking( true ); viewport()->setBackgroundMode( NoBackground ); setBackgroundMode( NoBackground ); // Start using the buffer connect( connection_->buffer(), SIGNAL( sizeChanged(int,int) ), this, SLOT( resizeContents(int,int) ) ); diff --git a/noncore/comm/keypebble/krfbconnection.cpp b/noncore/comm/keypebble/krfbconnection.cpp index b447046..33e0563 100644 --- a/noncore/comm/keypebble/krfbconnection.cpp +++ b/noncore/comm/keypebble/krfbconnection.cpp @@ -1,22 +1,29 @@ -#include <assert.h> -#include <qsocket.h> -#include <qtimer.h> -#include <string.h> - #include "krfbconnection.h" #include "krfblogin.h" #include "krfbdecoder.h" #include "krfbbuffer.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ +#include <qsocket.h> +#include <qtimer.h> + +/* STD */ +#include <assert.h> +#include <string.h> + KRFBConnection::KRFBConnection( QObject *parent ) : QObject( parent, "KRFBConnection" ) { portBase_ = 5900; currentState_ = Disconnected; sock = 0; minData_ = 0; options_ = new KRFBServer(); updater = 0; decoder_ = 0; buffer_ = 0; } @@ -34,33 +41,33 @@ void KRFBConnection::connectTo( KRFBServer server) if ( currentState_ != Disconnected ) disconnect(); (*options_)=server; sock = new QSocket( this, "rfbSocket" ); CHECK_PTR( sock ); // Connect to something to notice connection or error connect( sock, SIGNAL( error(int) ), SLOT( gotSocketError(int) ) ); connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); - qWarning( "Connecting..." ); + owarn << "Connecting..." << oendl; currentState_ = Connecting; sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display ); } void KRFBConnection::disconnect() { - qWarning( "Disconnecting from server" ); + owarn << "Disconnecting from server" << oendl; if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) { currentState_ = Disconnecting; connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) ); sock->close(); if ( sock->state() != QSocket::Closing ) disconnectDone(); } @@ -73,36 +80,36 @@ void KRFBConnection::disconnectDone() sock = 0; minData_ = 0; delete updater; delete decoder_; delete buffer_; emit disconnected(); } void KRFBConnection::gotSocketConnection() { currentState_ = LoggingIn; - qWarning( "Connected, logging in..." ); + owarn << "Connected, logging in..." << oendl; static QString statusMsg = tr( "Connected" ); emit statusChanged( statusMsg ); // Do some login stuff login = new KRFBLogin( this ); } void KRFBConnection::gotRFBConnection() { - qWarning( "Logged into server" ); + owarn << "Logged into server" << oendl; currentState_ = Connected; emit connected(); // Create the decoder and start doing stuff decoder_ = new KRFBDecoder( this ); CHECK_PTR( decoder_ ); buffer_ = new KRFBBuffer( decoder_, this, "RFB Buffer" ); CHECK_PTR( buffer_ ); decoder_->setBuffer( buffer_ ); @@ -113,25 +120,25 @@ void KRFBConnection::gotRFBConnection() decoder_->start(); updater = new QTimer; connect( updater, SIGNAL( timeout() ), SLOT( updateTimer() ) ); updater->start( options_->updateRate ); } void KRFBConnection::gotSocketError( int err ) { currentState_ = Error; // Do some error handling stuff - qWarning( "KRFBConnection: Socket error %d", err ); + owarn << "KRFBConnection: Socket error " << err << "" << oendl; static QString refused = tr( "Connection Refused" ); static QString host = tr( "Host not found" ); static QString read = tr( "Read Error: QSocket reported an error reading\n" "data, the remote host has probably dropped the\n" "connection." ); static QString confused = tr( "QSocket reported an invalid error code" ); QString msg; switch ( err ) { case QSocket::ErrConnectionRefused: msg = refused; @@ -163,29 +170,29 @@ void KRFBConnection::gotMoreData() QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); emit gotEnoughData(); } } void KRFBConnection::waitForData( unsigned int sz ) { assert( minData_ == 0 ); assert( sz > 0 ); assert( currentState_ != Error ); if ( sock->size() >= sz ) { - // qWarning( "No need to wait for data" ); + // owarn << "No need to wait for data" << oendl; emit gotEnoughData(); } else { - // qWarning( "Waiting for %u bytes", sz ); + // owarn << "Waiting for " << sz << " bytes" << oendl; minData_ = sz; connect( sock, SIGNAL( readyRead() ), SLOT( gotMoreData() ) ); } } int KRFBConnection::read( void *buf, int sz ) { return sock->readBlock( (char *) buf, sz ); } int KRFBConnection::write( void *buf, int sz ) { diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp index db95154..69457e2 100644 --- a/noncore/comm/keypebble/krfbdecoder.cpp +++ b/noncore/comm/keypebble/krfbdecoder.cpp @@ -1,26 +1,31 @@ #include "krfbconnection.h" #include "krfbserverinfo.h" #include "krfbdecoder.h" #include "krfbbuffer.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; +/* QT */ #include <qpixmap.h> +/* STD */ #include <assert.h> // // Endian stuff // -#ifndef KDE_USE_FINAL +#ifndef OPIE_NO_DEBUG const int endianTest = 1; #endif #define Swap16IfLE(s) \ (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) #define Swap32IfLE(l) \ (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ (((l) & 0x00ff0000) >> 8) | \ (((l) & 0x0000ff00) << 8) | \ (((l) & 0x000000ff) << 24)) : (l)) @@ -126,37 +131,37 @@ KRFBDecoder::~KRFBDecoder() } void KRFBDecoder::start() { sendClientInit(); } void KRFBDecoder::sendClientInit() { con->write( &( con->options()->shared ), 1 ); // Wait for server init - qWarning( "Waiting for server init" ); + owarn << "Waiting for server init" << oendl; static QString statusMsg = tr( "Waiting for server initialization..." ); emit status( statusMsg ); currentState = AwaitingServerInit; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerInit() ) ); con->waitForData( ServerInitLength ); } void KRFBDecoder::gotServerInit() { - qWarning( "Got server init" ); + owarn << "Got server init" << oendl; disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) ); if ( info ) delete info; info = new KRFBServerInfo; CHECK_PTR( info ); con->read( &(info->width), 2 ); info->width = Swap16IfLE( info->width ); con->read( &info->height, 2 ); info->height = Swap16IfLE( info->height ); @@ -172,63 +177,63 @@ void KRFBDecoder::gotServerInit() con->read( &(info->blueMax), 2 ); info->blueMax = Swap16IfLE( info->blueMax ); con->read( &(info->redShift), 1 ); con->read( &(info->greenShift), 1 ); con->read( &(info->blueShift), 1 ); con->read( info->padding, 3 ); con->read( &(info->nameLength), 4 ); info->nameLength = Swap32IfLE( info->nameLength ); - qWarning( "Width = %d, Height = %d", info->width, info->height ); + owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl; qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d", info->bpp, info->depth, info->bigEndian, info->trueColor ); qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d", info->redMax, info->greenMax, info->blueMax ); qWarning( "RedShift = %d, GreenShift = %d, BlueShift = %d", info->redShift, info->greenShift,info-> blueShift ); buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor); // Wait for desktop name - qWarning( "Waiting for desktop name" ); + owarn << "Waiting for desktop name" << oendl; static QString statusMsg = tr( "Waiting for desktop name..." ); emit status( statusMsg ); currentState = AwaitingDesktopName; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) ); con->waitForData( info->nameLength ); } void KRFBDecoder::gotDesktopName() { assert( info ); assert( currentState == AwaitingDesktopName ); - qWarning( "Got desktop name" ); + owarn << "Got desktop name" << oendl; disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotDesktopName() ) ); char *buf = new char[ info->nameLength + 1 ]; CHECK_PTR( buf ); con->read( buf, info->nameLength ); buf[ info->nameLength ] = '\0'; info->name = buf; - qWarning( "Desktop: %s", info->name.latin1() ); + owarn << "Desktop: " << info->name.latin1() << "" << oendl; delete buf; // Get the format we'll really use and tell the server decidePixelFormat(); sendPixelFormat(); sendAllowedEncodings(); currentState = Idle; QString msg; msg = tr( "Connected to %1" ); msg = msg.arg( info->name ); @@ -362,25 +367,25 @@ void KRFBDecoder::sendUpdateRequest( bool incremental ) con->write( &h, 2 ); // Now wait for the update currentState = AwaitingUpdate; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); con->waitForData( UpdateHeaderLength ); } void KRFBDecoder::gotUpdateHeader() { assert( currentState == AwaitingUpdate ); - // qWarning( "Got update header" ); + // owarn << "Got update header" << oendl; disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotUpdateHeader() ) ); CARD8 msgType; con->read( &msgType, 1 ); if ( msgType != UpdateId ) { // We might have a bell or server cut if ( msgType == ServerCutId ) { oldState = currentState; gotServerCut(); @@ -397,37 +402,37 @@ void KRFBDecoder::gotUpdateHeader() currentState = Error; emit error( protocolError ); } return; } CARD8 padding; con->read( &padding, 1 ); con->read( &noRects, 2 ); noRects = Swap16IfLE( noRects ); - // qWarning( "Expecting %d rects", noRects ); + // owarn << "Expecting " << noRects << " rects" << oendl; // Now wait for the data currentState = AwaitingRectHeader; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); con->waitForData( RectHeaderLength ); } void KRFBDecoder::gotRectHeader() { assert( currentState == AwaitingRectHeader ); - // qWarning( "Got rect header" ); + // owarn << "Got rect header" << oendl; disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotRectHeader() ) ); con->read( &x, 2 ); x = Swap16IfLE( x ); con->read( &y, 2 ); y = Swap16IfLE( y ); con->read( &w, 2 ); w = Swap16IfLE( w ); con->read( &h, 2 ); @@ -437,125 +442,125 @@ void KRFBDecoder::gotRectHeader() // CARD32 encodingLocal = Swap32IfLE( encoding ); // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld", // x, y, w, h, encodingLocal ); // // Each encoding needs to be handled differently. Some require // waiting for more data, but others like a copyrect do not. // Our constants have already been byte swapped, so we use // the remote value as is. // if ( encoding == RawEncoding ) { - // qWarning( "Raw encoding" ); + // owarn << "Raw encoding" << oendl; handleRawRect(); } else if ( encoding == CopyRectEncoding ) { -// qWarning( "CopyRect encoding" ); +// owarn << "CopyRect encoding" << oendl; handleCopyRect(); } else if ( encoding == RreEncoding ) { - qWarning( "RRE encoding" ); + owarn << "RRE encoding" << oendl; handleRRERect(); } else if ( encoding == CorreEncoding ) { - qWarning( "CoRRE encoding" ); + owarn << "CoRRE encoding" << oendl; handleCoRRERect(); } else if ( encoding == HexTileEncoding ) { - qWarning( "HexTile encoding" ); + owarn << "HexTile encoding" << oendl; handleHexTileRect(); } else { int msg = Swap32IfLE( encoding ); QString protocolError = tr( "Protocol Error: An unknown encoding was " "used by the server %1" ).arg( msg ); currentState = Error; - qWarning( "Unknown encoding, %d", msg ); + owarn << "Unknown encoding, " << msg << "" << oendl; emit error( protocolError ); return; } } // // Raw Encoding // void KRFBDecoder::handleRawRect() { // We need something a bit cleverer here to handle large // rectanges nicely. The chunking should be based on the // overall size (but has to be in complete lines). - // qWarning( "Handling a raw rect chunk" ); + // owarn << "Handling a raw rect chunk" << oendl; // CARD32 lineCount = w * format->bpp / 8; if ( h > RectChunkSize ) { // if ( con->sock->size() / lineCount ) { // getRawRectChunk( con->sock->size() / lineCount ); // } // else { getRawRectChunk( RectChunkSize ); // } } else { getRawRectChunk( h ); } } void KRFBDecoder::getRawRectChunk( int lines ) { this->lines = lines; CARD32 count = lines * w * format->bpp / 8; // Wait for server init - // qWarning( "Waiting for raw rect chunk, %ld", count ); + // owarn << "Waiting for raw rect chunk, " << count << "" << oendl; currentState = AwaitingRawRectChunk; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) ); con->waitForData( count ); } void KRFBDecoder::gotRawRectChunk() { assert( currentState == AwaitingRawRectChunk ); disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotRawRectChunk() ) ); - // qWarning( "Got raw rect chunk" ); + // owarn << "Got raw rect chunk" << oendl; // // Read the rect data and copy it to the buffer. // // TODO: Replace this! int count = lines * w * format->bpp / 8; char *hack = new char[ count ]; con->read( hack, count ); buf->drawRawRectChunk( hack, x, y, w, lines ); delete hack; // /TODO: h = h - lines; y = y + lines; if ( h > 0 ) { handleRawRect(); } else { noRects--; - // qWarning( "There are %d rects left", noRects ); + // owarn << "There are " << noRects << " rects left" << oendl; if ( noRects ) { currentState = AwaitingRectHeader; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); con->waitForData( RectHeaderLength ); } else { // we are now ready for the next update - no need to wait for the timer currentState = Idle; sendUpdateRequest (1); } } @@ -581,48 +586,48 @@ void KRFBDecoder::gotCopyRectPos() CARD16 srcY; con->read( &srcX, 2 ); con->read( &srcY, 2 ); srcX = Swap16IfLE( srcX ); srcY = Swap16IfLE( srcY ); buf->copyRect( srcX, srcY, x, y, w, h ); noRects--; - // qWarning( "There are %d rects left", noRects ); + // owarn << "There are " << noRects << " rects left" << oendl; if ( noRects ) { currentState = AwaitingRectHeader; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); con->waitForData( RectHeaderLength ); } else currentState = Idle; } void KRFBDecoder::handleRRERect() { - qWarning( "RRE not implemented" ); + owarn << "RRE not implemented" << oendl; } void KRFBDecoder::handleCoRRERect() { - qWarning( "CoRRE not implemented" ); + owarn << "CoRRE not implemented" << oendl; } void KRFBDecoder::handleHexTileRect() { - qWarning( "HexTile not implemented" ); + owarn << "HexTile not implemented" << oendl; } void KRFBDecoder::sendMouseEvent( QMouseEvent *e ) { // Deal with the buttons if ( e->type() != QEvent::MouseMove ) { buttonMask = 0; if ( e->type() == QEvent::MouseButtonPress ) { if ( e->button() & LeftButton ) buttonMask |= 0x01; if ( e->button() & MidButton ) buttonMask |= 0x04; @@ -664,25 +669,25 @@ void KRFBDecoder::sendCutEvent( const QString &unicode ) QCString text = unicode.local8Bit(); CARD32 length = text.length(); length = Swap32IfLE( length ); con->write( &ClientCutTextId, 1 ); con->write( &padding, 3 ); con->write( &length, 4 ); con->write( text.data(), length ); } void KRFBDecoder::gotServerCut() { - qWarning( "Got server cut" ); + owarn << "Got server cut" << oendl; currentState = AwaitingServerCutLength; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) ); con->waitForData( ServerCutLenLength ); } void KRFBDecoder::gotServerCutLength() { assert( currentState = AwaitingServerCutLength ); disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerCutLength() ) ); @@ -712,62 +717,62 @@ void KRFBDecoder::gotServerCutText() // same. I've reported this problem to the ORL guys, but they apparantly have no // immediate plans to fix the issue. :-( (rich) // char *cutbuf = new char[ serverCutTextLen + 1 ]; CHECK_PTR( cutbuf ); con->read( cutbuf, serverCutTextLen ); cutbuf[ serverCutTextLen ] = '\0'; /* For some reason QApplication::clipboard()->setText() segfaults when called * from within keypebble's mass of signals and slots - qWarning( "Server cut: %s", cutbuf ); + owarn << "Server cut: " << cutbuf << "" << oendl; QString cutText( cutbuf ); // DANGER!! qApp->clipboard()->setText( cutText ); */ delete cutbuf; // Now wait for the update (again) if ( oldState == AwaitingUpdate ) { currentState = AwaitingUpdate; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); con->waitForData( UpdateHeaderLength ); } else if ( oldState == Idle ) { currentState = Idle; } else { - qWarning( "Async handled in weird state" ); + owarn << "Async handled in weird state" << oendl; currentState = oldState; }; } void KRFBDecoder::gotBell() { - qWarning( "Got server bell" ); + owarn << "Got server bell" << oendl; buf->soundBell(); // Now wait for the update (again) if ( oldState == AwaitingUpdate ) { currentState = AwaitingUpdate; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); con->waitForData( UpdateHeaderLength ); } else if ( oldState == Idle ) { currentState = Idle; } else { - qWarning( "Async handled in weird state" ); + owarn << "Async handled in weird state" << oendl; currentState = oldState; }; } void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event ) { int key; key = toKeySym( event ); if ( key ) { key = Swap32IfLE( key ); CARD8 mask = true; diff --git a/noncore/comm/keypebble/krfblogin.cpp b/noncore/comm/keypebble/krfblogin.cpp index 2bbd110..92005d2 100644 --- a/noncore/comm/keypebble/krfblogin.cpp +++ b/noncore/comm/keypebble/krfblogin.cpp @@ -1,23 +1,28 @@ -#include <assert.h> +#include "krfblogin.h" +#include "krfbconnection.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ +#include <qtimer.h> +/* STD */ +#include <assert.h> extern "C" { #include "vncauth.h" } -#include "krfblogin.h" -#include "krfbconnection.h" -#include <qtimer.h> - // The length of the various messages (used to decide how many bytes to // wait for). const int ServerVersionLength = 12; const int ClientVersionLength = 12; const int AuthSchemeLength = 4; const int FailureReasonSizeLength = 4; const int ChallengeLength = 16; const int AuthResultLength = 4; // Authentication results enum AuthResult { AuthOk, @@ -43,154 +48,154 @@ const int endianTest = 1; KRFBLogin::KRFBLogin( KRFBConnection *con ) : QObject( con, "RFB login manager" ) { assert( con ); this->con = con; currentState = AwaitingServerVersion; connect( this, SIGNAL( error(const QString&) ), con, SIGNAL( error(const QString&) ) ); - qWarning( "Waiting for server version..." ); + owarn << "Waiting for server version..." << oendl; static QString statusMsg = tr( "Waiting for server version..." ); emit status( statusMsg ); // Kick off the state machine connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerVersion() ) ); con->waitForData( ServerVersionLength ); } KRFBLogin::~KRFBLogin() { } KRFBLogin::State KRFBLogin::state() const { return currentState; } void KRFBLogin::gotServerVersion() { - qWarning( "Got server version" ); + owarn << "Got server version" << oendl; disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerVersion() ) ); // Read the server's version message char serverVersion[ ServerVersionLength + 1 ]; con->read( serverVersion, ServerVersionLength ); serverVersion[ ServerVersionLength ] = '\0'; QCString rfbString( serverVersion, ServerVersionLength + 1 ); versionString = rfbString; QRegExp regexp( "RFB [0-9][0-9][0-9]\\.[0-9][0-9][0-9]\n" ); if ( rfbString.find( regexp ) == -1 ) { static QString msg = tr( "Error: Invalid server version, %1" ).arg( rfbString ); - qWarning( msg ); + owarn << msg << oendl; emit error( msg ); currentState = Error; return; } // Calculate the actual version number serverMajor = (serverVersion[4] - '0') * 100 + (serverVersion[5] - '0') * 10 + (serverVersion[6] - '0'); serverMinor = (serverVersion[8] - '0') * 100 + (serverVersion[9] - '0') * 10 + (serverVersion[10] - '0'); - qWarning("Server Version: %03d.%03d", serverMajor, serverMinor ); + owarn << "Server Version: " << serverMajor << "." << serverMinor << "" << oendl; if ( serverMajor != 3 ) { QString msg = tr( "Error: Unsupported server version, %1" ) .arg( rfbString ); - qWarning( msg ); + owarn << msg << oendl; emit error( msg ); currentState = Error; return; } if ( serverMinor != 3 ) { - qWarning( "Minor version mismatch: %d", serverMinor ); + owarn << "Minor version mismatch: " << serverMinor << "" << oendl; } // Setup for the next state sendClientVersion(); connect( con, SIGNAL( gotEnoughData() ), SLOT( gotAuthScheme() ) ); con->waitForData( AuthSchemeLength ); } void KRFBLogin::gotAuthScheme() { disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotAuthScheme() ) ); // Got data CARD32 scheme; con->read( &scheme, AuthSchemeLength ); scheme = Swap32IfLE( scheme ); static QString statusMsgOk = tr( "Logged in" ); switch ( scheme ) { case 0: - qWarning( "Failed" ); + owarn << "Failed" << oendl; // Handle failure connect( con, SIGNAL( gotEnoughData() ), SLOT( gotFailureReasonSize() ) ); con->waitForData( FailureReasonSizeLength ); break; case 1: // Handle no auth emit status( statusMsgOk ); con->gotRFBConnection(); break; case 2: // Handle VNC auth connect( con, SIGNAL( gotEnoughData() ), SLOT( gotChallenge() ) ); con->waitForData( ChallengeLength ); break; default: - qWarning( "Unknown authentication scheme, 0x%08lx", scheme ); + owarn << "Unknown authentication scheme, 0x" << scheme << "" << oendl; currentState = Error; break; }; } void KRFBLogin::gotChallenge() { disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotChallenge() ) ); QTimer::singleShot( 0, this, SLOT(getPassword()) ); } void KRFBLogin::getPassword() { // Got data CARD8 challenge[ ChallengeLength ]; con->read( challenge, ChallengeLength ); // Last chance to enter a password if ( con->options_->password.isNull() ) { - qWarning( "krfblogin needs a password" ); + owarn << "krfblogin needs a password" << oendl; emit passwordRequired( con ); } if ( con->options_->password.isNull() ) { QString msg = tr( "Error: This server requires a password, but none " "has been specified.\n" ); emit error( msg ); return; } vncEncryptBytes( (unsigned char *) challenge, QCString(con->options_->password.latin1()).data() ); @@ -207,47 +212,47 @@ void KRFBLogin::gotFailureReasonSize() } void KRFBLogin::gotAuthResult() { // Got data disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotAuthResult() ) ); long result; con->read( &result, AuthResultLength ); result = Swap32IfLE( result ); - qWarning( "Authentication Result is 0x%08lx", result ); + owarn << "Authentication Result is 0x" << result << "" << oendl; static QString failed = tr( "Error: The password you specified was incorrect." ); static QString tooMany = tr( "Error: Too many invalid login attempts have been made\n" "to this account, please try later." ); static QString statusMsgOk = tr( "Logged in" ); static QString statusMsgFailed = tr( "Login Failed" ); static QString statusMsgTooMany = tr( "Too many failures" ); switch( result ) { case AuthOk: emit status( statusMsgOk ); con->gotRFBConnection(); break; case AuthFailed: - qWarning( "Dammit" ); + owarn << "Dammit" << oendl; emit status( statusMsgFailed ); emit error( failed ); break; case AuthTooMany: emit status( statusMsgTooMany ); emit error( tooMany ); break; default: - qWarning( "Invalid authentication result, %lx", result ); + owarn << "Invalid authentication result, " << result << "" << oendl; break; } } void KRFBLogin::sendClientVersion() { - qWarning( "Sending client version" ); + owarn << "Sending client version" << oendl; con->write( (void*)"RFB 003.003\n", ClientVersionLength ); } diff --git a/noncore/comm/keypebble/kvncbookmarkdlg.cpp b/noncore/comm/keypebble/kvncbookmarkdlg.cpp index ef2fa12..149c398 100644 --- a/noncore/comm/keypebble/kvncbookmarkdlg.cpp +++ b/noncore/comm/keypebble/kvncbookmarkdlg.cpp @@ -1,17 +1,23 @@ +#include "kvncbookmarkdlg.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/global.h> +using namespace Opie::Core; + +/* QT */ #include <qdir.h> #include <qtextstream.h> #include <qlistbox.h> -#include <qpe/global.h> -#include "kvncbookmarkdlg.h" KVNCBookmarkDlg::KVNCBookmarkDlg( QWidget * parent, const char * name, WFlags f ) : KVNCBookmarkDlgBase( parent, name,f) { readBookmarks(); refresh(); } KVNCBookmarkDlg::~KVNCBookmarkDlg() { @@ -166,25 +172,25 @@ void KVNCBookmarkDlg::writeBookmarks(void) QFile f(filename); QString key, val; KRFBServer * server=0; if ( f.open(IO_ReadWrite) ) { QTextStream t( &f ); QString s; int n = 1; KRFBServer *server; for ( server=servers.first(); server != 0; server=servers.next() ) { - qDebug(server->name); + odebug << server->name << oendl; t << "server=" << server->name << '\n'; t << "\thostname=" << server->hostname << '\n'; t << "\tpassword=" << encipher(server->password )<< '\n'; t << "\tdisplay=" << server->display << '\n'; t << "\thextile=" << server->hexTile << '\n'; t << "\tcorre=" << server->corre << '\n'; t << "\trre=" << server->rre << '\n'; t << "\tcopyrect=" << server->copyrect << '\n'; t << "\tshared=" << server->shared << '\n'; t << "\treadonly=" << server->readOnly << '\n'; t << "\tdeiconify=" << server->deIconify << '\n'; t << "\tupdaterate=" << server->updateRate << '\n'; diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp index 51020a0..bdb1c78 100644 --- a/noncore/games/backgammon/backgammon.cpp +++ b/noncore/games/backgammon/backgammon.cpp @@ -1,48 +1,52 @@ #include "backgammon.h" - #include "aidialog.h" #include "filedialog.h" #include "playerdialog.h" #include "rulesdialog.h" #include "themedialog.h" +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/qpeapplication.h> +#include <qpe/config.h> +#include <qpe/resource.h> +using namespace Opie::Core; + +/* QT */ #include <qfile.h> #include <qlayout.h> #include <qmessagebox.h> #include <qtimer.h> -#include <qpe/qpeapplication.h> -#include <qpe/config.h> #include <qmenubar.h> -#include <qpe/resource.h> #include <stdlib.h> BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { if (!name) setName("BackGammon"); setCaption(tr( "Backgammon") ); setIcon( Resource::loadPixmap( "backgammon" ) ); //general counter varaible int a=0; //the game engine move=new MoveEngine(); //load the default theme Config conf("backgammon"); if(!conf.isValid()) { - qDebug("config file does not exist"); + odebug << "config file does not exist" << oendl; conf.setGroup("general"); conf.writeEntry("theme","default"); conf.setGroup("rules"); conf.writeEntry("move_with_pieces_out",false); conf.writeEntry("nice_dice",false); conf.setGroup("display"); conf.writeEntry("small",false); conf.writeEntry("warning",true); conf.setGroup("ai"); conf.writeEntry("rescue",6); conf.writeEntry("eliminate",4); conf.writeEntry("expose",1); @@ -69,25 +73,25 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) ai.eliminate=conf.readNumEntry("eliminate",4); ai.expose=conf.readNumEntry("expose",1); ai.protect=conf.readNumEntry("protect",5); ai.safe=conf.readNumEntry("safe",3); ai.empty=conf.readNumEntry("empty",2); move->setAISettings(ai); //get the theme component names Config theme(theme_file,Config::File); if(!theme.isValid()) { - qDebug("theme file does not exist"); + odebug << "theme file does not exist" << oendl; theme.setGroup("theme"); theme.writeEntry("board","casino_board_1"); theme.writeEntry("pieces1","casino_pieces_blue"); theme.writeEntry("pieces2","casino_pieces_white"); theme.writeEntry("dice1","casino_dice"); theme.writeEntry("dice2","casino_dice"); theme.writeEntry("table","casino_table_green"); theme.writeEntry("odds","casino_odds"); } theme.setGroup("theme"); board_name=theme.readEntry("board","casino_board_1"); piecesA_name=theme.readEntry("pieces1","casino_pieces_blue"); diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp index 7de7147..a4145cc 100644 --- a/noncore/games/backgammon/moveengine.cpp +++ b/noncore/games/backgammon/moveengine.cpp @@ -448,25 +448,25 @@ int MoveEngine::getPossibleMoves() } int total=0; for(int field=0;field<26;field++) { total+=moves[field].weight[0]+moves[field].weight[1]+moves[field].weight[2]+moves[field].weight[3]; } return total; } void MoveEngine::move(const int& from, int to, const int& dice) { - //qDebug("%d moves from %d to %d (%d) with dice %d",player,from,to,to-from,dice); + //odebug << "" << player << " moves from " << from << " to " << to << " (" << to-from << ") with dice " << dice << "" << oendl; if(player==1 && to==25) to=26; if(player==2 && to==0) to=27; //if space is occupied by enemy move pieces to startzone if(fieldColor(to)==otherplayer) { population[to].total=0; if(otherplayer==1) population[0].total++; diff --git a/noncore/games/bounce/bounce.pro b/noncore/games/bounce/bounce.pro index ba745c8..56a325c 100644 --- a/noncore/games/bounce/bounce.pro +++ b/noncore/games/bounce/bounce.pro @@ -1,10 +1,9 @@ -#CONFIG = qt warn_on -CONFIG = qt warn_on quick-app +CONFIG = qt warn_on quick-app HEADERS = game.h kbounce.h SOURCES = game.cpp kbounce.cpp main.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopiecore2 +LIBS += -lqpe -lopiecore2 TARGET = bounce include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/games/bounce/game.cpp b/noncore/games/bounce/game.cpp index 1f1f8cd..bbd3d0b 100644 --- a/noncore/games/bounce/game.cpp +++ b/noncore/games/bounce/game.cpp @@ -8,29 +8,36 @@ * * 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <stdlib.h> -#include <qtimer.h> +#include "game.h" + +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; -#include "game.h" +/* QT */ +#include <qtimer.h> + +/* STD */ +#include <stdlib.h> #define TILE_SIZE 9 #define TILE_FIRST ((FIELD_WIDTH-2)*(FIELD_HEIGHT-2)) #define TILE_FREE (TILE_FIRST + 0) #define TILE_BORDER (TILE_FIRST + 1) #define TILE_WALLEND (TILE_FIRST + 2) #define TILE_WALLUP (TILE_FIRST + 3) #define TILE_WALLDOWN (TILE_FIRST + 4) #define TILE_WALLLEFT (TILE_FIRST + 5) #define TILE_WALLRIGHT (TILE_FIRST + 6) @@ -358,25 +365,25 @@ JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name ) } JezzGame::~JezzGame() { m_balls.clear(); delete m_view; delete m_field; delete m_ballPixmaps; } void JezzGame::display( QString text, int size ) { - qDebug("This function \"display\" shouldn't be called!!!"); + odebug << "This function \"display\" shouldn't be called!!!" << oendl; if ( !text.isEmpty() ) { QFont font( "Helvetica", size, QFont::Bold ); font.setStyleHint( QFont::Helvetica ); m_text->setFont( font ); m_text->setText( text ); QRect size = m_text->boundingRect(); m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2, ( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 ); m_text->show(); diff --git a/noncore/games/go/go.pro b/noncore/games/go/go.pro index b73bbb0..72425a5 100644 --- a/noncore/games/go/go.pro +++ b/noncore/games/go/go.pro @@ -1,19 +1,18 @@ -CONFIG = qt warn_on quick-app +CONFIG = qt warn_on quick-app HEADERS = amigo.h \ go.h \ goplayutils.h \ gowidget.h SOURCES = amigo.c \ - goplayer.c \ - goplayutils.c \ - killable.c \ - gowidget.cpp \ - main.cpp -INCLUDEPATH += $(OPIEDIR)/include + goplayer.c \ + goplayutils.c \ + killable.c \ + gowidget.cpp \ + main.cpp +INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 TARGET = go - include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp index d134540..ec03c1d 100644 --- a/noncore/games/go/gowidget.cpp +++ b/noncore/games/go/gowidget.cpp @@ -11,37 +11,38 @@ ** 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 "gowidget.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/resource.h> +using namespace Opie::Core; +/* QT */ #include <qpainter.h> #include <qtoolbar.h> #include <qmenubar.h> #include <qaction.h> #include <qapplication.h> //processEvents() #include <qlabel.h> -//#include <stdio.h> - - static const enum bVal computer_color = BLACK; static int current_handicap = 1; static QBrush *goBrush; //static QImage *newBlackStone; //static QImage *blackStone; //static QImage *whiteStone; static QPixmap *newBlackStone; static QPixmap *blackStone; static QPixmap *whiteStone; @@ -439,22 +440,22 @@ extern "C" { void removestone(short x, short y) { GoWidget::self->removeStone(x,y); } void placestone (enum bVal c, short x, short y ) { GoWidget::self->placeStone(c,x,y); } void intrMoveReport(enum bVal c ,char *coord ,char *reason ) { - qDebug( "intrMoveReport colour %d, %s %s", c, coord, reason ); + odebug << "intrMoveReport colour " << c << ", " << coord << " " << reason << "" << oendl; } void intrPrisonerReport( short blackcnt, short whitecnt ) { GoWidget::self->reportPrisoners(blackcnt,whitecnt); } } diff --git a/noncore/games/kpacman/kpacman.pro b/noncore/games/kpacman/kpacman.pro index 8453f78..45314f9 100644 --- a/noncore/games/kpacman/kpacman.pro +++ b/noncore/games/kpacman/kpacman.pro @@ -1,16 +1,14 @@ TEMPLATE = app -#CONFIG = qt warn_on CONFIG = qt warn_on -#TMAKE_CXXFLAGS += HEADERS = kpacmanwidget.h \ referee.h \ status.h \ painter.h \ score.h \ pacman.h \ monster.h \ keys.h \ fruit.h \ energizer.h \ board.h \ bitfont.h \ @@ -25,17 +23,17 @@ SOURCES = kpacmanwidget.cpp \ score.cpp \ pacman.cpp \ monster.cpp \ keys.cpp \ fruit.cpp \ energizer.cpp \ board.cpp \ bitfont.cpp \ kpacman.cpp \ main.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 DESTDIR = $(OPIEDIR)/bin TARGET = kpacman include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/games/kpacman/kpacmanwidget.cpp b/noncore/games/kpacman/kpacmanwidget.cpp index 9631495..b59dd02 100644 --- a/noncore/games/kpacman/kpacmanwidget.cpp +++ b/noncore/games/kpacman/kpacmanwidget.cpp @@ -4,25 +4,26 @@ #if defined( KDE2_PORT ) #include <kapp.h> #include <kconfig.h> #include <kstddirs.h> #include <kpacmanwidget.h> #include <kpacmanwidget.moc> #elif defined( QPE_PORT ) #include <qpe/qpeapplication.h> #include <qpe/config.h> #include "kpacmanwidget.h" #endif - +#include <opie2/odebug.h> +using namespace Opie::Core; KpacmanWidget::KpacmanWidget( QWidget *parent, const char *name) : QWidget( parent, name ) { score = 0l; referee = 0l; status = 0l; bitfont = NULL; fontName = ""; scheme = mode = -1; confScheme(); @@ -130,24 +131,24 @@ void KpacmanWidget::setScheme(int Scheme, int Mode) score->setScheme(Scheme, Mode, bitfont); referee->setScheme(Scheme, Mode, bitfont); status->setScheme(Scheme, Mode); score->repaint(FALSE); referee->repaint(FALSE); status->repaint(FALSE); } void KpacmanWidget::resizeEvent( QResizeEvent * ) { - qWarning("Resize"); + owarn << "Resize" << oendl; referee->setGeometry(0, bitfont->height()*3, referee->width(), referee->height()); referee->setBackgroundColor(BLACK); if(!status ) return; status->setGeometry(0, bitfont->height()*3+referee->height(), referee->width(), status->height()); status->setBackgroundColor(BLACK); score->setGeometry(0, 0, referee->width(), bitfont->height()*3+referee->height()+status->height()); score->setBackgroundColor(BLACK); } diff --git a/noncore/games/kpacman/status.cpp b/noncore/games/kpacman/status.cpp index 02ff63d..db6938e 100644 --- a/noncore/games/kpacman/status.cpp +++ b/noncore/games/kpacman/status.cpp @@ -4,32 +4,35 @@ #if defined( KDE2_PORT ) #include <kapp.h> #include <klocale.h> #include <kstddirs.h> #include <status.h> #include <status.moc> #elif defined( QPE_PORT ) #include <qpe/qpeapplication.h> #include <qpe/config.h> #include "status.h" #endif +#include <opie2/odebug.h> +using namespace Opie::Core; + #include <qbitmap.h> #include <qmsgbox.h> #include <qfileinfo.h> Status::Status( QWidget *parent, const char *name, int Scheme, int Mode ) : QWidget( parent, name ) { - qWarning("Status::Status"); + owarn << "Status::Status" << oendl; actualLifes = 0; actualLevel = 0; lifesPix = NULL; levelPix = NULL; scheme = Scheme; mode = Mode; level = 0; confScheme(); } diff --git a/noncore/games/mindbreaker/mindbreaker.cpp b/noncore/games/mindbreaker/mindbreaker.cpp index 2b924c6..1f554d2 100644 --- a/noncore/games/mindbreaker/mindbreaker.cpp +++ b/noncore/games/mindbreaker/mindbreaker.cpp @@ -81,25 +81,25 @@ static void setupBoardSize(int w, int h) // looks a bit dodgy on larger sizes (still does though, but not as much...) if ( adjusted_answerpeg_size > 22 ) adjusted_answerpeg_size = 22; adjusted_answerpegx = adjusted_panel_width * 159/180 - adjusted_answerpeg_size/2; adjusted_answerpegy = adjusted_panel_height/3 - adjusted_answerpeg_size/2; adjusted_answerpeg_xdiff = adjusted_panel_width * 10/180; adjusted_answerpeg_ydiff = adjusted_panel_height * 9/25; adjusted_board_height = adjusted_title_height + (adjusted_panel_height * 9); adjusted_board_width = adjusted_panel_width + (adjusted_bin_margin * 2) + adjusted_peg_size; -// qDebug("Adjusted width %d height %d", adjusted_board_width, adjusted_board_height); +// odebug << "Adjusted width " << adjusted_board_width << " height " << adjusted_board_height << "" << oendl; } /* helper class, */ class Peg : public QCanvasRectangle { public: Peg(QCanvas *canvas, int type, int go = -1, int pos = -1); int rtti() const {return pegRTTI; } void advance(int phase); bool hit( const QPoint &) const; diff --git a/noncore/games/oyatzee/oyatzee.cpp b/noncore/games/oyatzee/oyatzee.cpp index a55aa73..27c0a9f 100644 --- a/noncore/games/oyatzee/oyatzee.cpp +++ b/noncore/games/oyatzee/oyatzee.cpp @@ -1,19 +1,25 @@ #include "oyatzee.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qmessagebox.h> #include <qpushbutton.h> #include <qpainter.h> #include <qlayout.h> +/* STD */ #include <stdlib.h> OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( parent , name , fl ) { QWidget *thing = new QWidget( this ); setCentralWidget( thing ); setCaption( tr( "OYatzee" ) ); setPlayerNumber( 4 ); setRoundsNumber( 1 ); @@ -32,25 +38,25 @@ OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( connect( sb->pb , SIGNAL( item(int) ), this , SLOT( slotEndRound(int) ) ); dw = new DiceWidget( thing , "dw" ); dw->setMaximumHeight( this->height()/4 ); connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) ); vbox->addWidget( sb ); vbox->addWidget( dw ); } void OYatzee::slotEndRound( int item ) { - qDebug( "Der User hat Nummer %d ausgewählt" , item ); + odebug << "Der User hat Nummer " << item << " ausgewählt" << oendl; /* * if the user clicked on Total, Bonus or Score and thus not on a * selectable item return and do nothing */ if ( item == 7 || item == 8 || item == 16 ) return; /* * check if the user can really click on that item */ if ( posibilities.find( item ) == posibilities.end() ) return; @@ -100,25 +106,25 @@ void OYatzee::slotEndRound( int item ) points = 40; break; case Yatzee: points = 50; break; case Chance: points = getPoints ( Chance , numbers ); } sb->nextRB(currentPlayer-1)->updateMap( item , points ); nextPlayer(); - qDebug( "Punkte: %d" , points ); + odebug << "Punkte: " << points << "" << oendl; } void OYatzee::nextPlayer() { currentPlayer++; if ( currentPlayer > numOfPlayers ) { currentPlayer = 1; } ps.at(currentPlayer-1)->turn = 0; @@ -147,25 +153,25 @@ int OYatzee::getPoints( const int num , QValueListInt l) } return c; } } OYatzee::~OYatzee() { } void OYatzee::detectPosibilities() { posibilities.clear(); - qDebug( "running detectPosibilities()" ); + odebug << "running detectPosibilities()" << oendl; Dice *d = dw->diceList.first(); QValueListInt numbers; for ( ; d != 0 ; d = dw->diceList.next() ) { numbers.append( d->hasValue() ); } //the 6 numbers QValueListInt::Iterator it; @@ -252,65 +258,65 @@ void OYatzee::detectPosibilities() posibilities.append( 13 ); } posibilities.append( 13 ); //Chance, well, this is allways possible displayPossibilites(); } void OYatzee::displayPossibilites() { //X for ( QValueListInt::Iterator it = posibilities.begin() ; it != posibilities.end(); ++it ) //X { -//X qDebug( QString::number( *it ) ); +//X odebug << QString::number( *it ) << oendl; //X switch ( *it ) //X { //X case Ones: -//X qDebug( "1er" ); +//X odebug << "1er" << oendl; //X break; //X case Twos: -//X qDebug( "2er" ); +//X odebug << "2er" << oendl; //X break; //X case Threes: -//X qDebug( "3er" ); +//X odebug << "3er" << oendl; //X break; //X case Fours: -//X qDebug( "4er" ); +//X odebug << "4er" << oendl; //X break; //X case Fives: -//X qDebug( "5er" ); +//X odebug << "5er" << oendl; //X break; //X case Sixes: -//X qDebug( "6er" ); +//X odebug << "6er" << oendl; //X break; //X case ThreeOfAKind: -//X qDebug( "3oaK" ); +//X odebug << "3oaK" << oendl; //X break; //X case FourOfAKind: -//X qDebug( "4oaK" ); +//X odebug << "4oaK" << oendl; //X break; //X case FullHouse: -//X qDebug( "Full House" ); +//X odebug << "Full House" << oendl; //X break; //X case SStraight: -//X qDebug( "Short S" ); +//X odebug << "Short S" << oendl; //X break; //X case LStraight: -//X qDebug( "Long S" ); +//X odebug << "Long S" << oendl; //X break; //X case Yatzee: -//X qDebug( "Yatzee!" ); +//X odebug << "Yatzee!" << oendl; //X break; //X case Chance: -//X qDebug( "Chance" ); +//X odebug << "Chance" << oendl; //X break; //X } //X } sb->pb->setIntlist( posibilities ); sb->pb->update(); } void OYatzee::startGame() { /* * TODO @@ -326,45 +332,45 @@ void OYatzee::setPlayerNumber( const int num ) void OYatzee::setRoundsNumber( const int num ) { numOfRounds = num; } void OYatzee::slotStartGame() { } void OYatzee::slotRollDices() { - qDebug( "Roll nummer: %d" , ps.at( currentPlayer-1 )->turn ); + odebug << "Roll nummer: " << ps.at( currentPlayer-1 )->turn << "" << oendl; if ( ps.at( currentPlayer-1 )->turn == 3 ) { QMessageBox::information( this, "OYatzee", tr( "Only three rolls per turn allowed." ) ); return; } Dice *d = dw->diceList.first(); for ( ; d != 0 ; d = dw->diceList.next() ) { if ( !d->isSelected ) d->roll(); } -// qDebug( "Roll nummer (vorher): %d" , ps.at( currentPlayer-1 )->turn ); +// odebug << "Roll nummer (vorher): " << ps.at( currentPlayer-1 )->turn << "" << oendl; ps.at(currentPlayer-1)->turn++; -// qDebug( "Roll nummer (nachher): %d" , ps.at( currentPlayer-1 )->turn ); +// odebug << "Roll nummer (nachher): " << ps.at( currentPlayer-1 )->turn << "" << oendl; detectPosibilities(); } /* * Scoreboard */ Scoreboard::Scoreboard( playerList ps, QWidget *parent, const char *name ) : QWidget( parent , name ) { ps_ = ps; pb = new Possibilityboard( this , "pb" ); @@ -382,25 +388,25 @@ Scoreboard::Scoreboard( playerList ps, QWidget *parent, const char *name ) : QWi for ( ; r != 0 ; r = rbList.next() ) { hbox->addWidget( r ); } } Resultboard* Scoreboard::nextRB( int currentPlayer ) { Resultboard *b; b = rbList.at( currentPlayer ); - qDebug( "Anzahl: %d" , rbList.count() ); + odebug << "Anzahl: " << rbList.count() << "" << oendl; return b; } void Scoreboard::createResultboards(const int num) { Player *p = ps_.first(); for ( int i = 0 ; i < num ; ++i , p = ps_.next() ) { QString n = p->playerName; rbList.append( new Resultboard( n , this ) ); } @@ -599,25 +605,25 @@ Resultboard::Resultboard( QString playerName , QWidget *parent , const char* nam void Resultboard::paintEvent( QPaintEvent* ) { QPainter p; p.begin( this ); const int cell_width = this->width(); const int cell_height = this->height()/17; pointMap::Iterator it = pMap.begin(); for ( ; it != pMap.end() ; ++it ) { int i = it.key(); - qDebug( "ok: %d , %d" , i , it.data() ); + odebug << "ok: " << i << " , " << it.data() << "" << oendl; p.drawText( 0, i*cell_height , cell_width , cell_height , Qt::AlignCenter , QString::number( it.data() ) ); } p.drawText( 0,0,cell_width,cell_height, Qt::AlignCenter , pName ); //Playername } void Resultboard::updateMap( int item , int points ) { pMap.insert( item , points ); update(); diff --git a/noncore/games/oyatzee/oyatzee.pro b/noncore/games/oyatzee/oyatzee.pro index 754abd2..f505c66 100644 --- a/noncore/games/oyatzee/oyatzee.pro +++ b/noncore/games/oyatzee/oyatzee.pro @@ -1,11 +1,11 @@ TEMPLATE = app CONFIG = qt warn_on DESTDIR = $(OPIEDIR)/bin HEADERS = oyatzee.h SOURCES = main.cpp oyatzee.cpp TARGET = oyatzee INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/games/wordgame/wordgame.cpp b/noncore/games/wordgame/wordgame.cpp index a80bd35..47d6725 100644 --- a/noncore/games/wordgame/wordgame.cpp +++ b/noncore/games/wordgame/wordgame.cpp @@ -666,25 +666,25 @@ void ComputerPlayer::findBest(QPoint at, const QPoint& d, const QDawg::Node* nod } findBest(at, d, node->next(), used, nletter, tiles, n, blankvalues, blused); } void ComputerPlayer::noteChoice(const Tile** tiles, int n, const QPoint& d, const Tile* blankvalues, int blused) { int s = board->score(current, tiles, n, blankvalues, d, TRUE, 0); /* if (s>0 || current==QPoint(5,1)){ QString st; for ( int i=0; i<n; i++ ) st += tiles[i]->text(); -qDebug("%d,%d: %s (%d) for %d",current.x(),current.y(),st.latin1(),n,s); +odebug << "" << current.x() << "," << current.y() << ": " << st.latin1() << " (" << n << ") for " << s << "" << oendl; } */ if ( s > best_score ) { int i; for ( i=0; i<n; i++ ) best[i] = tiles[i]; for ( i=0; i<blused; i++ ) best_blankvalues[i] = blankvalues[i]; best_n = n; best_blused = blused; best_score = s; best_dir = d; diff --git a/noncore/graphics/opie-eye/config.in b/noncore/graphics/opie-eye/config.in index 996dcf3..d7f9963 100644 --- a/noncore/graphics/opie-eye/config.in +++ b/noncore/graphics/opie-eye/config.in @@ -1,9 +1,9 @@ config OPIE_EYE boolean "opie-eye The Image Viewer and Browser" default "y" - depends on ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI + depends on ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI config OPIE_EYE_SLAVE boolean default "y" if OPIE_EYE - depends on ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI + depends on ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp index 79f4510..5599ad1 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp @@ -1,26 +1,30 @@ /* * GPLv2 * zecke@handhelds.org */ +#include "dir_ifaceinfo.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +using namespace Opie::Core; + +/* QT */ #include <qwidget.h> #include <qcheckbox.h> #include <qhbox.h> #include <qlabel.h> -#include <qpe/config.h> - -#include "dir_ifaceinfo.h" - namespace { class DirImageWidget : public QHBox { public: DirImageWidget() { chkbox = new QCheckBox( QObject::tr("Show all files"), this ); } ~DirImageWidget() {} QCheckBox* chkbox; }; } @@ -32,16 +36,16 @@ DirInterfaceInfo::~DirInterfaceInfo() { QString DirInterfaceInfo::name()const { return QString::fromLatin1(QObject::tr("DirView" )); } QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { DirImageWidget* wid = new DirImageWidget(); wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); return wid; } void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) { - qWarning( "Write Config" ); + owarn << "Write Config" << oendl; DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); } diff --git a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp index ffea29e..0a5cff4 100644 --- a/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp +++ b/noncore/graphics/opie-eye/impl/dir/dir_lister.cpp @@ -1,33 +1,35 @@ /* * GPLv2 zecke@handhelds.org */ #include "dir_lister.h" #include <lib/slavemaster.h> - +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; +/* QT */ #include <qdir.h> #include <qfileinfo.h> - Dir_DirLister::Dir_DirLister( bool list ) : PDirLister( "dir_dir_lister" ) { m_allFiles = list; - qWarning("All Files %d", m_allFiles ); + owarn << "All Files " << m_allFiles << "" << oendl; SlaveMaster* master = SlaveMaster::self(); connect( master, SIGNAL(sig_start()), this, SIGNAL(sig_start()) ); connect( master, SIGNAL(sig_end()), this, SIGNAL(sig_end()) ); connect( master, SIGNAL(sig_thumbInfo(const QString&, const QString&)), this, SIGNAL(sig_thumbInfo(const QString&, const QString&)) ); connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), this, SIGNAL(sig_fullInfo(const QString&, const QString&)) ); connect( master, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)), this, SIGNAL(sig_thumbNail(const QString&, const QPixmap&)) ); } diff --git a/noncore/graphics/opie-eye/lib/slavemaster.cpp b/noncore/graphics/opie-eye/lib/slavemaster.cpp index 4e28535..5bb7ab8 100644 --- a/noncore/graphics/opie-eye/lib/slavemaster.cpp +++ b/noncore/graphics/opie-eye/lib/slavemaster.cpp @@ -1,38 +1,42 @@ #include "slavemaster.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> #include <qpe/qcopenvelope_qws.h> +using namespace Opie::Core; +/* QT */ #include <qcopchannel_qws.h> #include <qtimer.h> QDataStream & operator << (QDataStream & str, bool b) { str << Q_INT8(b); return str; } QDataStream & operator >> (QDataStream & str, bool & b) { Q_INT8 l; str >> l; b = bool(l); return str; } /* * ! We don't put a Pixmap in!!!! */ QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { - qWarning( "Image request is %s %d %d", inf.file.latin1(), inf.width, inf.height ); + owarn << "Image request is " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl; return s << inf.file << inf.width << inf.height; } QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { s >> inf.file >> inf.pixmap >> inf.width >> inf.height; return s; } QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { return s << i.kind << i.file << i.info; } QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { s >> i.kind >> i.file >> i.info; return s; @@ -69,52 +73,52 @@ void SlaveMaster::thumbInfo( const QString& str) { } void SlaveMaster::imageInfo( const QString& str ) { m_inImageInfo.append( str ); if ( !m_started ) { QTimer::singleShot( 0, this, SLOT(slotTimerStart())); m_started = true; } } void SlaveMaster::thumbNail( const QString& str, int w, int h ) { if ( str.isEmpty() ) { - qWarning( "Asking for empty nail" ); + owarn << "Asking for empty nail" << oendl; return; } - qWarning( "Asking for thumbNail in size %d %d" + str, w,h ); + owarn << "Asking for thumbNail in size " << w << " " << h << "" + str << oendl; PixmapInfo item; item.file = str; item.width = w; item.height = h; item.pixmap = QPixmap(); m_inThumbNail.append( item ); if ( !m_started ) { QTimer::singleShot( 0, this, SLOT(slotTimerStart())); m_started = true; } } void SlaveMaster::recieve( const QCString& str, const QByteArray& at) { ImageInfos infos; PixmapInfos pixinfos; QDataStream stream( at, IO_ReadOnly ); if ( str == "pixmapsHandled(PixmapList)" ) stream >> pixinfos; else if ( str == "pixmapsHandled(StringList)" ) stream >> infos; - qWarning( "PixInfos %d", pixinfos.count() ); + owarn << "PixInfos " << pixinfos.count() << "" << oendl; bool got_data = ( !infos.isEmpty() || !pixinfos.isEmpty() ); if ( got_data ) { emit sig_start(); for ( ImageInfos::Iterator _it = infos.begin(); _it != infos.end(); ++_it ) { if ( (*_it).kind ) emit sig_fullInfo( (*_it).file, (*_it).info ); else emit sig_thumbInfo( (*_it).file, (*_it).info ); } for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index 17fa22c..0e2202a 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro @@ -22,15 +22,15 @@ SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ gui/imageinfoui.cpp # A list of source files INTERFACES = # list of ui files INCLUDEPATH += . $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopieui2 +LIBS += -lqpe -lopiecore2 -lopieui2 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp index 086b47f..fb7d5de 100644 --- a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp +++ b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp @@ -1,19 +1,23 @@ #include "jpeg_slave.h" - #include "thumbnailtool.h" PHUNK_VIEW_INTERFACE( "JPEG", JpegSlave ) -#include <qtopia/timestring.h> +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/timestring.h> +using namespace Opie::Core; + +/* QT */ #include <qobject.h> #include <qimage.h> /** exif.h */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> @@ -110,25 +114,25 @@ public: int getCompressionLevel() { return CompressionLevel; } QString getUserComment() { return UserComment; } QString getComment() { return Comment; } QImage getThumbnail(); bool isThumbnailSane(); bool isNullThumbnail() { return !isThumbnailSane(); } }; class FatalError { const char* ex; public: FatalError(const char* s) { ex = s; } - void debug_print() const { qWarning("exception: %s", ex ); } + void debug_print() const { owarn << "exception: " << ex << "" << oendl; } }; static unsigned char * LastExifRefd; static int ExifSettingsLength; static double FocalplaneXRes; static double FocalplaneUnits; static int MotorolaOrder = 0; static int SectionsRead; //static int HaveAll; @@ -253,25 +257,25 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode) int marker = 0; int got; unsigned int ll,lh; unsigned int itemlen; uchar * Data; for (a=0;a<7;a++){ marker = infile.getch(); if (marker != 0xff) break; if (a >= 6){ - qWarning( "too many padding bytes" ); + owarn << "too many padding bytes" << oendl; return false; } } if (marker == 0xff){ // 0xff is legal padding, but if we get that many, something's wrong. return false; } Sections[SectionsRead].Type = marker; @@ -318,25 +322,25 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode) return false; } Sections[SectionsRead].Data = Data; Sections[SectionsRead].Size = size; Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER; SectionsRead ++; //HaveAll = 1; } return true; case M_EOI: // in case it's a tables-only JPEG stream - qWarning( "No image in jpeg!" ); + owarn << "No image in jpeg!" << oendl; return false; case M_COM: // Comment section // pieczy 2002-02-12 // now the User comment goes to UserComment // so we can store a Comment section also in READ_EXIF mode process_COM(Data, itemlen); break; case M_JFIF: // Regular jpegs always have this tag, exif images have the exif // marker instead, althogh ACDsee will write images with both markers. @@ -717,25 +721,25 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa if (DIR_ENTRY_ADDR(DirStart, NumDirEntries) + 4 <= OffsetBase+ExifLength){ Offset = Get32u(DIR_ENTRY_ADDR(DirStart, NumDirEntries)); // There is at least one jpeg from an HP camera having an Offset of almost MAXUINT. // Adding OffsetBase to it produces an overflow, so compare with ExifLength here. // See http://bugs.kde.org/show_bug.cgi?id=54542 if (Offset && Offset < ExifLength){ SubdirStart = OffsetBase + Offset; if (SubdirStart > OffsetBase+ExifLength){ if (SubdirStart < OffsetBase+ExifLength+20){ // Jhead 1.3 or earlier would crop the whole directory! // As Jhead produces this form of format incorrectness, // I'll just let it pass silently - qWarning( "Thumbnail removed with Jhead 1.3 or earlier" ); + owarn << "Thumbnail removed with Jhead 1.3 or earlier" << oendl; }else{ return; } }else{ if (SubdirStart <= OffsetBase+ExifLength){ ProcessExifDir(SubdirStart, OffsetBase, ExifLength); } } } }else{ // The exif header ends before the last next directory pointer. } @@ -904,25 +908,25 @@ ExifData::ExifData() //-------------------------------------------------------------------------- bool ExifData::scan(const QString & path) { int ret; QFile f(path); f.open(IO_ReadOnly); // Scan the JPEG headers. ret = ReadJpegSections(f, READ_EXIF); if (ret == false){ - qWarning( "Not JPEG file!" ); + owarn << "Not JPEG file!" << oendl; DiscardData(); f.close(); return false; } f.close(); DiscardData(); //now make the strings clean, // for exmaple my Casio is a "QV-4000 " CameraMake = CameraMake.stripWhiteSpace(); CameraModel = CameraModel.stripWhiteSpace(); UserComment = UserComment.stripWhiteSpace(); diff --git a/noncore/graphics/opie-eye/slave/main.cpp b/noncore/graphics/opie-eye/slave/main.cpp index 37020e6..5b90483 100644 --- a/noncore/graphics/opie-eye/slave/main.cpp +++ b/noncore/graphics/opie-eye/slave/main.cpp @@ -22,38 +22,38 @@ int main( int argc, char* argv[] ) { &rec, SLOT(recieveAnswer(const QCString&,const QByteArray&))); QObject::connect(qApp,SIGNAL(appMessage(const QCString&, const QByteArray&)), &rec, SLOT(recieveAnswer(const QCString&,const QByteArray&))); return app.exec(); } #ifdef DEBUG_IT int main( int argc, char* argv[] ) { QString str = QString::fromLatin1(argv[2] ); QApplication app( argc, argv ); GifSlave slave; - qWarning( str +" "+slave.iconViewName(str ) ); - qWarning( str+" "+slave.fullImageInfo( str ) ); + owarn << str +" "+slave.iconViewName(str ) << oendl; + owarn << str+" "+slave.fullImageInfo( str ) << oendl; PNGSlave pngslave; - qWarning( str + " " + pngslave.iconViewName(str) ); - qWarning( str + " " + pngslave.fullImageInfo(str)); + owarn << str + " " + pngslave.iconViewName(str) << oendl; + owarn << str + " " + pngslave.fullImageInfo(str) << oendl; JpegSlave jpgslave; - qWarning( str + " " + jpgslave.iconViewName(str ) ); - qWarning( str + " " + jpgslave.fullImageInfo( str ) ); + owarn << str + " " + jpgslave.iconViewName(str ) << oendl; + owarn << str + " " + jpgslave.fullImageInfo( str ) << oendl; //return app.exec(); QPixmap pix = ThumbNailTool::getThumb( str, 24, 24 ); if ( pix.isNull() ) { - qWarning( "No Thumbnail" ); + owarn << "No Thumbnail" << oendl; pix = slave.pixmap(str, 24, 24); } if (!pix.isNull() ) { - qWarning( "Saving Thumbnail" ); + owarn << "Saving Thumbnail" << oendl; ThumbNailTool::putThumb( str, pix, 24, 24 ); } } #endif diff --git a/noncore/graphics/opie-eye/slave/slave.pro b/noncore/graphics/opie-eye/slave/slave.pro index 3f42495..903d667 100644 --- a/noncore/graphics/opie-eye/slave/slave.pro +++ b/noncore/graphics/opie-eye/slave/slave.pro @@ -1,18 +1,18 @@ -CONFIG += qte +CONFIG = qt TEMPLATE = app TARGET = opie-eye_slave DESTDIR = $(OPIEDIR)/bin HEADERS = gif_slave.h slaveiface.h slavereciever.h \ thumbnailtool.h png_slave.h jpeg_slave.h \ ../iface/slaveiface.h SOURCES = main.cpp gif_slave.cpp slavereciever.cpp \ slaveiface.cpp thumbnailtool.cpp png_slave.cpp \ jpeg_slave.cpp INCLUDEPATH += $(OPIEDIR)/include ../ DEPENDSPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 -include ( $(OPIEDIR)/include.pro )
\ No newline at end of file +include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/graphics/opie-eye/slave/slavereciever.cpp b/noncore/graphics/opie-eye/slave/slavereciever.cpp index bbbbb30..82b3d23 100644 --- a/noncore/graphics/opie-eye/slave/slavereciever.cpp +++ b/noncore/graphics/opie-eye/slave/slavereciever.cpp @@ -1,22 +1,26 @@ /* * GPLv2 zecke@handhelds.org */ #include "slavereciever.h" #include "slaveiface.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; +/* QT */ #include <qtimer.h> static SlaveObjects* _slaveObj = 0; QDataStream & operator << (QDataStream & str, bool b) { str << Q_INT8(b); return str; } QDataStream & operator >> (QDataStream & str, bool & b) { @@ -28,25 +32,25 @@ QDataStream & operator >> (QDataStream & str, bool & b) QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { return s << inf.file << inf.pixmap << inf.width << inf.height; } /* * GUI sends no QPIxmap!!! */ QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { s >> inf.file >> inf.width >> inf.height; - qWarning( "Recieved %s %d %d", inf.file.latin1(), inf.width, inf.height ); + owarn << "Recieved " << inf.file.latin1() << " " << inf.width << " " << inf.height << "" << oendl; return s; } QDataStream &operator<<( QDataStream& s, const ImageInfo& i) { return s << i.kind << i.file << i.info; } QDataStream &operator>>( QDataStream& s, ImageInfo& i ) { s >> i.kind >> i.file >> i.info; return s; } @@ -73,60 +77,60 @@ SlaveReciever::SlaveReciever( QObject* par) SlaveObjects *obj = slaveObjects(); // won't be changed SlaveMap::Iterator it; SlaveMap* map = slaveMap(); // SlaveMap won't be changed during execution!!! for(it = map->begin(); it != map->end(); ++it ) { obj->insert( it.key(), (*it.data())() ); } } SlaveReciever::~SlaveReciever() { } void SlaveReciever::recieveAnswer( const QCString& string, const QByteArray& ar) { - qWarning( "String is %s", string.data() ); + owarn << "String is " << string.data() << "" << oendl; QDataStream stream(ar, IO_ReadOnly ); QStringList lst; static ImageInfo inf; static PixmapInfo pix; if ( string == "thumbInfo(QString)" ) { stream >> inf.file; m_inList.append(inf); }else if ( string == "thumbInfos(QStringList)" ) { stream >> lst; for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { - qWarning( "Adding thumbinfo for file "+ *it ); + owarn << "Adding thumbinfo for file "+ *it << oendl; inf.file = (*it); m_inList.append(inf); } }else if ( string == "fullInfo(QString)" ) { inf.kind = true; stream >> inf.file; m_inList.append(inf); }else if ( string == "fullInfos(QStringList)" ) { stream >> lst; for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { - qWarning( "Adding fullInfo for"+ *it ); + owarn << "Adding fullInfo for"+ *it << oendl; inf.file = (*it); inf.kind = true; m_inList.append(inf); } }else if ( string == "pixmapInfo(QString,int,int)" ) { stream >> pix.file >> pix.width >> pix.height; m_inPix.append(pix); }else if ( string == "pixmapInfos(PixmapInfos)" ) { PixmapList list; stream >> list; for(PixmapList::Iterator it = list.begin(); it != list.end(); ++it ) { - qWarning( "Got %d %d " + (*it).file, (*it).width , (*it).height ); + owarn << "Got " << (*it).width << " " << (*it).height << " " + (*it).file << oendl; m_inPix.append(*it); } }else if ( string == "refUp()" ) { m_refs++; }else if ( string == "refDown()" ) { m_refs--; } if (!m_inf->isActive() && !m_inList.isEmpty() ) m_inf->start(5); if (!m_pix->isActive() && !m_inPix.isEmpty() ) @@ -172,55 +176,55 @@ void SlaveReciever::slotImageInfo() { } void SlaveReciever::slotThumbNail() { PixmapInfo inf = m_inPix.first(); m_inPix.remove( inf ); static SlaveObjects::Iterator it; static SlaveObjects* map = slaveObjects(); // SlaveMap won't be changed during execution!!! for(it = map->begin(); it != map->end(); ++it ) { SlaveInterface* iface = it.data(); if( iface->supports(inf.file ) ) { /* pixmap */ - qWarning( "Asking for thumbNail in size %d %d for "+inf.file, inf.width, inf.height ); + owarn << "Asking for thumbNail in size " << inf.width << " " << inf.height << " for "+inf.file << oendl; inf.pixmap = iface->pixmap(inf.file, 64, 64); m_outPix.append( inf ); break; } } if(m_inPix.isEmpty() ) m_pix->stop(); if(!m_out->isActive() && !m_outPix.isEmpty() ) m_out->start(100); } void SlaveReciever::slotSend() { m_out->stop(); - qWarning( "Sending %d %d", outPix().count(), outInf().count() ); + owarn << "Sending " << outPix().count() << " " << outInf().count() << "" << oendl; /* queue it and send */ /* if this ever gets a service introduce request queues * so we can differinatate between different clients */ if (! m_outPix.isEmpty() ) { QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(PixmapList)" ); answer << outPix(); for ( PixmapList::Iterator it = m_outPix.begin();it!=m_outPix.end();++it ) { - qWarning( "Sending out %s %d %d", (*it).file.latin1(), (*it).width, (*it).height ); + owarn << "Sending out " << (*it).file.latin1() << " " << (*it).width << " " << (*it).height << "" << oendl; } } if ( !m_outList.isEmpty() ) { QCopEnvelope answer("QPE/opie-eye", "pixmapsHandled(StringList)" ); answer << outInf(); for ( StringList::Iterator it = m_outList.begin();it!=m_outList.end();++it ) { - qWarning( "Sending out2 " + (*it).file ); + owarn << "Sending out2 " + (*it).file << oendl; } } m_outList.clear(); m_outPix.clear(); } diff --git a/noncore/graphics/opie-eye/slave/thumbnailtool.cpp b/noncore/graphics/opie-eye/slave/thumbnailtool.cpp index a202457..d2e169c 100644 --- a/noncore/graphics/opie-eye/slave/thumbnailtool.cpp +++ b/noncore/graphics/opie-eye/slave/thumbnailtool.cpp @@ -1,14 +1,19 @@ #include "thumbnailtool.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qfileinfo.h> #include <qdir.h> #include <qimage.h> #include <qpixmap.h> #include <qstring.h> static bool makeThumbDir( const QFileInfo& inf, bool make = false) { QDir dir( inf.dirPath()+ "/.opie-eye" ); if ( !dir.exists() ) if ( make ) return dir.mkdir(QString::null); else @@ -17,40 +22,40 @@ static bool makeThumbDir( const QFileInfo& inf, bool make = false) { } /* * check if the Opie opie-eye dir exists * check if a thumbnail exists * load the thumbnail * /foo/bar/imagefoo.gif * check for a png in /foo/bar/.opie-eye/%dx%d-imagefoo.gif */ QPixmap ThumbNailTool::getThumb( const QString& path, int width, int height ) { QFileInfo inf( path ); - qWarning( "Get Thumb" ); + owarn << "Get Thumb" << oendl; if ( !makeThumbDir( inf ) ) { QPixmap pix; return pix; } QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() ); - qWarning( inf.dirPath()+str ); + owarn << inf.dirPath()+str << oendl; return QPixmap( inf.dirPath()+str,"PNG" ); } void ThumbNailTool::putThumb( const QString& path, const QPixmap& pix, int width, int height ) { QFileInfo inf( path ); makeThumbDir( inf, true ); QString str = QString( "/.opie-eye/%1x%2-%3" ).arg( width ).arg( height ).arg( inf.fileName() ); - qWarning( inf.dirPath()+str ); + owarn << inf.dirPath()+str << oendl; pix.save( inf.dirPath()+str, "PNG" ); } QPixmap ThumbNailTool::scaleImage( QImage& img, int w, int h ) { double hs = (double)h / (double)img.height() ; double ws = (double)w / (double)img.width() ; double scaleFactor = (hs > ws) ? ws : hs; int smoothW = (int)(scaleFactor * img.width()); int smoothH = (int)(scaleFactor * img.height()); QPixmap pixmap; if ( img.width() <= w && img.height() <= h ) diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 28a42eb..36def67 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -124,25 +124,25 @@ void AudioWidget::sliderPressed() { } void AudioWidget::sliderReleased() { audioSliderBeingMoved = FALSE; if ( slider.width() == 0 ) return; long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); mediaPlayerState.setPosition( val ); } void AudioWidget::setPosition( long i ) { - // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); + // odebug << "<<<<<<<<<<<<<<<<<<<<<<<<set position " << i << "" << oendl; updateSlider( i, mediaPlayerState.length() ); } void AudioWidget::setLength( long max ) { updateSlider( mediaPlayerState.position(), max ); } void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { if ( mediaType == MediaPlayerState::Audio ) { // startTimer( 150 ); @@ -178,37 +178,37 @@ void AudioWidget::loadSkin() time.setFocusPolicy( QWidget::NoFocus ); time.setAlignment( Qt::AlignCenter ); // time.setFrame(FALSE); // changeTextColor( &time ); resizeEvent( 0 ); } void AudioWidget::setSeekable( bool isSeekable ) { if ( !isSeekable ) { - qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); + odebug << "<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>" << oendl; if( !slider.isHidden()) { slider.hide(); } disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); } else { // this stops the slider from being moved, thus // does not stop stream when it reaches the end slider.show(); - qDebug( " CONNECT SET POSTION " ); + odebug << " CONNECT SET POSTION " << oendl; connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); } } static QString timeAsString( long length ) { int minutes = length / 60; int seconds = length % 60; return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); @@ -262,25 +262,25 @@ void AudioWidget::timerEvent( QTimerEvent * ) { } else if ( skipDirection == -1 ) { mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); } } void AudioWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity hide(); - // qDebug("Audio F9"); + // odebug << "Audio F9" << oendl; e->accept(); break; case Key_F10: //contacts break; case Key_F11: //menu mediaPlayerState.toggleBlank(); e->accept(); break; case Key_F12: //home break; case Key_F13: //mail mediaPlayerState.toggleBlank(); diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index a42b8e5..5c24dbe 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp @@ -97,28 +97,28 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) } if ( initMode == InitializeImmediately ) { initialize(); m_initialized = true; } else start(); } void Lib::run() { - qDebug( "Lib::run() started" ); + odebug << "Lib::run() started" << oendl; initialize(); m_initialized = true; - qDebug( "Lib::run() finished" ); + odebug << "Lib::run() finished" << oendl; } void Lib::initialize() { m_duringInitialization = true; m_xine = xine_new( ); QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; xine_config_load( m_xine, QFile::encodeName( configPath ) ); xine_init( m_xine ); @@ -206,25 +206,25 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) { //m_queue = xine_event_new_queue (m_stream); //xine_event_create_listener_thread (m_queue, xine_event_handler, this); if ( !xine_open( m_stream, str.utf8().data() ) ) { return 0; } return xine_play( m_stream, startPos, start_time); } void Lib::stop() { assert( m_initialized ); - qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); + odebug << "<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>" << oendl; xine_stop( m_stream ); } void Lib::pause( bool toggle ) { assert( m_initialized ); xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); } int Lib::speed() const { assert( m_initialized ); @@ -318,27 +318,27 @@ QString Lib::metaInfo( int number) const { int Lib::error() const { assert( m_initialized ); return xine_get_error( m_stream ); }; void Lib::ensureInitialized() { if ( m_initialized ) return; - qDebug( "waiting for initialization thread to finish" ); + odebug << "waiting for initialization thread to finish" << oendl; wait(); - qDebug( "initialization thread finished!" ); + odebug << "initialization thread finished!" << oendl; } void Lib::setWidget( XineVideoWidget *widget ) { m_wid = widget; resize ( m_wid-> size ( ) ); ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); m_wid->repaint(); } void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) { @@ -413,20 +413,20 @@ void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { ( (Lib*)user_data)->handleXineEvent( t ); } void Lib::xine_display_frame( void* user_data, uint8_t *frame, int width, int height, int bytes ) { ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); } void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { assert( m_initialized ); if ( !m_video ) { - qWarning("not showing video now"); + owarn << "not showing video now" << oendl; return; } assert( m_wid ); m_wid-> setVideoFrame ( frame, width, height, bytes ); } diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index a236775..7e38fc7 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -143,25 +143,25 @@ void MediaPlayer::next() { if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist if ( playList.next() ) { play(); } else if ( mediaPlayerState.isLooping() ) { if ( playList.first() ) { play(); } } else { mediaPlayerState.setList(); } } else { //if playing from file list, let's just stop - qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); + odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl; mediaPlayerState.setPlaying(false); mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); if(l) mediaPlayerState.setLooping(l); if(r) mediaPlayerState.setShuffled(r); } qApp->processEvents(); } void MediaPlayer::startDecreasingVolume() { volumeDirection = -1; startTimer( 100 ); @@ -276,69 +276,69 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { } } } void MediaPlayer::blank( bool b ) { fd=open("/dev/fb0",O_RDWR); #ifdef QT_QWS_SL5XXX fl= open( "/dev/fl", O_RDWR ); #endif if (fd != -1) { if ( b ) { - qDebug("do blanking"); + odebug << "do blanking" << oendl; #ifdef QT_QWS_SL5XXX ioctl( fd, FBIOBLANK, 1 ); if(fl !=-1) { ioctl( fl, 2 ); ::close(fl); } #else ioctl( fd, FBIOBLANK, 3 ); #endif isBlanked = TRUE; } else { - qDebug("do unblanking"); + odebug << "do unblanking" << oendl; ioctl( fd, FBIOBLANK, 0); #ifdef QT_QWS_SL5XXX if(fl != -1) { ioctl( fl, 1); ::close(fl); } #endif isBlanked = FALSE; } close( fd ); } else { - qDebug("<< /dev/fb0 could not be opened >>"); + odebug << "<< /dev/fb0 could not be opened >>" << oendl; } } void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity break; case Key_F10: //contacts break; case Key_F11: //menu break; case Key_F12: //home - qDebug("Blank here"); + odebug << "Blank here" << oendl; // mediaPlayerState->toggleBlank(); break; case Key_F13: //mail - qDebug("Blank here"); + odebug << "Blank here" << oendl; // mediaPlayerState->toggleBlank(); break; } } void MediaPlayer::cleanUp() {// this happens on closing Config cfg( "OpiePlayer" ); mediaPlayerState.writeConfig( cfg ); playList.writeDefaultPlaylist( ); // QPEApplication::grabKeyboard(); // QPEApplication::ungrabKeyboard(); diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index 26d5e15..95dbab5 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp @@ -28,68 +28,68 @@ Boston, MA 02111-1307, USA. */ #include "om3u.h" //extern PlayListWidget *playList; Om3u::Om3u( const QString &filePath, int mode) : QStringList (){ -qDebug("<<<<<<<new m3u "+filePath); +odebug << "<<<<<<<new m3u "+filePath << oendl; f.setName(filePath); f.open(mode); } Om3u::~Om3u(){} void Om3u::readM3u() { -// qDebug("<<<<<<reading m3u "+f.name()); +// odebug << "<<<<<<reading m3u "+f.name() << oendl; QTextStream t(&f); t.setEncoding(QTextStream::UnicodeUTF8); QString s; while ( !t.atEnd() ) { s=t.readLine(); -// qDebug(s); +// odebug << s << oendl; if( s.find( "#", 0, TRUE) == -1 ) { if( s.left(2) == "E:" || s.left(2) == "P:" ) { s = s.right( s.length() -2 ); QFileInfo f( s ); QString name = f.baseName(); name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); s=s.replace( QRegExp( "\\" ), "/" ); append(s); -// qDebug(s); +// odebug << s << oendl; } else { // is url QString name; name = s; append(name); } } } } void Om3u::readPls() { //it's a pls file QTextStream t( &f ); t.setEncoding(QTextStream::UnicodeUTF8); QString s; while ( !t.atEnd() ) { s = t.readLine(); if( s.left(4) == "File" ) { s = s.right( s.length() - s.find("=",0,true)-1 ); s = s.stripWhiteSpace(); s.replace( QRegExp( "%20" )," "); -// qDebug( "adding " + s + " to playlist" ); +// odebug << "adding " + s + " to playlist" << oendl; // numberofentries=2 // File1=http // Title // Length // Version // File2=http s = s.replace( QRegExp( "\\" ), "/" ); QFileInfo f( s ); QString name = f.baseName(); if( name.left( 4 ) == "http" ) { name = s.right( s.length() - 7); } else { @@ -105,41 +105,41 @@ void Om3u::readPls() { //it's a pls file append(s); } } } } void Om3u::write() { //writes list to m3u file QString list; QTextStream t(&f); t.setEncoding(QTextStream::UnicodeUTF8); if(count()>0) { for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { -// qDebug(*it); +// odebug << *it << oendl; t << *it << "\n"; } } // f.close(); } void Om3u::add(const QString &filePath) { //adds to m3u file append(filePath); } void Om3u::remove(const QString &filePath) { //removes from m3u list QString list, currentFile; if(count()>0) { for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { currentFile=*it; - // qDebug(*it); + // odebug << *it << oendl; if( filePath != currentFile) list += currentFile+"\n"; } f.writeBlock( list, list.length() ); } } void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file f.close(); f.remove(); diff --git a/noncore/multimedia/opieplayer2/playlistselection.cpp b/noncore/multimedia/opieplayer2/playlistselection.cpp index 015896f..3499837 100644 --- a/noncore/multimedia/opieplayer2/playlistselection.cpp +++ b/noncore/multimedia/opieplayer2/playlistselection.cpp @@ -35,46 +35,46 @@ public: }; const DocLnk *file() const { return fl; } private: const DocLnk *fl; }; PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) : QListView( parent, name ) { -// qDebug("starting playlistselector"); +// odebug << "starting playlistselector" << oendl; // #ifdef USE_PLAYLIST_BACKGROUND // setStaticBackground( TRUE ); // setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); // setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); // #endif // addColumn("Title",236); // setAllColumnsShowFocus( TRUE ); addColumn( tr( "Playlist Selection" ) ); header()->hide(); setSorting( -1, FALSE ); } PlayListSelection::~PlayListSelection() { } // #ifdef USE_PLAYLIST_BACKGROUND void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { -// qDebug("drawBackground"); +// odebug << "drawBackground" << oendl; p->fillRect( r, QBrush( white ) ); // QImage logo = Resource::loadImage( "launcher/opielogo" ); // if ( !logo.isNull() ) // p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); } // #endif void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { if ( event->state() == QMouseEvent::LeftButton ) { QListViewItem *currentItem = selectedItem(); QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); @@ -175,32 +175,32 @@ bool PlayListSelection::last() { void PlayListSelection::unSelect() { //QListViewItem *item = selectedItem(); setSelected( currentItem(), FALSE); } void PlayListSelection::writeCurrent( Config& cfg ) { cfg.setGroup("PlayList"); QListViewItem *item = selectedItem(); if ( item ) cfg.writeEntry("current", item->text(0) ); - qDebug(item->text(0)); + odebug << item->text(0) << oendl; } void PlayListSelection::setSelectedItem(const QString &strk ) { unSelect(); QListViewItemIterator it( this ); for ( ; it.current(); ++it ) { -// qDebug( it.current()->text(0)); +// odebug << it.current()->text(0) << oendl; if( strk == it.current()->text(0)) { -// qDebug( "We have a match "+strk); +// odebug << "We have a match "+strk << oendl; setSelected( it.current(), TRUE); ensureItemVisible( it.current() ); return; } } // setSelected( item, TRUE ); // ensureItemVisible( selectedItem() ); } diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 4460833..956d206 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -173,29 +173,29 @@ void PlayListWidget::initializeStates() { d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); d->playListFrame->show(); } void PlayListWidget::writeDefaultPlaylist() { Config config( "OpiePlayer" ); config.setGroup( "PlayList" ); QString filename=QPEApplication::documentDir() + "/default.m3u"; QString currentString = config.readEntry( "CurrentPlaylist", filename); if( currentString == filename) { Om3u *m3uList; - // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); + // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl; if( d->selectedFiles->first() ) { m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); do { - // qDebug(d->selectedFiles->current()->file()); + // odebug << d->selectedFiles->current()->file() << oendl; m3uList->add( d->selectedFiles->current()->file() ); } while ( d->selectedFiles->next() ); m3uList->write(); m3uList->close(); delete m3uList; } } } @@ -316,25 +316,25 @@ void PlayListWidget::addAllVideoToList() { filename = videoIt.current()->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); } tabWidget->setCurrentPage(0); writeCurrentM3u(); d->selectedFiles->first(); } void PlayListWidget::setDocument( const QString& fileref ) { - // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); + // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl; fromSetDocument = TRUE; QFileInfo fileInfo(fileref); if ( !fileInfo.exists() ) { QMessageBox::warning( this, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); return; } clearList(); QString extension = fileInfo.extension(false); @@ -392,25 +392,25 @@ bool PlayListWidget::prev() { if ( mediaPlayerState->isLooping() ) { return d->selectedFiles->last(); } else { return FALSE; } } return TRUE; } } bool PlayListWidget::next() { -//qDebug("<<<<<<<<<<<<next()"); +//odebug << "<<<<<<<<<<<<next()" << oendl; if ( mediaPlayerState->isShuffled() ) { return prev(); } else { if ( !d->selectedFiles->next() ) { if ( mediaPlayerState->isLooping() ) { return d->selectedFiles->first(); } else { return FALSE; } } return TRUE; } @@ -603,25 +603,25 @@ bool PlayListWidget::inFileListMode() const return tab == AudioFiles || tab == VideoFiles; } void PlayListWidget::openURL() { // http://66.28.164.33:2080 // http://somafm.com/star0242.m3u QString filename, name; InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { filename = fileDlg->text(); - qDebug( "Selected filename is " + filename ); + odebug << "Selected filename is " + filename << oendl; // Om3u *m3uList; DocLnk lnk; Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); if(filename.left(4) == "http") { QString m3uFile, m3uFilePath; if(filename.find(":",8,TRUE) != -1) { //found a port m3uFile = filename.left( filename.find( ":",8,TRUE)); m3uFile = m3uFile.right( 7); } else if(filename.left(4) == "http"){ m3uFile=filename; @@ -679,56 +679,56 @@ void PlayListWidget::openFile() { QString str = OFileDialog::getOpenFileName( 1, cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", types, 0 ); if(str.left(2) == "//") { str=str.right(str.length()-1); } cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); if( !str.isEmpty() ) { - qDebug( "Selected filename is " + str ); + odebug << "Selected filename is " + str << oendl; filename = str; DocLnk lnk; if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { readListFromFile( filename ); } else { lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk ); writeCurrentM3u(); d->selectedFiles->setSelectedItem( lnk.name() ); } } } void PlayListWidget::readListFromFile( const QString &filename ) { - qDebug( "read list filename " + filename ); + odebug << "read list filename " + filename << oendl; QFileInfo fi(filename); Om3u *m3uList; QString s, name; m3uList = new Om3u( filename, IO_ReadOnly ); if(fi.extension(false).find("m3u",0,false) != -1 ) m3uList->readM3u(); else if(fi.extension(false).find("pls",0,false) != -1 ) m3uList->readPls(); DocLnk lnk; for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { s = *it; - // qDebug(s); + // odebug << s << oendl; if(s.left(4)=="http") { lnk.setName( s ); //sets file name lnk.setIcon("opieplayer2/musicfile"); lnk.setFile( s ); //sets file name } else { //is file lnk.setName( QFileInfo(s).baseName()); if(s.left(1) != "/") { lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); } else { lnk.setFile( s); @@ -744,39 +744,39 @@ void PlayListWidget::readListFromFile( const QString &filename ) { currentPlayList=filename; m3uList->close(); delete m3uList; d->selectedFiles->setSelectedItem( s); setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); } // writes current playlist to current m3u file */ void PlayListWidget::writeCurrentM3u() { - qDebug("writing to current m3u"); + odebug << "writing to current m3u" << oendl; Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); Om3u *m3uList; m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); if( d->selectedFiles->first()) { do { - // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); + // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; m3uList->add( d->selectedFiles->current()->file() ); } while ( d->selectedFiles->next() ); - // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); + // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; m3uList->write(); m3uList->close(); } delete m3uList; } /* writes current playlist to m3u file */ void PlayListWidget::writem3u() { //InputDilog *fileDlg; //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); @@ -803,63 +803,63 @@ void PlayListWidget::writem3u() { cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", types, 0 ); if(str.left(2) == "//") str=str.right(str.length()-1); cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); QString name, filename, list; Om3u *m3uList; if( !str.isEmpty() ) { name = str; // name = fileDlg->text(); -// qDebug( filename ); +// odebug << filename << oendl; if( name.find("/",0,true) != -1) {// assume they specify a file path filename = name; name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); } else //otherwise dump it somewhere noticable filename = QPEApplication::documentDir() + "/" + name; if( filename.right( 3 ) != "m3u" ) //needs filename extension filename += ".m3u"; if( d->selectedFiles->first()) { //ramble through playlist view m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); do { m3uList->add( d->selectedFiles->current()->file()); } while ( d->selectedFiles->next() ); - // qDebug( list ); + // odebug << list << oendl; m3uList->write(); m3uList->close(); delete m3uList; //delete fileDlg; DocLnk lnk; lnk.setFile( filename); lnk.setIcon("opieplayer2/playlist2"); lnk.setName( name); //sets file name - // qDebug(filename); + // odebug << filename << oendl; Config config( "OpiePlayer" ); config.setGroup( "PlayList" ); config.writeEntry("CurrentPlaylist",filename); currentPlayList=filename; if(!lnk.writeLink()) { - qDebug("Writing doclink did not work"); + odebug << "Writing doclink did not work" << oendl; } setCaption(tr("OpiePlayer: ") + name); } } } void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_F9: //activity // if(audioUI->isHidden()) @@ -875,25 +875,25 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { // doBlank(); break; case Key_F13: //mail // doUnblank(); break; case Key_Q: //add to playlist addSelected(); break; case Key_R: //remove from playlist removeSelected(); break; // case Key_P: //play - // qDebug("Play"); + // odebug << "Play" << oendl; // playSelected(); // break; case Key_Space: // playSelected(); puh break; case Key_1: tabWidget->setCurrentPage( 0 ); break; case Key_2: tabWidget->setCurrentPage( 1 ); break; case Key_3: @@ -905,25 +905,25 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { case Key_Down: if ( !d->selectedFiles->next() ) d->selectedFiles->first(); break; case Key_Up: if ( !d->selectedFiles->prev() ) // d->selectedFiles->last(); break; } } void PlayListWidget::pmViewActivated(int index) { -// qDebug("%d", index); +// odebug << "" << index << "" << oendl; switch(index) { case -16: { mediaPlayerState->toggleFullscreen(); bool b=mediaPlayerState->isFullscreen(); pmView->setItemChecked( index, b); Config cfg( "OpiePlayer" ); cfg.writeEntry( "FullScreen", b ); } break; }; } @@ -935,25 +935,25 @@ void PlayListWidget::populateSkinsMenu() { Config cfg( "OpiePlayer" ); cfg.setGroup("Options" ); QString skin = cfg.readEntry( "Skin", "default" ); QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); skinsDir.setFilter( QDir::Dirs ); skinsDir.setSorting(QDir::Name ); const QFileInfoList *skinslist = skinsDir.entryInfoList(); QFileInfoListIterator it( *skinslist ); QFileInfo *fi; while ( ( fi = it.current() ) ) { skinName = fi->fileName(); -// qDebug( fi->fileName() ); +// odebug << fi->fileName() << oendl; if( skinName != "." && skinName != ".." && skinName !="CVS" ) { item = skinsMenu->insertItem( fi->fileName() ) ; } if( skinName == "default" ) { defaultSkinIndex = item; } if( skinName == skin ) { skinsMenu->setItemChecked( item, TRUE ); } ++it; } } @@ -991,25 +991,25 @@ PlayListWidget::Entry PlayListWidget::currentEntry() const return Entry( lnk->name(), lnk->file() ); } return Entry( currentFileListPathName() ); } QString PlayListWidget::currentFileListPathName() const { return currentFileListView->currentItem()->text( 3 ); } void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { - qDebug("qcop message "+msg ); + odebug << "qcop message "+msg << oendl; QDataStream stream ( data, IO_ReadOnly ); if ( msg == "play()" ) { //plays current selection btnPlay( true); } else if ( msg == "stop()" ) { mediaPlayerState->setPlaying( false); } else if ( msg == "togglePause()" ) { mediaPlayerState->togglePaused(); } else if ( msg == "next()" ) { //select next in list mediaPlayerState->setNext(); } else if ( msg == "prev()" ) { //select previous in list mediaPlayerState->setPrev(); } else if ( msg == "toggleLooping()" ) { //loop or not loop diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index 2ff190d..922f9d7 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp @@ -174,20 +174,20 @@ PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name ) PlayListWidgetGui::~PlayListWidgetGui() { } void PlayListWidgetGui::setView( char view ) { if ( view == 'l' ) showMaximized(); else hide(); } void PlayListWidgetGui::setActiveWindow() { - // qDebug("SETTING active window"); + // odebug << "SETTING active window" << oendl; // When we get raised we need to ensure that it switches views MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType(); mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate mediaPlayerState->setDisplayType( origDisplayType ); // now switch back } diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp index 7c38983..84f5f87 100644 --- a/noncore/multimedia/opieplayer2/skin.cpp +++ b/noncore/multimedia/opieplayer2/skin.cpp @@ -169,29 +169,29 @@ SkinCache::SkinCache() // ... and one background pixmap m_backgroundPixmapCache.setMaxCost( 1 ); } SkinData *SkinCache::lookupAndTake( const QString &skinPath, const QString &fileNameInfix ) { QString key = skinPath + fileNameInfix; SkinData *data = m_cache.take( key ); if ( !data ) data = new SkinData; else - qDebug( "SkinCache: hit" ); + odebug << "SkinCache: hit" << oendl; QPixmap *bgPixmap = m_backgroundPixmapCache.find( skinPath ); if ( bgPixmap ) { - qDebug( "SkinCache: hit on bgpixmap" ); + odebug << "SkinCache: hit on bgpixmap" << oendl; data->backgroundPixmap = *bgPixmap; } else data->backgroundPixmap = QPixmap(); return data; } void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, SkinData *data ) { QPixmap *backgroundPixmap = new QPixmap( data->backgroundPixmap ); @@ -209,114 +209,114 @@ void SkinCache::store( const QString &skinPath, const QString &fileNameInfix, Sk } SkinLoader::IncrementalLoader::IncrementalLoader( const Info &info ) : m_skin( info.skinName, info.fileNameInfix ), m_info( info ) { m_currentState = LoadBackgroundPixmap; } SkinLoader::IncrementalLoader::LoaderResult SkinLoader::IncrementalLoader::loadStep() { switch ( m_currentState ) { case LoadBackgroundPixmap: - qDebug( "load bgpixmap" ); + odebug << "load bgpixmap" << oendl; m_skin.backgroundPixmap(); m_currentState = LoadButtonUpImage; break; case LoadButtonUpImage: - qDebug( "load upimage" ); + odebug << "load upimage" << oendl; m_skin.buttonUpImage(); m_currentState = LoadButtonDownImage; break; case LoadButtonDownImage: - qDebug( "load downimage" ); + odebug << "load downimage" << oendl; m_skin.buttonDownImage(); m_currentState = LoadButtonMasks; m_currentButton = 0; break; case LoadButtonMasks: - qDebug( "load button masks %i", m_currentButton ); + odebug << "load button masks " << m_currentButton << "" << oendl; m_skin.buttonMaskImage( m_info.buttonInfo[ m_currentButton ].fileName ); m_currentButton++; if ( m_currentButton >= m_info.buttonCount ) m_currentState = LoadButtonMask; break; case LoadButtonMask: - qDebug( "load whole mask" ); + odebug << "load whole mask" << oendl; m_skin.buttonMask( m_info.buttonInfo, m_info.buttonCount ); return LoadingCompleted; } return MoreToCome; } SkinLoader::SkinLoader() : m_currentLoader( 0 ), m_timerId( -1 ) { } SkinLoader::~SkinLoader() { - qDebug( "SkinLoader::~SkinLoader()" ); + odebug << "SkinLoader::~SkinLoader()" << oendl; killTimers(); delete m_currentLoader; } void SkinLoader::schedule( const MediaWidget::GUIInfo &guiInfo ) { schedule( Skin::defaultSkinName(), guiInfo ); } void SkinLoader::schedule( const QString &skinName, const MediaWidget::GUIInfo &guiInfo ) { pendingSkins << Info( skinName, guiInfo ); } void SkinLoader::start() { assert( m_timerId == -1 ); m_timerId = startTimer( 100 /* ms */ ); - qDebug( "SkinLoader::start() %d jobs", pendingSkins.count() ); + odebug << "SkinLoader::start() " << pendingSkins.count() << " jobs" << oendl; } void SkinLoader::timerEvent( QTimerEvent *ev ) { if ( ev->timerId() != m_timerId ) { QObject::timerEvent( ev ); return; } if ( !m_currentLoader ) { if ( pendingSkins.isEmpty() ) { - qDebug( "all jobs done" ); + odebug << "all jobs done" << oendl; killTimer( m_timerId ); m_timerId = -1; // ### qt3: use deleteLater(); QTimer::singleShot( 0, this, SLOT( deleteMe() ) ); return; } Info nfo = *pendingSkins.begin(); pendingSkins.remove( pendingSkins.begin() ); m_currentLoader = new IncrementalLoader( nfo ); - qDebug( "new loader %i jobs left", pendingSkins.count() ); + odebug << "new loader " << pendingSkins.count() << " jobs left" << oendl; } if ( m_currentLoader->loadStep() == IncrementalLoader::LoadingCompleted ) { delete m_currentLoader; m_currentLoader = 0; } - qDebug( "finished step" ); + odebug << "finished step" << oendl; } void SkinLoader::deleteMe() { delete this; } /* vim: et sw=4 ts=4 */ diff --git a/noncore/multimedia/opieplayer2/threadutil.cpp b/noncore/multimedia/opieplayer2/threadutil.cpp index fb951b4..d8b8abe 100644 --- a/noncore/multimedia/opieplayer2/threadutil.cpp +++ b/noncore/multimedia/opieplayer2/threadutil.cpp @@ -178,34 +178,34 @@ Thread::Thread() Thread::~Thread() { assert( d->isRunning == false ); delete d; } void Thread::start() { AutoLock lock( d->guard ); if ( d->isRunning ) { - qDebug( "ThreadUtil::Thread::start() called for running thread." ); + odebug << "ThreadUtil::Thread::start() called for running thread." << oendl; return; } pthread_attr_t attributes; pthread_attr_init( &attributes ); pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM ); int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d ); if ( err != 0 ) { - qDebug( "ThreadUtil::Thread::start() : can't create thread: %s", strerror( err ) ); + odebug << "ThreadUtil::Thread::start() : can't create thread: " << strerror( err ) << "" << oendl; pthread_attr_destroy( &attributes ); return; } pthread_attr_destroy( &attributes ); } void Thread::terminate() { AutoLock lock( d->guard ); if ( !d->isRunning ) return; @@ -275,25 +275,25 @@ ChannelMessage::ChannelMessage( int type ) } ChannelMessage::~ChannelMessage() { if ( m_guard.isLocked() ) m_guard.unlock(); } void ChannelMessage::reply() { if ( !m_isCall ) { - qDebug( "ChannelMessage::reply() - can't reply oneway message!" ); + odebug << "ChannelMessage::reply() - can't reply oneway message!" << oendl; return; } if ( m_inEventHandler ) { m_replied = true; return; } m_condition.wakeOne(); m_guard.unlock(); } diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 8f11b2e..94f99f8 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -84,43 +84,43 @@ XineControl::~XineControl() { QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; } #endif delete libXine; } void XineControl::play( const QString& fileName ) { hasVideoChannel = FALSE; hasAudioChannel = FALSE; m_fileName = fileName; - qDebug("<<FILENAME: " + fileName + ">>>>"); + odebug << "<<FILENAME: " + fileName + ">>>>" << oendl; if ( !libXine->play( fileName, 0, 0 ) ) { QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); // toggle stop so the the play button is reset mediaPlayerState.setPlaying( false ); return; } mediaPlayerState.setPlaying( true ); MediaPlayerState::DisplayType displayType; if ( !libXine->hasVideo() ) { displayType = MediaPlayerState::Audio; - qDebug("HAS AUDIO"); + odebug << "HAS AUDIO" << oendl; libXine->setShowVideo( false ); hasAudioChannel = TRUE; } else { displayType = MediaPlayerState::Video; - qDebug("HAS VIDEO"); + odebug << "HAS VIDEO" << oendl; libXine->setShowVideo( true ); hasVideoChannel = TRUE; } // determine if slider is shown mediaPlayerState.setIsSeekable( libXine->isSeekable() ); // which gui (video / audio) mediaPlayerState.setDisplayType( displayType ); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( !disabledSuspendScreenSaver ) { disabledSuspendScreenSaver = TRUE; @@ -234,25 +234,25 @@ QString XineControl::getMetaInfo() { } if ( !libXine->metaInfo( 5 ).isEmpty() ) { returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); } return returnString; } QString XineControl::getErrorCode() { int errorCode = libXine->error(); - qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); + odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl; if ( errorCode == 1 ) { return tr( "No input plugin found for this media type" ); } else if ( errorCode == 2 ) { return tr( "No demux plugin found for this media type" ); } else if ( errorCode == 3 ) { return tr( "Demuxing failed for this media type" ); } else if ( errorCode == 4 ) { return tr( "Malformed MRL" ); } else { return tr( "Some other error" ); } diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp index ce49e96..5319d97 100644 --- a/noncore/multimedia/opierec/device.cpp +++ b/noncore/multimedia/opierec/device.cpp @@ -1,50 +1,50 @@ // device.cpp #include "device.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> +using namespace Opie::Core; - +/* STD */ #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> #include <sys/soundcard.h> #include <unistd.h> -#include<sys/wait.h> -// #include <sys/stat.h> -// #include <sys/time.h> -// #include <sys/types.h> +#include <sys/wait.h> #include <unistd.h> #include <errno.h> //extern QtRec *qperec; Device::Device( QObject * parent, const char * dsp, const char * mixr, bool record ) : QObject( parent) { dspstr = (char *)dsp; mixstr = (char *)mixr; devForm=-1; devCh=-1; devRate=-1; if( !record){ //playing - qDebug("setting up DSP for playing"); + odebug << "setting up DSP for playing" << oendl; flags = O_WRONLY; } else { //recording - qDebug("setting up DSP for recording"); + odebug << "setting up DSP for recording" << oendl; flags = O_RDWR; // flags = O_RDONLY; // selectMicInput(); } } bool Device::openDsp() { if( openDevice( flags) == -1) { perror("<<<<<<<<<<<<<<ioctl(\"Open device\")"); return false; @@ -87,40 +87,40 @@ int Device::getInVolume() { void Device::changedOutVolume(int vol) { int level = (vol << 8) + vol; int fd = 0; if ((fd = open("/dev/mixer", O_RDWR))>=0) { if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &level) == -1) perror("ioctl(\"MIXER_IN_WRITE\")"); Config cfg("qpe"); cfg.setGroup("Volume"); cfg.writeEntry("VolumePercent", QString::number( vol )); QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; - qWarning("changing output vol %d", vol); + owarn << "changing output vol " << vol << "" << oendl; } ::close(fd); } void Device::changedInVolume(int vol ) { int level = (vol << 8) + vol; int fd = 0; if ((fd = open("/dev/mixer", O_RDWR))>=0) { if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &level) == -1) perror("ioctl(\"MIXER_IN_WRITE\")"); Config cfg("qpe"); cfg.setGroup("Volume"); cfg.writeEntry("Mic", QString::number(vol )); QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; - qWarning("changing input volume %d", vol); + owarn << "changing input volume " << vol << "" << oendl; } ::close(fd); } bool Device::selectMicInput() { int md=0; int info=MIXER_WRITE(SOUND_MIXER_MIC); md = ::open( "/dev/mixer", O_RDWR ); if ( md == -1) perror("open(\"/dev/mixer\")"); else { @@ -140,56 +140,56 @@ int Device::openDevice( int flags) { int pipefd[2]; char message[20]; if (pipe(pipefd) == -1){ perror ("Error creating pipe"); exit(1); } switch (pid = fork()) { case -1: perror("The fork failed!"); break; case 0: { */ -qDebug("Opening %s",dspstr); +odebug << "Opening " << dspstr << "" << oendl; if (( sd = ::open( dspstr, flags)) == -1) { perror("open(\"/dev/dsp\")"); QString errorMsg="Could not open audio device\n /dev/dsp\n" +(QString)strerror(errno); - qDebug("XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg); + odebug << "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl; return -1; } -qDebug("Opening mixer"); +odebug << "Opening mixer" << oendl; int mixerHandle=0; if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) { perror("open(\"/dev/mixer\")"); QString errorMsg="Could not open audio device\n /dev/dsp\n" +(QString)strerror(errno); - qDebug("XXXXXXXXXXXXXXXXXXXXXX "+errorMsg); + odebug << "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg << oendl; } if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){ perror("ioctl RESET"); } // sprintf(message, "%d", sd); /* QFile f1("/pid"); f1.open(IO_WriteOnly ); f1.writeBlock(message, strlen(message)); f1.close(); */ /* close(pipefd[0]); write(pipefd[1], message, sizeof(message)); close(pipefd[1]); - // qDebug("%d",soundDevice->sd ); + // odebug << "" << soundDevice->sd << "" << oendl; _exit(0); } default: // pid greater than zero is parent getting the child's pid printf("Child's pid is %d\n",pid); QString s; close(pipefd[1]); read(pipefd[0], message, sizeof(message)); s = message; close(pipefd[0]); // while(wait(NULL)!=pid) @@ -197,74 +197,74 @@ qDebug("Opening mixer"); printf("child %ld terminated normally, return status is zero\n", (long) pid); */ // filePara.sd=(long) pid; /* QFile f2("/pid"); f2.open(IO_ReadOnly); QTextStream t(&f2); // for(int f=0; f < t.atEnd() ;f++) { s = t.readLine(); // } */ // bool ok; // sd = s.toInt(&ok, 10); -// qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s); +// odebug << "<<<<<<<<<<<<<>>>>>>>>>>>>"+s << oendl; // f2.close(); // } ::close(mixerHandle ); -// qDebug("open device %s", dspstr); -// qDebug("success! %d",sd); +// odebug << "open device " << dspstr << "" << oendl; +// odebug << "success! " << sd << "" << oendl; return sd; } bool Device::closeDevice( bool) { // if(b) {//close now // if (ioctl( sd, SNDCTL_DSP_RESET, 0) == -1) { // perror("ioctl(\"SNDCTL_DSP_RESET\")"); // } // } else { //let play // if (ioctl( sd, SNDCTL_DSP_SYNC, 0) == -1) { // perror("ioctl(\"SNDCTL_DSP_SYNC\")"); // } // } ::close( sd); //close sound device // sdfd=0; // sd=0; -// qDebug("closed dsp"); +// odebug << "closed dsp" << oendl; return true; } bool Device::setDeviceFormat( int form) { - qDebug("set device res %d %d", form, sd); + odebug << "set device res " << form << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_SETFMT, &form)==-1) { //set format perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); return false; } devRes=form; return true; } bool Device::setDeviceChannels( int ch) { - qDebug("set channels %d %d", ch, sd); + odebug << "set channels " << ch << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_CHANNELS, &ch)==-1) { perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); return false; } devCh=ch; return true; } bool Device::setDeviceRate( int rate) { - qDebug("set rate %d %d", rate, sd); + odebug << "set rate " << rate << " " << sd << "" << oendl; if (ioctl( sd, SNDCTL_DSP_SPEED, &rate) == -1) { perror("ioctl(\"SNDCTL_DSP_SPEED\")"); return false; } devRate=rate; return true; } int Device::getRes() { return devRes; @@ -309,27 +309,27 @@ int Device::getDeviceBits() { int Device::getDeviceChannels() { int dCh=0; if (ioctl( sd, SOUND_PCM_READ_CHANNELS, &dCh) == -1) { perror("ioctl(\"SNDCTL_PCM_READ_CHANNELS\")"); } return dCh; } int Device::getDeviceFragSize() { int frag_size; if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { - qDebug("no fragsize"); + odebug << "no fragsize" << oendl; } else { - qDebug("driver says frag size is %d", frag_size); + odebug << "driver says frag size is " << frag_size << "" << oendl; } return frag_size; } bool Device::setFragSize(int frag) { if (ioctl(sd, SNDCTL_DSP_SETFRAGMENT, &frag)) { perror("ioctl(\"SNDCTL_DSP_SETFRAGMENT\")"); return false; } return true; } diff --git a/noncore/multimedia/opierec/helpwindow.cpp b/noncore/multimedia/opierec/helpwindow.cpp index 6aebaa1..7f984c3 100644 --- a/noncore/multimedia/opierec/helpwindow.cpp +++ b/noncore/multimedia/opierec/helpwindow.cpp @@ -1,40 +1,45 @@ /**************************************************************************** ** $Id$ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** ** This file is part of an example program for Qt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ #include "helpwindow.h" -#include <qlayout.h> -#include <qtoolbar.h> +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/resource.h> +using namespace Opie::Core; +/* QT */ +#include <qlayout.h> +#include <qtoolbar.h> #include <qaction.h> #include <qmenubar.h> +/* STD */ #include <ctype.h> HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() { QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2); layout->setMargin( 2); - qDebug(_path); + odebug << _path << oendl; browser = new QTextBrowser( this ); QStringList Strlist; Strlist.append( home_); browser->mimeSourceFactory()->setFilePath( Strlist ); browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); if ( !home_.isEmpty() ) browser->setSource( home_ ); QToolBar *toolbar = new QToolBar( this ); diff --git a/noncore/multimedia/opierec/opierec.pro b/noncore/multimedia/opierec/opierec.pro index 7b08f0e..ea1bae3 100644 --- a/noncore/multimedia/opierec/opierec.pro +++ b/noncore/multimedia/opierec/opierec.pro @@ -1,15 +1,13 @@ -#CONFIG = qt warn_on pdaudio -CONFIG = qt warn_on opie -#CONFIG = qt warn_on quick-app +CONFIG = qt warn_on HEADERS = adpcm.h \ pixmaps.h \ helpwindow.h \ qtrec.h \ device.h \ wavFile.h \ waveform.h SOURCES = adpcm.c \ helpwindow.cpp \ main.cpp \ qtrec.cpp \ device.cpp \ @@ -20,22 +18,22 @@ INTERFACES = contains(CONFIG, pdaudio) { # LIBS += -L/opt/buildroot-opie/output/staging/target/lib -lqpe -lpthread -ljpeg -lpng -lz LIBS += -L$(QPEDIR)/lib -lqpe -lpthread -ljpeg -lpng -lz -lopiecore2 INCLUDEPATH += $(QPEDIR)/include DEPENDPATH += $(QPEDIR)/include DEFINES += PDAUDIO DEFINES += THREADED TARGET = qperec # DESTDIR=$(QPEDIR)/bin } -contains(CONFIG, opie) { +!contains(CONFIG, pdaudio) { INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include DESTDIR=$(OPIEDIR)/bin LIBS += -lqpe -lopiecore2 -lpthread TARGET = opierec include ( $(OPIEDIR)/include.pro ) } diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 1c64ab1..2187d5a 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp @@ -1,68 +1,67 @@ /**************************************************************************** // qtrec.cpp Created: Thu Jan 17 11:19:58 2002 copyright 2002 by L.J. Potter <ljp@llornkcor.com> ****************************************************************************/ #define DEV_VERSION #include "pixmaps.h" #include "qtrec.h" #include "waveform.h" - -#include <pthread.h> - extern "C" { #include "adpcm.h" } -#include <sys/soundcard.h> - +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/storage.h> +using namespace Opie::Core; +/* QT */ #include <qcheckbox.h> #include <qcombobox.h> -//#include <qdatetime.h> #include <qdir.h> #include <qgroupbox.h> #include <qlabel.h> #include <qlayout.h> #include <qlistview.h> #include <qmessagebox.h> #include <qpopupmenu.h> #include <qpushbutton.h> #include <qslider.h> #include <qtabwidget.h> #include <qtimer.h> +/* STD */ #include <errno.h> #include <fcntl.h> #include <math.h> #include <mntent.h> #include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> #include <sys/soundcard.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <sys/vfs.h> #include <unistd.h> #include <sys/wait.h> #include <sys/signal.h> - +#include <pthread.h> #ifdef PDAUDIO //ALSA #include <alsa/asoundlib.h> static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 }; static int deviceBitRates[] = { 8, 16, 24, 32, -1 }; #else //OSS static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 }; static int deviceBitRates[] = { 8, 16, -1 }; #endif #if defined(QT_QWS_SL5XXX) ///#if defined(QT_QWS_EBX) @@ -127,55 +126,55 @@ void quickRec() qDebug("samples %d, rate %d, channels %d", filePara.numberSamples, filePara.sampleRate, filePara.channels); int total = 0; // Total number of bytes read in so far. int bytesWritten, number; bytesWritten = 0; number = 0; QString num; int level = 0; int threshold = 0; // int bits = filePara.resolution; -// qDebug("bits %d", bits); +// odebug << "bits " << bits << "" << oendl; if( filePara.resolution == 16 ) { //AFMT_S16_LE) -// qDebug("AFMT_S16_LE size %d", filePara.SecondsToRecord); -// qDebug("samples to record %d", filePara.samplesToRecord); -// qDebug("%d", filePara.sd); +// odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; +// odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; +// odebug << "" << filePara.sd << "" << oendl; level = 7; threshold = 0; if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { -// qDebug("start recording WAVE_FORMAT_DVI_ADPCM"); +// odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> char abuf[ BUFSIZE/2 ]; short sbuf[ BUFSIZE ]; short sbuf2[ BUFSIZE ]; memset( abuf, 0, BUFSIZE/2); memset( sbuf, 0, BUFSIZE); memset( sbuf2, 0, BUFSIZE); for(;;) { if ( stopped) { -// qDebug("quickRec:: stopped"); +// odebug << "quickRec:: stopped" << oendl; break; } // number=::read( filePara.sd, sbuf, BUFSIZE); number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE); if(number <= 0) { perror("recording error "); - qDebug( "%s %d", filePara.fileName, number); + odebug << "" << filePara.fileName << " " << number << "" << oendl; stopped = true; return; } //if(stereo == 2) { // adpcm_coder( sbuf2, abuf, number/2, &encoder_state); adpcm_coder( sbuf, abuf, number/2, &encoder_state); bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); waveform->newSamples( (const short *)abuf, bytesWritten ); total += bytesWritten; @@ -183,43 +182,43 @@ void quickRec() timeSlider->setValue( total); filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 / filePara.channels; qApp->processEvents(); if( total >= filePara.samplesToRecord) { stopped = true; break; } } } else { // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>> - qDebug("start recording WAVE_FORMAT_PCM"); + odebug << "start recording WAVE_FORMAT_PCM" << oendl; short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ]; memset( inbuffer, 0, BUFSIZE); memset( outbuffer, 0, BUFSIZE); for(;;) { if ( stopped) { - qDebug("quickRec:: stopped"); + odebug << "quickRec:: stopped" << oendl; stopped = true; break; // stop if playing was set to false return; } number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE); waveform->newSamples( inbuffer, number ); if( number <= 0) { perror( "recording error "); - qDebug( filePara.fileName); + odebug << filePara.fileName << oendl; stopped = true; return; } bytesWritten = ::write( filePara.fd , inbuffer, number); if( bytesWritten < 0) { perror("File writing error "); stopped = true; return; } @@ -241,25 +240,25 @@ void quickRec() } } } //end main loop } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ]; memset( unsigned_inbuffer, 0, BUFSIZE); memset( unsigned_outbuffer, 0, BUFSIZE); for(;;) { if ( stopped) { - qDebug("quickRec:: stopped"); + odebug << "quickRec:: stopped" << oendl; break; // stop if playing was set to false } number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE); bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); if(bytesWritten < 0) { stopped = true; QMessageBox::message("Note","There was a problem\nwriting to the file"); perror("File writing error "); return; } @@ -364,25 +363,25 @@ void playIt() total += bytesWritten; timeSlider->setValue( total); filePara.numberSamples = total; filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2; // timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds); // timeLabel->setText( timeString + tr(" seconds")); qApp->processEvents(); if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { - qWarning("Jane! Stop this crazy thing!"); + owarn << "Jane! Stop this crazy thing!" << oendl; stopped = true; // playing = false; break; } } printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total); fflush(stdout); } //end loop } else { /////////////////////////////// format = AFMT_U8; unsigned char unsigned_inbuffer[ BUFSIZE ]; //, unsigned_outbuffer[BUFSIZE]; memset( unsigned_inbuffer, 0, BUFSIZE); @@ -709,25 +708,25 @@ void QtRec::init() { waveform->setBackgroundColor ( black ); } void QtRec::initIconView() { ListView1->clear(); Config cfg("OpieRec"); cfg.setGroup("Sounds"); QString temp; QPixmap image0( ( const char** ) image0_data ); int nFiles = cfg.readNumEntry("NumberofFiles",0); -// qDebug("init number of files %d", nFiles); +// odebug << "init number of files " << nFiles << "" << oendl; for(int i=1;i<= nFiles;i++) { QListViewItem * item; QString fileS, mediaLocation, fileDate, filePath; temp.sprintf( "%d",i); temp = cfg.readEntry( temp,""); //reads currentFile filePath = cfg.readEntry( temp,""); //currentFileName QFileInfo info(filePath); fileDate = info.lastModified().toString(); @@ -851,25 +850,25 @@ void QtRec::initConfig() { if( autoMuteCheckBox->isChecked()) slotAutoMute(true); else slotAutoMute(false); Config cofg( "qpe"); cofg.setGroup( "Volume"); outMuteCheckBox->setChecked( cofg.readBoolEntry( "Mute",0)); inMuteCheckBox->setChecked( cofg.readBoolEntry( "MicMute",0)); } void QtRec::stop() { - qWarning("STOP"); + owarn << "STOP" << oendl; setRecordButton(false); if( !recording) endPlaying(); else endRecording(); timeSlider->setValue(0); } void QtRec::doPlayBtn() { if(!stopped) { @@ -913,69 +912,69 @@ bool QtRec::rec() { //record if( setupAudio( true)) if(setUpFile()) { int fileSize = 0; Config cfg("OpieRec"); cfg.setGroup("Settings"); // qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", // soundDevice->getDeviceBits(), // soundDevice->getDeviceRate(), // soundDevice->getDeviceChannels()); //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); -// qDebug("sample rate is %d", filePara.sampleRate); +// odebug << "sample rate is " << filePara.sampleRate << "" << oendl; filePara.SecondsToRecord = getCurrentSizeLimit(); -// qDebug("size limit %d sec", filePara.SecondsToRecord); +// odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); if( filePara.SecondsToRecord == 0) { fileSize = diskSize; } else if( filePara.format == WAVE_FORMAT_PCM) { -// qDebug("WAVE_FORMAT_PCM"); +// odebug << "WAVE_FORMAT_PCM" << oendl; fileSize = (filePara.SecondsToRecord ) * filePara.channels * filePara.sampleRate * ( filePara.resolution / 8) + 1000; } else { -// qDebug("WAVE_FORMAT_DVI_ADPCM"); +// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; fileSize = ((filePara.SecondsToRecord) * filePara.channels * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; } filePara.samplesToRecord = fileSize; qDebug("filesize should be %d, bits %d, rate %d", filePara.samplesToRecord, filePara.resolution, filePara.sampleRate); if( paused) { paused = false; } // else { - qDebug("Setting timeslider %d", filePara.samplesToRecord); + odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl; // if(fileSize != 0) timeSlider->setRange(0, filePara.samplesToRecord); // } if( diskSize < fileSize/1024) { QMessageBox::warning(this, tr("Low Disk Space"), tr("You are running low of\nrecording space\n" "or a card isn't being recognized")); stopped = true; //we need to be stopped stop(); } else { QString msg; msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); #ifdef DEV_VERSION setCaption( msg); #endif filePara.fileName=currentFile.latin1(); - qDebug("Start recording thread"); + odebug << "Start recording thread" << oendl; stopped = false; #ifdef THREADED pthread_t thread1; pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); #endif toBeginningButton->setEnabled( false); toEndButton->setEnabled( false); startTimer(1000); #ifndef THREADED quickRec(); @@ -1001,31 +1000,31 @@ void QtRec::thisTab(QWidget* widg) { } if( index==2) { //help page } qApp->processEvents(); update(); } } void QtRec::getOutVol( ) { filePara.outVol = soundDevice->getOutVolume(); -// qDebug("out vol %d", filePara.outVol); +// odebug << "out vol " << filePara.outVol << "" << oendl; OutputSlider->setValue( -filePara.outVol); } void QtRec::getInVol() { filePara.inVol = soundDevice->getInVolume(); -// qDebug("in vol %d", filePara.inVol); +// odebug << "in vol " << filePara.inVol << "" << oendl; InputSlider->setValue( -filePara.inVol); } void QtRec::changedOutVolume() { soundDevice->changedOutVolume( -OutputSlider->value()); } void QtRec::changedInVolume( ) { soundDevice->changedInVolume( -InputSlider->value()); } @@ -1081,53 +1080,53 @@ bool QtRec::setupAudio( bool b) { sampleformat = SND_PCM_FORMAT_S32; else sampleformat = SND_PCM_FORMAT_U8; #else if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") sampleformat = AFMT_S16_LE; else sampleformat = AFMT_U8; if( !compressionCheckBox->isChecked()) { filePara.format = WAVE_FORMAT_PCM; -// qDebug("WAVE_FORMAT_PCM"); +// odebug << "WAVE_FORMAT_PCM" << oendl; } else { filePara.format = WAVE_FORMAT_DVI_ADPCM; sampleformat = AFMT_S16_LE; -// qDebug("WAVE_FORMAT_DVI_ADPCM"); +// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; } #endif stereo = filePara.channels; // filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; flags= O_RDWR; // flags= O_RDONLY; Config hwcfg("OpieRec"); hwcfg.setGroup("Hardware"); dspString = hwcfg.readEntry( "Audio", DSPSTRIN); mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXERIN); recording = true; } // if(soundDevice) delete soundDevice; - qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat); - qWarning("change waveform settings"); + odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; + owarn << "change waveform settings" << oendl; waveform->changeSettings( filePara.sampleRate, filePara.channels ); soundDevice = new Device( this, dspString, mixerString, b); // soundDevice->openDsp(); soundDevice->reset(); - qDebug("device has been made %d", soundDevice->sd); + odebug << "device has been made " << soundDevice->sd << "" << oendl; ////////////////// <<<<<<<<<<<<>>>>>>>>>>>> soundDevice->setDeviceFormat( sampleformat); soundDevice->setDeviceChannels( filePara.channels); soundDevice->setDeviceRate( filePara.sampleRate); soundDevice->getDeviceFragSize(); #ifdef QT_QWS_EBX int frag = FRAGSIZE; soundDevice->setFragSize( frag); soundDevice->getDeviceFragSize(); #endif ///////////////// @@ -1140,25 +1139,25 @@ bool QtRec::setupAudio( bool b) { update(); setCaption( tr( "OpieRecord " )+ QString::number(VERSION) ); return false; } if(autoMute) doMute(false); return true; } bool QtRec::setUpFile() { //setup file for recording -// qDebug("Setting up wavfile"); +// odebug << "Setting up wavfile" << oendl; // if(wavFile) delete wavFile; wavFile = new WavFile( this, (const QString &)"", true, filePara.sampleRate, filePara.channels, filePara.resolution, filePara.format); filePara.fd = wavFile->wavHandle(); if(filePara.fd == -1) { return false; } else { @@ -1173,25 +1172,25 @@ bool QtRec::doPlay() { if( !paused) { total = 0; filePara.numberOfRecordedSeconds = 0; } else { paused = false; secCount = (int)filePara.numberOfRecordedSeconds; } playing = true; stopped = false; recording = false; QString num; - qDebug( "Play number of samples %d", filePara.numberSamples); + odebug << "Play number of samples " << filePara.numberSamples << "" << oendl; // timeSlider->setRange( 0, filePara.numberSamples); timeString.sprintf("%f", filePara.numberOfRecordedSeconds); timeLabel->setText( timeString+ tr(" seconds")); QString msg; msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); #ifdef DEV_VERSION @@ -1225,45 +1224,45 @@ void QtRec::changebitrateCombo(int i) { filePara.resolution = bits; cfg.write(); } void QtRec::changesamplerateCombo(int i) { Config cfg("OpieRec"); cfg.setGroup("Settings"); int rate=0; bool ok; rate = sampleRateComboBox->text(i).toInt(&ok, 10); cfg.writeEntry( "samplerate",rate); filePara.sampleRate=rate; - qDebug( "Change sample rate %d", rate); + odebug << "Change sample rate " << rate << "" << oendl; cfg.write(); } void QtRec::changeDirCombo(int index) { Config cfg("OpieRec"); cfg.setGroup("Settings"); QString sName = directoryComboBox->text(index); StorageInfo storageInfo; const QList<FileSystem> &fs = storageInfo.fileSystems(); QListIterator<FileSystem> it ( fs ); QString storage; for( ; it.current(); ++it ){ if( sName == (*it)->name()+" "+ (*it)->path() || (*it)->name() == sName ) { const QString path = (*it)->path(); recDir = path; cfg.writeEntry("directory", recDir); - qDebug("new rec dir "+recDir); + odebug << "new rec dir "+recDir << oendl; } } cfg.write(); } void QtRec::changeSizeLimitCombo(int) { Config cfg("OpieRec"); cfg.setGroup("Settings"); cfg.writeEntry("sizeLimit", getCurrentSizeLimit() ); cfg.write(); } @@ -1365,25 +1364,25 @@ void QtRec::keyPressEvent( QKeyEvent *e) { break; case Key_Space: break; case Key_Delete: break; case Key_Up: // stop(); break; case Key_Down: // newSound(); break; case Key_Left: { - qDebug("rewinding"); + odebug << "rewinding" << oendl; if( !e->isAutoRepeat()) rewindPressed(); } break; case Key_Right: { if( !e->isAutoRepeat()) FastforwardPressed(); } break; } } @@ -1419,37 +1418,37 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) { break; case Key_Space: if(stopped && !recording) newSound(); else stop(); break; case Key_Delete: deleteSound(); break; case Key_Up: // stop(); - qDebug("Up"); + odebug << "Up" << oendl; break; case Key_Down: // start(); - // qDebug("Down"); + // odebug << "Down" << oendl; // newSound(); break; case Key_Left: - qDebug("Left"); + odebug << "Left" << oendl; rewindReleased(); break; case Key_Right: - qDebug("Right"); + odebug << "Right" << oendl; FastforwardReleased(); break; } } void QtRec::endRecording() { monitoring = false; recording = false; stopped = true; waveform->reset(); setRecordButton( false); @@ -1466,139 +1465,139 @@ void QtRec::endRecording() { if( wavFile->track.isOpen()) { wavFile->adjustHeaders( filePara.fd, filePara.numberSamples); // soundDevice->sd=-1; filePara.numberSamples = 0; // filePara.sd=-1; wavFile->closeFile(); filePara.fd=0; if( wavFile->isTempFile()) { // move tmp file to regular file QString cmd; cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); -// qDebug("moving tmp file to "+currentFileName); +// odebug << "moving tmp file to "+currentFileName << oendl; system( cmd.latin1()); } - qDebug("Just moved " + wavFile->currentFileName); + odebug << "Just moved " + wavFile->currentFileName << oendl; Config cfg("OpieRec"); cfg.setGroup("Sounds"); int nFiles = cfg.readNumEntry( "NumberofFiles",0); currentFile = QFileInfo( wavFile->currentFileName).fileName(); currentFile = currentFile.left( currentFile.length() - 4); cfg.writeEntry( "NumberofFiles", nFiles + 1); cfg.writeEntry( QString::number( nFiles + 1), currentFile); cfg.writeEntry( currentFile, wavFile->currentFileName); QString time; time.sprintf("%.2f", filePara.numberOfRecordedSeconds); cfg.writeEntry( wavFile->currentFileName, time ); -// qDebug("writing config numberOfRecordedSeconds "+time); +// odebug << "writing config numberOfRecordedSeconds "+time << oendl; cfg.write(); - qDebug("finished recording"); + odebug << "finished recording" << oendl; timeLabel->setText(""); } if(soundDevice) delete soundDevice; timeSlider->setValue(0); initIconView(); selectItemByName( currentFile); } void QtRec::endPlaying() { monitoring = false; recording = false; playing = false; stopped = true; waveform->reset(); // errorStop(); -// qDebug("end playing"); +// odebug << "end playing" << oendl; setRecordButton( false); toBeginningButton->setEnabled( true); toEndButton->setEnabled( true); if(autoMute) doMute( true); soundDevice->closeDevice( false); soundDevice->sd = -1; // if(soundDevice) delete soundDevice; -// qDebug("file and sound device closed"); +// odebug << "file and sound device closed" << oendl; timeLabel->setText(""); total = 0; filePara.numberSamples = 0; filePara.sd = -1; // wavFile->closeFile(); filePara.fd = 0; // if(wavFile) delete wavFile; //this crashes -// qDebug("track closed"); +// odebug << "track closed" << oendl; killTimers(); - qWarning("reset slider"); + owarn << "reset slider" << oendl; timeSlider->setValue(0); if(soundDevice) delete soundDevice; } bool QtRec::openPlayFile() { qApp->processEvents(); if( currentFile.isEmpty()) { QMessageBox::message(tr("Opierec"),tr("Please select file to play")); endPlaying(); return false; } QString currentFileName; Config cfg("OpieRec"); cfg.setGroup("Sounds"); int nFiles = cfg.readNumEntry( "NumberofFiles", 0); for(int i=0;i<nFiles+1;i++) { //look for file if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) { currentFileName = cfg.readEntry( currentFile, "" ); - qDebug("opening for play: " + currentFileName); + odebug << "opening for play: " + currentFileName << oendl; } } wavFile = new WavFile(this, currentFileName, false); filePara.fd = wavFile->wavHandle(); if(filePara.fd == -1) { // if(!track.open(IO_ReadOnly)) { QString errorMsg = (QString)strerror(errno); monitoring = false; setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); QMessageBox::message(tr("Note"), tr("Could not open audio file.\n") + errorMsg + "\n" + currentFile); return false; } else { filePara.numberSamples = wavFile->getNumberSamples(); filePara.format = wavFile->getFormat(); filePara.sampleRate = wavFile->getSampleRate(); filePara.resolution = wavFile->getResolution(); filePara.channels = wavFile->getChannels(); timeSlider->setPageStep(1); monitoring = true; - qDebug("file %d, samples %d %d", filePara.fd, filePara.numberSamples, filePara.sampleRate); + odebug << "file " << filePara.fd << ", samples " << filePara.numberSamples << " " << filePara.sampleRate << "" << oendl; int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8)); - qWarning("seconds %d", sec); + owarn << "seconds " << sec << "" << oendl; timeSlider->setRange(0, filePara.numberSamples ); } return true; } void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) { if(item == NULL ) return; switch (mouse) { case 1: { @@ -1681,37 +1680,37 @@ void QtRec::doRename() { renameBox->selectAll(); renameBox->installEventFilter( this ); ListView1->addChild( renameBox, r.x(), r.y() ); renameBox->resize( r.size() ); ListView1->viewport()->setFocusProxy( renameBox ); renameBox->setFocus(); renameBox->show(); } void QtRec::okRename() { - qDebug(renameBox->text()); + odebug << renameBox->text() << oendl; QString filename = renameBox->text(); cancelRename(); if( ListView1->currentItem() == NULL) return; Config cfg("OpieRec"); cfg.setGroup("Sounds"); QString file = ListView1->currentItem()->text(0); - qDebug("filename is " + filename); + odebug << "filename is " + filename << oendl; int nFiles = cfg.readNumEntry("NumberofFiles",0); for(int i=0;i<nFiles+1;i++) { //look for file if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { QString filePath = cfg.readEntry(file,""); cfg.writeEntry( QString::number(i), filename ); cfg.writeEntry( filename, filePath ); cfg.removeEntry( file); cfg.write(); @@ -1764,25 +1763,25 @@ void QtRec::timerBreak() { endPlaying(); } void QtRec::doVolMuting(bool b) { Config cfg( "qpe" ); cfg. setGroup( "Volume" ); cfg.writeEntry( "Mute",b); cfg.write(); QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << b; } void QtRec::doMicMuting(bool b) { - // qDebug("mic mute"); + // odebug << "mic mute" << oendl; Config cfg( "qpe" ); cfg. setGroup( "Volume" ); cfg.writeEntry( "MicMute",b); cfg.write(); QCopEnvelope( "QPE/System", "micChange(bool)" ) << b; } void QtRec::compressionSelected(bool b) { Config cfg("OpieRec"); cfg.setGroup("Settings"); cfg.writeEntry("wavCompression", b); cfg.writeEntry("bitrate", 16); @@ -1820,90 +1819,90 @@ long QtRec::checkDiskSpace(const QString &path) { // short f_fstyp; /* File system type */ // long f_bsize; /* Block size */ // long f_frsize; /* Fragment size */ // long f_blocks; /* Total number of blocks*/ // long f_bfree; /* Count of free blocks */ // long f_files; /* Total number of file nodes */ // long f_ffree; /* Count of free file nodes */ // char f_fname[6]; /* Volumename */ // char f_fpack[6]; /* Pack name */ void QtRec::receive( const QCString &msg, const QByteArray & ) { - qDebug("Voicerecord received message "+msg); + odebug << "Voicerecord received message "+msg << oendl; } ///////////////////////////// timerEvent void QtRec::timerEvent( QTimerEvent * ) { // if(!recording) // timeSlider->setValue( secCount); // else // timeSlider->setValue( filePara.numberOfRecordedSeconds); if( stopped && playing) { stop(); } if( stopped && recording ){ stop(); } if( recording && filePara.SecondsToRecord < secCount && filePara.SecondsToRecord != 0) { stop(); } - qDebug( "%d", secCount ); + odebug << "" << secCount << "" << oendl; QString timeString; #ifdef DEV_VERSION QString msg; msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); setCaption( msg +" :: "+QString::number(secCount)); #endif timeString.sprintf("%d", secCount); timeLabel->setText( timeString + " seconds"); secCount++; } void QtRec::changeTimeSlider(int index) { if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; - // qDebug("Slider moved to %d",index); + // odebug << "Slider moved to " << index << "" << oendl; paused = true; stopped = true; sliderPos=index; QString timeString; filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); secCount = (int)filePara.numberOfRecordedSeconds; timeLabel->setText( timeString + tr(" seconds")); } void QtRec::timeSliderPressed() { if( ListView1->currentItem() == 0) return; - // qDebug("slider pressed"); + // odebug << "slider pressed" << oendl; paused = true; stopped = true; } void QtRec::timeSliderReleased() { if( ListView1->currentItem() == 0) return; sliderPos = timeSlider->value(); - // qDebug("slider released %d", sliderPos); + // odebug << "slider released " << sliderPos << "" << oendl; stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos*4; filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2; doPlay(); } void QtRec::rewindPressed() { if( ListView1->currentItem() == 0) return; if( !wavFile->track.isOpen()) { if( !openPlayFile() ) @@ -1915,39 +1914,39 @@ void QtRec::rewindPressed() { killTimers(); paused = true; stopped = true; rewindTimer->start( 50, false); } } void QtRec::rewindTimerTimeout() { int sliderValue = timeSlider->value(); sliderValue = sliderValue - ( filePara.numberSamples / 100); // if(toBeginningButton->isDown()) timeSlider->setValue( sliderValue ) ; - // qDebug("%d", sliderValue); + // odebug << "" << sliderValue << "" << oendl; QString timeString; filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2; timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); timeLabel->setText( timeString+ tr(" seconds")); } void QtRec::rewindReleased() { rewindTimer->stop(); if( wavFile->track.isOpen()) { sliderPos=timeSlider->value(); stopped = false; int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); total = newPos * 4; - // qDebug("rewind released %d", total); + // odebug << "rewind released " << total << "" << oendl; startTimer( 1000); doPlay(); } } void QtRec::FastforwardPressed() { if( ListView1->currentItem() == 0) return; if( !wavFile->track.isOpen()) if( !openPlayFile() ) return; else if( !setupAudio( false)) @@ -1993,25 +1992,25 @@ QString QtRec::getStorage(const QString &fileName) { const QList<FileSystem> &fs = storageInfo.fileSystems(); QListIterator<FileSystem> it ( fs ); QString storage; for( ; it.current(); ++it ){ const QString name = ( *it)->name(); const QString path = ( *it)->path(); const QString disk = ( *it)->disk(); if( fileName.find( path,0,true) != -1) storage = name; // const QString options = (*it)->options(); // if( name.find( tr("Internal"),0,true) == -1) { // storageComboBox->insertItem( name +" -> "+disk); - // qDebug(name); + // odebug << name << oendl; } return storage; // struct mntent *me; // // if(fileName == "/etc/mtab") { // FILE *mntfp = setmntent( fileName.latin1(), "r" ); // if ( mntfp ) { // while ( (me = getmntent( mntfp )) != 0 ) { // QString filesystemType = me->mnt_type; // } // } // endmntent( mntfp ); diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp index 35bc14d..7e9b50f 100644 --- a/noncore/multimedia/opierec/wavFile.cpp +++ b/noncore/multimedia/opierec/wavFile.cpp @@ -1,274 +1,277 @@ //wavFile.cpp #include "wavFile.h" #include "qtrec.h" +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +using namespace Opie::Core; + +/* QT */ #include <qmessagebox.h> #include <qdir.h> -#include <qpe/config.h> - +/* STD */ #include <errno.h> - #include <sys/time.h> #include <sys/types.h> #include <sys/vfs.h> - #include <fcntl.h> #include <math.h> #include <mntent.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int sampleRate, int channels, int resolution, int format ) : QObject( parent) { -//qDebug("new wave file"); +//odebug << "new wave file" << oendl; bool b = makeNwFile; wavSampleRate=sampleRate; wavFormat=format; wavChannels=channels; wavResolution=resolution; useTmpFile=false; if( b) { newFile(); } else { openFile(fileName); } } bool WavFile::newFile() { -// qDebug("Set up new file"); +// odebug << "Set up new file" << oendl; Config cfg("OpieRec"); cfg.setGroup("Settings"); currentFileName=cfg.readEntry("directory",QDir::homeDirPath()); QString date; QDateTime dt = QDateTime::currentDateTime(); date = dt.toString();//TimeString::dateString( QDateTime::currentDateTime(),false,true); date.replace(QRegExp("'"),""); date.replace(QRegExp(" "),"_"); date.replace(QRegExp(":"),"."); date.replace(QRegExp(","),""); QString currentFile=date; if(currentFileName.right(1).find("/",0,true) == -1) currentFileName += "/" + date; else currentFileName += date; currentFileName+=".wav"; -// qDebug("set up file for recording: "+currentFileName); +// odebug << "set up file for recording: "+currentFileName << oendl; char pointer[] = "/tmp/opierec-XXXXXX"; int fd = 0; if( currentFileName.find("/mnt",0,true) == -1 && currentFileName.find("/tmp",0,true) == -1 ) { // if destination file is most likely in flash (assuming jffs2) // we have to write to a different filesystem first useTmpFile = true; if(( fd = mkstemp( pointer)) < 0 ) { perror("mkstemp failed"); return false; } -// qDebug("Opening tmp file %s",pointer); +// odebug << "Opening tmp file " << pointer << "" << oendl; track.setName( pointer); } else { //just use regular file.. no moving useTmpFile = false; track.setName( currentFileName); } if(!track.open( IO_ReadWrite | IO_Truncate)) { QString errorMsg=(QString)strerror(errno); - qDebug(errorMsg); + odebug << errorMsg << oendl; QMessageBox::message("Note", "Error opening file.\n" +errorMsg); return false; } else { setWavHeader( track.handle() , &hdr); } return true; } WavFile::~WavFile() { closeFile(); } void WavFile::closeFile() { if(track.isOpen()) track.close(); } int WavFile::openFile(const QString ¤tFileName) { -// qDebug("open play file "+currentFileName); +// odebug << "open play file "+currentFileName << oendl; closeFile(); track.setName(currentFileName); if(!track.open(IO_ReadOnly)) { QString errorMsg=(QString)strerror(errno); - qDebug("<<<<<<<<<<< "+errorMsg+currentFileName); + odebug << "<<<<<<<<<<< "+errorMsg+currentFileName << oendl; QMessageBox::message("Note", "Error opening file.\n" +errorMsg); return -1; } else { parseWavHeader( track.handle()); } return track.handle(); } bool WavFile::setWavHeader(int fd, wavhdr *hdr) { strncpy((*hdr).riffID, "RIFF", 4); // RIFF strncpy((*hdr).wavID, "WAVE", 4); //WAVE strncpy((*hdr).fmtID, "fmt ", 4); // fmt (*hdr).fmtLen = 16; // format length = 16 if( wavFormat == WAVE_FORMAT_PCM) { (*hdr).fmtTag = 1; // PCM -// qDebug("set header WAVE_FORMAT_PCM"); +// odebug << "set header WAVE_FORMAT_PCM" << oendl; } else { (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM - // qDebug("set header WAVE_FORMAT_DVI_ADPCM"); + // odebug << "set header WAVE_FORMAT_DVI_ADPCM" << oendl; } // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels (*hdr).sampleRate = wavSampleRate; //samples per second (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16 strncpy((*hdr).dataID, "data", 4); write( fd,hdr, sizeof(*hdr)); qDebug("writing header: bitrate%d, samplerate %d, channels %d", wavResolution, wavSampleRate, wavChannels); return true; } bool WavFile::adjustHeaders(int fd, int total) { lseek(fd, 4, SEEK_SET); int i = total + 36; write( fd, &i, sizeof(i)); lseek( fd, 40, SEEK_SET); write( fd, &total, sizeof(total)); - qDebug("adjusting header %d", total); + odebug << "adjusting header " << total << "" << oendl; return true; } int WavFile::parseWavHeader(int fd) { - qDebug("Parsing wav header"); + odebug << "Parsing wav header" << oendl; char string[4]; int found; short fmt; unsigned short ch, bitrate; unsigned long samplerrate, longdata; if (read(fd, string, 4) < 4) { - qDebug(" Could not read from sound file.\n"); + odebug << " Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "RIFF", 4)) { - qDebug(" not a valid WAV file.\n"); + odebug << " not a valid WAV file.\n" << oendl; return -1; } lseek(fd, 4, SEEK_CUR); if (read(fd, string, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "WAVE", 4)) { - qDebug("not a valid WAV file.\n"); + odebug << "not a valid WAV file.\n" << oendl; return -1; } found = 0; while (!found) { if (read(fd, string, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "fmt ", 4)) { if (read(fd, &longdata, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } lseek(fd, longdata, SEEK_CUR); } else { lseek(fd, 4, SEEK_CUR); if (read(fd, &fmt, 2) < 2) { - qDebug("Could not read format chunk.\n"); + odebug << "Could not read format chunk.\n" << oendl; return -1; } if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { qDebug("Wave file contains unknown format." " Unable to continue.\n"); return -1; } wavFormat = fmt; // compressionFormat=fmt; - qDebug("compressionFormat is %d", fmt); + odebug << "compressionFormat is " << fmt << "" << oendl; if (read(fd, &ch, 2) < 2) { - qDebug("Could not read format chunk.\n"); + odebug << "Could not read format chunk.\n" << oendl; return -1; } else { wavChannels = ch; - qDebug("File has %d channels", ch); + odebug << "File has " << ch << " channels" << oendl; } if (read(fd, &samplerrate, 4) < 4) { - qDebug("Could not read from format chunk.\n"); + odebug << "Could not read from format chunk.\n" << oendl; return -1; } else { wavSampleRate = samplerrate; // sampleRate = samplerrate; - qDebug("File has samplerate of %d",(int) samplerrate); + odebug << "File has samplerate of " << (int) samplerrate << "" << oendl; } lseek(fd, 6, SEEK_CUR); if (read(fd, &bitrate, 2) < 2) { - qDebug("Could not read format chunk.\n"); + odebug << "Could not read format chunk.\n" << oendl; return -1; } else { wavResolution=bitrate; // resolution = bitrate; - qDebug("File has bitrate of %d", bitrate); + odebug << "File has bitrate of " << bitrate << "" << oendl; } found++; } } found = 0; while (!found) { if (read(fd, string, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } if (strncmp(string, "data", 4)) { if (read(fd, &longdata, 4)<4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } lseek(fd, longdata, SEEK_CUR); } else { if (read(fd, &longdata, 4) < 4) { - qDebug("Could not read from sound file.\n"); + odebug << "Could not read from sound file.\n" << oendl; return -1; } else { wavNumberSamples = longdata; qDebug("file has length of %d \nlasting %d seconds", (int)longdata, (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) ); // wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)); return longdata; } } } diff --git a/noncore/multimedia/opierec/waveform.cpp b/noncore/multimedia/opierec/waveform.cpp index 9cc40b4..7c9a25f 100644 --- a/noncore/multimedia/opierec/waveform.cpp +++ b/noncore/multimedia/opierec/waveform.cpp @@ -10,46 +10,50 @@ ** ** 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 "waveform.h" -#include <qpainter.h> +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; +/* QT */ +#include <qpainter.h> Waveform::Waveform( QWidget *parent, const char *name, WFlags fl ) : QWidget( parent, name, fl ) { pixmap = 0; windowSize = 100; samplesPerPixel = 8000 / (5 * windowSize); currentValue = 0; numSamples = 0; windowPosn = 0; window = 0; } void Waveform::changeSettings( int frequency, int channels ) { makePixmap(); -// qWarning("change waveform %d, %d", frequency, channels); +// owarn << "change waveform " << frequency << ", " << channels << "" << oendl; samplesPerPixel = frequency * channels / (5 * windowSize); - qWarning("Waveform::changeSettings %d", samplesPerPixel); + owarn << "Waveform::changeSettings " << samplesPerPixel << "" << oendl; if ( !samplesPerPixel ) samplesPerPixel = 1; currentValue = 0; numSamples = 0; windowPosn = 0; draw(); } Waveform::~Waveform() { if ( window ) @@ -87,25 +91,25 @@ void Waveform::newSamples( const short *buf, int len ) window[windowPosn++] = (short)(currentValue / numSamples); if ( windowPosn >= windowSize ) { this->windowPosn = windowPosn; draw(); windowPosn = 0; } numSamples = 0; currentValue = 0; } } // Copy the final state back to the object. -//qWarning("%d, %d, %d", currentValue, numSamples, windowPosn); +//owarn << "" << currentValue << ", " << numSamples << ", " << windowPosn << "" << oendl; this->currentValue = currentValue; this->numSamples = numSamples; this->windowPosn = windowPosn; } void Waveform::makePixmap() { if ( !pixmap ) { pixmap = new QPixmap( size() ); windowSize = pixmap->width(); window = new short [windowSize]; diff --git a/noncore/multimedia/powerchord/config.in b/noncore/multimedia/powerchord/config.in index ab1512b..5db784a 100644 --- a/noncore/multimedia/powerchord/config.in +++ b/noncore/multimedia/powerchord/config.in @@ -1,7 +1,7 @@ config POWERCHORD boolean "opie-powerchord (guitar chord generator and tuning)" default "n" - depends ( LIBQPE || LIBQPE-X11 ) - comment "opie-powerchord needs a libqpe" - depends !(( LIBQPE || LIBQPE-X11 ) ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE + comment "opie-powerchord needs a libqpe and libopiecore2" + depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE ) diff --git a/noncore/multimedia/powerchord/powerchord.pro b/noncore/multimedia/powerchord/powerchord.pro index 917c88f..f7af6d6 100644 --- a/noncore/multimedia/powerchord/powerchord.pro +++ b/noncore/multimedia/powerchord/powerchord.pro @@ -9,19 +9,18 @@ HEADERS = powerchord.h \ powerchordbase.h SOURCES = main.cpp \ powerchord.cpp \ fretboard.cpp \ chordengine.cpp \ vumeter.cpp \ gs.cpp gt.cpp \ powerchordbase.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -#INTERFACES = powerchordbase.ui +LIBS += -lqpe -lopiecore2 DESTDIR = $(OPIEDIR)/bin TARGET = powerchord include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/multimedia/powerchord/powerchordbase.cpp b/noncore/multimedia/powerchord/powerchordbase.cpp index 4fb5dda..0694ba3 100644 --- a/noncore/multimedia/powerchord/powerchordbase.cpp +++ b/noncore/multimedia/powerchord/powerchordbase.cpp @@ -1,34 +1,38 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'powerchordbase.ui' ** ** Created: Sun Jan 13 23:05:11 2002 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include "powerchordbase.h" - #include "fretboard.h" #include "vumeter.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/resource.h> +using namespace Opie::Core; + +/* QT */ #include <qcombobox.h> #include <qlabel.h> #include <qlistbox.h> #include <qpushbutton.h> #include <qspinbox.h> #include <qtabwidget.h> #include <qlayout.h> #include <qtooltip.h> -#include <qpe/resource.h> - /* * Constructs a PowerchordBase which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { simulation_timer = 0; audio_timer = 0; // setPalette( QPalette( QColor( 232, 227, 215) ) ); @@ -571,15 +575,15 @@ void PowerchordBase::tuner_simulation_cb(){ } /* * Destroys the object and frees any allocated resources */ PowerchordBase::~PowerchordBase() { // no need to delete child widgets, Qt does it all for us } void PowerchordBase::change_handler() { - qWarning( "PowerchordBase::change_handler(): Not implemented yet!" ); + owarn << "PowerchordBase::change_handler(): Not implemented yet!" << oendl; } diff --git a/noncore/multimedia/showimg/ImageFileSelector.cpp b/noncore/multimedia/showimg/ImageFileSelector.cpp index 79ee925..53cc883 100644 --- a/noncore/multimedia/showimg/ImageFileSelector.cpp +++ b/noncore/multimedia/showimg/ImageFileSelector.cpp @@ -1,23 +1,25 @@ +#include "ImageFileSelector.h" +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/qpeapplication.h> +using namespace Opie::Core; -#include "qpe/qpeapplication.h" - -#include <stdlib.h> - -#include <qlabel.h> +/* QT */ +#include <qlabel.h> #include <qfileinfo.h> -#include "ImageFileSelector.h" - +/* STD */ +#include <stdlib.h> ThumbWidget::ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent,int w) : QWidget( parent ),fl(f) { setBackgroundMode(NoBackground); if ( w!=-1 ) setMinimumSize(w,p.height()+24); else setMinimumSize(p.width(),p.height()+24); description=new QLabel(text,this); description->setBackgroundColor(colorGroup().base()); description->setAlignment(AlignCenter); @@ -146,25 +148,25 @@ void ImageFileSelector::resizeEvent(QResizeEvent *) void ImageFileSelector::updateSizes() { int ww=(detailed->width()-detailed->frameWidth()*2); double w=(double)ww*0.70; detailed->setColumnWidth(0,(int)w); detailed->setColumnWidth(1,ww-(int)w); background->setMinimumWidth(thumb->visibleWidth()); thumb->updateScrollBars(); } void ImageFileSelector::reread(bool) { -// qDebug("reread"); +// odebug << "reread" << oendl; ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->selectedItem(); QString oldFile; if ( item ) oldFile = item->file().file(); detailed->clear(); tList.clear(); DocLnkSet files; Global::findDocuments(&files, "image/*"); count = files.children().count(); QListIterator<DocLnk> dit( files.children() ); // int y=0; // int x=4; @@ -212,25 +214,25 @@ void ImageFileSelector::reread(bool) detailed->setUpdatesEnabled(true); thumb->setUpdatesEnabled(true); detailed->update(); thumb->update(); } int ImageFileSelector::fileCount() { return count; } const DocLnk * ImageFileSelector::selected() { - qDebug("image selected"); + odebug << "image selected" << oendl; ImageFileSelectorItem *item = (ImageFileSelectorItem *) detailed->selectedItem(); if ( item ) return new DocLnk( item->file() ); return 0; } void ImageFileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) { if ( !i ) return; diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp index 696a57b..24377ed 100644 --- a/noncore/multimedia/showimg/showimg.cpp +++ b/noncore/multimedia/showimg/showimg.cpp @@ -17,41 +17,43 @@ ** not clear to you. ** **********************************************************************/ // // Full-screen and rotation options contributed by Robert Wittams <robert@wittams.com> // #include "showimg.h" #include "ImageFileSelector.h" #include "settingsdialog.h" - +/* OPIE */ +#include <opie2/odebug.h> #include <opie2/ofiledialog.h> - #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/resource.h> -#include <qtoolbar.h> +using namespace Opie::Core; +using namespace Opie::Ui; +/* QT */ +#include <qtoolbar.h> #include <qaction.h> #include <qfiledialog.h> #include <qmenubar.h> #include <qspinbox.h> +/* STD */ #include <math.h> - -using namespace Opie::Ui; ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent) : QDialog(parent,0,true) { setCaption(caption); if ( parent ) { setPalette(parent->palette()); } b=brightness; img=image; @@ -277,25 +279,25 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int /*wFlags*/ ) imagePanel = new ImagePane( stack ); connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView())); ImageFileSelector::CURRENT_VIEW cv; if(showThumbView) cv=ImageFileSelector::THUMBNAIL; else cv=ImageFileSelector::DETAILED; - qDebug("cv = %d",cv); + odebug << "cv = " << cv << "" << oendl; fileSelector = new ImageFileSelector( cv,stack, "fs"); //switchThumbView(); //fileSelector = new ImageFileSelector("image/*", stack, "fs"); //fileSelector->setNewVisible(FALSE); //fileSelector->setCloseVisible(FALSE); connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) ); connect( fileSelector, SIGNAL( fileSelected(const DocLnk&) ), this, SLOT( openFile(const DocLnk&) ) ); @@ -404,25 +406,25 @@ void ImageViewer::help() { void ImageViewer::settings() { SettingsDialog dlg( this, 0, TRUE ); dlg.setDelay( slideDelay ); dlg.setRepeat( slideRepeat ); dlg.setReverse( slideReverse ); dlg.setRotate(rotateOnLoad); dlg.setFastLoad(fastLoad); if ( QPEApplication::execDialog(&dlg) == QDialog::Accepted ) { - qDebug("<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>"); + odebug << "<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>" << oendl; slideDelay = dlg.delay(); slideRepeat = dlg.repeat(); slideReverse = dlg.reverse(); rotateOnLoad = dlg.rotate(); fastLoad = dlg.fastLoad(); Config config( "ImageViewer" ); config.setGroup( "SlideShow" ); config.writeEntry( "Delay", slideDelay ); config.writeEntry( "Repeat", slideRepeat ); config.writeEntry("Reverse", slideReverse); @@ -496,25 +498,25 @@ void ImageViewer::doDelayedLoad() { show(delayLoad); } void ImageViewer::show() { normalView(); QMainWindow::show(); } void ImageViewer::show(const QString& fileref) { -// qDebug("Show "+fileref); +// odebug << "Show "+fileref << oendl; bFromDocView = TRUE; closeFileSelector(); DocLnk link(fileref); if ( link.isValid() ) { openFile(link); } else { filename = fileref; updateCaption( fileref ); loadImage( fileref ); } } @@ -526,25 +528,25 @@ void ImageViewer::openFile() { QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 ); DocLnk link(str); // if ( link.isValid() ) openFile(link); } void ImageViewer::openFile( const DocLnk &link ) { closeFileSelector(); // DocLnk link(file); - qDebug("open "+link.name()); + odebug << "open "+link.name() << oendl; updateCaption( link.name() ); loadImage( link.file() ); if (slideTimer->isActive()) { slideTimer->start(slideDelay * 1000, FALSE); } } void ImageViewer::open() { switchToFileSelector(); } diff --git a/noncore/multimedia/showimg/showimg.pro b/noncore/multimedia/showimg/showimg.pro index 6fd019e..c905da8 100644 --- a/noncore/multimedia/showimg/showimg.pro +++ b/noncore/multimedia/showimg/showimg.pro @@ -1,9 +1,9 @@ -CONFIG += qt warn_on quick-app +CONFIG += qt warn_on quick-app HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp TARGET = showimg INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -lopieui2 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/multimedia/tonleiter/config.in b/noncore/multimedia/tonleiter/config.in index d580ad7..9bd167e 100644 --- a/noncore/multimedia/tonleiter/config.in +++ b/noncore/multimedia/tonleiter/config.in @@ -1,4 +1,4 @@ config TONLEITER boolean "tonleiter (shows scales on sting instruments)" default "n" - depends ( LIBQPE || LIBQPE-X11 ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE diff --git a/noncore/multimedia/tonleiter/editinst.cpp b/noncore/multimedia/tonleiter/editinst.cpp index ccb4560..a8c20c8 100644 --- a/noncore/multimedia/tonleiter/editinst.cpp +++ b/noncore/multimedia/tonleiter/editinst.cpp @@ -1,17 +1,22 @@ #include "editinst.h" -#include <qpushbutton.h> - +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; + +/* QT */ +#include <qpushbutton.h> Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name) :QDialog(parent,name,true,0),data(data) { setCaption("Tonleiter::"+tr("Instrument")); QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom); instid=data->getCurrentInstrumentID(); stringlist.setAutoDelete(true); QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight); //Name combo + Add + Delete @@ -91,20 +96,20 @@ void Menu::InstEditDialog::deleteString(int id) } //**************************************************************************** void Menu::InstEditDialog::saveInstrument() { //auto delete is set to true so widgets _should_ be deleted stringlist.clear(); } //**************************************************************************** void Menu::InstEditDialog::loadInstrument() { stringlist.clear(); Instrument inst=data->getInstrument(instid); - qDebug("load Instrument : %d strings",inst.noOfStrings()); + odebug << "load Instrument : " << inst.noOfStrings() << " strings" << oendl; for(uint s=0;s<inst.noOfStrings();s++) { stringlist.append(new EditStringWidget(inst.string(s),stringwidget)); } } //**************************************************************************** //**************************************************************************** diff --git a/noncore/multimedia/tonleiter/fretboard.cpp b/noncore/multimedia/tonleiter/fretboard.cpp index 7e63e01..58bdb86 100644 --- a/noncore/multimedia/tonleiter/fretboard.cpp +++ b/noncore/multimedia/tonleiter/fretboard.cpp @@ -1,14 +1,19 @@ #include "fretboard.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qpainter.h> Graph::FretBoard::FretBoard(TonleiterData* data,QWidget* parent,const char* name,WFlags f) :QWidget(parent,name,f),data(data) { setBackgroundColor(QColor(0,0,0)); fretpen=QPen(QColor(155,155,155),0); markerbrush=QBrush(QColor(155,155,155)); stringpen=QPen(QColor(255,255,255),3); connect(data,SIGNAL(dataChange()),this,SLOT(dataChange())); } //**************************************************************************** @@ -18,25 +23,25 @@ Graph::FretBoard::~FretBoard() //**************************************************************************** void Graph::FretBoard::dataChange() { repaint(true); } //**************************************************************************** void Graph::FretBoard::paintEvent(QPaintEvent* pe) { Q_UNUSED(pe); int instid=data->getCurrentInstrumentID(); inst=data->getInstrument(instid); - //qDebug("inst %d is %s",instid,inst.instName().data()); + //odebug << "inst " << instid << " is " << inst.instName().data() << "" << oendl; QRect mysize=rect(); xmargin=(int)(mysize.width()*0.05); xmin=2*xmargin; xmax=mysize.width()-xmargin; xwidth=xmax-xmin; ymargin=(int)(mysize.height()*0.1); ymin=ymargin; ymax=mysize.height()-2*ymargin; yheight=ymax-ymin; @@ -134,35 +139,35 @@ void Graph::FretBoard::paintScale(QPainter* p) int y=(int)(stringdist*s)+ymin; int stingid=inst.noOfStrings()-(s+1); for(int f=0;f<=inst.noOfFrets();f++) { int note=inst.string(stingid)+f; if(scale.noteInScale(data->getCurrentBaseNote(),note)) { int x=(int)(fretdist*f)+xmin; //no more than six octaves can be visualised (there is a zero octave) int octave=Note::octaveOfBaseNote(data->getCurrentBaseNote(),note)-baseoctave; if(octave<0) - qDebug("%d,%d",octave,baseoctave); + odebug << "" << octave << "," << baseoctave << "" << oendl; if(octave>5) { - qDebug("octave out of range"); + odebug << "octave out of range" << oendl; octave=5; } p->setPen(QColor(255,0,0)); int c= ( (note-12*baseoctave) - (12*octave+data->getCurrentBaseNote()) )*15; if(c<0 || c>255) - qDebug("%d = %d - ( %d + %d)",c,note,12*octave,data->getCurrentBaseNote()); + odebug << "" << c << " = " << note << " - ( " << 12*octave << " + " << data->getCurrentBaseNote() << ")" << oendl; QColor dotcolor(255,255,255); if(octave==0) dotcolor=QColor(c,c,255); else if(octave==1) dotcolor=QColor(c,255,c); else if(octave==2) dotcolor=QColor(255,c,c); else if(octave==3) dotcolor=QColor(255,255,c); else if(octave==4) dotcolor=QColor(255,c,255); diff --git a/noncore/multimedia/tonleiter/tonleiter.pro b/noncore/multimedia/tonleiter/tonleiter.pro index 4bd1bc2..4be3bef 100644 --- a/noncore/multimedia/tonleiter/tonleiter.pro +++ b/noncore/multimedia/tonleiter/tonleiter.pro @@ -1,13 +1,11 @@ TEMPLATE = app -#CONFIG = qt warn_on CONFIG = qt warn_on HEADERS = mainwidget.h tonleiterdata.h tonleiterdatahelper.h fretboard.h menuwidget.h editinst.h editstringwidget.h editscale.h pianoscale.h SOURCES = mainwidget.cpp tonleiterdata.cpp tonleiterdatahelper.cpp fretboard.cpp menuwidget.cpp main.cpp editinst.cpp editstringwidget.cpp editscale.cpp pianoscale.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -INTERFACES = +LIBS += -lqpe -lopiecore2 TARGET = tonleiter DESTDIR = $(OPIEDIR)/bin -#TMAKE_CXXFLAGS += -DQT_QWS_VERCEL_IDR -DQWS -fno-exceptions -fno-rtti + include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/multimedia/tonleiter/tonleiterdata.cpp b/noncore/multimedia/tonleiter/tonleiterdata.cpp index 33b3c49..564b7f0 100644 --- a/noncore/multimedia/tonleiter/tonleiterdata.cpp +++ b/noncore/multimedia/tonleiter/tonleiterdata.cpp @@ -1,18 +1,19 @@ #include "tonleiterdata.h" - -#include <qpe/config.h> - using namespace Data; +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +using namespace Opie::Core; TonleiterData::TonleiterData(QObject* parent) :QObject(parent) { drawnames=true; loadData(); } //**************************************************************************** TonleiterData::~TonleiterData() { saveData(); } @@ -143,47 +144,47 @@ void TonleiterData::saveData() //**************************************************************************** int TonleiterData::noOfInstruments() { return (int)instruments.count(); } //**************************************************************************** Instrument TonleiterData::getInstrument(int id) { if(id>=0 && id<noOfInstruments()) return instruments[id]; else { - qDebug("undefined insrtument %d of %d",id,instruments.count()); + odebug << "undefined insrtument " << id << " of " << instruments.count() << "" << oendl; return Instrument(); } } //**************************************************************************** int TonleiterData::getCurrentInstrumentID() { return currentInstrumentID; } //**************************************************************************** int TonleiterData::noOfScales() { return (int)scales.count(); } //**************************************************************************** Scale TonleiterData::getScale(int id) { if(id>=0 && id<noOfScales()) return scales[id]; else { - qDebug("Undefined scale"); + odebug << "Undefined scale" << oendl; return Scale(); } } //**************************************************************************** int TonleiterData::getCurrentScaleID() { return currentScaleID; } //**************************************************************************** int TonleiterData::getCurrentBaseNote() { return currentNote; diff --git a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp index d904a71..285d2c1 100644 --- a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp +++ b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp @@ -25,25 +25,25 @@ int Note::getNoteFromName(QString name,int octave) { notevalue=a; break; } } return notevalue+12*octave; } //**************************************************************************** int Note::octaveOfBaseNote(int base,int note) { int normnote = (note>=base) ? note-base : (12-base)+note; int octave=getOctaveOfNote(normnote); - //qDebug("note %d of %d base is norm %d -> ocatve %d",note,base,normnote,octave); + //odebug << "note " << note << " of " << base << " base is norm " << normnote << " -> ocatve " << octave << "" << oendl; return octave; } //**************************************************************************** //**************************************************************************** Instrument::Instrument() { name="UNDEFINED"; frets=0; } //**************************************************************************** Instrument::Instrument(QString name,int frets,QValueList<int> strings) :name(name),frets(frets),strings(strings) @@ -122,23 +122,23 @@ QString Scale::scaleName() { return name; } //**************************************************************************** bool Scale::noteInScale(int base,int note) { int octave=Note::getOctaveOfNote(note); note-=12*octave; int normnote = (note>=base) ? note-base : (12-base)+note; if(halftones.contains(normnote)>0) { - //qDebug("OK : base : %d, note %d -> norm %d",base,note,normnote); + //odebug << "OK : base : " << base << ", note " << note << " -> norm " << normnote << "" << oendl; return true; } else { - //qDebug("BAD : base : %d, note %d -> norm %d",base,note,normnote); + //odebug << "BAD : base : " << base << ", note " << note << " -> norm " << normnote << "" << oendl; return false; } } //**************************************************************************** //**************************************************************************** diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index 54d2da2..ae28313 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp @@ -69,25 +69,25 @@ void POP3viewItem::refresh() QValueList<FolderP>::ConstIterator it; QListViewItem*item = 0; for ( it = folders->begin(); it!=folders->end(); ++it) { item = new POP3folderItem( (*it), this , item ); item->setSelectable( (*it)->may_select()); } delete folders; } RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) { - qDebug( "POP3 fetchBody" ); + odebug << "POP3 fetchBody" << oendl; return wrapper->fetchBody( mail ); } QPopupMenu * POP3viewItem::getContextMenu() { QPopupMenu *m = new QPopupMenu(0); if (m) { if (!account->getOffline()) { m->insertItem(QObject::tr("Disconnect",contextName),0); m->insertItem(QObject::tr("Set offline",contextName),1); @@ -260,25 +260,25 @@ void NNTPviewItem::refresh() QValueList<FolderP>::ConstIterator it; QListViewItem*item = 0; for ( it = folders->begin(); it!=folders->end(); ++it) { item = new NNTPfolderItem( (*it), this , item ); item->setSelectable( (*it)->may_select()); } delete folders; } RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) { - qDebug( "NNTP fetchBody" ); + odebug << "NNTP fetchBody" << oendl; return wrapper->fetchBody( mail ); } QPopupMenu * NNTPviewItem::getContextMenu() { QPopupMenu *m = new QPopupMenu(0); if (m) { if (!account->getOffline()) { m->insertItem(QObject::tr("Disconnect",contextName),0); m->insertItem(QObject::tr("Set offline",contextName),1); @@ -451,25 +451,25 @@ void IMAPviewItem::refreshFolders(bool force) QValueList<FolderP>::Iterator it; QListViewItem*item = 0; QListViewItem*titem = 0; QString fname,del,search; int pos; for ( it = folders->begin(); it!=folders->end(); ++it) { if ((*it)->getDisplayName().lower()=="inbox") { item = new IMAPfolderItem( (*it), this , item ); folders->remove(it); - qDebug("inbox found"); + odebug << "inbox found" << oendl; break; } } for ( it = folders->begin(); it!=folders->end(); ++it) { fname = (*it)->getDisplayName(); currentFolders.append((*it)->getName()); pos = fname.findRev((*it)->Separator()); if (pos != -1) { fname = fname.left(pos); } @@ -524,25 +524,25 @@ void IMAPviewItem::createNewFolder() { delemiter = item->Delemiter(); } if (wrapper->createMbox(ndir,0,delemiter,makesubs)) { refreshFolders(true); } } } void IMAPviewItem::contextMenuSelected(int id) { - qDebug("Id selected: %i",id); + odebug << "Id selected: " << id << "" << oendl; switch (id) { case 0: refreshFolders(true); break; case 1: createNewFolder(); break; case 2: removeChilds(); wrapper->logout(); break; @@ -662,25 +662,25 @@ void IMAPfolderItem::createNewFolder() { imap->refreshFolders(true); } } } void IMAPfolderItem::deleteFolder() { int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), QObject::tr("Yes",contextName), QObject::tr("No",contextName),QString::null,1,1); - qDebug("Auswahl: %i",yesno); + odebug << "Auswahl: " << yesno << "" << oendl; if (yesno == 0) { if (imap->getWrapper()->deleteMbox(folder)) { QListView*v=listView(); IMAPviewItem * box = imap; /* be carefull - after that this object is destroyd so don't use * any member of it after that call!!*/ imap->refreshFolders(true); if (v) { v->setSelected(box,true); @@ -689,25 +689,25 @@ void IMAPfolderItem::deleteFolder() } } void IMAPfolderItem::downloadMails() { AccountView*bl = imap->accountView(); if (!bl) return; bl->downloadMails(folder,imap->getWrapper()); } void IMAPfolderItem::contextMenuSelected(int id) { - qDebug("Selected id: %i",id); + odebug << "Selected id: " << id << "" << oendl; AccountView * view = (AccountView*)listView(); switch(id) { case 0: view->refreshCurrent(); break; case 1: deleteAllMail(imap->getWrapper(),folder); break; case 2: createNewFolder(); break; @@ -793,25 +793,25 @@ void MHviewItem::refresh(bool force) } else { item = new MHfolderItem( (*it), this , item ); } item->setSelectable((*it)->may_select()); } delete folders; } RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) { - qDebug( "MH fetchBody" ); + odebug << "MH fetchBody" << oendl; return wrapper->fetchBody( mail ); } QPopupMenu * MHviewItem::getContextMenu() { QPopupMenu *m = new QPopupMenu(0); if (m) { m->insertItem(QObject::tr("Refresh folder list",contextName),0); m->insertItem(QObject::tr("Create new folder",contextName),1); m->insertItem(QObject::tr("Delete all mails",contextName),2); m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); @@ -923,25 +923,25 @@ void MHfolderItem::refresh(QValueList<RecMailP>&target) RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) { return mbox->getWrapper()->fetchBody(aMail); } void MHfolderItem::deleteFolder() { int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), QObject::tr("Yes",contextName), QObject::tr("No",contextName),QString::null,1,1); - qDebug("Auswahl: %i",yesno); + odebug << "Auswahl: " << yesno << "" << oendl; if (yesno == 0) { if (mbox->getWrapper()->deleteMbox(folder)) { QListView*v=listView(); MHviewItem * box = mbox; /* be carefull - after that this object is destroyd so don't use * any member of it after that call!!*/ mbox->refresh(true); if (v) { v->setSelected(box,true); @@ -1065,25 +1065,25 @@ AccountView*AccountViewItem::accountView() } void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) { if (!wrapper) return; QString fname=""; if (folder) fname = folder->getDisplayName(); int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). arg(fname), QObject::tr("Yes",contextName), QObject::tr("No",contextName),QString::null,1,1); - qDebug("Auswahl: %i",yesno); + odebug << "Auswahl: " << yesno << "" << oendl; if (yesno == 0) { if (wrapper->deleteAllMail(folder)) { AccountView * view = (AccountView*)listView(); if (view) view->refreshCurrent(); } } } void AccountViewItem::removeChilds() { diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index f0a163e..0052061 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -57,48 +57,48 @@ void AccountView::populate( QList<Account> list ) imapAccounts.clear(); mhAccounts.clear(); mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); Account *it; for ( it = list.first(); it; it = list.next() ) { if ( it->getType() == MAILLIB::A_IMAP ) { IMAPaccount *imap = static_cast<IMAPaccount *>(it); - qDebug( "added IMAP " + imap->getAccountName() ); + odebug << "added IMAP " + imap->getAccountName() << oendl; imapAccounts.append(new IMAPviewItem( imap, this )); } else if ( it->getType() == MAILLIB::A_POP3 ) { POP3account *pop3 = static_cast<POP3account *>(it); - qDebug( "added POP3 " + pop3->getAccountName() ); + odebug << "added POP3 " + pop3->getAccountName() << oendl; /* must not be hold 'cause it isn't required */ (void) new POP3viewItem( pop3, this ); } else if ( it->getType() == MAILLIB::A_NNTP ) { NNTPaccount *nntp = static_cast<NNTPaccount *>(it); - qDebug( "added NNTP " + nntp->getAccountName() ); + odebug << "added NNTP " + nntp->getAccountName() << oendl; /* must not be hold 'cause it isn't required */ (void) new NNTPviewItem( nntp, this ); } } } void AccountView::refresh(QListViewItem *item) { - qDebug("AccountView refresh..."); + odebug << "AccountView refresh..." << oendl; if ( item ) { m_currentItem = item; QValueList<RecMailP> headerlist; AccountViewItem *view = static_cast<AccountViewItem *>(item); view->refresh(headerlist); emit refreshMailview(headerlist); } } void AccountView::refreshCurrent() { @@ -153,24 +153,24 @@ void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrappe targetFolder = sels.currentFolder(); if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || targetFolder.isEmpty()) { return; } if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { QMessageBox::critical(0,tr("Error creating new Folder"), tr("<center>Error while creating<br>new folder - breaking.</center>")); return; } - qDebug("Targetfolder: %s",targetFolder.latin1()); - qDebug("Fromfolder: %s",fromFolder->getName().latin1()); + odebug << "Targetfolder: " << targetFolder.latin1() << "" << oendl; + odebug << "Fromfolder: " << fromFolder->getName().latin1() << "" << oendl; fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); refreshCurrent(); } bool AccountView::currentisDraft() { AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); if (!view) return false; return view->isDraftfolder(); } diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 988a1d9..fa703c4 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp @@ -174,25 +174,25 @@ void ComposeMail::removeAttachment() if ( !attList->currentItem() ) { QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select a File.</p>" ), tr( "Ok" ) ); } else { attList->takeItem( attList->currentItem() ); } } void ComposeMail::accept() { if ( checkBoxLater->isChecked() ) { - qDebug( "Send later" ); + odebug << "Send later" << oendl; } #if 0 qDebug( "Sending Mail with " + smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); #endif Opie::Core::OSmartPointer<Mail> mail=new Mail; SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); mail->setMail(fromBox->currentText()); if ( !toLine->text().isEmpty() ) { @@ -247,25 +247,25 @@ void ComposeMail::reject() mail->setReply( replyLine->text() ); mail->setSubject( subjectLine->text() ); if (!m_replyid.isEmpty()) { QStringList ids; ids.append(m_replyid); mail->setInreply(ids); } QString txt = message->text(); if ( !sigMultiLine->text().isEmpty() ) { txt.append( "\n--\n" ); txt.append( sigMultiLine->text() ); } - qDebug(txt); + odebug << txt << oendl; mail->setMessage( txt ); /* only use the default drafts folder name! */ Storemail wrapper(AbstractMail::draftFolder()); wrapper.storeMail(mail); AttachViewItem *it = (AttachViewItem *) attList->firstChild(); /* attachments we will ignore! */ if ( it != NULL ) { QMessageBox::warning(0,tr("Store message"), tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); } @@ -283,20 +283,20 @@ void ComposeMail::reEditMail(const RecMailP¤t) message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); subjectLine->setText( data->getSubject()); toLine->setText(data->To().join(",")); ccLine->setText(data->CC().join(",")); bccLine->setText(data->Bcc().join(",")); replyLine->setText(data->Replyto()); } AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) : QListViewItem( parent ) { attachment = att; - qDebug( att->getMimeType() ); + odebug << att->getMimeType() << oendl; setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? Resource::loadPixmap( "UnknownDocument-14" ) : attachment->getDocLnk().pixmap() ); setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); setText( 1, QString::number( att->getSize() ) ); } diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 5c4bdf7..de064ca 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp @@ -31,25 +31,25 @@ AccountListItem::AccountListItem( QListView *parent, Account *a) ttext = "SMTP"; break; default: ttext = "UNKNOWN"; break; } setText( 1, ttext); } EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) : EditAccountsUI( parent, name, modal, flags ) { - qDebug( "New Account Configuration Widget" ); + odebug << "New Account Configuration Widget" << oendl; settings = s; mailList->addColumn( tr( "Account" ) ); mailList->addColumn( tr( "Type" ) ); newsList->addColumn( tr( "Account" ) ); connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); @@ -71,88 +71,88 @@ void EditAccounts::slotFillLists() { (void) new AccountListItem( newsList, it ); } else { (void) new AccountListItem( mailList, it ); } } } void EditAccounts::slotNewMail() { - qDebug( "New Mail Account" ); + odebug << "New Mail Account" << oendl; QString *selection = new QString(); SelectMailType selType( selection, this, 0, true ); selType.show(); if ( QDialog::Accepted == selType.exec() ) { slotNewAccount( *selection ); } } void EditAccounts::slotNewAccount( const QString &type ) { if ( type.compare( "IMAP" ) == 0 ) { - qDebug( "-> config IMAP" ); + odebug << "-> config IMAP" << oendl; IMAPaccount *account = new IMAPaccount(); IMAPconfig imap( account, this, 0, true ); if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) { settings->addAccount( account ); account->save(); slotFillLists(); } else { account->remove(); } } else if ( type.compare( "POP3" ) == 0 ) { - qDebug( "-> config POP3" ); + odebug << "-> config POP3" << oendl; POP3account *account = new POP3account(); POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) { settings->addAccount( account ); account->save(); slotFillLists(); } else { account->remove(); } } else if ( type.compare( "SMTP" ) == 0 ) { - qDebug( "-> config SMTP" ); + odebug << "-> config SMTP" << oendl; SMTPaccount *account = new SMTPaccount(); SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) { settings->addAccount( account ); account->save(); slotFillLists(); } else { account->remove(); } } else if ( type.compare( "NNTP" ) == 0 ) { - qDebug( "-> config NNTP" ); + odebug << "-> config NNTP" << oendl; NNTPaccount *account = new NNTPaccount(); NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) { settings->addAccount( account ); account->save(); slotFillLists(); } else { account->remove(); } @@ -203,25 +203,25 @@ void EditAccounts::slotDeleteAccount( Account *account ) { if ( QMessageBox::information( this, tr( "Question" ), tr( "<p>Do you really want to delete the selected Account?</p>" ), tr( "Yes" ), tr( "No" ) ) == 0 ) { settings->delAccount( account ); slotFillLists(); } } void EditAccounts::slotEditMail() { - qDebug( "Edit Mail Account" ); + odebug << "Edit Mail Account" << oendl; if ( !mailList->currentItem() ) { QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); return; } Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); slotEditAccount( a ); } @@ -232,46 +232,46 @@ void EditAccounts::slotDeleteMail() QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); return; } Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); slotDeleteAccount( a ); } void EditAccounts::slotNewNews() { - qDebug( "New News Account" ); + odebug << "New News Account" << oendl; slotNewAccount( "NNTP" ); } void EditAccounts::slotEditNews() { - qDebug( "Edit News Account" ); + odebug << "Edit News Account" << oendl; if ( !newsList->currentItem() ) { QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); return; } Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); slotEditAccount( a ); } void EditAccounts::slotDeleteNews() { - qDebug( "Delete News Account" ); + odebug << "Delete News Account" << oendl; if ( !newsList->currentItem() ) { QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); return; } Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); slotDeleteAccount( a ); } @@ -569,25 +569,25 @@ void NNTPconfig::save() data->setPort( portLine->text() ); data->setSSL( sslBox->isChecked() ); data->setLogin( loginBox->isChecked() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); QListViewItemIterator list_it( ListViewGroups ); QStringList groupList; for ( ; list_it.current(); ++list_it ) { if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { - qDebug(list_it.current()->text(0) ); + odebug << list_it.current()->text(0) << oendl; groupList.append( list_it.current()->text(0) ); } } data->setGroups( groupList ); } void NNTPconfig::accept() { save(); QDialog::accept(); } diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 6bebb7b..1a26351 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp @@ -43,67 +43,67 @@ AbstractMail* AbstractMail::getWrapper(Account*a) return new POP3wrapper((POP3account*)a); break; case MAILLIB::A_NNTP: return new NNTPwrapper((NNTPaccount*)a); break; default: return 0; } } encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) { - qDebug("Decode string start"); + odebug << "Decode string start" << oendl; char*result_text; size_t index = 0; /* reset for recursive use! */ size_t target_length = 0; result_text = 0; int mimetype = MAILMIME_MECHANISM_7BIT; if (enc.lower()=="quoted-printable") { mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; } else if (enc.lower()=="base64") { mimetype = MAILMIME_MECHANISM_BASE64; } else if (enc.lower()=="8bit") { mimetype = MAILMIME_MECHANISM_8BIT; } else if (enc.lower()=="binary") { mimetype = MAILMIME_MECHANISM_BINARY; } int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, &result_text,&target_length); encodedString* result = new encodedString(); if (err == MAILIMF_NO_ERROR) { result->setContent(result_text,target_length); } - qDebug("Decode string finished"); + odebug << "Decode string finished" << oendl; return result; } QString AbstractMail::convert_String(const char*text) { //size_t index = 0; char*res = 0; int err = MAILIMF_NO_ERROR; QString result(text); /* due a bug in libetpan it isn't usable this moment */ /* int err = mailmime_encoded_phrase_parse("iso-8859-1", text, strlen(text),&index, "iso-8859-1",&res);*/ - //qDebug("Input: %s",text); + //odebug << "Input: " << text << "" << oendl; if (err == MAILIMF_NO_ERROR && res && strlen(res)) { // result = QString(res); -// qDebug("Res: %s, length: %i",res,strlen(res)); +// odebug << "Res: " << res << ", length: " << strlen(res) << "" << oendl; } if (res) free(res); return result; } /* cp & paste from launcher */ QString AbstractMail::gen_attachment_id() { QFile file( "/proc/sys/kernel/random/uuid" ); if (!file.open(IO_ReadOnly ) ) return QString::null; diff --git a/noncore/net/mail/libmailwrapper/generatemail.cpp b/noncore/net/mail/libmailwrapper/generatemail.cpp index cb58d82..36ec232 100644 --- a/noncore/net/mail/libmailwrapper/generatemail.cpp +++ b/noncore/net/mail/libmailwrapper/generatemail.cpp @@ -88,47 +88,47 @@ mailimf_address_list *Generatemail::parseAddresses(const QString&addr ) { QString s; unsigned int i = 0; for (; i < addr.length();++i) { switch (addr[i]) { case '\"': literal_open = !literal_open; break; case ',': if (!literal_open) { s = addr.mid(startpos,i-startpos); if (!s.isEmpty()) { list.append(s); - qDebug("Appended %s",s.latin1()); + odebug << "Appended " << s.latin1() << "" << oendl; } // !!!! this is a MUST BE! startpos = ++i; } break; default: break; } } s = addr.mid(startpos,i-startpos); if (!s.isEmpty()) { list.append(s); - qDebug("Appended %s",s.latin1()); + odebug << "Appended " << s.latin1() << "" << oendl; } QStringList::Iterator it; for ( it = list.begin(); it != list.end(); it++ ) { int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() ); if ( err != MAILIMF_NO_ERROR ) { - qDebug( "Error parsing" ); - qDebug( *it ); + odebug << "Error parsing" << oendl; + odebug << *it << oendl; } else { - qDebug( "Parse success! %s",(*it).latin1()); + odebug << "Parse success! " << (*it).latin1() << "" << oendl; } } return addresses; } mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { mailmime * filePart = 0; mailmime_fields * fields = 0; mailmime_content * content = 0; mailmime_parameter * param = 0; char*name = 0; char*file = 0; @@ -166,25 +166,25 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet clist_append(content->ct_parameters,param); param = 0; } filePart = mailmime_new_empty( content, fields ); } if (filePart) { if (filename.length()>0) { err = mailmime_set_body_file( filePart, file ); } else { err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length()); } if (err != MAILIMF_NO_ERROR) { - qDebug("Error setting body with file %s",file); + odebug << "Error setting body with file " << file << "" << oendl; mailmime_free( filePart ); filePart = 0; } } if (!filePart) { if ( param != NULL ) { mailmime_parameter_free( param ); } if (content) { mailmime_content_free( content ); } @@ -197,41 +197,41 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet if (file) { free( file ); } } } return filePart; // Success :) } void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) { const Attachment *it; unsigned int count = files.count(); - qDebug("List contains %i values",count); + odebug << "List contains " << count << " values" << oendl; for ( unsigned int i = 0; i < count; ++i ) { - qDebug( "Adding file" ); + odebug << "Adding file" << oendl; mailmime *filePart; int err; it = ((QList<Attachment>)files).at(i); filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); if ( filePart == NULL ) { - qDebug( "addFileParts: error adding file:" ); - qDebug( it->getFileName() ); + odebug << "addFileParts: error adding file:" << oendl; + odebug << it->getFileName() << oendl; continue; } err = mailmime_smart_add_part( message, filePart ); if ( err != MAILIMF_NO_ERROR ) { mailmime_free( filePart ); - qDebug("error smart add"); + odebug << "error smart add" << oendl; } } } mailmime *Generatemail::buildTxtPart(const QString&str ) { mailmime *txtPart; mailmime_fields *fields; mailmime_content *content; mailmime_parameter *param; int err; param = mailmime_parameter_new( strdup( "charset" ), @@ -261,25 +261,25 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) { return txtPart; // Success :) err_free_txtPart: mailmime_free( txtPart ); err_free_fields: mailmime_fields_free( fields ); err_free_content: mailmime_content_free( content ); err_free_param: mailmime_parameter_free( param ); err_free: - qDebug( "buildTxtPart - error" ); + odebug << "buildTxtPart - error" << oendl; return NULL; // Error :( } mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { return mailimf_mailbox_new( strdup( name.latin1() ), strdup( mail.latin1() ) ); } mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail ) { mailimf_fields *fields = NULL; @@ -336,33 +336,33 @@ mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Ma h.remove(0,1); } while (h.length()>0 && h[h.length()-1]=='>') { h.remove(h.length()-1,1); } if (h.isEmpty()) continue; nsize = strlen(h.latin1()); /* yes! must be malloc! */ c_reply = (char*)malloc( (nsize+1)*sizeof(char)); memset(c_reply,0,nsize+1); memcpy(c_reply,h.latin1(),nsize); clist_append(in_reply_to,c_reply); - qDebug("In reply to: %s",c_reply); + odebug << "In reply to: " << c_reply << "" << oendl; } } if (res) { fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, in_reply_to, NULL, subject ); if ( fields == NULL ) { - qDebug("Error creating mailimf fields"); + odebug << "Error creating mailimf fields" << oendl; res = 0; } } if (res) xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), strdup( USER_AGENT ) ); if ( xmailer == NULL ) { res = 0; } else { err = mailimf_fields_add( fields, xmailer ); if ( err != MAILIMF_NO_ERROR ) { res = 0; } @@ -426,25 +426,25 @@ mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &ma addFileParts( message, mail->getAttachments() ); return message; // Success :) err_free_txtPart: mailmime_free( txtPart ); err_free_message: mailmime_free( message ); err_free_fields: mailimf_fields_free( fields ); err_free: - qDebug( "createMimeMail: error" ); + odebug << "createMimeMail: error" << oendl; return NULL; // Error :( } clist *Generatemail::createRcptList( mailimf_fields *fields ) { clist *rcptList; mailimf_field *field; rcptList = esmtp_address_list_new(); field = getField( fields, MAILIMF_FIELD_TO ); if ( field && (field->fld_type == MAILIMF_FIELD_TO) diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 0c68280..fae4c99 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp @@ -126,25 +126,25 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) default: if (aEnc->enc_token) { enc = QString(aEnc->enc_token); } break; } return enc; } void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) { if (current_rec >= 10) { - qDebug("too deep recursion!"); + odebug << "too deep recursion!" << oendl; } if (!message || !mime) { return; } int r; char*data = 0; size_t len; clistiter * cur = 0; QString b; RecPartP part = new RecPart(); switch (mime->mm_type) { @@ -263,25 +263,25 @@ QString Genericwrapper::parseAddressList( mailimf_address_list *list ) } else { first = false; } switch ( addr->ad_type ) { case MAILIMF_ADDRESS_MAILBOX: result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); break; case MAILIMF_ADDRESS_GROUP: result.append( parseGroup( addr->ad_data.ad_group ) ); break; default: - qDebug( "Generic: unkown mailimf address type" ); + odebug << "Generic: unkown mailimf address type" << oendl; break; } } return result; } QString Genericwrapper::parseGroup( mailimf_group *group ) { QString result( "" ); result.append( group->grp_display_name ); @@ -356,25 +356,25 @@ QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) return text; } void Genericwrapper::cleanMimeCache() { QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); for (;it!=bodyCache.end();++it) { encodedString*t = it.data(); //it.setValue(0); if (t) delete t; } bodyCache.clear(); - qDebug("Genericwrapper: cache cleaned"); + odebug << "Genericwrapper: cache cleaned" << oendl; } QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) { QStringList res; if (!in_replies || !in_replies->mid_list) return res; clistiter * current = 0; for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { QString h((char*)current->data); while (h.length()>0 && h[0]=='<') { h.remove(0,1); } @@ -385,44 +385,44 @@ QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) res.append(h); } } return res; } void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) { int r; mailmessage_list * env_list = 0; r = mailsession_get_messages_list(session,&env_list); if (r != MAIL_NO_ERROR) { - qDebug("Error message list"); + odebug << "Error message list" << oendl; return; } r = mailsession_get_envelopes_list(session, env_list); if (r != MAIL_NO_ERROR) { - qDebug("Error filling message list"); + odebug << "Error filling message list" << oendl; if (env_list) { mailmessage_list_free(env_list); } return; } mailimf_references * refs = 0; mailimf_in_reply_to * in_replies = 0; uint32_t i = 0; for(; i < carray_count(env_list->msg_tab) ; ++i) { mailmessage * msg; QBitArray mFlags(7); msg = (mailmessage*)carray_get(env_list->msg_tab, i); if (msg->msg_fields == NULL) { - //qDebug("could not fetch envelope of message %i", i); + //odebug << "could not fetch envelope of message " << i << "" << oendl; continue; } RecMailP mail = new RecMail(); mail->setWrapper(this); mail_flags * flag_result = 0; r = mailmessage_get_flags(msg,&flag_result); if (r == MAIL_ERROR_NOT_IMPLEMENTED) { mFlags.setBit(FLAG_SEEN); } mailimf_single_fields single_fields; mailimf_single_fields_init(&single_fields, msg->msg_fields); mail->setMsgsize(msg->msg_size); @@ -439,25 +439,25 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & } else { mail->setTo(mailbox); } if (single_fields.fld_cc) mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); if (single_fields.fld_bcc) mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); if (single_fields.fld_orig_date) mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); // crashes when accessing pop3 account? if (single_fields.fld_message_id->mid_value) { mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); - qDebug("Msgid == %s",mail->Msgid().latin1()); + odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; } if (single_fields.fld_reply_to) { QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); if (t.count()>0) { mail->setReplyto(t[0]); } } #if 0 refs = single_fields.fld_references; if (refs && refs->mid_list && clist_count(refs->mid_list)) { char * text = (char*)refs->mid_list->first->data; diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 657c2ba..35468fe 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp @@ -21,69 +21,69 @@ IMAPwrapper::~IMAPwrapper() logout(); } /* to avoid to often select statements in loops etc. we trust that we are logged in and connection is established!*/ int IMAPwrapper::selectMbox(const QString&mbox) { if (mbox == m_Lastmbox) { return MAILIMAP_NO_ERROR; } int err = mailimap_select( m_imap, (char*)mbox.latin1()); if ( err != MAILIMAP_NO_ERROR ) { - qDebug("error selecting mailbox: %s",m_imap->imap_response); + odebug << "error selecting mailbox: " << m_imap->imap_response << "" << oendl; m_Lastmbox = ""; return err; } m_Lastmbox = mbox; return err; } void IMAPwrapper::imap_progress( size_t current, size_t maximum ) { qApp->processEvents(); - qDebug( "IMAP: %i of %i", current, maximum ); + odebug << "IMAP: " << current << " of " << maximum << "" << oendl; } bool IMAPwrapper::start_tls(bool force_tls) { int err; bool try_tls; mailimap_capability_data * cap_data = 0; err = mailimap_capability(m_imap,&cap_data); if (err != MAILIMAP_NO_ERROR) { Global::statusMessage("error getting capabilities!"); - qDebug("error getting capabilities!"); + odebug << "error getting capabilities!" << oendl; return false; } clistiter * cur; for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { struct mailimap_capability * cap; cap = (struct mailimap_capability *)clist_content(cur); if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) { try_tls = true; break; } } } if (cap_data) { mailimap_capability_data_free(cap_data); } if (try_tls) { err = mailimap_starttls(m_imap); if (err != MAILIMAP_NO_ERROR && force_tls) { Global::statusMessage(tr("Server has no TLS support!")); - qDebug("Server has no TLS support!"); + odebug << "Server has no TLS support!" << oendl; try_tls = false; } else { mailstream_low * low; mailstream_low * new_low; low = mailstream_get_low(m_imap->imap_stream); if (!low) { try_tls = false; } else { int fd = mailstream_low_get_fd(low); if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { mailstream_low_free(low); mailstream_set_low(m_imap->imap_stream, new_low); @@ -116,48 +116,48 @@ void IMAPwrapper::login() } server = account->getServer().latin1(); port = account->getPort().toUInt(); if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); login.show(); if ( QDialog::Accepted == login.exec() ) { // ok user = login.getUser().latin1(); pass = login.getPassword().latin1(); } else { // cancel - qDebug( "IMAP: Login canceled" ); + odebug << "IMAP: Login canceled" << oendl; return; } } else { user = account->getUser().latin1(); pass = account->getPassword().latin1(); } m_imap = mailimap_new( 20, &imap_progress ); /* connect */ bool ssl = false; bool try_tls = false; bool force_tls = false; if ( account->ConnectionType() == 2 ) { ssl = true; } if (account->ConnectionType()==1) { force_tls = true; } if ( ssl ) { - qDebug( "using ssl" ); + odebug << "using ssl" << oendl; err = mailimap_ssl_connect( m_imap, (char*)server, port ); } else { err = mailimap_socket_connect( m_imap, (char*)server, port ); } if ( err != MAILIMAP_NO_ERROR && err != MAILIMAP_NO_ERROR_AUTHENTICATED && err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { QString failure = ""; if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { failure="Connection refused"; } else { @@ -167,25 +167,25 @@ void IMAPwrapper::login() mailimap_free( m_imap ); m_imap = 0; return; } if (!ssl) { try_tls = start_tls(force_tls); } bool ok = true; if (force_tls && !try_tls) { Global::statusMessage(tr("Server has no TLS support!")); - qDebug("Server has no TLS support!"); + odebug << "Server has no TLS support!" << oendl; ok = false; } /* login */ if (ok) { err = mailimap_login_simple( m_imap, (char*)user, (char*)pass ); if ( err != MAILIMAP_NO_ERROR ) { Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response)); ok = false; } @@ -308,35 +308,35 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() if ( (bflags = list->mb_flag) ) { selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { no_inferiors = true; } } } folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); } } else { - qDebug("error fetching folders: %s",m_imap->imap_response); + odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl; } mailimap_list_result_free( result ); /* * second stage - get the other then inbox folders */ mask = "*" ; path = account->getPrefix().latin1(); if (!path) path = ""; - qDebug(path); + odebug << path << oendl; err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); if ( err == MAILIMAP_NO_ERROR ) { current = result->first; for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { no_inferiors = false; list = (mailimap_mailbox_list *) current->data; // it is better use the deep copy mechanism of qt itself // instead of using strdup! temp = list->mb_name; if (temp.lower()=="inbox") continue; if (temp.lower()==account->getPrefix().lower()) @@ -345,25 +345,25 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { no_inferiors = true; } } } del = list->mb_delimiter; folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); } } else { - qDebug("error fetching folders %s",m_imap->imap_response); + odebug << "error fetching folders " << m_imap->imap_response << "" << oendl; } if (result) mailimap_list_result_free( result ); return folders; } RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) { RecMail * m = 0; mailimap_msg_att_item *item=0; clistcell *current,*c,*cf; mailimap_msg_att_dynamic*flist; mailimap_flag_fetch*cflag; @@ -457,26 +457,26 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) } if (h.length()>0) { m->setInreply(QStringList(h)); } } if (head->env_message_id) { m->setMsgid(QString(head->env_message_id)); } } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { #if 0 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); - qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec); - qDebug(da.toString()); + odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl; + odebug << da.toString() << oendl; #endif } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { size = item->att_data.att_static->att_data.att_rfc822_size; } } /* msg is already deleted */ if (mFlags.testBit(FLAG_DELETED) && m) { delete m; m = 0; } if (m) { m->setFlags(mFlags); @@ -515,25 +515,25 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) err = mailimap_fetch( m_imap, set, fetchType, &result ); mailimap_set_free( set ); mailimap_fetch_type_free( fetchType ); if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { mailimap_msg_att * msg_att; msg_att = (mailimap_msg_att*)current->data; mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; QValueList<int> path; body_desc = item->att_data.att_static->att_data.att_body; traverseBody(mail,body_desc,body,0,path); } else { - qDebug("error fetching body: %s",m_imap->imap_response); + odebug << "error fetching body: " << m_imap->imap_response << "" << oendl; } if (result) mailimap_fetch_list_free(result); return body; } QStringList IMAPwrapper::address_list_to_stringlist(clist*list) { QStringList l; QString from; bool named_from; clistcell *current = NULL; mailimap_address * current_address=NULL; @@ -627,25 +627,25 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { msg_att_item = (mailimap_msg_att_item*)clist_content(cur); if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; /* detach - we take over the content */ msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); } } } } else { - qDebug("error fetching text: %s",m_imap->imap_response); + odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; } if (result) mailimap_fetch_list_free(result); return res; } /* current_recursion is for recursive calls. current_count means the position inside the internal loop! */ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, int current_recursion,QValueList<int>recList,int current_count) { if (!body || current_recursion>=10) { return; @@ -654,25 +654,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t case MAILIMAP_BODY_1PART: { QValueList<int>countlist = recList; countlist.append(current_count); RecPartP currentPart = new RecPart(); mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; QString id(""); currentPart->setPositionlist(countlist); for (unsigned int j = 0; j < countlist.count();++j) { id+=(j>0?" ":""); id+=QString("%1").arg(countlist[j]); } - qDebug("ID = %s",id.latin1()); + odebug << "ID = " << id.latin1() << "" << oendl; currentPart->setIdentifier(id); fillSinglePart(currentPart,part1); /* important: Check for is NULL 'cause a body can be empty! And we put it only into the mail if it is the FIRST part */ if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); target_body->setDescription(currentPart); target_body->setBodytext(body_text); if (countlist.count()>1) { target_body->addPart(currentPart); } } else { @@ -695,25 +695,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t if (current_body->bd_type==MAILIMAP_BODY_MPART) { RecPartP targetPart = new RecPart(); targetPart->setType("multipart"); fillMultiPart(targetPart,mailDescription); countlist.append(current_count); targetPart->setPositionlist(countlist); target_body->addPart(targetPart); QString id(""); for (unsigned int j = 0; j < countlist.count();++j) { id+=(j>0?" ":""); id+=QString("%1").arg(countlist[j]); } - qDebug("ID(mpart) = %s",id.latin1()); + odebug << "ID(mpart) = " << id.latin1() << "" << oendl; } traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); if (current_body->bd_type==MAILIMAP_BODY_MPART) { countlist = recList; } ++ccount; } } break; default: break; } @@ -739,37 +739,37 @@ void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*D default: break; } } void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) { if (!which) { return; } QString sub; sub = which->bd_media_text; - qDebug("Type= text/%s",which->bd_media_text); + odebug << "Type= text/" << which->bd_media_text << "" << oendl; target_part->setSubtype(sub.lower()); target_part->setLines(which->bd_lines); fillBodyFields(target_part,which->bd_fields); } void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) { if (!which) { return; } target_part->setSubtype("rfc822"); - qDebug("Message part"); + odebug << "Message part" << oendl; /* we set this type to text/plain */ target_part->setLines(which->bd_lines); fillBodyFields(target_part,which->bd_fields); } void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) { if (!which) return; QString sub = which->bd_media_subtype; target_part->setSubtype(sub.lower()); if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { clistcell*cur = 0; @@ -810,25 +810,25 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba if (which->bd_media_basic->med_basic_type) { type = which->bd_media_basic->med_basic_type; } else { type = ""; } break; } if (which->bd_media_basic->med_subtype) { sub = which->bd_media_basic->med_subtype; } else { sub = ""; } - qDebug("Type = %s/%s",type.latin1(),sub.latin1()); + odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; target_part->setType(type.lower()); target_part->setSubtype(sub.lower()); fillBodyFields(target_part,which->bd_fields); } void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) { if (!which) return; if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { clistcell*cur; mailimap_single_body_fld_param*param=0; for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { @@ -886,34 +886,34 @@ void IMAPwrapper::deleteMail(const RecMailP&mail) if ( err != MAILIMAP_NO_ERROR ) { return; } flist = mailimap_flag_list_new_empty(); mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); store_flags = mailimap_store_att_flags_new_set_flags(flist); set = mailimap_set_new_single(mail->getNumber()); err = mailimap_store(m_imap,set,store_flags); mailimap_set_free( set ); mailimap_store_att_flags_free(store_flags); if (err != MAILIMAP_NO_ERROR) { - qDebug("error deleting mail: %s",m_imap->imap_response); + odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; return; } - qDebug("deleting mail: %s",m_imap->imap_response); + odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; /* should we realy do that at this moment? */ err = mailimap_expunge(m_imap); if (err != MAILIMAP_NO_ERROR) { - qDebug("error deleting mail: %s",m_imap->imap_response); + odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; } - qDebug("Delete successfull %s",m_imap->imap_response); + odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; } void IMAPwrapper::answeredMail(const RecMailP&mail) { mailimap_flag_list*flist; mailimap_set *set; mailimap_store_att_flags * store_flags; int err; login(); if (!m_imap) { return; } @@ -921,25 +921,25 @@ void IMAPwrapper::answeredMail(const RecMailP&mail) if ( err != MAILIMAP_NO_ERROR ) { return; } flist = mailimap_flag_list_new_empty(); mailimap_flag_list_add(flist,mailimap_flag_new_answered()); store_flags = mailimap_store_att_flags_new_add_flags(flist); set = mailimap_set_new_single(mail->getNumber()); err = mailimap_store(m_imap,set,store_flags); mailimap_set_free( set ); mailimap_store_att_flags_free(store_flags); if (err != MAILIMAP_NO_ERROR) { - qDebug("error marking mail: %s",m_imap->imap_response); + odebug << "error marking mail: " << m_imap->imap_response << "" << oendl; return; } } QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc) { QString body(""); encodedString*res = fetchRawPart(mail,path,internal_call); encodedString*r = decode_String(res,enc); delete res; if (r) { if (r->Length()>0) { @@ -989,57 +989,57 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder) } flist = mailimap_flag_list_new_empty(); mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); store_flags = mailimap_store_att_flags_new_set_flags(flist); set = mailimap_set_new_interval( 1, last ); err = mailimap_store(m_imap,set,store_flags); mailimap_set_free( set ); mailimap_store_att_flags_free(store_flags); if (err != MAILIMAP_NO_ERROR) { Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); return 0; } - qDebug("deleting mail: %s",m_imap->imap_response); + odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; /* should we realy do that at this moment? */ err = mailimap_expunge(m_imap); if (err != MAILIMAP_NO_ERROR) { Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); return 0; } - qDebug("Delete successfull %s",m_imap->imap_response); + odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; return 1; } int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) { if (folder.length()==0) return 0; login(); if (!m_imap) {return 0;} QString pre = account->getPrefix(); if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) { pre+=delemiter; } if (parentfolder) { pre += parentfolder->getDisplayName()+delemiter; } pre+=folder; if (getsubfolder) { if (delemiter.length()>0) { pre+=delemiter; } else { Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre)); return 0; } } - qDebug("Creating %s",pre.latin1()); + odebug << "Creating " << pre.latin1() << "" << oendl; int res = mailimap_create(m_imap,pre.latin1()); if (res != MAILIMAP_NO_ERROR) { Global::statusMessage(tr("%1").arg(m_imap->imap_response)); return 0; } return 1; } int IMAPwrapper::deleteMbox(const FolderP&folder) { if (!folder) return 0; login(); @@ -1080,108 +1080,108 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) case MAILIMAP_STATUS_ATT_MESSAGES: target_stat.message_count = status_info->st_value; break; case MAILIMAP_STATUS_ATT_RECENT: target_stat.message_recent = status_info->st_value; break; case MAILIMAP_STATUS_ATT_UNSEEN: target_stat.message_unseen = status_info->st_value; break; } } } else { - qDebug("Error retrieving status"); + odebug << "Error retrieving status" << oendl; } if (status) mailimap_mailbox_data_status_free(status); if (att_list) mailimap_status_att_list_free(att_list); } void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) { login(); if (!m_imap) return; if (!msg) return; int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); if (r != MAILIMAP_NO_ERROR) { Global::statusMessage("Error storing mail!"); } } MAILLIB::ATYPE IMAPwrapper::getType()const { return account->getType(); } const QString&IMAPwrapper::getName()const { - qDebug("Get name: %s",account->getAccountName().latin1()); + odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; return account->getAccountName(); } encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) { // dummy QValueList<int> path; return fetchRawPart(mail,path,false); } void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { if (targetWrapper != this) { AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); - qDebug("Using generic"); + odebug << "Using generic" << oendl; return; } mailimap_set *set = 0; login(); if (!m_imap) { return; } int err = selectMbox(fromFolder->getName()); if ( err != MAILIMAP_NO_ERROR ) { return; } int last = m_imap->imap_selection_info->sel_exists; set = mailimap_set_new_interval( 1, last ); err = mailimap_copy(m_imap,set,targetFolder.latin1()); mailimap_set_free( set ); if ( err != MAILIMAP_NO_ERROR ) { QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response); Global::statusMessage(error_msg); - qDebug(error_msg); + odebug << error_msg << oendl; return; } if (moveit) { deleteAllMail(fromFolder); } } void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { if (targetWrapper != this) { - qDebug("Using generic"); + odebug << "Using generic" << oendl; AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); return; } mailimap_set *set = 0; login(); if (!m_imap) { return; } int err = selectMbox(mail->getMbox()); if ( err != MAILIMAP_NO_ERROR ) { return; } set = mailimap_set_new_single(mail->getNumber()); err = mailimap_copy(m_imap,set,targetFolder.latin1()); mailimap_set_free( set ); if ( err != MAILIMAP_NO_ERROR ) { QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); Global::statusMessage(error_msg); - qDebug(error_msg); + odebug << error_msg << oendl; return; } if (moveit) { deleteMail(mail); } } diff --git a/noncore/net/mail/libmailwrapper/logindialog.cpp b/noncore/net/mail/libmailwrapper/logindialog.cpp index 01d177e..c9ae190 100644 --- a/noncore/net/mail/libmailwrapper/logindialog.cpp +++ b/noncore/net/mail/libmailwrapper/logindialog.cpp @@ -15,15 +15,15 @@ LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent, } else { passLine->setFocus(); } } void LoginDialog::accept() { //_user.replace( 0, _user.length(), userLine->text() ); //_pass.replace( 0, _pass.length(), passLine->text() ); _user = userLine->text(); _pass = passLine->text(); - qDebug("User im accept: |%s|",_user.latin1()); + odebug << "User im accept: |" << _user.latin1() << "|" << oendl; QDialog::accept(); } diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index 90b8865..6d44db4 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp @@ -4,25 +4,25 @@ using namespace Opie::Core; RecMail::RecMail() :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) { init(); } RecMail::RecMail(const RecMail&old) :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) { init(); copy_old(old); - qDebug("Copy constructor RecMail"); + odebug << "Copy constructor RecMail" << oendl; } RecMail::~RecMail() { wrapper = 0; } void RecMail::copy_old(const RecMail&old) { subject = old.subject; date = old.date; mbox = old.mbox; @@ -122,25 +122,25 @@ RecPart::RecPart(const RecPart&old) : Opie::Core::ORefCount(), m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) { m_type = old.m_type; m_subtype = old.m_subtype; m_identifier = old.m_identifier; m_encoding = old.m_encoding; m_description = old.m_description; m_lines = old.m_lines; m_size = old.m_size; m_Parameters = old.m_Parameters; m_poslist = old.m_poslist; - qDebug("RecPart copy constructor"); + odebug << "RecPart copy constructor" << oendl; } RecPart::~RecPart() { } void RecPart::setSize(unsigned int size) { m_size = size; } const unsigned int RecPart::Size()const @@ -246,25 +246,25 @@ const QValueList<int>& RecPart::Positionlist()const RecBody::RecBody() : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) { m_PartsList.clear(); } RecBody::RecBody(const RecBody&old) :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) { m_BodyText = old.m_BodyText; m_PartsList = old.m_PartsList; m_description = old.m_description; - qDebug("Recbody copy constructor"); + odebug << "Recbody copy constructor" << oendl; } RecBody::~RecBody() { } void RecBody::setBodytext(const QString&bodyText) { m_BodyText = bodyText; } const QString& RecBody::Bodytext()const @@ -311,32 +311,32 @@ encodedString::encodedString(const char*nContent,unsigned int nSize) } encodedString::encodedString(char*nContent,unsigned int nSize) { init(); setContent(nContent,nSize); } encodedString::encodedString(const encodedString&old) { init(); copy_old(old); - qDebug("encodedeString: copy constructor!"); + odebug << "encodedeString: copy constructor!" << oendl; } encodedString& encodedString::operator=(const encodedString&old) { init(); copy_old(old); - qDebug("encodedString: assign operator!"); + odebug << "encodedString: assign operator!" << oendl; return *this; } encodedString::~encodedString() { clean(); } void encodedString::init() { content = 0; size = 0; diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index eddc0b9..2b0d112 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp @@ -42,25 +42,25 @@ Folder::~Folder() const QString& Folder::Separator()const { return separator; } IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix ) : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf) { // Decode IMAP foldername nameDisplay = IMAPFolder::decodeFolderName( name ); /* - qDebug( "folder " + name + " - displayed as " + nameDisplay ); + odebug << "folder " + name + " - displayed as " + nameDisplay << oendl; */ prefix = aprefix; if (prefix.length()>0) { if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); } } } IMAPFolder::~IMAPFolder() { diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index e3c75f3..df2112f 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp @@ -22,25 +22,25 @@ MBOXwrapper::~MBOXwrapper() void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target ) { mailstorage*storage = mailstorage_new(NULL); QString p = MBOXPath+"/"; p+=mailbox; int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); mailfolder*folder; folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); if (r != MAIL_NO_ERROR) { - qDebug("Error initializing mbox"); + odebug << "Error initializing mbox" << oendl; mailfolder_free(folder); mailstorage_free(storage); return; } parseList(target,folder->fld_session,mailbox); mailfolder_disconnect(folder); mailfolder_free(folder); mailstorage_free(storage); Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); } @@ -61,87 +61,87 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders() } void MBOXwrapper::deleteMail(const RecMailP & mail) { mailstorage*storage = mailstorage_new(NULL); QString p = MBOXPath+"/"; p+=mail->getMbox(); int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); mailfolder*folder; folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); if (r != MAIL_NO_ERROR) { - qDebug("Error initializing mbox"); + odebug << "Error initializing mbox" << oendl; mailfolder_free(folder); mailstorage_free(storage); return; } r = mailsession_remove_message(folder->fld_session,mail->getNumber()); if (r != MAIL_NO_ERROR) { - qDebug("error deleting mail"); + odebug << "error deleting mail" << oendl; } mailfolder_free(folder); mailstorage_free(storage); } void MBOXwrapper::answeredMail(const RecMailP&) { } RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail ) { RecBodyP body = new RecBody(); mailstorage*storage = mailstorage_new(NULL); QString p = MBOXPath+"/"; p+=mail->getMbox(); mailmessage * msg; char*data=0; size_t size; int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); mailfolder*folder; folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); if (r != MAIL_NO_ERROR) { - qDebug("Error initializing mbox"); + odebug << "Error initializing mbox" << oendl; mailfolder_free(folder); mailstorage_free(storage); return body; } r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg); if (r != MAIL_NO_ERROR) { - qDebug("Error fetching mail %i",mail->getNumber()); + odebug << "Error fetching mail " << mail->getNumber() << "" << oendl; mailfolder_free(folder); mailstorage_free(storage); return body; } r = mailmessage_fetch(msg,&data,&size); if (r != MAIL_NO_ERROR) { - qDebug("Error fetching mail %i",mail->getNumber()); + odebug << "Error fetching mail " << mail->getNumber() << "" << oendl; mailfolder_free(folder); mailstorage_free(storage); mailmessage_free(msg); return body; } body = parseMail(msg); mailmessage_fetch_result_free(msg,data); mailfolder_free(folder); mailstorage_free(storage); return body; } void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) { - qDebug("MBOX %i von %i",current,maximum); + odebug << "MBOX " << current << " von " << maximum << "" << oendl; } int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool ) { QString p = MBOXPath+"/"; p+=folder; QFileInfo fi(p); if (fi.exists()) { Global::statusMessage(tr("Mailbox exists.")); return 0; } mailmbox_folder*f = 0; @@ -211,45 +211,45 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail) mailstorage_free(storage); mailmessage_free(msg); return result; } void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) { QString p = MBOXPath+"/"; p+=mailbox; mailmbox_folder*f = 0; int r = mailmbox_init(p.latin1(),0,1,0,&f); if (r != MAIL_NO_ERROR) { - qDebug("Error init folder"); + odebug << "Error init folder" << oendl; return; } deleteMails(f,target); mailmbox_done(f); } void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target) { if (!f) return; int r; QValueList<RecMailP>::ConstIterator it; for (it=target.begin(); it != target.end();++it) { r = mailmbox_delete_msg(f,(*it)->getNumber()); if (r!=MAILMBOX_NO_ERROR) { - qDebug("error delete mail"); + odebug << "error delete mail" << oendl; } } r = mailmbox_expunge(f); if (r != MAILMBOX_NO_ERROR) { - qDebug("error expunge mailbox"); + odebug << "error expunge mailbox" << oendl; } } int MBOXwrapper::deleteAllMail(const FolderP&tfolder) { if (!tfolder) return 0; QString p = MBOXPath+"/"+tfolder->getDisplayName(); int res = 1; mailfolder*folder = 0; mailmessage_list*l=0; mailstorage*storage = mailstorage_new(NULL); @@ -260,25 +260,25 @@ int MBOXwrapper::deleteAllMail(const FolderP&tfolder) } if (res) { folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); if (r != MAIL_NO_ERROR) { Global::statusMessage(tr("Error initializing mbox")); res = 0; } } if (res) { r = mailsession_get_messages_list(folder->fld_session,&l); if (r != MAIL_NO_ERROR) { - qDebug("Error message list"); + odebug << "Error message list" << oendl; res=0; } } for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { r = mailsession_remove_message(folder->fld_session,i+1); if (r != MAIL_NO_ERROR) { Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); res = 0; break; } } if (l) mailmessage_list_free(l); diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index 12472e9..cd7cecb 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp @@ -7,50 +7,50 @@ #include <stdlib.h> #include <qpe/global.h> #include <opie2/oprocess.h> using namespace Opie::Core; MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) { if (MHPath.length()>0) { if (MHPath[MHPath.length()-1]=='/') { MHPath=MHPath.left(MHPath.length()-1); } - qDebug(MHPath); + odebug << MHPath << oendl; QDir dir(MHPath); if (!dir.exists()) { dir.mkdir(MHPath); } init_storage(); } } void MHwrapper::init_storage() { int r; QString pre = MHPath; if (!m_storage) { m_storage = mailstorage_new(NULL); r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); if (r != MAIL_NO_ERROR) { - qDebug("error initializing storage"); + odebug << "error initializing storage" << oendl; mailstorage_free(m_storage); m_storage = 0; return; } } r = mailstorage_connect(m_storage); if (r!=MAIL_NO_ERROR) { - qDebug("error connecting storage"); + odebug << "error connecting storage" << oendl; mailstorage_free(m_storage); m_storage = 0; } } void MHwrapper::clean_storage() { if (m_storage) { mailstorage_disconnect(m_storage); mailstorage_free(m_storage); m_storage = 0; } @@ -61,105 +61,105 @@ MHwrapper::~MHwrapper() clean_storage(); } void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) { init_storage(); if (!m_storage) { return; } QString f = buildPath(mailbox); int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); if (r!=MAIL_NO_ERROR) { - qDebug("listMessages: error selecting folder!"); + odebug << "listMessages: error selecting folder!" << oendl; return; } parseList(target,m_storage->sto_session,f); Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); } QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() { QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); /* this is needed! */ if (m_storage) mailstorage_disconnect(m_storage); init_storage(); if (!m_storage) { return folders; } mail_list*flist = 0; clistcell*current=0; int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); if (r != MAIL_NO_ERROR || !flist) { - qDebug("error getting folder list"); + odebug << "error getting folder list" << oendl; return folders; } for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) { QString t = (char*)current->data; t.replace(0,MHPath.length(),""); folders->append(new MHFolder(t,MHPath)); } mail_list_free(flist); return folders; } void MHwrapper::deleteMail(const RecMailP&mail) { init_storage(); if (!m_storage) { return; } int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); if (r!=MAIL_NO_ERROR) { - qDebug("error selecting folder!"); + odebug << "error selecting folder!" << oendl; return; } r = mailsession_remove_message(m_storage->sto_session,mail->getNumber()); if (r != MAIL_NO_ERROR) { - qDebug("error deleting mail"); + odebug << "error deleting mail" << oendl; } } void MHwrapper::answeredMail(const RecMailP&) { } RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) { RecBodyP body = new RecBody(); init_storage(); if (!m_storage) { return body; } mailmessage * msg; char*data=0; /* mail should hold the complete path! */ int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); if (r != MAIL_NO_ERROR) { return body; } r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); if (r != MAIL_NO_ERROR) { - qDebug("Error fetching mail %i",mail->getNumber()); + odebug << "Error fetching mail " << mail->getNumber() << "" << oendl; return body; } body = parseMail(msg); mailmessage_fetch_result_free(msg,data); return body; } void MHwrapper::mbox_progress( size_t current, size_t maximum ) { - qDebug("MH %i von %i",current,maximum); + odebug << "MH " << current << " von " << maximum << "" << oendl; } QString MHwrapper::buildPath(const QString&p) { QString f=""; if (p.length()==0||p=="/") return MHPath; if (!p.startsWith(MHPath)) { f+=MHPath; } if (!p.startsWith("/")) { f+="/"; @@ -174,119 +174,119 @@ int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QStri if (!m_storage) { return 0; } QString f; if (!pfolder) { // toplevel folder f = buildPath(folder); } else { f = pfolder->getName(); f+="/"; f+=folder; } - qDebug(f); + odebug << f << oendl; int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); if (r != MAIL_NO_ERROR) { - qDebug("error creating folder %i",r); + odebug << "error creating folder " << r << "" << oendl; return 0; } - qDebug("Folder created"); + odebug << "Folder created" << oendl; return 1; } void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) { init_storage(); if (!m_storage) { return; } QString f = buildPath(Folder); int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); if (r!=MAIL_NO_ERROR) { - qDebug("error selecting folder!"); + odebug << "error selecting folder!" << oendl; return; } r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); if (r!=MAIL_NO_ERROR) { - qDebug("error storing mail"); + odebug << "error storing mail" << oendl; } return; } encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) { encodedString*result = 0; init_storage(); if (!m_storage) { return result; } mailmessage * msg = 0; char*data=0; size_t size; int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); if (r!=MAIL_NO_ERROR) { - qDebug("error selecting folder!"); + odebug << "error selecting folder!" << oendl; return result; } r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); if (r != MAIL_NO_ERROR) { Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); return 0; } r = mailmessage_fetch(msg,&data,&size); if (r != MAIL_NO_ERROR) { Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); if (msg) mailmessage_free(msg); return 0; } result = new encodedString(data,size); if (msg) mailmessage_free(msg); return result; } void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) { QString f = buildPath(mailbox); int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); if (r!=MAIL_NO_ERROR) { - qDebug("deleteMails: error selecting folder!"); + odebug << "deleteMails: error selecting folder!" << oendl; return; } QValueList<RecMailP>::ConstIterator it; for (it=target.begin(); it!=target.end();++it) { r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber()); if (r != MAIL_NO_ERROR) { - qDebug("error deleting mail"); + odebug << "error deleting mail" << oendl; break; } } } int MHwrapper::deleteAllMail(const FolderP&tfolder) { init_storage(); if (!m_storage) { return 0; } int res = 1; if (!tfolder) return 0; int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); if (r!=MAIL_NO_ERROR) { - qDebug("error selecting folder!"); + odebug << "error selecting folder!" << oendl; return 0; } mailmessage_list*l=0; r = mailsession_get_messages_list(m_storage->sto_session,&l); if (r != MAIL_NO_ERROR) { - qDebug("Error message list"); + odebug << "Error message list" << oendl; res = 0; } unsigned j = 0; for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { mailmessage * msg; msg = (mailmessage*)carray_get(l->msg_tab, i); j = msg->msg_index; r = mailsession_remove_message(m_storage->sto_session,j); if (r != MAIL_NO_ERROR) { Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); res = 0; break; @@ -299,46 +299,46 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder) int MHwrapper::deleteMbox(const FolderP&tfolder) { init_storage(); if (!m_storage) { return 0; } if (!tfolder) return 0; if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); if (r != MAIL_NO_ERROR) { - qDebug("error deleting mail box"); + odebug << "error deleting mail box" << oendl; return 0; } QString cmd = "rm -rf "+tfolder->getName(); QStringList command; command << "/bin/sh"; command << "-c"; command << cmd.latin1(); OProcess *process = new OProcess(); connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT( processEnded(Opie::Core::OProcess*))); connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); *process << command; removeMboxfailed = false; if(!process->start(OProcess::Block, OProcess::All) ) { - qDebug("could not start process"); + odebug << "could not start process" << oendl; return 0; } - qDebug("mail box deleted"); + odebug << "mail box deleted" << oendl; return 1; } void MHwrapper::processEnded(OProcess *p) { if (p) delete p; } void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) { QString lineStr = buffer; QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); @@ -369,74 +369,74 @@ MAILLIB::ATYPE MHwrapper::getType()const const QString&MHwrapper::getName()const { return MHName; } void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { init_storage(); if (!m_storage) { return; } if (targetWrapper != this) { - qDebug("Using generic"); + odebug << "Using generic" << oendl; Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); return; } - qDebug("Using internal routines for move/copy"); + odebug << "Using internal routines for move/copy" << oendl; QString tf = buildPath(targetFolder); int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); if (r != MAIL_NO_ERROR) { - qDebug("Error selecting source mailbox"); + odebug << "Error selecting source mailbox" << oendl; return; } if (moveit) { r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); } else { r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); } if (r != MAIL_NO_ERROR) { - qDebug("Error copy/moving mail internal (%i)",r); + odebug << "Error copy/moving mail internal (" << r << ")" << oendl; } } void MHwrapper::mvcpAllMails(const FolderP&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { init_storage(); if (!m_storage) { return; } if (targetWrapper != this) { - qDebug("Using generic"); + odebug << "Using generic" << oendl; Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); return; } if (!fromFolder) return; int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); if (r!=MAIL_NO_ERROR) { - qDebug("error selecting source folder!"); + odebug << "error selecting source folder!" << oendl; return; } QString tf = buildPath(targetFolder); mailmessage_list*l=0; r = mailsession_get_messages_list(m_storage->sto_session,&l); if (r != MAIL_NO_ERROR) { - qDebug("Error message list"); + odebug << "Error message list" << oendl; } unsigned j = 0; for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) { mailmessage * msg; msg = (mailmessage*)carray_get(l->msg_tab, i); j = msg->msg_index; if (moveit) { r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1()); } else { r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1()); } if (r != MAIL_NO_ERROR) { - qDebug("Error copy/moving mail internal (%i)",r); + odebug << "Error copy/moving mail internal (" << r << ")" << oendl; break; } } if (l) mailmessage_list_free(l); } diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index cfded43..5d5011a 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp @@ -20,42 +20,42 @@ NNTPwrapper::NNTPwrapper( NNTPaccount *a ) last_msg_id = 0; } NNTPwrapper::~NNTPwrapper() { logout(); QFile msg_cache(msgTempName); if (msg_cache.exists()) { msg_cache.remove(); } } void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { - qDebug( "NNTP: %i of %i", current, maximum ); + odebug << "NNTP: " << current << " of " << maximum << "" << oendl; } RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) { int err = NEWSNNTP_NO_ERROR; char *message = 0; size_t length = 0; RecBodyP body = new RecBody(); login(); if ( !m_nntp ) { return body; } mailmessage * mailmsg; if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { - qDebug("Message to large: %i",mail->Msgsize()); + odebug << "Message to large: " << mail->Msgsize() << "" << oendl; return body; } QFile msg_cache(msgTempName); cleanMimeCache(); if (mail->getNumber()!=last_msg_id) { if (msg_cache.exists()) { msg_cache.remove(); } msg_cache.open(IO_ReadWrite|IO_Truncate); @@ -125,25 +125,25 @@ void NNTPwrapper::login() user = pass = 0; if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) { LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); login.show(); if ( QDialog::Accepted == login.exec() ) { // ok User = login.getUser().latin1(); Pass = login.getPassword().latin1(); } else { // cancel - qDebug( "NNTP: Login canceled" ); + odebug << "NNTP: Login canceled" << oendl; return; } } else { User = account->getUser().latin1(); Pass = account->getPassword().latin1(); } if (User.isEmpty()) { user=0; pass = 0; } else { user=User.latin1(); @@ -162,25 +162,25 @@ void NNTPwrapper::login() } else if ( conntypeset == 1 ) { conntype = CONNECTION_TYPE_STARTTLS; } else if ( conntypeset == 0 ) { conntype = CONNECTION_TYPE_TRY_STARTTLS; } nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, (char*)user,(char*)pass,0,0,0); err = mailstorage_connect( m_nntp ); if (err != NEWSNNTP_NO_ERROR) { - qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); + odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; // Global::statusMessage(tr("Error initializing folder")); mailstorage_free(m_nntp); m_nntp = 0; } else { mailsession * session = m_nntp->sto_session; newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; news->nntp_progr_fun = &nntp_progress; } } diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 5467547..c586c29 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp @@ -19,42 +19,42 @@ POP3wrapper::POP3wrapper( POP3account *a ) last_msg_id = 0; } POP3wrapper::~POP3wrapper() { logout(); QFile msg_cache(msgTempName); if (msg_cache.exists()) { msg_cache.remove(); } } void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { - qDebug( "POP3: %i of %i", current, maximum ); + odebug << "POP3: " << current << " of " << maximum << "" << oendl; } RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { int err = MAILPOP3_NO_ERROR; char *message = 0; size_t length = 0; RecBodyP body = new RecBody(); login(); if ( !m_pop3 ) { return body; } mailmessage * mailmsg; if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { - qDebug("Message to large: %i",mail->Msgsize()); + odebug << "Message to large: " << mail->Msgsize() << "" << oendl; return body; } QFile msg_cache(msgTempName); cleanMimeCache(); if (mail->getNumber()!=last_msg_id) { if (msg_cache.exists()) { msg_cache.remove(); } msg_cache.open(IO_ReadWrite|IO_Truncate); @@ -121,25 +121,25 @@ void POP3wrapper::login() server = account->getServer().latin1(); port = account->getPort().toUInt(); if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); login.show(); if ( QDialog::Accepted == login.exec() ) { // ok user = login.getUser().latin1(); pass = login.getPassword().latin1(); } else { // cancel - qDebug( "POP3: Login canceled" ); + odebug << "POP3: Login canceled" << oendl; return; } } else { user = account->getUser().latin1(); pass = account->getPassword().latin1(); } // bool ssl = account->getSSL(); m_pop3=mailstorage_new(NULL); int conntypeset = account->ConnectionType(); @@ -153,25 +153,25 @@ void POP3wrapper::login() } else if ( conntypeset == 0 ) { conntype = CONNECTION_TYPE_TRY_STARTTLS; } //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, (char*)user,(char*)pass,0,0,0); err = mailstorage_connect(m_pop3); if (err != MAIL_NO_ERROR) { - qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); + odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; Global::statusMessage(tr("Error initializing folder")); mailstorage_free(m_pop3); m_pop3 = 0; } else { mailsession * session = m_pop3->sto_session; mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; if (mail) { mail->pop3_progr_fun = &pop3_progress; } } } @@ -227,25 +227,25 @@ int POP3wrapper::deleteAllMail(const FolderP&) { } void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { login(); target_stat.message_count = 0; target_stat.message_unseen = 0; target_stat.message_recent = 0; if (!m_pop3) return; int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, &target_stat.message_recent,&target_stat.message_unseen); if (r != MAIL_NO_ERROR) { - qDebug("error getting folter status."); + odebug << "error getting folter status." << oendl; } } encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) { char*target=0; size_t length=0; encodedString*res = 0; mailmessage * mailmsg = 0; int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); err = mailmessage_fetch(mailmsg,&target,&length); if (mailmsg) mailmessage_free(mailmsg); diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index 2c81963..de36eeb 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp @@ -17,25 +17,25 @@ Settings::Settings() : QObject() { updateAccounts(); } void Settings::checkDirectory() { if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { system( "mkdir -p $HOME/Applications/opiemail" ); - qDebug( "$HOME/Applications/opiemail created" ); + odebug << "$HOME/Applications/opiemail created" << oendl; } } QList<Account> Settings::getAccounts() { return accounts; } void Settings::addAccount( Account *account ) { accounts.append( account ); } @@ -45,46 +45,46 @@ void Settings::delAccount( Account *account ) accounts.remove( account ); account->remove(); } void Settings::updateAccounts() { accounts.clear(); QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); QStringList::Iterator it; QStringList imap = dir.entryList( "imap-*" ); for ( it = imap.begin(); it != imap.end(); it++ ) { - qDebug( "Added IMAP account" ); + odebug << "Added IMAP account" << oendl; IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); accounts.append( account ); } QStringList pop3 = dir.entryList( "pop3-*" ); for ( it = pop3.begin(); it != pop3.end(); it++ ) { - qDebug( "Added POP account" ); + odebug << "Added POP account" << oendl; POP3account *account = new POP3account( (*it).replace(0, 5, "") ); accounts.append( account ); } QStringList smtp = dir.entryList( "smtp-*" ); for ( it = smtp.begin(); it != smtp.end(); it++ ) { - qDebug( "Added SMTP account" ); + odebug << "Added SMTP account" << oendl; SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); accounts.append( account ); } QStringList nntp = dir.entryList( "nntp-*" ); for ( it = nntp.begin(); it != nntp.end(); it++ ) { - qDebug( "Added NNTP account" ); + odebug << "Added NNTP account" << oendl; NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); accounts.append( account ); } readAccounts(); } void Settings::saveAccounts() { checkDirectory(); Account *it; @@ -170,25 +170,25 @@ void IMAPaccount::read() user = conf->readEntry( "User","" ); if (user.isNull()) user = ""; password = conf->readEntryCrypt( "Password","" ); if (password.isNull()) password = ""; prefix = conf->readEntry("MailPrefix",""); if (prefix.isNull()) prefix = ""; offline = conf->readBoolEntry("Offline",false); delete conf; } void IMAPaccount::save() { - qDebug( "saving " + getFileName() ); + odebug << "saving " + getFileName() << oendl; Settings::checkDirectory(); Config *conf = new Config( getFileName(), Config::File ); conf->setGroup( "IMAP Account" ); conf->writeEntry( "Account", accountName ); conf->writeEntry( "Server", server ); conf->writeEntry( "Port", port ); conf->writeEntry( "SSL", ssl ); conf->writeEntry( "ConnectionType", connectionType ); conf->writeEntry( "User", user ); conf->writeEntryCrypt( "Password", password ); conf->writeEntry( "MailPrefix",prefix); @@ -248,25 +248,25 @@ void POP3account::read() server = conf->readEntry( "Server" ); port = conf->readEntry( "Port" ); ssl = conf->readBoolEntry( "SSL" ); connectionType = conf->readNumEntry( "ConnectionType" ); user = conf->readEntry( "User" ); password = conf->readEntryCrypt( "Password" ); offline = conf->readBoolEntry("Offline",false); delete conf; } void POP3account::save() { - qDebug( "saving " + getFileName() ); + odebug << "saving " + getFileName() << oendl; Settings::checkDirectory(); Config *conf = new Config( getFileName(), Config::File ); conf->setGroup( "POP3 Account" ); conf->writeEntry( "Account", accountName ); conf->writeEntry( "Server", server ); conf->writeEntry( "Port", port ); conf->writeEntry( "SSL", ssl ); conf->writeEntry( "ConnectionType", connectionType ); conf->writeEntry( "User", user ); conf->writeEntryCrypt( "Password", password ); conf->writeEntry( "Offline",offline); @@ -330,25 +330,25 @@ void SMTPaccount::read() server = conf->readEntry( "Server" ); port = conf->readEntry( "Port" ); ssl = conf->readBoolEntry( "SSL" ); connectionType = conf->readNumEntry( "ConnectionType" ); login = conf->readBoolEntry( "Login" ); user = conf->readEntry( "User" ); password = conf->readEntryCrypt( "Password" ); delete conf; } void SMTPaccount::save() { - qDebug( "saving " + getFileName() ); + odebug << "saving " + getFileName() << oendl; Settings::checkDirectory(); Config *conf = new Config( getFileName(), Config::File ); conf->setGroup( "SMTP Account" ); conf->writeEntry( "Account", accountName ); conf->writeEntry( "Server", server ); conf->writeEntry( "Port", port ); conf->writeEntry( "SSL", ssl ); conf->writeEntry( "ConnectionType", connectionType ); conf->writeEntry( "Login", login ); conf->writeEntry( "User", user ); conf->writeEntryCrypt( "Password", password ); @@ -407,25 +407,25 @@ void NNTPaccount::read() server = conf->readEntry( "Server" ); port = conf->readEntry( "Port" ); ssl = conf->readBoolEntry( "SSL" ); login = conf->readBoolEntry( "Login" ); user = conf->readEntry( "User" ); password = conf->readEntryCrypt( "Password" ); subscribedGroups = conf->readListEntry( "Subscribed", ',' ); delete conf; } void NNTPaccount::save() { - qDebug( "saving " + getFileName() ); + odebug << "saving " + getFileName() << oendl; Settings::checkDirectory(); Config *conf = new Config( getFileName(), Config::File ); conf->setGroup( "NNTP Account" ); conf->writeEntry( "Account", accountName ); conf->writeEntry( "Server", server ); conf->writeEntry( "Port", port ); conf->writeEntry( "SSL", ssl ); conf->writeEntry( "Login", login ); conf->writeEntry( "User", user ); conf->writeEntryCrypt( "Password", password ); conf->writeEntry( "Subscribed" , subscribedGroups, ',' ); diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index e2cea7a..ba78c3b 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp @@ -106,25 +106,25 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) { from = data = 0; mailmessage * msg = 0; msg = mime_message_init(mail); mime_message_set_tmpdir(msg,getenv( "HOME" )); int r = mailmessage_fetch(msg,&data,&size); mime_message_detach_mime(msg); mailmessage_free(msg); if (r != MAIL_NO_ERROR || !data) { if (data) free(data); - qDebug("Error fetching mime..."); + odebug << "Error fetching mime..." << oendl; return; } msg = 0; if (later) { storeMail(data,size,"Outgoing"); if (data) free( data ); Config cfg( "mail" ); cfg.setGroup( "Status" ); cfg.writeEntry( "outgoing", ++m_queuedMail ); emit queuedMails( m_queuedMail ); return; @@ -199,34 +199,34 @@ void SMTPwrapper::connect_server() } int result = 1; port = m_SmtpAccount->getPort().toUInt(); m_smtp = mailsmtp_new( 20, &progress ); if ( m_smtp == NULL ) { /* no failure message cause this happens when problems with memory - than we we can not display any messagebox */ return; } int err = MAILSMTP_NO_ERROR; - qDebug( "Servername %s at port %i", server, port ); + odebug << "Servername " << server << " at port " << port << "" << oendl; if ( ssl ) { - qDebug( "SSL session" ); + odebug << "SSL session" << oendl; err = mailsmtp_ssl_connect( m_smtp, server, port ); } else { - qDebug( "No SSL session" ); + odebug << "No SSL session" << oendl; err = mailsmtp_socket_connect( m_smtp, server, port ); } if ( err != MAILSMTP_NO_ERROR ) { - qDebug("Error init connection"); + odebug << "Error init connection" << oendl; failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); result = 0; } /* switch to tls after init 'cause there it will send the ehlo */ if (result) { err = mailsmtp_init( m_smtp ); if (err != MAILSMTP_NO_ERROR) { result = 0; failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); } } @@ -237,47 +237,47 @@ void SMTPwrapper::connect_server() try_tls = false; } else { err = mailesmtp_ehlo(m_smtp); } } if (!try_tls && force_tls) { result = 0; failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err)); } if (result==1 && m_SmtpAccount->getLogin() ) { - qDebug("smtp with auth"); + odebug << "smtp with auth" << oendl; if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { // get'em LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); login.show(); if ( QDialog::Accepted == login.exec() ) { // ok user = login.getUser().latin1(); pass = login.getPassword().latin1(); } else { result = 0; failuretext=tr("Login aborted - storing mail to localfolder"); } } else { user = m_SmtpAccount->getUser().latin1(); pass = m_SmtpAccount->getPassword().latin1(); } - qDebug( "session->auth: %i", m_smtp->auth); + odebug << "session->auth: " << m_smtp->auth << "" << oendl; if (result) { err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass ); if ( err == MAILSMTP_NO_ERROR ) { - qDebug("auth ok"); + odebug << "auth ok" << oendl; } else { failuretext = tr("Authentification failed"); result = 0; } } } } void SMTPwrapper::disc_server() { if (m_smtp) { mailsmtp_quit( m_smtp ); @@ -298,43 +298,43 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) err = mailsmtp_send( m_smtp, from, rcpts, data, size ); if ( err != MAILSMTP_NO_ERROR ) { failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); result = 0; } } else { result = 0; } if (!result) { storeFailedMail(data,size,failuretext); } else { - qDebug( "Mail sent." ); + odebug << "Mail sent." << oendl; storeMail(data,size,"Sent"); } return result; } void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) { mailmime * mimeMail; mimeMail = createMimeMail(mail ); if ( mimeMail == NULL ) { - qDebug( "sendMail: error creating mime mail" ); + odebug << "sendMail: error creating mime mail" << oendl; } else { sendProgress = new progressMailSend(); sendProgress->show(); sendProgress->setMaxMails(1); smtpSend( mimeMail,later); - qDebug("Clean up done"); + odebug << "Clean up done" << oendl; sendProgress->hide(); delete sendProgress; sendProgress = 0; mailmime_free( mimeMail ); } } int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { size_t curTok = 0; mailimf_fields *fields = 0; mailimf_field*ffrom = 0; clist *rcpts = 0; @@ -369,45 +369,45 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { free(from); } if (rcpts) { smtp_address_list_free( rcpts ); } return res; } /* this is a special fun */ bool SMTPwrapper::flushOutbox() { bool returnValue = true; - qDebug("Sending the queue"); + odebug << "Sending the queue" << oendl; if (!m_SmtpAccount) { - qDebug("No smtp account given"); + odebug << "No smtp account given" << oendl; return false; } bool reset_user_value = false; QString localfolders = AbstractMail::defaultLocalfolder(); AbstractMail*wrap = AbstractMail::getWrapper(localfolders); if (!wrap) { - qDebug("memory error"); + odebug << "memory error" << oendl; return false; } QString oldPw, oldUser; QValueList<RecMailP> mailsToSend; QValueList<RecMailP> mailsToRemove; QString mbox("Outgoing"); wrap->listMessages(mbox,mailsToSend); if (mailsToSend.count()==0) { delete wrap; - qDebug("No mails to send"); + odebug << "No mails to send" << oendl; return false; } oldPw = m_SmtpAccount->getPassword(); oldUser = m_SmtpAccount->getUser(); if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { // get'em QString user,pass; LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); login.show(); if ( QDialog::Accepted == login.exec() ) { // ok diff --git a/noncore/net/mail/libmailwrapper/statusmail.cpp b/noncore/net/mail/libmailwrapper/statusmail.cpp index b78244d..51383f6 100644 --- a/noncore/net/mail/libmailwrapper/statusmail.cpp +++ b/noncore/net/mail/libmailwrapper/statusmail.cpp @@ -34,25 +34,25 @@ void StatusMail::initAccounts(QList<Account>&accounts) currentImapStat.message_count+=currentStat.message_unseen; currentImapStat.message_count+=currentStat.message_recent; currentImapStat.message_count+=currentStat.message_count; } else if ( it->getType() == MAILLIB::A_POP3 && !it->getOffline() ) { POP3account *pop3 = static_cast<POP3account *>(it); current = AbstractMail::getWrapper(pop3); connectionList.append(current); current->statusFolder(currentStat); currentPop3Stat.message_count+=currentStat.message_count; } current->logout(); } - qDebug("Pop3 init count: %i",currentPop3Stat.message_count); + odebug << "Pop3 init count: " << currentPop3Stat.message_count << "" << oendl; currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; lastPop3Stat.message_unseen = currentPop3Stat.message_unseen; lastPop3Stat.message_recent = currentPop3Stat.message_recent; lastPop3Stat.message_count = currentPop3Stat.message_count; } void StatusMail::reset_status() { lastPop3Stat = currentPop3Stat; } void StatusMail::check_current_stat(folderStat&targetStat) @@ -63,28 +63,28 @@ void StatusMail::check_current_stat(folderStat&targetStat) currentPop3Stat.message_count = 0; currentPop3Stat.message_unseen = 0; currentImapStat = currentPop3Stat; for ( it = connectionList.first(); it; it = connectionList.next() ) { it->statusFolder(currentStat); it->logout(); if (it->getType() == MAILLIB::A_IMAP) { currentImapStat.message_unseen+=currentStat.message_unseen; currentImapStat.message_recent+=currentStat.message_recent; currentImapStat.message_count+=currentStat.message_count; } else if (it->getType() == MAILLIB::A_POP3) { currentPop3Stat.message_count+=currentStat.message_count; - qDebug("Pop3 count: %i",currentPop3Stat.message_count); + odebug << "Pop3 count: " << currentPop3Stat.message_count << "" << oendl; } } - qDebug("Pop3 last: %i",lastPop3Stat.message_count); + odebug << "Pop3 last: " << lastPop3Stat.message_count << "" << oendl; if (currentPop3Stat.message_count > lastPop3Stat.message_count) { currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count; currentPop3Stat.message_unseen = currentPop3Stat.message_recent; } else { lastPop3Stat.message_count = currentPop3Stat.message_count; currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; } targetStat = currentImapStat; targetStat.message_unseen+=currentPop3Stat.message_unseen; targetStat.message_recent+=currentPop3Stat.message_recent; targetStat.message_count+=currentPop3Stat.message_count; } diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp index 914a11d..546d756 100644 --- a/noncore/net/mail/libmailwrapper/storemail.cpp +++ b/noncore/net/mail/libmailwrapper/storemail.cpp @@ -49,40 +49,40 @@ Storemail::Storemail(const QString&aFolder) Storemail::~Storemail() { } int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) { if (!wrapper) return 0; int ret = 1; mailmime * mimeMail = 0; mimeMail = createMimeMail(mail ); if ( mimeMail == NULL ) { - qDebug( "storeMail: error creating mime mail" ); + odebug << "storeMail: error creating mime mail" << oendl; return 0; } char *data; size_t size; data = 0; mailmessage * msg = 0; msg = mime_message_init(mimeMail); mime_message_set_tmpdir(msg,getenv( "HOME" )); int r = mailmessage_fetch(msg,&data,&size); mime_message_detach_mime(msg); mailmessage_free(msg); msg = 0; if (r != MAIL_NO_ERROR || !data) { - qDebug("Error fetching mime..."); + odebug << "Error fetching mime..." << oendl; ret = 0; } if (ret) { wrapper->storeMessage(data,size,m_tfolder); } if (data) { free(data); } if (mimeMail) { mailmime_free( mimeMail ); diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index c23ad3f..4c87d64 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -132,25 +132,25 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); #endif QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); } MainWindow::~MainWindow() { } void MainWindow::appMessage(const QCString &, const QByteArray &) { - qDebug("appMessage not reached"); + odebug << "appMessage not reached" << oendl; } void MainWindow::slotAdjustLayout() { QWidget *d = QApplication::desktop(); if ( d->width() < d->height() ) { layout->setDirection( QBoxLayout::TopToBottom ); } else { layout->setDirection( QBoxLayout::LeftToRight ); } } @@ -166,50 +166,50 @@ void MainWindow::slotAdjustColumns() mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); mailView->setColumnWidth( 2, 80 ); mailView->setColumnWidth( 3, 50 ); mailView->setColumnWidth( 4, 50 ); } void MainWindow::slotEditSettings() { } void MainWindow::slotShowFolders( bool ) { - qDebug( "slotShowFolders not reached" ); + odebug << "slotShowFolders not reached" << oendl; } void MainWindow::refreshMailView(const QValueList<RecMailP>&) { - qDebug( "refreshMailView not reached" ); + odebug << "refreshMailView not reached" << oendl; } void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) { - qDebug( "mailLeftClicked not reached" ); + odebug << "mailLeftClicked not reached" << oendl; } void MainWindow::displayMail() { - qDebug("displayMail not reached"); + odebug << "displayMail not reached" << oendl; } void MainWindow::slotDeleteMail() { - qDebug("deleteMail not reached"); + odebug << "deleteMail not reached" << oendl; } void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) { - qDebug("mailHold not reached"); + odebug << "mailHold not reached" << oendl; } void MainWindow::slotSendQueued() { } void MainWindow::slotEditAccounts() { } void MainWindow::slotComposeMail() { diff --git a/noncore/net/mail/nntpgroups.cpp b/noncore/net/mail/nntpgroups.cpp index 8741c4b..3243ee3 100644 --- a/noncore/net/mail/nntpgroups.cpp +++ b/noncore/net/mail/nntpgroups.cpp @@ -44,19 +44,19 @@ void NNTPGroups::fillGroups() item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); item->setOn( true ); } } void NNTPGroups::storeValues() { if (!m_Account) return; QListViewItemIterator list_it( GroupListView ); subscribedGroups.clear(); for ( ; list_it.current(); ++list_it ) { if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { - qDebug(list_it.current()->text(0) ); + odebug << list_it.current()->text(0) << oendl; subscribedGroups.append( list_it.current()->text(0) ); } } subscribedGroups+=subscribedGroupsNotListed; m_Account->setGroups( subscribedGroups ); } diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 5da2161..0669b5a 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -58,31 +58,31 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email) } else { compose.setTo(email); } } compose.slotAdjustColumns(); QPEApplication::execDialog( &compose ); } void OpieMail::slotComposeMail() { - qDebug( "Compose Mail" ); + odebug << "Compose Mail" << oendl; slotwriteMail(0l,0l); } void OpieMail::slotSendQueued() { - qDebug( "Send Queued" ); + odebug << "Send Queued" << oendl; SMTPaccount *smtp = 0; QList<Account> list = settings->getAccounts(); QList<SMTPaccount> smtpList; smtpList.setAutoDelete(false); Account *it; for ( it = list.first(); it; it = list.next() ) { if ( it->getType() == MAILLIB::A_SMTP ) { smtp = static_cast<SMTPaccount *>(it); smtpList.append(smtp); @@ -111,36 +111,36 @@ void OpieMail::slotSendQueued() { SMTPwrapper * wrap = new SMTPwrapper(smtp); if ( wrap->flushOutbox() ) { QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); } delete wrap; } } void OpieMail::slotSearchMails() { - qDebug( "Search Mails" ); + odebug << "Search Mails" << oendl; } void OpieMail::slotEditSettings() { SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); QPEApplication::execDialog( &settingsDialog ); } void OpieMail::slotEditAccounts() { - qDebug( "Edit Accounts" ); + odebug << "Edit Accounts" << oendl; EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); eaDialog.slotAdjustColumns(); QPEApplication::execDialog( &eaDialog ); if ( settings ) delete settings; settings = new Settings(); folderView->populate( settings->getAccounts() ); } void OpieMail::displayMail() { QListViewItem*item = mailView->currentItem(); @@ -171,57 +171,57 @@ void OpieMail::slotDeleteMail() { mail->Wrapper()->deleteMail( mail ); folderView->refreshCurrent(); } } void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) { if (!mailView->currentItem()) return; MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); /* just the RIGHT button - or hold on pda */ if (button!=2) {return;} - qDebug("Event right/hold"); + odebug << "Event right/hold" << oendl; if (!item) return; QPopupMenu *m = new QPopupMenu(0); if (m) { if (mailtype==MAILLIB::A_NNTP) { m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); } else { if (folderView->currentisDraft()) { m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); } m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); } m->setFocus(); m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); delete m; } } void OpieMail::slotShowFolders( bool show ) { - qDebug( "Show Folders" ); + odebug << "Show Folders" << oendl; if ( show && folderView->isHidden() ) { - qDebug( "-> showing" ); + odebug << "-> showing" << oendl; folderView->show(); } else if ( !show && !folderView->isHidden() ) { - qDebug( "-> hiding" ); + odebug << "-> hiding" << oendl; folderView->hide(); } } void OpieMail::refreshMailView(const QValueList<RecMailP>&list) { MailListViewItem*item = 0; mailView->clear(); QValueList<RecMailP>::ConstIterator it; for (it = list.begin(); it != list.end();++it) { diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp index f672a36..cac9048 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.cpp +++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp @@ -95,25 +95,25 @@ void MailApplet::slotCheck() { m_intervalTimer->changeInterval( newIntervalMs ); m_intervalMs = newIntervalMs; } if (m_statusMail == 0) { return; } folderStat stat; m_statusMail->check_current_stat( stat ); int newMailsOld = m_newMails; m_newMails = stat.message_unseen; - qDebug( QString( "test %1" ).arg( m_newMails ) ); + odebug << QString( "test %1" ).arg( m_newMails ) << oendl; if ( m_newMails > 0 && newMailsOld != m_newMails ) { ODevice *device = ODevice::inst(); if ( isHidden() ) show(); if ( m_config->readBoolEntry( "BlinkLed", true ) ) { if ( !device->ledList().isEmpty() ) { OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); } } if ( m_config->readBoolEntry( "PlaySound", false ) ) device->playAlarmSound(); diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 156e11d..a574ea1 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp @@ -130,25 +130,25 @@ void ViewMail::setBody(const RecBodyP&body ) } curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); QString filename = ""; for (unsigned int i = 0; i < body->Parts().count();++i) { filename = ""; type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); for (;it!=body->Parts()[i]->Parameters().end();++it) { - qDebug(it.key()); + odebug << it.key() << oendl; if (it.key().lower()=="name") { filename=it.data(); } } s = body->Parts()[i]->Size(); w = 0; while (s>1024) { s/=1024; ++w; if (w>=2) break; diff --git a/noncore/net/opieftp/config.in b/noncore/net/opieftp/config.in index 96e8b27..95cf73c 100644 --- a/noncore/net/opieftp/config.in +++ b/noncore/net/opieftp/config.in @@ -1,4 +1,4 @@ config OPIEFTP boolean "opie-ftp (ftp client for Opie)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && FTPLIB + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && FTPLIB diff --git a/noncore/net/opieftp/filePermissions.cpp b/noncore/net/opieftp/filePermissions.cpp index f545c1f..991fcd5 100644 --- a/noncore/net/opieftp/filePermissions.cpp +++ b/noncore/net/opieftp/filePermissions.cpp @@ -23,25 +23,25 @@ #include <unistd.h> #include <sys/stat.h> #include <stdlib.h> #include <sys/types.h> #include <pwd.h> #include <grp.h> filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName, bool useRemote ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( tr("filePermissions") ); -// qDebug("FilePermissions "+fileName); +// odebug << "FilePermissions "+fileName << oendl; resize( 236, 210 ); isRemote=useRemote; setMaximumSize( QSize( 236, 210 ) ); setCaption( tr( "Set File Permissions" ) ); TextLabel1 = new QLabel( this, "TextLabel1" ); TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); TextLabel1->setText( tr( "Set file permissions for:" ) ); LineEdit1 = new QLineEdit( this, "LineEdit1" ); LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) ); LineEdit1->setReadOnly(true); diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 4c39569..fe96103 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp @@ -10,67 +10,70 @@ * (at your option) any later version. * ***************************************************************************/ //#define DEVELOPERS_VERSION #include "opieftp.h" extern "C" { #include "../ftplib/ftplib.h" } #include "inputDialog.h" -#include <qmenubar.h> +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/mimetype.h> +using namespace Opie::Core; #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 <qmenubar.h> #include <qlineedit.h> #include <qlistbox.h> #include <qvbox.h> +/* STD */ #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( QWidget* parent, const char* name, WFlags fl) : QMainWindow( parent, name, fl ) { - qDebug("OpieFtp constructor"); + odebug << "OpieFtp constructor" << oendl; setCaption( tr( "OpieFtp" ) ); fuckeduphack=FALSE; QVBox* wrapperBox = new QVBox( this ); setCentralWidget( wrapperBox ); QWidget *view = new QWidget( wrapperBox ); QGridLayout *layout = new QGridLayout( view ); layout->setSpacing( 2); layout->setMargin( 2); connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); @@ -325,25 +328,25 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); ProgressBar->setMaximumHeight(10); filterStr="*"; b=FALSE; #if 0 populateLocalView(); #endif readConfig(); // ServerComboBox->setCurrentItem(currentServerConfig); TabWidget->setCurrentPage(2); - qDebug("Constructor done"); + odebug << "Constructor done" << oendl; } OpieFtp::~OpieFtp() { } void OpieFtp::cleanUp() { if(conn) FtpQuit(conn); QString sfile=QDir::homeDirPath(); if(sfile.right(1) != "/") @@ -396,25 +399,25 @@ void OpieFtp::newConnection() { UsernameComboBox->lineEdit()->setText(""); PasswordEdit->setText( "" ); ServerComboBox->lineEdit()->setText( ""); remotePath->setText( currentRemoteDir = "/"); PortSpinBox->setValue( 21); TabWidget->setCurrentPage(2); } void OpieFtp::serverComboEdited(const QString & ) { // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { -// qDebug("ServerComboEdited"); +// odebug << "ServerComboEdited" << oendl; // // currentServerConfig = -1; // } } void OpieFtp::UsernameComboBoxEdited(const QString &) { // currentServerConfig = -1; } void OpieFtp::PasswordEditEdited(const QString & ) { // currentServerConfig = -1; } @@ -521,25 +524,25 @@ void OpieFtp::localUpload() QString strItem = it.current()->text(0); QString localFile = currentDir.canonicalPath()+"/"+strItem; QString remoteFile= currentRemoteDir+strItem; QFileInfo fi(localFile); if( !fi.isDir()) { fsz=fi.size(); ProgressBar->setTotalSteps(fsz); FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); - qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); + odebug << "Put: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { QString msg; msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); } } else { QMessageBox::message(tr("Note"),tr("Cannot upload directories")); } ProgressBar->reset(); nullifyCallBack(); @@ -582,25 +585,25 @@ void OpieFtp::remoteDownload() // QString localFile = currentDir.canonicalPath()+"/"+strItem; QString remoteFile= currentRemoteDir+strItem; if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) fsz = 0; QString temp; temp.sprintf( remoteFile+" "+" %dkb", fsz); ProgressBar->setTotalSteps(fsz); FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); - qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); + odebug << "Get: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { QString msg; msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); } ProgressBar->reset(); nullifyCallBack(); it.current()->setSelected(FALSE); } } @@ -611,82 +614,82 @@ void OpieFtp::remoteDownload() TabWidget->setCurrentPage(0); populateLocalView(); // QCopEnvelope ( "QPE/System", "notBusy()" ); } bool OpieFtp::remoteDirList(const QString &dir) { QString tmp = QDir::homeDirPath(); if(tmp.right(1) != "/") tmp+="/._temp"; else tmp+="._temp"; -// qDebug("Listing remote dir "+tmp); +// odebug << "Listing remote dir "+tmp << oendl; // QCopEnvelope ( "QPE/System", "busy()" ); if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { QString msg; msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); return false; } populateRemoteView() ; // QCopEnvelope ( "QPE/System", "notBusy()" ); return true; } bool OpieFtp::remoteChDir(const QString &dir) { // QCopEnvelope ( "QPE/System", "busy()" ); if (!FtpChdir( dir.latin1(), conn )) { QString msg; msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); -// qDebug(msg); +// odebug << msg << oendl; // QCopEnvelope ( "QPE/System", "notBusy()" ); return FALSE; } // QCopEnvelope ( "QPE/System", "notBusy()" ); return TRUE; } void OpieFtp::populateLocalView() { Local_View->clear(); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentDir.setMatchAllDirs(TRUE); currentDir.setNameFilter(filterStr); QString fileL, fileS, fileDate; bool isDir=FALSE; const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); QFileInfoListIterator it(*list); QFileInfo *fi; while ( (fi=it.current()) ) { if (fi->isSymLink() ){ QString symLink=fi->readLink(); - qDebug("Symlink detected "+symLink); + odebug << "Symlink detected "+symLink << oendl; QFileInfo sym( symLink); fileS.sprintf( "%10i", sym.size() ); fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); fileDate = sym.lastModified().toString(); } else { - qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); + odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl; fileS.sprintf( "%10i", fi->size() ); fileL.sprintf( "%s",fi->fileName().data() ); fileDate= fi->lastModified().toString(); if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { fileL+="/"; isDir=TRUE; - qDebug( fileL); + odebug << fileL << oendl; } } if(fileL !="./" && fi->exists()) { item = new QListViewItem( Local_View,fileL, fileDate, fileS ); QPixmap pm; if(isDir || fileL.find("/",0,TRUE) != -1) { if( !QDir( fi->filePath() ).isReadable()) pm = Resource::loadPixmap( "lockedfolder" ); else pm= Resource::loadPixmap( "folder" ); item->setPixmap( 0,pm ); @@ -711,25 +714,25 @@ void OpieFtp::populateLocalView() item->setPixmap( 0,pm); } isDir=FALSE; ++it; } Local_View->setSorting( 3,FALSE); currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); fillCombo( (const QString &)currentDir); } bool OpieFtp::populateRemoteView( ) { -// qDebug("populate remoteview"); +// odebug << "populate remoteview" << oendl; QString sfile=QDir::homeDirPath(); if(sfile.right(1) != "/") sfile+="/._temp"; else sfile+="._temp"; QFile file( sfile); Remote_View->clear(); QString s, File_Name; QListViewItem *itemDir=NULL, *itemFile=NULL; QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); QString fileL, fileS, fileDate; if ( file.open(IO_ReadOnly)) { @@ -760,69 +763,69 @@ bool OpieFtp::populateRemoteView( ) // if(itemFile) item->moveItem(itemDir); item->moveItem(itemFile); itemFile=item; } } QListViewItem * item1 = new QListViewItem( Remote_View, "../"); item1->setPixmap( 0, Resource::loadPixmap( "folder" )); file.close(); if( file.exists()) file. remove(); } else - qDebug("temp file not opened successfully "+sfile); + odebug << "temp file not opened successfully "+sfile << oendl; Remote_View->setSorting( 4,TRUE); return true; } void OpieFtp::remoteListClicked(QListViewItem *selectedItem) { if( selectedItem) { // if(selectedItem!= NULL) { // QCopEnvelope ( "QPE/System", "busy()" ); QString oldRemoteCurrentDir = currentRemoteDir; QString strItem=selectedItem->text(0); strItem=strItem.simplifyWhiteSpace(); if(strItem == "../") { // the user wants to go ^ if( FtpCDUp( conn) == 0) { QString msg; msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); -// qDebug(msg); +// odebug << msg << oendl; } char path[256]; if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string QString msg; msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); -// qDebug(msg); +// odebug << msg << oendl; } currentRemoteDir=path; } else { if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); strItem = strItem.stripWhiteSpace(); currentRemoteDir = strItem; if( !remoteChDir( (const QString &)strItem)) { currentRemoteDir = oldRemoteCurrentDir; strItem=""; -// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); +// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl; } } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { currentRemoteDir = oldRemoteCurrentDir; strItem=""; -// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); +// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl; } else { currentRemoteDir = currentRemoteDir+strItem; } } else { // QCopEnvelope ( "QPE/System", "notBusy()" ); return; } } remoteDirList( (const QString &)currentRemoteDir); //this also calls populate if(currentRemoteDir.right(1) !="/") currentRemoteDir +="/"; @@ -857,25 +860,25 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem) populateLocalView(); } else { currentDir.cdUp(); populateLocalView(); } if(QDir(strItem).exists()){ currentDir.cd(strItem, TRUE); populateLocalView(); } } else { strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); if( QFile::exists(strItem ) ) { - // qDebug("upload "+strItem); + // odebug << "upload "+strItem << oendl; return; } } //end not symlink chdir(strItem.latin1()); } Local_View->ensureItemVisible(Local_View->firstChild()); } } void OpieFtp::doLocalCd() { localListClicked( Local_View->currentItem()); @@ -1161,25 +1164,25 @@ void OpieFtp::fillRemoteCombo(const QString ¤tPath) { currentPathCombo->lineEdit()->setText(currentPath); if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { currentPathCombo->clear(); remoteDirPathStringList.prepend(currentPath ); currentPathCombo->insertStringList( remoteDirPathStringList,-1); } } void OpieFtp::currentPathComboChanged() { QString oldRemoteCurrentDir = currentRemoteDir; -// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); +// odebug << "oldRemoteCurrentDir "+oldRemoteCurrentDir << oendl; if (TabWidget->currentPageIndex() == 0) { if(QDir( currentPathCombo->lineEdit()->text()).exists()) { currentDir.setPath( currentPathCombo->lineEdit()->text() ); populateLocalView(); } else { QMessageBox::message(tr("Note"),tr("That directory does not exist")); } } if (TabWidget->currentPageIndex() == 1) { currentRemoteDir = currentPathCombo->lineEdit()->text(); if(currentRemoteDir.right(1) !="/") { currentRemoteDir = currentRemoteDir +"/"; @@ -1207,32 +1210,32 @@ void OpieFtp::switchToRemoteTab() void OpieFtp::switchToConfigTab() { TabWidget->setCurrentPage(2); } void OpieFtp::readConfig() { fillCombos(); Config cfg("opieftp"); cfg.setGroup("Server"); currentServerConfig = cfg.readNumEntry("currentServer", -1); -// qDebug("Reading %d", currentServerConfig); +// odebug << "Reading " << currentServerConfig << "" << oendl; serverComboSelected( currentServerConfig-1); } void OpieFtp::writeConfig() { - qDebug("write config"); + odebug << "write config" << oendl; Config cfg("opieftp"); cfg.setGroup("Server"); QString username, remoteServerStr, remotePathStr, password, port, temp; int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); if( currentServerConfig == -1) { for (int i = 1; i <= numberOfEntries; i++) { temp.setNum(i); cfg.setGroup("Server"); @@ -1245,133 +1248,133 @@ void OpieFtp::writeConfig() remoteServerStr = cfg.readEntry( temp,""); int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); temp.setNum(numberOfEntries+1); cfg.setGroup("Server"); cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); cfg.writeEntry("currentServer", numberOfEntries+1); currentServerConfig = numberOfEntries+1; - qDebug("setting currentserverconfig to %d", currentServerConfig); + odebug << "setting currentserverconfig to " << currentServerConfig << "" << oendl; cfg.setGroup(temp); if(!newServerName.isEmpty()) cfg.writeEntry("ServerName", newServerName); cfg.writeEntry("RemotePath", remotePath->text()); cfg.writeEntry("Username", UsernameComboBox->currentText()); cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); cfg.setGroup("Server"); cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); } } void OpieFtp::clearCombos() { - qDebug("clearing"); + odebug << "clearing" << oendl; ServerComboBox->clear(); UsernameComboBox->clear(); PasswordEdit->clear(); serverListView->clear(); } void OpieFtp::fillCombos() { clearCombos(); Config cfg("opieftp"); cfg.setGroup("Server"); QString username, remoteServerStr, remotePathStr, password, port, temp; int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); for (int i = 1; i <= numberOfEntries; i++) { temp.setNum(i); - qDebug(temp); + odebug << temp << oendl; cfg.setGroup("Server"); remoteServerStr = cfg.readEntry( temp,""); - qDebug( remoteServerStr); + odebug << remoteServerStr << oendl; int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); port = remoteServerStr.right( divider - 1); bool ok; PortSpinBox->setValue( port.toInt(&ok,10)); remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); - qDebug( "remote server string "+remoteServerStr); + odebug << "remote server string "+remoteServerStr << oendl; ServerComboBox->insertItem( remoteServerStr ); cfg.setGroup(temp); username = cfg.readEntry(temp); UsernameComboBox->insertItem(username); password = cfg.readEntryCrypt(username,""); PasswordEdit->setText(password); serverListView->insertItem( cfg.readEntry("ServerName")); } } void OpieFtp::serverComboSelected(int index) { currentServerConfig = index+1; - qDebug("server combo selected %d", index+1); + odebug << "server combo selected " << index+1 << "" << oendl; QString username, remoteServerStr, remotePathStr, password, port, temp; // remoteServerStr = ServerComboBox->text(index); Config cfg("opieftp"); cfg.setGroup("Server"); // int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); temp.setNum(index+1); remoteServerStr = cfg.readEntry( temp,""); - qDebug("Group" +temp); + odebug << "Group" +temp << oendl; cfg.setGroup(temp); -// qDebug(temp); +// odebug << temp << oendl; int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); port = remoteServerStr.right( divider - 1); bool ok; int portInt = port.toInt(&ok,10); if( portInt == 0) portInt = 21; ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); PortSpinBox->setValue( portInt); remotePath->setText(cfg.readEntry("RemotePath", "/")); username = cfg.readEntry("Username", "anonymous"); UsernameComboBox->lineEdit()->setText(username); - qDebug(username); -// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); + odebug << username << oendl; +// odebug << "Password is "+cfg.readEntryCrypt(username << oendl; PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); // UsernameComboBox // PasswordEdit cfg.setGroup("Server"); temp.sprintf("%d",currentServerConfig); cfg.writeEntry("currentServer", temp); fuckeduphack = TRUE; serverListView->setCurrentItem( index); fuckeduphack=FALSE; - qDebug("server list set selected %d",index); + odebug << "server list set selected " << index << "" << oendl; update(); } void OpieFtp::deleteServer() { QString username, remoteServerStr, remotePathStr, password, port, temp, servername; remoteServerStr = ServerComboBox->currentText( ); username = UsernameComboBox->currentText(); servername=serverListView->currentText(); Config cfg("opieftp"); cfg.setGroup("Server"); @@ -1382,25 +1385,25 @@ void OpieFtp::deleteServer() temp.setNum(i); // cfg.setGroup("Server"); cfg.setGroup(QString::number(i)); tempname=cfg.readEntry( "ServerName",""); if( tempname.find( servername,0,TRUE) != -1 ) { // servername.find( cfg.readEntry("ServerName")) != -1 && // remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && // username.find( cfg.readEntry("Username")) != -1) { serverListView->removeItem(i); - qDebug("OK DELETE "+tempname); + odebug << "OK DELETE "+tempname << oendl; cfg.removeEntry(QString::number(i)); for ( ; i <= numberOfEntries; i++) { cfg.setGroup("Server"); cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); cfg.setGroup(QString::number(i+1)); //get next server config servername=cfg.readEntry("ServerName"); remoteServerStr=cfg.readEntry("RemotePath"); username=cfg.readEntry("Username"); password=cfg.readEntryCrypt( username); cfg.setGroup(QString::number(i)); @@ -1437,33 +1440,33 @@ void OpieFtp::upDir() dir.cdUp(); current = dir.canonicalPath(); chdir( current.latin1() ); currentDir.cd( current, TRUE); populateLocalView(); update(); } else { if( FtpCDUp( conn) == 0) { QString msg; msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); -// qDebug(msg); +// odebug << msg << oendl; } char path[256]; if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string QString msg; msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); -// qDebug(msg); +// odebug << msg << oendl; } currentRemoteDir=path; remoteDirList( (const QString &)currentRemoteDir); //this also calls populate if(currentRemoteDir.right(1) !="/") currentRemoteDir +="/"; currentPathCombo->lineEdit()->setText( currentRemoteDir); fillRemoteCombo( (const QString &)currentRemoteDir); } } void OpieFtp::docButtonPushed() { @@ -1506,24 +1509,24 @@ void OpieFtp::NewServer() { } } currentServerConfig =-1; writeConfig(); serverListView->insertItem( newServerName ); serverListView->setCurrentItem( serverListView->count()); } } void OpieFtp::serverListClicked( const QString &item) { if(item.isEmpty()) return; Config cfg("opieftp"); - qDebug("highltined "+item); + odebug << "highltined "+item << oendl; int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); for (int i = 1; i <= numberOfEntries; i++) { cfg.setGroup(QString::number(i)); if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack) serverComboSelected(i-1); } } void OpieFtp::timerOut() { } diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro index 2f97dc2..003b166 100644 --- a/noncore/net/opieftp/opieftp.pro +++ b/noncore/net/opieftp/opieftp.pro @@ -1,11 +1,10 @@ -#CONFIG += qt warn_on quick-app -CONFIG += qt warn_on -HEADERS = opieftp.h inputDialog.h -SOURCES = opieftp.cpp inputDialog.cpp main.cpp -TARGET = opieftp +CONFIG += qt warn_on +HEADERS = opieftp.h inputDialog.h +SOURCES = opieftp.cpp inputDialog.cpp main.cpp +TARGET = opieftp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lftplib +LIBS += -lqpe -lopiecore2 -lftplib DESTDIR = $(OPIEDIR)/bin include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/opieirc/config.in b/noncore/net/opieirc/config.in index a61cf70..2c56523 100644 --- a/noncore/net/opieirc/config.in +++ b/noncore/net/opieirc/config.in @@ -1,4 +1,4 @@ config OPIEIRC boolean "opie-irc (chat via your favorite IRC server)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && LIBQTAUX + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBQTAUX diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp index 22387b3..6d93a34 100644 --- a/noncore/net/opieirc/ircmisc.cpp +++ b/noncore/net/opieirc/ircmisc.cpp @@ -1,15 +1,18 @@ -#include <stdio.h> #include "ircmisc.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { } int IRCTabBar::insertTab(QTab *tab, int index) { /* FIXME: find some nicer way to do this */ QExtTab *ext = new QExtTab(); ext->color = black; ext->label = tab->text(); ext->r = tab->rect(); ext->enabled = tab->isEnabled(); ext->iconset = tab->iconSet(); delete tab; @@ -55,29 +58,29 @@ void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { if (m_history.count() > 0 && m_index > 0) { m_index--; setText(m_history[m_index]); } if (m_index == 0) { m_index = -1; setText(""); } } else if (key == Key_Return) { m_history.prepend(text()); m_index = -1; } else if (key == Key_Tab) { - printf("got tab\n"); + odebug << "got tab" << oendl; return; } QLineEdit::keyPressEvent(event); } bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { if (event->type() == QEvent::KeyPress) { QKeyEvent *k = (QKeyEvent *) event; /* Catch tab characters */ if (k->key() == Key_Tab) { - qDebug("tab!"); + odebug << "tab!" << oendl; return TRUE; } } return QLineEdit::eventFilter(object, event); } diff --git a/noncore/net/opieirc/opieirc.pro b/noncore/net/opieirc/opieirc.pro index 4f9092f..2455ec4 100644 --- a/noncore/net/opieirc/opieirc.pro +++ b/noncore/net/opieirc/opieirc.pro @@ -1,25 +1,24 @@ -CONFIG = qt warn_on quick-app -HEADERS = ircchannel.h ircconnection.h \ +CONFIG = qt warn_on 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 \ +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 -lopieui2 -lqtaux2 - -TARGET = opieirc +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe -lopiecore2 -lopieui2 -lqtaux2 +TARGET = opieirc include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 8a7f0bc..1d93f5c 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp @@ -197,25 +197,25 @@ namespace OpieTooth { if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { update(); } } /** * Implementation of the paint event * @param the QPaintEvent */ void BluezApplet::paintEvent( QPaintEvent* ) { QPainter p(this); - qDebug("paint bluetooth pixmap"); + odebug << "paint bluetooth pixmap" << oendl; if (bluezactive > 0) { p.drawPixmap( 0, 1, bluezOnPixmap ); } else { p.drawPixmap( 0, 1, bluezOffPixmap ); } if (bluezDiscoveryActive > 0) { p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); } } }; diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp index 09b19d2..37f2ae7 100644 --- a/noncore/net/opietooth/lib/startdunconnection.cpp +++ b/noncore/net/opietooth/lib/startdunconnection.cpp @@ -36,25 +36,25 @@ StartConnection::ConnectionType StartDunConnection::type() { return m_connectionType; } void StartDunConnection::start() { m_dunConnect = new OProcess(); *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , this, SLOT( slotExited(Opie::Core::OProcess*) ) ); connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { - qWarning( "could not start" ); + owarn << "could not start" << oendl; delete m_dunConnect; } } void StartDunConnection::slotExited( OProcess* proc ) { delete m_dunConnect; } void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) {} diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp index 24ac530..50afc9f 100644 --- a/noncore/net/opietooth/lib/startpanconnection.cpp +++ b/noncore/net/opietooth/lib/startpanconnection.cpp @@ -30,55 +30,55 @@ QString StartPanConnection::name() { } void StartPanConnection::setConnectionType() { m_connectionType = Pan; } StartConnection::ConnectionType StartPanConnection::type() { return m_connectionType; } void StartPanConnection::start() { m_panConnect = new OProcess(); - qDebug( "IM START " + m_mac ); + odebug << "IM START " + m_mac << oendl; *m_panConnect << "pand" << "--connect" << m_mac; connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , this, SLOT( slotExited(Opie::Core::OProcess*) ) ); connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { - qWarning( "could not start" ); + owarn << "could not start" << oendl; delete m_panConnect; } } void StartPanConnection::slotExited( OProcess* proc ) { delete m_panConnect; m_panConnect = 0l; } void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) {} void StartPanConnection::stop() { if ( m_panConnect ) { delete m_panConnect; m_panConnect = 0l; } m_panConnect = new OProcess(); - qDebug("IM STOP " + m_mac); + odebug << "IM STOP " + m_mac << oendl; *m_panConnect << "pand" << "--kill" << m_mac; connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , this, SLOT( slotExited(Opie::Core::OProcess*) ) ); connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { - qWarning( "could not stop" ); + owarn << "could not stop" << oendl; delete m_panConnect; } } diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 29030ab..b1cddd2 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -146,25 +146,25 @@ void BlueBase::writeConfig() 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"); + owarn << "writeToHciConfig" << oendl; 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(); } @@ -358,81 +358,81 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin * 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() ); + owarn << "Searching id " << it.key() << " " << it.data().latin1() << "" << oendl; popup = m_popHelper.find( it.key(), service->services(), (BTDeviceItem*)service->parent() ); } else { - qWarning("Empty"); + owarn << "Empty" << oendl; } if ( popup == 0l ) { - qWarning("factory returned 0l"); + owarn << "factory returned 0l" << oendl; popup = new QPopupMenu(); } int test1 = popup->insertItem( tr("Test1:"), 2); ret = popup->exec( point ); - qWarning("returned from exec() "); + owarn << "returned from exec() " << oendl; if ( ret == -1 ) { ; } else if ( ret == test1 ) { ; } delete popup; } delete menu; } /** * Search and display avail. services for a device (on expand from device listing) * @param item the service item returned */ void BlueBase::addServicesToDevice( BTDeviceItem * item ) { - qDebug("addServicesToDevice"); + odebug << "addServicesToDevice" << oendl; // row of mac adress text(3) RemoteDevice device = item->remoteDevice(); m_deviceList.insert( item->mac() , item ); // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back m_localDevice->searchServices( device ); } /** * Overloaded. This one it the one that is ted to the foundServices signal * @param device the mac address of the remote device * @param servicesList the list with the service the device has. */ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { - qDebug("fill services list"); + odebug << "fill services list" << oendl; QMap<QString,BTDeviceItem*>::Iterator it; BTDeviceItem* deviceItem = 0; // get the right devices which requested the search it = m_deviceList.find( device ); if( it == m_deviceList.end() ) return; deviceItem = it.data(); // remove previous entries QList<QListViewItem> tempList; @@ -598,25 +598,25 @@ void BlueBase::deviceActive( const RemoteDevice &device ) // We should have a BTDeviceItem there or where does it get added to the map -zecke m_localDevice->isAvailable( device.mac() ); } /** * The signal catcher. Set the avail. status on device. * @param device - the mac address * @param connected - if it is avail. or not */ void BlueBase::deviceActive( const QString& device, bool connected ) { - qDebug("deviceActive slot"); + odebug << "deviceActive slot" << oendl; QMap<QString,BTDeviceItem*>::Iterator it; it = m_deviceList.find( device ); if( it == m_deviceList.end() ) return; BTDeviceItem* deviceItem = it.data(); if ( connected ) { diff --git a/noncore/net/opietooth/manager/devicehandler.cpp b/noncore/net/opietooth/manager/devicehandler.cpp index 9c5b817..bd34351 100644 --- a/noncore/net/opietooth/manager/devicehandler.cpp +++ b/noncore/net/opietooth/manager/devicehandler.cpp @@ -24,31 +24,31 @@ QString path = QDir::homeDirPath() + "/Settings/bluetooth"; QStringList devicesFileList = deviceListSave.entryList(); // cut .conf of to get the mac and also read the name entry in it. if (!devicesFileList.isEmpty() ) { QString name; QString mac; QStringList::Iterator it; for (it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { if ( (*it) == "." || (*it) == ".." ) continue; - qDebug((*it).latin1() ); + odebug << (*it).latin1() << oendl; Config conf(path + "/"+(*it), Config::File); conf.setGroup("Info"); name = conf.readEntry("name", "Error"); mac = conf.readEntry("mac", QString::null); - qDebug("MAC: " + mac); - qDebug("NAME: " + name); + odebug << "MAC: " + mac << oendl; + odebug << "NAME: " + name << oendl; if (mac.isEmpty() ) continue; RemoteDevice currentDevice( mac , name ); list.append( currentDevice ); } } return list; }; /* * This is some how rude but make sure all old devices * are getting deleted */ @@ -57,31 +57,31 @@ void DeviceHandler::save( const RemoteDevice::ValueList& list) { rm += "rm -rf "; rm += QDir::homeDirPath() + "/Settings/bluetooth"; system ( rm.data() ); if (list.isEmpty() ) // no need to create the dir return; /** * Create a new dir */ rm = "mkdir "; rm += QDir::homeDirPath() + "/Settings/bluetooth"; - qWarning("out %s", rm.data() ); + owarn << "out " << rm.data() << "" << oendl; system( rm.data() ); RemoteDevice::ValueList::ConstIterator it; // write the config for ( it = list.begin(); it != list.end(); ++it ) { - qDebug( "/Settings/bluetooth/" + (*it).mac() + ".conf"); + odebug << "/Settings/bluetooth/" + (*it).mac() + ".conf" << oendl; Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (*it).mac() + ".conf", Config::File ); conf.setGroup( "Info" ); conf.writeEntry( "name", (*it).name() ); conf.writeEntry( "mac", (*it).mac() ); } } diff --git a/noncore/net/opietooth/manager/dunpopup.cpp b/noncore/net/opietooth/manager/dunpopup.cpp index 3043f71..5b01d2f 100644 --- a/noncore/net/opietooth/manager/dunpopup.cpp +++ b/noncore/net/opietooth/manager/dunpopup.cpp @@ -2,25 +2,25 @@ #include <qtimer.h> #include "dunpopup.h" using namespace OpieTooth; /* * c'tor init the QAction */ DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { - qWarning("DunPopup c'tor"); + owarn << "DunPopup c'tor" << oendl; m_item = item; QAction *a, *b, *c; m_dunconnection = 0l; /* connect action */ a = new QAction(); // so it's get deleted a->setText( tr("connect") ); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); diff --git a/noncore/net/opietooth/manager/hciconfwrapper.cpp b/noncore/net/opietooth/manager/hciconfwrapper.cpp index 35e9cd9..71c935c 100644 --- a/noncore/net/opietooth/manager/hciconfwrapper.cpp +++ b/noncore/net/opietooth/manager/hciconfwrapper.cpp @@ -65,75 +65,75 @@ namespace OpieTooth { void HciConfWrapper::setValue(const QString &key, const QString &value ) { if (m_file.isEmpty() ) // load first return; QStringList::Iterator it; QString str; for (it = m_file.begin(); it != m_file.end(); ++it ) { str = (*it); if( (str.contains(key)) > 0 ) { - qDebug("Found"); + odebug << "Found" << oendl; // still need to look if its commented out!!! str.simplifyWhiteSpace(); - qDebug( key ); + odebug << key << oendl; if (str.startsWith("#")) { str = (key + " " + value + ";"); } else { str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); } - qDebug( str ); + odebug << str << oendl; it = m_file.remove( it ); it = m_file.insert( it, str ); //return; the regexp is too wide -zecke // all set } } } /** * This loads the config file and stores it inside * the m_file */ void HciConfWrapper::load() { - qWarning("loaded"); + owarn << "loaded" << oendl; m_file.clear(); QFile file( m_fileName ); if (!file.open( IO_ReadOnly ) ) { - qDebug("Could not open"); + odebug << "Could not open" << oendl; return; } /** * readAll() into a QByteArray * QStringList::split('\n', array ) * would this be faster? -zecke */ QTextStream stream(&file ); QString tmp; while ( !stream.atEnd() ) { tmp = stream.readLine(); m_file.append( tmp ); } } void HciConfWrapper::save() { - qWarning("save"); + owarn << "save" << oendl; if (m_file.isEmpty() ) // load first return; QFile file( m_fileName ); if ( !file.open(IO_WriteOnly ) ) { - qWarning("could not open %s", m_fileName.latin1() ); + owarn << "could not open " << m_fileName.latin1() << "" << oendl; return; } QTextStream stream(&file ); QStringList::Iterator it; for ( it = m_file.begin(); it != m_file.end(); ++it ) { stream << (*it) << endl; } - qWarning("saved"); + owarn << "saved" << oendl; }; } diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp index 1ef862a..3a3dbb0 100644 --- a/noncore/net/opietooth/manager/obexdialog.cpp +++ b/noncore/net/opietooth/manager/obexdialog.cpp @@ -71,19 +71,19 @@ void ObexDialog::sendData() { QString fileURL = cmdLine->text(); QString file = QFileInfo( fileURL ).fileName(); QString modifiedName = chNameLine->text(); // vom popupmenu beziehen OProcess* obexSend = new OProcess(); if ( !modifiedName.isEmpty() ) { *obexSend << "ussp-push" << m_device << fileURL << modifiedName; } else { *obexSend << "ussp-push" << m_device << fileURL << file; } if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { - qWarning("could not start"); + owarn << "could not start" << oendl; delete obexSend; } } diff --git a/noncore/net/opietooth/manager/obexpopup.cpp b/noncore/net/opietooth/manager/obexpopup.cpp index d147d52..9a50199 100644 --- a/noncore/net/opietooth/manager/obexpopup.cpp +++ b/noncore/net/opietooth/manager/obexpopup.cpp @@ -7,39 +7,39 @@ /* QT */ #include <qtimer.h> using namespace OpieTooth; /* * c'tor init the QAction */ ObexPopup::ObexPopup() : QPopupMenu() { - qWarning("RfcCommPopup c'tor"); + owarn << "RfcCommPopup c'tor" << oendl; QAction* a; /* connect action */ a = new QAction( ); // so it's get deleted a->setText("Push file"); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotPush() ) ); }; ObexPopup::~ObexPopup() {} void ObexPopup::slotPush() { - qWarning("push something"); + owarn << "push something" << oendl; ObexDialog obexDialog; QPEApplication::execDialog( &obexDialog ); } diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp index 8b05964..43c2777 100644 --- a/noncore/net/opietooth/manager/panpopup.cpp +++ b/noncore/net/opietooth/manager/panpopup.cpp @@ -2,25 +2,25 @@ #include <qtimer.h> #include "panpopup.h" using namespace OpieTooth; /* * c'tor init the QAction */ PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { - qWarning("PanPopup c'tor"); + owarn << "PanPopup c'tor" << oendl; m_item = item; QAction *a, *b, *c; m_panconnection = 0l; /* connect action */ a = new QAction(); // so it's get deleted a->setText( tr("connect") ); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp index ab22fea..19deb19 100644 --- a/noncore/net/opietooth/manager/popuphelper.cpp +++ b/noncore/net/opietooth/manager/popuphelper.cpp @@ -7,28 +7,28 @@ using namespace OpieTooth; PopupHelper::PopupHelper() { init(); } PopupHelper::~PopupHelper() { } void PopupHelper::insert( int id, popupFactory fact ) { m_map.insert(id, fact ); } QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item ) { - //qWarning("find"); + //owarn << "find" << oendl; FactoryMap::Iterator it = m_map.find(id ); if ( it != m_map.end() ) { - //qWarning("found"); + //owarn << "found" << oendl; popupFactory fact = it.data(); return (*fact)(ser, item); } return 0l; } void PopupHelper::init() { insert( 4355, newRfcComPopup ); insert( 4354, newDunPopup ); insert( 4353, newRfcComPopup ); insert( 4357, newObexPushPopup ); insert( 4358, newObexPushPopup ); diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp index 78c1501..989bf45 100644 --- a/noncore/net/opietooth/manager/pppdialog.cpp +++ b/noncore/net/opietooth/manager/pppdialog.cpp @@ -47,23 +47,23 @@ PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, PPPDialog::~PPPDialog() { } void PPPDialog::connectToDevice() { outPut->clear(); // vom popupmenu beziehen QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); OProcess* pppDial = new OProcess(); *pppDial << "pppd" << m_device << "call" << connectScript; connect( pppDial, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT(fillOutPut(Opie::Core::OProcess*,char*,int) ) ); if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { - qWarning("could not start"); + owarn << "could not start" << oendl; delete pppDial; } } void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { QCString str(cha, len ); outPut->insertLine( str ); delete pppDial; } diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp index fc76301..4469129 100644 --- a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp +++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp @@ -62,46 +62,46 @@ void RfcommAssignDialog::newDevice( const QString & mac ) RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); newDev->setIdent( i ); newDev->setMac( mac ); if ( QPEApplication::execDialog( &dialog ) == 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" ); + odebug << "New device set up" << oendl; } } } } 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() " ); + odebug << "Found key in foundEntries() " << oendl; 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", "" ) ); */ } } diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.cpp b/noncore/net/opietooth/manager/rfcommconfhandler.cpp index 20453e8..2ef95ff 100644 --- a/noncore/net/opietooth/manager/rfcommconfhandler.cpp +++ b/noncore/net/opietooth/manager/rfcommconfhandler.cpp @@ -83,32 +83,32 @@ void RfCommConfHandler::load() { 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 ); + odebug << tmpLine << oendl; + odebug << "TEST " + number << oendl; } 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 ); + odebug << "mac" + mac << oendl; } 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 ); + odebug << "Comment: " + comment << oendl; } } rfCommConf.close(); } save( m_foundEntries ); - qDebug( QString( "ENTries: %1").arg( m_foundEntries.count() ) ); + odebug << QString( "ENTries: %1").arg( m_foundEntries.count() ) << oendl; } diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp index 04bfe48..01ad616 100644 --- a/noncore/net/opietooth/manager/rfcpopup.cpp +++ b/noncore/net/opietooth/manager/rfcpopup.cpp @@ -8,25 +8,25 @@ /* QT */ #include <qtimer.h> using namespace OpieTooth; /* * c'tor init the QAction */ RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { - qWarning("RfcCommPopup c'tor"); + owarn << "RfcCommPopup c'tor" << oendl; 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() ) ); @@ -61,43 +61,43 @@ RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) RfcCommPopup::~RfcCommPopup() { /* delete m_con; delete m_dis; delete m_foo; delete m_bar; */ } void RfcCommPopup::slotConnect() { - qWarning("connect"); + owarn << "connect" << oendl; PPPDialog pppDialog; QPEApplication::execDialog( &pppDialog ); } void RfcCommPopup::slotDisconnect() { - qWarning("slot disconnected"); + owarn << "slot disconnected" << oendl; } void RfcCommPopup::slotBind() { RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); rfcommAssign.newDevice( m_item->mac() ); if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted ) { rfcommAssign.saveConfig(); } } void RfcCommPopup::slotBar() { - qWarning("slotBar"); + owarn << "slotBar" << oendl; }; diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index c8ea3e3..3b005c4 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp @@ -146,16 +146,16 @@ namespace OpieTooth { if ( ( (QCheckListItem*)it.current() )->isOn() ) { RemoteDevice device( it.current()->text(1), it.current()->text(0) ); deviceList.append( device ); } } emit selectedDevices( deviceList ); } /** * Cleanup */ ScanDialog::~ScanDialog() { - qWarning("delete scan dialog"); + owarn << "delete scan dialog" << oendl; delete localDevice; } } diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index da39113..bfdb20a 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -14,50 +14,46 @@ **********************************************************************/ /* LOCAL */ #include "configwindow.h" #include "mainwindow.h" /* OPIE */ #include <opie2/onetwork.h> #ifdef QWS #include <opie2/oapplication.h> #include <opie2/oconfig.h> #include <opie2/odevice.h> -using namespace Opie; +#include <opie2/odebug.h> +using namespace Opie::Core; +using namespace Opie::Net; #endif /* QT */ #include <qapplication.h> #include <qcheckbox.h> #include <qcombobox.h> #include <qfile.h> #include <qlineedit.h> #include <qlayout.h> #include <qmap.h> #include <qpushbutton.h> #include <qtabwidget.h> #include <qtoolbutton.h> #include <qspinbox.h> #include <qtextstream.h> -/* POSIX */ +/* STD */ #include <assert.h> -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Core; -using namespace Opie::Net; WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) :WellenreiterConfigBase( parent, name, true, f ) { _devicetype[ "cisco" ] = DEVTYPE_CISCO; _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; _devicetype[ "<file>" ] = DEVTYPE_FILE; @@ -107,46 +103,46 @@ void WellenreiterConfigWindow::accept() WellenreiterConfigWindow::~WellenreiterConfigWindow() { } void WellenreiterConfigWindow::performAutodetection() { //TODO: insert modal splash screen here // and sleep a second, so that it looks // like we're actually doing something fancy... ;-) - qDebug( "WellenreiterConfigWindow::performAutodetection()" ); + odebug << "WellenreiterConfigWindow::performAutodetection()" << oendl; // try to guess device type QFile m( "/proc/modules" ); if ( m.open( IO_ReadOnly ) ) { int devicetype(0); QString line; QTextStream modules( &m ); while( !modules.atEnd() && !devicetype ) { modules >> line; if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; } if ( devicetype ) { deviceType->setCurrentItem( devicetype ); _guess = devicetype; - qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); + odebug << "Wellenreiter: guessed device type to be #" << devicetype << "" << oendl; } } } int WellenreiterConfigWindow::driverType() const { QString name = deviceType->currentText(); if ( _devicetype.contains( name ) ) { return _devicetype[name]; } @@ -232,25 +228,25 @@ void WellenreiterConfigWindow::changedClientAction(int t) } void WellenreiterConfigWindow::changedStationAction(int t) { synchronizeActionsAndScripts(); } void WellenreiterConfigWindow::getCaptureFileNameClicked() { QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); - qDebug( "name = %s", (const char*) name ); + odebug << "name = " << (const char*) name << "" << oendl; if ( !name.isEmpty() ) { captureFileName->setText( name ); } } void WellenreiterConfigWindow::channelAllClicked(int state) { bool b = state; channel1->setChecked( b ); channel2->setChecked( b ); @@ -307,70 +303,70 @@ void WellenreiterConfigWindow::performAction( const QString& type, else if ( type == "managed" || type == "adhoc" ) { action = newClientAction->currentItem(); script = newClientScript->text(); } else if ( type == "station" ) { action = newStationAction->currentItem(); script = newStationScript->text(); } else { - qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); + owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << (const char*) type << "'" << oendl; return; } - qDebug( "for event '%s' I'm going to perform action %d (script='%s')", (const char*) type, action, (const char*) script ); + odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << (const char*) script << "')" << oendl; switch( action ) { case 0: /* Ignore */ return; case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return; case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return; case 3: /* Blink LED */ break; //FIXME: Implement this case 4: /* Run Script */ { /** * * Script Substitution Information: * * $SSID = SSID * $MAC = MAC * $WEP = Wep * $CHAN = Channel * **/ script = script.replace( QRegExp( "$SSID" ), essid ); script = script.replace( QRegExp( "$MAC" ), mac ); script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); - qDebug( "going to call script '%s'", (const char*) script ); + odebug << "going to call script '" << (const char*) script << "'" << oendl; ::system( script ); - qDebug( "script returned." ); + odebug << "script returned." << oendl; return; } default: assert( false ); } } void WellenreiterConfigWindow::load() { #ifdef Q_WS_X11 #warning Persistent Configuration not yet implemented for standalone X11 build performAutodetection(); #else - qDebug( "loading configuration settings..." ); + odebug << "loading configuration settings..." << oendl; /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ OConfig* c = oApp->config(); c->setGroup( "Interface" ); QString interface = c->readEntry( "name", "<none>" ); if ( interface != "<none>" ) { #if QT_VERSION < 300 interfaceName->insertItem( interface, 0 ); @@ -430,25 +426,25 @@ void WellenreiterConfigWindow::load() startGPS->setChecked( c->readBoolEntry( "start", false ) ); commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) ); #endif } void WellenreiterConfigWindow::save() { #ifdef Q_WS_X11 #warning Persistent Configuration not yet implemented for standalone X11 build #else - qDebug( "saving configuration settings..." ); + odebug << "saving configuration settings..." << oendl; /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ OConfig* c = oApp->config(); c->setGroup( "Interface" ); c->writeEntry( "name", interfaceName->currentText() ); c->writeEntry( "type", deviceType->currentText() ); c->writeEntry( "prism", prismHeader->isChecked() ); c->writeEntry( "hop", hopChannels->isChecked() ); c->writeEntry( "interval", hopInterval->value() ); c->writeEntry( "adaptive", adaptiveHopping->isChecked() ); diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index a47b4ec..bd91e35 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp @@ -6,71 +6,75 @@ ** 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. ** **********************************************************************/ #include "gps.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + /* QT */ #include <qtextstream.h> /* STD */ #include <stdlib.h> #include <unistd.h> GPS::GPS( QObject* parent, const char * name ) :QObject( parent, name ) { - qDebug( "GPS::GPS()" ); + odebug << "GPS::GPS()" << oendl; _socket = new QSocket( this, "gpsd commsock" ); } GPS::~GPS() { - qDebug( "GPS::~GPS()" ); + odebug << "GPS::~GPS()" << oendl; } bool GPS::open( const QString& host, int port ) { _socket->connectToHost( host, port ); } GpsLocation GPS::position() const { char buf[256]; double lat = -111.0; double lon = -111.0; int result = _socket->writeBlock( "p\r\n", 3 ); _socket->flush(); if ( result ) { int numAvail = _socket->bytesAvailable(); - qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); + odebug << "GPS write succeeded, " << numAvail << " bytes available for reading..." << oendl; if ( numAvail ) { int numRead = _socket->readBlock( &buf[0], sizeof buf ); int numScan = ::sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon); if ( numRead < 7 || numScan != 2 ) { - qDebug( "GPS read %d bytes succeeded, invalid response: '%s'", numRead, &buf[0] ); + odebug << "GPS read " << numRead << " bytes succeeded, invalid response: '" << &buf[0] << "'" << oendl; return GpsLocation( -111, -111 ); } else { return GpsLocation( lat, lon ); } } } return GpsLocation( -111, -111 ); } diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp index 1c72cf4..714a9a9 100644 --- a/noncore/net/wellenreiter/gui/logwindow.cpp +++ b/noncore/net/wellenreiter/gui/logwindow.cpp @@ -5,49 +5,55 @@ ** ** 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. ** **********************************************************************/ #include "logwindow.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qmultilineedit.h> #include <qdatetime.h> MLogWindow* MLogWindow::_instance; MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) :QVBox( parent, name, f ) { ledit = new QMultiLineEdit( this ); ledit->setReadOnly( true ); MLogWindow::_instance = this; } void MLogWindow::log( QString text ) { QTime time = QTime::currentTime(); QString line; line.sprintf( "[%s] %s\n", (const char*) time.toString(), (const char*) text ); int col; int row; ledit->getCursorPosition( &col, &row ); ledit->insertAt( line, col, row ); - qDebug( line ); + odebug << line << oendl; } void MLogWindow::clear() { ledit->clear(); } const QString MLogWindow::getLog() const { return ledit->text(); diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp index 6bbc39b..62db967 100644 --- a/noncore/net/wellenreiter/gui/main.cpp +++ b/noncore/net/wellenreiter/gui/main.cpp @@ -5,97 +5,100 @@ ** ** 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. ** **********************************************************************/ #include "mainwindow.h" + #ifdef QWS +#include <opie2/odebug.h> #include <opie2/oapplication.h> #include <opie2/oprocess.h> #else #include <qapplication.h> #endif +/* QT */ #include <qmessagebox.h> #include <qstringlist.h> +/* STD */ #include <errno.h> #include <signal.h> #include <string.h> #include <unistd.h> using namespace Opie::Core; -using namespace Opie::Core; -using namespace Opie::Core; + int main( int argc, char **argv ) { #ifdef QWS OApplication a( argc, argv, "Wellenreiter II" ); #else QApplication a( argc, argv ); #endif WellenreiterMainWindow* w = new WellenreiterMainWindow(); #ifdef QWS a.showMainWidget( w ); #else a.setMainWidget( w ); w->setCaption( "Wellenreiter II" ); w->show(); #endif a.processEvents(); // show the window before doing the safety checks int result = -1; static int killed = false; bool check = true; for ( int i = 1; i < argc; ++i ) { - qDebug( "Wellenreiter::main() parsing argument %d = '%s'", i, argv[i] ); + odebug << "Wellenreiter::main() parsing argument " << i << " = '" << argv[i] << "'" << oendl; if ( !strcmp( "-nocheck", argv[i] ) ) { - qDebug( "-nocheck found" ); + odebug << "-nocheck found" << oendl; check = false; break; } } if ( check ) { // root check if ( getuid() ) { - qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); + owarn << QObject::tr( "Wellenreiter: trying to run as non-root!" ) << oendl; result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), QMessageBox::Yes, QMessageBox::No ); if ( result == QMessageBox::No ) return -1; } int dhcpid = OProcess::processPID( "dhcpc" ); if ( dhcpid ) { result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" "(PID = %1)\nThis can severly limit scanning!\nShould I kill it for you?" ).arg( dhcpid ), QMessageBox::Yes, QMessageBox::No ); if ( result == QMessageBox::Yes ) { if ( -1 == ::kill( dhcpid, SIGTERM ) ) - qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); + owarn << "Wellenreiter: can't kill process #" << result << " (" << strerror( errno ) << ")" << oendl; else killed = true; } } } a.exec(); if ( check ) { if ( killed ) diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 7add6cd..a4b8839 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -12,59 +12,60 @@ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #include "configwindow.h" #include "gps.h" #include "logwindow.h" #include "packetview.h" #include "mainwindow.h" #include "wellenreiter.h" #include "scanlist.h" +/* OPIE */ +#ifdef QWS +#include <qpe/resource.h> +#include <opie2/odebug.h> +#include <opie2/ofiledialog.h> +#else +#include "resource.h" +#include <qapplication.h> +#include <qfiledialog.h> +#endif +using namespace Opie::Core; +using namespace Opie::Net; +using namespace Opie::Ui; + +/* QT */ #include <qcombobox.h> #include <qdatastream.h> #include <qfile.h> #include <qfileinfo.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qiconset.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qpopupmenu.h> #include <qpushbutton.h> #include <qstatusbar.h> #include <qspinbox.h> #include <qtextstream.h> #include <qtoolbutton.h> #include <qwhatsthis.h> -#ifdef QWS -#include <qpe/resource.h> -#include <opie2/ofiledialog.h> -using namespace Opie; -#else -#include "resource.h" -#include <qapplication.h> -#include <qfiledialog.h> -#endif - +/* STD */ #include <unistd.h> -using namespace Opie::Ui; -using namespace Opie::Net; -using namespace Opie::Ui; -using namespace Opie::Net; -using namespace Opie::Net; WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) :QMainWindow( parent, name, f ) { cw = new WellenreiterConfigWindow( this ); mw = new Wellenreiter( this ); mw->setConfigWindow( cw ); setCentralWidget( mw ); // setup application icon setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); #ifndef QWS @@ -179,25 +180,25 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n #ifndef QWS statusBar()->message( tr( "Ready." ) ); #endif connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); }; void WellenreiterMainWindow::showConfigure() { - qDebug( "show configure..." ); + odebug << "show configure..." << oendl; cw->setCaption( tr( "Configure" ) ); int result = QPEApplication::execDialog( cw ); if ( result ) updateToolButtonState(); } void WellenreiterMainWindow::updateToolButtonState() { const QString& interface = cw->interfaceName->currentText(); const int cardtype = cw->driverType(); @@ -222,45 +223,45 @@ void WellenreiterMainWindow::changedSniffingState() menuBar()->setItemEnabled( stopID, mw->sniffing ); if ( !mw->sniffing ) { menuBar()->setItemEnabled( uploadID, true ); uploadButton->setEnabled( true ); } } WellenreiterMainWindow::~WellenreiterMainWindow() { - qDebug( "Wellenreiter: bye." ); + odebug << "Wellenreiter: bye." << oendl; }; void WellenreiterMainWindow::demoAddStations() { //mw = 0; // test SIGSEGV handling mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); } void WellenreiterMainWindow::demoReadFromGps() { WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); GPS* gps = new GPS( this ); - qDebug( "Wellenreiter::demoReadFromGps(): url=gps://%s:%d/", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); + odebug << "Wellenreiter::demoReadFromGps(): url=gps://" << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "/" << oendl; gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); GpsLocation loc = gps->position(); QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); delete gps; } QString WellenreiterMainWindow::getFileName( bool save ) { QMap<QString, QStringList> map; map.insert( tr("All"), QStringList() ); QStringList text; @@ -296,93 +297,93 @@ QString WellenreiterMainWindow::getFileName( bool save ) void WellenreiterMainWindow::fileSaveLog() { QString fname = getFileName( true ); if ( !fname.isEmpty() ) { QFile f( fname ); if ( f.open(IO_WriteOnly) ) { QTextStream t( &f ); t << mw->logWindow()->getLog(); f.close(); - qDebug( "Saved log to file '%s'", (const char*) fname ); + odebug << "Saved log to file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem saving log to file '%s'", (const char*) fname ); + odebug << "Problem saving log to file '" << (const char*) fname << "'" << oendl; } } } void WellenreiterMainWindow::fileSaveSession() { QString fname = getFileName( true ); if ( !fname.isEmpty() ) { QFile f( fname ); if ( f.open(IO_WriteOnly) ) { QDataStream t( &f ); t << *mw->netView(); f.close(); - qDebug( "Saved session to file '%s'", (const char*) fname ); + odebug << "Saved session to file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem saving session to file '%s'", (const char*) fname ); + odebug << "Problem saving session to file '" << (const char*) fname << "'" << oendl; } } } void WellenreiterMainWindow::fileSaveHex() { #warning DOES NOT WORK AT THE MOMENT /* QString fname = getFileName( true ); if ( !fname.isEmpty() ) { QFile f( fname ); if ( f.open(IO_WriteOnly) ) { QTextStream t( &f ); t << mw->hexWindow()->getLog(); f.close(); - qDebug( "Saved hex log to file '%s'", (const char*) fname ); + odebug << "Saved hex log to file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); + odebug << "Problem saving hex log to file '" << (const char*) fname << "'" << oendl; } } */ } void WellenreiterMainWindow::fileLoadSession() { QString fname = getFileName( false ); if ( !fname.isEmpty() ) { QFile f( fname ); if ( f.open(IO_ReadOnly) ) { QDataStream t( &f ); t >> *mw->netView(); f.close(); - qDebug( "Loaded session from file '%s'", (const char*) fname ); + odebug << "Loaded session from file '" << (const char*) fname << "'" << oendl; } else { - qDebug( "Problem loading session from file '%s'", (const char*) fname ); + odebug << "Problem loading session from file '" << (const char*) fname << "'" << oendl; } } } void WellenreiterMainWindow::fileNew() { mw->netView()->clear(); mw->logWindow()->clear(); mw->hexWindow()->clear(); } @@ -429,29 +430,29 @@ void WellenreiterMainWindow::uploadSession() g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 ); accept->setDefault( true ); accept->setAutoDefault( true ); from->setText( "WL II User" ); location->setText( "WL II Location" ); comments->setText( "No Comments." ); connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) ); connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) ); int result = d->exec(); if ( !result ) { - qDebug( "Session upload cancelled :(" ); + odebug << "Session upload cancelled :(" << oendl; return; } - qDebug( "Starting upload..." ); + odebug << "Starting upload..." << oendl; struct sockaddr_in raddr; struct hostent *rhost_info; int sock = -1; bool ok = false; rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname ); if ( rhost_info ) { if ( !QFile::exists( mw->captureFileName() ) ) diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp index 3d3aa18..4df01da 100644 --- a/noncore/net/wellenreiter/gui/packetview.cpp +++ b/noncore/net/wellenreiter/gui/packetview.cpp @@ -75,25 +75,25 @@ void PacketView::showPacket( int number ) { _list->clear(); _hex->setText(""); const OPacket* p = _packets.at( number ); if ( p ) { _doSubPackets( const_cast<QObjectList*>( p->children() ), 0 ); _doHexPacket( p ); } else { - qDebug( "D'oh! No packet!" ); + odebug << "D'oh! No packet!" << oendl; } } void PacketView::_doSubPackets( QObjectList* l, int counter ) { if (!l) return; QObject* o = l->first(); while ( o ) { new OListViewItem( _list, QString::number( counter++ ), o->name() ); _doSubPackets( const_cast<QObjectList*>( o->children() ), counter ); o = l->next(); diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp index d98ef0b..cb17f51 100644 --- a/noncore/net/wellenreiter/gui/resource.cpp +++ b/noncore/net/wellenreiter/gui/resource.cpp @@ -20,30 +20,30 @@ #include <qiconset.h> namespace Resource { QPixmap loadPixmap( const QString& pix ) { QString filename; filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); QPixmap pixmap( filename ); if ( pixmap.isNull() ) { - qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); + odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; } return pixmap; }; QIconSet loadIconSet( const QString& pix ) { QString filename; filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); QPixmap pixmap( filename ); if ( pixmap.isNull() ) { - qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); + odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; } return QIconSet( pixmap ); }; }; diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 3b7120a..a2be782 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -8,59 +8,58 @@ ** 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. ** **********************************************************************/ #include "scanlist.h" #include "configwindow.h" #include "logwindow.h" -#include <assert.h> -#include <qcursor.h> -#include <qdatetime.h> -#include <qpopupmenu.h> -#include <qcheckbox.h> - +/* OPIE */ #ifdef QWS +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> -#endif - -#ifdef QWS #include <qpe/resource.h> #else #include "resource.h" #endif +using namespace Opie::Core; +using namespace Opie::Ui; +using namespace Opie::Net; + +/* QT */ +#include <qcursor.h> +#include <qdatetime.h> +#include <qpopupmenu.h> +#include <qcheckbox.h> + +/* STD */ +#include <assert.h> const int col_type = 0; const int col_essid = 0; const int col_sig = 1; const int col_ap = 2; const int col_channel = 3; const int col_wep = 4; const int col_traffic = 5; const int col_ip = 6; const int col_manuf = 7; const int col_firstseen = 8; const int col_lastseen = 9; const int col_location = 10; -using namespace Opie::Net; -using namespace Opie::Ui; -using namespace Opie::Net; -using namespace Opie::Ui; -using namespace Opie::Ui; -using namespace Opie::Net; MScanListView::MScanListView( QWidget* parent, const char* name ) :OListView( parent, name ) { setFrameShape( QListView::StyledPanel ); setFrameShadow( QListView::Sunken ); addColumn( tr( "Net/Station" ) ); setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); addColumn( tr( "#" ) ); setColumnAlignment( col_sig, AlignCenter ); addColumn( tr( "MAC" ) ); setColumnAlignment( col_ap, AlignCenter ); @@ -97,32 +96,32 @@ MScanListView::~MScanListView() { }; OListViewItem* MScanListView::childFactory() { return new MScanListItem( this ); } void MScanListView::serializeTo( QDataStream& s) const { - qDebug( "serializing MScanListView" ); + odebug << "serializing MScanListView" << oendl; OListView::serializeTo( s ); } void MScanListView::serializeFrom( QDataStream& s) { - qDebug( "serializing MScanListView" ); + odebug << "serializing MScanListView" << oendl; OListView::serializeFrom( s ); } void MScanListView::addNewItem( const QString& type, const QString& essid, const OMacAddress& mac, bool wep, int channel, int signal, const GpsLocation& loc, bool probe ) @@ -134,68 +133,68 @@ void MScanListView::addNewItem( const QString& type, (const char*) essid, (const char*) macaddr, channel ); #endif // search, if we already have seen this net QString s; MScanListItem* network; MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); while ( item && ( item->text( col_essid ) != essid ) ) { #ifdef DEBUG - qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); + odebug << "itemtext: " << (const char*) item->text( col_essid ) << "" << oendl; #endif item = static_cast<MScanListItem*> ( item->nextSibling() ); } if ( item ) { // we have already seen this net, check all childs if MAC exists network = item; item = static_cast<MScanListItem*> ( item->firstChild() ); assert( item ); // this shouldn't fail while ( item && ( item->text( col_ap ) != macaddr ) ) { #ifdef DEBUG - qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); + odebug << "subitemtext: " << (const char*) item->text( col_ap ) << "" << oendl; #endif item = static_cast<MScanListItem*> ( item->nextSibling() ); } if ( item ) { // we have already seen this item, it's a dupe #ifdef DEBUG - qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); + odebug << "" << (const char*) macaddr << " is a dupe - ignoring..." << oendl; #endif item->receivedBeacon(); return; } } else { s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); MLogWindow::logwindow()->log( s ); network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); } // insert new station as child from network // no essid to reduce clutter, maybe later we have a nick or stationname to display!? #ifdef DEBUG - qDebug( "inserting new station %s", (const char*) macaddr ); + odebug << "inserting new station " << (const char*) macaddr << "" << oendl; #endif MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); station->setManufacturer( mac.manufacturer() ); station->setLocation( loc.dmsPosition() ); if ( type == "managed" ) { s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); } else { @@ -203,196 +202,196 @@ void MScanListView::addNewItem( const QString& type, } MLogWindow::logwindow()->log( s ); } void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) { MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) { #ifdef DEBUG - qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); + odebug << "subitemtext: " << (const char*) subitem->text( col_ap ) << "" << oendl; #endif subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); } if ( subitem ) { // we have already seen this item, it's a dupe #ifdef DEBUG - qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); + odebug << "" << (const char*) addr.toString(true) << " is a dupe - ignoring..." << oendl; #endif subitem->receivedBeacon(); //FIXME: sent data bit return; } // Hey, it seems to be a new item :-D MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); station->setManufacturer( addr.manufacturer() ); QString s; if ( type == "station" ) { s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); } else { s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); } MLogWindow::logwindow()->log( s ); } void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) { - qDebug( "WDSTraffic: %s and %s seem to form a WDS", (const char*) viaFrom.toString(), (const char*) viaTo.toString() ); + odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << (const char*) viaTo.toString() << " seem to form a WDS" << oendl; QString s; MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != viaFrom.toString(true) && it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; MScanListItem* item = static_cast<MScanListItem*>( it.current() ); if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations { addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); } else { - qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); + odebug << "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); } } void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) { QString s; MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; MScanListItem* item = static_cast<MScanListItem*>( it.current() ); if ( item ) // AP has shown up yet, so just add our new "from" - station { addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); } else { - qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); + odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); } } void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) { QString s; MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; MScanListItem* item = static_cast<MScanListItem*>( it.current() ); if ( item ) // AP has shown up yet, so just add our new "from" - station { addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); } else { - qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); + odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); } } void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) { - qWarning( "D'oh! Not yet implemented..." ); + owarn << "D'oh! Not yet implemented..." << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); } void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) { - qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); + odebug << "identify " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl; QListViewItemIterator it( this ); for ( ; it.current(); ++it ) { if ( it.current()->text( col_ap ) == macaddr.toString(true) ) { it.current()->setText( col_ip, ip ); return; } } - qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); + odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", (const char*) macaddr.toString(), (const char*) ip ) ); } void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) { - qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip ); + odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl; //TODO: Refactor that out, we need it all over the place. // Best to do it in a more comfortable abstraction in OListView // (Hmm, didn't I already start something in this direction?) QListViewItemIterator it( this ); for ( ; it.current(); ++it ) { if ( it.current()->text( col_ap ) == macaddr.toString(true) ) { MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); while ( subitem && ( subitem->text( col_essid ) != name ) ) { #ifdef DEBUG - qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) ); + odebug << "subitemtext: " << (const char*) subitem->text( col_essid ) << "" << oendl; #endif subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); } if ( subitem ) { // we have already seen this item, it's a dupe #ifdef DEBUG - qDebug( "%s is a dupe - ignoring...", (const char*) name ); + odebug << "" << (const char*) name << " is a dupe - ignoring..." << oendl; #endif subitem->receivedBeacon(); //FIXME: sent data bit return; } // never seen that - add new item MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); item->setText( col_essid, name ); return; } } - qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); + odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", (const char*) macaddr.toString(), (const char*) ip ) ); } void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) { if ( !item ) return; MScanListItem* itm = static_cast<MScanListItem*>( item ); qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", @@ -412,74 +411,74 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in //============================================================ // MScanListItem //============================================================ MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, bool wep, int channel, int signal, bool probed ) :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), _channel( channel ), _signal( signal ), _beacons( 1 ) { #ifdef DEBUG - qDebug( "creating scanlist item" ); + odebug << "creating scanlist item" << oendl; #endif if ( WellenreiterConfigWindow::instance() ) WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here decorateItem( type, essid, macaddr, wep, channel, signal, probed ); } MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, bool wep, int channel, int signal ) :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) { #ifdef DEBUG - qDebug( "creating scanlist item" ); + odebug << "creating scanlist item" << oendl; #endif if ( WellenreiterConfigWindow::instance() ) WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here decorateItem( type, essid, macaddr, wep, channel, signal, false ); } const QString& MScanListItem::essid() const { if ( type == "network" ) return _essid; else return ( (MScanListItem*) parent() )->essid(); } OListViewItem* MScanListItem::childFactory() { return new MScanListItem( this ); } void MScanListItem::serializeTo( QDataStream& s ) const { #ifdef DEBUG - qDebug( "serializing MScanListItem" ); + odebug << "serializing MScanListItem" << oendl; #endif OListViewItem::serializeTo( s ); s << _type; s << (Q_UINT8) ( _wep ? 'y' : 'n' ); } void MScanListItem::serializeFrom( QDataStream& s ) { #ifdef DEBUG - qDebug( "serializing MScanListItem" ); + odebug << "serializing MScanListItem" << oendl; #endif OListViewItem::serializeFrom( s ); char wep; s >> _type; s >> (Q_UINT8) wep; _wep = (wep == 'y'); QString name; name.sprintf( "wellenreiter/%s", (const char*) _type ); setPixmap( col_type, Resource::loadPixmap( name ) ); if ( _wep ) @@ -547,22 +546,22 @@ void MScanListItem::setManufacturer( const QString& manufacturer ) void MScanListItem::setLocation( const QString& location ) { setText( col_location, location ); } void MScanListItem::receivedBeacon() { _beacons++; #ifdef DEBUG - qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); + odebug << "MScanListItem " << (const char*) _macaddr << ": received beacon #" << _beacons << "" << oendl; #endif setText( col_sig, QString::number( _beacons ) ); setText( col_lastseen, QTime::currentTime().toString() ); MScanListItem* p = (MScanListItem*) parent(); if ( p ) p->receivedBeacon(); } diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index fff7c35..fad6efd 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -2,80 +2,72 @@ ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. ** ** 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. ** ***********************************************************************/ -// Local - #include "gps.h" #include "wellenreiter.h" #include "scanlist.h" #include "logwindow.h" #include "packetview.h" #include "configwindow.h" #include "statwindow.h" #include "graphwindow.h" #include "protolistview.h" -// Opie - +/* OPIE */ #ifdef QWS #include <opie2/oapplication.h> +#include <opie2/odebug.h> #include <opie2/odevice.h> #else #include <qapplication.h> #endif #include <opie2/omanufacturerdb.h> #include <opie2/onetwork.h> #include <opie2/opcap.h> #include <qpe/qcopenvelope_qws.h> -using namespace Opie; - -// Qt +using namespace Opie::Core; +using namespace Opie::Net; +using namespace Opie::Ui; +/* QT */ #include <qcheckbox.h> #include <qcombobox.h> #include <qdatetime.h> #include <qpushbutton.h> #include <qlineedit.h> #include <qmessagebox.h> #include <qobjectlist.h> #include <qregexp.h> #include <qspinbox.h> #include <qtimer.h> #include <qtoolbutton.h> #include <qmainwindow.h> -// Standard - +/* STD */ #include <assert.h> #include <errno.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <stdlib.h> -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Net; -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Core; Wellenreiter::Wellenreiter( QWidget* parent ) : WellenreiterBase( parent, 0, 0 ), sniffing( false ), iface( 0 ), configwindow( 0 ) { logwindow->log( "(i) Wellenreiter has been started." ); // // detect operating system // #ifdef QWS @@ -97,25 +89,25 @@ Wellenreiter::Wellenreiter( QWidget* parent ) } Wellenreiter::~Wellenreiter() { delete pcap; } void Wellenreiter::initialTimer() { - qDebug( "Wellenreiter::preloading manufacturer database..." ); + odebug << "Wellenreiter::preloading manufacturer database..." << oendl; OManufacturerDB::instance(); } void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) { configwindow = cw; } void Wellenreiter::channelHopped(int c) { @@ -140,104 +132,104 @@ void Wellenreiter::channelHopped(int c) void Wellenreiter::handleNotification( OPacket* p ) { QObjectList* l = p->queryList(); QObjectListIt it( *l ); QObject* o; while ( (o = it.current()) != 0 ) { QString name = it.current()->name(); if ( configwindow->parsePackets->isProtocolChecked( name ) ) { QString action = configwindow->parsePackets->protocolAction( name ); - qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); + odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; doAction( action, name, p ); } else { - qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); + odebug << "protocol '" << (const char*) name << "' not checked in parsePackets." << oendl; } ++it; } } void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) { if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); - else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); + else owarn << "Wellenreiter::handleManagementFrame(): '" << (const char*) manage->managementType() << "' - please handle me!" << oendl; } void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) { OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); int channel = ds ? ds->channel() : -1; OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); GpsLocation loc( -111, -111 ); if ( configwindow->enableGPS->isChecked() ) { // TODO: add check if GPS is working!? - qDebug( "Wellenreiter::gathering GPS data..." ); + odebug << "Wellenreiter::gathering GPS data..." << oendl; loc = gps->position(); - qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); + odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; } if ( essid.length() ) netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); - qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); + odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; } void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) { } void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) { QString type; if ( beacon->canIBSS() ) { type = "adhoc"; } else if ( beacon->canESS() ) { type = "managed"; } else { - qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); + owarn << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; return; } OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); int channel = ds ? ds->channel() : -1; OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); GpsLocation loc( -111, -111 ); if ( configwindow->enableGPS->isChecked() ) { // TODO: add check if GPS is working!? - qDebug( "Wellenreiter::gathering GPS data..." ); + odebug << "Wellenreiter::gathering GPS data..." << oendl; loc = gps->position(); - qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); + odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; } netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); // update graph window if ( ds ) { OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); if ( prism ) graphwindow->traffic( ds->channel(), prism->signalStrength() ); else graphwindow->traffic( ds->channel(), 95 ); @@ -246,25 +238,25 @@ void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPa void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) { OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); if ( control->controlType() == "Acknowledge" ) { netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); } else { - qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); + odebug << "Wellenreiter::handleControlFrame - please handle " << (const char*) control->controlType() << " in a future version! :D" << oendl; } } void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) { OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); if ( wlan->fromDS() && !wlan->toDS() ) { netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); from = wlan->macAddress3(); to = wlan->macAddress2(); @@ -295,55 +287,55 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd from = data->sourceAddress(); to = data->destinationAddress(); netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); } void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) { OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); if ( arp ) { - qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); + odebug << "Received ARP traffic (type '" << (const char*) arp->type() << "'): " << oendl; if ( arp->type() == "REQUEST" ) { netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); } else if ( arp->type() == "REPLY" ) { netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); } } } void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) { //TODO: Implement more IP based protocols ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); if ( dhcp ) { - qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); + odebug << "Received DHCP '" << (const char*) dhcp->type() << "' packet" << oendl; if ( dhcp->type() == "OFFER" ) { - qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); + odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << (const char*) dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; netView()->identify( source, dhcp->serverAddress().toString() ); netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); } else if ( dhcp->type() == "ACK" ) { - qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); + odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << (const char*) dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); } } } QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) { if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) return 0; @@ -359,34 +351,34 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) return true; // semantic change - we're logging anyway now to /tmp/wellenreiter QObjectList* l = p->queryList(); QObjectListIt it( *l ); QObject* o; while ( (o = it.current()) != 0 ) { QString name = it.current()->name(); if ( configwindow->capturePackets->isProtocolChecked( name ) ) { QString action = configwindow->capturePackets->protocolAction( name ); - qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); + odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; if ( action == "Discard" ) { logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); return false; } } else { - qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name ); + odebug << "protocol '" << (const char*) name << "' not checked in capturePackets." << oendl; } ++it; } return true; } void Wellenreiter::receivePacket( OPacket* p ) { hexWindow()->add( p ); if ( checkDumpPacket( p ) ) @@ -542,70 +534,70 @@ void Wellenreiter::startClicked() } } // set monitor mode bool usePrism = configwindow->usePrismHeader(); switch ( cardtype ) { case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; - case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; + case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << (const char*) interface << "'" << oendl; break; default: assert( 0 ); // shouldn't reach this } // switch device into monitor mode if ( cardtype < DEVTYPE_FILE ) { if ( cardtype != DEVTYPE_MANUAL ) iface->setMode( "monitor" ); if ( iface->mode() != "monitor" ) { if ( QMessageBox::warning( this, "Wellenreiter II", tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) return; } } // open GPS device if ( configwindow->enableGPS->isChecked() ) { - qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); + odebug << "Wellenreiter:GPS enabled @ " << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl; gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); } // open pcap and start sniffing if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? { dumpname = configwindow->captureFileName->text(); if ( dumpname.isEmpty() ) dumpname = "captureFile"; dumpname.append( '-' ); dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); dumpname.append( ".wellenreiter" ); } else // write it anyway ;) { dumpname = "/var/log/dump.wellenreiter"; } if ( cardtype != DEVTYPE_FILE ) pcap->open( interface ); else pcap->open( QFile( interface ) ); - qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname ); + odebug << "Wellenreiter:: dumping to " << (const char*) dumpname << "" << oendl; pcap->openDumpFile( dumpname ); if ( !pcap->isOpen() ) { QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); return; } // set capturer to non-blocking mode pcap->setBlocking( false ); @@ -643,25 +635,25 @@ void Wellenreiter::startClicked() emit( startedSniffing() ); if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title else { assert( parent() ); ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); } } void Wellenreiter::timerEvent( QTimerEvent* ) { - qDebug( "Wellenreiter::timerEvent()" ); + odebug << "Wellenreiter::timerEvent()" << oendl; OPacket* p = pcap->next(); if ( !p ) // no more packets available { stopClicked(); } else { receivePacket( p ); // We no longer delete packets here. Ownership of the packets is // transferred to the PacketView. //delete p; } @@ -706,28 +698,28 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch return; } qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", (const char*) iface->name(), (const char*) type, (const char*) essid, channel, (const char*) macaddr ); QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); int count = 3; - qDebug("sending %d messages",count); + odebug << "sending " << count << " messages" << oendl; msg << QString("count") << QString::number(count); - qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); + odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; msg << QString(iface->name()) << QString("Mode") << type; - qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); + odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; msg << QString(iface->name()) << QString("ESSID") << essid; - qDebug("msg >%s< channel >%d<", iface->name(),channel); + odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; msg << QString(iface->name()) << QString("Channel") << channel; -// qDebug("msg >%s< mac >%s<", iface->name(),macaddr); +// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; // msg << QString(iface->name()) << QString("MacAddr") << macaddr; #else QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); #endif } diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 58e5c71..2eccdfe 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp @@ -1,19 +1,20 @@ - #include "backuprestore.h" #include "errordialog.h" /* OPIE */ +#include <opie2/odebug.h> #include <opie2/ostorageinfo.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; /* QT */ #include <qapplication.h> #include <qmultilineedit.h> #include <qdir.h> #include <qfile.h> #include <qfileinfo.h> #include <qlistview.h> #include <qpushbutton.h> #include <qheader.h> #include <qpe/resource.h> #include <qpe/config.h> @@ -31,25 +32,24 @@ #include <unistd.h> #include <sys/stat.h> #include <dirent.h> #define HEADER_NAME 0 #define HEADER_BACKUP 1 #define BACKUP_LOCATION 2 #define EXTENSION ".bck" const QString tempFileName = "/tmp/backup.err"; - BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) : BackupAndRestoreBase(parent, name, fl) { backupList->header()->hide(); restoreList->header()->hide(); connect(backupButton, SIGNAL(clicked()), this, SLOT(backup())); connect(restoreButton, SIGNAL(clicked()), this, SLOT(restore())); connect(backupList, SIGNAL(clicked(QListViewItem*)), this, SLOT(selectItem(QListViewItem*))); connect(restoreSource, SIGNAL(activated(int)), @@ -64,35 +64,35 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f selectItem(applicationSettings); documents= new QListViewItem(backupList, "Documents", "", "Documents/"); selectItem(documents); scanForApplicationSettings(); Opie::Core::OStorageInfo storage; backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); if ( storage.hasCf() ) { backupLocations.insert( "CF", storage.cfPath() ); - qDebug( "Cf Path: " + storage.cfPath() ); + odebug << "Cf Path: " + storage.cfPath() << oendl; } if ( storage.hasSd() ) { backupLocations.insert( "SD", storage.sdPath() ); - qDebug( " Sd Path: " + storage.sdPath() ); + odebug << " Sd Path: " + storage.sdPath() << oendl; } if ( storage.hasMmc() ) { backupLocations.insert( "MMC", storage.mmcPath() ); - qDebug( "Mmc Path: " + storage.mmcPath() ); + odebug << "Mmc Path: " + storage.mmcPath() << oendl; } Config config("BackupAndRestore"); //read last locations config.setGroup("LastLocation"); QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); int locationIndex = 0; QMap<QString, QString>::Iterator it; for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) { @@ -194,25 +194,25 @@ void BackupAndRestore::selectItem(QListViewItem *currentItem) } } void BackupAndRestore::scanForApplicationSettings() { QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); const QFileInfoList *list = d.entryInfoList(); QFileInfoListIterator it( *list ); QFileInfo *fi; while ( (fi=it.current()) ) { - //qDebug((d.path()+"/"+fi->fileName()).latin1()); + //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) { QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); selectItem(newItem); } ++it; } } /** * The "Backup" button has been pressed. Get a list of all of the files that * should be backed up. If there are no files, emit and error and exit. @@ -240,48 +240,48 @@ void BackupAndRestore::backup() QString t = outputFile; int c = 1; while(QFile::exists(outputFile + EXTENSION)) { outputFile = t + QString("%1").arg(c); c++; } // We execute tar and compressing its output with gzip.. // The error output will be written into a temp-file which could be provided // for debugging.. - qDebug( "Storing file: %s", outputFile.latin1() ); + odebug << "Storing file: " << outputFile.latin1() << "" << oendl; outputFile += EXTENSION; QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) .arg( getExcludeFile() ) .arg( backupFiles ) .arg( outputFile.latin1() ) .arg( tempFileName.latin1() ); - qDebug( commandLine ); + odebug << commandLine << oendl; int r = system( commandLine ); if(r != 0) { perror("Error: "); QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) { case 1: - qWarning("Details pressed !"); + owarn << "Details pressed !" << oendl; ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); QFile errorFile( tempFileName ); if ( errorFile.open(IO_ReadOnly) ) { QTextStream t( &errorFile ); QString s; while ( !t.eof() ) { // until end of file... s += t.readLine(); // line of text excluding '\n' } errorFile.close(); @@ -350,37 +350,37 @@ int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent } return count; } void BackupAndRestore::sourceDirChanged(int selection) { restoreList->clear(); rescanFolder(backupLocations[restoreSource->text(selection)]); } void BackupAndRestore::fileListUpdate() { - qWarning("void BackupAndRestore::fileListUpdate()"); + owarn << "void BackupAndRestore::fileListUpdate()" << oendl; restoreList->clear(); rescanFolder( backupLocations[restoreSource->currentText()] ); } /** * Scans directory for any backup files. Will recursivly go down, * but will not follow symlinks. * @param directory - the directory to look in. */ void BackupAndRestore::rescanFolder(QString directory) { - //qDebug(QString("rescanFolder: ") + directory.latin1()); + //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; QDir d(directory); if(!d.exists()) return; d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); const QFileInfoList *list = d.entryInfoList(); QFileInfoListIterator it( *list ); QFileInfo *file; while ( (file=it.current()) ) { // for each file... // If it is a dir and not .. or . then add it as a tab and go down. if(file->isDir()) @@ -410,60 +410,60 @@ void BackupAndRestore::restore() if(!restoreItem) { QMessageBox::critical(this, tr( "Message" ), tr( "Please select something to restore." ),QString( tr( "Ok") ) ); return; } setCaption(tr("Backup and Restore... working...")); QString restoreFile = backupLocations[restoreSource->currentText()]; restoreFile += "/" + restoreItem->text(0); - qDebug( restoreFile ); + odebug << restoreFile << oendl; //check if backup file come from opie 1.0.x QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); int r = system( commandLine ); QString startDir; if( r != 0 ) //Applications/backup/exclude not found - old backup file { startDir = QString( "/" ); } else { startDir = QDir::homeDirPath(); } //unpack backup file commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) .arg( restoreFile.latin1() ) .arg( tempFileName.latin1() ); - qDebug( commandLine ); + odebug << commandLine << oendl; r = system( commandLine ); //error handling if(r != 0) { QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) { case 1: - qWarning("Details pressed !"); + owarn << "Details pressed !" << oendl; ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); QFile errorFile( tempFileName ); if ( errorFile.open(IO_ReadOnly) ) { QTextStream t( &errorFile ); QString s; while ( !t.eof() ) { // until end of file... s += t.readLine(); // line of text excluding '\n' } errorFile.close(); diff --git a/noncore/settings/netsystemtime/settingstabwidget.cpp b/noncore/settings/netsystemtime/settingstabwidget.cpp index ad80e05..1307082 100644 --- a/noncore/settings/netsystemtime/settingstabwidget.cpp +++ b/noncore/settings/netsystemtime/settingstabwidget.cpp @@ -130,25 +130,25 @@ void SettingsTabWidget::saveSettings() if ( serversChanged ) { QString ntpSrvsFile = QPEApplication::qpeDir(); ntpSrvsFile.append( "etc/ntpservers" ); Config ntpSrvs( ntpSrvsFile, Config::File ); ntpSrvs.setGroup( "servers" ); ntpSrvs.writeEntry( "count", ++srvCount ); ntpSrvs.setGroup( "0" ); ntpSrvs.writeEntry( "name", edit ); curSrv = 0; for ( int i = 1; i < srvCount; i++ ) { -// qDebug( "ntpSrvs[%i/%i]=%s", i, srvCount, cbTimeServer->text( i ).latin1() ); +// odebug << "ntpSrvs[" << i << "/" << srvCount << "]=" << cbTimeServer->text( i ).latin1() << "" << oendl; ntpSrvs.setGroup( QString::number( i ) ); ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) ); } } Config config( "ntp", Config::User ); config.setGroup( "settings" ); config.writeEntry( "ntpServer", curSrv ); config.writeEntry( "minLookupDiff", sbPredictDelay->value() ); config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() ); config.writeEntry( "displayNtpTab", chNtpTab->isChecked() ); config.writeEntry( "displayPredictTab", chPredictTab->isChecked() ); } diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp index b00b899..d2b106a 100644 --- a/noncore/settings/networksettings/interfaces/interface.cpp +++ b/noncore/settings/networksettings/interfaces/interface.cpp @@ -128,31 +128,31 @@ bool Interface::refresh(){ broadcast = ""; dhcp = false; dhcpServerIp = ""; leaseObtained = ""; leaseExpires = ""; emit(updateInterface(this)); return true; } QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name()); int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1()); if(ret != 0){ - qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1()); + odebug << QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1() << oendl; return false; } QFile file(fileName); if (!file.open(IO_ReadOnly)){ - qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); + odebug << QString("Interface: Can't open file: %1").arg(fileName).latin1() << oendl; return false; } // Set to the defaults macAddress = ""; ip = "0.0.0.0"; subnetMask = "0.0.0.0"; broadcast = ""; QTextStream stream( &file ); QString line; while ( !stream.eof() ) { @@ -192,73 +192,73 @@ bool Interface::refresh(){ dhcpDirectory = "/var/run"; // See if we have QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name())); // If there is no DHCP information then exit now with no errors. if(!QFile::exists(dhcpFile)){ emit(updateInterface(this)); return true; } file.setName(dhcpFile); if (!file.open(IO_ReadOnly)){ - qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); + odebug << QString("Interface: Can't open file: %1").arg(dhcpFile).latin1() << oendl; return false; } // leaseTime and renewalTime and used if pid and deamon exe can be accessed. int leaseTime = 0; int renewalTime = 0; stream.setDevice( &file ); while ( !stream.eof() ) { line = stream.readLine(); if(line.contains("DHCPSIADDR=")) dhcpServerIp = line.mid(11, line.length()); if(line.contains("LEASETIME=")) leaseTime = line.mid(10, line.length()).toInt(); if(line.contains("RENEWALTIME=")) renewalTime = line.mid(12, line.length()).toInt(); } file.close(); - //qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1()); - //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); + //odebug << QString("Interface: leaseTime: %1").arg(leaseTime).latin1() << oendl; + //odebug << QString("Interface: renewalTime: %1").arg(renewalTime).latin1() << oendl; // Get the pid of the deamond dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name())); file.setName(dhcpFile); if (!file.open(IO_ReadOnly)){ - qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); + odebug << QString("Interface: Can't open file: %1").arg(dhcpFile).latin1() << oendl; return false; } int pid = -1; stream.setDevice( &file ); while ( !stream.eof() ) { line = stream.readLine(); pid = line.toInt(); } file.close(); if( pid == -1){ - qDebug("Interface: Could not get pid of dhcpc deamon."); + odebug << "Interface: Could not get pid of dhcpc deamon." << oendl; return false; } // Get the start running time of the deamon fileName = (QString("/proc/%1/stat").arg(pid)); file.setName(fileName); stream.setDevice( &file ); if (!file.open(IO_ReadOnly)){ - qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1()); + odebug << QString("Interface: Can't open file: %1").arg(fileName).latin1() << oendl; return false; } while ( !stream.eof() ) { line = stream.readLine(); } file.close(); long time = 0; // Grab the start time // pid com state ppid pgrp session tty_nr tpgid flags sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u " // minflt cminflt majflt cmajflt utime stime cutime cstime priority "%*u %*u %*u %*u %*u %*u %*d %*d %*d " @@ -269,30 +269,30 @@ bool Interface::refresh(){ QDateTime datetime(QDateTime::currentDateTime()); // Get the uptime of the computer. QFile f("/proc/uptime"); if ( f.open(IO_ReadOnly) ) { // file opened successfully QTextStream t( &f ); // use a text stream int sec = 0; t >> sec; datetime = datetime.addSecs((-1*sec)); f.close(); } else{ - qDebug("Interface: Can't open /proc/uptime to retrive uptime."); + odebug << "Interface: Can't open /proc/uptime to retrive uptime." << oendl; return false; } datetime = datetime.addSecs(time); - //qDebug(QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1()); + //odebug << QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1() << oendl; // Calculate the start and renew times leaseObtained = datetime.toString(); // Calculate the start and renew times datetime = datetime.addSecs(leaseTime); leaseExpires = datetime.toString(); dhcp = true; emit(updateInterface(this)); return true; diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp index 6b161ae..e283926 100644 --- a/noncore/settings/networksettings/interfaces/interfaces.cpp +++ b/noncore/settings/networksettings/interfaces/interfaces.cpp @@ -15,25 +15,25 @@ * the \n for interfaces variable. * @param useInterfacesFile if an interface file other then the default is * desired to be used it should be passed in. */ Interfaces::Interfaces(QString useInterfacesFile){ acceptedFamily.append(INTERFACES_FAMILY_INET); acceptedFamily.append(INTERFACES_FAMILY_IPX); acceptedFamily.append(INTERFACES_FAMILY_INET6); interfacesFile = useInterfacesFile; QFile file(interfacesFile); if (!file.open(IO_ReadOnly)){ - qDebug("Interfaces: Can't open file: %s for reading.", interfacesFile.latin1() ); + odebug << "Interfaces: Can't open file: " << interfacesFile.latin1() << " for reading." << oendl; currentIface = interfaces.end(); currentMapping = interfaces.end(); return; } QTextStream stream( &file ); QString line; while ( !stream.eof() ) { line += stream.readLine(); line += "\n"; } file.close(); interfaces = QStringList::split("\n", line, true); @@ -67,25 +67,25 @@ QStringList Interfaces::getInterfaceList(){ } /** * Find out if interface is in an "auto" group or not. * Report any duplicates such as eth0 being in two differnt auto's * @param interface interface to check to see if it is on or not. * @return true is interface is in auto */ bool Interfaces::isAuto(const QString &interface) const { QStringList autoLines = interfaces.grep(QRegExp(AUTO)); QStringList awi = autoLines.grep(QRegExp(interface)); if(awi.count() > 1) - qDebug(QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1()); + odebug << QString("Interfaces: Found more then auto group with interface: %1.").arg(interface).latin1() << oendl; return awi.count() > 0; } /** * Attempt to set the auto option for interface to setAuto. * @param interface the interface to set * @param setAuto the value to set interface to. * @return false if already set to setAuto. * */ bool Interfaces::setAuto(const QString &interface, bool setAuto){ // Don't need to set it if it is already set. if(isAuto(interface) == setAuto) @@ -143,41 +143,41 @@ bool Interfaces::isInterfaceSet() const { } /** * Add a new interface of with the settings - family and method * @param interface the name of the interface to set. All whitespace is * removed from the interface name. * @param family the family of this interface inet or inet, ipx or inet6 * Must of one of the families defined in interfaces.h * @param method for the family. see interfaces man page for family methods. * @return true if successful. */ bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){ - qDebug("Interfaces::addInterface(%s)",interface.latin1()); + odebug << "Interfaces::addInterface(" << interface.latin1() << ")" << oendl; if(0 == acceptedFamily.contains(family)) return false; QString newInterface = interface.simplifyWhiteSpace(); newInterface = newInterface.replace(QRegExp(" "), ""); interfaces.append(""); interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method)); return true; } /** * Copies interface with name interface to name newInterface * @param newInterface name of the new interface. * @return bool true if successful */ bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){ - qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1()); + odebug << "copy interface " << interface.latin1() << " to " << newInterface.latin1() << "" << oendl; if(!setInterface(interface)) return false; // Store the old interface and bump past the stanza line. QStringList::Iterator it = currentIface; it++; // Add the new interface bool error; addInterface(newInterface, getInterfaceFamily(error), getInterfaceMethod(error)); if(!setInterface(newInterface)) return false; @@ -266,32 +266,32 @@ QString Interfaces::getInterfaceMethod(bool &error){ line = line.mid(family.length()+1, line.length()); line = line.simplifyWhiteSpace(); error = false; return line; } /** * Sets the interface name to newName. * @param newName the new name of the interface. All whitespace is removed. * @return bool true if successful. */ bool Interfaces::setInterfaceName(const QString &newName){ - qDebug("setInterfaceName %s", newName.latin1()); + odebug << "setInterfaceName " << newName.latin1() << "" << oendl; if(currentIface == interfaces.end()) return false; QString name = newName.simplifyWhiteSpace(); name = name.replace(QRegExp(" "), ""); bool returnValue = false; QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue)); - qDebug("setting %s",tmp.latin1()); + odebug << "setting " << tmp.latin1() << "" << oendl; (*currentIface) = tmp; return !returnValue; } /** * Sets the interface family to newName. * @param newName the new name of the interface. Must be one of the families * defined in the interfaces.h file. * @return bool true if successful. */ bool Interfaces::setInterfaceFamily(const QString &newName){ @@ -336,25 +336,25 @@ QString Interfaces::getInterfaceOption(const QString &option, bool &error){ * doesn't exist then it is added along with the value. * If value isEmpty() then we will remove the option * * @param option the options to set the value. * @param value the value that option should be set to. * @param error set to true if any error occurs, false otherwise. * @return QString the options value. QString::null if error == true */ bool Interfaces::setInterfaceOption(const QString &option, const QString &value){ if( value.stripWhiteSpace().isEmpty() ) return removeInterfaceOption( option ); - qDebug("iface >%s< option >%s< value >%s<", (*currentIface).latin1(), option.latin1(),value.latin1()); + odebug << "iface >" << (*currentIface).latin1() << "< option >" << option.latin1() << "< value >" << value.latin1() << "<" << oendl; return setOption(currentIface, option, value); } /** * Removes a value for an option in the currently selected interface. * @param option the options to set the value. * @param error set to true if any error occurs, false otherwise. * @return QString the options value. QString::null if error == true */ bool Interfaces::removeInterfaceOption(const QString &option){ return removeOption(currentIface, option); } @@ -477,84 +477,84 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString // There are more chars in the line. check +1 if(line.at(point-1) != ' ') valid = false; } point += option.length(); if(point < line.length()-1){ // There are more chars in the line. check -1 if(line.at(point) != ' ') valid = false; } if(valid){ if(found == true){ - qDebug(QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1()); + odebug << QString("Interfaces: Found multiple stanza's for search: %1 %2").arg(stanza).arg(option).latin1() << oendl; } found = true; iterator = it; } } } return found; } /** * Sets a value of an option in a stanza * @param start the start of the stanza * @param option the option to use when setting value. * @return bool true if successful, false otherwise. */ bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){ if(start == interfaces.end()) return false; - qDebug("setting option"); + odebug << "setting option" << oendl; bool found = false; bool replaced = false; QStringList::Iterator insertAt = NULL; for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { - qDebug(" Interfaces::setOption got line >%s<",(*it).latin1()); + odebug << " Interfaces::setOption got line >" << (*it).latin1() << "<" << oendl; // FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line // but since it works with an empty interfaces file I (tille) will not do anything more if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){ if (found) break; // && it != start){ // if(!found && value != ""){ // // Got to the end of the stanza without finding it, so append it. -// qDebug(" Got to the end of the stanza without finding it, so append it."); +// odebug << " Got to the end of the stanza without finding it, so append it." << oendl; // interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value)); // } - qDebug("found 1"); + odebug << "found 1" << oendl; // interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value)); found = true; insertAt = it; } if((*it).contains(option) && it != start && (*it).at(0) != '#'){ // Found it in stanza so replace it. - qDebug("found 2"); + odebug << "found 2" << oendl; if(found) - qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); + odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl; found = true; replaced = true; (*it) = QString("\t%1 %2").arg(option).arg(value); } } if(!found){ - qDebug("! found insert anyway"); + odebug << "! found insert anyway" << oendl; QStringList::Iterator p = start; interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value)); found = true; } if(found && !replaced){ - qDebug("found iface but not the option so insert it here..."); + odebug << "found iface but not the option so insert it here..." << oendl; interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value)); } return found; } /** * Removes a stanza and all of its options * @param stanza the stanza to remove * @return bool true if successful. */ bool Interfaces::removeStanza(QStringList::Iterator &stanza){ if(stanza == interfaces.end()) @@ -573,25 +573,25 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString if(start == interfaces.end()) return false; bool found = false; for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ // got to the end without finding it break; } if((*it).contains(option) && it != start && (*it).at(0) != '#'){ // Found it in stanza so replace it. if(found) - qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); + odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl; found = true; it = interfaces.remove( it ); // we really want to remove the line --it; // we do ++it later in the head of the for loop } } return found; } /** * Removes a option in a stanza * @param start the start of the stanza * @param option the option to use when setting value. @@ -601,25 +601,25 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString if(start == interfaces.end()) return false; bool found = false; for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ // got to the end without finding it break; } if((*it).contains(option) && (*it).contains(value) && it != start && (*it).at(0) != '#'){ // Found it in stanza so replace it. if(found) - qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1()); + odebug << QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1() << oendl; found = true; it = interfaces.remove( it ); // we really want to remove the line --it; // we do ++it later in the head of the for loop } } return found; } /** * Removes all options in a stanza * @param start the start of the stanza * @return bool true if successful, false otherwise. @@ -654,59 +654,59 @@ QString Interfaces::getOption(const QStringList::Iterator &start, const QString error = false; return QString(); } QString value; bool found = false; for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) { if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){ break; } if((*it).contains(option) && (*it).at(0) != '#'){ if(found) - qDebug(QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1()); + odebug << QString("Interfaces: getOption found more then one value: %1 for option: %2 in stanza %3").arg((*it)).arg(option).arg((*start)).latin1() << oendl; found = true; QString line = (*it).simplifyWhiteSpace(); int space = line.find(" ", option.length()); if(space != -1){ value = line.mid(space+1, line.length()); break; } } } error = !found; return value; } /** * Write out the interfaces file to the file passed into the constructor. * Removes any excess blank lines over 1 line long. * @return bool true if successful, false if not. */ bool Interfaces::write(){ QFile::remove(interfacesFile); QFile file(interfacesFile); if (!file.open(IO_ReadWrite)){ - qDebug(QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1()); + odebug << QString("Interfaces: Can't open file: %1 for writing.").arg(interfacesFile).latin1() << oendl; return false; } QTextStream stream( &file ); int whiteSpaceCount = 0; for ( QStringList::Iterator it = interfaces.begin(); it != interfaces.end(); ++it ) { QString line = (*it).simplifyWhiteSpace(); line = line.replace(QRegExp(" "),""); if(line.length() == 0) whiteSpaceCount++; else whiteSpaceCount = 0; if(whiteSpaceCount < 2){ - qDebug((*it).latin1()); + odebug << (*it).latin1() << oendl; stream << (*it) << '\n'; } } file.close(); return true; } // interfaces.cpp diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp index 7c2f85c..ec3bad3 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp @@ -37,25 +37,25 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac InterfaceSetupImp::~InterfaceSetupImp(){ if(delInterfaces) { delete interfaces; } } /** * Save the current settings, then write out the interfaces file and close. */ bool InterfaceSetupImp::saveChanges(){ bool error; QString iface = interfaces->getInterfaceName(error); - qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() ); + odebug << "InterfaceSetupImp::saveChanges saves interface " << iface.latin1() << "" << oendl; if(!saveSettings()) return false; interfaces->write(); if (interface->getStatus()) { QString ifup; ifup += "ifdown "; ifup += iface; ifup += "; ifup "; ifup += iface; ifup += ";"; @@ -63,25 +63,25 @@ bool InterfaceSetupImp::saveChanges(){ OProcess restart; restart << "sh"; restart << "-c"; restart << ifup; OWait *owait = new OWait(); Global::statusMessage( tr( "Restarting interface" ) ); owait->show(); qApp->processEvents(); if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { - qWarning("unstable to spawn ifdown/ifup"); + owarn << "unstable to spawn ifdown/ifup" << oendl; } owait->hide(); delete owait; interface->refresh(); } return true; } /** * Save the settings for the current Interface. @@ -148,61 +148,61 @@ void InterfaceSetupImp::setProfile(const QString &profile){ QString newInterfaceName = interface->getInterfaceName(); if(profile.length() > 0) newInterfaceName += "_" + profile; // See if we have to make a interface. if(!interfaces->setInterface(newInterfaceName)){ // Add making for this new interface if need too if(profile != ""){ interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); if(!interfaces->setMapping(interface->getInterfaceName())){ interfaces->addMapping(interface->getInterfaceName()); if(!interfaces->setMapping(interface->getInterfaceName())){ - qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface."); + odebug << "InterfaceSetupImp: Added Mapping, but still can't setInterface." << oendl; return; } } interfaces->setMap("map", newInterfaceName); interfaces->setScript("getprofile.sh"); } else{ interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); if(!interfaces->setInterface(newInterfaceName)){ - qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); + odebug << "InterfaceSetupImp: Added interface, but still can't setInterface." << oendl; return; } } } // We must have a valid interface to get this far so read some settings. // DHCP bool error = false; if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) dhcpCheckBox->setChecked(true); else dhcpCheckBox->setChecked(false); // IP Information autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error); - qDebug("dns >%s<",dns.latin1()); + odebug << "dns >" << dns.latin1() << "<" << oendl; if(dns.contains(" ")){ firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); }else firstDNSLineEdit->setText(dns); ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); if (subnetMaskEdit->text().isEmpty()) subnetMaskEdit->setText( "255.255.255.0" ); gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); - qWarning("InterfaceSetupImp::setProfile(%s)\n", profile.latin1()); - qWarning("InterfaceSetupImp::setProfile: iface is %s\n", interfaces->getInterfaceName(error).latin1()); + owarn << "InterfaceSetupImp::setProfile(" << profile.latin1() << ")\n" << oendl; + owarn << "InterfaceSetupImp::setProfile: iface is " << interfaces->getInterfaceName(error).latin1() << "\n" << oendl; } // interfacesetup.cpp diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 1e16b97..3e1a650 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp @@ -70,25 +70,25 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi Interfaces i; QStringList list = i.getInterfaceList(); QMap<QString, Interface*>::Iterator it; for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { /* * we skipped it in getAllInterfaces now * we need to ignore it as well */ if (m_handledIfaces.contains( *ni) ) { - qDebug("Not up iface handled by module"); + odebug << "Not up iface handled by module" << oendl; continue; } bool found = false; for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) { if(it.key() == (*ni)) found = true; } if(!found) { if(!(*ni).contains("_")) { @@ -210,25 +210,25 @@ void MainWindowImp::getAllInterfaces() if((loc = line.find(":")) != -1) { ifaces += line.left(loc); } } } for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) { int flags = 0; if ( m_handledIfaces.contains( (*it) ) ) { - qDebug(" %s is handled by a module", (*it).latin1() ); + odebug << " " << (*it).latin1() << " is handled by a module" << oendl; continue; } // int family; i = NULL; strcpy(ifr.ifr_name, (*it).latin1()); struct ifreq ifcopy; ifcopy = ifr; result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy); flags = ifcopy.ifr_flags; i = new Interface(this, ifr.ifr_name, false); @@ -240,141 +240,141 @@ void MainWindowImp::getAllInterfaces() if ((flags & IFF_BROADCAST) == IFF_BROADCAST) i->setHardwareName("Ethernet"); else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) i->setHardwareName("Point to Point"); else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) i->setHardwareName("Multicast"); else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) i->setHardwareName("Loopback"); else i->setHardwareName("Unknown"); - qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name); + owarn << "Adding interface " << ifr.ifr_name << " to interfaceNames\n" << oendl; interfaceNames.insert(i->getInterfaceName(), i); updateInterface(i); connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*))); } // now lets ask the plugins too ;) QMap<Module*, QLibrary*>::Iterator it; QList<Interface> ilist; for( it = libraries.begin(); it != libraries.end(); ++it ) { if(it.key()) { ilist = it.key()->getInterfaces(); for( i = ilist.first(); i != 0; i = ilist.next() ) { - qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() ); + owarn << "Adding interface " << i->getInterfaceName().latin1() << " to interfaceNames\n" << oendl; interfaceNames.insert(i->getInterfaceName(), i); updateInterface(i); connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*))); } } } } /** * Load all modules that are found in the path * @param path a directory that is scaned for any plugins that can be loaded * and attempts to load them */ void MainWindowImp::loadModules(const QString &path) { #ifdef DEBUG - qDebug("MainWindowImp::loadModules: %s", path.latin1()); + odebug << "MainWindowImp::loadModules: " << path.latin1() << "" << oendl; #endif QDir d(path); if(!d.exists()) return; // Don't want sym links d.setFilter( QDir::Files | QDir::NoSymLinks ); const QFileInfoList *list = d.entryInfoList(); QFileInfoListIterator it( *list ); QFileInfo *fi; while ( (fi=it.current()) ) { #ifdef QWS if(fi->fileName().contains(".so")) { #else if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")) { #endif loadPlugin(path + "/" + fi->fileName()); - qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1()); + odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl; } ++it; } } /** * Attempt to load a function and resolve a function. * @param pluginFileName - the name of the file in which to attempt to load * @param resolveString - function pointer to resolve * @return pointer to the function with name resolveString or NULL */ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString) { #ifdef DEBUG - qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1()); + odebug << "MainWindowImp::loadPlugin: " << pluginFileName.latin1() << ": resolving " << resolveString.latin1() << "" << oendl; #endif #ifdef QWS QLibrary *lib = new QLibrary(pluginFileName); void *functionPointer = lib->resolve(resolveString); if( !functionPointer ) { #ifdef DEBUG - qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1()); + odebug << "MainWindowImp::loadPlugin: Warning: " << pluginFileName.latin1() << " is not a plugin" << oendl; #endif delete lib; return NULL; } // Try to get an object. Module *object = ((Module* (*)()) functionPointer)(); if(object == NULL) { #ifdef DEBUG - qDebug("MainWindowImp: Couldn't create object, but did load library!"); + odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl; #endif delete lib; return NULL; } m_handledIfaces += object->handledInterfaceNames(); // Store for deletion later libraries.insert(object, lib); return object; #else QLibrary *lib = loader->library(pluginFileName); if( !lib || !lib->hasSymbol(resolveString) ) { - qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); + odebug << QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1() << oendl; return NULL; } // Try to get an object. Module *object = ((Module* (*)()) lib->symbol(resolveString))(); if(object == NULL) { #ifdef DEBUG - qDebug("MainWindowImp: Couldn't create object, but did load library!"); + odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl; #endif return NULL; } #ifdef DEBUG - qDebug("MainWindowImp::loadPlugin:: Found object, storing."); + odebug << "MainWindowImp::loadPlugin:: Found object, storing." << oendl; #endif // Store for deletion later libraries.insert(object, lib); return object; #endif } /** * The Add button was clicked. Bring up the add dialog and if OK is hit * load the plugin and append it to the list */ void MainWindowImp::addClicked() @@ -402,25 +402,25 @@ void MainWindowImp::addClicked() { QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); if(!item) return; for( it = libraries.begin(); it != libraries.end(); ++it ) { if(it.key()) { Interface *i = (it.key())->addNewInterface(item->text(0)); if(i) { - qDebug("iface name %s",i->getInterfaceName().latin1()); + odebug << "iface name " << i->getInterfaceName().latin1() << "" << oendl; interfaceNames.insert(i->getInterfaceName(), i); updateInterface(i); } } } } } /** * Prompt the user to see if they really want to do this. * If they do then remove from the list and unload. */ @@ -504,25 +504,25 @@ void MainWindowImp::informationClicked() // if(!i->isAttached()){ // QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); // return; // } if(i->getModuleOwner()) { QWidget *moduleInformation = i->getModuleOwner()->information(i); if(moduleInformation != NULL) { QPEApplication::showWidget( moduleInformation ); #ifdef DEBUG - qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); + odebug << "MainWindowImp::informationClicked:: Module owner has created, we showed." << oendl; #endif return; } } InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp); QPEApplication::showWidget( information ); } /** * Update this interface. If no QListViewItem exists create one. * @param Interface* pointer to the interface that needs to be updated. */ @@ -641,25 +641,25 @@ void MainWindowImp::removeProfile() profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); profilesList->clear(); for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) profilesList->insertItem((*it)); // Remove any interface settings and mappings. Interfaces interfaces; // Go through them one by one QMap<Interface*, QListViewItem*>::Iterator it; for( it = items.begin(); it != items.end(); ++it ) { QString interfaceName = it.key()->getInterfaceName(); - qDebug(interfaceName.latin1()); + odebug << interfaceName.latin1() << oendl; if(interfaces.setInterface(interfaceName + "_" + profileToRemove)) { interfaces.removeInterface(); if(interfaces.setMapping(interfaceName)) { if(profilesList->count() == 1) interfaces.removeMapping(); else { interfaces.removeMap("map", interfaceName + "_" + profileToRemove); } } @@ -710,39 +710,39 @@ void MainWindowImp::changeProfile() void MainWindowImp::makeChannel() { channel = new QCopChannel( "QPE/Application/networksettings", this ); connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); } void MainWindowImp::receive(const QCString &msg, const QByteArray &arg) { bool found = false; - qDebug("MainWindowImp::receive QCop msg >"+msg+"<"); + odebug << "MainWindowImp::receive QCop msg >"+msg+"<" << oendl; if (msg == "raise") { raise(); return; } QString dest = msg.left(msg.find("(")); QCString param = msg.right(msg.length() - msg.find("(") - 1); param = param.left( param.length() - 1 ); - qDebug("dest >%s< param >"+param+"<",dest.latin1()); + odebug << "dest >" << dest.latin1() << "< param >"+param+"<" << oendl; QMap<Module*, QLibrary*>::Iterator it; for( it = libraries.begin(); it != libraries.end(); ++it ) { - qDebug("plugin >%s<", it.key()->type().latin1() ); + odebug << "plugin >" << it.key()->type().latin1() << "<" << oendl; if(it.key()->type() == dest) { it.key()->receive( param, arg ); found = true; } } if (found) QPEApplication::setKeepRunning(); - else qDebug("Huh what do ya want"); + else odebug << "Huh what do ya want" << oendl; } diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp index b8a1925a..aedc0b9 100644 --- a/noncore/settings/networksettings/ppp/accounts.cpp +++ b/noncore/settings/networksettings/ppp/accounts.cpp @@ -109,25 +109,25 @@ void AccountWidget::edit() void AccountWidget::create() { // if(listListbox->count() == MAX_ACCOUNTS) { // QMessageBox::information(this, "sorry", // tr("Maximum number of accounts reached.")); // return; // } int result; if (_pppdata->newaccount() == -1) { - qDebug("_pppdata->newaccount() == -1"); + odebug << "_pppdata->newaccount() == -1" << oendl; return; } result = doTab(); if(result == QDialog::Accepted) { listListbox->insertItem(_pppdata->accname()); listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true); _pppdata->save(); } else diff --git a/noncore/settings/networksettings/ppp/authwidget.cpp b/noncore/settings/networksettings/ppp/authwidget.cpp index fa2b164..f3d842f 100644 --- a/noncore/settings/networksettings/ppp/authwidget.cpp +++ b/noncore/settings/networksettings/ppp/authwidget.cpp @@ -133,34 +133,34 @@ bool AuthWidget::check() void AuthWidget::save() { _pppdata->setAuthMethod(auth->currentItem()); if (scriptWidget) scriptWidget->save(); _pppdata->setStoredUsername( userName->text() ); _pppdata->setStorePassword(store_password->isChecked()); if (store_password->isChecked()) _pppdata->setStoredPassword( passWord->text() ); } void AuthWidget::authChanged( const QString &authStr ) { - qDebug("AuthWidget::authChanged( %s )", authStr.latin1() ); + odebug << "AuthWidget::authChanged( " << authStr.latin1() << " )" << oendl; if ( authStr.contains( tr("Script-based") ) ){ showUsernamePassword( false ); showScriptWindow( true ); } else if ( authStr.contains( tr("PAP") ) || authStr.contains( tr("CHAP") ) ){ showUsernamePassword( true ); showScriptWindow( false ); } else { - qDebug("do not really know how to handle"); + odebug << "do not really know how to handle" << oendl; showUsernamePassword( false ); showScriptWindow( false ); } } void AuthWidget::showUsernamePassword( bool show ) { if (show){ user_l->show(); userName->show(); pw_l->show(); diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index e3fab24..b75410c 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp @@ -463,25 +463,25 @@ void ConnectWidget::timerEvent(QTimerEvent *) { // execute the script if(vmain == 2) { if(!expecting && !pausing && !scanning) { timeout_timer->stop(); timeout_timer->start(scriptTimeout); if((unsigned) scriptindex < comlist->count()) { scriptCommand = *(comlist->at(scriptindex)); scriptArgument = *(arglist->at(scriptindex)); } else { - qDebug( "End of script" ); + odebug << "End of script" << oendl; vmain = 10; return; } if (scriptCommand == "Scan") { QString bm = QObject::tr("Scanning %1").arg(scriptArgument); messg->setText(bm); emit debugMessage(bm); setScan(scriptArgument); scriptindex++; return; @@ -829,35 +829,35 @@ void ConnectWidget::timerEvent(QTimerEvent *) { // Close the tty. This prevents the QTimer::singleShot() in // Modem::readtty() from re-enabling the socket notifier. // The port is still held open by the helper process. /* Er, there _is_ not QTimer::singleShot() in Modem::readtty(), and closing the thing prevents pppd from using it later. */ //_ifaceppp->modem()->closetty(); killTimer( main_timer_ID ); if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000); - qDebug( "started if timeout timer with %i", _ifaceppp->data()->pppdTimeout()*1000); + odebug << "started if timeout timer with " << _ifaceppp->data()->pppdTimeout()*1000 << "" << oendl; // find out PPP interface and notify the stats module // stats->setUnit(pppInterfaceNumber()); qApp->flushX(); semaphore = true; result = execppp(); emit debugMessage(QObject::tr("Starting pppd...")); - qDebug("execppp() returned with return-code %i", result ); + odebug << "execppp() returned with return-code " << result << "" << oendl; if(result) { if(!_ifaceppp->data()->autoDNS()) adddns( _ifaceppp ); // O.K we are done here, let's change over to the if_waiting loop // where we wait for the ppp if (interface) to come up. emit if_waiting_signal(); } else { // starting pppd wasn't successful. Error messages were @@ -1055,25 +1055,25 @@ void ConnectWidget::setExpect(const QString &n) { QString ts = QObject::tr("Expecting: %1").arg(n); ts.replace(QRegExp("\n"), "<LF>"); emit debugMessage(ts); // check if the expected string is in the read buffer already. checkBuffers(); } void ConnectWidget::if_waiting_timed_out() { if_timer->stop(); if_timeout_timer->stop(); - qDebug("if_waiting_timed_out()"); + odebug << "if_waiting_timed_out()" << oendl; _ifaceppp->data()->setpppdError(E_IF_TIMEOUT); // let's kill the stuck pppd _ifaceppp->modem()->killPPPDaemon(); emit stopAccounting(); // p_kppp->con_win->stopClock(); // killing ppp will generate a SIGCHLD which will be caught in pppdie() // in main.cpp what happens next will depend on the boolean @@ -1262,25 +1262,25 @@ bool ConnectWidget::execppp() { command += " call opie-kppp logfd 11"; if (command.length() > MAX_CMDLEN) { QMessageBox::critical(this, "error", QObject::tr( "pppd command + command-line arguments exceed " "2024 characters in length." )); return false; // nonsensically long command which would bust my buffer buf. } - qWarning("Command IS: %s",command.latin1() ); + owarn << "Command IS: " << command.latin1() << "" << oendl; qApp->flushX(); return _ifaceppp->modem()->execPPPDaemon(command); } void ConnectWidget::closeEvent( QCloseEvent *e ) { e->ignore(); emit cancelbutton(); } diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp index 9da090d..350ff32 100644 --- a/noncore/settings/networksettings/ppp/devices.cpp +++ b/noncore/settings/networksettings/ppp/devices.cpp @@ -63,29 +63,29 @@ DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *nam tr("Makes a copy of the selected device. All\n" "settings of the selected device are copied\n" "to a new device, that you can modify to fit your\n" "needs")); QWhatsThis::add(delete_b, tr("<p>Deletes the selected device\n\n" "<font color=\"red\"><b>Use with care!</b></font>")); copy_b->setEnabled( false ); //FIXME // delete_b->setEnabled( false ); //FIXME QStringList tmp = _pppdata->getDevicesNamesList(); - qDebug("DevicesWidget::DevicesWidget got devices %s",tmp.join("--").latin1()); + odebug << "DevicesWidget::DevicesWidget got devices " << tmp.join("--").latin1() << "" << oendl; listListbox->insertStringList(tmp); for (uint i = 0; i < listListbox->count(); i++){ - qDebug("listListbox->text(i) %s == _pppdata->devname() %s",listListbox->text(i).latin1(), _pppdata->devname().latin1()); + odebug << "listListbox->text(i) " << listListbox->text(i).latin1() << " == _pppdata->devname() " << _pppdata->devname().latin1() << "" << oendl; if ( listListbox->text(i) == _pppdata->devname() ) listListbox->setCurrentItem( i ); } } void DevicesWidget::slotListBoxSelect(int idx) { bool ok = _pppdata->setDevice( listListbox->text(idx) ); delete_b->setEnabled((bool)(idx != -1)); edit_b->setEnabled((bool)(idx != -1)); //FIXME copy_b->setEnabled((bool)(idx != -1)); diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp index 81dab38..69bb682 100644 --- a/noncore/settings/networksettings/ppp/general.cpp +++ b/noncore/settings/networksettings/ppp/general.cpp @@ -326,25 +326,25 @@ ModemWidget::~ModemWidget() // _pppdata->setModemTimeout(n); // } bool ModemWidget::save() { //first check to make sure that the device name is unique! if(modemname->text().isEmpty() || !_pppdata->isUniqueDevname(modemname->text())) return false; - qDebug("ModemWidget::save saving modem1 data"); + odebug << "ModemWidget::save saving modem1 data" << oendl; _pppdata->setDevname( modemname->text() ); _pppdata->setModemDevice( modemdevice->currentText() ); _pppdata->setFlowcontrol(flowcontrol->currentText()); _pppdata->setFlowcontrol(flowcontrol->currentText()); _pppdata->setSpeed(baud_c->currentText()); _pppdata->setModemLockFile( modemlockfile->isChecked()); _pppdata->setModemTimeout( modemtimeout->value() ); return true; } ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp index 6b158b9..5a76293 100644 --- a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp @@ -11,25 +11,25 @@ #ifdef QWS #else #define showMaximized show #endif /** * Constructor for the InterfaceInformationImp class. This class pretty much * just display's information about the interface that is passed to it. */ InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f) :InterfaceInformationImp(parent, name, i, Qt::WStyle_ContextHelp) { - qDebug("InterfaceInformationPPP::InterfaceInformationPPP %s", name); + odebug << "InterfaceInformationPPP::InterfaceInformationPPP " << name << "" << oendl; con = new ConnectWidget( (InterfacePPP*)i, this, "con" ); con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed) ); macAddressLabel->hide(); subnetMaskLabel->hide(); broadcastLabel->hide(); TextLabel23->hide(); TextLabel21->hide(); TextLabel24->hide(); InterfaceInformationLayout->addWidget( con, 1, 0 ); diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp index f443f3c..5cc6f70 100644 --- a/noncore/settings/networksettings/ppp/interfaceppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp @@ -5,64 +5,64 @@ #include <qlabel.h> #include "auth.h" #include "interfaceppp.h" #include "modem.h" #include "pppdata.h" InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) : Interface(parent, name, status), _modemPtr(0), _dataPtr(0) { - qDebug("InterfacePPP::InterfacePPP("); + odebug << "InterfacePPP::InterfacePPP(" << oendl; } PPPData* InterfacePPP::data()const { if (!_dataPtr){ - qDebug("creating new Data obj"); + odebug << "creating new Data obj" << oendl; _dataPtr = new PPPData(); _dataPtr->setDevice( getInterfaceName() ); _dataPtr->setAccount( getHardwareName() ); } return _dataPtr; } Modem* InterfacePPP::modem()const { if (!_modemPtr){ - qDebug("creating new modem obj"); + odebug << "creating new modem obj" << oendl; _modemPtr = new Modem( data() ); } return _modemPtr; } bool InterfacePPP::refresh() { - qDebug("InterfacePPP::refresh()"); + odebug << "InterfacePPP::refresh()" << oendl; QString old = getInterfaceName(); setInterfaceName( modem()->pppDevice() ); (void)Interface::refresh(); setInterfaceName( old ); emit updateInterface(this); return true; } void InterfacePPP::start() { - qDebug("InterfacePPP::start"); + odebug << "InterfacePPP::start" << oendl; if (data()->password().isEmpty() && !data()->storedUsername().isEmpty() ) { QDialog mb( 0, "Dialog", true ); mb.setCaption( tr( "No password" ) ); QVBoxLayout layout( &mb ); QLabel text ( &mb ); text.setText( tr("Username defined but no password\n Please enter a password") ); QLineEdit lineedit( &mb ); lineedit.setEchoMode( QLineEdit::Password ); layout.addWidget( &text ); layout.addWidget( &lineedit ); @@ -134,30 +134,30 @@ void InterfacePPP::start() if (data()->phonenumber().isEmpty()) { QString s = QObject::tr("You must specify a telephone number!"); QMessageBox::warning(0, tr("Error"), s); return; } // SEGFAULTS: // setStatus( true ); // emit updateInterface((Interface*) this); emit begin_connect(); - qDebug("InterfacePPP::start END"); + odebug << "InterfacePPP::start END" << oendl; } void InterfacePPP::stop() { - qDebug("InterfacePPP::stop"); + odebug << "InterfacePPP::stop" << oendl; // emit hangup_now(); status = false; // not connected setStatus( false ); emit hangup_now(); refresh(); } void InterfacePPP::save() { data()->save(); emit updateInterface((Interface*) this); diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp index e21bbc7..fd09332 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.cpp +++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp @@ -65,31 +65,31 @@ #define execute_command system KPPPWidget *p_kppp = 0; KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl ) : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd) { // tabWindow = 0; p_kppp = this; // before doing anything else, run a few tests if (!_pppdata->setModemDevice( i->getInterfaceName() )) _pppdata->setModemDevice("/dev/modem"); - qDebug("PPPConfigWidget::PPPConfigWidget"); - qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1()); + odebug << "PPPConfigWidget::PPPConfigWidget" << oendl; + odebug << " interface->getHardwareName >" << i->getHardwareName().latin1() << "<" << oendl; if (!_pppdata->setAccount( i->getHardwareName() )) _pppdata->setAccount( 0 ); - qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1()); - qDebug(" _pppdata->currentAccountID() >%i<",_pppdata->currentAccountID()); + odebug << " _pppdata->accname >" << _pppdata->accname().latin1() << "<" << oendl; + odebug << " _pppdata->currentAccountID() >" << _pppdata->currentAccountID() << "<" << oendl; int result = runTests(); if(result == TEST_CRITICAL) exit(4); // installEventFilter(this); QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); QGridLayout *l1 = new QGridLayout(3, 4); tl->addLayout(l1); l1->addColSpacing(0, 10); @@ -296,25 +296,25 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na } KPPPWidget::~KPPPWidget() { p_kppp = 0; // delete stats; } // bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { // if(e->type() == QEvent::User) { // switch(((SignalEvent*)e)->sigType()) { // case SIGINT: -// qDebug( "Received a SIGINT" ); +// odebug << "Received a SIGINT" << oendl; // interruptConnection(); // break; // case SIGCHLD: // sigChld(); // break; // case SIGUSR1: // sigPPPDDied(); // break; // } // return true; // } @@ -414,44 +414,44 @@ void KPPPWidget::interruptConnection() { // if (con->isVisible()) emit con->cancelbutton(); // disconnect if online if (_pppdata->pppdRunning()) emit disconnect(); } void KPPPWidget::sigPPPDDied() { - qDebug( "Received a SIGUSR1" ); + odebug << "Received a SIGUSR1" << oendl; // if we are not connected pppdpid is -1 so have have to check for that // in the followin line to make sure that we don't raise a false alarm // such as would be the case when the log file viewer exits. if(_pppdata->pppdRunning() || _pppdata->pppdError()) { - qDebug( "It was pppd that died" ); + odebug << "It was pppd that died" << oendl; // when we killpppd() on Cancel in ConnectWidget // we set pppid to -1 so we won't // enter this block // just to be sure Modem::modem->removeSecret(AUTH_PAP); Modem::modem->removeSecret(AUTH_CHAP); _pppdata->setpppdRunning(false); - qDebug( "Executing command on disconnect since pppd has died." ); + odebug << "Executing command on disconnect since pppd has died." << oendl; QApplication::flushX(); execute_command(_pppdata->command_on_disconnect()); // stopAccounting(); con_win->stopClock(); // DockWidget::dock_widget->stop_stats(); // DockWidget::dock_widget->hide(); if(!_pppdata->pppdError()) _pppdata->setpppdError(E_PPPD_DIED); removedns(); @@ -480,47 +480,47 @@ void KPPPWidget::sigPPPDDied() { msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus); msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error " "codes or take a look at the kppp FAQ on " " <a href=http://devel-home.kde.org/~kppp/index.html>" "http://devel-home.kde.org/~kppp/index.html</a></p>"); } } // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No) // // PPPL_ShowLog(); // } else { /* reconnect on disconnect */ if (false){ - qDebug( "Trying to reconnect... " ); + odebug << "Trying to reconnect... " << oendl; if(_pppdata->authMethod() == AUTH_PAP || _pppdata->authMethod() == AUTH_CHAP || _pppdata->authMethod() == AUTH_PAPCHAP) Modem::modem->setSecret(_pppdata->authMethod(), encodeWord(_pppdata->storedUsername()), encodeWord(_pppdata->password())); con_win->hide(); con_win->stopClock(); // stopAccounting(); _pppdata->setpppdRunning(false); // not in a signal handler !!! KNotifyClient::beep(); emit cmdl_start(); } } _pppdata->setpppdError(0); } } // void KPPPWidget::sigChld() { -// qDebug( "sigchld()" ); +// odebug << "sigchld()" << oendl; // // pid_t id = wait(0L); // // if(id == helperPid && helperPid != -1) { // // kdDebug(5002) << "It was the setuid child that died" << endl; // // helperPid = -1; // QString msg = QObject::tr("kppp's helper process just died.\n" // "Since a further execution would be pointless, " // "kppp will shut down now."); // QMessageBox::warning(0L,"error", msg); // //remove_pidfile(); // exit(1); // // } // } diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp index 3dbc8c3..f3f2639 100644 --- a/noncore/settings/networksettings/ppp/modem.cpp +++ b/noncore/settings/networksettings/ppp/modem.cpp @@ -46,25 +46,25 @@ #ifndef _PATH_RESCONF #define _PATH_RESCONF "/etc/resolv.conf" #endif #define strlcpy strcpy #include "auth.h" #include "modem.h" #include "pppdata.h" #define qError qDebug #define MY_ASSERT(x) if (!(x)) { \ - qFatal( "ASSERT: \"%s\" in %s (%d)\n",#x,__FILE__,__LINE__); \ + ofatal << "ASSERT: \"" << #x << "\" in " << __FILE__ << " (" << __LINE__ << ")\n" << oendl; \ exit(1); } static sigjmp_buf jmp_buffer; //Modem *Modem::modem = 0; const char* pppdPath() { // wasting a few bytes static char buffer[sizeof(PPPDSEARCHPATH)+sizeof(PPPDNAME)]; static char *pppdPath = 0L; @@ -156,25 +156,25 @@ speed_t Modem::modemspeed() { return B38400; break; } } bool Modem::opentty() { // int flags; //begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { close(modemfd); device = _pppdata->modemDevice(); if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { - qDebug("error opening modem device !"); + odebug << "error opening modem device !" << oendl; errmsg = QObject::tr("Unable to open modem."); return false; } //bend if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { //} #if 0 if(_pppdata->UseCDLine()) { if(ioctl(modemfd, TIOCMGET, &flags) == -1) { errmsg = QObject::tr("Unable to detect state of CD line."); ::close(modemfd); modemfd = -1; @@ -297,56 +297,56 @@ void Modem::notify(const QObject *receiver, const char *member) { void Modem::stop() { disconnect(SIGNAL(charWaiting(unsigned char))); stopNotifier(); } void Modem::startNotifier() { if(modemfd >= 0) { if(sn == 0) { sn = new QSocketNotifier(modemfd, QSocketNotifier::Read, this); connect(sn, SIGNAL(activated(int)), SLOT(readtty(int))); - qDebug("QSocketNotifier started!"); + odebug << "QSocketNotifier started!" << oendl; } else { - qDebug("QSocketNotifier re-enabled!"); + odebug << "QSocketNotifier re-enabled!" << oendl; sn->setEnabled(true); } } } void Modem::stopNotifier() { if(sn != 0) { sn->setEnabled(false); disconnect(sn); delete sn; sn = 0; - qDebug( "QSocketNotifier stopped!" ); + odebug << "QSocketNotifier stopped!" << oendl; } } void Modem::flush() { char c; while(read(modemfd, &c, 1) == 1); } bool Modem::writeChar(unsigned char c) { int s; do { s = write(modemfd, &c, 1); if (s < 0) { - qError( "write() in Modem::writeChar failed" ); + oerr << "write() in Modem::writeChar failed" << oendl; return false; } } while(s == 0); return true; } bool Modem::writeLine(const char *buf) { int len = strlen(buf); char *b = new char[len+2]; memcpy(b, buf, len); @@ -356,25 +356,25 @@ bool Modem::writeLine(const char *buf) { b[len++]='\n'; else if(term == "CR") b[len++]='\r'; else if(term == "CR/LF") { b[len++]='\r'; b[len++]='\n'; } int l = len; while(l) { int wr = write(modemfd, &b[len-l], l); if(wr < 0) { // TODO do something meaningful with the error code (or ignore it - qError( "write() in Modem::writeLine failed" ); + oerr << "write() in Modem::writeLine failed" << oendl; delete[] b; return false; } l -= wr; } delete[] b; return true; } bool Modem::hangup() { // this should really get the modem to hang up and go into command mode @@ -465,25 +465,25 @@ void Modem::escape_to_command_mode() { const QString Modem::modemMessage() { return errmsg; } QString Modem::parseModemSpeed(const QString &s) { // this is a small (and bad) parser for modem speeds int rx = -1; int tx = -1; int i; QString result; - qDebug( "Modem reported result string: %s", s.latin1()); + odebug << "Modem reported result string: " << s.latin1() << "" << oendl; const int RXMAX = 7; const int TXMAX = 2; QRegExp rrx[RXMAX] = { QRegExp("[0-9]+[:/ ]RX", false), QRegExp("[0-9]+RX", false), QRegExp("[/: -][0-9]+[/: ]", false), QRegExp("[/: -][0-9]+$", false), QRegExp("CARRIER [^0-9]*[0-9]+", false), QRegExp("CONNECT [^0-9]*[0-9]+", false), QRegExp("[0-9]+") // panic mode }; @@ -551,131 +551,131 @@ QString Modem::parseModemSpeed(const QString &s) { } } if(rx == -1 && tx == -1) result = QObject::tr("Unknown speed"); else if(tx == -1) result.setNum(rx); else if(rx == -1) // should not happen result.setNum(tx); else result.sprintf("%d/%d", rx, tx); - qDebug( "The parsed result is: %s", result.latin1()); + odebug << "The parsed result is: " << result.latin1() << "" << oendl; return result; } // Lock modem device. Returns 0 on success 1 if the modem is locked and -1 if // a lock file can't be created ( permission problem ) int Modem::lockdevice() { int fd; char newlock[80]=""; // safe if(!_pppdata->modemLockFile()) { - qDebug("The user doesn't want a lockfile."); + odebug << "The user doesn't want a lockfile." << oendl; return 0; } if (modem_is_locked) return 1; QString lockfile = LOCK_DIR"/LCK.."; lockfile += _pppdata->modemDevice().mid(5); // append everything after /dev/ if(access(QFile::encodeName(lockfile), F_OK) == 0) { // if ((fd = Requester::rq-> if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) { // Mario: it's not necessary to read more than lets say 32 bytes. If // file has more than 32 bytes, skip the rest char oldlock[33]; // safe int sz = read(fd, &oldlock, 32); close (fd); if (sz <= 0) return 1; oldlock[sz] = '\0'; - qDebug( "Device is locked by: %s", oldlock); + odebug << "Device is locked by: " << oldlock << "" << oendl; int oldpid; int match = sscanf(oldlock, "%d", &oldpid); // found a pid in lockfile ? if (match < 1 || oldpid <= 0) return 1; // check if process exists if (kill((pid_t)oldpid, 0) == 0 || errno != ESRCH) return 1; - qDebug( "lockfile is stale" ); + odebug << "lockfile is stale" << oendl; } } fd = openLockfile(_pppdata->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); if(fd >= 0) { sprintf(newlock,"%010d\n", getpid()); - qDebug("Locking Device: %s", newlock); + odebug << "Locking Device: " << newlock << "" << oendl; write(fd, newlock, strlen(newlock)); close(fd); modem_is_locked=true; return 0; } return -1; } // UnLock modem device void Modem::unlockdevice() { if (modem_is_locked) { - qDebug( "UnLocking Modem Device" ); + odebug << "UnLocking Modem Device" << oendl; close(modemfd); modemfd = -1; unlink(lockfile); lockfile[0] = '\0'; modem_is_locked=false; } } int Modem::openLockfile( QString lockfile, int flags) { int fd; int mode; flags = O_RDONLY; if(flags == O_WRONLY|O_TRUNC|O_CREAT) mode = 0644; else mode = 0; lockfile = LOCK_DIR; lockfile += "/LCK.."; lockfile += device.right( device.length() - device.findRev("/") -1 ); - qDebug("lockfile >%s<",lockfile.latin1()); + odebug << "lockfile >" << lockfile.latin1() << "<" << oendl; // TODO: // struct stat st; // if(stat(lockfile.data(), &st) == -1) { // if(errno == EBADF) // return -1; // } else { // // make sure that this is a regular file // if(!S_ISREG(st.st_mode)) // return -1; // } if ((fd = open(lockfile, flags, mode)) == -1) { - qDebug("error opening lockfile!"); + odebug << "error opening lockfile!" << oendl; lockfile = QString::null; fd = open(DEVNULL, O_RDONLY); } else fchown(fd, 0, 0); return fd; } void alarm_handler(int) { // fprintf(stderr, "alarm_handler(): Received SIGALRM\n"); @@ -918,60 +918,60 @@ bool Modem::execpppd(const char *arguments) { fprintf(stderr, "Kernel does not support ppp, oops.\n"); break; case 0: fprintf(stderr, "Kernel supports ppp alright.\n"); break; } execve(pppdPath(), args, 0L); _exit(0); break; default: - qDebug("In parent: pppd pid %d\n",pppdPid); + odebug << "In parent: pppd pid " << pppdPid << "\n" << oendl; close(modemfd); ::close( m_pppdLOG[1] ); // set it to nonblocking io int flag = ::fcntl( m_pppdLOG[0], F_GETFL ); if ( !(flag & O_NONBLOCK) ) { - qDebug("Setting nonblocking io"); + odebug << "Setting nonblocking io" << oendl; flag |= O_NONBLOCK; ::fcntl(m_pppdLOG[0], F_SETFL, flag ); } delete m_modemDebug; m_modemDebug = new QSocketNotifier(m_pppdLOG[0], QSocketNotifier::Read, this ); connect(m_modemDebug, SIGNAL(activated(int) ), this, SLOT(slotModemDebug(int) ) ); modemfd = -1; m_pppdDev = QString::fromLatin1("ppp0"); return true; break; } } bool Modem::killpppd() { - qDebug("In killpppd and pid is %d", pppdPid ); + odebug << "In killpppd and pid is " << pppdPid << "" << oendl; if(pppdPid > 0) { delete m_modemDebug; m_modemDebug = 0; - qDebug("In killpppd(): Sending SIGTERM to %d\n", pppdPid); + odebug << "In killpppd(): Sending SIGTERM to " << pppdPid << "\n" << oendl; if(kill(pppdPid, SIGTERM) < 0) { - qDebug("Error terminating %d. Sending SIGKILL\n", pppdPid); + odebug << "Error terminating " << pppdPid << ". Sending SIGKILL\n" << oendl; if(kill(pppdPid, SIGKILL) < 0) { - qDebug("Error killing %d\n", pppdPid); + odebug << "Error killing " << pppdPid << "\n" << oendl; return false; } } } return true; } void Modem::parseargs(char* buf, char** args) { int nargs = 0; int quotes; @@ -1026,46 +1026,46 @@ void Modem::killPPPDaemon() killpppd(); } int Modem::pppdExitStatus() { return _pppdExitStatus; } int Modem::openResolv(int flags) { int fd; if ((fd = open(_PATH_RESCONF, flags)) == -1) { - qDebug("error opening resolv.conf!"); + odebug << "error opening resolv.conf!" << oendl; fd = open(DEVNULL, O_RDONLY); } return fd; } bool Modem::setHostname(const QString & name) { return sethostname(name, name.length()) == 0; } QString Modem::pppDevice()const { return m_pppdDev; } void Modem::setPPPDevice( const QString& dev ) { m_pppdDev = dev; } pid_t Modem::pppPID()const { return pppdPid; } void Modem::setPPPDPid( pid_t pid ) { - qDebug("Modem setting pid"); + odebug << "Modem setting pid" << oendl; _pppdExitStatus = -1; pppdPid = pid; modemfd = -1; } void Modem::slotModemDebug(int fd) { char buf[2049]; int len; // read in pppd data look for Using interface // then read the interface // we limit to 10 device now 0-9 if((len = ::read(fd, buf, 2048)) > 0) { diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp index 97baf31..a8c99fd 100644 --- a/noncore/settings/networksettings/ppp/pppconfig.cpp +++ b/noncore/settings/networksettings/ppp/pppconfig.cpp @@ -16,28 +16,28 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent, const char *name, bool modal, WFlags fl ) : QDialog(parent, name, modal, fl) { setCaption(tr("Configure Modem")); int result = runTests(); if(result == TEST_CRITICAL){ QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") ); return; } interface = iface; - qDebug("PPPConfigWidget::PPPConfigWidget"); - qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1()); + odebug << "PPPConfigWidget::PPPConfigWidget" << oendl; + odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl; - qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1()); + odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl; QVBoxLayout *layout = new QVBoxLayout( this ); layout->setSpacing( 0 ); layout->setMargin( 1 ); tabWindow = new QTabWidget( this, "tabWidget" ); layout->addWidget( tabWindow ); accounts = new AccountWidget( interface->data(), tabWindow, "accounts", Qt::WStyle_ContextHelp ); tabWindow->addTab( accounts, tr("&Accounts") ); devices = new DevicesWidget( interface, tabWindow, "devices", Qt::WStyle_ContextHelp ); tabWindow->addTab( devices, tr("&Devices") ); @@ -49,27 +49,27 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent, // tabWindow->addTab( modem2, tr("&Modem") ); } PPPConfigWidget::~PPPConfigWidget() { } void PPPConfigWidget::accept() { - qDebug("PPPConfigWidget::accept"); - qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1()); - qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1()); + odebug << "PPPConfigWidget::accept" << oendl; + odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl; + odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl; interface->setInterfaceName( interface->data()->devname() ); interface->setHardwareName( interface->data()->accname() ); interface->save(); QDialog::accept(); } void PPPConfigWidget::reject() { interface->data()->cancel(); QDialog::reject(); } diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index f4727c1..567ccf8 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp @@ -47,26 +47,26 @@ PPPData::PPPData() highcountdev(-1), // start out with no entries // caccount(-1), // set the current account index also suidprocessid(-1), // process ID of setuid child pppdisrunning(false), pppderror(0) { highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; highcountdev = readNumConfig(GENERAL_GRP, NUMDEVICES_KEY, 0) - 1; Config cfg = config(); cfg.setGroup(GENERAL_GRP); accountList = cfg.readListEntry(ACCOUNT_LIST, ',' ); deviceList = cfg.readListEntry(DEVICESNAMES_LIST, ',' ); - qDebug("PPPData::PPPData has a accountList %s", accountList.join("---").latin1()); - qDebug("PPPData::PPPData has a deviceList %s", deviceList.join("---").latin1()); + odebug << "PPPData::PPPData has a accountList " << accountList.join("---").latin1() << "" << oendl; + odebug << "PPPData::PPPData has a deviceList " << deviceList.join("---").latin1() << "" << oendl; // if (highcount > MAX_ACCOUNTS) // highcount = MAX_ACCOUNTS; // if(highcount >= 0 && defaultAccount().isEmpty()) { // setAccountbyIndex(0); // setDefaultAccount(accname()); // } else if(!setAccount(defaultAccount())) setDefaultAccount(accname()); // start out with internal debugging disabled // the user is still free to specify `debug' on his own @@ -77,81 +77,81 @@ PPPData::PPPData() } Config PPPData::config() { return Config("NetworkSetupPPP"); } // // save configuration // void PPPData::save() { - qDebug("PPPData saving data"); + odebug << "PPPData saving data" << oendl; writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); writeConfig(GENERAL_GRP, NUMDEVICES_KEY, highcountdev + 1); QString key; QStringList keys; Config cfg = config(); cfg.setGroup(GENERAL_GRP); cfg.writeEntry(ACCOUNT_LIST, accountList, ',' ); cfg.writeEntry(DEVICESNAMES_LIST, deviceList, ',' ); for( QMap<QString,QString>::Iterator it = stringEntries.begin(); it != stringEntries.end(); ++it ){ QString val = it.data(); key = it.key(); -// qDebug("saving %s -> %s", key.latin1(), val.latin1() ); +// odebug << "saving " << key.latin1() << " -> " << val.latin1() << "" << oendl; keys = QStringList::split( "SEPARATOR", key ); - //qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); + //odebug << "group >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl; cfg.setGroup(keys[0]); cfg.writeEntry(keys[1], val); } for( QMap<QString,int>::Iterator it = intEntries.begin(); it != intEntries.end(); ++it ){ int val = it.data(); key = it.key(); -// qDebug("saving %s -> %i", key.latin1(), val ); +// odebug << "saving " << key.latin1() << " -> " << val << "" << oendl; keys = QStringList::split( "SEPARATOR", key ); - //qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val ); + //odebug << "group >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< val " << val << "" << oendl; cfg.setGroup(keys[0]); cfg.writeEntry(keys[1], val); } for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); it != listEntries.end(); ++it ){ QStringList val = it.data(); key = it.key(); QChar sep = sepEntries[key]; -// qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() ); +// odebug << "saving " << key.latin1() << " -> " << val.join(sep).latin1() << "" << oendl; keys = QStringList::split( "SEPARATOR", key ); cfg.setGroup(keys[0]); cfg.writeEntry(keys[1], val, sep); } } // // cancel changes // void PPPData::cancel() { stringEntries.clear(); intEntries.clear(); listEntries.clear(); } // functions to read/write date to configuration file QString PPPData::readConfig(const QString &group, const QString &key, const QString &defvalue = "") { -// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); +// odebug << "PPPData::readConfig key >" << key.latin1() << "< group >" << group.latin1() << "<" << oendl; QString idx = SEP.arg(group).arg(key); if (stringEntries.find(idx) != stringEntries.end()) return stringEntries[idx]; Config cfg = config(); cfg.setGroup(group); return cfg.readEntry(key, defvalue); } int PPPData::readNumConfig(const QString &group, const QString &key, int defvalue) { @@ -356,39 +356,39 @@ void PPPData::setpppdTimeout(int n) { const QString PPPData::modemDevice() { return readConfig (modemGroup(), MODEMDEV_KEY, "/dev/modem" ); } // const QString PPPData::modemName() // { // return readConfig(modemGroup(), MODEMNAME_KEY); // } // bool PPPData::setModemName(const QString &n) { -// qDebug("Setting modem name to >%s<", n.latin1()); +// odebug << "Setting modem name to >" << n.latin1() << "<" << oendl; // _modemName = n; // writeConfig(cgroup, MODEMNAME_KEY, n); // return true; //FIXME // } // bool PPPData::changeModemName(const QString &n) { -// qDebug("Setting modem name to >%s<", n.latin1()); +// odebug << "Setting modem name to >" << n.latin1() << "<" << oendl; // _modemName = n; // writeConfig(modemGroup(), MODEMNAME_KEY, n); // return true; //FIXME // } bool PPPData::setModemDevice(const QString &n) { - qDebug("Setting modem dev to >%s<", n.latin1()); + odebug << "Setting modem dev to >" << n.latin1() << "<" << oendl; writeConfig(modemGroup(), MODEMDEV_KEY, n); return true; //FIXME } const QString PPPData::flowcontrol() { return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); } void PPPData::setFlowcontrol(const QString &n) { writeConfig(modemGroup(), FLOWCONTROL_KEY, n); @@ -730,80 +730,80 @@ void PPPData::setEnter(const QString &n) { // // functions to set/return account information // //returns number of accounts int PPPData::count() const { return highcount + 1; } bool PPPData::setAccount(const QString &aname) { - qDebug("setting account to >%s<", aname.latin1()); + odebug << "setting account to >" << aname.latin1() << "<" << oendl; for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { cgroup = *it; - qDebug("PPPData::setAccount %s", cgroup.latin1()); - qDebug( "iterator %s", (*it).latin1() ); + odebug << "PPPData::setAccount " << cgroup.latin1() << "" << oendl; + odebug << "iterator " << (*it).latin1() << "" << oendl; if(accname() == aname) { - qDebug("SUCCESS"); + odebug << "SUCCESS" << oendl; return true; } } - qDebug("FAILURE"); + odebug << "FAILURE" << oendl; return false; } /* bool PPPData::setAccountbyIndex(int i) { if(i >= 0 && i <= highcount) { QString tmp; tmp.sprintf("%s%i", ACCOUNT_GRP, i); if (_deleted.find(tmp)!=_deleted.end()) return false; caccount = i; cgroup = tmp; return true; } return false; } */ bool PPPData::isUniqueAccname(const QString &n) { QString save_cgroup = cgroup; for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { cgroup = *it; - qDebug("PPPData::setAccount %s", cgroup.latin1()); - qDebug( "%s \n", (*it).latin1() ); + odebug << "PPPData::setAccount " << cgroup.latin1() << "" << oendl; + odebug << "" << (*it).latin1() << " \n" << oendl; if(accname() == n && cgroup != save_cgroup) { cgroup = save_cgroup; - qDebug("SUCCESS"); + odebug << "SUCCESS" << oendl; return false; } } cgroup = save_cgroup; return true; } bool PPPData::isUniqueDevname(const QString &n) { QString save_mName = _modemName; - qDebug("PPPData::isUniqueDevname checking if %s is unique", n.latin1()); + odebug << "PPPData::isUniqueDevname checking if " << n.latin1() << " is unique" << oendl; for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { _modemName = *it; - qDebug("PPPData::isUniqueDevname %s == %s", n.latin1() , devname().latin1()); + odebug << "PPPData::isUniqueDevname " << n.latin1() << " == " << devname().latin1() << "" << oendl; if(devname() == n && _modemName != save_mName) { _modemName = save_mName; - qDebug("NOT UNIQUE"); + odebug << "NOT UNIQUE" << oendl; return false; } } _modemName = save_mName; return true; } bool PPPData::deleteAccount() { // FIXME: check if this account exists in a config... Config cfg = PPPData::config(); @@ -811,74 +811,74 @@ bool PPPData::deleteAccount() { cfg.clearGroup(); accountList.remove(cgroup); QString key; QStringList keys; for( QMap<QString,QString>::Iterator it = stringEntries.begin(); it != stringEntries.end(); ++it ){ QString val = it.data(); key = it.key(); keys = QStringList::split( "SEPARATOR", key ); if(keys[0]==cgroup){ stringEntries.remove( it ); - qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); + odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl; } } for( QMap<QString,int>::Iterator it = intEntries.begin(); it != intEntries.end(); ++it ){ int val = it.data(); key = it.key(); keys = QStringList::split( "SEPARATOR", key ); if(keys[0]==cgroup){ intEntries.remove( it ); - qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val ); + odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val << "<" << oendl; } } for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); it != listEntries.end(); ++it ){ QStringList val = it.data(); key = it.key(); if(keys[0]==cgroup){ listEntries.remove( it ); sepEntries.remove( key ); - qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() ); + odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.join("").latin1() << "<" << oendl; } } return true; } bool PPPData::deleteAccount(const QString &aname) { if(!setAccount(aname)) return false; deleteAccount(); return true; } int PPPData::newaccount() { - qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); + odebug << "PPPData::newaccount highcount " << highcount << "/" << MAX_ACCOUNTS << "" << oendl; // if(!config) open(); // if (highcount >= MAX_ACCOUNTS) return -1; QString tmp; tmp.sprintf("%s%i", ACCOUNT_GRP, ++highcount); cgroup = QString(tmp); accountList << tmp; - qDebug("PPPData::newaccount() Group: >%s<",cgroup.latin1()); + odebug << "PPPData::newaccount() Group: >" << cgroup.latin1() << "<" << oendl; setpppdArgumentDefaults(); return highcount; } int PPPData::copyaccount(const QString&) { // FIXME: PPPData::copyaccount // if(highcount >= MAX_ACCOUNTS) return -1; // setAccountbyIndex(i); // QMap <QString, QString> map = config->entryMap(cgroup); @@ -956,27 +956,27 @@ void PPPData::setAuthMethod(int value) { const QString PPPData::storedUsername() { return readConfig(cgroup, STORED_USERNAME_KEY, ""); } void PPPData::setStoredUsername(const QString &b) { writeConfig(cgroup, STORED_USERNAME_KEY, b); } const QString PPPData::storedPassword() { - qDebug("getting stored pw"); - qDebug("g %s", cgroup.latin1() ); - qDebug("k %s", STORED_PASSWORD_KEY); + odebug << "getting stored pw" << oendl; + odebug << "g " << cgroup.latin1() << "" << oendl; + odebug << "k " << STORED_PASSWORD_KEY << "" << oendl; return readConfig(cgroup, STORED_PASSWORD_KEY, ""); } void PPPData::setStoredPassword(const QString &b) { writeConfig(cgroup, STORED_PASSWORD_KEY, b); } bool PPPData::storePassword() { return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1); } @@ -1320,28 +1320,28 @@ QMap<QString,QString> PPPData::getConfiguredInterfaces() return ifaces; } void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) { QMap<QString,QString>::Iterator it; int i = 0; Config cfg = config(); for( it = ifaces.begin(); it != ifaces.end(); ++it ){ cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++)); cfg.writeEntry( ACOUNTS_DEV, it.key() ); cfg.writeEntry( ACOUNTS_ACC, it.data() ); - qDebug("I %i",i); + odebug << "I " << i << "" << oendl; } cfg.setGroup( ACCLIST_GRP ); - qDebug("saved %i account settings", i); + odebug << "saved " << i << " account settings" << oendl; cfg.writeEntry( ACCOUNTS_COUNT, i ); } /** * pppd's getword() function knows about escape characters. * If we write the username and password to the secrets file * we'll therefore have to escape back slashes. */ QString PPPData::encodeWord(const QString &s) { QString r = s; r.replace(QRegExp("\\"), "\\\\"); @@ -1363,133 +1363,133 @@ QStringList PPPData::getAccountList() for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { cgroup = *it; list << accname(); } cgroup = save_cgroup; return list; }; const QString PPPData::devname() { QString tmp = readConfig(modemGroup(), MODEMNAME_KEY ); - qDebug("PPPData::devname() of %s is %s", modemGroup().latin1(), tmp.latin1()); + odebug << "PPPData::devname() of " << modemGroup().latin1() << " is " << tmp.latin1() << "" << oendl; return tmp; } void PPPData::setDevname(const QString &n) { // if(!cgroup.isNull()) { // // are we manipulating the default account's name ? then change it, too. // bool def = accname() == defaultAccount(); // writeConfig(cgroup, NAME_KEY, n); // if (def) // setDefaultAccount(n); // } writeConfig(modemGroup(), MODEMNAME_KEY, n ); } bool PPPData::setDevice(const QString &dev ) { - qDebug("setting device to >%s<", dev.latin1()); + odebug << "setting device to >" << dev.latin1() << "<" << oendl; QString save_mName = _modemName; for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { _modemName = *it; - qDebug("PPPData::setDevice %s is named %s", _modemName.latin1(), devname().latin1() ); - qDebug( "iterator %s", (*it).latin1() ); + odebug << "PPPData::setDevice " << _modemName.latin1() << " is named " << devname().latin1() << "" << oendl; + odebug << "iterator " << (*it).latin1() << "" << oendl; if(devname() == dev) { - qDebug("SUCCESS"); + odebug << "SUCCESS" << oendl; return true; } } _modemName = save_mName; - qDebug("FAILURE"); + odebug << "FAILURE" << oendl; return false; } bool PPPData::deleteDevice() { // FIXME: check if this account exists in a config... Config cfg = PPPData::config(); cfg.setGroup(modemGroup()); cfg.clearGroup(); deviceList.remove(modemGroup()); QString key; QStringList keys; for( QMap<QString,QString>::Iterator it = stringEntries.begin(); it != stringEntries.end(); ++it ){ QString val = it.data(); key = it.key(); keys = QStringList::split( "SEPARATOR", key ); if(keys[0]==modemGroup()){ stringEntries.remove( it ); - qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); + odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.latin1() << "<" << oendl; } } for( QMap<QString,int>::Iterator it = intEntries.begin(); it != intEntries.end(); ++it ){ int val = it.data(); key = it.key(); keys = QStringList::split( "SEPARATOR", key ); if(keys[0]==modemGroup()){ intEntries.remove( it ); - qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val ); + odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val << "<" << oendl; } } for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); it != listEntries.end(); ++it ){ QStringList val = it.data(); key = it.key(); if(keys[0]==modemGroup()){ listEntries.remove( it ); sepEntries.remove( key ); - qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() ); + odebug << "deleting >" << keys[0].latin1() << "< key >" << keys[1].latin1() << "< value >" << val.join("").latin1() << "<" << oendl; } } return true; } bool PPPData::deleteDevice(const QString &dev) { if(!setDevice(dev)) return false; return deleteDevice(); } int PPPData::newdevice() { - qDebug("PPPData::newdevice highcount %i",highcountdev); + odebug << "PPPData::newdevice highcount " << highcountdev << "" << oendl; QString tmp; tmp.sprintf("%s%i", MODEM_GRP, ++highcountdev); _modemName = QString(tmp); deviceList << tmp; - qDebug("PPPData::newdevice() Group: >%s<",cgroup.latin1()); + odebug << "PPPData::newdevice() Group: >" << cgroup.latin1() << "<" << oendl; return highcountdev; } int PPPData::copydevice(const QString&) { return false; } QStringList PPPData::getDevicesNamesList() { QStringList list; QString save_mName = _modemName; - qDebug("PPPData::getDevicesNamesList has %s", deviceList.join("---").latin1()); + odebug << "PPPData::getDevicesNamesList has " << deviceList.join("---").latin1() << "" << oendl; for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { _modemName = *it; - qDebug("PPPData::getDevicesNamesList adding %s as %s",_modemName.latin1(), devname().latin1()); + odebug << "PPPData::getDevicesNamesList adding " << _modemName.latin1() << " as " << devname().latin1() << "" << oendl; list << devname(); } _modemName = save_mName; return list; }; diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index a7caffe..2291e8a 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp @@ -51,62 +51,62 @@ namespace * an interface was up while closing the application * we need to be able to shut it down... */ PPPModule::PPPModule() : Module() { InterfaceKeeper inFace; QMap<QString,Connection> running = inFace.interfaces(); QStringList handledInterfaceNames; QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); QMap<QString,QString>::Iterator it; InterfacePPP *iface; - qDebug("getting interfaces"); + odebug << "getting interfaces" << oendl; for( it = ifaces.begin(); it != ifaces.end(); ++it ) { - qDebug("ifaces %s %s", it.key().latin1(), it.data().latin1() ); + odebug << "ifaces " << it.key().latin1() << " " << it.data().latin1() << "" << oendl; iface = new InterfacePPP( 0, it.key() ); iface->setHardwareName( it.data() ); list.append( (Interface*)iface ); // check if (*it) is one of the running ifaces if ( running.contains( it.data() ) ) { - qDebug("iface is running %s", it.key().latin1() ); + odebug << "iface is running " << it.key().latin1() << "" << oendl; handledInterfaceNames << running[it.data()].device; iface->setStatus( true ); iface->setPPPDpid( running[it.data()].pid ); iface->modem()->setPPPDevice( running[it.data()].device ); iface->refresh(); } } setHandledInterfaceNames( handledInterfaceNames ); } /** * Delete any interfaces that we own. */ PPPModule::~PPPModule() { - qDebug("PPPModule::~PPPModule() " ); + odebug << "PPPModule::~PPPModule() " << oendl; QMap<QString,QString> ifaces; InterfaceKeeper keeper; Interface *i; for ( i=list.first(); i != 0; i=list.next() ) { /* if online save the state */ if ( i->getStatus() ) { - qDebug("Iface %s is still up", i->getHardwareName().latin1() ); + odebug << "Iface " << i->getHardwareName().latin1() << " is still up" << oendl; InterfacePPP* ppp = static_cast<InterfacePPP*>(i); keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() ); } ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); delete i; } PPPData::setConfiguredInterfaces( ifaces ); } /** * Change the current profile */ @@ -132,25 +132,25 @@ QString PPPModule::getPixmapName(Interface* ) */ bool PPPModule::isOwner(Interface *i) { return list.find( i ) != -1; } /** * Create, and return the WLANConfigure Module * @return QWidget* pointer to this modules configure. */ QWidget *PPPModule::configure(Interface *i) { - qDebug("return ModemWidget"); + odebug << "return ModemWidget" << oendl; PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, 0, "PPPConfig", false, (Qt::WDestructiveClose | Qt::WStyle_ContextHelp)); return pppconfig; } /** * Create, and return the Information Module * @return QWidget* pointer to this modules info. */ QWidget *PPPModule::information(Interface *i) { @@ -159,25 +159,25 @@ QWidget *PPPModule::information(Interface *i) return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); } /** * Get all active (up or down) interfaces * @return QList<Interface> A list of interfaces that exsist that havn't * been called by isOwner() */ QList<Interface> PPPModule::getInterfaces() { // List all of the files in the peer directory - qDebug("PPPModule::getInterfaces"); + odebug << "PPPModule::getInterfaces" << oendl; return list; } /** * Attempt to add a new interface as defined by name * @param name the name of the type of interface that should be created given * by possibleNewInterfaces(); * @return Interface* NULL if it was unable to be created. */ Interface *PPPModule::addNewInterface(const QString &newInterface) { @@ -252,32 +252,32 @@ namespace QMap<QString, Connection> InterfaceKeeper::interfaces()const { Config cfg("ppp_plugin_keeper"); QMap<QString, Connection> ifaces; QStringList lst = cfg.groupList(); for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { Connection con; cfg.setGroup( (*it) ); con.name = (*it); con.pid = cfg.readNumEntry("pid"); con.device = cfg.readEntry("device"); - qDebug(" %s %s %d", con.name.latin1(), con.device.latin1(), con.pid ); + odebug << " " << con.name.latin1() << " " << con.device.latin1() << " " << con.pid << "" << oendl; if ( con.pid != -1 && isAvailable( con.pid ) ) ifaces.insert( con.name, con ); } return ifaces; } bool InterfaceKeeper::isAvailable( pid_t p)const { if (::kill(p, 0 ) == 0 || errno != ESRCH ) { - qDebug("isAvailable %d", p); + odebug << "isAvailable " << p << "" << oendl; return true; } - qDebug("notAvailable %d", p); + odebug << "notAvailable " << p << "" << oendl; return false; } } diff --git a/noncore/settings/networksettings/wlan/infoimp.cpp b/noncore/settings/networksettings/wlan/infoimp.cpp index bd56678..c558f5e 100644 --- a/noncore/settings/networksettings/wlan/infoimp.cpp +++ b/noncore/settings/networksettings/wlan/infoimp.cpp @@ -4,40 +4,40 @@ #include <qtimer.h> #include <qprogressbar.h> #include <qlabel.h> /** * Constructor. If wireless extensions are enabled on device name then * start a timer that every second will update the information. */ WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ WExtensions *wExtensions = new WExtensions(name); if(!wExtensions->doesHaveWirelessExtensions()){ delete wExtensions; - qDebug("WlanInfoImp::No wireless extension"); + odebug << "WlanInfoImp::No wireless extension" << oendl; return; } delete wExtensions; timer = new QTimer( this ); connect( timer, SIGNAL(timeout()), this, SLOT(update())); timer->start( 1000, false ); } /** * Updates the information about the wireless device. */ void WlanInfoImp::update(){ WExtensions *wExtensions = new WExtensions(this->name()); if(!wExtensions->doesHaveWirelessExtensions()){ - qDebug("No extension"); + odebug << "No extension" << oendl; delete wExtensions; timer->stop(); return; } essidLabel->setText(wExtensions->essid()); apLabel->setText(wExtensions->ap()); stationLabel->setText(wExtensions->station()); modeLabel->setText(wExtensions->mode()); channelLabel->setText(QString("%1").arg(wExtensions->channel())); int signal = 0; int noise = 0; int quality = 0; diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp index d1fff88..9c64323 100644 --- a/noncore/settings/networksettings/wlan/wextensions.cpp +++ b/noncore/settings/networksettings/wlan/wextensions.cpp @@ -103,25 +103,25 @@ int WExtensions::channel(){ // http://www.elanix.com/pdf/an137e.pdf double num = (double( iwr.u.freq.m ) * pow( 10, iwr.u.freq.e ) / 1000000000); double left = 2.401; double right = 2.416; for(int channel = 1; channel<= 15; channel++){ if( num >= left && num <= right ) return channel; left += 0.005; right += 0.005; } - qDebug(QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1()); + odebug << QString("Unknown frequency: %1, returning -1 for the channel.").arg(num).latin1() << oendl; return -1; } /*** * Get the current rate that the card is transmiting at. * @return double the rate, 0 if error. */ double WExtensions::rate(){ if(!hasWirelessExtensions) return 0; if(0 == ioctl(fd, SIOCGIWRATE, &iwr)){ return ((double)iwr.u.bitrate.value)/1000000; @@ -168,33 +168,33 @@ bool WExtensions::stats(int &signal, int &noise, int &quality){ QFile wfile( PROCNETWIRELESS ); if(!wfile.open( IO_ReadOnly )) return false; QTextStream wstream( &wfile ); wstream.readLine(); // skip the first two lines wstream.readLine(); // because they only contain headers while(!wstream.atEnd()){ wstream >> name >> status >> quality >> c >> signal >> c >> noise; if(name == QString("%1:").arg(interface)){ if ( quality > 92 ) - qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); + odebug << "WIFIAPPLET: D'oh! Quality " << quality << " > estimated max!\n" << oendl; if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) - qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); + odebug << "WIFIAPPLET: Doh! Strength " << signal << " > estimated max!\n" << oendl; if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) - qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); - //qDebug(QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1()); + odebug << "WIFIAPPLET: Doh! Noise " << noise << " > estimated max!\n" << oendl; + //odebug << QString("q:%1, s:%2, n:%3").arg(quality).arg(signal).arg(noise).latin1() << oendl; signal = ( ( signal-IW_LOWER ) * 100 ) / IW_UPPER; noise = ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; quality = ( quality*100 ) / 92; return true; } } - qDebug("WExtensions::statsCard no longer present."); + odebug << "WExtensions::statsCard no longer present." << oendl; quality = -1; signal = IW_LOWER; noise = IW_LOWER; return false; } // wextensions.cpp diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 80a9927..fe7941d 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp @@ -36,25 +36,25 @@ WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, W if (file.open(IO_ReadOnly)){ QTextStream stream( &file ); QString line = ""; while ( !stream.eof() ) { line += stream.readLine(); line += "\n"; } file.close(); settingsFileText = QStringList::split("\n", line, true); parseSettingFile(); } else - qDebug(QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1()); + odebug << QString("WLANImp: Can't open file: %1 for reading.").arg(wlanFile).latin1() << oendl; connect(networkType, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); } void WLANImp::typeChanged(int mod){ networkChannel->setEnabled(mod); channelLabel->setEnabled(mod); } /** * Change the profile for both wireless settings and network settings. */ void WLANImp::setProfile(const QString &profile){ @@ -137,25 +137,25 @@ void WLANImp::parseSettingFile(){ } } /** * Saves settings to the wireless.opts file using the current profile */ void WLANImp::changeAndSaveSettingFile(){ QString wlanFile = WIRELESS_OPTS; QFile::remove(wlanFile); QFile file(wlanFile); if (!file.open(IO_ReadWrite)){ - qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); + odebug << QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1() << oendl; return; } QTextStream stream( &file ); bool foundCase = false; bool found = false; bool output = true; for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { QString line = (*it).simplifyWhiteSpace(); if(line.contains("case")) foundCase = true; // See if we found our scheme to write or the sceme couldn't be found @@ -227,19 +227,19 @@ void WLANImp::accept(){ changeAndSaveSettingFile(); // Try to save the interfaces settings. if(!interfaceSetup->saveChanges()) return; OProcess insert; insert << "sh"; insert << "-c"; insert << "cardctl eject && cardctl insert"; if (!insert.start(OProcess::DontCare, OProcess::NoCommunication) ) { - qWarning("could not start cardctl"); + owarn << "could not start cardctl" << oendl; } // Close out the dialog QDialog::accept(); } diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp index eeebe7f..e483efe 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp @@ -43,25 +43,25 @@ * Constructor, read in the wireless.opts file for parsing later. */ using namespace Opie::Net; using namespace Opie::Core; WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { interfaces = new Interfaces(); interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); tabWidget->insertTab(interfaceSetup, "TCP/IP"); // Check sanity - the existance of the wireless-tools if-pre-up script QFile file(QString(PREUP)); if (file.exists()) { - qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); + owarn << QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools") << oendl; } connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) ); netView->setColumnAlignment( col_chn, AlignCenter ); netView->setItemMargin( 3 ); netView->setAllColumnsShowFocus( true ); } WLANImp::~WLANImp() { //FIXME: delete interfaces; @@ -224,25 +224,25 @@ void WLANImp::accept() { // Close out the dialog // FIXME: QDialog::accept(); } void WLANImp::writeOpts() { // eh can't really do anything about it other then return. :-D if(!interfaces->isInterfaceSet()){ QMessageBox::warning(0,"Inface not set","should not happen!!!"); return; } bool error = false; - qDebug("setting wlan interface %s", interfaces->getInterfaceName( error ).latin1() ); + odebug << "setting wlan interface " << interfaces->getInterfaceName( error ).latin1() << "" << oendl; if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!"); interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); if (specifyAp->isChecked()) { interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text()); } else { interfaces->removeInterfaceOption(QString("wireless_ap")); } @@ -298,83 +298,83 @@ void WLANImp::writeOpts() { QDialog::accept(); } /* * Scan for possible wireless networks around... * ... powered by Wellenreiter II technology (C) Michael 'Mickey' Lauer <mickeyl@handhelds.org> */ void WLANImp::rescanNeighbourhood() { QString name = interface->getInterfaceName(); - qDebug( "rescanNeighbourhood via '%s'", (const char*) name ); + odebug << "rescanNeighbourhood via '" << (const char*) name << "'" << oendl; OWirelessNetworkInterface* wiface = static_cast<OWirelessNetworkInterface*>( ONetwork::instance()->interface( name ) ); assert( wiface ); // try to guess device type QString devicetype; QFile m( "/proc/modules" ); if ( m.open( IO_ReadOnly ) ) { QString line; QTextStream modules( &m ); while( !modules.atEnd() && !devicetype ) { modules >> line; if ( line.contains( "cisco" ) ) devicetype = "cisco"; else if ( line.contains( "hostap" ) ) devicetype = "hostap"; else if ( line.contains( "prism" ) ) devicetype = "wlan-ng"; /* puke */ else if ( line.contains( "orinoco" ) ) devicetype = "orinoco"; } } if ( devicetype.isEmpty() ) { - qWarning( "rescanNeighbourhood(): couldn't guess device type :(" ); + owarn << "rescanNeighbourhood(): couldn't guess device type :(" << oendl; return; } else { - qDebug( "rescanNeighbourhood(): device type seems to be '%s'", (const char*) devicetype ); + odebug << "rescanNeighbourhood(): device type seems to be '" << (const char*) devicetype << "'" << oendl; } // configure interface to receive 802.11 management frames wiface->setUp( true ); wiface->setPromiscuousMode( true ); if ( devicetype == "cisco" ) wiface->setMonitoring( new OCiscoMonitoringInterface( wiface, false ) ); else if ( devicetype == "hostap" ) wiface->setMonitoring( new OHostAPMonitoringInterface( wiface, false ) ); else if ( devicetype == "wlan-ng" ) wiface->setMonitoring( new OWlanNGMonitoringInterface( wiface, false ) ); else if ( devicetype == "orinoco" ) wiface->setMonitoring( new OOrinocoMonitoringInterface( wiface, false ) ); else { - qDebug( "rescanNeighbourhood(): unsupported device type for monitoring :(" ); + odebug << "rescanNeighbourhood(): unsupported device type for monitoring :(" << oendl; return; } wiface->setMode( "monitor" ); if ( wiface->mode() != "monitor" ) { - qWarning( "rescanNeighbourhood(): Unable to bring device into monitor mode (%s).", strerror( errno ) ); + owarn << "rescanNeighbourhood(): Unable to bring device into monitor mode (" << strerror( errno ) << ")." << oendl; return; } // open a packet capturer OPacketCapturer* cap = new OPacketCapturer(); cap->open( name ); if ( !cap->isOpen() ) { - qWarning( "rescanNeighbourhood(): Unable to open libpcap (%s).", strerror( errno ) ); + owarn << "rescanNeighbourhood(): Unable to open libpcap (" << strerror( errno ) << ")." << oendl; return; } // display splash screen QFrame* splash = new QFrame( this, "splash", false, WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_Customize ); splash->setLineWidth( 2 ); splash->setFrameStyle( QFrame::Panel | QFrame::Raised ); QVBoxLayout* vbox = new QVBoxLayout( splash, 4, 4 ); QLabel* lab = new QLabel( "<center><b>Scanning...</b><br>Please Wait...</center>", splash ); QProgressBar* pb = new QProgressBar( wiface->channels(), splash ); vbox->addWidget( lab ); vbox->addWidget( pb ); @@ -389,33 +389,33 @@ void WLANImp::rescanNeighbourhood() splash->show(); splash->raise(); qApp->processEvents(); // set capturer to non-blocking mode cap->setBlocking( false ); for ( int i = 1; i <= wiface->channels(); ++i ) { wiface->setChannel( i ); pb->setProgress( i ); qApp->processEvents(); - qDebug( "rescanNeighbourhood(): listening on channel %d...", i ); + odebug << "rescanNeighbourhood(): listening on channel " << i << "..." << oendl; OPacket* p = cap->next( 1000 ); if ( !p ) { - qDebug( "rescanNeighbourhood(): nothing received on channel %d", i ); + odebug << "rescanNeighbourhood(): nothing received on channel " << i << "" << oendl; } else { - qDebug( "rescanNeighbourhood(): TADAA - something came in on channel %d", i ); + odebug << "rescanNeighbourhood(): TADAA - something came in on channel " << i << "" << oendl; handlePacket( p ); } } cap->close(); wiface->setMode( "managed" ); // TODO: use previous mode wiface->setPromiscuousMode( false ); splash->hide(); delete splash; } @@ -430,25 +430,25 @@ void WLANImp::handlePacket( OPacket* p ) QString type; if ( beacon->canIBSS() ) { type = "adhoc"; } else if ( beacon->canESS() ) { type = "managed"; } else { - qWarning( "handlePacket(): invalid frame [possibly noise] detected!" ); + owarn << "handlePacket(): invalid frame [possibly noise] detected!" << oendl; return; } OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); QString essid = ssid ? ssid->ID() : QString("<unknown>"); OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); int channel = ds ? ds->channel() : -1; OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); displayFoundNetwork( type, channel, essid, header->macAddress2() ); } } diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index 74d7f8e..886af10 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp @@ -113,71 +113,71 @@ Interface *WLANModule::addNewInterface(const QString &){ /** * Attempts to remove the interface, doesn't delete i * @return bool true if successful, false otherwise. */ bool WLANModule::remove(Interface*){ // Can't remove a hardware device, you can stop it though. return false; } void WLANModule::receive(const QCString ¶m, const QByteArray &arg) { - qDebug("WLANModule::receive "+param); + odebug << "WLANModule::receive "+param << oendl; QStringList params = QStringList::split(",",param); int count = params.count(); - qDebug("WLANModule got %i params", count ); + odebug << "WLANModule got " << count << " params" << oendl; if (count < 2){ - qDebug("Erorr less than 2 parameter"); - qDebug("RETURNING"); + odebug << "Erorr less than 2 parameter" << oendl; + odebug << "RETURNING" << oendl; return; } QDataStream stream(arg,IO_ReadOnly); QString interface; QString action; int countMsgs = 0; stream >> interface; - qDebug("got count? >%s<",interface.latin1()); + odebug << "got count? >" << interface.latin1() << "<" << oendl; if (interface == "count"){ - qDebug("got count"); + odebug << "got count" << oendl; stream >> action; - qDebug("Got count num >%s<", action.latin1()); + odebug << "Got count num >" << action.latin1() << "<" << oendl; countMsgs = action.toInt(); } QDialog *toShow; //while (! stream.atEnd() ){ for (int i = 0; i < countMsgs; i++){ - qDebug("start stream %d/%d",i,countMsgs); + odebug << "start stream " << i << "/" << countMsgs << "" << oendl; if (stream.atEnd()){ - qDebug("end of stream"); + odebug << "end of stream" << oendl; return; } stream >> interface; - qDebug("got iface"); + odebug << "got iface" << oendl; stream >> action; - qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1()); + odebug << "WLANModule got interface " << interface.latin1() << " and acion " << action.latin1() << "" << oendl; // find interfaces Interface *ifa=0; for ( Interface *i=list.first(); i != 0; i=list.next() ){ if (i->getInterfaceName() == interface){ - qDebug("WLANModule found interface %s",interface.latin1()); + odebug << "WLANModule found interface " << interface.latin1() << "" << oendl; ifa = i; } } if (ifa == 0){ - qDebug("WLANModule Did not find %s",interface.latin1()); - qDebug("skipping"); + odebug << "WLANModule Did not find " << interface.latin1() << "" << oendl; + odebug << "skipping" << oendl; count = 0; } if (count == 2){ // those should call the interface directly QWidget *info = getInfo( ifa ); QPEApplication::showWidget( info ); if ( action.contains("start" ) ){ ifa->start(); } else if ( action.contains("restart" ) ){ ifa->restart(); @@ -186,70 +186,70 @@ void WLANModule::receive(const QCString ¶m, const QByteArray &arg) }else if ( action.contains("refresh" ) ){ ifa->refresh(); } }else if (count == 3){ QString value; if (!wlanconfigWiget){ //FIXME: what if it got closed meanwhile? wlanconfigWiget = (WLANImp*) configure(ifa); toShow = (QDialog*) wlanconfigWiget; } QPEApplication::showWidget( wlanconfigWiget ); stream >> value; - qDebug("WLANModule (build 4) is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); + odebug << "WLANModule (build 4) is setting " << action.latin1() << " of " << interface.latin1() << " to " << value.latin1() << "" << oendl; if (value.isEmpty()){ - qDebug("value is empty!!!\nreturning"); + odebug << "value is empty!!!\nreturning" << oendl; return; } if ( action.contains("ESSID") ){ QComboBox *combo = wlanconfigWiget->essid; bool found = false; for ( int i = 0; i < combo->count(); i++) if ( combo->text( i ) == value ){ combo->setCurrentItem( i ); found = true; } if (!found) combo->insertItem( value, 0 ); }else if ( action.contains("Mode") ){ QComboBox *combo = wlanconfigWiget->mode; for ( int i = 0; i < combo->count(); i++) if ( combo->text( i ) == value ){ combo->setCurrentItem( i ); } }else if (action.contains("Channel")){ bool ok; - qDebug("converting channel"); + odebug << "converting channel" << oendl; int chan = value.toInt( &ok ); if (ok){ - qDebug("ok setting channel"); + odebug << "ok setting channel" << oendl; wlanconfigWiget->specifyChan->setChecked( true ); wlanconfigWiget->networkChannel->setValue( chan ); } }else if (action.contains("MacAddr")){ wlanconfigWiget->specifyAp->setChecked( true ); wlanconfigWiget->macEdit->setText( value ); }else - qDebug("wlan plugin has no clue"); + odebug << "wlan plugin has no clue" << oendl; } - qDebug("next stream"); + odebug << "next stream" << oendl; }// while stream - qDebug("end of stream"); + odebug << "end of stream" << oendl; if (toShow) toShow->exec(); - qDebug("returning"); + odebug << "returning" << oendl; } QWidget *WLANModule::getInfo( Interface *i) { - qDebug("WLANModule::getInfo start"); + odebug << "WLANModule::getInfo start" << oendl; WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); info->tabWidget->insertTab(information, "TCP/IP", 0); info->tabWidget->setCurrentPage( 0 ); info->tabWidget->showPage( information ); - if (info->tabWidget->currentPage() == information ) qDebug("infotab OK"); - else qDebug("infotab NOT OK"); - qDebug("current idx %d", info->tabWidget->currentPageIndex()); - qDebug("WLANModule::getInfo return"); + if (info->tabWidget->currentPage() == information ) odebug << "infotab OK" << oendl; + else odebug << "infotab NOT OK" << oendl; + odebug << "current idx " << info->tabWidget->currentPageIndex() << "" << oendl; + odebug << "WLANModule::getInfo return" << oendl; return info; } diff --git a/noncore/settings/sound/sound.pro b/noncore/settings/sound/sound.pro index a3804c3..58e94f3 100644 --- a/noncore/settings/sound/sound.pro +++ b/noncore/settings/sound/sound.pro @@ -1,10 +1,9 @@ -CONFIG += qt warn_on quick-app -HEADERS = soundsettings.h soundsettingsbase.h -SOURCES = soundsettings.cpp soundsettingsbase.cpp main.cpp -#INTERFACES = soundsettingsbase.ui +CONFIG += qt warn_on quick-app +HEADERS = soundsettings.h soundsettingsbase.h +SOURCES = soundsettings.cpp soundsettingsbase.cpp main.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopiecore2 -TARGET = sound +LIBS += -lqpe -lopiecore2 +TARGET = sound include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index 8ad0a3f..d55a751 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp @@ -12,38 +12,42 @@ ** 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. ** **********************************************************************/ // parts copyright 2002 L.J. Potter #include "soundsettings.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/storage.h> +using namespace Opie::Core; +/* QT */ #include <qcheckbox.h> #include <qcombobox.h> #include <qlabel.h> +/* STD */ #include <sys/utsname.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> -#include <stdio.h> #include <sys/stat.h> SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) : SoundSettingsBase( parent, objname, TRUE, fl ) { keyReset=FALSE; noWarning=false; Config config( "qpe"); config.setGroup( "Volume" ); Config cfg("Vmemo"); connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); @@ -64,37 +68,37 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); //TODO hide if zaurus- mono only #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) //since ipaq and zaurus have particular //devices bool systemZaurus=FALSE; struct utsname name; /* check for embedix kernel running on the zaurus*/ if (uname(&name) != -1) {// TODO change this here,... QString release=name.release; if( release.find("embedix",0,TRUE) != -1) { - qDebug("IS System Zaurus"); + odebug << "IS System Zaurus" << oendl; systemZaurus=TRUE; } } if(!systemZaurus) { stereoCheckBox->setChecked(TRUE); } stereoCheckBox->setEnabled(FALSE); sixteenBitCheckBox->setEnabled(FALSE); #else #endif int sRate=cfg.readNumEntry("SizeLimit", 30); - qDebug("%d",sRate); + odebug << "" << sRate << "" << oendl; if(sRate ==30) timeLimitComboBox->setCurrentItem(0); else if(sRate==20) timeLimitComboBox->setCurrentItem(1); else if(sRate == 15) timeLimitComboBox->setCurrentItem(2); else if(sRate == 10) timeLimitComboBox->setCurrentItem(3); else if(sRate == 5) timeLimitComboBox->setCurrentItem(4); else @@ -134,42 +138,42 @@ void SoundSettings::updateStorageCombo() { int set=0; StorageInfo storageInfo; QString sName, sPath; QStringList list; list << "Documents : "+QPEApplication::documentDir(); list << "tmp : /tmp"; const QList<FileSystem> &fs = storageInfo.fileSystems(); QListIterator<FileSystem> it ( fs ); for( ; it.current(); ++it ){ const QString name = (*it)->name(); const QString path = (*it)->path(); - qDebug("storage name "+name +" storage path is "+path); + odebug << "storage name "+name +" storage path is "+path << oendl; list << name + ": " +path; if( loc.find( path,0,TRUE) != -1) set = i; // if(dit.current()->file().find(path) != -1 ) storage=name; i++; } LocationComboBox->insertStringList(list); - qDebug("set item %d", set); + odebug << "set item " << set << "" << oendl; LocationComboBox->setCurrentItem(set); } void SoundSettings::setLocation(const QString & string) { Config config( "Vmemo" ); config.setGroup( "System" ); config.writeEntry("RecLocation",string); - qDebug("set location "+string); + odebug << "set location "+string << oendl; config.write(); } void SoundSettings::cleanUp() { Config cfg("Vmemo"); cfg.writeEntry("Alert",AlertCheckBox->isChecked()); cfg.setGroup("Record"); cfg.writeEntry("SampleRate",sampleRate->currentText()); cfg.writeEntry("Stereo",stereoCheckBox->isChecked()); cfg.writeEntry("SixteenBit",sixteenBitCheckBox->isChecked()); if(keyReset && noWarning) { diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp index 96bcdfc..4163fb2 100644 --- a/noncore/settings/sysinfo/benchmarkinfo.cpp +++ b/noncore/settings/sysinfo/benchmarkinfo.cpp @@ -10,31 +10,34 @@ ** 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. ** **********************************************************************/ #include "benchmarkinfo.h" /* OPIE */ +#include <opie2/odebug.h> #include <opie2/ostorageinfo.h> #include <opie2/olistview.h> #include <qpe/qpeapplication.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpedecoration_qws.h> #include <qpe/resource.h> #include <qpe/config.h> +using namespace Opie::Core; +using namespace Opie::Ui; /* QT */ #include <qclipboard.h> #include <qcolor.h> #include <qcombobox.h> #include <qdirectpainter_qws.h> #include <qfile.h> #include <qtextstream.h> #include <qfiledialog.h> #include <qlabel.h> #include <qlayout.h> #include <qpainter.h> @@ -42,28 +45,25 @@ #include <qtimer.h> #include <qwhatsthis.h> /* STD */ #include <time.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #if defined (__GNUC__) && (__GNUC__ < 3) #define round qRound #endif -using namespace Opie::Ui; -using namespace Opie::Core; extern "C" - { void BenchFFT( void ); double dhry_main( int ); } #define DHRYSTONE_RUNS 20000000 #define TEST_DURATION 3 #define BUFF_SIZE 8192 #define FILE_SIZE 1024 * 1024 // 1Mb //=========================================================================== @@ -139,50 +139,50 @@ BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) vb->addWidget( tests, 2 ); QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" ); if ( f.open( IO_ReadOnly ) ) { machineCombo = new QComboBox( this ); QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) ); QTextStream ts( &f ); while( !ts.eof() ) { QString machline = ts.readLine(); - qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline ); + odebug << "sysinfo: parsing benchmark results for '" << (const char*) machline << "'" << oendl; QString resline = ts.readLine(); machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); machineCombo->insertItem( machline ); } QHBoxLayout* hb = new QHBoxLayout( vb ); hb->addWidget( new QLabel( tr( "Compare To:" ), this ) ); hb->addWidget( machineCombo, 2 ); connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) ); } vb->addWidget( startButton, 2 ); } BenchmarkInfo::~BenchmarkInfo() {} void BenchmarkInfo::machineActivated( int index ) { QStringList* results = machines[ machineCombo->text( index ) ]; if ( !results ) { - qDebug( "sysinfo: no results available." ); + odebug << "sysinfo: no results available." << oendl; return; } QStringList::Iterator it = results->begin(); test_alu->setText( 2, *(it++) ); test_fpu->setText( 2, *(it++) ); test_txt->setText( 2, *(it++) ); test_gfx->setText( 2, *(it++) ); test_ram->setText( 2, *(it++) ); test_sd->setText( 2, *(it++) ); test_cf->setText( 2, *(it++) ); } diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp index 15aeaf5..4274203 100644 --- a/noncore/settings/tabmanager/tabmanager.cpp +++ b/noncore/settings/tabmanager/tabmanager.cpp @@ -54,25 +54,25 @@ TabManager::~TabManager(){ e << link; } } /** * Scans root directory for any tabs or applications. Will recursivly go down, * but will not follow symlinks. * @param directory - the directory to look in. * @param parent - the parent to place any new tabs or apps into. If parent is * NULL then the item is a tab and should be placed as a child of the window. */ void TabManager::rescanFolder(QString directory, QListViewItem* parent){ - //qDebug(QString("rescanFolder: ") + directory.latin1()); + //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; QDir d; d.setPath(directory); // Show hidden files for .directories d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); const QFileInfoList *list = d.entryInfoList(); QFileInfoListIterator it( *list ); // create list iterator QFileInfo *fi; // pointer for traversing while ( (fi=it.current()) ) { // for each file... // If it is a dir and not .. or . then add it as a tab and go down. @@ -198,25 +198,25 @@ void TabManager::removeItem(){ if(item->parent() == NULL){ // Remove .directory file string location = location.mid(0,location.length()-10); QDir dir; if(!dir.rmdir(location)) removeSuccessful = false; else removeSuccessful = true; } // If removing failed. if(!removeSuccessful){ - qDebug((QString("removeItem: ") + location).latin1()); + odebug << (QString("removeItem: ") + location).latin1() << oendl; QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); return; } // Remove from the installer so it wont fail. // Don't need to do this sense the current install uses rm -f so no error // Remove from the gui list. itemList.remove(item); if(item->parent()) item->parent()->takeItem(item); delete item; @@ -235,25 +235,25 @@ void TabManager::editCurrentItem(){ /** * Edit the item that is passed in. * Show application dialog and if anything changed * @param item the item to edit. */ void TabManager::editItem( QListViewItem * item){ if(!item) return; TabAppLnk app(itemList[item]); if(!app.isValid()){ - qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1()); + odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl; return; } // Fill with all of the icons if(!application){ Wait waitDialog(this, "Wait dialog"); waitDialog.waitLabel->setText(tr("Gathering icons...")); waitDialog.show(); qApp->processEvents(); application = new AppEdit(this, "Application edit", true); QDir d(QPEApplication::qpeDir() + "/pics/"); @@ -264,25 +264,25 @@ void TabManager::editItem( QListViewItem * item){ QFileInfo *fi; // pointer for traversing while ( (fi=it.current()) ) { // for each file... QString fileName = fi->fileName(); if(fileName.right(4) == ".png"){ fileName = fileName.mid(0,fileName.length()-4); QPixmap imageOfFile(Resource::loadPixmap(fileName)); QImage foo = imageOfFile.convertToImage(); foo = foo.smoothScale(16,16); imageOfFile.convertFromImage(foo); application->iconLineEdit->insertItem(imageOfFile,fileName); } - //qDebug(fi->fileName().latin1()); + //odebug << fi->fileName().latin1() << oendl; ++it; } waitDialog.hide(); } int pixmap = -1; QString pixmapText = app.pixmapString(); QComboBox *f = application->iconLineEdit; for(int i = 0; i < application->iconLineEdit->count(); i++){ if(f->text(i) == pixmapText){ pixmap = i; break; } @@ -393,38 +393,38 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ QString desktopFile = itemList[item]; slash = desktopFile.findRev('/', -1); desktopFile = desktopFile.mid(slash, desktopFile.length()); newFolder = newFolder + desktopFile; // Move file QDir r; if(!r.rename(itemList[item], newFolder)){ QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") ); return; } - //qDebug((QString("moveApplication: ") + itemList[item]).latin1()); - //qDebug((QString("moveApplication: ") + newFolder).latin1()); + //odebug << (QString("moveApplication: ") + itemList[item]).latin1() << oendl; + //odebug << (QString("moveApplication: ") + newFolder).latin1() << oendl; // Move in the gui item->parent()->takeItem(item); newGroup->insertItem(item); newGroup->setOpen(true); // Move file in the installer QString installedAppFile; if(findInstalledApplication(desktopFile, installedAppFile)) swapInstalledLocation(installedAppFile, desktopFile, newFolder); else - qDebug("moveApplication: No installed app found for dekstop file"); + odebug << "moveApplication: No installed app found for dekstop file" << oendl; // Move application type AppLnk app(newFolder); app.setType(folderName); app.writeLink(); // Move in our internal list itemList.remove(item); itemList.insert(item, newFolder); // We have changed something. changed = true; @@ -455,54 +455,54 @@ bool TabManager::findInstalledApplication(QString desktopFile, QString &installe QString line; while ( !stream.eof() ) { // until end of file... line = stream.readLine(); // line of text excluding '\n' if(line.contains(desktopFile)){ installedAppFile = QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName(); file.close(); return true; } } file.close(); } else - qDebug((QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1()); + odebug << (QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1() << oendl; ++it; // goto next list element } return false; } /** * Open a file and replace a file containing the old desktop file with the new. * @param installedAppFile application installed list * @param desktopFile old .desktop file * @param newLocation new .desktop file */ void TabManager::swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation ){ QFile file(installedAppFile); if ( !file.open(IO_ReadOnly) ){ - qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1()); + odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; return; } QTextStream stream( &file ); // use a text stream QString allLines; while ( !stream.eof() ) { // until end of file... QString line = stream.readLine(); // line of text excluding '\n' if(line.contains(desktopFile)) allLines += newLocation; else allLines += line; allLines += '\n'; } file.close(); if ( !file.open(IO_ReadWrite) ){ - qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1()); + odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; return; } QTextStream streamOut( &file ); streamOut << allLines; file.close(); } // tabmanager.cpp diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp index 5854fe0..3616507 100644 --- a/noncore/settings/usermanager/userdialog.cpp +++ b/noncore/settings/usermanager/userdialog.cpp @@ -2,48 +2,46 @@ * * * 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 "userdialog.h" #include "passwd.h" /* OPIE */ +#include <opie2/odebug.h> #include <opie2/odevice.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; +using namespace Opie::Ui; /* QT */ #include <qlayout.h> #include <qlabel.h> #include <qmessagebox.h> #include <qfile.h> /* STD */ #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <signal.h> - -using namespace Opie::Core; - - /** * UserDialog constructor. Setup the dialog, fill the groupComboBox & groupsListView with all groups. * */ -using namespace Opie::Ui; UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog(parent, name, modal, fl) { vm=viewmode; QVBoxLayout *layout = new QVBoxLayout(this); myTabWidget=new QTabWidget(this,"User Tab Widget"); layout->addWidget(myTabWidget); setupTab1(); setupTab2(); accounts->groupStringList.sort(); // And also fill the listview & the combobox with all available groups. for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) @@ -236,25 +234,25 @@ bool UserDialog::addUser(int uid, int gid) if (temp->text()=="power") temp->setOn(true); if (temp->text()=="input") temp->setOn(true); if (temp->text()=="sharp") temp->setOn(true); if (temp->text()=="tty") temp->setOn(true); } } // Show the dialog! if(!(adduserDialog->exec())) return false; if((adduserDialog->groupComboBox->currentItem()!=0)) { accounts->findGroup(adduserDialog->groupComboBox->currentText()); adduserDialog->groupID=accounts->gr_gid; - qWarning(QString::number(accounts->gr_gid)); + owarn << QString::number(accounts->gr_gid) << oendl; } if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(), adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(), QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) { QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user."); return false; } // Add User to additional groups. QListViewItemIterator it( adduserDialog->groupsListView ); for ( ; it.current(); ++it ) @@ -365,40 +363,40 @@ bool UserDialog::editUser(const char *username) { edituserDialog->groupComboBox->insertItem("<Undefined group>",0); edituserDialog->groupComboBox->setCurrentItem(0); } // Select the groups in the listview, to which the user belongs. QCheckListItem *temp; // BAH!!! QRegExp in qt2 sucks... or maybe I do... can't figure out how to check for EITHER end of input ($) OR a comma, so here we do two different QRegExps instead. QRegExp userRegExp(QString("[:,]%1$").arg(username)); // The end of line variant. QStringList tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) { // Iterate over all of them. - qWarning(*it); + owarn << *it << oendl; QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. for ( ; lvit.current(); ++lvit ) { if(lvit.current()->text(0)==(*it).left((*it).find(":"))) { temp=(QCheckListItem*)lvit.current(); temp->setOn(true); // If we find a line with that groupname, select it.; } } } userRegExp=QRegExp(QString("[:,]%1,").arg(username)); // And the other one. (not end of line.) tempList=accounts->groupStringList.grep(userRegExp); // Find all entries in the group database, that the user is a member of. for(QStringList::Iterator it=tempList.begin(); it!=tempList.end(); ++it) { // Iterate over all of them. - qWarning(*it); + owarn << *it << oendl; QListViewItemIterator lvit( edituserDialog->groupsListView ); // Compare to all groups. for ( ; lvit.current(); ++lvit ) { if(lvit.current()->text(0)==(*it).left((*it).find(":"))) { temp=(QCheckListItem*)lvit.current(); temp->setOn(true); // If we find a line with that groupname, select it.; } } } if(!(edituserDialog->exec())) return false; // SHOW THE DIALOG! diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp index a1130d4..1d345ee 100644 --- a/noncore/settings/usermanager/usermanager.cpp +++ b/noncore/settings/usermanager/usermanager.cpp @@ -1,29 +1,32 @@ /*************************************************************************** * * * 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 "usermanager.h" -#include <qlayout.h> +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/resource.h> +using namespace Opie::Core; +/* QT */ +#include <qlayout.h> #include <qmessagebox.h> #include <qfile.h> -#include <qpe/resource.h> - #include <qregexp.h> /** * The mainwindow constructor. * * @param QWidget *parent * @param const char *name * @ param WFlags fl * */ UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { setCaption(tr("Opie User Manager")); @@ -244,14 +247,14 @@ void UserConfig::delGroup() { groupname=groupsListView->currentItem()->text(1); // Get the groupname from the listview. if(QMessageBox::warning(this,"Delete group","Are you sure you want to\ndelete the group \""+QString(groupname)+"\" ?","&No","&Yes",0,0,1)) { // If confirmed, try to delete the group. if(GroupDialog::delGroup(groupname)) getGroups(); // And also update the view afterwards if the user was deleted. } } else { QMessageBox::information(this,"No selection","No group has been selected."); } } void UserConfig::showUserMenu(QListViewItem *item) { // userPopupMenu.exec(item->mapToGlobal(QPoint(0,0))); - qWarning("Pressed!"); + owarn << "Pressed!" << oendl; } diff --git a/noncore/settings/usermanager/usermanager.pro b/noncore/settings/usermanager/usermanager.pro index d0647dd..31f52a6 100644 --- a/noncore/settings/usermanager/usermanager.pro +++ b/noncore/settings/usermanager/usermanager.pro @@ -1,10 +1,9 @@ -#CONFIG = qt warn_on -CONFIG = qt warn_on quick-app +CONFIG = qt warn_on quick-app HEADERS = usermanager.h userdialog.h groupdialog.h passwd.h SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.cpp main.cpp INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopiecore2 -lopieui2 -lcrypt -TARGET = usermanager +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe -lopiecore2 -lopieui2 -lcrypt +TARGET = usermanager include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/styles/liquid/config.in b/noncore/styles/liquid/config.in index 23f8637..cffdb39 100644 --- a/noncore/styles/liquid/config.in +++ b/noncore/styles/liquid/config.in @@ -1,4 +1,4 @@ config LIQUID boolean "opie-liquid (Mosfet's well known Liquid GUI style from KDE)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBQTAUX + depends ( LIBQPE || LIBQPE-X11 ) && LIBQTAUX && LIBOPIE2CORE diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index bac882c..51814e7 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp @@ -2,55 +2,60 @@ * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. */ // // (c) 2002 Robert 'sandman' Griebl // #ifndef INCLUDE_MENUITEM_DEF #define INCLUDE_MENUITEM_DEF #endif -#include <qmenudata.h> #include "liquid.h" -//#include "liquiddeco.h" -#include <qapplication.h> +#include "effects.h" +#include "htmlmasks.h" +#include "embeddata.h" + +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/config.h> -#include "effects.h" +using namespace Opie::Core; + +/* QT */ +#include <qmenudata.h> +#include <qapplication.h> #include <qpalette.h> #include <qbitmap.h> #include <qtabbar.h> #include <qpopupmenu.h> #include <qobjectlist.h> #include <qimage.h> #include <qtimer.h> #include <qpixmapcache.h> #include <qradiobutton.h> #include <qcombobox.h> #include <qdrawutil.h> #include <qwidgetlist.h> #include <qtoolbutton.h> #include <qheader.h> -#include <unistd.h> #include <qmenubar.h> #include <qprogressbar.h> #include <qlineedit.h> #include <qlistbox.h> +/* STD */ +#include <unistd.h> #include <stdio.h> -#include "htmlmasks.h" -#include "embeddata.h" - typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) { QImage img(pix.convertToImage()); QImageEffect::fade(img, 0.9, color); int x, y; int r, g, b; @@ -140,25 +145,25 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { QWidget *wid = (QWidget *) it.current ( ); wid-> setBackgroundPixmap(*pix); wid-> setBackgroundOrigin(QWidget::ParentOrigin); } delete ol; } } else if(ev->type() == QEvent::Hide){ if(type == TransStippleBg || type == TransStippleBtn || type == Custom){ -// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); +// owarn << "Deleting menu pixmap, width " << pixDict.find(p->winId())->width() << "" << oendl; pixDict.remove(p->winId()); if ( !p->inherits("QPopupMenu")) p->setBackgroundMode(QWidget::PaletteBackground); QObjectList *ol = p-> queryList("QWidget"); for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { QWidget *wid = (QWidget *) it.current ( ); wid-> setBackgroundMode( QWidget::PaletteBackground ); } delete ol; @@ -485,25 +490,25 @@ void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, } QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, bool blend) { QImage img(qembed_findImage(label)); img.detach(); if(img.isNull()){ // shouldn't happen, been tested - qWarning("Invalid embedded label %s", label); + owarn << "Invalid embedded label " << label << "" << oendl; return(NULL); } if(img.depth() != 32) img = img.convertDepth(32); unsigned int *data = (unsigned int *)img.bits(); int total = img.width()*img.height(); int current; QColor c; int oldH, oldS, oldV; int alpha; if(v < 235) v += 20; @@ -851,25 +856,25 @@ void LiquidStyle::polish(QWidget *w) } w-> installEventFilter ( this ); } if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); } if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ return; } if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> palette().active().brush(QColorGroup::Background).pixmap()){ - qWarning("No parent pixmap for child widget %s", w->className()); + owarn << "No parent pixmap for child widget " << w->className() << "" << oendl; return; } if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { if(w->backgroundMode() == QWidget::PaletteBackground || w->backgroundMode() == QWidget::PaletteButton){ w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); w->setBackgroundOrigin(QWidget::ParentOrigin); // w->setBackgroundMode(QWidget::NoBackground); } } if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) diff --git a/noncore/styles/liquid/liquid.pro b/noncore/styles/liquid/liquid.pro index 7fe2829..767007f 100644 --- a/noncore/styles/liquid/liquid.pro +++ b/noncore/styles/liquid/liquid.pro @@ -1,19 +1,19 @@ TEMPLATE = lib -CONFIG = qt plugin embedded warn_on +CONFIG = qt plugin embedded warn_on SOURCES = liquid.cpp \ effects.cpp \ liquidset.cpp \ plugin.cpp HEADERS = liquid.h \ effects.h \ liquidset.h \ plugin.h -LIBS += -lqpe -lqtaux2 +LIBS += -lqpe -lqtaux2 -lopiecore2 INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/plugins/styles TARGET = liquid -VERSION = 1.0.0 +VERSION = 1.0.1 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/styles/theme/othemebase.cpp b/noncore/styles/theme/othemebase.cpp index 62b3a11..7ce4e5a 100644 --- a/noncore/styles/theme/othemebase.cpp +++ b/noncore/styles/theme/othemebase.cpp @@ -6,42 +6,44 @@ License version 2 as published by the Free Software Foundation. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #include "othemebase.h" #include "ogfxeffect.h" + +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> -//#include <kdebug.h> -//#include <klocale.h> -#include <qpe/config.h> -//#include <kglobal.h> -//#include <kglobalsettings.h> -//#include <kstddirs.h> +#include <qpe/config.h> +using namespace Opie::Core; + +/* QT */ #include <qfile.h> #include <qtextstream.h> #include <qdir.h> #include <qpainter.h> #include <qbitmap.h> -#include <stdlib.h> #include <qstringlist.h> -#include <stdio.h> +/* STD */ +#include <stdlib.h> template class QIntCache<OThemePixmap> ; static const char *widgetEntries[] = { // unsunken widgets (see header) "PushButton", "ComboBox", "HSBarSlider", "VSBarSlider", "Bevel", "ToolButton", "ScrollButton", "HScrollDeco", "VScrollDeco", "ComboDeco", "MenuItem", "Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", // sunken widgets "PushButtonDown", "ComboBoxDown", "HSBarSliderDown", "VSBarSliderDown", @@ -253,58 +255,51 @@ void OThemeBase::readConfig( Qt::GUIStyle /*style*/ ) QString pixnames[ WIDGETS ]; // used for duplicate check QString brdnames[ WIDGETS ]; bool loaded[ WIDGETS ]; // used for preloading for CopyWidget if ( configFileName.isEmpty() ) { Config cfg ( "qpe" ); cfg. setGroup ( "Appearance" ); configFileName = cfg. readEntry ( "Theme", "default" ); } Config config( configFilePath + "/themes/" + configFileName + ".themerc" , Config::File ); -// printf ( "Opened config file: %s\n", ( configFilePath + "/themes/" + configFileName + ".themerc" ). ascii()); - // Are we initalized? applyMiscResourceGroup( &config ); for ( i = 0; i < INHERIT_ITEMS; ++i ) { applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); -// printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() ); } for ( ; i < INHERIT_ITEMS*2; ++i ) { if ( config.hasGroup( QString( widgetEntries[ i ] ) ) ) { applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); -// printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() ); } else { copyfrom [ i ] = widgetEntries[ i - INHERIT_ITEMS ]; -// printf ( "%d [%s]: copy=%s\n", i, widgetEntries [i], copyfrom [i].latin1()); } } for ( ; i < WIDGETS; ++i ) { applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); -// printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() ); } // initalize defaults that may not be read for ( i = 0; i < WIDGETS; ++i ) loaded[ i ] = false; btnXShift = btnYShift = focus3DOffset = 0; aTabLine = iTabLine = true; roundedButton = roundedCombo = roundedSlider = focus3D = false; splitterWidth = 10; for ( i = 0; i < WIDGETS; ++i ) { readResourceGroup( i, copyfrom, pixnames, brdnames, loaded ); -// printf ( "%d [%s]: copy=%s, pix=%s, brd=%s, colors=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1(), (colors[i]?colors[i]->background().name().latin1():"<none)" )); } // misc items readMiscResourceGroup(); // Handle preblend items for ( i = 0; i < PREBLEND_ITEMS; ++i ) { if ( pixmaps[ preBlend[ i ] ] != NULL && blends[ preBlend[ i ] ] != 0.0 ) blend( preBlend[ i ] ); } } @@ -398,25 +393,25 @@ OThemePixmap* OThemeBase::loadPixmap( QString &name ) OThemePixmap* OThemeBase::scale( int w, int h, WidgetType widget ) { if ( scaleHints[ widget ] == FullScale ) { if ( !pixmaps[ widget ] || pixmaps[ widget ] ->width() != w || pixmaps[ widget ] ->height() != h ) { OThemePixmap * cachePix = cache->pixmap( w, h, widget ); if ( cachePix ) { cachePix = new OThemePixmap( *cachePix ); if ( pixmaps[ widget ] ) cache->insert( pixmaps[ widget ], OThemeCache::FullScale, widget ); else - qDebug( "We would have inserted a null pixmap!\n" ); + odebug << "We would have inserted a null pixmap!\n" << oendl; pixmaps[ widget ] = cachePix; } else { cache->insert( pixmaps[ widget ], OThemeCache::FullScale, widget ); QImage tmpImg = images[ widget ] ->smoothScale( w, h ); pixmaps[ widget ] = new OThemePixmap; pixmaps[ widget ] ->convertFromImage( tmpImg ); if ( blends[ widget ] != 0.0 ) blend( widget ); } } } diff --git a/noncore/todayplugins/fortune/fortune.pro b/noncore/todayplugins/fortune/fortune.pro index 2e4b4b3..74c60b1 100644 --- a/noncore/todayplugins/fortune/fortune.pro +++ b/noncore/todayplugins/fortune/fortune.pro @@ -1,14 +1,13 @@ TEMPLATE = lib -#CONFIG -= moc CONFIG += qt plugin # Input HEADERS = fortuneplugin.h fortunepluginimpl.h \ fortunepluginwidget.h SOURCES = fortuneplugin.cpp fortunepluginimpl.cpp \ fortunepluginwidget.cpp INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library DEPENDPATH += $(OPIEDIR)/include \ ../ ../library diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.cpp b/noncore/todayplugins/fortune/fortunepluginwidget.cpp index c3ee546..c147567 100644 --- a/noncore/todayplugins/fortune/fortunepluginwidget.cpp +++ b/noncore/todayplugins/fortune/fortunepluginwidget.cpp @@ -7,36 +7,39 @@ */ /*************************************************************************** * * * 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 "fortunepluginwidget.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> +using namespace Opie::Core; +using namespace Opie::Ui; +/* QT */ #include <qvaluelist.h> #include <qtl.h> #include <qstring.h> #include <qscrollview.h> #include <qobject.h> #include <qlayout.h> -using namespace Opie::Core; -using namespace Opie::Ui; FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) : QWidget( parent, name ) { fortune = NULL; getFortune(); } FortunePluginWidget::~FortunePluginWidget() { if( fortuneProcess ){ delete fortuneProcess; } @@ -58,25 +61,25 @@ void FortunePluginWidget::getFortune() { // fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); fortune->setText( QString("Obtaining fortune...") ); layoutFortune->addWidget( fortune ); fortuneProcess = new OProcess(); *fortuneProcess << "fortune"; connect(fortuneProcess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int) ) ); if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { - qWarning("could not start :("); + owarn << "could not start :(" << oendl; fortune->setText( QString("Failed to obtain fortune.") ); delete fortuneProcess; fortuneProcess = 0; } } void FortunePluginWidget::slotStdOut( OProcess* /*proc*/, char* buf, int len ) { QCString s( buf, len ); s.replace( QRegExp("\n"), "" ); fortune->setText( s ); diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp index ce35256..ae219d7 100644 --- a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp +++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp @@ -1,33 +1,35 @@ #include "inputDialog.h" +#include "helpwindow.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +using namespace Opie::Core; +/* QT */ #include <qapplication.h> #include <qlayout.h> #include <qcheckbox.h> #include <qlineedit.h> #include <qvariant.h> #include <qpushbutton.h> #include <qwhatsthis.h> #include <qlabel.h> #include <qlayout.h> -#include <qpe/config.h> #include <qstringlist.h> -using namespace Opie::Core; -using namespace Opie::Core; #include <qmainwindow.h> -#include "helpwindow.h" +/* STD */ #include <stdlib.h> -// #include <sys/stat.h> -// #include <unistd.h> InputDialog::InputDialog( ) : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { setCaption( tr("Symbol Lookup")); QGridLayout *layout = new QGridLayout( this ); layout->setSpacing(6); layout->setMargin( 2); LineEdit1 = new QLineEdit( this, "LineEdit1" ); LineEdit1->setFocus(); @@ -45,44 +47,44 @@ InputDialog::InputDialog( ) } InputDialog::~InputDialog() { } void InputDialog::doLookup() { // http://finance.yahoo.com/l?m=&s=siemens&t= QString url = "\"http://finance.yahoo.com/l?m=&s="+LineEdit1->text()+"\""; QString tempHtml = "/tmp/stockticker.html"; QString cmd = "wget -O "+tempHtml+" "+url; - qDebug(cmd); + odebug << cmd << oendl; /* OProcess proc; proc << "/usr/bin/wget"; proc<<"-O"<< tempHtml<< url; connect( &proc, SIGNAL( processExited(Opie::Core::OProcess*)),this, SLOT( showBrowser(Opie::Core::OProcess*))); proc.start( OProcess::NotifyOnExit); */ system(cmd.latin1()); HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); StockLookup->setCaption("Symbol"); StockLookup->showMaximized(); StockLookup->show(); LineEdit1->text(); } void InputDialog::showBrowser(OProcess*) { - qDebug("BLAH"); + odebug << "BLAH" << oendl; QString tempHtml = "/tmp/stockticker.html"; HelpWindow *StockLookup = new HelpWindow( tempHtml,".",this, "SymbolLookup"); StockLookup->setCaption("Symbol"); StockLookup->showMaximized(); StockLookup->show(); LineEdit1->text(); } diff --git a/noncore/todayplugins/stockticker/stocktickerlib/config.in b/noncore/todayplugins/stockticker/stocktickerlib/config.in index 4d589f9..7dbe03a 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/config.in +++ b/noncore/todayplugins/stockticker/stocktickerlib/config.in @@ -1,4 +1,4 @@ config TODAY_STOCKTICKERLIB boolean default "y" if TODAY_STOCKTICKER - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && LIBOPIE2PIM && TODAY + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM && TODAY diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro index e70d1c0..6dcf945 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro @@ -1,29 +1,28 @@ TEMPLATE = lib -CONFIG -= moc CONFIG += qt plugin HEADERS = stocktickerplugin.h stocktickerpluginimpl.h stocktickerpluginwidget.h stocktickerconfig.h \ ../libstocks/csv.h \ ../libstocks/http.h \ ../libstocks/lists.h \ ../libstocks/stocks.h SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp stocktickerconfig.cpp \ ../libstocks/csv.c \ ../libstocks/currency.c \ ../libstocks/history.c \ ../libstocks/http.c \ ../libstocks/lists.c \ ../libstocks/stocks.c INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library DEPENDPATH += $(OPIEDIR)/include \ ../ ../library -LIBS+= -lqpe -lopieui2 -lopiepim2 -lpthread -TMAKE_CFLAGS += -D__UNIX__ +LIBS += -lqpe -lopiecore2 -lopieui2 -lopiepim2 -lpthread +DEFINES += __UNIX__ DESTDIR = $(OPIEDIR)/plugins/today TARGET = todaystocktickerplugin include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp index aaeb5ee..4855ac6 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp @@ -36,25 +36,25 @@ extern "C" { bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; void getStocks(char *blah) { // stocktickerTicker->setText( "Downloading stock data."); stock *stocks_quotes=NULL; stock *stocks_tmp; stock_liste = blah; ::free ( blah ); // char *stock_liste = (char *)blah->latin1(); - // qDebug("%s", stock_liste.data() ); + // odebug << "" << stock_liste.data() << "" << oendl; output = ""; QString tempString; libstocks_return_code error; // Config cfg( "stockticker"); // cfg.setGroup( "Fields" ); // bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; // bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; // bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; @@ -269,51 +269,51 @@ void getStocks(char *blah) { //::free((void*)thread1); //getStocks(blah); } } void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { killTimer(e->timerId()); checkConnection(); } void StockTickerPluginWidget::checkConnection() { - // qDebug("checking connection"); + // odebug << "checking connection" << oendl; // Sock = new QSocket( this ); // if( wasError) // stocktickerTicker->setText("Checking connection"); // if(Sock->state() == QSocket::Idle) { // Sock->connectToHost("finance.yahoo.com", 80); // connect( Sock, SIGNAL( error(int) ), SLOT(socketError(int)) ); // connect( Sock, SIGNAL( hostFound() ), SLOT(isConnected()) ); // } else { - // qDebug("State is not Idle"); + // odebug << "State is not Idle" << oendl; isConnected(); // } } void StockTickerPluginWidget::isConnected() { - // qDebug("We connect, so ok to grab stocks"); + // odebug << "We connect, so ok to grab stocks" << oendl; if(this->isVisible()) doStocks(); Config cfg( "stockticker"); cfg.setGroup("Timer"); timerDelay= cfg.readNumEntry("Delay",0); if(timerDelay > 0) startTimer(timerDelay*60000); - // qDebug("timer set for %d",(timerDelay*60000)/60000); + // odebug << "timer set for " << (timerDelay*60000)/60000 << "" << oendl; wasError = false; // Sock->close(); } void StockTickerPluginWidget::socketError(int errcode) { switch(errcode) { case QSocket::ErrConnectionRefused: output = tr("Connection refused."); break; case QSocket::ErrHostNotFound: output = tr("Could not find server."); diff --git a/noncore/tools/calc2/engine.cpp b/noncore/tools/calc2/engine.cpp index a9a47c4..e843e29 100644 --- a/noncore/tools/calc2/engine.cpp +++ b/noncore/tools/calc2/engine.cpp @@ -92,25 +92,25 @@ void Engine::pushValue (char v) case rDouble: displayString.append(v); num.dbl=displayString.toDouble(&ok); break; case rFraction: break; default: displayString.append(v); num.i=displayString.toInt(&ok, calcBase()); }; if (!ok) { state = sError; - qDebug("pushValue() - num->string conversion"); + odebug << "pushValue() - num->string conversion" << oendl; } else { const QString constString = displayString; emit(display(constString)); }; } else if (state == sStart) { softReset(); displayString.truncate(0); state = sAppend; pushValue (v); } else if (state == sError) { qDebug ("in error state"); @@ -118,70 +118,70 @@ void Engine::pushValue (char v) } } void Engine::del () { bool ok; switch (currentRep) { case rDouble: displayString.truncate(displayString.length()); num.dbl=displayString.toDouble(&ok); break; case rFraction: - qDebug("not available"); + odebug << "not available" << oendl; break; default: displayString.truncate(displayString.length()); num.i = displayString.toInt(&ok, calcBase()); }; if (!ok) { state = sError; - qDebug("del() - num->string conversion"); + odebug << "del() - num->string conversion" << oendl; } else { const QString constString = displayString; emit(display(constString)); }; } void Engine::displayData(Data d) { switch (currentRep) { case rDouble: displayString.setNum(d.dbl); break; case rFraction: - qDebug("fractional display not yet impl"); + odebug << "fractional display not yet impl" << oendl; break; default: displayString.setNum(d.i, calcBase()); break; }; const QString constString= displayString; emit(display(constString)); } // Returns the base when Rep is an integer type int Engine::calcBase () { switch (currentRep) { case rBin: return 2; case rOct: return 8; case rDec: return 10; case rHex: return 16; default: state = sError; - qDebug("Error - attempt to calc base for non-integer"); + odebug << "Error - attempt to calc base for non-integer" << oendl; return 10; }; } // Special instruction for internal use only class iOpenBrace:public Instruction { public: iOpenBrace (Engine *e):Instruction (100) {engine = e;}; ~iOpenBrace () {}; Data eval (Data num) { engine->decBraces(); diff --git a/noncore/tools/calculator/calculator.pro b/noncore/tools/calculator/calculator.pro index ae6a666..78d4519 100644 --- a/noncore/tools/calculator/calculator.pro +++ b/noncore/tools/calculator/calculator.pro @@ -1,11 +1,11 @@ -CONFIG = qt warn_on quick-app +CONFIG = qt warn_on quick-app HEADERS = calculatorimpl.h SOURCES = calculatorimpl.cpp \ main.cpp -INCLUDEPATH += $(OPIEDIR)/include +INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 INTERFACES = calculator.ui TARGET = calculator include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/tools/calculator/calculatorimpl.cpp b/noncore/tools/calculator/calculatorimpl.cpp index dead03d..05cb9b5 100644 --- a/noncore/tools/calculator/calculatorimpl.cpp +++ b/noncore/tools/calculator/calculatorimpl.cpp @@ -17,38 +17,45 @@ ** not clear to you. ** **********************************************************************/ /* * 01/14/2002 Charles-Edouard Ruault <ce@ruault.com> * Added support for Temperature conversions. */ // Sat 03-09-2002 L.J. Potter added the inlined pixmaps here #include "calculatorimpl.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/resource.h> #include <qpe/qmath.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; +/* QT */ #include <qpushbutton.h> #include <qcombobox.h> #include <qlabel.h> #include <qfont.h> #include <qlayout.h> #include <qstringlist.h> #include <qfile.h> #include <qtextstream.h> #include <qmessagebox.h> + +/* STD */ #include <math.h> + /* XPM */ static char *oneoverx_xpm[] = { /* width height num_colors chars_per_pixel */ " 13 11 2 1", /* colors */ ". c None", "# c #000000", /* pixels */ "......#......", ".....##......", "......#......" ".....###.....", @@ -224,25 +231,25 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name, connect(ComboBoxFunction, SIGNAL(activated(int) ), this, SLOT(function_button(int) ) ); captions.append(tr("Standard")); ComboBoxFunction->insertItem(captions.last()); // now add in the conversion modes // when the menu gets done, these should be in a submenu QString tmp = QPEApplication::qpeDir(); tmp += "etc/unit_conversion.dat"; QFile myfile(tmp); if ( !myfile.open( IO_Translate | IO_ReadOnly ) ) { - qDebug("Data file unit_conversion.dat not found\nNo conversion features will be available\n"+tmp); + odebug << "Data file unit_conversion.dat not found\nNo conversion features will be available\n"+tmp << oendl; // disable the f button if no conv file available ComboBoxFunction->setEnabled(FALSE); } else { QString line, line2; QTextStream ts(&myfile); // first pass, see how many conversion types there are in order to allocate for them while ( ! ts.eof() ) { line = ts.readLine(); if ( line.contains ("STARTTYPE" ) ) conversion_mode_count++; @@ -498,25 +505,25 @@ void CalculatorImpl::execOp( Operation i ) case oOpenBrace: { Op op( 0, oOpenBrace ); operationStack.push( op ); numOpenBraces++; state = sNewNumber; return; } case oCloseBrace: { if ( numOpenBraces == 0 ) return; processStack( oAdd ); if ( operationStack.top().operation != oOpenBrace ) - qDebug( "Calculator: internal Error" ); + odebug << "Calculator: internal Error" << oendl; operationStack.pop(); state = sNewNumber; numOpenBraces--; break; } case oPoint: flPoint = TRUE; return; case oPercent: processStack( oPercent ); diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp index 4204d73..642196e 100644 --- a/noncore/tools/formatter/formatter.cpp +++ b/noncore/tools/formatter/formatter.cpp @@ -2,48 +2,50 @@ ** formatter.cpp ** ** Copyright: Thu Apr 11 11:01:13 2002 ** by: L. J. Potter ** ****************************************************************************/ #include "formatter.h" #include "inputDialog.h" #include "output.h" /* OPIE */ -#include <qtoolbar.h> +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/mimetype.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/storage.h> +using namespace Opie::Core; /* QT */ #include <qmenubar.h> #include <qmultilineedit.h> #include <qstring.h> #include <qlist.h> #include <qstringlist.h> #include <qdir.h> #include <qfile.h> #include <qtstream.h> #include <qcombobox.h> #include <qpopupmenu.h> #include <qmessagebox.h> #include <qregexp.h> #include <qlabel.h> #include <qlineedit.h> #include <qpushbutton.h> +#include <qtoolbar.h> #include <qtabwidget.h> #include <qwidget.h> #include <qlayout.h> #include <qvariant.h> /* STD */ #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/vfs.h> #include <mntent.h> #include <string.h> @@ -229,92 +231,92 @@ void FormatterApp::doFormat() // cmd = "ls -l"; outDlg = new Output(this, tr("Formatter Output"),FALSE); QPEApplication::showDialog( outDlg); qApp->processEvents(); FILE *fp; char line[130]; outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) ); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); sleep(1); - qDebug("Command is "+umountS); + odebug << "Command is "+umountS << oendl; fp = popen( (const char *) umountS, "r"); - // qDebug("%d", fp); + // odebug << "" << fp << "" << oendl; if ( !fp ) { - qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); + odebug << "Could not execute '" + umountS + "'! err=" << err << "\n" +(QString)strerror(errno) << oendl; QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); pclose(fp); return; } else { // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); while ( fgets( line, sizeof line, fp)) { if( ((QString)line).find("busy",0,TRUE) != -1) { - qDebug("Could not find '" + umountS); + odebug << "Could not find '" + umountS << oendl; QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); pclose(fp); return; } else { QString lineStr = line; lineStr=lineStr.left(lineStr.length()-1); outDlg->OutputEdit->append(lineStr); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); } } } pclose(fp); - qDebug("Command would be: "+cmd); + odebug << "Command would be: "+cmd << oendl; outDlg->OutputEdit->append( tr("Trying to format.") ); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); fp = popen( (const char *) cmd, "r"); while ( fgets( line, sizeof line, fp)) { if( ((QString)line).find("No such device",0,TRUE) != -1) { - qDebug("No such device '" + umountS); + odebug << "No such device '" + umountS << oendl; QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); pclose(fp); // outDlg->OutputEdit->append("No such device"); // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); return; } else { QString lineStr = line; lineStr=lineStr.left(lineStr.length()-1); outDlg->OutputEdit->append(lineStr); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); } } outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); pclose(fp); outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) ); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); fp = popen( (const char *) remountS, "r"); if ( !fp) { - qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err); + odebug << "Could not execute '" + remountS + "'! err=" << err << "\n" +(QString)strerror(errno) << oendl; QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") ); } else { outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText )); while ( fgets( line, sizeof line, fp)) { QString lineStr = line; lineStr=lineStr.left(lineStr.length()-1); outDlg->OutputEdit->append(lineStr); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); @@ -371,25 +373,25 @@ void FormatterApp::fsComboSelected(int ) {} void FormatterApp::storageComboSelected(int index ) { QString currentText = storageComboBox->text(index); QString nameS = currentText.left( currentText.find("->",0,TRUE)); TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) ); currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); QString fsType = getFileSystemType((const QString &) currentText); - // qDebug(fsType); + // odebug << fsType << oendl; for(int i = 0; i < fileSystemsCombo->count(); i++) { if( fsType == fileSystemsCombo->text(i)) fileSystemsCombo->setCurrentItem(i); } // deviceComboSelected(index); } void FormatterApp::deviceComboSelected(int index) { StorageInfo storageInfo; @@ -455,25 +457,25 @@ void FormatterApp::parsetab(const QString &fileName) while ( (me = getmntent( mntfp )) != 0 ) { QString deviceName = me->mnt_fsname; QString filesystemType = me->mnt_type; if(deviceName != "none") { if( fsList.contains(filesystemType) == 0 & filesystemType.find("proc",0,TRUE) == -1 & filesystemType.find("cramfs",0,TRUE) == -1 & filesystemType.find("auto",0,TRUE) == -1) fsList << filesystemType; deviceList << deviceName; - qDebug(deviceName+"::"+filesystemType); + odebug << deviceName+"::"+filesystemType << oendl; fileSystemTypeList << deviceName+"::"+filesystemType; } } } endmntent( mntfp ); // } else if(fileName == "/etc/fstab") { // QFile f("/etc/fstab"); // if ( f.open(IO_ReadOnly) ) { // QTextStream t (&f); // QString s; // while (! t.eof()) { // s=t.readLine(); @@ -497,25 +499,25 @@ void FormatterApp::parsetab(const QString &fileName) QString FormatterApp::getFileSystemType(const QString ¤tText) { parsetab("/etc/mtab"); //why did TT forget filesystem type? for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { QString temp = (*it); if( temp.find( currentText,0,TRUE) != -1) { return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); - // qDebug(fsType); + // odebug << fsType << oendl; } } return ""; } bool FormatterApp::doFsck() { Output *outDlg; QString selectedDevice; // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) selectedDevice = deviceComboBox->currentText(); @@ -524,79 +526,79 @@ bool FormatterApp::doFsck() QString remountS = "mount -v "+mountPoint+" 2>&1"; // #else // // for testing // // currentText = diskDevice = "/dev/fd0"; // QString umountS = "umount -v /floppy 2>&1"; // QString remountS = "mount -v /floppy 2>&1"; // selectedDevice ="/dev/fd0"; // #endif QString fsType = getFileSystemType((const QString &)selectedDevice); QString cmd; - qDebug( selectedDevice +" "+ fsType); + odebug << selectedDevice +" "+ fsType << oendl; if(fsType == "vfat") cmd = "dosfsck -vy "; if(fsType == "ext2") cmd = "e2fsck -cpvy "; cmd += selectedDevice + " 2>&1"; outDlg = new Output(this, tr("Formatter Output"),FALSE); QPEApplication::showDialog( outDlg ); qApp->processEvents(); FILE *fp; char line[130]; outDlg->OutputEdit->append( tr("Trying to umount.")); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); sleep(1); - // qDebug("Command is "+umountS); + // odebug << "Command is "+umountS << oendl; fp = popen( (const char *) umountS, "r"); - // qDebug("%d", fp); + // odebug << "" << fp << "" << oendl; if ( !fp ) { - qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); + odebug << "Could not execute '" + umountS + "'!\n" +(QString)strerror(errno) << oendl; QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); pclose(fp); return false; } else { // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); while ( fgets( line, sizeof line, fp)) { if( ((QString)line).find("busy",0,TRUE) != -1) { - qDebug("Could not find '" + umountS); + odebug << "Could not find '" + umountS << oendl; QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); pclose(fp); return false; } else { QString lineStr = line; lineStr=lineStr.left(lineStr.length()-1); outDlg->OutputEdit->append(lineStr); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); } } } pclose(fp); ///////////////////////////////////// fp = popen( (const char *) cmd, "r"); while ( fgets( line, sizeof line, fp)) { if( ((QString)line).find("No such device",0,TRUE) != -1) { - qDebug("No such device '" + umountS); + odebug << "No such device '" + umountS << oendl; QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); pclose(fp); // outDlg->OutputEdit->append("No such device"); // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); return false; } else { QString lineStr = line; lineStr=lineStr.left(lineStr.length()-1); outDlg->OutputEdit->append(lineStr); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); diff --git a/noncore/tools/formatter/formatter.pro b/noncore/tools/formatter/formatter.pro index 913cca8..f6d34c7 100644 --- a/noncore/tools/formatter/formatter.pro +++ b/noncore/tools/formatter/formatter.pro @@ -1,9 +1,9 @@ -CONFIG += qt warn_on quick-app -HEADERS = formatter.h inputDialog.h output.h -SOURCES = formatter.cpp inputDialog.cpp output.cpp main.cpp -TARGET = formatter +CONFIG += qt warn_on quick-app +HEADERS = formatter.h inputDialog.h output.h +SOURCES = formatter.cpp inputDialog.cpp output.cpp main.cpp +TARGET = formatter INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopiecore2 +LIBS += -lqpe -lopiecore2 include ( $(OPIEDIR)/include.pro ) |