author | ar <ar> | 2004-05-31 15:26:50 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-31 15:26:50 (UTC) |
commit | 27dfc34d411dee76f09f5e516c60b0a64eb35948 (patch) (side-by-side diff) | |
tree | b7f7259497630390e352a1257cac5dc59f5399a6 | |
parent | 27b09fe4f930b96e82cea9fb0eb1a9b87f7ec062 (diff) | |
download | opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.zip opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.gz opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.bz2 |
- convert qWarning to owarn
20 files changed, 209 insertions, 170 deletions
diff --git a/noncore/apps/opie-write/qrichtext_p.h b/noncore/apps/opie-write/qrichtext_p.h index e368edb..3778feb 100644 --- a/noncore/apps/opie-write/qrichtext_p.h +++ b/noncore/apps/opie-write/qrichtext_p.h @@ -29,48 +29,51 @@ ** 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. ** **********************************************************************/ #ifndef QRICHTEXT_P_H #define QRICHTEXT_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of a number of Qt sources files. This header file may change from // version to version without notice, or even be removed. // // We mean it. // // +#include <opie2/odebug.h> +using namespace Opie::Core; + #ifndef QT_H #include "qstring.h" #include "qlist.h" #include "qrect.h" #include "qfontmetrics.h" #include "qintdict.h" #include "qmap.h" #include "qstringlist.h" #include "qfont.h" #include "qcolor.h" #include "qsize.h" #include "qvaluelist.h" #include "qvaluestack.h" #include "qobject.h" #include "qdict.h" #include "qtextstream.h" #include "qpixmap.h" #include "qstylesheet.h" #include "qvector.h" #include "qpainter.h" #include "qlayout.h" #include "qobject.h" #include "qcomplextext_p.h" #include "qapplication.h" @@ -1862,49 +1865,49 @@ inline bool QTextParagraph::hasAnySelection() const { return mSelections ? !selections().isEmpty() : FALSE; } inline void QTextParagraph::setEndState( int s ) { if ( s == state ) return; state = s; } inline int QTextParagraph::endState() const { return state; } inline void QTextParagraph::setParagId( int i ) { id = i; } inline int QTextParagraph::paragId() const { if ( id == -1 ) - qWarning( "invalid parag id!!!!!!!! (%p)", (void*)this ); + owarn << "invalid parag id!!!!!!!! (" << (void*)this << ")" << oendl; return id; } inline bool QTextParagraph::firstPreProcess() const { return firstPProcess; } inline void QTextParagraph::setFirstPreProcess( bool b ) { firstPProcess = b; } inline QMap<int, QTextLineStart*> &QTextParagraph::lineStartList() { return lineStarts; } inline QTextString *QTextParagraph::string() const { return str; } inline QTextDocument *QTextParagraph::document() const diff --git a/noncore/apps/tableviewer/browsekeyentry.cpp b/noncore/apps/tableviewer/browsekeyentry.cpp index 04e7902..bab9af6 100644 --- a/noncore/apps/tableviewer/browsekeyentry.cpp +++ b/noncore/apps/tableviewer/browsekeyentry.cpp @@ -1,57 +1,59 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "browsekeyentry.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qtoolbutton.h> #include <qwidgetstack.h> #include <qlayout.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qpopupmenu.h> #include <qhbox.h> #include <qdatetime.h> -//#include <iostream.h> -#include <qheader.h> -// For qWarning(const char *) /*! \class TVBrowseKeyEntry \brief a Widget used enter keys into the TVBrowseViewWidget The TVBrowseKeyEntry Widget provides the facility to enter various key types to be search on in the table. The key can be changed and the entry field will update to the correct sort of widget appropriately */ /*! Constructs the widget */ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { int stack_elem = 0; QHBoxLayout *h_layout = new QHBoxLayout(this); textKey = new QLineEdit(this, 0); dateKey = new QHBox(this, 0); dayKey = new QLineEdit(dateKey, 0); monthKey = new QLineEdit(dateKey, 0); @@ -207,36 +209,35 @@ void TVBrowseKeyEntry::searchOnText() return; if(!QTime::isValid(h, m, s)) return; sendkey = (void *) new QTime(h, m, s); break; } case kt_date: { bool ok; int d,m,y; d = dayKey->text().toInt(&ok); if (!ok) return; m = monthKey->text().toInt(&ok); if (!ok) return; y = yearKey->text().toInt(&ok); if (!ok) return; if(!QDate::isValid(y, m, d)) return; sendkey = (void *) new QDate(y, m, d); break; } default: - qWarning("TVBrowseKeyEntry::searchOnText() " - "cannot work out data type"); + owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl; return; } emit searchOnKey(ts->current_column, sendkey); } /*! \fn void TVBrowseKeyEntry::searchOnKey(int currentKeyId, void *v) This signal indicates that a search on key index currentKeyId should be done searching for the value v. */ diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp index b58af85..c35dbea 100644 --- a/noncore/apps/tableviewer/db/common.cpp +++ b/noncore/apps/tableviewer/db/common.cpp @@ -839,50 +839,49 @@ int KeyList::addKey(QString name, TVVariant example) while(find(i) && (i > -1)) i--; replace(i, new Key(name, example, 0)); return i; } int KeyList::addKey(QString name, TVVariant::KeyType type) { /* generate a valid type for the example? */ TVVariant e = TVVariant("0"); switch(type) { case TVVariant::String: return addKey(name, TVVariant("<undefined>").asString()); break; case TVVariant::Date: return addKey(name, TVVariant(QDate::currentDate()).asDate()); break; case TVVariant::Time: return addKey(name, TVVariant(QTime(0,0,0)).toTime()); break; case TVVariant::Int: return addKey(name, TVVariant(0).toInt()); break; default: - qWarning(QObject::tr("KeyList::addKey() Cannot make default " - "value for type %1, Key not added.").arg(type)); + owarn << "KeyList::addKey() Cannot make default value for type " << type << ", Key not added." << oendl; break; } return -1; } void KeyList::setKeyFlags(int i, int flag) { if(find(i)) find(i)->setFlags(flag); } int KeyList::getKeyFlags(int i) const { if(find(i)) return find(i)->flags(); return 0; } bool KeyList::checkNewFlag(int i) const { if (find(i)) return find(i)->newFlag(); return false; } @@ -1187,51 +1186,49 @@ void DataElem::setField(int i, QString q) TVVariant t = TVVariant(q); switch(kt) { case TVVariant::Int: { t.asInt(); setField(i, t); return; } case TVVariant::String: { t.asString(); setField(i, t); return; } case TVVariant::Date: { t.asDate(); setField(i, t); return; } case TVVariant::Time: { t.asTime(); setField(i, t); return; } default: - qWarning( - QObject::tr("DataElem::setField(%1, %2) No valid type found").arg(i).arg(q) - ); + owarn << "DataElem::setField(" << i << ", " << q << ") No valid type found" << oendl; } } /*! Sets the value of the elements field index i to the value at the pointer value. \param i index of the field to set \param value a pointer to the (already allocated) value to set */ void DataElem::setField(int i, TVVariant value) { if (value.isValid()) { values.remove(i); values.replace(i, new TVVariant(value)); } } /*! Sets the value of the elements field name qs to the value represented in the QString q. \param qs name of the field to set \param q a string that can be parsed to get the value to be set diff --git a/noncore/apps/tableviewer/db/datacache.cpp b/noncore/apps/tableviewer/db/datacache.cpp index 6380e1b..de57961 100644 --- a/noncore/apps/tableviewer/db/datacache.cpp +++ b/noncore/apps/tableviewer/db/datacache.cpp @@ -135,49 +135,49 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source) archive = new DBXml(this); } else if (source == "text/x-xml-tableviewer") { archive = new DBCsv(this); } else return false; } return (archive->saveSource(outDev)); } /*! This function is used to add new elements to the database. If the database has already reached the maximum allowable size this function does not alter the database. \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 already full, don't over fill, do a owarn though */ if (full) { 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; /* check that the new table size is still valid, i.e. that we didn't just shift the 1 bit of the end of the int. */ if (!table_size) { full = true; /* no point in doing antying else. */ return; } master_table.resize(table_size); } } diff --git a/noncore/apps/tableviewer/db/datacache.h b/noncore/apps/tableviewer/db/datacache.h index c5dc637..e38050c 100644 --- a/noncore/apps/tableviewer/db/datacache.h +++ b/noncore/apps/tableviewer/db/datacache.h @@ -6,72 +6,78 @@ ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ /* * 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. */ #ifndef __DATACACHE_H__ #define __DATACACHE_H__ +#include "common.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qstring.h> #include <qvector.h> -#include "common.h" class DBStore; /*! Abstract class that defines how database stuff can be accessed */ class DBAccess { public: // DBAccess(DBStore *d) { dstore = d; } virtual ~DBAccess() {} virtual QString type() { return QString(); } virtual bool openSource(QIODevice *) { - qWarning("DBAccess::openSource not yet implemented"); + owarn << "DBAccess::openSource not yet implemented" << oendl; return false; } virtual bool saveSource(QIODevice *) { - qWarning("DBAccess::saveSource(QString) not yet implemented"); + owarn << "DBAccess::saveSource(QString) not yet implemented" << oendl; return false; } protected: DBStore *dstore; QString source_name; }; class DBStore { public: DBStore(); ~DBStore(); bool openSource(QIODevice *, const QString &source); bool saveSource(QIODevice *, const QString &source); // Add an item void addItem(DataElem *); void addItemInternal(DataElem *); void removeItem(DataElem *); // Set the name of the database void setName(const QString &name); diff --git a/noncore/apps/tableviewer/ui/browsekeyentry.cpp b/noncore/apps/tableviewer/ui/browsekeyentry.cpp index 42e24dd..6b78437 100644 --- a/noncore/apps/tableviewer/ui/browsekeyentry.cpp +++ b/noncore/apps/tableviewer/ui/browsekeyentry.cpp @@ -1,58 +1,58 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "browsekeyentry.h" #include "commonwidgets.h" +#include <opie2/odebug.h> +using namespace Opie::Core; + #include <qtoolbutton.h> #include <qwidgetstack.h> #include <qlayout.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qpopupmenu.h> #include <qhbox.h> #include <qdatetime.h> -#include <qheader.h> -// For qWarning(const char *) - /*! \class TVBrowseKeyEntry \brief a Widget used enter keys into the TVBrowseViewWidget The TVBrowseKeyEntry Widget provides the facility to enter various key types to be search on in the table. The key can be changed and the entry field will update to the correct sort of widget appropriately */ /*! Constructs the widget */ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { QHBoxLayout *h_layout = new QHBoxLayout(this); textKey = new QLineEdit(this, 0); intKey = new IntEdit(this, 0); dateKey = new DateEdit(this, 0); timeKey = new TimeEdit(this, 0); resetButton = new QPushButton(this, "reset"); resetButton->setMinimumSize(QSize(50, 0)); @@ -171,36 +171,35 @@ void TVBrowseKeyEntry::searchOnText() TVVariant sendkey; if (!ts) return; switch(ts->kRep->getKeyType(ts->current_column)) { case TVVariant::String: sendkey = TVVariant(QString(textKey->text())); break; case TVVariant::Int: { sendkey = TVVariant(intKey->value()); break; } case TVVariant::Time: { sendkey = TVVariant(QTime(timeKey->time())); break; } case TVVariant::Date: { sendkey = TVVariant(QDate(dateKey->date())); break; } case TVVariant::Invalid: break; default: - qWarning("TVBrowseKeyEntry::searchOnText() " - "cannot work out data type"); + owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl; return; } emit searchOnKey(ts->current_column, sendkey); } /*! \fn void TVBrowseKeyEntry::searchOnKey(int currentKeyId, TVVariant) This signal indicates that a search on key index currentKeyId should be done searching for the value v. */ diff --git a/noncore/apps/tableviewer/ui/filterkeyentry.cpp b/noncore/apps/tableviewer/ui/filterkeyentry.cpp index d108fbd..4d74d6b 100644 --- a/noncore/apps/tableviewer/ui/filterkeyentry.cpp +++ b/noncore/apps/tableviewer/ui/filterkeyentry.cpp @@ -1,46 +1,51 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "filterkeyentry.h" #include "commonwidgets.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qwidgetstack.h> #include <qcombobox.h> #include <qlayout.h> #include <qlineedit.h> #include <qsizepolicy.h> #include <qdatetime.h> #include <qhbox.h> TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { int stack_elem = 0; layout = new QHBoxLayout(this, 0); layout->setSpacing(0); layout->setMargin(0); textEntry = new QHBox(this, 0); textEntry->setSpacing(0); textEntry->setMargin(0); intEntry = new QHBox(this, 0); intEntry->setSpacing(0); intEntry->setMargin(0); @@ -179,30 +184,29 @@ CmpType TVFilterKeyEntry::getCompareType() /* MUST return a valid pointer */ TVVariant TVFilterKeyEntry::getCompareValue() { TVVariant sendkey; int tmp; switch(current_type) { case TVVariant::String: sendkey = TVVariant(QString(textKey->text())); break; case TVVariant::Int: { sendkey = TVVariant(intKey->value()); break; } case TVVariant::Time: { sendkey = TVVariant(QTime(timeKey->time())); break; } case TVVariant::Date: { sendkey = TVVariant(QDate(dateKey->date())); break; } default: { sendkey = TVVariant(0); - qWarning("TVFilterKeyEntry::getCompareValue() " - "cannot work out data type"); + owarn << "TVFilterKeyEntry::getCompareValue() cannot work out data type" << oendl; } } return sendkey; } diff --git a/noncore/apps/tableviewer/ui/tvfilterview.cpp b/noncore/apps/tableviewer/ui/tvfilterview.cpp index 22f1fb7..198c8b5 100644 --- a/noncore/apps/tableviewer/ui/tvfilterview.cpp +++ b/noncore/apps/tableviewer/ui/tvfilterview.cpp @@ -1,53 +1,59 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "tvfilterview.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/qpeapplication.h> +using namespace Opie::Core; + +/* QT */ #include <qtoolbutton.h> #include <qcombobox.h> #include <qlistview.h> #include <qlayout.h> #include <qheader.h> #include <qpushbutton.h> #include <qlabel.h> -#include <qpe/qpeapplication.h> TVFilterView::TVFilterView(TableState *t, QWidget* parent, const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl) { if ( !name ) setName( "Filter View" ); QVBoxLayout *vlayout = new QVBoxLayout(this); display = new QListView(this, "display"); display->addColumn("Key"); display->addColumn("Constraint"); display->addColumn("Value"); display->header()->setClickEnabled(FALSE); display->header()->setResizeEnabled(FALSE); vlayout->addWidget(display); QHBoxLayout *hlayout = new QHBoxLayout; hlayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); newFilterButton = new QPushButton(this, "new Filter"); newFilterButton->setMaximumSize(QSize(50, 32767)); newFilterButton->setText("New"); @@ -154,50 +160,49 @@ bool TVFilterView::passesFilter(DataElem *d) { if (!d->lessThan(t->keyIndex, t->value)) return false; break; case ct_more: if (!d->moreThan(t->keyIndex, t->value)) return false; break; case ct_equal: if (!d->equalTo(t->keyIndex, t->value)) return false; break; case ct_contains: if (!d->contains(t->keyIndex, t->value)) return false; break; case ct_startswith: if (!d->startsWith(t->keyIndex, t->value)) return false; break; case ct_endswith: if (!d->endsWith(t->keyIndex, t->value)) return false; break; default: - qWarning("TVFilterView::passesFilter() " - "unrecognized filter type"); + owarn << "TVFilterView::passesFilter() unrecognized filter type" << oendl; return false; } } return true; } bool TVFilterView::filterActive() const { /* when button operated, also check the do_filter value return do_filter; */ if (terms.isEmpty()) return false; return true; } /* SLOTS */ void TVFilterView::newTerm() { if (!ts) return; FilterTerm *term = new FilterTerm; current = term; diff --git a/noncore/apps/tinykate/libkate/kateconfig.cpp b/noncore/apps/tinykate/libkate/kateconfig.cpp index 782b629..4b8ce78 100644 --- a/noncore/apps/tinykate/libkate/kateconfig.cpp +++ b/noncore/apps/tinykate/libkate/kateconfig.cpp @@ -3,48 +3,49 @@ ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #define QTOPIA_INTERNAL_LANGLIST #include "kateconfig.h" /* OPIE */ #include <opie2/odebug.h> #include <qpe/global.h> +using namespace Opie::Core; /* QT */ #include <qdir.h> #include <qmessagebox.h> #if QT_VERSION <= 230 && defined(QT_NO_CODECS) #include <qtextcodec.h> #endif #include <qtextstream.h> /* STD */ #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <stdlib.h> #include <unistd.h> /*! \internal */ QString KateConfig::configFilename(const QString& name, Domain d) { switch (d) { case File: @@ -535,50 +536,49 @@ void KateConfig::write( const QString &fn ) QCString cstr; QMap< QString, KateConfigGroup >::Iterator g_it = groups.begin(); for ( ; g_it != groups.end(); ++g_it ) { str += "[" + g_it.key() + "]\n"; KateConfigGroup::Iterator e_it = ( *g_it ).begin(); for ( ; e_it != ( *g_it ).end(); ++e_it ) str += e_it.key() + " = " + *e_it + "\n"; } cstr = str.utf8(); int total_length; total_length = f.writeBlock( cstr.data(), cstr.length() ); if ( total_length != int(cstr.length()) ) { QMessageBox::critical( 0, QObject::tr("Out of Space"), QObject::tr("There was a problem creating\nKateConfiguration Information \nfor this program.\n\nPlease free up some space and\ntry again.") ); f.close(); QFile::remove( strNewFile ); return; } f.close(); // now rename the file... if ( rename( strNewFile, filename ) < 0 ) { - qWarning( "problem renaming the file %s to %s", strNewFile.latin1(), - filename.latin1() ); + owarn << "problem renaming the file " << strNewFile.latin1() << " to " << filename.latin1() << oendl; QFile::remove( strNewFile ); } } /*! Returns whether the KateConfig is in a valid state. */ bool KateConfig::isValid() const { return groups.end() != git; } /*! \internal */ void KateConfig::read() { changed = FALSE; if ( !QFileInfo( filename ).exists() ) { git = groups.end(); return; } diff --git a/noncore/apps/zsafe/main.cpp b/noncore/apps/zsafe/main.cpp index 4fe319b..5f48f77 100644 --- a/noncore/apps/zsafe/main.cpp +++ b/noncore/apps/zsafe/main.cpp @@ -1,39 +1,47 @@ /* ** Author: Carsten Schneider <CarstenSchneider@t-online.de> ** ** $Id$ ** ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html */ #include "zsafe.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #ifdef DESKTOP #include <qapplication.h> #else #include <qpe/qpeapplication.h> #endif + +/* STD */ #include <stdio.h> #include <signal.h> ZSafe *zs; #ifdef DESKTOP QApplication *appl; #else QPEApplication *appl; #endif int DeskW; int DeskH; void suspend (int signum) { printf ("Suspend signal %d received\n", signum); } void resume (int signum) { printf ("Resume signal %d received\n", signum); zs->resume(signum); } @@ -53,59 +61,56 @@ int main( int argc, char ** argv ) #ifdef DESKTOP if (argc >= 3) { #ifndef WIN32 DeskW = atoi(argv[1]); DeskH = atoi(argv[2]); #else int w, h; sscanf (argv[1], "%d", &w); sscanf (argv[2], "%d", &h); DeskW = w; DeskH = h; #endif } else { DeskW = 600; DeskH = 400; } #else DeskW = a.desktop()->width(); DeskH = a.desktop()->height(); - char buf[128]; - sprintf (buf, "Width: %d Height: %d\n", DeskW, DeskH); - qWarning (buf); + owarn << "Width: " << DeskW << " Height: " << DeskH << oendl; #ifdef JPATCH_HDE // nothings #else if (DeskW > 240) { DeskW -= 20; DeskH += 25; - sprintf (buf, "Changed width: %d Height: %d\n", DeskW, DeskH); - qWarning (buf); + owarn << "Changed width: " << DeskW << " Height: " << DeskH << oendl; } #endif #endif ZSafe mw; zs = &mw; #ifndef WIN32 signal (SIGCONT, resume); #endif #ifdef DESKTOP a.setMainWidget(&mw); mw.show(); #else // a.showMainWidget( &mw ); a.showMainDocumentWidget( &mw ); #endif int ret = a.exec(); return ret; } diff --git a/noncore/apps/zsafe/zlistview.cpp b/noncore/apps/zsafe/zlistview.cpp index ba02a15..7d0b8c2 100644 --- a/noncore/apps/zsafe/zlistview.cpp +++ b/noncore/apps/zsafe/zlistview.cpp @@ -1,36 +1,39 @@ /* ** $Id$ */ #include "zlistview.h" -#include <stdio.h> #include "zsafe.h" +/* OPIE */ +//#include <opie2/odebug.h> + +/* STD */ +#include <stdio.h> + ZListView::ZListView (ZSafe *zsafe, const char *id) : QListView(zsafe, id) { zs = zsafe; } ZListView::~ZListView() { } void ZListView::keyPressEvent ( QKeyEvent *e ) { /* - char buf[64]; - sprintf (buf, "key: %d\n", e->key()); - qWarning (buf); + owarn << "key: " << e->key() << oendl; */ switch (e->key()) { case 32: // middle cursor key pressed zs->showInfo (zs->selectedItem); break; default: QListView::keyPressEvent( e ); } } diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 6ff05ac..ca3ff52 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -860,126 +860,126 @@ void ZSafe::findPwd() dialog->NameField->setText(lastSearchedName); else dialog->NameField->setText(""); if (lastSearchedUsername) dialog->UsernameField->setText(lastSearchedUsername); else dialog->UsernameField->setText(""); if (lastSearchedComment) dialog->CommentField->setText(lastSearchedComment); else dialog->CommentField->setText(""); DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP result = Accepted; #endif QString name; QString username; QString comment; if (result == Accepted) { name = dialog->NameField->text(); username = dialog->UsernameField->text(); comment = dialog->CommentField->text(); - qWarning (name); + owarn << name << oendl; } else { delete dialog; return; } if (!name.isEmpty() && name != lastSearchedName || lastSearchedName.isEmpty() && !name.isEmpty()) { // set search at the beginning if a new name is given lastSearchedCategory = NULL; lastSearchedItem = NULL; } lastSearchedName = name; if (!username.isEmpty() && username != lastSearchedUsername || lastSearchedUsername.isEmpty() && !username.isEmpty()) { // set search at the beginning if a new name is given lastSearchedCategory = NULL; lastSearchedItem = NULL; } lastSearchedUsername = username; if (!comment.isEmpty() && comment != lastSearchedComment || lastSearchedComment.isEmpty() && !comment.isEmpty()) { // set search at the beginning if a new name is given lastSearchedCategory = NULL; lastSearchedItem = NULL; } lastSearchedComment = comment; ListView->clearSelection(); bool found=FALSE; // step through all categories QListViewItem *i; if (lastSearchedCategory) i = lastSearchedCategory; else i = ListView->firstChild(); for (; i != NULL; i = i->nextSibling()) { - qWarning (i->text(0)); + owarn << i->text(0) << oendl; i->setSelected(FALSE); // step through all subitems QListViewItem *si; if (lastSearchedItem) si = lastSearchedItem; else si = i->firstChild(); // for (si = i->firstChild(); for (; si != NULL; si = si->nextSibling()) { - qWarning (si->text(0)); + owarn << si->text(0) << oendl; if (si->isSelected()) si->setSelected(FALSE); // ListView->repaintItem(si); bool n=TRUE; bool u=TRUE; bool c=TRUE; if (!name.isEmpty()) n = (si->text(0)).contains (name, FALSE); if (!username.isEmpty()) u = (si->text(1)).contains (username, FALSE); if (!comment.isEmpty()) c = (si->text(3)).contains (comment, FALSE); if ((n && u && c ) && !found) { - qWarning ("Found"); + owarn << "Found" << oendl; selectedItem = si; si->setSelected(TRUE); ListView->setCurrentItem(si); ListView->ensureItemVisible(si); ListView->triggerUpdate(); lastSearchedCategory = i; // set to the next item lastSearchedItem = si->nextSibling(); if (!lastSearchedItem) { // no next item within category -> set next category lastSearchedCategory = i->nextSibling(); if (!lastSearchedCategory) lastSearchedItem = NULL; // END } found = TRUE; delete dialog; update(); return; } } lastSearchedCategory = i->nextSibling(); @@ -1207,224 +1207,221 @@ void ZSafe::removeAsciiFile() QString::null, mimeTypes, this, tr ("Remove text file")); #else QString fn = ScQtFileEdit::getOpenFileName(this, tr ("Remove text file"), QDir::homeDirPath() + "/Documents/application/zsafe", "*.txt"); #endif #else QString fn = QFileDialog::getOpenFileName( QDir::homeDirPath() + "/Documents/application/zsafe", "ZSafe (*.txt)", this, "ZSafe File Dialog" "Choose a text file" ); #endif if (fn && fn.length() > 0 ) { QFile f( fn ); if ( !f.remove() ) { - qWarning( QString("Could not remove file %1").arg(fn), - 2000 ); + owarn << "Could not remove file " << fn << oendl; QMessageBox::critical( 0, tr("ZSafe"), tr("Could not remove text file.") ); return; } } } void ZSafe::writeAllEntries() { if (filename.isEmpty()) { QMessageBox::critical( 0, tr("ZSafe"), tr("No document defined.\nYou have to create a new document")); return; } // open the file dialog #ifndef DESKTOP #ifndef NO_OPIE QMap<QString, QStringList> mimeTypes; mimeTypes.insert(tr("All"), QStringList() ); mimeTypes.insert(tr("Text"), "text/*" ); QString fn = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL, QDir::homeDirPath() + "/Documents/application/zsafe", QString::null, mimeTypes, this, tr ("Export text file")); #else QString fn = ScQtFileEdit::getSaveAsFileName(this, tr ("Export text file"), QDir::homeDirPath() + "/Documents/application/zsafe", "*.txt"); #endif #else QString fn = QFileDialog::getSaveFileName( QDir::homeDirPath() + "/Documents/application/zsafe", "ZSafe (*.txt)", this, "ZSafe File Dialog" "Choose a text file" ); #endif // open the new document if (fn && fn.length() > 0 ) { QFile f( fn ); if ( !f.open( IO_WriteOnly ) ) { - qWarning( QString("Could not write to file %1").arg(fn), - 2000 ); + owarn << "Could not write to file " << fn << oendl; QMessageBox::critical( 0, "ZSafe", QString("Could not export to text file.") ); return; } QTextStream t( &f ); QListViewItem *i; // step through all categories for (i = ListView->firstChild(); i != NULL; i = i->nextSibling()) { // step through all subitems QListViewItem *si; for (si = i->firstChild(); si != NULL; si = si->nextSibling()) { QString oneEntry; oneEntry += "\""; oneEntry += i->text(0); oneEntry += "\";"; oneEntry += "\""; oneEntry += si->text(0); oneEntry += "\";"; oneEntry += "\""; oneEntry += si->text(1); oneEntry += "\";"; oneEntry += "\""; oneEntry += si->text(2); oneEntry += "\";"; oneEntry += "\""; QString comment = si->text(3); comment.replace (QRegExp("\n"), "<br>"); oneEntry += comment; oneEntry += "\";"; oneEntry += "\""; oneEntry += si->text(4); oneEntry += "\";"; oneEntry += "\""; oneEntry += si->text(5); oneEntry += "\""; - // qWarning (oneEntry); + // owarn << oneEntry << oendl; t << oneEntry << endl; - // qWarning (si->text(0)); + // owarn << si->text(0) << oendl; } } f.close(); } } void ZSafe::readAllEntries() { if (filename.isEmpty()) { QMessageBox::critical( 0, tr("ZSafe"), tr("No document defined.\nYou have to create a new document")); return; } // open the file dialog #ifndef DESKTOP #ifndef NO_OPIE QMap<QString, QStringList> mimeTypes; mimeTypes.insert(tr("All"), QStringList() ); mimeTypes.insert(tr("Text"), "text/*" ); QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, QDir::homeDirPath() + "/Documents/application/zsafe", QString::null, mimeTypes, this, tr ("Import text file")); #else QString fn = ScQtFileEdit::getOpenFileName(this, tr ("Import text file"), QDir::homeDirPath() + "/Documents/application/zsafe", "*.txt"); #endif #else QString fn = QFileDialog::getOpenFileName( QDir::homeDirPath() + "/Documents/application/zsafe", "ZSafe (*.txt)", this, "ZSafe File Dialog" "Choose a text file" ); #endif if (fn && fn.length() > 0 ) { QFile f( fn ); if ( !f.open( IO_ReadOnly ) ) { - qWarning( QString("Could not read file %1").arg(fn), - 2000 ); + owarn << "Could not read file " << fn << oendl; QMessageBox::critical( 0, "ZSafe", QString("Could not import text file.") ); return; } modified = true; // clear the password list selectedItem = NULL; QListViewItem *i; // step through all categories for (i = ListView->firstChild(); i != NULL; i = i->nextSibling()) { // step through all subitems QListViewItem *si; for (si = i->firstChild(); si != NULL; ) // si = si->nextSibling()) { QListViewItem *_si = si; si = si->nextSibling(); i->takeItem(_si); // remove from view list if (_si) delete _si; } } - qWarning ("ReadAllEntries(): "); + owarn << "ReadAllEntries(): " << oendl; QTextStream t(&f); while ( !t.eof() ) { QString s = t.readLine(); s.replace (QRegExp("\";\""), "\"|\""); // char buffer[1024]; #ifndef WIN32 char buffer[s.length()+1]; #else char buffer[4048]; #endif /* modify QString -> QCString::utf8 */ strcpy (buffer, s.utf8()); QString name; QString user; QString password; QString comment; QString field5=""; QString field6=""; @@ -1533,133 +1530,131 @@ void ZSafe::readAllEntries() c1->setIcon (*getPredefinedIcon(category)); } c1->setListItem (catI); c1->initListItem(); categories.insert (c1->getCategoryName(), c1); } } f.close(); } else { } } #ifdef UNUSED void ZSafe::writeAllEntries() { // open the file for writing QString fn = filename + ".txt"; QFile f( fn ); if ( !f.open( IO_WriteOnly ) ) { - qWarning( QString("Could not write to file %1").arg(fn), - 2000 ); + owarn << "Could not write to file " << fn << oendl; QMessageBox::critical( 0, tr("ZSafe"), tr("Could not export to text file.") ); return; } QTextStream t( &f ); QListViewItem *i; // step through all categories for (i = ListView->firstChild(); i != NULL; i = i->nextSibling()) { // step through all subitems QListViewItem *si; for (si = i->firstChild(); si != NULL; si = si->nextSibling()) { QString oneEntry; oneEntry += "\""; oneEntry += i->text(0); oneEntry += "\";"; oneEntry += "\""; oneEntry += si->text(0); oneEntry += "\";"; oneEntry += "\""; oneEntry += si->text(1); oneEntry += "\";"; oneEntry += "\""; oneEntry += si->text(2); oneEntry += "\";"; oneEntry += "\""; // oneEntry += si->text(3); QString comment = si->text(3); comment.replace (QRegExp("\n"), "<br>"); oneEntry += comment; oneEntry += "\""; - // qWarning (oneEntry); + // owarn << oneEntry << oendl; t << oneEntry << endl; - // qWarning (si->text(0)); + // owarn << si->text(0) << oendl; } } f.close(); } void ZSafe::readAllEntries() { QString fn = filename + ".txt"; QFile f( fn ); if ( !f.open( IO_ReadOnly ) ) { - qWarning( QString("Could not read file %1").arg(fn), - 2000 ); + owarn << "Could not read file " << fn << oendl; QMessageBox::critical( 0, tr("ZSafe"), tr("Could not import text file.") ); return; } modified = true; // clear the password list selectedItem = NULL; QListViewItem *i; // step through all categories for (i = ListView->firstChild(); i != NULL; i = i->nextSibling()) { // step through all subitems QListViewItem *si; for (si = i->firstChild(); si != NULL; ) // si = si->nextSibling()) { QListViewItem *_si = si; si = si->nextSibling(); i->takeItem(_si); // remove from view list if (_si) delete _si; } } - qWarning ("ReadAllEntries(): "); + owarn << "ReadAllEntries(): " << oendl; QTextStream t(&f); while ( !t.eof() ) { QString s = t.readLine(); s.replace (QRegExp("\";\""), "\"|\""); // char buffer[1024]; int len=s.length()+1; #ifdef WIN32 char buffer[512]; #else char buffer[len]; #endif strcpy (buffer, s); QString name; QString user; QString password; QString comment; // separete the entries char *i = strtok (buffer, "|"); QString category(&i[1]); category.truncate(category.length() -1); @@ -1741,49 +1736,49 @@ void ZSafe::readAllEntries() QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); c1->setIconName (icon); c1->setIcon (*pix); isIconAv = true; } } if (!isIconAv) { c1->setIcon (*getPredefinedIcon(category)); } c1->setListItem (catI); c1->initListItem(); categories.insert (c1->getCategoryName(), c1); } } f.close(); } #endif // UNUSED void ZSafe::resume(int) { - qWarning ("Resume"); + owarn << "Resume" << oendl; // hide the main window infoForm->hide(); // open zsafe again m_password = ""; selectedItem = NULL; // clear the password list QListViewItem *i; // step through all categories for (i = ListView->firstChild(); i != NULL; i = i->nextSibling()) { // step through all subitems QListViewItem *si; for (si = i->firstChild(); si != NULL; ) { QListViewItem *_si = si; si = si->nextSibling(); i->takeItem(_si); // remove from view list if (_si) delete _si; } @@ -1797,58 +1792,58 @@ void ZSafe::resume(int) bool ZSafe::openDocument(const char* _filename, const char* ) { int retval; char* entry[FIELD_SIZE]; // #ifndef WIN32 int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1); // #else // int validationFlag = 1; // #endif int pwdOk = 0; int numberOfTries = 3; for (int i=0; i < numberOfTries; i++) { QFile f(_filename); if (f.exists()) { // ask with a dialog for the password if (m_password.isEmpty()) getDocPassword(tr("Enter Password")); if (m_password.isEmpty() && validationFlag == 0) { - qWarning ("Wrong password"); + owarn << "Wrong password" << oendl; QMessageBox::critical( 0, tr("ZSafe"), tr("Wrong password.\n\nZSafe will now exit.") ); exitZs (1); } retval = loadInit(_filename, m_password); if (retval != PWERR_GOOD) { - qWarning ("Error loading Document"); + owarn << "Error loading Document" << oendl; return false; } } else { #ifdef WIN32 this->setCaption("Qt ZSafe"); #else this->setCaption("ZSafe"); #endif filename = ""; return false; } // load the validation entry if (validationFlag == 0) { pwdOk = 1; break; } retval = loadEntry(entry); if (retval == 1 && @@ -2280,49 +2275,49 @@ bool ZSafe::saveDocument(const char* _filename, } if (saveFinalize() == PWERR_DATA) { 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; void ZSafe::setPasswordDialogDone() { newPwdDialogResult = true; newPwdDialog->close(); } void ZSafe::getDocPassword(QString title) { -qWarning ("getDocPassword"); + owarn << "getDocPassword" << oendl; // open the 'Password' dialog PasswordForm *dialog = new PasswordForm(this, title, TRUE); newPwdDialog = dialog; newPwdDialogResult = false; connect( dialog->PasswordField, SIGNAL( returnPressed() ), this, SLOT( setPasswordDialogDone() ) ); // CS: !!! // int pos = filename.findRev ('/'); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); #ifdef WIN32 dialog->setCaption("Qt " + ti); #else dialog->setCaption(ti); #endif // dialog->setCaption(title); dialog->PasswordField->setFocus(); DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP result = Accepted; #endif @@ -2459,49 +2454,49 @@ int ZSafe::saveFinalize(void) * over, leaving us 3 short, so we fill it in with 3's. * * If we come out even, we fill it with 8 8s * * um, except that in this instance we are using 4 shorts instead of 8 bytes. * so, half everything */ for (count1 = bufferIndex; count1 < 4; count1++) { plaintext[count1] = (4 - bufferIndex); } krc2->rc2_encrypt (plaintext); for (count1 = 0; count1 < 4; count1++) { ciphertext[count1] = iv[count1] ^ plaintext[count1]; if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA; if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA; } fclose (fd); free(buffer); return retval; } void ZSafe::quitMe () { - qWarning ("QUIT..."); + owarn << "QUIT..." << oendl; if (modified) { switch( QMessageBox::information( this, tr("ZSafe"), tr("Do you want to save\nbefore exiting?"), tr("&Save"), tr("S&ave with\nnew\npassword"), tr("&Don't Save"), 0 // Enter == button 0 ) ) { // Escape == button 2 case 0: // Save clicked, Alt-S or Enter pressed. // save modified = false; saveDocument(filename, FALSE); exitZs (1); break; case 1: // // Save with new password modified = false; saveDocument(filename, TRUE); exitZs (1); break; case 2: // Don't Save clicked or Alt-D pressed @@ -2663,49 +2658,49 @@ void ZSafe::addCategory() waitDialog.hide(); } #ifndef WIN32 dialog->show(); #endif #ifndef DESKTOP // dialog->move (20, 100); #endif DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP result = Accepted; #endif QString category; QString icon; QString fullIconPath; QPixmap *pix; if (result == Accepted) { modified = true; category = dialog->CategoryField->currentText(); icon = dialog->IconField->currentText()+".png"; - qWarning (category); + owarn << category << oendl; QListViewItem *li = new ShadedListItem( 1, ListView ); Category *c1 = new Category(); c1->setCategoryName(category); // if (!icon.isEmpty() && !icon.isNull()) if (icon != "predefined.png") { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); // pix->resize(14, 14); if (pix) { // save the full pixmap name into the config file // #ifndef WIN32 conf->writeEntry(APP_KEY+category, icon); // #endif saveConf(); QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); c1->setIcon (*pix); c1->setIconName(icon); } @@ -3171,49 +3166,49 @@ void ZSafe::editCategory() // save the full pixmap name into the config file // #ifndef WIN32 conf->writeEntry(APP_KEY+category, icon); // #endif saveConf(); QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); cat->setIconName (icon); cat->setIcon (*pix); } } else { // #ifndef WIN32 conf->removeEntry (category); // #endif saveConf(); cat->setIcon (*getPredefinedIcon(category)); } // change the category name of the selected category QListViewItem *catItem = cat->getListItem(); if (catItem) { - qWarning (category); + owarn << category << oendl; catItem->setText( 0, tr( category ) ); cat->setCategoryName (tr(category)); cat->initListItem(); categories.insert (category, cat); } } saveCategoryDialogFields(dialog); } else { // delete dialog; dialog->hide(); return; } } } void ZSafe::cutItem() { if (!selectedItem) return; if (!isCategory(selectedItem)) @@ -3572,49 +3567,49 @@ void ZSafe::setExpandFlag() file->setItemChecked('o', expandTree); #ifndef DESKTOP conf->setGroup ("zsafePrefs"); #endif // #ifndef WIN32 conf->writeEntry (APP_KEY+"expandTree", expandTree); // #endif saveConf(); } void ZSafe::paintEvent( QPaintEvent * ) { if (raiseFlag) { raiseFlag = false; raiseTimer.start (1, true); if (infoForm->isVisible()) infoForm->raise(); } } void ZSafe::resizeEvent ( QResizeEvent * ) { - // qWarning ("resizeEvent"); + // owarn << "resizeEvent" << oendl; #ifndef DESKTOP DeskW = appl->desktop()->width(); DeskH = appl->desktop()->height(); #else DeskW = this->width(); DeskH = this->height(); #endif if (New) New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) ); if (Edit) Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) ); if (Delete) Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); if (Find) Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) ); } void ZSafe::slotRaiseTimer() { if (infoForm->isVisible()) infoForm->raise(); raiseFlag = true; } diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp index d61433f..837fcc5 100644 --- a/noncore/comm/keypebble/krfbdecoder.cpp +++ b/noncore/comm/keypebble/krfbdecoder.cpp @@ -166,54 +166,53 @@ void KRFBDecoder::gotServerInit() info->height = Swap16IfLE( info->height ); con->read( &(info->bpp), 1 ); con->read( &(info->depth), 1 ); con->read( &(info->bigEndian), 1 ); con->read( &(info->trueColor), 1 ); con->read( &(info->redMax), 2 ); info->redMax = Swap16IfLE( info->redMax ); con->read( &(info->greenMax), 2 ); info->greenMax = Swap16IfLE( info->greenMax ); 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 ); 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 ); + owarn << "Bpp = " << info->bpp << ", Depth = " << info->depth << ", Big = " << info->bigEndian + << ", True = " << info->trueColor << oendl; + owarn << "RedMax = " << info->redMax << ", GreenMax = " << info->greenMax << ", BlueMax = " << info->blueMax << oendl; + owarn << "RedShift = " << info->redShift << ", GreenShift = " << info->greenShift + << ", BlueShift = " << info-> blueShift << oendl; buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor); // Wait 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 ); owarn << "Got desktop name" << oendl; disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotDesktopName() ) ); @@ -243,54 +242,51 @@ void KRFBDecoder::gotDesktopName() } void KRFBDecoder::decidePixelFormat() { assert( info ); if ( format ) delete format; format = new KRFBPixelFormat; CHECK_PTR( format ); // What depth do we want? // // We'll use the minimum of the remote and local depths, UNLESS an // eight bit session has been specifically requested by the user. int screenDepth = QPixmap::defaultDepth(); int bestDepth = ( screenDepth > info->depth ) ? info->depth : screenDepth; int chosenDepth; if ( con->options()->colors256 ) chosenDepth = 8; else chosenDepth = bestDepth; - qWarning( "Screen depth=%d, server depth=%d, best depth=%d, " \ - "eight bit %d, chosenDepth=%d", - screenDepth, - info->depth, - bestDepth, - con->options()->colors256, chosenDepth ); + owarn << "Screen depth=" << screenDepth << ", server depth=" << info->depth + << ", best depth=" << bestDepth << "eight bit " << con->options()->colors256 + << ", chosenDepth=" << chosenDepth << oendl; format->depth = chosenDepth; // If we're using the servers native depth if ( chosenDepth == info->depth ) { // Use the servers native format format->bpp = info->bpp; // format->bigEndian = info->bigEndian; format->bigEndian = true; format->trueColor = info->trueColor; format->redMax = info->redMax; format->greenMax = info->greenMax; format->blueMax = info->blueMax; format->redShift = info->redShift; format->greenShift = info->greenShift; format->blueShift = info->blueShift; } else { if ( chosenDepth == 8 ) { format->bpp = 8; format->bigEndian = true; format->trueColor = true; format->redMax = 7; format->greenMax = 7; @@ -420,50 +416,50 @@ void KRFBDecoder::gotUpdateHeader() } void KRFBDecoder::gotRectHeader() { assert( currentState == AwaitingRectHeader ); // 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 ); h = Swap16IfLE( h ); con->read( &encoding, 4 ); // CARD32 encodingLocal = Swap32IfLE( encoding ); - // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld", - // x, y, w, h, encodingLocal ); + // owarn << "Rect: x=" << x << ", y= " << y << ", w=" << w << ", h=" << h + // << ", encoding= " << encodingLocal << oendl; // // 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 ) { // owarn << "Raw encoding" << oendl; handleRawRect(); } else if ( encoding == CopyRectEncoding ) { // owarn << "CopyRect encoding" << oendl; handleCopyRect(); } else if ( encoding == RreEncoding ) { owarn << "RRE encoding" << oendl; handleRRERect(); } else if ( encoding == CorreEncoding ) { owarn << "CoRRE encoding" << oendl; handleCoRRERect(); } else if ( encoding == HexTileEncoding ) { diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 6c5f5ea..211314b 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -89,51 +89,51 @@ namespace { IconViewItem::IconViewItem( QIconView* view,const QString& path, const QString& name, bool isDir ) : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), m_noInfo( false ),m_textOnly(false),m_Pixset(false) { if ( isDir && !_dirPix ) _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); else if ( !isDir && !_unkPix ) _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); } inline void IconViewItem::setPixmap( const QPixmap & icon, bool recalc, bool redraw) { m_Pixset = true; calcRect(text()); } inline void IconViewItem::setPixmap( const QPixmap & icon) { m_Pixset = true; calcRect(text()); } inline QPixmap* IconViewItem::pixmap()const { -// qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d", -// rect().x(),rect().y(),rect().width(),rect().height(), -// iconView()->contentsX(), iconView()->contentsY()); +// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y() +// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX() +// << " " << iconView()->contentsY() << oendl; if (textOnly()&&!m_isDir) { if (!_emptyPix) _emptyPix = new QPixmap(0,0,1); return _emptyPix; } if ( m_isDir ) return _dirPix; else{ if (!m_noInfo && !g_stringInf.contains( m_path ) ) { currentView()->dirLister()->imageInfo( m_path ); g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); } m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); if (!m_pix && !g_stringPix.contains( m_path )) { currentView()->dirLister()->thumbNail( m_path, 64, 64 ); g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); } return m_pix ? m_pix : _unkPix; } } inline void IconViewItem::setText( const QString& str ) { QString text = QIconViewItem::text()+"\n"+str; m_noInfo = true; diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp index 36e5dcf..aa15d31 100644 --- a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp +++ b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp @@ -1,45 +1,48 @@ #include "viewmodebutton.h" +/* OPIE */ #include <opie2/odebug.h> +using namespace Opie::Core; +/* QT */ #include <qtoolbar.h> #include <qpopupmenu.h> ViewModeButton::ViewModeButton( QToolBar* bar,int def ) : QToolButton( bar ) { slotChange( def ); QPopupMenu *pop= new QPopupMenu( this ); pop->setCheckable( true ); pop->insertItem( tr("Thumbnail and Imageinfo"), 1 ); pop->insertItem( tr("Thumbnail and Name" ), 2 ); pop->insertItem( tr("Name Only" ), 3 ); connect(pop, SIGNAL(activated(int)), this, SIGNAL(changeMode(int)) ); connect(pop, SIGNAL(activated(int)), this, SLOT(slotChange(int)) ); setPopup( pop ); } ViewModeButton::~ViewModeButton() { } void ViewModeButton::slotChange( int i ) { QString name; switch( i ) { case 1: name = "opie-eye/opie-eye-thumb"; break; case 2: name = "opie-eye/opie-eye-thumbonly"; break; case 3: name = "opie-eye/opie-eye-textview"; break; } - qWarning("foo %d" +name, i ); + owarn << "foo " << name << oendl; setIconSet( Resource::loadIconSet( name ) ); } diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc index 04c50d9..f81066e 100644 --- a/noncore/net/opietooth/lib/device.cc +++ b/noncore/net/opietooth/lib/device.cc @@ -1,152 +1,157 @@ -#include <signal.h> +#include "device.h" +/* OPIE */ #include <opie2/oprocess.h> +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* STD */ +#include <signal.h> -#include "device.h" using namespace OpieTooth; using Opie::Core::OProcess; namespace { int parsePid( const QCString& par ){ int id=0; QString string( par ); QStringList list = QStringList::split( '\n', string ); for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ - qWarning("parsePID: %s", (*it).latin1() ); + owarn << "parsePID: " << (*it).latin1() << oendl; if( !(*it).startsWith("CSR") ){ id = (*it).toInt(); break; } } return id; } } Device::Device(const QString &device, const QString &mode, const QString &speed ) : QObject(0, "device") { - qWarning("OpieTooth::Device create" ); + owarn << "OpieTooth::Device create" << oendl; m_hci = 0; m_process = 0; m_attached = false; m_device = device; m_mode = mode; m_speed = speed; attach(); } Device::~Device(){ detach(); } void Device::attach(){ - qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() ); + owarn << "attaching " << m_device.latin1() << " " << m_mode.latin1() << " " << m_speed.latin1() << oendl; if(m_process == 0 ){ m_output.resize(0); - qWarning("new process to create" ); + owarn << "new process to create" << oendl; m_process = new OProcess(); *m_process << "hciattach"; *m_process << "-p"; *m_process << m_device << m_mode << m_speed; connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ), this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ), this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int ) ) ); connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ), this, SLOT(slotStdErr(Opie::Core::OProcess*,char*,int) ) ); if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ - qWarning("Could not start" ); + owarn << "Could not start" << oendl; delete m_process; m_process = 0; } }; } void Device::detach(){ delete m_hci; delete m_process; // kill the pid we got if(m_attached ){ //kill the pid - qWarning( "killing" ); + warn << "killing" << oendl; kill(pid, 9); } - qWarning("detached" ); + owarn << "detached" << oendl; } bool Device::isLoaded()const{ return m_attached; } QString Device::devName()const { return QString::fromLatin1("hci0"); }; void Device::slotExited( OProcess* proc) { - qWarning("prcess exited" ); + owarn << "prcess exited" << oendl; if(proc== m_process ){ - qWarning("proc == m_process" ); + owarn << "proc == m_process" << oendl; if( m_process->normalExit() ){ // normal exit - qWarning("normalExit" ); + owarn << "normalExit" << oendl; int ret = m_process->exitStatus(); if( ret == 0 ){ // attached - qWarning("attached" ); - qWarning("Output: %s", m_output.data() ); + owarn << "attached" << oendl; + owarn << "Output: " << m_output.data() << oendl; pid = parsePid( m_output ); - qWarning("Pid = %d", pid ); + owarn << "Pid = " << pid << oendl; // now hciconfig hci0 up ( determine hciX FIXME) // and call hciconfig hci0 up // FIXME hardcoded to hci0 now :( m_hci = new OProcess( ); *m_hci << "hciconfig"; *m_hci << "hci0 up"; connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); if(!m_hci->start() ){ - qWarning("could not start" ); + owarn << "could not start" << oendl; m_attached = false; emit device("hci0", false ); } }else{ - qWarning("crass" ); + owarn << "crass" << oendl; m_attached = false; emit device("hci0", false ); } } delete m_process; m_process = 0; }else if(proc== m_hci ){ - qWarning("M HCI exited" ); + owarn << "M HCI exited" << oendl; if( m_hci->normalExit() ){ - qWarning("normal exit" ); + owarn << "normal exit" << oendl; int ret = m_hci->exitStatus(); if( ret == 0 ){ - qWarning("attached really really attached" ); + owarn << "attached really really attached" << oendl; m_attached = true; emit device("hci0", true ); }else{ - qWarning( "failed" ); + owarn << "failed" << oendl; emit device("hci0", false ); m_attached = false; } }// normal exit delete m_hci; m_hci = 0; } } void Device::slotStdOut(OProcess* proc, char* chars, int len) { - qWarning("std out" ); + owarn << "std out" << oendl; if( len <1 ){ - qWarning( "len < 1 " ); + owarn << "len < 1 " << oendl; return; } if(proc == m_process ){ QCString string( chars, len+1 ); // \0 == +1 - qWarning("output: %s", string.data() ); + owarn << "output: " << string.data() << oendl; m_output.append( string.data() ); } } void Device::slotStdErr(OProcess* proc, char* chars, int len) { - qWarning("std err" ); + owarn << "std err" << oendl; slotStdOut( proc, chars, len ); } diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc index 18e1df9..76d9127 100644 --- a/noncore/net/opietooth/lib/manager.cc +++ b/noncore/net/opietooth/lib/manager.cc @@ -1,316 +1,317 @@ - -#include <opie2/oprocess.h> - #include "parser.h" #include "manager.h" +#include <opie2/oprocess.h> +#include <opie2/odebug.h> +using namespace Opie::Core; + using namespace OpieTooth; using Opie::Core::OProcess; Manager::Manager( const QString& dev ) : QObject() { - qWarning("created"); + owarn << "created" << oendl; m_device = dev; m_hcitool = 0; m_sdp = 0; } Manager::Manager( Device* /*dev*/ ) : QObject() { m_hcitool = 0; m_sdp = 0; } Manager::Manager() : QObject() { m_hcitool = 0; m_sdp = 0; } Manager::~Manager(){ delete m_hcitool; delete m_sdp; } void Manager::setDevice( const QString& dev ){ m_device = dev; } void Manager::setDevice( Device* /*dev*/ ){ } void Manager::isAvailable( const QString& device ){ OProcess* l2ping = new OProcess(); l2ping->setName( device.latin1() ); *l2ping << "l2ping" << "-c1" << device; connect(l2ping, SIGNAL(processExited(Opie::Core::OProcess* ) ), this, SLOT(slotProcessExited(Opie::Core::OProcess*) ) ); if (!l2ping->start() ) { emit available( device, false ); delete l2ping; } } void Manager::isAvailable( Device* /*dev*/ ){ } void Manager::searchDevices( const QString& device ){ - qWarning("search devices"); + owarn << "search devices" << oendl; OProcess* hcitool = new OProcess(); hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); *hcitool << "hcitool" << "scan"; connect( hcitool, SIGNAL(processExited(Opie::Core::OProcess*) ) , this, SLOT(slotHCIExited(Opie::Core::OProcess* ) ) ); connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), this, SLOT(slotHCIOut(Opie::Core::OProcess*, char*, int ) ) ); if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { - qWarning("could not start"); + owarn << "could not start" << oendl; RemoteDevice::ValueList list; emit foundDevices( device, list ); delete hcitool; } } void Manager::searchDevices(Device* /*d*/ ){ } void Manager::addService(const QString& name ){ OProcess proc; proc << "sdptool" << "add" << name; bool bo = true; if (!proc.start(OProcess::DontCare ) ) bo = false; emit addedService( name, bo ); } void Manager::addServices(const QStringList& list){ QStringList::ConstIterator it; for (it = list.begin(); it != list.end(); ++it ) addService( (*it) ); } void Manager::removeService( const QString& name ){ OProcess prc; prc << "sdptool" << "del" << name; bool bo = true; if (!prc.start(OProcess::DontCare ) ) bo = false; emit removedService( name, bo ); } void Manager::removeServices( const QStringList& list){ QStringList::ConstIterator it; for (it = list.begin(); it != list.end(); ++it ) removeService( (*it) ); } void Manager::searchServices( const QString& remDevice ){ OProcess *m_sdp =new OProcess(); *m_sdp << "sdptool" << "browse" << remDevice; m_sdp->setName( remDevice.latin1() ); - qWarning("search Services for %s", remDevice.latin1() ); + owarn << "search Services for " << remDevice.latin1() << oendl; connect(m_sdp, SIGNAL(processExited(Opie::Core::OProcess*) ), this, SLOT(slotSDPExited(Opie::Core::OProcess* ) ) ); connect(m_sdp, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), this, SLOT(slotSDPOut(Opie::Core::OProcess*, char*, int) ) ); if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { - qWarning("could not start sdptool" ); + owarn << "could not start sdptool" << oendl; delete m_sdp; Services::ValueList list; emit foundServices( remDevice, list ); } } void Manager::searchServices( const RemoteDevice& dev){ searchServices( dev.mac() ); } QString Manager::toDevice( const QString& /*mac*/ ){ return QString::null; } QString Manager::toMac( const QString &/*device*/ ){ return QString::null; } void Manager::slotProcessExited(OProcess* proc ) { bool conn= false; if (proc->normalExit() && proc->exitStatus() == 0 ) conn = true; QString name = QString::fromLatin1(proc->name() ); emit available( name, conn ); delete proc; } void Manager::slotSDPOut(OProcess* proc, char* ch, int len) { QCString str(ch, len+1 ); - qWarning("SDP:%s", str.data() ); + owarn << "SDP:" << str.data() << oendl; QMap<QString, QString>::Iterator it; it = m_out.find(proc->name() ); QString string; if ( it != m_out.end() ) { string = it.data(); } string.append( str ); m_out.replace( proc->name(), string ); } void Manager::slotSDPExited( OProcess* proc) { - qWarning("proc name %s", proc->name() ); + owarn << "proc name " << proc->name() << oendl; Services::ValueList list; if (proc->normalExit() ) { QMap<QString, QString>::Iterator it = m_out.find( proc->name() ); if ( it != m_out.end() ) { - qWarning("found process" ); + owarn << "found process" << oendl; list = parseSDPOutput( it.data() ); m_out.remove( it ); } } emit foundServices( proc->name(), list ); delete proc; } Services::ValueList Manager::parseSDPOutput( const QString& out ) { Services::ValueList list; - qWarning("parsing output" ); + owarn << "parsing output" << oendl; Parser parser( out ); list = parser.services(); return list; } void Manager::slotHCIExited(OProcess* proc ) { - qWarning("process exited"); + owarn << "process exited" << oendl; RemoteDevice::ValueList list; if (proc->normalExit() ) { - qWarning("normalExit %s", proc->name() ); + owarn << "normalExit " << proc->name() << oendl; QMap<QString, QString>::Iterator it = m_devices.find(proc->name() ); if (it != m_devices.end() ) { - qWarning("!= end ;)"); + owarn << "!= end ;)" << oendl; list = parseHCIOutput( it.data() ); m_devices.remove( it ); } } emit foundDevices( proc->name(), list ); delete proc; } void Manager::slotHCIOut(OProcess* proc, char* ch, int len) { QCString str( ch, len+1 ); - qWarning("hci: %s", str.data() ); + owarn << "hci: " << str.data() oendl; QMap<QString, QString>::Iterator it; it = m_devices.find( proc->name() ); - qWarning("proc->name %s", proc->name() ); + owarn << "proc->name " << proc->name() << oendl; QString string; if (it != m_devices.end() ) { - qWarning("slotHCIOut "); + owarn << "slotHCIOut " << oendl; string = it.data(); } string.append( str ); m_devices.replace( proc->name(), string ); } RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) { - qWarning("parseHCI %s", output.latin1() ); + owarn << "parseHCI " << output.latin1() << oendl; RemoteDevice::ValueList list; QStringList strList = QStringList::split('\n', output ); QStringList::Iterator it; QString str; for ( it = strList.begin(); it != strList.end(); ++it ) { str = (*it).stripWhiteSpace(); - qWarning("OpieTooth %s", str.latin1() ); + owarn << "OpieTooth " << str.latin1() << oendl; int pos = str.findRev(':' ); if ( pos > 0 ) { QString mac = str.left(17 ); str.remove( 0, 17 ); - qWarning("mac %s", mac.latin1() ); - qWarning("rest:%s", str.latin1() ); + owarn << "mac " << mac.latin1() << oendl; + owarn << "rest: " << str.latin1() << oendl; RemoteDevice rem( mac , str.stripWhiteSpace() ); list.append( rem ); } } return list; } ////// hcitool cc and hcitool con /** * Create it on the stack as don't care * so we don't need to care for it * cause hcitool gets reparented */ void Manager::connectTo( const QString& mac) { OProcess proc; proc << "hcitool"; proc << "cc"; proc << mac; proc.start(OProcess::DontCare); // the lib does not care at this point } void Manager::searchConnections() { - qWarning("searching connections?"); + owarn << "searching connections?" << oendl; OProcess* proc = new OProcess(); m_hcitoolCon = QString::null; connect(proc, SIGNAL(processExited(Opie::Core::OProcess*) ), this, SLOT(slotConnectionExited( Opie::Core::OProcess*) ) ); connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ), this, SLOT(slotConnectionOutput(Opie::Core::OProcess*, char*, int) ) ); *proc << "hcitool"; *proc << "con"; if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { ConnectionState::ValueList list; emit connections( list ); delete proc; } } void Manager::slotConnectionExited( OProcess* proc ) { ConnectionState::ValueList list; list = parseConnections( m_hcitoolCon ); emit connections(list ); delete proc; } void Manager::slotConnectionOutput(OProcess* /*proc*/, char* cha, int len) { QCString str(cha, len ); m_hcitoolCon.append( str ); //delete proc; } ConnectionState::ValueList Manager::parseConnections( const QString& out ) { ConnectionState::ValueList list2; QStringList list = QStringList::split('\n', out ); QStringList::Iterator it; // remove the first line ( "Connections:") it = list.begin(); it = list.remove( it ); for (; it != list.end(); ++it ) { QString row = (*it).stripWhiteSpace(); QStringList value = QStringList::split(' ', row ); - qWarning("0: %s", value[0].latin1() ); - qWarning("1: %s", value[1].latin1() ); - qWarning("2: %s", value[2].latin1() ); - qWarning("3: %s", value[3].latin1() ); - qWarning("4: %s", value[4].latin1() ); - qWarning("5: %s", value[5].latin1() ); - qWarning("6: %s", value[6].latin1() ); - qWarning("7: %s", value[7].latin1() ); - qWarning("8: %s", value[8].latin1() ); + owan << "0: %s" << value[0].latin1() << oendl; + owan << "1: %s" << value[1].latin1() << oendl; + owan << "2: %s" << value[2].latin1() << oendl; + owan << "3: %s" << value[3].latin1() << oendl; + owan << "4: %s" << value[4].latin1() << oendl; + owan << "5: %s" << value[5].latin1() << oendl; + owan << "6: %s" << value[6].latin1() << oendl; + owan << "7: %s" << value[7].latin1() << oendl; + owan << "8: %s" << value[8].latin1() << oendl; ConnectionState con; con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming ); con.setConnectionMode( value[1] ); con.setMac( value[2] ); con.setHandle( value[4].toInt() ); con.setState( value[6].toInt() ); con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client ); list2.append( con ); } return list2; } void Manager::signalStrength( const QString &mac ) { OProcess* sig_proc = new OProcess(); connect(sig_proc, SIGNAL(processExited(Opie::Core::OProcess*) ), this, SLOT(slotSignalStrengthExited( Opie::Core::OProcess*) ) ); connect(sig_proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ), this, SLOT(slotSignalStrengthOutput(Opie::Core::OProcess*, char*, int) ) ); *sig_proc << "hcitool"; *sig_proc << "lq"; *sig_proc << mac; diff --git a/noncore/net/opietooth/lib/parser.cc b/noncore/net/opietooth/lib/parser.cc index 8baf284..7e95907 100644 --- a/noncore/net/opietooth/lib/parser.cc +++ b/noncore/net/opietooth/lib/parser.cc @@ -1,199 +1,205 @@ +#include "parser.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qstringlist.h> -#include "parser.h" using namespace OpieTooth; namespace { // "Test Foo Bar" (0x3456) // @param ret Test Foo Bar // @eturn 13398 // tactic find " ( int convert( const QString& line, QString& ret ) { -// qWarning("called"); +// owarn << "called" << oendl; ret = QString::null; int i = 0; int pos = line.findRev("\" ("); if ( pos > 0 ) { // it shouldn't be at pos 0 ret = line.left(pos ).stripWhiteSpace(); - // qWarning("ret: %s", ret.latin1() ); + // owarn << "ret: " << ret.latin1() << oendl; ret = ret.replace(QRegExp("[\"]"), ""); - //qWarning("ret: %s", ret.latin1() ); + //owarn << "ret: " << ret.latin1() << oendl; QString dummy = line.mid(pos + 5 ); - //qWarning("dummy: %s", dummy.latin1() ); + //owarn << "dummy: " << dummy.latin1() << oendl; dummy = dummy.replace(QRegExp("[)]"), ""); - //qWarning("dummy: %s", dummy.latin1() ); + //owarn << "dummy: " << dummy.latin1() << oendl; // dummy = dummy.remove( dummy.length() -2, 1 ); // remove the ) bool ok; i = dummy.toInt(&ok, 16 ); //if (ok ) { - // qWarning("converted %d", i); - //}else qWarning("failed" ); - //qWarning("exiting"); + // owarn << "converted " << i << oendl; + //}else owarn << "failed" << oendl; + //owarn << "exiting" << oendl; return i; } - //qWarning("output %d", i ); + //owarn << "output " << i << oendl; return i; } }; Parser::Parser(const QString& output ) { parse( output ); } void Parser::setText(const QString& output) { parse( output ); } Services::ValueList Parser::services() const { return m_list; } void Parser::parse( const QString& string) { m_list.clear(); m_complete = true; QStringList list = QStringList::split('\n', string,TRUE ); QStringList::Iterator it; for (it = list.begin(); it != list.end(); ++it ) { - //qWarning("line:%s:line", (*it).latin1() ); + //owarn << "line:" << (*it).latin1() << oendl; if ( (*it).startsWith("Browsing") ) continue; if ( (*it).stripWhiteSpace().isEmpty() ) { // line is empty because a new Service begins - qWarning("could add"); + owarn << "could add" << oendl; // now see if complete and add if (m_complete ) { if (!m_item.serviceName().isEmpty() ) m_list.append( m_item ); Services serv; m_item = serv; m_complete = true; continue; } } if (parseName( (*it) ) ) ;//continue; if (parseRecHandle( (*it) ) ) ;//continue; if (parseClassId( (*it) ) ) ;//continue; if (parseProtocol( (*it) ) ) ;//continue; if (parseProfile( (*it) ) ) ;//continue; } // missed the last one if (m_complete) { -// qWarning("adding"); +// owarn << "adding" << oendl; if (!m_item.serviceName().isEmpty() ) m_list.append(m_item ); } QValueList<Services>::Iterator it2; if (m_list.isEmpty() ) - qWarning("m_list is empty"); + owarn << "m_list is empty" << oendl; for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) { - qWarning("name %s", (*it2).serviceName().latin1() ); + owarn << "name " << (*it2).serviceName().latin1() << oendl; } } bool Parser::parseName( const QString& str) { if (str.startsWith("Service Name:") ) { m_item.setServiceName( str.mid(13).stripWhiteSpace() ); - qWarning(m_item.serviceName() ); + owarn << m_item.serviceName() << oendl; return true; } return false; } bool Parser::parseRecHandle( const QString& str) { if (str.startsWith("Service RecHandle:" ) ) { QString out = str.mid(18 ).stripWhiteSpace(); - qWarning("out %s", out.latin1() ); + owarn << "out " << out.latin1() << oendl; int value = out.mid(2).toInt(&m_ok, 16 ); if (m_ok && (value != -1) ) m_complete = true; else m_complete = false; - qWarning("rec handle %d", value); + owarn << "rec handle " << value << oendl; m_item.setRecHandle( value ); return true; } return false; } bool Parser::parseClassId( const QString& str) { if (str.startsWith("Service Class ID List:") ) { - qWarning("found class id" ); - qWarning("line:%s", str.latin1() ); + owarn << "found class id" << oendl; + owarn << "line: " << str.latin1() << oendl; m_classOver = true; return true; }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place - qWarning("line with class id" ); - qWarning("%s",str.latin1() ); + owarn << "line with class id" << oendl; + owarn << str.latin1() << oendl; // "Obex Object Push" (0x1105) // find backwards the " and the from 0 to pos and the mid pos+1 // then stripWhiteSpace add name replace '"' with "" // and then convert 0x1105 toInt() QString classes; int ids; ids = convert( str, classes ); - qWarning("ids %d", ids ); + owarn << "ids " << ids << oendl; m_item.insertClassId( ids, classes ); return true; }else{ - qWarning("Else %d", m_classOver ); + owarn << "Else " << m_classOver << oendl; m_classOver = false; } return false; } bool Parser::parseProtocol( const QString& str) { if (str.startsWith("Protocol Descriptor List:") ) { m_protocolOver = true; m_protocolAdded = false; return true; }else if (m_protocolOver && str.startsWith(" ") ) { // "L2CAP" (0x0100) - qWarning("double protocol filter"); + owarn << "double protocol filter" << oendl; if (!m_protocolAdded ) { // the protocol does neither supply a channel nor port so add it now Services::ProtocolDescriptor desc( m_protName, m_protId ); m_item.insertProtocolDescriptor( desc ); } m_protocolAdded = false; { // the find function m_protId = convert(str, m_protName ); } return true; }else if (m_protocolOver && str.startsWith(" ") ) { - qWarning("tripple protocol filter"); + owarn << "tripple protocol filter" << oendl; m_protocolAdded = true; QString dummy = str.stripWhiteSpace(); int pos = dummy.findRev(':'); if ( pos > -1 ) { int port = dummy.mid(pos+1 ).stripWhiteSpace().toInt(); Services::ProtocolDescriptor desc( m_protName, m_protId, port ); m_item.insertProtocolDescriptor( desc ); } return true; }else if (m_protocolOver ) { m_protocolOver = false; } return false; } bool Parser::parseProfile( const QString& str) { if (str.startsWith("Profile Descriptor List:") ) { m_profOver = true; }else if ( m_profOver && str.startsWith(" ") ) { m_profId = convert( str, m_profName ); }else if ( m_profOver && str.startsWith(" ") ) { // now find int pos = str.findRev(':'); if ( pos > 0 ) { int dummy = str.mid(pos+1 ).stripWhiteSpace().toInt(); - qWarning("dummyInt:%d", dummy ); + owarn << "dummyInt: " << dummy << oendl; Services::ProfileDescriptor desc( m_profName, m_profId, dummy ); m_item.insertProfileDescriptor(desc); } }else m_profOver = false; return false; } diff --git a/noncore/settings/mediummount/mediumglobal.cc b/noncore/settings/mediummount/mediumglobal.cc index ab0b3af..0c6cf12 100644 --- a/noncore/settings/mediummount/mediumglobal.cc +++ b/noncore/settings/mediummount/mediumglobal.cc @@ -1,38 +1,43 @@ +#include "mediumglobal.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; +#include <qpe/config.h> +/* QT */ #include <qlineedit.h> #include <qcheckbox.h> #include <qlabel.h> #include <qabstractlayout.h> // spacer item #include <qlayout.h> #include <qframe.h> #include <qgroupbox.h> #include <qwhatsthis.h> -#include <qpe/config.h> -#include "mediumglobal.h" using namespace MediumMountSetting; /* TRANSLATOR MediumMountSetting::MediumGlobalWidget */ MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name ) : QWidget( wid, name, WStyle_ContextHelp ) { m_config = 0; initGUI(); readConfig(); } void MediumGlobalWidget::initGUI() { m_layout = new QVBoxLayout(this ); m_layout->setMargin( 4 ); // m_layout->setSpacing( 10 ); m_label = new QLabel( this ); m_label->setTextFormat( Qt::RichText ); m_label->setText( tr("") ); QWhatsThis::add( this, tr("If a medium gets inserted into this device Opie " @@ -131,49 +136,49 @@ void MediumGlobalWidget::writeConfig() m_config->setGroup( "main" ); m_config->writeEntry("global", m_useglobal->isChecked() ); m_config->writeEntry("use", m_check->isChecked() ); m_config->setGroup("mimetypes" ); m_config->writeEntry("all", m_all->isChecked() ); m_config->writeEntry("audio", m_audio->isChecked() ); m_config->writeEntry("video", m_video->isChecked() ); m_config->writeEntry("text", m_text->isChecked() ); m_config->writeEntry("image", m_image->isChecked() ); } MediumGlobalWidget::~MediumGlobalWidget() { delete m_config; } void MediumGlobalWidget::slotGlobalChanged() { int mode = GLOBAL_DISABLED; bool enabled = false; if( ( enabled =m_useglobal->isChecked() ) ){ mode = GLOBAL_ENABLED; }else mode = GLOBAL_DISABLED; - qWarning("enabled = %d", enabled ); + owarn << "enabled = " << enabled << oendl; m_all->setEnabled ( enabled ); m_audio->setEnabled( enabled ); m_image->setEnabled( enabled ); m_text->setEnabled ( enabled ); m_video->setEnabled ( enabled ); slotAllChanged(); emit globalStateChanged( mode ); } void MediumGlobalWidget::slotEnableChecking() { int mode = ENABLE_CHECKS; bool enabled = false; if( ( enabled = m_check->isChecked() ) ){ mode = ENABLE_CHECKS; }else{ mode = DISABLE_CHECKS; } m_frame->setEnabled( enabled ); slotGlobalChanged(); emit enableStateChanged( mode ); } void MediumGlobalWidget::slotAllChanged() { diff --git a/noncore/styles/theme/othemebase.h b/noncore/styles/theme/othemebase.h index e691692..5519798 100644 --- a/noncore/styles/theme/othemebase.h +++ b/noncore/styles/theme/othemebase.h @@ -1,93 +1,98 @@ /* This file is part of the KDE libraries Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public 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. */ #ifndef __OTHEMEBASE_H #define __OTHEMEBASE_H +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qdatetime.h> #include <qtimer.h> #include <qwindowsstyle.h> #include <qpixmap.h> #include <qpe/config.h> #include <qimage.h> #include <qintcache.h> #include <qstring.h> #include <qpalette.h> #define WIDGETS 54 /** * This class adds simple time management to QPixmap for use in flushing * OThemeCache. * * @author Daniel M. Duley <mosfet@kde.org> */ class OThemePixmap : public QPixmap { public: enum BorderType{Top = 0, Bottom, Left, Right, TopLeft, TopRight, BottomLeft, BottomRight}; OThemePixmap( bool timer = true ); OThemePixmap( const OThemePixmap &p ); ~OThemePixmap(); QPixmap* border( BorderType type ); void setBorder( BorderType type, const QPixmap &p ); void updateAccessed(); bool isOld(); protected: QTime *t; QPixmap *b[ 8 ]; private: class OThemePixmapPrivate; OThemePixmapPrivate *d; }; inline QPixmap* OThemePixmap::border( BorderType type ) { return ( b[ type ] ); } inline void OThemePixmap::setBorder( BorderType type, const QPixmap &p ) { if ( b[ type ] ) { - qWarning( "OThemePixmap: Overwriting existing border!" ); + owarn << "OThemePixmap: Overwriting existing border!" << oendl; delete( b[ type ] ); } b[ type ] = new QPixmap( p ); } inline void OThemePixmap::updateAccessed() { if (t) t->start(); } inline bool OThemePixmap::isOld() { return ( t ? t->elapsed() >= 300000 : false ); } /** * A very simple pixmap cache for theme plugins. QPixmapCache is not used * since it uses QString keys which are not needed. All the information we * need can be encoded in a numeric key. Using QIntCache instead allows us to * skip the string operations. * * This class is mostly just inline methods that do bit operations on a key * composed of the widget ID, width and/or height, and then calls |