174 files changed, 812 insertions, 816 deletions
diff --git a/libqtaux/ocolorbutton.cpp b/libqtaux/ocolorbutton.cpp index fd3f963..9e41d93 100644 --- a/libqtaux/ocolorbutton.cpp +++ b/libqtaux/ocolorbutton.cpp @@ -14,97 +14,97 @@ .i_,=:_. -<s. 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 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 "ocolorpopupmenu.h" #include "ocolorbutton.h" /* OPIE */ /* QT */ #include <qimage.h> using namespace Opie; struct OColorButtonPrivate { QPopupMenu *m_menu; QColor m_color; }; /** * This concstructs a Color Button with @param color as the start color * It'll use a OColorPopupMenu internally * * @param parent The parent of the Color Button * @param color The color from where to start on * @param name @see QObject */ OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) : QPushButton ( parent, name ) { d = new OColorButtonPrivate; d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); setPopup ( d-> m_menu ); // setPopupDelay ( 0 ); - connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); + connect ( d-> m_menu, SIGNAL( colorSelected(const QColor&)), this, SLOT( updateColor(const QColor&))); updateColor ( color ); QSize s = sizeHint ( ) + QSize ( 12, 0 ); setMinimumSize ( s ); setMaximumSize ( s. width ( ) * 2, s. height ( )); } /** * This destructs the object */ OColorButton::~OColorButton ( ) { delete d; } /** * @return Returns the current color of the button */ QColor OColorButton::color ( ) const { return d-> m_color; } /** * This method sets the color of the button * @param c The color to be set. */ void OColorButton::setColor ( const QColor &c ) { updateColor ( c ); } /** * @internal */ void OColorButton::updateColor ( const QColor &c ) { d-> m_color = c; QImage img ( 16, 16, 32 ); img. fill ( 0 ); int r, g, b; c. rgb ( &r, &g, &b ); int w = img. width ( ); int h = img. height ( ); diff --git a/libqtaux/ocolorpopupmenu.cpp b/libqtaux/ocolorpopupmenu.cpp index c5b2b88..4da2a0e 100644 --- a/libqtaux/ocolorpopupmenu.cpp +++ b/libqtaux/ocolorpopupmenu.cpp @@ -110,66 +110,66 @@ OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const ch addColor(QColor(0, 0, 0), 0, 5); addColor(QColor(255, 0, 0), 1, 0); addColor(QColor(255, 128, 0), 1, 1); addColor(QColor(255, 255, 0), 1, 2); addColor(QColor(128, 255, 0), 1, 3); addColor(QColor(0, 255, 0), 1, 4); addColor(QColor(0, 255, 128), 1, 5); addColor(QColor(128, 0, 0), 2, 0); addColor(QColor(128, 64, 0), 2, 1); addColor(QColor(128, 128, 0), 2, 2); addColor(QColor(64, 128, 0), 2, 3); addColor(QColor(0, 128, 0), 2, 4); addColor(QColor(0, 128, 64), 2, 5); addColor(QColor(0, 255, 255), 3, 0); addColor(QColor(0, 128, 255), 3, 1); addColor(QColor(0, 0, 255), 3, 2); addColor(QColor(128, 0, 255), 3, 3); addColor(QColor(255, 0, 255), 3, 4); addColor(QColor(255, 0, 128), 3, 5); addColor(QColor(0, 128, 128), 4, 0); addColor(QColor(0, 64, 128), 4, 1); addColor(QColor(0, 0, 128), 4, 2); addColor(QColor(64, 0, 128), 4, 3); addColor(QColor(128, 0, 128), 4, 4); addColor(QColor(128, 0, 64), 4, 5); insertItem( colorPanel ); insertSeparator(); insertItem(tr("More"),this,SLOT( moreColorClicked())); /* QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" ); connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) ); chooseColorAction->addTo( this ); */ activateItemAt( 0 ); } OColorPopupMenu::~OColorPopupMenu() { } void OColorPopupMenu::addColor( const QColor& color, int row, int col ) { OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel ); - connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) ); + connect( panelButton, SIGNAL( selected(const QColor&) ), this, SLOT( buttonSelected(const QColor&) ) ); colorLayout->addWidget( panelButton, row, col ); } void OColorPopupMenu::buttonSelected( const QColor& color ) { m_color = color; emit colorSelected( color ); hide(); } void OColorPopupMenu::moreColorClicked() { QColor color = QColorDialog::getColor( m_color ); m_color = color; emit colorSelected( color ); hide(); } diff --git a/library/datebookmonth.cpp b/library/datebookmonth.cpp index 76e022f..421559e 100644 --- a/library/datebookmonth.cpp +++ b/library/datebookmonth.cpp @@ -24,99 +24,99 @@ #include <qpe/qpeapplication.h> #include <qtoolbutton.h> #include <qspinbox.h> #include <qcombobox.h> #include <qvaluestack.h> #include <qwhatsthis.h> DateBookMonthHeader::DateBookMonthHeader( QWidget *parent, const char *name ) : QHBox( parent, name ) { setBackgroundMode( PaletteButton ); begin = new QToolButton( this ); begin->setFocusPolicy(NoFocus); begin->setPixmap( Resource::loadPixmap( "start" ) ); begin->setAutoRaise( TRUE ); begin->setFixedSize( begin->sizeHint() ); QWhatsThis::add( begin, tr("Show January in the selected year") ); back = new QToolButton( this ); back->setFocusPolicy(NoFocus); back->setPixmap( Resource::loadPixmap( "back" ) ); back->setAutoRaise( TRUE ); back->setFixedSize( back->sizeHint() ); QWhatsThis::add( back, tr("Show the previous month") ); month = new QComboBox( FALSE, this ); for ( int i = 0; i < 12; ++i ) month->insertItem( Calendar::nameOfMonth( i + 1 ) ); year = new QSpinBox( 1752, 8000, 1, this ); next = new QToolButton( this ); next->setFocusPolicy(NoFocus); next->setPixmap( Resource::loadPixmap( "forward" ) ); next->setAutoRaise( TRUE ); next->setFixedSize( next->sizeHint() ); QWhatsThis::add( next, tr("Show the next month") ); end = new QToolButton( this ); end->setFocusPolicy(NoFocus); end->setPixmap( Resource::loadPixmap( "finish" ) ); end->setAutoRaise( TRUE ); end->setFixedSize( end->sizeHint() ); QWhatsThis::add( end, tr("Show December in the selected year") ); - connect( month, SIGNAL( activated( int ) ), + connect( month, SIGNAL( activated(int) ), this, SLOT( updateDate() ) ); - connect( year, SIGNAL( valueChanged( int ) ), + connect( year, SIGNAL( valueChanged(int) ), this, SLOT( updateDate() ) ); connect( begin, SIGNAL( clicked() ), this, SLOT( firstMonth() ) ); connect( end, SIGNAL( clicked() ), this, SLOT( lastMonth() ) ); connect( back, SIGNAL( clicked() ), this, SLOT( monthBack() ) ); connect( next, SIGNAL( clicked() ), this, SLOT( monthForward() ) ); back->setAutoRepeat( TRUE ); next->setAutoRepeat( TRUE ); } DateBookMonthHeader::~DateBookMonthHeader() { } void DateBookMonthHeader::updateDate() { emit dateChanged( year->value(), month->currentItem() + 1 ); } void DateBookMonthHeader::firstMonth() { emit dateChanged( year->value(), 1 ); month->setCurrentItem( 0 ); } void DateBookMonthHeader::lastMonth() { emit dateChanged( year->value(), 12 ); month->setCurrentItem( 11 ); } void DateBookMonthHeader::monthBack() { if ( month->currentItem() > 0 ) { emit dateChanged( year->value(), month->currentItem() ); month->setCurrentItem( month->currentItem() - 1 ); } else { emit dateChanged( year->value() - 1, 12 ); // we have a signal set to a changed value in year so we only need to change // year to get the result... month->setCurrentItem( 11 ); year->setValue( year->value() - 1 ); } @@ -142,100 +142,100 @@ void DateBookMonthHeader::setDate( int y, int m ) } //--------------------------------------------------------------------------- class DateBookMonthTablePrivate { public: DateBookMonthTablePrivate() {}; ~DateBookMonthTablePrivate() { mMonthEvents.clear(); }; QValueList<EffectiveEvent> mMonthEvents; bool onMonday; }; DateBookMonthTable::DateBookMonthTable( QWidget *parent, const char *name, DateBookDB *newDb ) : QTable( 6, 7, parent, name ), db( newDb ) { d = new DateBookMonthTablePrivate(); selYear = -1; selMonth = -1; selDay = -1; /* init these as well make valgrind happy and be consistent with Qtopia1.6 -zecke */ year = -1; month = -1; day = -1; Config cfg( "qpe" ); cfg.setGroup( "Time" ); d->onMonday = cfg.readBoolEntry( "MONDAY" ); horizontalHeader()->setResizeEnabled( FALSE ); // we have to do this here... or suffer the consequences later... for ( int i = 0; i < 7; i++ ){ horizontalHeader()->resizeSection( i, 30 ); setColumnStretchable( i, TRUE ); } setupLabels(); verticalHeader()->hide(); setLeftMargin( 0 ); for ( int i = 0; i < 6; ++i ) setRowStretchable( i, TRUE ); setSelectionMode( NoSelection ); - connect( this, SIGNAL( clicked( int, int, int, const QPoint & ) ), - this, SLOT( dayClicked( int, int ) ) ); - connect( this, SIGNAL( currentChanged( int, int ) ), - this, SLOT( dragDay( int, int ) ) ); + connect( this, SIGNAL( clicked(int,int,int,const QPoint&) ), + this, SLOT( dayClicked(int,int) ) ); + connect( this, SIGNAL( currentChanged(int,int) ), + this, SLOT( dragDay(int,int) ) ); setVScrollBarMode( AlwaysOff ); setHScrollBarMode( AlwaysOff ); } DateBookMonthTable::~DateBookMonthTable() { monthsEvents.clear(); delete d; } void DateBookMonthTable::setDate(int y, int m, int d) { if (month == m && year == y) { if ( selYear == -1 ) year = selYear; if ( selMonth == -1 ) month = selMonth; int r1, c1, r2, c2; findDay(selDay, r1, c1); selDay = day = d; findDay(selDay, r2, c2); setCurrentCell( r2, c2 ); //updateCell(r1,c1); //updateCell(r2,c2); } else { selYear = year = y; selMonth = month = m; selDay = day = d; setupTable(); } } void DateBookMonthTable::redraw() { setupLabels(); setupTable(); } void DateBookMonthTable::setWeekStart( bool onMonday ) { d->onMonday = onMonday; setupLabels(); setupTable(); } void DateBookMonthTable::setupTable() { QValueList<Calendar::Day> days = Calendar::daysOfMonth( year, month, d->onMonday ); @@ -349,100 +349,100 @@ void DateBookMonthTable::getEvents() && e.date() == (*it).date() ) { dayEvent.append( *it ); ++it; } int row, col; findDay( e.date().day(), row, col ); DayItemMonth* w = static_cast<DayItemMonth*>( item( row, col ) ); w->setEvents( dayEvent ); updateCell( row, col ); dayEvent.clear(); } } void DateBookMonthTable::setupLabels() { for ( int i = 0; i < 7; ++i ) { // horizontalHeader()->resizeSection( i, 30 ); // setColumnStretchable( i, TRUE ); if ( d->onMonday ) horizontalHeader()->setLabel( i, Calendar::nameOfDay( i + 1 ) ); else { if ( i == 0 ) horizontalHeader()->setLabel( i, Calendar::nameOfDay( 7 ) ); else horizontalHeader()->setLabel( i, Calendar::nameOfDay( i ) ); } } } //--------------------------------------------------------------------------- DateBookMonth::DateBookMonth( QWidget *parent, const char *name, bool ac, DateBookDB *data ) : QVBox( parent, name ), autoClose( ac ) { setFocusPolicy(StrongFocus); year = QDate::currentDate().year(); month = QDate::currentDate().month(); day = QDate::currentDate().day(); header = new DateBookMonthHeader( this, "DateBookMonthHeader" ); table = new DateBookMonthTable( this, "DateBookMonthTable", data ); header->setDate( year, month ); table->setDate( year, month, QDate::currentDate().day() ); header->setFocusPolicy(NoFocus); table->setFocusPolicy(NoFocus); - connect( header, SIGNAL( dateChanged( int, int ) ), - this, SLOT( setDate( int, int ) ) ); - connect( table, SIGNAL( dateClicked( int, int, int ) ), - this, SLOT( finalDate(int, int, int) ) ); + connect( header, SIGNAL( dateChanged(int,int) ), + this, SLOT( setDate(int,int) ) ); + connect( table, SIGNAL( dateClicked(int,int,int) ), + this, SLOT( finalDate(int,int,int) ) ); connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChange(bool)) ); table->setFocus(); } DateBookMonth::~DateBookMonth() { } void DateBookMonth::setDate( int y, int m ) { /* only change the date if this is a different date, * other wise we may mistakenly overide the day */ if ( (y != year) || (m != month) ) { year = y; month = m; QDate nd( y, m, 1 ); if ( nd.daysInMonth() < day ) day = nd.daysInMonth(); table->setDate( year, month, day ); } } void DateBookMonth::setDate( int y, int m, int d ) { header->setDate( y, m); table->setDate( y, m, d); year = y; month = m; day = d; } /* called when we wish to close or pass back the date */ void DateBookMonth::finalDate(int y, int m, int d) { setDate( y, m, d ); emit dateClicked(y, m, d); // emit dateClicked(QDate(y, m, d).toString()); if ( autoClose && parentWidget() ) parentWidget()->close(); } void DateBookMonth::setDate( QDate d) { setDate(d.year(), d.month(), d.day()); @@ -651,100 +651,100 @@ void DayItemMonth::paint( QPainter *p, const QColorGroup &cg, p->setFont( f ); QFontMetrics fm( f ); p->drawText( 1, 1 + fm.ascent(), QString::number( day() ) ); p->restore(); } void DayItemMonth::setType( Calendar::Day::Type t ) { switch ( t ) { case Calendar::Day::PrevMonth: case Calendar::Day::NextMonth: back = QBrush( QColor( 224, 224, 224 ) ); forg = black; break; case Calendar::Day::ThisMonth: back = QBrush( white ); forg = black; break; } typ = t; } DateButton::DateButton( bool longDate, QWidget *parent, const char * name ) :QPushButton( parent, name ) { longFormat = longDate; df = DateFormat('/', DateFormat::MonthDayYear, DateFormat::MonthDayYear); setDate( QDate::currentDate() ); connect(this,SIGNAL(pressed()),this,SLOT(pickDate())); } void DateButton::pickDate() { static QPopupMenu *m1 = 0; static DateBookMonth *picker = 0; if ( !m1 ) { m1 = new QPopupMenu( this ); picker = new DateBookMonth( m1, 0, TRUE ); m1->insertItem( picker ); - connect( picker, SIGNAL( dateClicked( int, int, int ) ), - this, SLOT( setDate( int, int, int ) ) ); - connect( picker, SIGNAL( dateClicked( int, int, int ) ), - this, SIGNAL( dateSelected( int, int, int ) ) ); + connect( picker, SIGNAL( dateClicked(int,int,int) ), + this, SLOT( setDate(int,int,int) ) ); + connect( picker, SIGNAL( dateClicked(int,int,int) ), + this, SIGNAL( dateSelected(int,int,int) ) ); connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); } picker->slotWeekChange( weekStartsMonday ); picker->setDate( currDate.year(), currDate.month(), currDate.day() ); m1->popup(mapToGlobal(QPoint(0,height()))); picker->setFocus(); } void DateButton::gotHide() { // we have to redo the button... setDown( false ); } // void dateSelected( int year, int month, int day ); void DateButton::setWeekStartsMonday( int b ) { weekStartsMonday = b; } void DateButton::setDate( int y, int m, int d ) { setDate( QDate( y,m,d) ); } void DateButton::setDate( QDate d ) { currDate = d; setText( longFormat ? TimeString::longDateString( d, df ) : TimeString::shortDate( d, df ) ); } void DateButton::setDateFormat( DateFormat f ) { df = f; setDate( currDate ); } bool DateButton::customWhatsThis() const { return TRUE; } diff --git a/library/fileselector.cpp b/library/fileselector.cpp index 7c29aba..93fb429 100644 --- a/library/fileselector.cpp +++ b/library/fileselector.cpp @@ -263,125 +263,125 @@ public: \ingroup qtopiaemb \sa FileManager */ /*! Constructs a FileSelector with mime filter \a f. The standard Qt \a parent and \a name parameters are passed to the parent widget. If \a newVisible is TRUE, the widget has a button to allow the user the create "new" documents; this is useful for applications that can create and edit documents but not suitable for applications that only provide viewing. \a closeVisible is deprecated \sa DocLnkSet::DocLnkSet() */ FileSelector::FileSelector( const QString &f, QWidget *parent, const char *name, bool newVisible, bool closeVisible ) : QVBox( parent, name ), filter( f ) { setMargin( 0 ); setSpacing( 0 ); d = new FileSelectorPrivate(); d->newDocItem = 0; d->showNew = newVisible; d->catId = -2; // All files d->toolbar = new QHBox( this ); d->toolbar->setBackgroundMode( PaletteButton ); // same colour as toolbars d->toolbar->setSpacing( 0 ); d->toolbar->hide(); QWidget *spacer = new QWidget( d->toolbar ); spacer->setBackgroundMode( PaletteButton ); QToolButton *tb = new QToolButton( d->toolbar ); tb->setPixmap( Resource::loadPixmap( "close" ) ); connect( tb, SIGNAL( clicked() ), this, SIGNAL( closeMe() ) ); buttonClose = tb; tb->setFixedSize( 18, 20 ); // tb->sizeHint() ); tb->setAutoRaise( TRUE ); QToolTip::add( tb, tr( "Close the File Selector" ) ); QPEMenuToolFocusManager::manager()->addWidget( tb ); view = new FileSelectorView( this, "fileview" ); QPEApplication::setStylusOperation( view->viewport(), QPEApplication::RightOnHold ); - connect( view, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ), - this, SLOT( fileClicked( int, QListViewItem *, const QPoint &, int ) ) ); - connect( view, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint &, int ) ), - this, SLOT( filePressed( int, QListViewItem *, const QPoint &, int ) ) ); - connect( view, SIGNAL( returnPressed( QListViewItem * ) ), - this, SLOT( fileClicked( QListViewItem * ) ) ); + connect( view, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), + this, SLOT( fileClicked(int,QListViewItem*,const QPoint&,int) ) ); + connect( view, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), + this, SLOT( filePressed(int,QListViewItem*,const QPoint&,int) ) ); + connect( view, SIGNAL( returnPressed(QListViewItem*) ), + this, SLOT( fileClicked(QListViewItem*) ) ); QHBox *hb = new QHBox( this ); d->typeCombo = new TypeCombo( hb ); connect( d->typeCombo, SIGNAL(selected(const QString&)), this, SLOT(typeSelected(const QString&)) ); QWhatsThis::add( d->typeCombo, tr("Show documents of this type") ); Categories c; c.load(categoryFileName()); QArray<int> vl( 0 ); d->catSelect = new CategorySelect( hb ); d->catSelect->setRemoveCategoryEdit( TRUE ); d->catSelect->setCategories( vl, "Document View", tr("Document View") ); d->catSelect->setAllCategories( TRUE ); connect( d->catSelect, SIGNAL(signalSelected(int)), this, SLOT(catSelected(int)) ); QWhatsThis::add( d->catSelect, tr("Show documents in this category") ); setCloseVisible( closeVisible ); QCopChannel *channel = new QCopChannel( "QPE/Card", this ); - connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), - this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); + connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(cardMessage(const QCString&,const QByteArray&)) ); reread(); updateWhatsThis(); } /*! Destroys the widget. */ FileSelector::~FileSelector() { delete d; } /*! Returns the number of files in the view. If this is zero, an editor application might bypass the selector and immediately start with a "new" document. */ int FileSelector::fileCount() { return d->files.children().count();; } /*! Calling this function is the programmatic equivalent of the user pressing the "new" button. \sa newSelected(), closeMe() */ void FileSelector::createNew() { DocLnk f; emit newSelected( f ); emit closeMe(); } void FileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) { if ( !i ) return; if ( button == Qt::LeftButton ) { fileClicked( i ); } } void FileSelector::filePressed( int button, QListViewItem *i, const QPoint &, int ) { if ( !i || i == d->newDocItem ) diff --git a/library/finddialog.cpp b/library/finddialog.cpp index 64487c9..9417179 100644 --- a/library/finddialog.cpp +++ b/library/finddialog.cpp @@ -1,84 +1,80 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the 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. ** **********************************************************************/ // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT // have this class. #define QTOPIA_INTERNAL_FD #include "finddialog.h" #include "findwidget_p.h" #include <qlayout.h> /*! \class FindDialog finddialog.h \brief A simple FindDialog A find dialog. FIXME!!!! */ FindDialog::FindDialog( const QString &appName, QWidget *parent, const char *name, bool modal ) : QDialog( parent, name, modal ) { setCaption( tr("Find") ); QVBoxLayout *vb; vb = new QVBoxLayout( this ); fw = new FindWidget( appName, this, "Find Widget" ); vb->addWidget( fw ); - QObject::connect( fw, SIGNAL(signalFindClicked(const QString&, - bool,bool,int)), - this, SIGNAL(signalFindClicked(const QString&, - bool,bool,int)) ); - QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,const QDate&, - bool,bool,int)), - this, SIGNAL(signalFindClicked(const QString&, - const QDate&,bool,bool,int)) ); + QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,bool,bool,int)), + this, SIGNAL(signalFindClicked(const QString&,bool,bool,int)) ); + QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)), + this, SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)) ); d = 0; } FindDialog::~FindDialog() { } QString FindDialog::findText() const { return fw->findText(); } void FindDialog::setUseDate( bool show ) { fw->setUseDate( show ); } void FindDialog::setDate( const QDate &dt ) { fw->setDate( dt ); } void FindDialog::slotNotFound() { fw->slotNotFound(); } void FindDialog::slotWrapAround() { fw->slotWrapAround(); } diff --git a/library/findwidget_p.cpp b/library/findwidget_p.cpp index e91d789..0591f07 100644 --- a/library/findwidget_p.cpp +++ b/library/findwidget_p.cpp @@ -2,98 +2,98 @@ ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the 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 "findwidget_p.h" #include <qpe/categoryselect.h> #include <qpe/datebookmonth.h> #include <qcheckbox.h> #include <qlabel.h> #include <qlineedit.h> FindWidget::FindWidget( const QString &appName, QWidget *parent, const char *name ) : FindWidgetBase( parent, name ), mStrApp( appName ), mDate( QDate::currentDate() ) { setMaximumSize( sizeHint() ); QArray<int> vl(0); cmbCat->setCategories( vl, mStrApp ); cmbCat->setRemoveCategoryEdit( TRUE ); cmbCat->setAllCategories( TRUE ); // hide junk for the moment... lblStartDate->hide(); cmdStartDate->hide(); QPopupMenu *m1 = new QPopupMenu( this ); dtPicker = new DateBookMonth( m1, 0, TRUE ); dtPicker->setDate( mDate.year(), mDate.month(), mDate.day() ); m1->insertItem( dtPicker ); cmdStartDate->setPopup( m1 ); cmdStartDate->setText( TimeString::shortDate(mDate) ); - QObject::connect( dtPicker, SIGNAL(dateClicked(int, int, int)), - this, SLOT(slotDateChanged(int, int, int)) ); + QObject::connect( dtPicker, SIGNAL(dateClicked(int,int,int)), + this, SLOT(slotDateChanged(int,int,int)) ); QObject::connect( cmdFind, SIGNAL(clicked()), this, SLOT(slotFindClicked()) ); } FindWidget::~FindWidget() { } QString FindWidget::findText() const { return txtFind->text(); } void FindWidget::slotFindClicked() { lblStatus->setText( "" ); if ( cmdStartDate->isVisible() ) emit signalFindClicked( findText(), mDate, chkCase->isChecked(), chkBackwards->isChecked(), cmbCat->currentCategory() ); else emit signalFindClicked( findText(), chkCase->isChecked(), chkBackwards->isChecked(), cmbCat->currentCategory() ); } void FindWidget::setUseDate( bool show ) { if ( show ) { lblStartDate->show(); cmdStartDate->show(); } else { lblStartDate->hide(); cmdStartDate->hide(); } chkBackwards->setDisabled( show ); } void FindWidget::setDate( const QDate &dt ) { slotDateChanged( dt.year(), dt.month(), dt.day() ); } void FindWidget::slotNotFound() { diff --git a/library/ir.cpp b/library/ir.cpp index 32c0925..c581eb1 100644 --- a/library/ir.cpp +++ b/library/ir.cpp @@ -3,98 +3,98 @@ ** ** This file is part of the 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 "ir.h" #include "qcopenvelope_qws.h" #include "applnk.h" /*! \class Ir ir.h \brief The Ir class implements basic support for sending objects over an infrared communication link. Both \link doclnk.html DocLnk\endlink objects and files can be sent to another device via the infrared link using the send() function. When the send has completed the done() signal is emitted. The supported() function returns whether the device supports infrared communication or not. \ingroup qtopiaemb */ /*! Constructs an Ir object. The \a parent and \a name classes are the standard QObject parameters. */ Ir::Ir( QObject *parent, const char *name ) : QObject( parent, name ) { #ifndef QT_NO_COP ch = new QCopChannel( "QPE/Obex" ); - connect( ch, SIGNAL(received(const QCString &, const QByteArray &)), - this, SLOT(obexMessage( const QCString &, const QByteArray &)) ); + connect( ch, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(obexMessage(const QCString&,const QByteArray&)) ); #endif } /*! Returns TRUE if the system supports infrared communication; otherwise returns FALSE. */ bool Ir::supported() { #ifndef QT_NO_COP return QCopChannel::isRegistered( "QPE/Obex" ); #endif } /*! Sends the object in file \a fn over the infrared link. The \a description is used in the text shown to the user while sending is in progress. The optional \a mimetype parameter specifies the mimetype of the object. If this parameter is not set, it is determined by the the filename's suffix. \sa done() */ void Ir::send( const QString &fn, const QString &description, const QString &mimetype) { if ( !filename.isEmpty() ) return; filename = fn; #ifndef QT_NO_COP QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); e << description << filename << mimetype; #endif } /*! \overload Uses the DocLnk::file() and DocLnk::type() of \a doc. \sa done() */ void Ir::send( const DocLnk &doc, const QString &description ) { send( doc.file(), description, doc.type() ); } /*! \fn Ir::done( Ir *ir ); diff --git a/library/network.cpp b/library/network.cpp index 991e11a..df28857 100644 --- a/library/network.cpp +++ b/library/network.cpp @@ -116,98 +116,98 @@ void Network::connectChoiceChange(QObject* receiver, const char* slot) } #endif // QT_NO_COP /*! \internal */ QString Network::settingsDir() { return Global::applicationFileName("Network", "modules"); } #ifndef QT_NO_COP /*! \internal */ QStringList Network::choices(QListBox* lb, const QString& dir) { QStringList list; if ( lb ) lb->clear(); QString adir = dir.isEmpty() ? settingsDir() : dir; QDir settingsdir(adir); settingsdir.mkdir(adir); QStringList files = settingsdir.entryList("*.conf"); for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) { QString filename = settingsdir.filePath(*it); Config cfg(filename, Config::File); cfg.setGroup("Info"); if ( lb ) lb->insertItem(Resource::loadPixmap("Network/" + cfg.readEntry("Type")), cfg.readEntry("Name")); list.append(filename); } return list; } class NetworkServer : public QCopChannel { Q_OBJECT public: NetworkServer(QObject* parent) : QCopChannel("QPE/Network",parent), wait(0) { up = FALSE; examineNetworks( TRUE ); QCopChannel* card = new QCopChannel("QPE/Card",parent); - connect(card,SIGNAL(received(const QCString &, const QByteArray&)), - this,SLOT(cardMessage(const QCString &, const QByteArray&))); + connect(card,SIGNAL(received(const QCString&,const QByteArray&)), + this,SLOT(cardMessage(const QCString&,const QByteArray&))); } ~NetworkServer() { stop(); } bool networkOnline() const { return up; } private: void receive(const QCString &msg, const QByteArray& data) { if ( msg == "start(QString,QString)" ) { QDataStream stream(data,IO_ReadOnly); QString file,password; stream >> file >> password; if ( file.isEmpty() ) { QStringList l = Network::choices(); for (QStringList::ConstIterator i=l.begin(); i!=l.end(); ++i) { Config cfg(*i,Config::File); cfg.setGroup("Info"); QString type = cfg.readEntry("Type"); NetworkInterface* plugin = Network::loadPlugin(type); cfg.setGroup("Properties"); if ( plugin && plugin->isAvailable(cfg) ) { file = *i; break; } } if ( file.isEmpty() ) { QCopEnvelope("QPE/Network", "failed()"); return; } } start(file,password); } else if ( msg == "stop()" ) { stop(); } else if ( msg == "choicesChanged()" ) { examineNetworks(); } } private slots: void cardMessage(const QCString &msg, const QByteArray&) { diff --git a/library/qcopenvelope_qws.cpp b/library/qcopenvelope_qws.cpp index 8f58787..63efb13 100644 --- a/library/qcopenvelope_qws.cpp +++ b/library/qcopenvelope_qws.cpp @@ -23,98 +23,98 @@ #endif #include <qbuffer.h> #include <qfile.h> #include <unistd.h> #include <errno.h> #include <sys/file.h> #include <sys/types.h> #include <sys/stat.h> #include <time.h> #ifndef QT_NO_COP /*! \class QCopEnvelope qcopenvelope_qws.h \brief The QCopEnvelope class encapsulates and sends QCop messages over QCopChannels. QCop messages allow applications to communicate with each other. These messages are sent using QCopEnvelope, and received by connecting to a QCopChannel. To send a message, use the following protocol: \code QCopEnvelope e(channelname, messagename); e << parameter1 << parameter2 << ...; \endcode For messages without parameters, simply use: \code QCopEnvelope e(channelname, messagename); \endcode (Do not try to simplify this further as it may confuse some compilers.) The \c{channelname} of channels within Qtopia all start with "QPE/". The \c{messagename} is a function identifier followed by a list of types in parentheses. There is no whitespace in the message name. To receive a message, you will generally just use your application's predefined QPE/Application/\e{appname} channel (see QPEApplication::appMessage()), but you can make another channel and connect it to a slot like this: \code myChannel = new QCopChannel( "QPE/FooBar", this ); - connect( myChannel, SIGNAL(received(const QCString &, const QByteArray &)), - this, SLOT(fooBarMessage( const QCString &, const QByteArray &)) ); + connect( myChannel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(fooBarMessage(const QCString&,const QByteArray&)) ); \endcode See also, the \link qcop.html list of Qtopia messages\endlink. */ /*! Constructs a QCopEnvelope that will write \a message to \a channel. If \a message has parameters, you must then use operator<<() to add these parameters to the envelope. */ QCopEnvelope::QCopEnvelope( const QCString& channel, const QCString& message ) : QDataStream(new QBuffer), ch(channel), msg(message) { device()->open(IO_WriteOnly); } /*! Writes the message and then destroys the QCopEnvelope. */ QCopEnvelope::~QCopEnvelope() { QByteArray data = ((QBuffer*)device())->buffer(); const int pref=16; if ( qstrncmp(ch.data(),"QPE/Application/",pref)==0 ) { QString qcopfn("/tmp/qcop-msg-"); qcopfn += ch.mid(pref); QFile qcopfile(qcopfn); if ( qcopfile.open(IO_WriteOnly | IO_Append) ) { #ifndef Q_OS_WIN32 if(flock(qcopfile.handle(), LOCK_EX)) { /* some error occurred */ qWarning(QString("Failed to obtain file lock on %1 (%2)") .arg(qcopfn).arg( errno )); } #endif { QDataStream ds(&qcopfile); ds << ch << msg << data; qcopfile.flush(); #ifndef Q_OS_WIN32 flock(qcopfile.handle(), LOCK_UN); #endif qcopfile.close(); } QByteArray b; diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 262221e..c339a78 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -583,120 +583,120 @@ void QPEApplication::processQCopFile() \endcode \sa qcop.html Note that messages received here may be processed by qpe application and emitted as signals, such as flush() and reload(). */ /*! Constructs a QPEApplication just as you would construct a QApplication, passing \a argc, \a argv, and \a t. For applications, \a t should be the default, GuiClient. Only the Qtopia server passes GuiServer. */ QPEApplication::QPEApplication( int & argc, char **argv, Type t ) : QApplication( hack(argc), argv, t ), pidChannel( 0 ) { QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. d = new QPEApplicationData; d->loadTextCodecs(); d->loadImageCodecs(); int dw = desktop() ->width(); if ( dw < 200 ) { setFont( QFont( "vera", 8 ) ); AppLnk::setSmallIconSize( 10 ); AppLnk::setBigIconSize( 28 ); } #if defined(OPIE_HIGH_RES_SMALL_PHY) else if ( dw > 600 ) { setFont( QFont( "vera", 16 ) ); AppLnk::setSmallIconSize( 24 ); AppLnk::setBigIconSize( 48 ); } #endif else if ( dw > 200 ) { setFont( QFont( "vera", 10 ) ); AppLnk::setSmallIconSize( 14 ); AppLnk::setBigIconSize( 32 ); } QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); sysChannel = new QCopChannel( "QPE/System", this ); - connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), - this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); + connect( sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), + this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); /* COde now in initapp */ #if 0 #if defined(Q_WS_QWS) && !defined(QT_NO_COP) QString qcopfn( "/tmp/qcop-msg-" ); qcopfn += QString( argv[ 0 ] ); // append command name QFile f( qcopfn ); if ( f.open( IO_ReadOnly ) ) { flock( f.handle(), LOCK_EX ); } QCString channel = QCString( argv[ 0 ] ); channel.replace( QRegExp( ".*/" ), "" ); d->appName = channel; channel = "QPE/Application/" + channel; pidChannel = new QCopChannel( channel, this ); - connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), - this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); + connect( pidChannel, SIGNAL( received(const QCString&,const QByteArray&) ), + this, SLOT( pidMessage(const QCString&,const QByteArray&) ) ); if ( f.isOpen() ) { d->keep_running = FALSE; QDataStream ds( &f ); QCString channel, message; QByteArray data; while ( !ds.atEnd() ) { ds >> channel >> message >> data; d->enqueueQCop( channel, message, data ); } flock( f.handle(), LOCK_UN ); f.close(); f.remove(); } for ( int a = 0; a < argc; a++ ) { if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { argv[ a ] = argv[ a + 1 ]; a++; d->preloaded = TRUE; argc -= 1; } else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { argv[ a ] = argv[ a + 1 ]; a++; d->preloaded = TRUE; d->forceshow = TRUE; argc -= 1; } } /* overide stored arguments */ setArgs( argc, argv ); #endif #else initApp( argc, argv ); #endif // qwsSetDecoration( new QPEDecoration() ); #ifndef QT_NO_TRANSLATION d->langs = Global::languageList(); for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { QString lang = *it; installTranslation( lang + "/libopie.qm"); @@ -706,98 +706,98 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t ) //###language/font hack; should look it up somewhere #ifdef QWS if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { QFont fn = FontManager::unicodeFont( FontManager::Proportional ); setFont( fn ); } #endif } #endif applyStyle(); if ( type() == GuiServer ) { setVolume(); } installEventFilter( this ); QPEMenuToolFocusManager::initialize(); #ifdef QT_NO_QWS_CURSOR // if we have no cursor, probably don't want tooltips QToolTip::setEnabled( FALSE ); #endif } #ifdef QTOPIA_INTERNAL_INITAPP void QPEApplication::initApp( int argc, char **argv ) { delete pidChannel; d->keep_running = TRUE; d->preloaded = FALSE; d->forceshow = FALSE; QCString channel = QCString(argv[0]); channel.replace(QRegExp(".*/"),""); d->appName = channel; #if QT_VERSION > 235 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 #endif channel = "QPE/Application/" + channel; pidChannel = new QCopChannel( channel, this); - connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), - this, SLOT(pidMessage(const QCString &, const QByteArray &))); + connect( pidChannel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(pidMessage(const QCString&,const QByteArray&))); processQCopFile(); d->keep_running = d->qcopq.isEmpty(); for (int a=0; a<argc; a++) { if ( qstrcmp(argv[a],"-preload")==0 ) { argv[a] = argv[a+1]; a++; d->preloaded = TRUE; argc-=1; } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { argv[a] = argv[a+1]; a++; d->preloaded = TRUE; d->forceshow = TRUE; argc-=1; } } /* overide stored arguments */ setArgs(argc, argv); /* install translation here */ for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) installTranslation( (*it) + "/" + d->appName + ".qm" ); } #endif static QPtrDict<void>* inputMethodDict = 0; static void createInputMethodDict() { if ( !inputMethodDict ) inputMethodDict = new QPtrDict<void>; } /*! Returns the currently set hint to the system as to whether widget \a w has any use for text input methods. \sa setInputMethodHint() InputMethodHint */ QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) { if ( inputMethodDict && w ) diff --git a/library/qpedialog.cpp b/library/qpedialog.cpp index ac42972..da461b7 100644 --- a/library/qpedialog.cpp +++ b/library/qpedialog.cpp @@ -4,71 +4,71 @@ ** This file is part of the 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 protected public #include <qdialog.h> #undef protected #include "qpedialog.h" #include <qpe/qpeapplication.h> /** * \brief This is the only c'tor. * * The parent of this Listener is the Dialog you pass. This means once * the dialog is deleted this listener will be deleted too. * This Listener listens on QPEApplication::appMessage signal and implements * accept() and reject(). * * \code * QDialog *dialog = new YourDialog(); (void)new QPEDialogListener(dialog); if( QPEApplication::execDialog(dialog) == QDialog::Accept ){ // do some stuff } delete dialog; * \endcode * * @param di The dialog to handle */ QPEDialogListener::QPEDialogListener(QDialog *di ) : QObject(di) { dialog = di; - connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), - this, SLOT(appMessage(const QCString&, const QByteArray&)) ); + connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), + this, SLOT(appMessage(const QCString&,const QByteArray&)) ); } /** * d'tor */ QPEDialogListener::~QPEDialogListener() {} /** * \internal */ void QPEDialogListener::appMessage( const QCString &msg, const QByteArray & ) { if (!dialog) return; if (msg == "accept()") { dialog->accept(); } else if (msg == "reject()") { dialog->reject(); } } diff --git a/library/storage.cpp b/library/storage.cpp index 0ea465b..fcee689 100644 --- a/library/storage.cpp +++ b/library/storage.cpp @@ -50,98 +50,98 @@ static bool isCF(const QString& m) #ifndef Q_OS_MACX FILE* f = fopen("/var/run/stab", "r"); if (!f) f = fopen("/var/state/pcmcia/stab", "r"); if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); if ( f ) { char line[1024]; char devtype[80]; char devname[80]; while ( fgets( line, 1024, f ) ) { // 0 ide ide-cs 0 hda 3 0 if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) { if ( QString(devtype) == "ide" && m.find(devname)>0 ) { fclose(f); return TRUE; } } } fclose(f); } #endif /* Q_OS_MACX */ return FALSE; } /*! \class StorageInfo storage.h \brief The StorageInfo class describes the disks mounted on the file system. This class provides access to the mount information for the Linux filesystem. Each mount point is represented by the FileSystem class. To ensure this class has the most up to date size information, call the update() method. Note that this will automatically be signaled by the operating system when a disk has been mounted or unmounted. \ingroup qtopiaemb */ /*! Constructor that determines the current mount points of the filesystem. The standard \a parent parameters is passed on to QObject. */ StorageInfo::StorageInfo( QObject *parent ) : QObject( parent ) { mFileSystems.setAutoDelete( TRUE ); channel = new QCopChannel( "QPE/Card", this ); - connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), - this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); + connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(cardMessage(const QCString&,const QByteArray&)) ); update(); } /*! Returns the longest matching FileSystem that starts with the same prefix as \a filename as its mount point. */ const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) { for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { if ( filename.startsWith( (*i)->path() ) ) return (*i); } return 0; } void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) { if ( msg == "mtabChanged()" ) update(); } /*! Updates the mount and free space available information for each mount point. This method is automatically called when a disk is mounted or unmounted. */ // cause of the lack of a d pointer we need // to store informations in a config file :( void StorageInfo::update() { //qDebug("StorageInfo::updating"); #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) struct mntent *me; FILE *mntfp = setmntent( "/etc/mtab", "r" ); QStringList curdisks; QStringList curopts; QStringList curfs; bool rebuild = FALSE; int n=0; if ( mntfp ) { while ( (me = getmntent( mntfp )) != 0 ) { QString fs = me->mnt_fsname; if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" diff --git a/library/timestring.cpp b/library/timestring.cpp index 2fd0191..91c29ae 100644 --- a/library/timestring.cpp +++ b/library/timestring.cpp @@ -8,97 +8,97 @@ ** 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 "timestring.h" #include <qobject.h> #include <qpe/qpeapplication.h> //for qApp #include "config.h" class TimeStringFormatKeeper : public QObject { Q_OBJECT public: static DateFormat currentFormat() { if ( !self ) self = new TimeStringFormatKeeper; return self->format; } private slots: void formatChanged( DateFormat f ) { format = f; } private: static TimeStringFormatKeeper *self; DateFormat format; TimeStringFormatKeeper() : QObject( qApp ) { Config config("qpe"); config.setGroup( "Date" ); format = DateFormat(QChar(config.readEntry("Separator", "/")[0]), (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); connect( qApp, SIGNAL( dateFormatChanged(DateFormat) ), - this, SLOT( formatChanged( DateFormat ) ) ); + this, SLOT( formatChanged(DateFormat) ) ); } }; TimeStringFormatKeeper *TimeStringFormatKeeper::self = 0; QString DateFormat::toNumberString() const { QString buf = ""; // for each part of the order for (int i = 0; i < 3; i++) { // switch on the relavent 3 bits. switch((_shortOrder >> (i * 3)) & 0x0007) { case 0x0001: buf += QObject::tr( "D" , "Shortcut for Day"); break; case 0x0002: buf += QObject::tr( "M", "Shortcur for Month" ); break; case 0x0004: buf += QObject::tr( "Y" ); break; } if (i < 2) buf += _shortSeparator; } return buf; } QString DateFormat::toWordString() const { QString buf = ""; // for each part of the order for (int i = 0; i < 3; i++) { // switch on the relavent 3 bits. switch((_longOrder >> (i * 3)) & 0x0007) { case 0x0001: buf += QObject::tr( "day" ); if (i < 2) { if ((_shortOrder << ((i+1) * 3)) & 0x0007) buf += ", "; else buf += " "; } break; case 0x0002: buf += QObject::tr( "month" ); if (i < 2) buf += " "; diff --git a/library/tzselect.cpp b/library/tzselect.cpp index f28100b..848dfb7 100644 --- a/library/tzselect.cpp +++ b/library/tzselect.cpp @@ -32,98 +32,98 @@ #include <qmessagebox.h> /*! \class TimeZoneSelector \brief The TimeZoneSelector widget allows users to configure their time zone information. \ingroup qtopiaemb */ class TimeZoneSelectorPrivate { public: TimeZoneSelectorPrivate() : includeLocal(FALSE) {} bool includeLocal; }; TZCombo::TZCombo( QWidget *p, const char* n ) : QComboBox( p, n ) { updateZones(); // check to see if TZ is set, if it is set the current item to that QString tz = getenv("TZ"); if (parent()->inherits("TimeZoneSelector")) { if ( ((TimeZoneSelector *)parent())->localIncluded() ) { // overide to the 'local' type. tz = "None"; } } if ( !tz.isNull() ) { int n = 0, index = 0; for ( QStringList::Iterator it=identifiers.begin(); it!=identifiers.end(); ++it) { if ( *it == tz ) index = n; n++; } setCurrentItem(index); } else { setCurrentItem(0); } // listen on QPE/System #if !defined(QT_NO_COP) QCopChannel *channel = new QCopChannel( "QPE/System", this ); - connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT(handleSystemChannel(const QCString&, const QByteArray&)) ); + connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(handleSystemChannel(const QCString&,const QByteArray&)) ); #endif } TZCombo::~TZCombo() { } void TZCombo::updateZones() { QString cur = currentText(); clear(); identifiers.clear(); int curix=0; QString tz = getenv("TZ"); bool tzFound = FALSE; Config cfg("CityTime"); cfg.setGroup("TimeZones"); int listIndex = 0; if (parent()->inherits("TimeZoneSelector")) { if ( ((TimeZoneSelector *)parent())->localIncluded() ) { // overide to the 'local' type. identifiers.append( "None" ); insertItem( tr("None") ); if ( cur == tr("None")) curix = 0; listIndex++; } } int cfgIndex = 0; while (1) { QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null); if ( zn.isNull() ) break; if ( zn == tz ) tzFound = TRUE; QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex)); identifiers.append(zn); insertItem(nm); if ( nm == cur ) curix = listIndex; ++cfgIndex; ++listIndex; } if ( !listIndex ) { QStringList list = timezoneDefaults(); for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) { @@ -173,98 +173,98 @@ void TZCombo::mousePressEvent(QMouseEvent*e) } QString TZCombo::currZone() const { return identifiers[currentItem()]; } void TZCombo::setCurrZone( const QString& id ) { for (int i=0; i< count(); i++) { if ( identifiers[i] == id ) { setCurrentItem(i); return; } } insertItem(id); setCurrentItem( count() - 1); identifiers.append(id); extras.append(id); } void TZCombo::handleSystemChannel(const QCString&msg, const QByteArray&) { if ( msg == "timeZoneListChange()" ) { updateZones(); } } /*! Creates a new TimeZoneSelector with parent \a p and name \a n. The combobox will be populated with the available timezones. */ TimeZoneSelector::TimeZoneSelector(QWidget* p, const char* n) : QHBox(p,n) { d = new TimeZoneSelectorPrivate(); // build the combobox before we do any updates... cmbTz = new TZCombo( this, "timezone combo" ); cmdTz = new QToolButton( this, "timezone button" ); cmdTz->setIconSet( Resource::loadIconSet( "citytime_icon" ) ); cmdTz->setMaximumSize( cmdTz->sizeHint() ); // set up a connection to catch a newly selected item and throw our // signal - QObject::connect( cmbTz, SIGNAL( activated( int ) ), - this, SLOT( slotTzActive( int ) ) ); + QObject::connect( cmbTz, SIGNAL( activated(int) ), + this, SLOT( slotTzActive(int) ) ); QObject::connect( cmdTz, SIGNAL( clicked() ), this, SLOT( slotExecute() ) ); } /*! Destroys a TimeZoneSelector. */ TimeZoneSelector::~TimeZoneSelector() { } void TimeZoneSelector::setLocalIncluded(bool b) { d->includeLocal = b; cmbTz->updateZones(); } bool TimeZoneSelector::localIncluded() const { return d->includeLocal; } /*! Returns the currently selected timezone as a string in location format, e.g. \code Australia/Brisbane \endcode */ QString TimeZoneSelector::currentZone() const { return cmbTz->currZone(); } /*! Sets the current timezone to \a id. */ void TimeZoneSelector::setCurrentZone( const QString& id ) { cmbTz->setCurrZone( id ); } /*! \fn void TimeZoneSelector::signalNewTz( const QString& id ) This signal is emitted when a timezone has been selected by the user. The id is a \l QString in location format, eg \code Australia/Brisbane \endcode */ void TimeZoneSelector::slotTzActive( int ) { emit signalNewTz( cmbTz->currZone() ); } diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp index 04da8bb..9416db3 100644 --- a/noncore/applets/memoryapplet/swapfile.cpp +++ b/noncore/applets/memoryapplet/swapfile.cpp @@ -65,99 +65,99 @@ Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) 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); 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); mkswapProgress->setCenterIndicator(true); QHBox *hb4 = new QHBox(this); hb4->setSpacing(5); swapStatusIcon = new QLabel(hb4); swapStatus = new QLabel(tr(""), hb4); hb4->setStretchFactor(swapStatus, 99); vb->addWidget(hb4); connect(swapOn, SIGNAL(clicked()), this, SLOT(swapon())); connect(swapOff, SIGNAL(clicked()), this, SLOT(swapoff())); connect(cfRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); connect(sdRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); connect(ramRB, SIGNAL(clicked()), this, SLOT(cfsdchecked())); connect(mkSwap, SIGNAL(clicked()), this, SLOT(makeswapfile())); connect(rmSwap, SIGNAL(clicked()), this, SLOT(removeswapfile())); cfRB->setEnabled(FALSE); sdRB->setEnabled(FALSE); QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this); - connect(pcmciaChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(cardnotify(const QCString &, const QByteArray &))); + connect(pcmciaChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&))); QCopChannel *sdChannel = new QCopChannel("QPE/Card", this); - connect(sdChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(cardnotify(const QCString &, const QByteArray &))); + connect(sdChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(cardnotify(const QCString&,const QByteArray&))); cardInPcmcia0 = FALSE; cardInPcmcia1 = FALSE; cardInSd = FALSE; Swapfile::status(); Swapfile::getStatusPcmcia(); Swapfile::getStatusSd(); } int Swapfile::exec(const QString& arg) { return system((!isRoot ? "sudo " : "") + arg); } Swapfile::~Swapfile() { } void Swapfile::cardnotify(const QCString & msg, const QByteArray &) { if (msg == "stabChanged()") { getStatusPcmcia(); } else if (msg == "mtabChanged()") { getStatusSd(); } } void Swapfile::getStatusPcmcia() { bool cardWas0 = cardInPcmcia0; // remember last state bool cardWas1 = cardInPcmcia1; QString fileName; // one of these 3 files should exist if (QFile::exists("/var/run/stab")) { fileName = "/var/run/stab"; } else if (QFile::exists("/var/state/pcmcia/stab")) { fileName = "/var/state/pcmcia/stab"; } else { fileName = "/var/lib/pcmcia/stab"; } diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 1142028..9b5e475 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp @@ -82,192 +82,192 @@ NotesControl::NotesControl( QWidget *, const char * ) // : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) { QDir d( QDir::homeDirPath()+"/notes"); if( !d.exists()) { qDebug("make dir"); if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed"); } 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" ); view = new QMultiLineEdit(vbox, "OpieNotesView"); box = new QListBox(vbox, "OpieNotesBox"); QPEApplication::setStylusOperation( box->viewport(),QPEApplication::RightOnHold); box->setFixedHeight(50); vbox->setMargin( 6 ); vbox->setSpacing( 3 ); setFocusPolicy(QWidget::StrongFocus); newButton= new QPushButton( hbox, "newButton" ); newButton->setText(tr("New")); saveButton= new QPushButton( hbox, "saveButton" ); saveButton->setText(tr("Save")); deleteButton= new QPushButton( hbox, "deleteButton" ); deleteButton->setText(tr("Delete")); - connect( box, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint&)), - this,SLOT( boxPressed(int, QListBoxItem *, const QPoint&)) ); + connect( box, SIGNAL( mouseButtonPressed(int,QListBoxItem*,const QPoint&)), + this,SLOT( boxPressed(int,QListBoxItem*,const QPoint&)) ); - connect(box, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString &))); + connect(box, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString&))); connect( &menuTimer, SIGNAL( timeout() ), SLOT( showMenu() ) ); connect(view,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) ); connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton())); connect(saveButton, SIGNAL(clicked()), this, SLOT(slotSaveButton())); connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButtonClicked())); populateBox(); load(); setCaption("Notes"); // parent->setFocus(); } void NotesControl::slotSaveButton() { slotNewButton(); populateBox(); } 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); 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); 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); 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); QFile f( fi); if( !f.remove()) qDebug(".desktop file not removed"); } } view->clear(); populateBox(); } } void NotesControl::slotNewButton() { if(edited) save(); view->clear(); view->setFocus(); edited=false; isNew=false; } void NotesControl::slotBeamButton() { Ir ir; if(!ir.supported()){ } else { this->hide(); QString selectedText = box->currentText(); if( !selectedText.isEmpty()) { QString file = QDir::homeDirPath()+"/"+selectedText; QFile f(file); Ir *irFile = new Ir(this, "IR"); - connect( irFile, SIGNAL(done(Ir*)), this, SLOT( slotBeamFinished( Ir * ))); + connect( irFile, SIGNAL(done(Ir*)), this, SLOT( slotBeamFinished(Ir*))); irFile->send( file, "Note", "text/plain" ); } } } void NotesControl::slotBeamFinished(Ir *) { this->show(); } void NotesControl::boxPressed(int mouse, QListBoxItem *, const QPoint&) { switch (mouse) { case 1:{ } break; case 2: menuTimer.start( 500, TRUE ); break; }; } void NotesControl::slotBoxSelected(const QString &itemString) { if(edited) { save(); } loaded=false; edited=false; load(itemString); } void NotesControl::showMenu() { QPopupMenu *m = new QPopupMenu(0); m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() )); m->insertItem( tr( "Search For..." ), this, SLOT( slotSearch() )); m->insertItem( tr( "Toggle Maximized" ), this, SLOT( slotShowMax() )); m->insertSeparator(); m->insertItem( tr( "Delete" ), this, SLOT( slotDeleteButton() )); m->setFocus(); m->exec( QCursor::pos() ); if(m) delete m; } void NotesControl::focusOutEvent ( QFocusEvent * e) { if( e->reason() == QFocusEvent::Popup) save(); else { if(!loaded) { diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp index 9ce6618..6ef2e44 100644 --- a/noncore/applets/wirelessapplet/wireless.cpp +++ b/noncore/applets/wirelessapplet/wireless.cpp @@ -76,107 +76,107 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const statusLabel->setFixedSize( statusLabel->sizeHint() ); grid->addWidget( statusLabel, 0, 0 ); /* visualization group box */ QButtonGroup* group = new QButtonGroup( 1, Qt::Horizontal, "Visualization", this ); QRadioButton* r1 = new QRadioButton( "Color Bars", group ); QRadioButton* r2 = new QRadioButton( "Antenna", group ); r1->setFocusPolicy( QWidget::NoFocus ); r2->setFocusPolicy( QWidget::NoFocus ); group->setFocusPolicy( QWidget::NoFocus ); group->setButton( displayStyle ); grid->addWidget( group, 0, 1 ); /* quality graph */ mgraph = new MGraph( this ); mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); mgraph->setMin( 0 ); mgraph->setMax( 92 ); grid->addWidget( mgraph, 1, 0 ); mgraph->setFocusPolicy( QWidget::NoFocus ); /* advanced configuration Button */ QPushButton* advanced = new QPushButton( "Advanced...", this ); advanced->setFocusPolicy( QWidget::NoFocus ); grid->addWidget( advanced, 2, 0, Qt::AlignCenter ); connect( advanced, SIGNAL( clicked() ), this, SLOT( advancedConfigClicked() ) ); /* update Frequency Label */ updateLabel = new QLabel( this ); text.sprintf( "Update every %d s", updateFrequency ); updateLabel->setText( text ); grid->addWidget( updateLabel, 2, 1 ); /* update Frequency Slider */ QSlider* updateSlider = new QSlider( QSlider::Horizontal, this ); updateSlider->setRange( 0, 9 ); updateSlider->setValue( updateFrequency ); updateSlider->setTickmarks( QSlider::Both ); updateSlider->setTickInterval( 1 ); updateSlider->setSteps( 1, 1 ); updateSlider->setFocusPolicy( QWidget::NoFocus ); grid->addWidget( updateSlider, 1, 1 ); - connect( updateSlider, SIGNAL( valueChanged( int ) ), - this, SLOT( updateDelayChange( int ) ) ); + connect( updateSlider, SIGNAL( valueChanged(int) ), + this, SLOT( updateDelayChange(int) ) ); setFixedSize( sizeHint() ); setFocusPolicy( QWidget::NoFocus ); applet->displayStyleChange( displayStyle ); applet->updateDelayChange( updateFrequency ); - connect( group, SIGNAL( clicked( int ) ), - this, SLOT( displayStyleChange( int ) ) ); + connect( group, SIGNAL( clicked(int) ), + this, SLOT( displayStyleChange(int) ) ); applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); } void WirelessControl::advancedConfigClicked() { AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE ); int result = a->exec(); a->hide(); delete a; if ( result == QDialog::Accepted ) { readConfig(); applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); } } void WirelessControl::updateDelayChange( int delay ) { QString text; text.sprintf( "Update every %d s", delay ); updateLabel->setText( text ); applet->updateDelayChange( delay ); writeConfigEntry( "UpdateFrequency", delay ); } void WirelessControl::displayStyleChange( int style ) { applet->displayStyleChange( style ); writeConfigEntry( "DisplayStyle", style ); } void WirelessControl::show ( bool ) { QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) ); int w = sizeHint().width(); int x = curPos.x() - ( w / 2 ); if ( ( x + w ) > QPEApplication::desktop() ->width() ) x = QPEApplication::desktop ( ) -> width ( ) - w; move( x, curPos.y () - sizeHint().height () ); QFrame::show(); } void WirelessControl::readConfig() { diff --git a/noncore/applets/zkbapplet/zkbwidget.cpp b/noncore/applets/zkbapplet/zkbwidget.cpp index 0b5ab78..0083e9b 100644 --- a/noncore/applets/zkbapplet/zkbwidget.cpp +++ b/noncore/applets/zkbapplet/zkbwidget.cpp @@ -1,70 +1,70 @@ #include <opie2/otaskbarapplet.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/applnk.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <stdio.h> #include <unistd.h> #include "zkbwidget.h" #include "zkbcfg.h" ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0), disabled(Resource::loadPixmap("zkb-disabled")) { labels = new QPopupMenu(); connect(labels, SIGNAL(activated(int)), this, SLOT(labelChanged(int))); loadKeymap(); channel = new QCopChannel("QPE/zkb", this); - connect(channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT(signalReceived(const QCString&, const QByteArray&))); + connect(channel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(signalReceived(const QCString&,const QByteArray&))); setFixedWidth ( AppLnk::smallIconSize() ); setFixedHeight ( AppLnk::smallIconSize() ); } ZkbWidget::~ZkbWidget() { } int ZkbWidget::position() { return 8; } bool ZkbWidget::loadKeymap() { ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb"); QFontMetrics fm(font()); if (keymap != 0) { delete keymap; keymap = 0; } Keymap* km = new Keymap(); if (!c.load("zkb.xml", *km, "")) { delete km; setPixmap(disabled); return false; } connect(km, SIGNAL(stateChanged(const QString&)), this, SLOT(stateChanged(const QString&))); qwsServer->setKeyboardFilter(km); Keymap* oldkm = keymap; keymap = km; if (oldkm != 0) { delete oldkm; } setText(keymap->getCurrentLabel()); labels->clear(); QStringList l = keymap->listLabels(); labels->insertItem(disabled, 0, 0); int n = 1; w = 0; diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index c44d387..2ba3dca 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -4,98 +4,98 @@ ** Created: Sat Mar 9 23:33:09 2002 copyright : (C) 2002 by ljp email : ljp@llornkcor.com * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #define DEVELOPERS_VERSION #include "advancedfm.h" #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/mimetype.h> #include <qpe/applnk.h> #include <qpe/resource.h> #include <qpe/menubutton.h> #include <qcombobox.h> #include <qpopupmenu.h> #include <qlistview.h> #include <qmessagebox.h> #include <qlineedit.h> #include <sys/stat.h> #include <time.h> #include <dirent.h> #include <fcntl.h> #include <sys/vfs.h> #include <mntent.h> #ifdef NOQUICKLAUNCH AdvancedFm::AdvancedFm( ) #else AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) #endif : QMainWindow( ) { init(); renameBox = 0; unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); initConnections(); whichTab=1; rePopulate(); currentPathCombo->setFocus(); channel = new QCopChannel( "QPE/Application/advancedfm", this ); - connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); + connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); } 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"); 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"); QPixmap pm; QListView *thisView = CurrentView(); QDir *thisDir = CurrentDir(); QString path = thisDir->canonicalPath(); //qWarning("path is "+path); thisView->clear(); diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 763ae34..f791c77 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp @@ -208,79 +208,79 @@ void AdvancedFm::init() { /////////////// 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"); sdButton->hide(); } if( !StorageInfo::hasCf() ) { qDebug("not have cf"); 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="*"; b=FALSE; showMenuHidden(); TabWidget->setCurrentWidget(0); } void AdvancedFm::initConnections() { connect( qApp,SIGNAL( aboutToQuit()), this, SLOT( cleanUp()) ); connect( qpeDirButton ,SIGNAL(released()), this,SLOT( QPEButtonPushed()) ); connect( cfButton ,SIGNAL(released()), this,SLOT( CFButtonPushed()) ); connect( sdButton ,SIGNAL(released()), this,SLOT( SDButtonPushed()) ); connect( cdUpButton ,SIGNAL(released()), this,SLOT( upDir()) ); connect( docButton,SIGNAL(released()), this,SLOT( docButtonPushed()) ); connect( homeButton,SIGNAL(released()), this,SLOT( homeButtonPushed()) ); - connect( currentPathCombo, SIGNAL( activated( const QString & ) ), - this, SLOT( currentPathComboActivated( const QString & ) ) ); + connect( currentPathCombo, SIGNAL( activated(const QString&) ), + this, SLOT( currentPathComboActivated(const QString&) ) ); connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), this,SLOT(currentPathComboChanged())); - connect( Local_View, SIGNAL( clicked( QListViewItem*)), - this,SLOT( ListClicked(QListViewItem *)) ); + connect( Local_View, SIGNAL( clicked(QListViewItem*)), + this,SLOT( ListClicked(QListViewItem*)) ); - connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), - this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); + connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), + this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); - connect( Remote_View, SIGNAL( clicked( QListViewItem*)), - this,SLOT( ListClicked(QListViewItem *)) ); - connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), - this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); + connect( Remote_View, SIGNAL( clicked(QListViewItem*)), + this,SLOT( ListClicked(QListViewItem*)) ); + connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), + this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); - connect( TabWidget,SIGNAL(currentChanged(QWidget *)), + connect( TabWidget,SIGNAL(currentChanged(QWidget*)), this,SLOT(tabChanged(QWidget*))); connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); - connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); -// connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); - connect( viewMenu, SIGNAL( activated(int )), this, SLOT(slotSwitchMenu(int ))); + connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&))); +// connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int))); + connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int))); // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); } diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 9ad1146..9e740d0 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -636,122 +636,122 @@ void AdvancedFm::rn() { }
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 * )));
+ 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(OProcess *)),
- this, SLOT( processEnded(OProcess *)));
+ connect(process, SIGNAL(processExited(OProcess*)),
+ this, SLOT( processEnded(OProcess*)));
- connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)),
- this, SLOT( oprocessStderr(OProcess *, char *, int)));
+ connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)),
+ this, SLOT( oprocessStderr(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;
}
}
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp index 7dc2416..0bba1d8 100644 --- a/noncore/apps/advancedfm/output.cpp +++ b/noncore/apps/advancedfm/output.cpp @@ -96,181 +96,181 @@ static char * filesave_xpm[] = { "K c #323232", "L c #D0D0D0", "M c #1C1C1C", " ...+ ", " @#$%&..+ ", " .*=-;;>,..+ ", " ')!~;;;;;;{]..", " ^/(-;;;;;;;_:<", " [}|;;;;;;;{12$", " #34-55;;;;678$+", " 90ab=c;dd;e1fg ", " [ahij((kbl0mn$ ", " op^q^^7r&]s/$+ ", "@btu;vbwxy]zAB ", "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()); 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 ) ); connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() )); // docButton->setFlat(TRUE); OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 ); OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 ); proc = new OProcess(); - connect(proc, SIGNAL(processExited(OProcess *)), + connect(proc, SIGNAL(processExited(OProcess*)), this, SLOT( processFinished())); - connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), - this, SLOT(commandStdout(OProcess *, char *, int))); + connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)), + this, SLOT(commandStdout(OProcess*,char*,int))); - connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), - this, SLOT(commandStderr(OProcess *, char *, int))); + connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)), + this, SLOT(commandStderr(OProcess*,char*,int))); -// connect( , SIGNAL(received(const QByteArray &)), -// this, SLOT(commandStdin(const QByteArray &))); +// 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() ); * 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); } } 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); 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"); } } else qWarning("Could not write file"); f.close(); } } void Output::commandStdout(OProcess*, char *buffer, int buflen) { qWarning("received stdout %d bytes", buflen); // 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()); // 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); 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); // close(); -// disconnect( layer(), SIGNAL(received(const QByteArray &)), -// this, SLOT(commandStdin(const QByteArray &))); +// disconnect( layer(), SIGNAL(received(const QByteArray&)), +// this, SLOT(commandStdin(const QByteArray&))); } //============================== InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "InputDialog" ); resize( 234, 50 ); setMaximumSize( QSize( 240, 50 ) ); setCaption( tr(name ) ); LineEdit1 = new QLineEdit( this, "LineEdit1" ); LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); LineEdit1->setFocus(); LineEdit1->setFocus(); connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() )); } InputDialog::~InputDialog() { inputText = LineEdit1->text(); } void InputDialog::setInputText(const QString &string) { LineEdit1->setText( string); } void InputDialog::returned() { inputText = LineEdit1->text(); this->accept(); } diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index 26b2533..1b933f2 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp @@ -48,245 +48,245 @@ #include <qpushbutton.h> #include <qwhatsthis.h> #include <qpopupmenu.h> #define COL_ID 0 #define COL_SORTDATE 1 #define COL_NUM 2 #define COL_DATE 3 #define COL_DESC 4 #define COL_AMOUNT 5 #define COL_BAL 6 // --- Checkbook -------------------------------------------------------------- Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg ) : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { info = i; _pCfg=cfg; // Title bar if ( info->name() != "" ) { QString tempstr = info->name(); tempstr.append( " - " ); tempstr.append( tr( "Checkbook" ) ); setCaption( tempstr ); } else { setCaption( tr( "New checkbook" ) ); } // Setup layout to make everything pretty QVBoxLayout *layout = new QVBoxLayout( this ); layout->setMargin( 2 ); layout->setSpacing( 4 ); // Setup tabs for all info mainWidget = new OTabWidget( this ); layout->addWidget( mainWidget ); mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); if( _pCfg->isShowLastTab() ) mainWidget->setCurrentTab( info->getLastTab() ); else mainWidget->setCurrentTab( tr( "Info" ) ); - connect( mainWidget, SIGNAL( currentChanged(QWidget *) ), this, SLOT( slotTab(QWidget *) ) ); + connect( mainWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( slotTab(QWidget*) ) ); // Load checkbook information loadCheckbook(); } Checkbook::~Checkbook() { } // --- initInfo --------------------------------------------------------------- QWidget *Checkbook::initInfo() { QWidget *control = new QWidget( mainWidget, tr("Info") ); QVBoxLayout *vb = new QVBoxLayout( control ); QScrollView *sv = new QScrollView( control ); vb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QGridLayout *layout = new QGridLayout( container ); layout->setSpacing( 2 ); layout->setMargin( 4 ); // Password protection passwordCB = new QCheckBox( tr( "Password protect" ), container ); QWhatsThis::add( passwordCB, tr( "Click here to enable/disable password protection of this checkbook." ) ); connect( passwordCB, SIGNAL( clicked() ), this, SLOT( slotPasswordClicked() ) ); layout->addMultiCellWidget( passwordCB, 0, 0, 0, 1 ); // Account name QLabel *label = new QLabel( tr( "Name:" ), container ); QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); layout->addWidget( label, 1, 0 ); nameEdit = new QLineEdit( container ); QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); - connect( nameEdit, SIGNAL( textChanged( const QString & ) ), - this, SLOT( slotNameChanged( const QString & ) ) ); + connect( nameEdit, SIGNAL( textChanged(const QString&) ), + this, SLOT( slotNameChanged(const QString&) ) ); layout->addWidget( nameEdit, 1, 1 ); // Type of account label = new QLabel( tr( "Type:" ), container ); QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); layout->addWidget( label, 2, 0 ); typeList = new QComboBox( container ); QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); typeList->insertStringList( _pCfg->getAccountTypes() ); layout->addWidget( typeList, 2, 1 ); // Bank/institution name label = new QLabel( tr( "Bank:" ), container ); QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); layout->addWidget( label, 3, 0 ); bankEdit = new QLineEdit( container ); QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); layout->addWidget( bankEdit, 3, 1 ); // Account number label = new QLabel( tr( "Account number:" ), container ); QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); layout->addWidget( label, 4, 0 ); acctNumEdit = new QLineEdit( container ); QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); layout->addWidget( acctNumEdit, 4, 1 ); // PIN number label = new QLabel( tr( "PIN number:" ), container ); QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); layout->addWidget( label, 5, 0 ); pinNumEdit = new QLineEdit( container ); QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); layout->addWidget( pinNumEdit, 5, 1 ); // Starting balance label = new QLabel( tr( "Starting balance:" ), container ); QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); layout->addWidget( label, 6, 0 ); balanceEdit = new QLineEdit( container ); QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); - connect( balanceEdit, SIGNAL( textChanged( const QString & ) ), - this, SLOT( slotStartingBalanceChanged( const QString & ) ) ); + connect( balanceEdit, SIGNAL( textChanged(const QString&) ), + this, SLOT( slotStartingBalanceChanged(const QString&) ) ); layout->addWidget( balanceEdit, 6, 1 ); // Notes label = new QLabel( tr( "Notes:" ), container ); QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); layout->addWidget( label, 7, 0 ); notesEdit = new QMultiLineEdit( container ); QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); notesEdit->setMinimumHeight( 25 ); notesEdit->setMaximumHeight( 65 ); layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 ); return control; } // --- initTransactions ------------------------------------------------------- QWidget *Checkbook::initTransactions() { QWidget *control = new QWidget( mainWidget, tr("Transactions") ); QGridLayout *layout = new QGridLayout( control ); layout->setSpacing( 2 ); layout->setMargin( 4 ); // Sort selector QLabel *label = new QLabel( tr( "Sort by:" ), control ); QWhatsThis::add( label, tr( "Select checkbook sorting here." ) ); layout->addMultiCellWidget( label, 0, 0, 0, 1 ); _cbSortType=new QComboBox( control ); _cbSortType->insertItem( tr("Entry Order") ); _cbSortType->insertItem( tr("Date") ); _cbSortType->insertItem( tr("Number") ); layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 ); - connect( _cbSortType, SIGNAL( activated(const QString &) ), this, SLOT( slotSortChanged( const QString & ) ) ); + connect( _cbSortType, SIGNAL( activated(const QString&) ), this, SLOT( slotSortChanged(const QString&) ) ); // Table tranTable = new QListView( control ); QFont fnt(QPEApplication::font()); fnt.setPointSize( fnt.pointSize()-1 ); tranTable->setFont( fnt ); QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) ); tranTable->addColumn( tr( "Id" ) ); tranTable->setColumnWidthMode( COL_ID, QListView::Manual ); tranTable->setColumnWidth( COL_ID, 0); tranTable->addColumn( tr( "SortDate" ) ); tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual ); tranTable->setColumnWidth( COL_SORTDATE, 0); tranTable->addColumn( tr( "Num" ) ); tranTable->addColumn( tr( "Date" ) ); //tranTable->addColumn( tr( "Cleared" ) ); tranTable->addColumn( tr( "Description" ) ); int column = tranTable->addColumn( tr( "Amount" ) ); tranTable->setColumnAlignment( column, Qt::AlignRight ); column=tranTable->addColumn( tr("Balance") ); tranTable->setColumnAlignment( column, Qt::AlignRight ); tranTable->setAllColumnsShowFocus( TRUE ); tranTable->setSorting( -1 ); layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); - connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), - this, SLOT( slotMenuTran(QListViewItem *, const QPoint &) ) ); - connect( tranTable, SIGNAL( doubleClicked( QListViewItem * ) ), + connect( tranTable, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), + this, SLOT( slotMenuTran(QListViewItem*,const QPoint&) ) ); + connect( tranTable, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotEditTran() ) ); _sortCol=COL_ID; // Buttons QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); layout->addWidget( btn, 2, 0 ); btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); layout->addWidget( btn, 2, 1 ); btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); layout->addWidget( btn, 2, 2 ); return( control ); } // --- initCharts ------------------------------------------------------------- QWidget *Checkbook::initCharts() { graphInfo = 0x0; QWidget *control = new QWidget( mainWidget, tr("Charts") ); QGridLayout *layout = new QGridLayout( control ); layout->setSpacing( 2 ); layout->setMargin( 4 ); graphWidget = new Graph( control ); QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) ); layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 ); graphList = new QComboBox( control ); QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) ); graphList->insertItem( tr( "Account balance" ) ); graphList->insertItem( tr( "Withdrawals by category" ) ); graphList->insertItem( tr( "Deposits by category" ) ); layout->addMultiCellWidget( graphList, 1, 1, 0, 1 ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) ); diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp index 37f05f0..d00e305 100644 --- a/noncore/apps/checkbook/listedit.cpp +++ b/noncore/apps/checkbook/listedit.cpp @@ -10,111 +10,111 @@ - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this 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" #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 ); // type table _typeTable = new QListView( this ); ColumnDef *def=first(); while( def ) { _typeTable->addColumn( def->getName() ); def=next(); } - connect( _typeTable, SIGNAL( clicked(QListViewItem *, const QPoint &, int) ), this, SLOT( slotClick(QListViewItem *, const QPoint &, int ) ) ); + connect( _typeTable, SIGNAL( clicked(QListViewItem*,const QPoint&,int) ), this, SLOT( slotClick(QListViewItem*,const QPoint&,int) ) ); layout->addMultiCellWidget(_typeTable, 0,4,0,4); _currentItem=NULL; // edit field _stack=new QWidgetStack( this ); _stack->setMaximumHeight(fh+5); layout->addMultiCellWidget(_stack, 5,5,0,2); _typeEdit = new QLineEdit( _stack ); _stack->raiseWidget(_typeEdit ); - connect( _typeEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( slotEditChanged(const QString &) ) ); + connect( _typeEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotEditChanged(const QString&) ) ); // combo box _box=new QComboBox( _stack ); - connect( _box, SIGNAL( activated(const QString &) ), this, SLOT( slotActivated(const QString &) ) ); + connect( _box, SIGNAL( activated(const QString&) ), this, SLOT( slotActivated(const QString&) ) ); // add button QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/add" ), tr( "Add" ), this ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); layout->addWidget( btn, 5, 3 ); // delete button btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) ); layout->addWidget( btn, 5, 4 ); } // --- ~ListEdit -------------------------------------------------------------- ListEdit::~ListEdit() { } // --- slotEditTypeChanged ---------------------------------------------------- void ListEdit::slotEditChanged(const QString &str) { if( !_currentItem || _currentColumn<0 ) return; _currentItem->setText(_currentColumn, str); } // --- slotAddType ------------------------------------------------------------ void ListEdit::slotAdd() { // construct new row QString args[8]; ColumnDef *pCol=this->first(); int i=0; while( pCol && i<8 ) { args[i++]=pCol->getNewValue(); pCol=this->next(); } _currentItem=new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] ); // fix uniques fixTypes(); // display col 0 of new value QPoint pnt; slotClick(_currentItem, pnt, 0); _typeTable->setSelected( _currentItem, true ); // make it selected diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index d0fac3b..254ce6a 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp @@ -127,97 +127,97 @@ MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ ) this->show(); this->showMaximized(); QListViewItem *itm=cbList->firstChild(); while( itm ) { if( itm->text(posName)==_cfg.getLastBook() ) { openBook( itm ); break; } itm=itm->nextSibling(); } } } // --- ~MainWindow ------------------------------------------------------------ MainWindow::~MainWindow() { writeConfig(); } // --- buildList -------------------------------------------------------------- void MainWindow::buildList() { if ( cbList ) delete cbList; cbList = new QListView( this ); QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); if ( _cfg.getShowLocks() ) { cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 ); posName = 1; } else { posName = 0; } cbList->addColumn( tr( "Checkbook Name" ) ); if ( _cfg.getShowBalances() ) { int colnum = cbList->addColumn( tr( "Balance" ) ); cbList->setColumnAlignment( colnum, Qt::AlignRight ); } cbList->setAllColumnsShowFocus( TRUE ); cbList->setSorting( posName ); QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); - connect( cbList, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), + connect( cbList, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), this, SLOT( slotEdit() ) ); setCentralWidget( cbList ); for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) { addCheckbook( cb ); } } void MainWindow::addCheckbook( CBInfo *cb ) { QListViewItem *lvi = new QListViewItem( cbList ); if ( _cfg.getShowLocks() && !cb->password().isNull() ) { lvi->setPixmap( 0, lockIcon ); } lvi->setText( posName, cb->name() ); if ( _cfg.getShowBalances() ) { QString balance; balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); lvi->setText( posName + 1, balance ); } } void MainWindow::buildFilename( const QString &name ) { tempFilename = cbDir; tempFilename.append( name ); tempFilename.append( ".qcb" ); } void MainWindow::slotNew() { CBInfo *cb = new CBInfo(); Checkbook *currcb = new Checkbook( this, cb, &_cfg ); if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) { // Save new checkbook buildFilename( cb->name() ); _cfg.setLastBook( cb->name() ); cb->setFilename( tempFilename ); cb->write(); // Add to listbox checkbooks->inSort( cb ); addCheckbook( cb ); diff --git a/noncore/apps/checkbook/password.cpp b/noncore/apps/checkbook/password.cpp index f381271..89a6bc6 100644 --- a/noncore/apps/checkbook/password.cpp +++ b/noncore/apps/checkbook/password.cpp @@ -30,68 +30,68 @@ #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qpushbutton.h> static const char* const showhideimage_data[] = { "16 16 2 1", ". c None", "# c #000000", "................", "...#...###...##.", "..#.#..#..#.##..", "..###..###.##...", ".#...#.#..##....", ".#...#.#.##.....", "........##.#..#.", "..##...##...##..", ".#..#.###...##..", ".#...##..#.#..#.", ".#..##..........", ".#.##.#..#.#..#.", "..##...##...##..", ".##....##...##..", ".#....#..#.#..#.", "................"}; Password::Password( QWidget *parent, const char *caption, const char *prompt ) : QDialog( parent, 0x0, TRUE, 0x0 ) { setCaption( caption ); QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2 ); layout->setMargin( 4 ); QLabel *label = new QLabel( prompt, this ); label->setAlignment( AlignLeft | AlignTop | WordBreak ); layout->addMultiCellWidget( label, 0, 0, 0, 1 ); pw = new QLineEdit( this ); pw->setEchoMode( QLineEdit::Password ); layout->addWidget( pw, 1, 0 ); QPixmap *pic = new QPixmap( ( const char** ) showhideimage_data ); QPushButton *btn = new QPushButton( ( QIconSet ) *pic, QString::null, this ); btn->setMaximumSize( pic->width() + 10, pic->height() + 10 ); btn->setToggleButton( TRUE ); - connect( btn, SIGNAL( toggled( bool ) ), this, SLOT( slotTogglePassword( bool ) ) ); + connect( btn, SIGNAL( toggled(bool) ), this, SLOT( slotTogglePassword(bool) ) ); layout->addWidget( btn, 1, 1 ); password == ""; } Password::~Password() { } void Password::accept() { password = pw->text(); QDialog::accept(); } void Password::slotTogglePassword( bool showPW ) { showPW ? pw->setEchoMode( QLineEdit::Normal ) : pw->setEchoMode( QLineEdit::Password ); } diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp index a72a48b..1b08b24 100644 --- a/noncore/apps/checkbook/transaction.cpp +++ b/noncore/apps/checkbook/transaction.cpp @@ -54,171 +54,171 @@ Transaction::Transaction( QWidget *parent, bool bNew, const QString &acctname, tran = info; _pCfg=pCfg; QVBoxLayout *vb = new QVBoxLayout( this ); QScrollView *sv = new QScrollView( this ); vb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QGridLayout *layout = new QGridLayout( container ); layout->setSpacing( 2 ); layout->setMargin( 4 ); // Withdrawal/Deposit QButtonGroup *btngrp = new QButtonGroup( container ); btngrp->setColumnLayout(0, Qt::Vertical ); btngrp->layout()->setSpacing( 0 ); btngrp->layout()->setMargin( 0 ); btngrp->setMaximumWidth( 220 ); QGridLayout *layout2 = new QGridLayout( btngrp->layout() ); layout2->setSpacing( 2 ); layout2->setMargin( 2 ); withBtn = new QRadioButton( tr( "Withdrawal" ), btngrp ); QWhatsThis::add( withBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) ); layout2->addWidget( withBtn, 0, 0 ); connect( withBtn, SIGNAL( clicked() ), this, SLOT( slotWithdrawalClicked() ) ); depBtn = new QRadioButton( tr( "Deposit" ), btngrp ); QWhatsThis::add( depBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) ); layout2->addWidget( depBtn, 0, 1 ); btngrp->setMaximumSize( 320, withBtn->height() ); connect( depBtn, SIGNAL( clicked() ), this, SLOT( slotDepositClicked() ) ); layout->addMultiCellWidget( btngrp, 0, 0, 0, 3 ); // Date QLabel *label = new QLabel( tr( "Date:" ), container ); QWhatsThis::add( label, tr( "Select date of transaction here." ) ); layout->addWidget( label, 1, 0 ); dateBtn = new QPushButton( TimeString::shortDate( QDate::currentDate() ), container ); QWhatsThis::add( dateBtn, tr( "Select date of transaction here." ) ); QPopupMenu *m1 = new QPopupMenu( container ); datePicker = new DateBookMonth( m1, 0, TRUE ); m1->insertItem( datePicker ); dateBtn->setPopup( m1 ); - connect( datePicker, SIGNAL( dateClicked( int, int, int ) ), - this, SLOT( slotDateChanged( int, int, int ) ) ); + connect( datePicker, SIGNAL( dateClicked(int,int,int) ), + this, SLOT( slotDateChanged(int,int,int) ) ); layout->addWidget( dateBtn, 1, 1 ); // Check number label = new QLabel( tr( "Number:" ), container ); QWhatsThis::add( label, tr( "Enter check number here." ) ); layout->addWidget( label, 1, 2 ); numEdit = new QLineEdit( container ); QWhatsThis::add( numEdit, tr( "Enter check number here." ) ); numEdit->setMaximumWidth( 40 ); layout->addWidget( numEdit, 1, 3 ); // Description label = new QLabel( tr( "Description:" ), container ); QWhatsThis::add( label, tr( "Enter description of transaction here." ) ); layout->addWidget( label, 2, 0 ); _cbDesc=new QComboBox( true, container ); _cbDesc->insertStringList( _pCfg->getPayees() ); QWhatsThis::add( _cbDesc, tr( "Enter description of transaction here." ) ); layout->addMultiCellWidget( _cbDesc, 2, 2, 1, 3 ); - connect( _cbDesc, SIGNAL( activated(const QString &) ), this, SLOT( slotActivated(const QString &) ) ); + connect( _cbDesc, SIGNAL( activated(const QString&) ), this, SLOT( slotActivated(const QString&) ) ); // Category label = new QLabel( tr( "Category:" ), container ); QWhatsThis::add( label, tr( "Select transaction category here." ) ); layout->addWidget( label, 3, 0 ); catList = new QComboBox( container ); QWhatsThis::add( catList, tr( "Select transaction category here." ) ); layout->addMultiCellWidget( catList, 3, 3, 1, 3 ); // Type label = new QLabel( tr( "Type:" ), container ); QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); layout->addWidget( label, 4, 0 ); typeList = new QComboBox( container ); QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); layout->addMultiCellWidget( typeList, 4, 4, 1, 3 ); // Amount label = new QLabel( tr( "Amount:" ), container ); QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); layout->addWidget( label, 5, 0 ); amtEdit = new QLineEdit( container ); QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 ); // Fee label = new QLabel( tr( "Fee:" ), container ); QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); layout->addWidget( label, 6, 0 ); feeEdit = new QLineEdit( container ); QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 ); // Notes label = new QLabel( tr( "Notes:" ), container ); QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) ); layout->addWidget( label, 7, 0 ); noteEdit = new QMultiLineEdit( container ); QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) ); layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 ); // init date initFromInfo( info ); // not new handlers connect( withBtn, SIGNAL( toggled(bool) ), this, SLOT( slotNotNew() ) ); connect( depBtn, SIGNAL( toggled(bool) ), this, SLOT( slotNotNew() ) ); - connect( catList, SIGNAL(activated(const QString &)), this, SLOT( slotNotNew() ) ); - connect( typeList, SIGNAL(activated(const QString &)), this, SLOT( slotNotNew() ) ); - connect( amtEdit, SIGNAL(textChanged(const QString &)), this, SLOT( slotNotNew() ) ); - connect( feeEdit, SIGNAL(textChanged(const QString &)), this, SLOT( slotNotNew() ) ); + connect( catList, SIGNAL(activated(const QString&)), this, SLOT( slotNotNew() ) ); + connect( typeList, SIGNAL(activated(const QString&)), this, SLOT( slotNotNew() ) ); + connect( amtEdit, SIGNAL(textChanged(const QString&)), this, SLOT( slotNotNew() ) ); + connect( feeEdit, SIGNAL(textChanged(const QString&)), this, SLOT( slotNotNew() ) ); connect( noteEdit, SIGNAL(textChanged()), this, SLOT( slotNotNew() ) ); } // --- initFromInfo ----------------------------------------------------------- void Transaction::initFromInfo(TranInfo *info, bool bPopulateOld) { // Populate current values if provided if ( info ) { if ( info->withdrawal() ) { withBtn->setChecked( TRUE ); slotWithdrawalClicked(); } else { depBtn->setChecked( TRUE ); slotDepositClicked(); } if( !bPopulateOld ) { QDate dt = info->date(); slotDateChanged( dt.year(), dt.month(), dt.day() ); datePicker->setDate( dt ); numEdit->setText( info->number() ); } QString temptext = info->category(); // set description field int i; for(i=_cbDesc->count()-1; i>=0; i--) { if( _cbDesc->text(i)==info->desc() ) { _cbDesc->setCurrentItem(i); break; } } if( i<=0 ) _cbDesc->setEditText( info->desc() ); i = catList->count(); while ( i > 0 ) { i--; catList->setCurrentItem( i ); if ( catList->currentText() == temptext ) { break; } diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp index 5f7ad50..6ef1043 100644 --- a/noncore/apps/confedit/mainwindow.cpp +++ b/noncore/apps/confedit/mainwindow.cpp @@ -3,98 +3,98 @@ * 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 <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"); settingList = new ListViewConfDir( QDir::homeDirPath() + "/Settings", this, "settingslist"); settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); mainLayout->addWidget( settingList, 0); qDebug("creating editor"); 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* ) ) ); + connect( settingList, SIGNAL( clicked(QListViewItem*) ), + this, SLOT( stopTimer(QListViewItem*) ) ); connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), SLOT( groupChanged(const QString&) ) ); connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ), SLOT( keyChanged(const QString&) ) ); connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), SLOT( valueChanged(const QString&) ) ); setCurrent(0); editor->layoutType(EditWidget::File); } void MainWindow::makeMenu() { popupTimer = new QTimer(this); popupMenuFile = new QPopupMenu(this); popupMenuEntry = new QPopupMenu(this); popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 ); popupActionSave->addTo( popupMenuFile ); // popupActionSave->addTo( popupMenuEntry ); connect( popupActionSave, SIGNAL( activated() ), this , SLOT( saveConfFile() ) ); popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 ); popupActionRevert->addTo( popupMenuFile ); popupActionRevert->addTo( popupMenuEntry ); connect( popupActionRevert, SIGNAL( activated() ), this , SLOT( revertConfFile() ) ); popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 ); popupActionDelete->addTo( popupMenuFile ); popupActionDelete->addTo( popupMenuEntry ); connect( popupActionDelete, SIGNAL( activated() ), this , SLOT( removeConfFile() ) ); connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); } MainWindow::~MainWindow() { } void MainWindow::setCurrent(QListViewItem *item) { diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index d5c6d75..4c99964 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp @@ -161,55 +161,55 @@ void ODict::slotStartQuery() } } void ODict::slotSettings() { ConfigDlg dlg( this, "Config" , true); if ( dlg.exec() == QDialog::Accepted ) saveConfig(); } void ODict::slotSetParameter( int count ) { if ( count == 0 ) { if ( casesens ) casesens = false; else casesens = true; } saveConfig(); } void ODict::slotMethodChanged( const QString& methodnumber ) { activated_name = methodnumber; if ( activated_name != ding->loadedDict() ) { ding->loadDict(activated_name); lookupLanguageNames( activated_name ); top_name->setText( top_name_content ); bottom_name->setText( bottom_name_content ); } } void ODict::setupMenus() { menu = new QMenuBar( this ); settings = new QPopupMenu( menu ); setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); setting_a->addTo( settings ); setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); parameter = new QPopupMenu( menu ); - connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); + connect( parameter, SIGNAL( activated(int) ), this, SLOT( slotSetParameter(int) ) ); parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); parameter->insertSeparator(); menu->insertItem( tr( "Settings" ) , settings ); menu->insertItem( tr( "Parameter" ) , parameter ); } diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp index 3c010e9..b6401ed 100644 --- a/noncore/apps/opie-bartender/bartender.cpp +++ b/noncore/apps/opie-bartender/bartender.cpp @@ -57,99 +57,99 @@ Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 ); QMenuBar *menuBar = new QMenuBar( ToolBar1 ); QPopupMenu *fileMenu; fileMenu = new QPopupMenu( this); menuBar->insertItem( tr("File"), fileMenu ); fileMenu->insertItem(tr("New Drink")); fileMenu->insertItem(tr("Open Drink")); fileMenu->insertItem(tr("Find by Drink Name")); fileMenu->insertItem(tr("Find by Alcohol")); QPopupMenu *editMenu; editMenu = new QPopupMenu( this); menuBar->insertItem( tr("Edit"), editMenu ); editMenu->insertItem(tr("edit")); connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); a->addTo( ToolBar1 ); a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) ); a->addTo( ToolBar1 ); a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) ); a->addTo( ToolBar1 ); a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) ); a->addTo( ToolBar1 ); QPushButton *t; t= new QPushButton( "BAC", ToolBar1, "bacButtin"); connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) ); DrinkView = new QListView( this, "DrinkView" ); DrinkView->addColumn( tr( "Name of Drink" ) ); // DrinkView->setRootIsDecorated( TRUE ); DrinkView->header()->hide(); QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold); - connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink( QListViewItem*))); - connect(DrinkView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), - this,SLOT( showDrink(int, QListViewItem *, const QPoint&, int))); + connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink(QListViewItem*))); + connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), + this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int))); layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 ); if(QDir("db").exists()) { dbFile.setName( "db/drinkdb.txt"); } else dbFile.setName( QPEApplication::qpeDir()+"/etc/bartender/drinkdb.txt"); initDrinkDb(); } Bartender::~Bartender() { } /* this happens right before exit */ void Bartender::cleanUp() { dbFile.close(); } void Bartender::initDrinkDb() { if(!dbFile.isOpen()) if ( !dbFile.open( IO_ReadOnly)) { QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); return; } fillList(); } 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)); item= new QListViewItem( DrinkView, 0 ); item->setText( 0, s.right(s.length()-2)); i++; } } qDebug("there are currently %d of drinks", i); } diff --git a/noncore/apps/opie-bartender/searchresults.cpp b/noncore/apps/opie-bartender/searchresults.cpp index 4900d1f..a511a57 100644 --- a/noncore/apps/opie-bartender/searchresults.cpp +++ b/noncore/apps/opie-bartender/searchresults.cpp @@ -1,43 +1,43 @@ /**************************************************************************** ** Created: Sat Jul 20 08:23:27 2002 ** by: L.J. Potter <ljp@llornkcor.com> ** 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 "searchresults.h" #include <qlistbox.h> #include <qlayout.h> Search_Results::Search_Results( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( drinkName); drinkName = name; setCaption( drinkName ); Layout5 = new QGridLayout( this ); Layout5->setSpacing( 6 ); Layout5->setMargin( 4 ); ListBox1 = new QListBox( this, "ListBox1" ); Layout5->addMultiCellWidget( ListBox1, 0, 1, 0, 3 ); - connect( ListBox1, SIGNAL( clicked( QListBoxItem *)), SLOT( listSelected( QListBoxItem *)) ); + connect( ListBox1, SIGNAL( clicked(QListBoxItem*)), SLOT( listSelected(QListBoxItem*)) ); } Search_Results::~Search_Results() { } void Search_Results::listSelected(QListBoxItem *) { QDialog::accept(); } diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp index 64046d8..0ac337f 100644 --- a/noncore/apps/opie-console/btconfigwidget.cpp +++ b/noncore/apps/opie-console/btconfigwidget.cpp @@ -1,91 +1,91 @@ #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qcombobox.h> #include <qhbox.h> #include <qradiobutton.h> #include "iolayerbase.h" #include "btconfigwidget.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 ); } } BTConfigWidget::BTConfigWidget( const QString& name, QWidget* parent, const char* na ) : ProfileDialogConnectionWidget( name, parent, na ) { m_lay = new QVBoxLayout( this ); m_device = new QLabel( tr( "Device" ), this ); QHBox *deviceBox = new QHBox( this ); m_devRadio = new QRadioButton( deviceBox ); - connect( m_devRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotDevRadio( bool ) ) ); + connect( m_devRadio, SIGNAL( toggled(bool) ), this, SLOT( slotDevRadio(bool) ) ); m_deviceCmb = new QComboBox( deviceBox ); m_deviceCmb->setEditable( TRUE ); QLabel *macLabel = new QLabel( this ); macLabel->setText( tr( "Or peer mac address" ) ); QHBox *macBox = new QHBox( this ); m_macRadio = new QRadioButton( macBox ); - connect( m_macRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotMacRadio( bool ) ) ); + connect( m_macRadio, SIGNAL( toggled(bool) ), this, SLOT( slotMacRadio(bool) ) ); m_mac = new QLineEdit( macBox ); m_base = new IOLayerBase(this, "base"); m_lay->addWidget( m_device ); m_lay->addWidget( deviceBox ); m_lay->addWidget( macLabel ); m_lay->addWidget( macBox ); m_lay->addWidget( m_base ); m_deviceCmb->insertItem( "/dev/ttyU0" ); m_deviceCmb->insertItem( "/dev/ttyU1" ); } BTConfigWidget::~BTConfigWidget() { } void BTConfigWidget::load( const Profile& prof ) { int rad_flow = prof.readNumEntry("Flow"); int rad_parity = prof.readNumEntry("Parity"); int speed = prof.readNumEntry("Speed"); QString mac = prof.readEntry("Mac"); if (!mac.isEmpty() ) { m_mac->setText( mac ); } else { m_devRadio->setChecked( true ); } if (rad_flow == 1) { m_base->setFlow( IOLayerBase::Hardware ); } else if (rad_flow == 2) { m_base->setFlow( IOLayerBase::Software ); } else if (rad_flow == 0) { m_base->setFlow( IOLayerBase::None ); } if (rad_parity == 1) { m_base->setParity( IOLayerBase::Even ); } else if ( rad_parity == 2 ) { m_base->setParity( IOLayerBase::Odd ); } else { m_base->setParity( IOLayerBase::NonePar ); } switch( speed ) { case 115200: m_base->setSpeed(IOLayerBase::Baud_115200 ); diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp index 6bc1240..526d55e 100644 --- a/noncore/apps/opie-console/dialdialog.cpp +++ b/noncore/apps/opie-console/dialdialog.cpp @@ -17,82 +17,82 @@ DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags f QVBoxLayout *mainLayout = new QVBoxLayout( this ); QLabel *textLabel = new QLabel( this ); textLabel->setTextFormat( QLabel::RichText ); textLabel->setText( tr("Enter the number you want to dial. When finished, press ok") ); m_dialLine = new QLineEdit( this ); m_dialLine->setReadOnly( true ); m_dialLine->setFrame( false ); m_dialLine->setAlignment( Qt::AlignLeft ); QFont dialLine_font( m_dialLine->font() ); dialLine_font.setBold( TRUE ); dialLine_font.setPointSize( 18 ); m_dialLine->setFont( dialLine_font ); QWidget* dialWidget = new QWidget( this ); QGridLayout *layout = new QGridLayout( dialWidget , 4, 3 ); QButtonGroup *dialButtons = new QButtonGroup( ); QPushButton *number0 = new QPushButton( dialWidget ); number0->setText( QString( "0" ) ); QFont number0_font( number0->font() ); number0_font.setBold( TRUE ); number0->setFont( number0_font ); layout->addWidget( number0, 4, 1 ); dialButtons->insert( number0 ); int x = 0, y = 0; for ( int i = 0 ; i < 9; i++ ) { QPushButton *number = new QPushButton( dialWidget ); number->setText( QString( "%1" ).arg( i + 1 ) ); QFont number_font( number->font() ); number_font.setBold( TRUE ); number->setFont( number_font ); dialButtons->insert( number ); layout->addWidget( number, x, y ); if ( y < 2 ) { y++; } else { x++; y = 0; } } - connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) ); + connect( dialButtons, SIGNAL( clicked(int) ), this, SLOT( slotEnterNumber(int) ) ); mainLayout->addStretch( 2 ); mainLayout->addWidget( textLabel ); mainLayout->addStretch( 1 ); mainLayout->addWidget( m_dialLine ); mainLayout->addStretch( 2 ); mainLayout->addWidget( dialWidget ); mainLayout->addStretch( 4 ); } void DialDialog::slotEnterNumber( int number ) { // pretty stupid, just for testing .-) m_number.append(QString("%1").arg(number)); setNumber(m_number); } DialDialog::~DialDialog() { } QString DialDialog::number() { return m_number; } void DialDialog::setNumber( QString number ) { m_dialLine->setText( QString("%1").arg( number ) ); } diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 2c1d888..99d069f 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp @@ -1,71 +1,71 @@ #include "TEmuVt102.h" #include "profile.h" #include "emulation_handler.h" #include "script.h" 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 ); - connect(m_teEmu,SIGNAL(ImageSizeChanged(int, int) ), - this, SIGNAL(changeSize(int, int) ) ); - connect(m_teEmu, SIGNAL(sndBlock(const char*, int) ), - this, SLOT(recvEmulation(const char*, int) ) ); + connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ), + this, SIGNAL(changeSize(int,int) ) ); + connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ), + this, SLOT(recvEmulation(const char*,int) ) ); m_teEmu->setConnect( true ); m_teEmu->setHistory( TRUE ); load( prof ); } TEmulation* EmulationHandler::emulation() { return m_teEmu; } EmulationHandler::~EmulationHandler() { if (isRecording()) clearScript(); delete m_teEmu; delete m_teWid; } void EmulationHandler::load( const Profile& prof) { m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); int num = prof.readNumEntry("Color"); setColor( foreColor(num), backColor(num) ); m_teWid->setBackgroundColor(backColor(num) ); int term = prof.readNumEntry("Terminal", 0) ; switch(term) { default: case Profile::VT102: case Profile::VT100: m_teEmu->setKeytrans("vt100.keytab"); break; case Profile::Linux: m_teEmu->setKeytrans("linux.keytab"); break; case Profile::XTerm: m_teEmu->setKeytrans("default.Keytab"); break; } } void EmulationHandler::recv( const QByteArray& ar) { m_teEmu->onRcvBlock(ar.data(), ar.count() ); } void EmulationHandler::recvEmulation(const char* src, int len ) { QByteArray ar(len); memcpy(ar.data(), src, sizeof(char) * len ); if (isRecording()) m_script->append(ar); emit send(ar); diff --git a/noncore/apps/opie-console/emulation_layer.cpp b/noncore/apps/opie-console/emulation_layer.cpp index 2bef801..fd30ad7 100644 --- a/noncore/apps/opie-console/emulation_layer.cpp +++ b/noncore/apps/opie-console/emulation_layer.cpp @@ -61,108 +61,108 @@ refresh. This rule suits both bulk display operation as done by curses as well as individual characters typed. (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). Additionally, we trigger refreshing by newlines comming in to make visual snapshots of lists as produced by `cat', `ls' and likely programs, thereby 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 "emulation_layer.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> /* ------------------------------------------------------------------------- */ /* */ /* EmulationLayer */ /* */ /* ------------------------------------------------------------------------- */ #define CNTL(c) ((c)-'@') /*! */ EmulationLayer::EmulationLayer( WidgetLayer* gui ) : decoder((QTextDecoder*)NULL) { this->gui = gui; screen[0] = new Screen(gui->lines(),gui->columns()); screen[1] = new Screen(gui->lines(),gui->columns()); scr = screen[0]; bulk_nlcnt = 0; // reset bulk newline counter bulk_incnt = 0; // reset bulk counter connected = FALSE; QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) ); - QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ), - this,SLOT( onImageSizeChange( int, int ) ) ); - QObject::connect(gui,SIGNAL( changedHistoryCursor( int ) ), - this,SLOT( historyCursorChange( int ) ) ); - QObject::connect(gui,SIGNAL( keyPressed( QKeyEvent* ) ), - this,SLOT( onKeyPress( QKeyEvent* ) ) ); - QObject::connect(gui,SIGNAL( selectionBegin( const int, const int) ), - this,SLOT( onSelectionBegin( const int, const int ) ) ); - QObject::connect(gui,SIGNAL( selectionExtended( const int, const int ) ), - this,SLOT( onSelectionExtend( const int,const int ) ) ); - QObject::connect(gui,SIGNAL( selectionEnd( const bool ) ), - this,SLOT( setSelection( const bool ) ) ); + QObject::connect(gui,SIGNAL( imageSizeChanged(int,int) ), + this,SLOT( onImageSizeChange(int,int) ) ); + QObject::connect(gui,SIGNAL( changedHistoryCursor(int) ), + this,SLOT( historyCursorChange(int) ) ); + QObject::connect(gui,SIGNAL( keyPressed(QKeyEvent*) ), + this,SLOT( onKeyPress(QKeyEvent*) ) ); + QObject::connect(gui,SIGNAL( selectionBegin(const int,const int) ), + this,SLOT( onSelectionBegin(const int,const int) ) ); + QObject::connect(gui,SIGNAL( selectionExtended(const int,const int) ), + this,SLOT( onSelectionExtend(const int,const int) ) ); + QObject::connect(gui,SIGNAL( selectionEnd(const bool) ), + this,SLOT( setSelection(const bool) ) ); QObject::connect(gui,SIGNAL( selectionCleared() ), this,SLOT( clearSelection() ) ); } /*! */ EmulationLayer::~EmulationLayer() { delete screen[0]; delete screen[1]; bulk_timer.stop(); } /*! change between primary and alternate screen */ void EmulationLayer::setScreen(int n) { scr = screen[n&1]; } void EmulationLayer::setHistory(bool on) { screen[0]->setScroll(on); if (!connected) return; showBulk(); } bool EmulationLayer::history() { return screen[0]->hasScroll(); } void EmulationLayer::setCodec(int c) { //FIXME: check whether we have to free codec codec = c ? QTextCodec::codecForName("utf8") : QTextCodec::codecForLocale(); if (decoder) delete decoder; decoder = codec->makeDecoder(); } void EmulationLayer::setKeytrans(int no) { keytrans = KeyTrans::find(no); } diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index c232d89..eb32551 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp @@ -215,135 +215,135 @@ QSize FunctionKeyboard::sizeHint() const { return QSize(width(), keyHeight * numRows + 1); } void FunctionKeyboard::loadDefaults() { numRows = DEFAULT_ROWS; numCols = DEFAULT_COLS; keyWidth = (double)width()/numCols; // have to reset this thing too keys.insert( "r0c0", FKey ("Enter", "enter", Qt::Key_Enter, 0)); keys.insert( "r0c1", FKey ("Space", "space", Qt::Key_Space, Qt::Key_Space)); keys.insert( "r0c2", FKey ("Tab", "tab", Qt::Key_Tab, 0)); keys.insert( "r0c3", FKey ("Up", "up", Qt::Key_Up, 0)); keys.insert( "r0c4", FKey ("Down", "down", Qt::Key_Down, 0)); keys.insert( "r0c7", FKey ("Ho", 0, 4112, 0)); keys.insert( "r0c8", FKey ("End", 0, 4113, 0)); keys.insert( "r0c9", FKey ("Pu", 0, 4118, 0)); keys.insert( "r0c10", FKey ("Pd", 0, 4119, 0)); keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff)); keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); 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"); kb = new FunctionKeyboard(this); - connect (kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), - this, SLOT(slotKeyPressed(FKey, ushort, ushort, bool))); + 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); connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); l = new QLabel("Label", editKey); m_labels = new QComboBox(true, editKey); m_labels->setInsertionPolicy(QComboBox::AtCurrent); m_labels->insertItem(""); QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); for (uint i = 0; i < files.count(); i++) { m_labels->insertItem( Resource::loadPixmap("console/keys/" + files[i]), files[i]); } connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int))); - connect (m_labels, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeLabelText(const QString&))); + connect (m_labels, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeLabelText(const QString&))); l = new QLabel("Q Keycode", editKey); m_qvalues = new QComboBox(true, editKey); m_qvalues->setInsertionPolicy(QComboBox::AtTop); m_qvalues->setDuplicatesEnabled(false); m_qvalues->insertItem(""); - connect (m_qvalues, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeQCode(const QString&))); + connect (m_qvalues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeQCode(const QString&))); l = new QLabel("Unicode Value", editKey); m_uniValues = new QComboBox(true, editKey); m_uniValues->setInsertionPolicy(QComboBox::AtTop); m_uniValues->setDuplicatesEnabled(false); m_uniValues->insertItem(""); - connect (m_uniValues, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeUnicode(const QString&))); + connect (m_uniValues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeUnicode(const QString&))); QVBoxLayout *root = new QVBoxLayout(this, 2); root->addWidget(kb); root->addWidget(dimentions); root->addWidget(editKey); } FunctionKeyboardConfig::~FunctionKeyboardConfig() { } void FunctionKeyboardConfig::load (const Profile& prof) { kb->keys.clear(); kb->loadDefaults(); m_rowBox->setValue(prof.readNumEntry("keb_rows", 2)); m_colBox->setValue(prof.readNumEntry("keb_cols", 10)); /* load all the keys to the keyboard */ for (int i = 0; i <= m_rowBox->value() -1; i++) for (int j = 0; j <= m_colBox->value() -1; j++) { QString h = "r" + QString::number(i) + "c" + QString::number(j); QString values = prof.readEntry("keb_" + h); if (!values.isEmpty()) { QStringList l = QStringList::split(QChar('|'), values, TRUE); kb->keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt()); // load pixmap if used if (!l[1].isEmpty()) { kb->keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) ); } } } } void FunctionKeyboardConfig::save (Profile& prof) { prof.writeEntry("keb_rows", m_rowBox->value()); prof.writeEntry("keb_cols", m_colBox->value()); QMap<QString, FKey>::Iterator it; for ( it = kb->keys.begin(); it != kb->keys.end(); it++) { FKey k = it.data(); QString entry = k.label + "|" diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp index 37bf797..1a8c979 100644 --- a/noncore/apps/opie-console/io_bt.cpp +++ b/noncore/apps/opie-console/io_bt.cpp @@ -1,88 +1,88 @@ #include "io_bt.h" IOBt::IOBt( const Profile &config ) : IOSerial( config ) { m_attach = 0; } IOBt::~IOBt() { if ( m_attach ) { delete m_attach; } } void IOBt::close() { IOSerial::close(); // still need error handling if ( m_attach ) { delete m_attach; m_attach = 0; } } bool IOBt::open() { bool ret = false; // only set up bt stuff if mac address was set, otherwise use the device set if ( !m_mac.isEmpty() ) { // now it should also be checked, if there is a connection to the device with that mac allready // 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( OProcess* ) ), - this, SLOT( slotExited( OProcess* ) ) ); + connect( m_attach, SIGNAL( processExited(OProcess*) ), + this, SLOT( slotExited(OProcess*) ) ); if ( m_attach->start() ) { ret = IOSerial::open(); } else { qWarning("could not attach to device"); 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; } void IOBt::reload( const Profile &config ) { m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); } QString IOBt::identifier() const { return "bluetooth"; } QString IOBt::name() const { return "BLuetooth IO Layer"; } void IOBt::slotExited( OProcess* proc ){ close(); delete proc; } QBitArray IOBt::supports() const { return QBitArray( 3 ); } bool IOBt::isConnected() { return false; } diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp index e360fb4..b281b7d 100644 --- a/noncore/apps/opie-console/io_irda.cpp +++ b/noncore/apps/opie-console/io_irda.cpp @@ -1,77 +1,77 @@ #include "io_irda.h" IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { m_attach = 0; } IOIrda::~IOIrda() { if ( m_attach ) { delete m_attach; } } void IOIrda::close() { IOSerial::close(); // still need error handling delete m_attach; } bool IOIrda::open() { bool ret; // irdaattach here m_attach = new OProcess(); *m_attach << "irattach /dev/ttyS2 -s"; - connect( m_attach, SIGNAL( processExited( OProcess* ) ), - this, SLOT( slotExited( OProcess* ) ) ); + connect( m_attach, SIGNAL( processExited(OProcess*) ), + this, SLOT( slotExited(OProcess*) ) ); if ( m_attach->start() ) { ret= IOSerial::open(); } else { // emit error!!! qWarning("could not attach to device"); 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); m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); } QString IOIrda::identifier() const { return "irda"; } QString IOIrda::name() const { return "Irda IO Layer"; } void IOIrda::slotExited(OProcess* proc ){ close(); delete proc; } QBitArray IOIrda::supports()const { return QBitArray( 3 ); } bool IOIrda::isConnected() { return false; } void IOIrda::send(const QByteArray &data) { qDebug( "Please overload me..." ); } diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 1d2385f..197f799 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -165,136 +165,136 @@ void MainWindow::initUI() { m_closewindow = new QAction(); m_closewindow->setText( tr("Close Window") ); m_closewindow->addTo( m_console ); connect( m_closewindow, SIGNAL(activated() ), this, SLOT(slotClose() ) ); /* * script actions */ m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); m_recordScript->addTo(m_scripts); connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); m_saveScript->addTo(m_scripts); connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); /* * action that open/closes the keyboard */ m_openKeys = new QAction (tr("Open Keyboard..."), Resource::loadPixmap( "console/keys/keyboard_icon" ), QString::null, 0, this, 0); m_openKeys->setToggleAction(true); connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); /* insert the submenu */ m_console->insertItem(tr("New from Profile"), m_sessionsPop, -1, 0); /* insert the connection menu */ m_bar->insertItem( tr("Connection"), m_console ); /* the scripts menu */ m_bar->insertItem( tr("Scripts"), m_scripts ); /* and the keyboard */ m_keyBar = new QToolBar(this); addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); m_keyBar->setHorizontalStretchable( TRUE ); m_keyBar->hide(); m_kb = new FunctionKeyboard(m_keyBar); - connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), - this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); + connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), + this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); a = new QAction(tr("Copy"), Resource::loadPixmap("copy"), QString::null, 0, this, 0 ); //a->addTo( m_icons ); connect( a, SIGNAL(activated() ), this, SLOT(slotCopy() ) ); QAction *paste = new QAction(tr("Paste"), Resource::loadPixmap("paste"), QString::null, 0, this, 0 ); connect( paste, SIGNAL(activated() ), this, SLOT(slotPaste() ) ); newCon->addTo( m_icons ); //m_setProfiles->addTo( m_icons ); paste->addTo( m_icons ); m_openKeys->addTo(m_icons); m_fullscreen->addTo( m_icons ); m_connect->setEnabled( false ); m_disconnect->setEnabled( false ); m_terminate->setEnabled( false ); m_transfer->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); m_recordScript->setEnabled( false ); m_saveScript->setEnabled( false ); m_fullscreen->setEnabled( false ); m_closewindow->setEnabled( false ); m_wrap->setEnabled( false ); /* * connect to the menu activation */ - connect( m_sessionsPop, SIGNAL(activated( int ) ), - this, SLOT(slotProfile( int ) ) ); + connect( m_sessionsPop, SIGNAL(activated(int) ), + this, SLOT(slotProfile(int) ) ); m_consoleWindow = new TabWidget( this, "blah"); connect(m_consoleWindow, SIGNAL(activated(Session*) ), this, SLOT(slotSessionChanged(Session*) ) ); setCentralWidget( m_consoleWindow ); slotQuickLaunch(); } ProfileManager* MainWindow::manager() { return m_manager; } TabWidget* MainWindow::tabWidget() { return m_consoleWindow; } void MainWindow::populateProfiles() { m_sessionsPop->clear(); Profile::ValueList list = manager()->all(); for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { m_sessionsPop->insertItem( (*it).name() ); } } void MainWindow::populateScripts() { m_scriptsPop->clear(); m_scriptsData.clear(); DocLnkSet files(QPEApplication::documentDir(), "text/plain"); QListIterator<DocLnk> dit(files.children()); for (; dit.current(); ++dit) { if (*dit && (*dit)->name().length()>0) { QFileInfo info((*dit)->file()); if (info.extension(false) == "script") { m_scriptsData.append(new DocLnk(**dit)); m_scriptsPop->insertItem((*dit)->name()); } } } } MainWindow::~MainWindow() { delete m_factory; manager()->save(); } MetaFactory* MainWindow::factory() { return m_factory; diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 979e89d..6e1e23e 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp @@ -86,100 +86,100 @@ void ProfileEditorDialog::initUI() m_name = new QLineEdit(tabprof); QLabel *con = new QLabel(tr("Connection"), tabprof ); QLabel *term = new QLabel(tr("Terminal"), tabprof ); m_conCmb = new QComboBox( tabprof ); m_termCmb = new QComboBox( tabprof ); m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); // layouting QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); vbox3->add(name); vbox3->add(m_name); vbox3->add(con ); vbox3->add(m_conCmb ); vbox3->add(term ); vbox3->add(m_termCmb ); vbox3->add(m_autoConnect); vbox3->addStretch(1); m_showconntab = 0; tabWidget->addTab(tabprof, "", QObject::tr("Profile")); tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys")); tabWidget->setCurrentTab( tabprof ); // fill the comboboxes QStringList list = m_fact->connectionWidgets(); QStringList::Iterator it; for (it =list.begin(); it != list.end(); ++it ) { m_conCmb->insertItem( (*it) ); } list = m_fact->terminalWidgets(); for (it =list.begin(); it != list.end(); ++it ) { m_termCmb->insertItem( (*it) ); } // load profile values m_name->setText(m_prof.name()); slotKeyActivated( "Default Keyboard" ); setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); slotTermActivated( m_fact->external(m_prof.terminalName() ) ); m_autoConnect->setChecked(m_prof.autoConnect()); // signal and slots - connect(m_conCmb, SIGNAL(activated(const QString& ) ), + connect(m_conCmb, SIGNAL(activated(const QString&) ), this, SLOT(slotConActivated(const QString&) ) ); - connect(m_termCmb, SIGNAL(activated(const QString& ) ), - this, SLOT(slotTermActivated(const QString& ) ) ); + connect(m_termCmb, SIGNAL(activated(const QString&) ), + this, SLOT(slotTermActivated(const QString&) ) ); } ProfileEditorDialog::~ProfileEditorDialog() { } void ProfileEditorDialog::accept() { if(profName().isEmpty()) { QMessageBox::information(this, QObject::tr("Invalid profile"), QObject::tr("Please enter a profile name.")); return; } // Save profile and plugin profile //if(plugin_plugin) plugin_plugin->save(); // Save general values m_prof.setName( profName() ); m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); m_prof.setAutoConnect( m_autoConnect->isChecked() ); if (m_con ) m_con->save( m_prof ); if (m_term ) m_term->save( m_prof ); if (m_key) m_key->save( m_prof ); QDialog::accept(); } QString ProfileEditorDialog::profName()const { return m_name->text(); } QCString ProfileEditorDialog::profType()const { /*QStringList w = m_fact->configWidgets(); for(QStringList::Iterator it = w.begin(); it != w.end(); it++) if(device_box->currentText() == m_fact->name((*it))) return (*it); */ return QCString(); } diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp index 1034ede..b7f14c5 100644 --- a/noncore/apps/opie-console/session.cpp +++ b/noncore/apps/opie-console/session.cpp @@ -13,98 +13,98 @@ Session::Session() { } Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) : m_name( na ), m_widget( widget ), m_layer( lay ) { // m_widLay = 0l; // m_emLay = 0l; m_emu = 0l; } Session::~Session() { delete m_layer; delete m_emu; delete m_widget; /* the widget layer should be deleted by the m_widget */ } QString Session::name()const { return m_name; } QWidgetStack* Session::widgetStack() { return m_widget; } IOLayer* Session::layer() { return m_layer; } EmulationHandler* Session::emulationHandler() { return m_emu; } QWidget* Session::widget() { if (!m_emu ) return 0l; return m_emu->widget(); } Profile Session::profile()const { return m_prof; } /* WidgetLayer* Session::emulationWidget() { return m_widLay; } */ void Session::connect() { if ( !m_layer || !m_emu ) return; QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), m_emu, SLOT(recv(const QByteArray&) ) ); QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), m_layer, SLOT(send(const QByteArray&) ) ); - QObject::connect(m_emu, SIGNAL(changeSize(int, int) ), - m_layer, SLOT(setSize(int, int) ) ); + QObject::connect(m_emu, SIGNAL(changeSize(int,int) ), + m_layer, SLOT(setSize(int,int) ) ); } void Session::disconnect() { if ( !m_layer || !m_emu ) return; QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), m_emu, SLOT(recv(const QByteArray&) ) ); QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ), m_layer, SLOT(send(const QByteArray&) ) ); } void Session::setName( const QString& na){ m_name = na; } void Session::setWidgetStack( QWidgetStack* wid ) { delete m_emu; m_emu = 0l; delete m_widget; /* the EmulationLayer was destroyed... */ m_widget = wid; } void Session::setIOLayer( IOLayer* lay ) { delete m_layer; m_layer = lay; } void Session::setEmulationHandler( EmulationHandler* lay ) { delete m_emu; m_emu = lay; } void Session::setProfile( const Profile& prof ) { m_prof = prof; } /* void Session::setEmulationWidget( WidgetLayer* lay ) { delete m_widLay; m_widLay = lay; } */ void Session::setTransferDialog(QWidget *d) { m_transfer = d; } diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp index c47e73e..2f82417 100644 --- a/noncore/apps/opie-console/sz_transfer.cpp +++ b/noncore/apps/opie-console/sz_transfer.cpp @@ -1,84 +1,84 @@ #include "sz_transfer.h" #include <qfile.h> #include <stdio.h> #include <sys/termios.h> SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) { } SzTransfer::~SzTransfer() { } void SzTransfer::sendFile(const QFile& file) { sendFile(file.name()); } void SzTransfer::sendFile(const QString& file) { //setcbreak(2); /* raw no echo */ proc = new OProcess; *proc << "sz"; *proc << "-v" << "-v" << "-b" << file; - connect(proc, SIGNAL(processExited(OProcess *)), + connect(proc, SIGNAL(processExited(OProcess*)), this, SLOT(sent())); - connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), - this, SLOT(SzReceivedStdout(OProcess *, char *, int))); - connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), - this, SLOT(SzReceivedStderr(OProcess *, char *, int))); - connect(layer(), SIGNAL(received(const QByteArray &)), - this, SLOT(receivedStdin(const QByteArray &))); + connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)), + this, SLOT(SzReceivedStdout(OProcess*,char*,int))); + connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)), + this, SLOT(SzReceivedStderr(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); 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()); // recieved data from the io layer goes to sz proc->writeStdin(data.data(), data.size()); } void SzTransfer::sent() { qWarning("sent file"); //setcbreak(0); /* default */ delete proc; - disconnect(layer(), SIGNAL(received(const QByteArray &)), - this, SLOT(receivedStdin(const QByteArray &))); + disconnect(layer(), SIGNAL(received(const QByteArray&)), + this, SLOT(receivedStdin(const QByteArray&))); } diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp index 4a7202d..b1725db 100644 --- a/noncore/apps/opie-console/test/senderui.cpp +++ b/noncore/apps/opie-console/test/senderui.cpp @@ -1,77 +1,77 @@ #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <sys/termios.h> #include <qmultilineedit.h> #include <qsocketnotifier.h> #include "../profile.h" #include "../io_serial.h" #include "../filetransfer.h" #include "../filereceive.h" #include <opie2/oprocess.h> #include "senderui.h" 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); ser = new IOSerial(prof); - connect(ser, SIGNAL(received(const QByteArray& ) ), + connect(ser, SIGNAL(received(const QByteArray&) ), this, SLOT(got(const QByteArray&) ) ); if ( ser->open() ) qWarning("opened!!!"); else qWarning("could not open"); } 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() ); str = str.replace( QRegExp("\n"), "\r"); ser->send( str ); } void SenderUI::got(const QByteArray& ar) { qWarning("got:"); for ( uint i = 0; i < ar.count(); i++ ) { printf("%c", ar[i] ); } printf("\n"); } void SenderUI::fileTransComplete() { qWarning("file transfer complete"); } void SenderUI::send() { } void SenderUI::slotRev(){ qWarning("Going to receive!"); FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); rev->receive(); } diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp index 30e7caf..d494a6c 100644 --- a/noncore/apps/opie-console/transferdialog.cpp +++ b/noncore/apps/opie-console/transferdialog.cpp @@ -80,109 +80,109 @@ TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const ch hbox2 = new QHBoxLayout(vbox, 2); hbox2->add(ok); hbox2->add(cancel); setCaption(QObject::tr("File transfer")); show(); connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); } TransferDialog::~TransferDialog() { } void TransferDialog::slotFilename() { QString f; f = Opie::OFileDialog::getOpenFileName(0); if(!f.isNull()) filename->setText(f); } void TransferDialog::slotTransfer() { if((m_transfermode == id_send) && (filename->text().isEmpty())) { QMessageBox::information(this, QObject::tr("Attention"), QObject::tr("No file has been specified.")); return; } ok->setEnabled(false); cleanup(); m_autocleanup = 0; if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); else statusbar->setText(QObject::tr("Receiving...")); if(m_transfermode == id_send) { m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); m_lay->sendFile(filename->text()); - connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), - SLOT(slotProgress(const QString&, int, int, int, int, int))); - connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); + connect(m_lay, SIGNAL(progress(const QString&,int,int,int,int,int)), + SLOT(slotProgress(const QString&,int,int,int,int,int))); + connect(m_lay, SIGNAL(error(int,const QString&)), SLOT(slotError(int,const QString&))); connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); } else { m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); m_recvlay->receive(); - connect(m_recvlay, SIGNAL(progress(const QString&, int, int, int, int, int)), - SLOT(slotProgress(const QString&, int, int, int, int, int))); - connect(m_recvlay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); + connect(m_recvlay, SIGNAL(progress(const QString&,int,int,int,int,int)), + SLOT(slotProgress(const QString&,int,int,int,int,int))); + connect(m_recvlay, SIGNAL(error(int,const QString&)), SLOT(slotError(int,const QString&))); connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); } } void TransferDialog::cleanup() { if(m_lay) { m_lay->cancel(); delete m_lay; m_lay = 0l; } if(m_recvlay) { m_recvlay->cancel(); delete m_recvlay; m_recvlay = 0l; } } void TransferDialog::slotCancel() { ok->setEnabled(true); statusbar->setText(QObject::tr("Ready")); if((m_lay) || (m_recvlay)) { cleanup(); if(m_autocleanup) { m_running = false; close(); } else { QMessageBox::information(this, QObject::tr("Cancelled"), QObject::tr("The file transfer has been cancelled.")); } } else { m_running = false; close(); } } void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int ) diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index e759249..b0d589e 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp @@ -284,117 +284,117 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) mb = new QMenuBar( menubar ); #else mb = new QMenuBar( menubar ); #endif //#ifdef USEQPE QPopupMenu* tmp = new QPopupMenu(mb); mb->insertItem( geticon( "AppsIcon" ), tmp ); //#else // QMenuBar* tmp = mb; //#endif QPopupMenu *file = new QPopupMenu( mb ); tmp->insertItem( tr( "File" ), file ); QPopupMenu *navigation = new QPopupMenu(mb); tmp->insertItem( tr( "Navigation" ), navigation ); QPopupMenu *view = new QPopupMenu( mb ); tmp->insertItem( tr( "View" ), view ); QPopupMenu *marks = new QPopupMenu( this ); tmp->insertItem( tr( "Marks" ), marks ); QPopupMenu *settings = new QPopupMenu( this ); tmp->insertItem( tr( "Settings" ), settings ); // addToolBar(menubar, "Menus",QMainWindow::Top); // addToolBar(fileBar, "Toolbar",QMainWindow::Top); // QPopupMenu *edit = new QPopupMenu( this ); /* QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); a->addTo( bar ); a->addTo( file ); */ editorStack = new QWidgetStack( this ); setCentralWidget( editorStack ); searchVisible = FALSE; regVisible = FALSE; m_fontVisible = false; m_annoWin = new CAnnoEdit(editorStack); editorStack->addWidget(m_annoWin, get_unique_id()); - connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) ); + connect( m_annoWin, SIGNAL( finished(const QString&,const QString&) ), this, SLOT( addAnno(const QString&,const QString&) ) ); connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); m_infoWin = new infowin(editorStack); editorStack->addWidget(m_infoWin, get_unique_id()); connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); m_graphicwin = new GraphicWin(editorStack); editorStack->addWidget(m_graphicwin, get_unique_id()); connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); // bkmkselector = new QListBox(editorStack, "Bookmarks"); bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); editorStack->addWidget( bkmkselector, get_unique_id() ); /* importSelector = new FileSelector( "*", editorStack, "importselector", false ); - connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) ); + connect( importSelector, SIGNAL( fileSelected(const DocLnk&) ), this, SLOT( importFile(const DocLnk&) ) ); editorStack->addWidget( importSelector, get_unique_id() ); // don't need the close visible, it is redundant... importSelector->setCloseVisible( FALSE ); */ // qDebug("Reading file list"); readfilelist(); reader = new QTReader( editorStack ); reader->bDoUpdates = false; #ifdef USEQPE ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); #endif // qDebug("Reading config"); // Config config( APPDIR ); config.setGroup( "View" ); m_debounce = config.readNumEntry("Debounce", 0); #ifdef USEQPE m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); #else m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); #endif reader->bstripcr = config.readBoolEntry( "StripCr", true ); reader->bfulljust = config.readBoolEntry( "FullJust", false ); reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); reader->setlead(config.readNumEntry( "ExtraLead", 0 )); reader->btextfmt = config.readBoolEntry( "TextFmt", false ); reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); reader->bpeanut = config.readBoolEntry( "Peanut", false ); reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); reader->bdepluck = config.readBoolEntry( "Depluck", false ); reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); reader->bonespace = config.readBoolEntry( "OneSpace", false ); reader->bunindent = config.readBoolEntry( "Unindent", false ); reader->brepara = config.readBoolEntry( "Repara", false ); reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); reader->bindenter = config.readNumEntry( "Indent", 0 ); reader->m_textsize = config.readNumEntry( "FontSize", 12 ); reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); reader->m_lastfile = config.readEntry( "LastFile", QString::null ); reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); @@ -408,97 +408,97 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) reader->brepalm = config.readBoolEntry( "Repalm", true ); #endif reader->bremap = config.readBoolEntry( "Remap", true ); reader->bmakebold = config.readBoolEntry( "MakeBold", false ); reader->setContinuous(config.readBoolEntry( "Continuous", true )); m_targetapp = config.readEntry( "TargetApp", QString::null ); m_targetmsg = config.readEntry( "TargetMsg", QString::null ); #ifdef _SCROLLPIPE reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); #endif m_twoTouch = config.readBoolEntry( "TwoTouch", false); m_doAnnotation = config.readBoolEntry( "Annotation", false); m_doDictionary = config.readBoolEntry( "Dictionary", false); m_doClipboard = config.readBoolEntry( "Clipboard", false); m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); m_leftScroll = config.readBoolEntry("LeftScroll", false); m_rightScroll = config.readBoolEntry("RightScroll", false); m_upScroll = config.readBoolEntry("UpScroll", true); m_downScroll = config.readBoolEntry("DownScroll", true); m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); #ifndef USEQPE config.setGroup( "Geometry" ); setGeometry(0,0, config.readNumEntry( "width", QApplication::desktop()->width()/2 ), config.readNumEntry( "height", QApplication::desktop()->height()/2 )); move( config.readNumEntry( "x", 20 ), config.readNumEntry( "y", 20 )); #endif setTwoTouch(m_twoTouch); connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) ); connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); - connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, const QString&) ) ); + connect( reader, SIGNAL( OnWordSelected(const QString&,size_t,const QString&) ), this, SLOT( OnWordSelected(const QString&,size_t,const QString&) ) ); connect( reader, SIGNAL( OnURLSelected(const QString&) ), this, SLOT( OnURLSelected(const QString&) ) ); editorStack->addWidget( reader, get_unique_id() ); m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL); connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) ); m_preferences_action->addTo( settings ); m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL); connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) ); m_saveconfig_action->addTo( settings ); m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL); connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) ); m_loadconfig_action->addTo( settings ); m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL); connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) ); m_tidyconfig_action->addTo( settings ); settings->insertSeparator(); m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL); connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) ); m_toolbarprefs_action->addTo( settings ); m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 ); connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); m_open_action->addTo( file ); m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 ); connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) ); m_close_action->addTo( file ); #ifdef _SCRIPT a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL); connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) ); a->addTo( file ); #endif /* a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) ); a->addTo( file ); a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); a->addTo( filebar() ); a->addTo( edit ); */ @@ -681,170 +681,170 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) ); marks->insertSeparator(); m_autogen_action->addTo( marks ); m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL); connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) ); m_clear_action->addTo( marks ); m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL ); connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); m_save_action->addTo( marks ); m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL); connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); marks->insertSeparator(); m_tidy_action->addTo( marks ); m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL); connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) ); marks->insertSeparator(); m_startBlock_action->addTo( marks ); m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL); connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); m_endBlock_action->addTo( marks ); m_bkmkAvail = NULL; setToolBarsMovable(m_tbmove); addtoolbars(&config); pbar = new QProgressBar(this); pbar->hide(); searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); searchBar->setHorizontalStretchable( TRUE ); connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); searchEdit = new QLineEdit( searchBar, "searchEdit" ); // QFont f("unifont", 16 /*, QFont::Bold*/); // searchEdit->setFont( f ); searchBar->setStretchableWidget( searchEdit ); #ifdef __ISEARCH - connect( searchEdit, SIGNAL( textChanged( const QString & ) ), - this, SLOT( search( const QString& ) ) ); + connect( searchEdit, SIGNAL( textChanged(const QString&) ), + this, SLOT( search(const QString&) ) ); #else - connect( searchEdit, SIGNAL( returnPressed( ) ), - this, SLOT( search( ) ) ); + connect( searchEdit, SIGNAL( returnPressed() ), + this, SLOT( search() ) ); #endif QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); a->addTo( searchBar ); a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); a->addTo( searchBar ); searchBar->hide(); regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); regBar->setHorizontalStretchable( TRUE ); regEdit = new QLineEdit( regBar, "regEdit" ); // regEdit->setFont( f ); regBar->setStretchableWidget( regEdit ); - connect( regEdit, SIGNAL( returnPressed( ) ), + connect( regEdit, SIGNAL( returnPressed() ), this, SLOT( do_regaction() ) ); a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); a->addTo( regBar ); a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); a->addTo( regBar ); regBar->hide(); m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); m_fontBar->setHorizontalStretchable( TRUE ); // qDebug("Font selector"); m_fontSelector = new QComboBox(false, m_fontBar); m_fontBar->setStretchableWidget( m_fontSelector ); { #ifndef USEQPE QFontDatabase f; #else FontDatabase f; #endif QStringList flist = f.families(); bool realfont = false; for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) { if (reader->m_fontname == *nm) { realfont = true; } if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm); } if (!realfont) reader->m_fontname = flist[0]; } // delete the FontDatabase!!! - connect( m_fontSelector, SIGNAL( activated(const QString& ) ), + connect( m_fontSelector, SIGNAL( activated(const QString&) ), this, SLOT( do_setfont(const QString&) ) ); - connect( m_fontSelector, SIGNAL( activated(int ) ), + connect( m_fontSelector, SIGNAL( activated(int) ), this, SLOT( do_setencoding(int) ) ); m_fontBar->hide(); m_fontVisible = false; #ifdef USEMSGS - connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), - this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); + connect(qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), + this, SLOT( msgHandler(const QCString&,const QByteArray&) ) ); #endif // qDebug("Initing"); reader->init(); // qDebug("Inited"); // m_buttonAction[m_spaceTarget]->setOn(true); // qDebug("fonting"); do_setfont(reader->m_fontname); if (!reader->m_lastfile.isEmpty()) { // qDebug("doclnk"); // doc = new DocLnk(reader->m_lastfile); // qDebug("doclnk done"); if (pOpenlist != NULL) { /* int ind = 0; Bkmk* p = (*pOpenlist)[ind]; while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) { p = (*pOpenlist)[++ind]; } */ Bkmk* p = NULL; for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) { p = iter.pContent(); if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) { break; } // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); p = NULL; } if (p != NULL) { // qDebug("openfrombkmk"); if (!openfrombkmk(p)) showEditTools(); } else { // qDebug("openfile"); openFile( reader->m_lastfile ); } } else { diff --git a/noncore/apps/opie-reader/fileBrowser.cpp b/noncore/apps/opie-reader/fileBrowser.cpp index ebd14f3..e1cde6c 100644 --- a/noncore/apps/opie-reader/fileBrowser.cpp +++ b/noncore/apps/opie-reader/fileBrowser.cpp @@ -29,100 +29,100 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo filterspec(QDir::All) { // showMaximized(); if ( !name ) setName( "fileBrowser" ); /* if (parent != NULL) { #ifdef OPIE move(0,0); resize( parent->width(), parent->height() ); #else setGeometry(parent->x(), parent->y(), parent->width(), parent->height() ); #endif } */ // showFullScreen(); setCaption(tr( "Browse for file" ) ); filterStr=filter; buttonOk = new QPushButton( this, "buttonOk" ); buttonOk->setFixedSize( 25, 25 ); buttonOk->setAutoDefault( false ); buttonOk->setText( tr( "/" ) ); buttonShowHidden = new QPushButton( this, "buttonShowHidden" ); // buttonShowHidden->setFixedSize( 50, 25 ); buttonShowHidden->setText( tr( "Hidden" ) ); buttonShowHidden->setAutoDefault( false ); buttonShowHidden->setToggleButton( true ); buttonShowHidden->setOn( false ); dirLabel = new QLabel(this, "DirLabel"); dirLabel->setAlignment(AlignLeft | AlignVCenter | ExpandTabs | WordBreak); dirLabel->setText(currentDir.canonicalPath()); ListView = new QtrListView( this, "ListView" ); ListView->addColumn( tr( "Name" ) ); ListView->setSorting( 2, FALSE); ListView->addColumn( tr( "Size" ) ); ListView->setSelectionMode(QListView::Single); ListView->setAllColumnsShowFocus( TRUE ); ListView->setColumnWidthMode(0, QListView::Manual); ListView->setColumnWidthMode(1, QListView::Manual); // signals and slots connections connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) ); - connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); - connect( ListView, SIGNAL(clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); - connect( ListView, SIGNAL(OnOKButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); - connect( ListView, SIGNAL(OnCentreButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); + connect( ListView, SIGNAL(doubleClicked(QListViewItem*)), SLOT(listDoubleClicked(QListViewItem*)) ); + connect( ListView, SIGNAL(clicked(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); + connect( ListView, SIGNAL(OnOKButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); + connect( ListView, SIGNAL(OnCentreButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) ); QVBoxLayout* grid = new QVBoxLayout(this); QHBoxLayout* hgrid = new QHBoxLayout(grid); hgrid->addWidget(dirLabel,1); hgrid->addWidget(buttonShowHidden); hgrid->addWidget(buttonOk); grid->addWidget(ListView,1); if (allownew) { m_filename = new QLineEdit(this); grid->addWidget(m_filename); connect( m_filename, SIGNAL( returnPressed() ), this, SLOT( onReturn() )); } else { m_filename = NULL; } if (QFileInfo(iPath).exists()) { currentDir.setPath(iPath); #ifdef _WINDOWS _chdir(iPath.latin1()); #else chdir(iPath.latin1()); #endif } else { currentDir.setPath(QDir::currentDirPath()); chdir(QDir::currentDirPath().latin1()); } populateList(); if (modal) QPEApplication::showDialog( this ); } void fileBrowser::resizeEvent(QResizeEvent* e) { ListView->setColumnWidth(1,(ListView->width())/4); ListView->setColumnWidth(0,ListView->width()-20-ListView->columnWidth(1)); } fileBrowser::~fileBrowser() { diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp index 1fb2a3d..061748e 100644 --- a/noncore/apps/opie-sheet/mainwindow.cpp +++ b/noncore/apps/opie-sheet/mainwindow.cpp @@ -1,94 +1,94 @@ /*************************************************************************** * * * 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. * * * ***************************************************************************/ /* * Opie Sheet (formerly Sheet/Qt) * by Serdar Ozler <sozler@sitebest.com> */ #include "mainwindow.h" #include <qpe/resource.h> #include <qpe/qpeapplication.h> #include <qmessagebox.h> #include <qradiobutton.h> #include "cellformat.h" #include "numberdlg.h" #include "textdlg.h" #include "sortdlg.h" #include "finddlg.h" #define DEFAULT_NUM_ROWS 300 #define DEFAULT_NUM_COLS (26*3) #define DEFAULT_NUM_SHEETS 3 MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) :QMainWindow(parent, n, fl) { // initialize variables documentModified=FALSE; // construct objects currentDoc=0; fileSelector=new FileSelector("application/sheet-qt", this, QString::null); ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE); connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); - connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &))); - connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &))); - connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk &)),this,SLOT(slotImportExcel(const DocLnk &))); + connect(fileSelector, SIGNAL(newSelected(const DocLnk&)), this, SLOT(selectorFileNew(const DocLnk&))); + connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(selectorFileOpen(const DocLnk&))); + connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk&)),this,SLOT(slotImportExcel(const DocLnk&))); connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide())); listSheets.setAutoDelete(TRUE); initActions(); initMenu(); initEditToolbar(); initFunctionsToolbar(); initStandardToolbar(); initSheet(); // set window title setCaption(tr("Opie Sheet")); // create sheets selectorFileNew(DocLnk()); } MainWindow::~MainWindow() { if (currentDoc) delete currentDoc; } void MainWindow::documentSave(DocLnk *lnkDoc) { FileManager fm; QByteArray streamBuffer; QDataStream stream(streamBuffer, IO_WriteOnly); typeSheet *currentSheet=findSheet(sheet->getName()); if (!currentSheet) { QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!")); return; } sheet->copySheetData(¤tSheet->data); stream.writeRawBytes("SQT100", 6); stream << (Q_UINT32)listSheets.count(); for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) { stream << tempSheet->name << (Q_UINT32)tempSheet->data.count(); for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next()) stream << (Q_UINT32)tempCell->col << (Q_UINT32)tempCell->row << tempCell->borders.right << tempCell->borders.bottom << tempCell->background << (Q_UINT32)tempCell->alignment << tempCell->fontColor << tempCell->font << tempCell->data; } lnkDoc->setType("application/sheet-qt"); if (!fm.saveFile(*lnkDoc, streamBuffer)) @@ -535,157 +535,157 @@ void MainWindow::initMenu() submenuFunc->insertItem(tr("Sta&tistical"), submenuFuncStat); submenuFuncScientific=new QPopupMenu; addFlyAction(tr("BESSELI(x,n)"), tr("BESSELI(x,n)"), "BESSELI(",submenuFuncScientific); addFlyAction(tr("BESSELJ(x,n)"), tr("BESSELJ(x,n)"), "BESSELJ(",submenuFuncScientific); addFlyAction(tr("BESSELK(x,n)"), tr("BESSELK(x,n)"), "BESSELK(",submenuFuncScientific); addFlyAction(tr("BESSELY(x,n)"), tr("BESSELY(x,n)"), "BESSELY(",submenuFuncScientific); submenuFuncScientific->insertSeparator(); addFlyAction(tr("BETAI(x,a,b)"), tr("BETAI(x,a,b)"), "BETAI(",submenuFuncScientific); addFlyAction(tr("ERF(a,b)"), tr("ERF(a,b)"), "ERF(",submenuFuncScientific); addFlyAction(tr("ERFC(a,b)"), tr("ERFC(a,b)"), "ERFC(",submenuFuncScientific); addFlyAction(tr("GAMMALN(x)"), tr("GAMMALN(x)"), "GAMMALN(",submenuFuncScientific); addFlyAction(tr("GAMMAP(x,a)"), tr("GAMMAP(x,a)"), "GAMMAP(",submenuFuncScientific); addFlyAction(tr("GAMMAQ(x,a)"), tr("GAMMAQ(x,a)"), "GAMMAQ(",submenuFuncScientific); submenuFunc->insertItem(tr("Scienti&fic"), submenuFuncScientific); submenuFuncDistr=new QPopupMenu; addFlyAction(tr("BETADIST(z,a,b,Q?)"), tr("BETADIST(z,a,b,Q?)"), "BETADIST(",submenuFuncDistr); addFlyAction(tr("CHI2DIST(x,n,Q?)"), tr("CHI2DIST(x,n,Q?)"), "CHI2DIST(",submenuFuncDistr); addFlyAction(tr("CHIDIST(x,n,Q?)"), tr("CHIDIST(x,n,Q?)"), "CHIDIST(",submenuFuncDistr); addFlyAction(tr("FDIST(z,deg1,deg2,Q?)"), tr("FDIST(z,deg1,deg2,Q?)"), "FDIST(",submenuFuncDistr); addFlyAction(tr("GAMMADIST(x,a,b,Q?)"), tr("GAMMADIST(x,a,b,Q?)"), "GAMMADIST(",submenuFuncDistr); addFlyAction(tr("NORMALDIST(x,m,s,Q?)"), tr("NORMALDIST(x,m,s,Q?)"), "NORMALDIST(",submenuFuncDistr); addFlyAction(tr("PHI(x,Q?)"), tr("PHI(x,Q?)"), "PHI(",submenuFuncDistr); addFlyAction(tr("POISSON(x,n,Q?)"), tr("POISSON(x,n,Q?)"), "POISSON(",submenuFuncDistr); submenuFunc->insertItem(tr("&Distributions"), submenuFuncDistr); menuInsert->insertSeparator(); insertCells->addTo(menuInsert); insertRows->addTo(menuInsert); insertCols->addTo(menuInsert); insertSheets->addTo(menuInsert); } void MainWindow::initStandardToolbar() { toolbarStandard=new QToolBar(this); toolbarStandard->setHorizontalStretchable(TRUE); moveToolBar(toolbarStandard, Top); fileNew->addTo(toolbarStandard); fileOpen->addTo(toolbarStandard); fileSave->addTo(toolbarStandard); comboSheets=new QComboBox(toolbarStandard); toolbarStandard->setStretchableWidget(comboSheets); - connect(comboSheets, SIGNAL(activated(const QString &)), this, SLOT(slotSheetChanged(const QString &))); + connect(comboSheets, SIGNAL(activated(const QString&)), this, SLOT(slotSheetChanged(const QString&))); } void MainWindow::initFunctionsToolbar() { toolbarFunctions=new QToolBar(this); toolbarFunctions->setHorizontalStretchable(TRUE); moveToolBar(toolbarFunctions, Bottom); funcEqual->addTo(toolbarFunctions); funcPlus->addTo(toolbarFunctions); funcMinus->addTo(toolbarFunctions); funcCross->addTo(toolbarFunctions); funcDivide->addTo(toolbarFunctions); funcParanOpen->addTo(toolbarFunctions); funcParanClose->addTo(toolbarFunctions); funcComma->addTo(toolbarFunctions); toolFunction=new QToolButton(toolbarFunctions); toolFunction->setPixmap(Resource::loadPixmap( "opie-sheet/func-func" )); toolFunction->setTextLabel(tr("Functions")); toolFunction->setPopup(submenuFunc); toolFunction->setPopupDelay(0); } void MainWindow::initEditToolbar() { toolbarEdit=new QToolBar(this); toolbarEdit->setHorizontalStretchable(TRUE); moveToolBar(toolbarEdit, Bottom); editAccept->addTo(toolbarEdit); editCancel->addTo(toolbarEdit); editData=new QLineEdit(toolbarEdit); toolbarEdit->setStretchableWidget(editData); connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept())); editCellSelect->addTo(toolbarEdit); } void MainWindow::slotHelpAbout() { QDialog dialogAbout(this, 0, TRUE); dialogAbout.resize(width()-40, height()-80); dialogAbout.setCaption(tr("About Opie Sheet")); QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout); label.setGeometry(dialogAbout.rect()); label.setAlignment(Qt::AlignCenter | Qt::WordBreak); dialogAbout.exec(); } void MainWindow::initSheet() { sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this); setCentralWidget(sheet); - connect(sheet, SIGNAL(currentDataChanged(const QString &)), editData, SLOT(setText(const QString &))); - connect(sheet, SIGNAL(cellClicked(const QString &)), this, SLOT(slotCellClicked(const QString &))); + connect(sheet, SIGNAL(currentDataChanged(const QString&)), editData, SLOT(setText(const QString&))); + connect(sheet, SIGNAL(cellClicked(const QString&)), this, SLOT(slotCellClicked(const QString&))); connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified())); connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut())); connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy())); connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear())); } void MainWindow::slotEditAccept() { sheet->setData(editData->text()); } void MainWindow::slotEditCancel() { editData->setText(sheet->getData()); } void MainWindow::slotCellSelect(bool lock) { sheet->lockClicks(lock); } void MainWindow::addToData(const QString &data) { editData->setText(editData->text().insert(editData->cursorPosition(), data)); } void MainWindow::slotFuncOutput() { if (sender()->isA("QAction")) addToData(((QAction *)sender())->toolTip()); } void MainWindow::slotInsertRows() { NumberDialog dialogNumber(this); if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted) sheet->insertRows(dialogNumber.getValue()); } void MainWindow::slotInsertCols() { NumberDialog dialogNumber(this); if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted) sheet->insertColumns(dialogNumber.getValue()); } void MainWindow::slotInsertSheets() diff --git a/noncore/apps/opie-sheet/sheet.cpp b/noncore/apps/opie-sheet/sheet.cpp index f303d33..d4419af 100644 --- a/noncore/apps/opie-sheet/sheet.cpp +++ b/noncore/apps/opie-sheet/sheet.cpp @@ -1,95 +1,95 @@ /*************************************************************************** * * * 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. * * * ***************************************************************************/ /* * Opie Sheet (formerly Sheet/Qt) * by Serdar Ozler <sozler@sitebest.com> */ #include "sheet.h" #include <qmessagebox.h> #include <math.h> #include <stdlib.h> #include <stdio.h> #include <time.h> #define DEFAULT_COL_WIDTH 50 Sheet::Sheet(int numRows, int numCols, QWidget *parent) :QTable(numRows, numCols, parent) { defaultBorders.right=defaultBorders.bottom=QPen(Qt::gray, 1, Qt::SolidLine); defaultCellData.data=""; defaultCellData.background=QBrush(Qt::white, Qt::SolidPattern); defaultCellData.alignment=(Qt::AlignmentFlags)(Qt::AlignLeft | Qt::AlignTop); defaultCellData.fontColor=Qt::black; defaultCellData.font=font(); defaultCellData.borders=defaultBorders; clicksLocked=FALSE; selectionNo=-1; setSelectionMode(QTable::Single); sheetData.setAutoDelete(TRUE); clipboardData.setAutoDelete(TRUE); for (int i=0; i<numCols; ++i) horizontalHeader()->setLabel(i, getHeaderString(i+1), DEFAULT_COL_WIDTH); - connect(this, SIGNAL(currentChanged(int, int)), this, SLOT(slotCellSelected(int, int))); - connect(this, SIGNAL(valueChanged(int, int)), this, SLOT(slotCellChanged(int, int))); + connect(this, SIGNAL(currentChanged(int,int)), this, SLOT(slotCellSelected(int,int))); + connect(this, SIGNAL(valueChanged(int,int)), this, SLOT(slotCellChanged(int,int))); } Sheet::~Sheet() { } typeCellData *Sheet::findCellData(int row, int col) { typeCellData *tempCellData; for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next()) { if (tempCellData->row==row && tempCellData->col==col) return tempCellData; } return NULL; } void Sheet::slotCellSelected(int row, int col) { typeCellData *cellData=findCellData(row, col); if (cellData) { emit currentDataChanged(cellData->data); }else emit currentDataChanged(""); } typeCellData *Sheet::createCellData(int row, int col) { if (row<0 || col<0) return NULL; typeCellData *cellData=new typeCellData; cellData->row=row; cellData->col=col; cellData->data=defaultCellData.data; cellData->borders=defaultCellData.borders; cellData->alignment=defaultCellData.alignment; cellData->font=defaultCellData.font; cellData->fontColor=defaultCellData.fontColor; cellData->background=defaultCellData.background; sheetData.append(cellData); return cellData; } void Sheet::slotCellChanged(int row, int col) { typeCellData *cellData=findCellData(row, col); if (!cellData) cellData=createCellData(row, col); if (cellData) cellData->data=text(row, col); for (cellData=sheetData.first(); cellData; cellData=sheetData.next()) diff --git a/noncore/apps/opie-write/mainwindow.cpp b/noncore/apps/opie-write/mainwindow.cpp index 6bb524f..90e1a70 100644 --- a/noncore/apps/opie-write/mainwindow.cpp +++ b/noncore/apps/opie-write/mainwindow.cpp @@ -78,249 +78,249 @@ public: } signals: void activated( int id ); protected slots: void selected( int id ) { current = id; setIconSet( *popup()->iconSet( id ) ); emit activated( id ); } protected: virtual void drawButtonLabel( QPainter *p ) { p->translate( -4, 0 ); QToolButton::drawButtonLabel( p ); p->translate( 4, 0 ); } private: int current; }; //=========================================================================== MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) : QMainWindow( parent, name, fl ), doc( 0 ) { setRightJustification(TRUE); editorStack = new QWidgetStack( this ); fileSelector = new FileSelector( "text/html", editorStack, "fileselector" ); fileSelector->setCloseVisible( FALSE ); editorStack->addWidget( fileSelector, 0 ); editor = new Qt3::QTextEdit( editorStack ); editor->setTextFormat( Qt::RichText ); editorStack->addWidget( editor, 1 ); setupActions(); QObject::connect( fileSelector, SIGNAL(closeMe()), this, SLOT(showEditTools()) ); - QObject::connect( fileSelector, SIGNAL(fileSelected(const DocLnk &)), - this, SLOT(openFile(const DocLnk &)) ); + QObject::connect( fileSelector, SIGNAL(fileSelected(const DocLnk&)), + this, SLOT(openFile(const DocLnk&)) ); QObject::connect( fileSelector, SIGNAL(newSelected(const DocLnk&)), this, SLOT(newFile(const DocLnk&)) ); if ( fileSelector->fileCount() < 1 ) fileNew(); else { fileOpen(); } doConnections( editor ); setCentralWidget( editorStack ); } MainWindow::~MainWindow() { save(); } void MainWindow::setupActions() { setToolBarsMovable(false); tbMenu = new QToolBar( this ); tbMenu->setHorizontalStretchable( TRUE ); QMenuBar *menu = new QMenuBar( tbMenu ); tbEdit = new QToolBar( this ); QPopupMenu *file = new QPopupMenu( this ); menu->insertItem( tr("File"), file ); QPopupMenu *edit = new QPopupMenu( this ); menu->insertItem( tr("Edit"), edit ); // ### perhaps these shortcut keys should have some // IPaq keys defined??? QAction *a; a = new QAction( tr( "New" ), Resource::loadPixmap("new"), QString::null, 0, this, 0 ); connect( a, SIGNAL(activated()), this, SLOT(fileNew()) ); a->addTo( file ); a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); connect( a, SIGNAL(activated()), this, SLOT(fileOpen()) ); a->addTo( file ); a = new QAction( tr( "Undo" ), Resource::loadIconSet("undo"), QString::null, 0, this, "editUndo" ); connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) ); connect( editor, SIGNAL(undoAvailable(bool)), a, SLOT(setEnabled(bool)) ); a->addTo( tbEdit ); a->addTo( edit ); a = new QAction( tr( "Redo" ), Resource::loadIconSet("redo"), QString::null, 0, this, "editRedo" ); connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) ); connect( editor, SIGNAL(redoAvailable(bool)), a, SLOT(setEnabled(bool)) ); a->addTo( tbEdit ); a->addTo( edit ); edit->insertSeparator(); a = new QAction( tr( "Copy" ), Resource::loadIconSet("copy"), QString::null, 0, this, "editCopy" ); connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) ); a->addTo( tbEdit ); a->addTo( edit ); a = new QAction( tr( "Cut" ), Resource::loadIconSet("cut"), QString::null, 0, this, "editCut" ); connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) ); a->addTo( tbEdit ); a->addTo( edit ); a = new QAction( tr( "Paste" ), Resource::loadPixmap("paste"), QString::null, 0, this, "editPaste" ); connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); a->addTo( tbEdit ); a->addTo( edit ); tbFont = new QToolBar( this ); tbFont->setLabel( "Font Actions" ); tbFont->setHorizontalStretchable(TRUE); comboFont = new QComboBox( FALSE, tbFont ); FontDatabase db; QStringList f= db.families(); comboFont->insertStringList( db.families() ); - connect( comboFont, SIGNAL( activated( const QString & ) ), - this, SLOT( textFamily( const QString & ) ) ); + connect( comboFont, SIGNAL( activated(const QString&) ), + this, SLOT( textFamily(const QString&) ) ); comboFont->setCurrentItem( comboFont->listBox()->index( comboFont->listBox()->findItem( QApplication::font().family() ) ) ); comboFont->setMaximumWidth(90); comboSize = new QComboBox( TRUE, tbFont ); QValueList<int> sizes = db.standardSizes(); QValueList<int>::Iterator it = sizes.begin(); for ( ; it != sizes.end(); ++it ) comboSize->insertItem( QString::number( *it ) ); - connect( comboSize, SIGNAL( activated( const QString & ) ), - this, SLOT( textSize( const QString & ) ) ); + connect( comboSize, SIGNAL( activated(const QString&) ), + this, SLOT( textSize(const QString&) ) ); comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) ); comboSize->setFixedWidth( 38 ); tbStyle = new QToolBar( this ); tbStyle->setLabel( "Style Actions" ); actionTextBold = new QAction( tr( "Bold" ), Resource::loadPixmap("bold"), QString::null, CTRL + Key_B, this, "textBold" ); connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) ); actionTextBold->addTo( tbStyle ); actionTextBold->setToggleAction( TRUE ); actionTextItalic = new QAction( tr( "Italic" ), Resource::loadPixmap("italic"), tr( "&Italic" ), CTRL + Key_I, this, "textItalic" ); connect( actionTextItalic, SIGNAL( activated() ), this, SLOT( textItalic() ) ); actionTextItalic->addTo( tbStyle ); actionTextItalic->setToggleAction( TRUE ); actionTextUnderline = new QAction( tr( "Underline" ), Resource::loadPixmap("underline"), tr( "&Underline" ), CTRL + Key_U, this, "textUnderline" ); connect( actionTextUnderline, SIGNAL( activated() ), this, SLOT( textUnderline() ) ); actionTextUnderline->addTo( tbStyle ); actionTextUnderline->setToggleAction( TRUE ); alignMenu = new ButtonMenu( tbStyle ); alignMenu->insertItem( Resource::loadPixmap("left"), tr("Left"), AlignLeft ); alignMenu->insertItem( Resource::loadPixmap("center"), tr("Center"), AlignCenter ); alignMenu->insertItem( Resource::loadPixmap("right"), tr("Right"), AlignRight ); alignMenu->insertItem( Resource::loadPixmap("opie-write/justify"), tr("Full"), Qt3::AlignJustify ); connect( alignMenu, SIGNAL(activated(int)), this, SLOT(textAlign(int)) ); } Qt3::QTextEdit *MainWindow::currentEditor() const { return editor; } void MainWindow::doConnections( Qt3::QTextEdit *e ) { - connect( e, SIGNAL( currentFontChanged( const QFont & ) ), - this, SLOT( fontChanged( const QFont & ) ) ); - connect( e, SIGNAL( currentColorChanged( const QColor & ) ), - this, SLOT( colorChanged( const QColor & ) ) ); - connect( e, SIGNAL( currentAlignmentChanged( int ) ), - this, SLOT( alignmentChanged( int ) ) ); + connect( e, SIGNAL( currentFontChanged(const QFont&) ), + this, SLOT( fontChanged(const QFont&) ) ); + connect( e, SIGNAL( currentColorChanged(const QColor&) ), + this, SLOT( colorChanged(const QColor&) ) ); + connect( e, SIGNAL( currentAlignmentChanged(int) ), + this, SLOT( alignmentChanged(int) ) ); } void MainWindow::updateFontSizeCombo( const QFont &f ) { comboSize->clear(); FontDatabase fdb; QValueList<int> sizes = fdb.pointSizes( f.family() ); QValueList<int>::Iterator it = sizes.begin(); for ( ; it != sizes.end(); ++it ) comboSize->insertItem( QString::number( *it ) ); } void MainWindow::editUndo() { if ( !currentEditor() ) return; currentEditor()->undo(); } void MainWindow::editRedo() { if ( !currentEditor() ) return; currentEditor()->redo(); } void MainWindow::editCut() { if ( !currentEditor() ) return; currentEditor()->cut(); } void MainWindow::editCopy() { if ( !currentEditor() ) return; currentEditor()->copy(); } void MainWindow::editPaste() { if ( !currentEditor() ) return; currentEditor()->paste(); } void MainWindow::textBold() diff --git a/noncore/apps/opie-write/qtextedit.cpp b/noncore/apps/opie-write/qtextedit.cpp index 27dd515..73b7b7b 100644 --- a/noncore/apps/opie-write/qtextedit.cpp +++ b/noncore/apps/opie-write/qtextedit.cpp @@ -632,98 +632,98 @@ QTextEdit::QTextEdit( QWidget *parent, const char *name ) /*! Constructs a QTextEdit with parent \a parent and name \a name. The text edit will display the text \a text using context \a context. The \a context is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. It is passed to the mimeSourceFactory() when quering data. For example if the text contains an image tag, \c{<img src="image.png">}, and the context is "path/to/look/in", the QMimeSourceFactory will try to load the image from "path/to/look/in/image.png". If the tag was \c{<img src="/image.png">}, the context will not be used (because QMimeSourceFactory recognizes that we have used an absolute path) and will try to load "/image.png". The context is applied in exactly the same way to \e hrefs, for example, \c{<a href="target.html">Target</a>}, would resolve to "path/to/look/in/target.html". */ QTextEdit::QTextEdit( const QString& text, const QString& context, QWidget *parent, const char *name) : QScrollView( parent, name, WStaticContents | WRepaintNoErase | WResizeNoErase ), doc( new QTextDocument( 0 ) ), undoRedoInfo( doc ) { init(); setText( text, context ); } /*! \reimp */ QTextEdit::~QTextEdit() { delete undoRedoInfo.d; undoRedoInfo.d = 0; delete cursor; delete doc; delete d; } void QTextEdit::init() { setFrameStyle( Sunken ); undoEnabled = TRUE; readonly = TRUE; setReadOnly( FALSE ); d = new QTextEditPrivate; - connect( doc, SIGNAL( minimumWidthChanged( int ) ), - this, SLOT( documentWidthChanged( int ) ) ); + connect( doc, SIGNAL( minimumWidthChanged(int) ), + this, SLOT( documentWidthChanged(int) ) ); mousePressed = FALSE; inDoubleClick = FALSE; modified = FALSE; onLink = QString::null; overWrite = FALSE; wrapMode = WidgetWidth; wrapWidth = -1; wPolicy = AtWhiteSpace; inDnD = FALSE; doc->setFormatter( new QTextFormatterBreakWords ); doc->formatCollection()->defaultFormat()->setFont( QScrollView::font() ); doc->formatCollection()->defaultFormat()->setColor( colorGroup().color( QColorGroup::Text ) ); currentFormat = doc->formatCollection()->defaultFormat(); currentAlignment = Qt3::AlignAuto; viewport()->setBackgroundMode( PaletteBase ); viewport()->setAcceptDrops( TRUE ); resizeContents( 0, doc->lastParagraph() ? ( doc->lastParagraph()->paragId() + 1 ) * doc->formatCollection()->defaultFormat()->height() : 0 ); setKeyCompression( TRUE ); viewport()->setMouseTracking( TRUE ); #ifndef QT_NO_CURSOR viewport()->setCursor( isReadOnly() ? arrowCursor : ibeamCursor ); #endif cursor = new QTextCursor( doc ); formatTimer = new QTimer( this ); connect( formatTimer, SIGNAL( timeout() ), this, SLOT( formatMore() ) ); lastFormatted = doc->firstParagraph(); scrollTimer = new QTimer( this ); connect( scrollTimer, SIGNAL( timeout() ), this, SLOT( autoScrollTimerDone() ) ); interval = 0; changeIntervalTimer = new QTimer( this ); connect( changeIntervalTimer, SIGNAL( timeout() ), this, SLOT( doChangeInterval() ) ); cursorVisible = TRUE; blinkTimer = new QTimer( this ); connect( blinkTimer, SIGNAL( timeout() ), this, SLOT( blinkCursor() ) ); diff --git a/noncore/apps/qashmoney/accountdisplay.cpp b/noncore/apps/qashmoney/accountdisplay.cpp index 5ef5454..0fe5b09 100755 --- a/noncore/apps/qashmoney/accountdisplay.cpp +++ b/noncore/apps/qashmoney/accountdisplay.cpp @@ -1,97 +1,97 @@ #include <qmessagebox.h> #include <qheader.h> #include "accountdisplay.h" #include "newaccount.h" #include "transaction.h" #include "transferdialog.h" #include "transfer.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 ); newaccount = new QPushButton ( firstline ); newaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); - connect ( newaccount, SIGNAL ( released () ), this, SLOT ( addAccount () ) ); + connect ( newaccount, SIGNAL ( released() ), this, SLOT ( addAccount() ) ); editaccount = new QPushButton ( firstline ); editaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); - connect ( editaccount, SIGNAL ( released () ), this, SLOT ( editAccount () ) ); + connect ( editaccount, SIGNAL ( released() ), this, SLOT ( editAccount() ) ); deleteaccount = new QPushButton ( firstline ); deleteaccount->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); - connect ( deleteaccount, SIGNAL ( released () ), this, SLOT ( deleteAccount () ) ); + connect ( deleteaccount, SIGNAL ( released() ), this, SLOT ( deleteAccount() ) ); transferbutton = new QPushButton ( firstline ); transferbutton->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/transfer.png") ); transferbutton->setToggleButton ( TRUE ); - connect ( transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( accountTransfer ( bool ) ) ); + connect ( transferbutton, SIGNAL ( toggled(bool) ), this, SLOT ( accountTransfer(bool) ) ); listview = new QListView ( this ); listview->setAllColumnsShowFocus ( TRUE ); listview->setShowSortIndicator ( TRUE ); listview->setRootIsDecorated ( TRUE ); listview->setMultiSelection ( FALSE ); - connect ( listview, SIGNAL ( expanded ( QListViewItem * ) ), this, SLOT ( setAccountExpanded ( QListViewItem * ) ) ); - connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) ); + connect ( listview, SIGNAL ( expanded(QListViewItem*) ), this, SLOT ( setAccountExpanded(QListViewItem*) ) ); + connect ( listview, SIGNAL ( collapsed(QListViewItem*) ), this, SLOT ( setAccountCollapsed(QListViewItem*) ) ); listview->header()->setTracking ( FALSE ); - connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); - connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); + connect ( listview->header(), SIGNAL ( sizeChange(int,int,int) ), this, SLOT ( saveColumnSize(int,int,int) ) ); + connect ( listview->header(), SIGNAL ( clicked(int) ), this, SLOT ( saveSortingPreference(int) ) ); layout = new QVBoxLayout ( this, 2, 5 ); layout->addWidget ( firstline ); layout->addWidget ( listview ); } void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs ) { tab2 = newtab2; maintabs = newtabs; } void AccountDisplay::addAccount () { // initialize local variables int parentid = 0; type = 0; QString parentlist [ listview->childCount() + 1 ] [ 3 ] ; // create new account window for entering data NewAccount *newaccount = new NewAccount ( this ); int width = this->width(); newaccount->accountbox->setMaximumWidth ( ( int ) ( width * 0.5 ) ); newaccount->datebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); newaccount->childbox->setMaximumWidth ( ( int ) ( width * 0.5 ) ); newaccount->balancebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); newaccount->creditlimitbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); // if there are no accounts, disable the child check box if ( account->getNumberOfAccounts () == 0 ) newaccount->childcheckbox->setEnabled ( FALSE ); // if there are accounts, fill up the pulldown menu for // selecting a parent account. We should only add those parents without transactions else { int c = 0; QListViewItemIterator it ( listview ); for ( ; it.current(); ++it ) { int id = it.current()->text ( getIDColumn() ).toInt(); // iterate through accountdisplay listview and add parents with no transactions // add this item to the list box only if it is a parent and has no transactions if ( transfer->getNumberOfTransfers ( id ) == 0 && transaction->getNumberOfTransactions ( id ) == 0 && it.current()->parent() == 0 ) { newaccount->childbox->insertItem ( it.current()->text ( 0 ) ); parentlist [ c ] [ 0 ] = it.current()->text ( 0 ); parentlist [ c ] [ 1 ] = it.current()->text ( getIDColumn() ); @@ -180,163 +180,163 @@ void AccountDisplay::deleteAccount () if ( parentid != -1 ) account->changeParentAccountBalance ( parentid ); //redisplay accounts account->displayAccounts ( listview ); //remove all the columns from the accountdisplay if there are not any accounts if ( account->getNumberOfAccounts() == 0 ) { int columns = listview->columns(); int counter; for ( counter = 0; counter <= columns; counter++ ) listview->removeColumn ( 0 ); } setToggleButton(); } } maintabs->setTabEnabled ( tab2, FALSE ); } void AccountDisplay::setToggleButton () { // iterate through account display and determine how many "transferable" accounts we have // if there are less than two, disable the transfer button QListViewItemIterator it ( listview ); int counter = 0; for ( ; it.current(); ++it ) { // add one to counter if we find a transferable account if ( it.current()->parent() != 0 || ( it.current()->childCount() ) == 0 ) counter++; } if ( counter > 1 ) transferbutton->show(); else transferbutton->hide(); } void AccountDisplay::accountTransfer ( bool state ) { if ( state == TRUE ) { firstaccountid = -1; secondaccountid = -1; listview->clearSelection (); listview->setMultiSelection ( TRUE ); disableParentsWithChildren (); - connect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); + connect ( listview, SIGNAL ( clicked(QListViewItem*) ), this, SLOT ( getTransferAccounts(QListViewItem*) ) ); } else { firstaccountid = -1; secondaccountid = -1; listview->clearSelection (); listview->setMultiSelection ( FALSE ); enableAccounts (); - disconnect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); + disconnect ( listview, SIGNAL ( clicked(QListViewItem*) ), this, SLOT ( getTransferAccounts(QListViewItem*) ) ); } } void AccountDisplay::getTransferAccounts ( QListViewItem * item ) { if ( item->parent() != 0 || item->childCount() == 0 ) // only set an account for transfer if its a child or parent with no children { if ( firstaccountid == -1 ) firstaccountid = item->text ( getIDColumn() ).toInt(); // set first account if we've selected a valid account else if ( item->text ( getIDColumn() ).toInt() != firstaccountid ) // set the second account if its not equal to the first secondaccountid = item->text ( getIDColumn() ).toInt(); } // open transfer window if both accounts are set if ( firstaccountid != -1 && secondaccountid != -1 ) { // construct the transferdialog window TransferDialog *td = new TransferDialog ( this, firstaccountid, secondaccountid ); // 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()); // 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 ) account->changeParentAccountBalance ( account->getParentAccountID ( secondaccountid ) ); // redisplay accounts account->displayAccounts ( listview ); } else { firstaccountid = -1; secondaccountid = -1; listview->clearSelection (); listview->setMultiSelection ( FALSE ); - disconnect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); + disconnect ( listview, SIGNAL ( clicked(QListViewItem*) ), this, SLOT ( getTransferAccounts(QListViewItem*) ) ); } // reset the accounts display window transferbutton->toggle(); // toggling this button with clear the window as well // reenable all the accounts so the transaction tab will be properly set enableAccounts (); } } void AccountDisplay::disableParentsWithChildren () { // iterate through accountdisplay listview and disable all the parents that have children QListViewItemIterator it ( listview ); for ( ; it.current(); ++it ) { if ( it.current()->parent() == 0 && it.current()->childCount() != 0 ) it.current()->setSelectable ( FALSE ); } } void AccountDisplay::enableAccounts () { // iterate through accountdisplay listview and enable all accounts QListViewItemIterator it ( listview ); for ( ; it.current(); ++it ) it.current()->setSelectable ( TRUE ); } void AccountDisplay::saveColumnSize ( int column, int oldsize, int newsize ) { switch ( column ) { case 0: if ( listview->columns() == 3 ) preferences->changeColumnPreference ( 1, newsize ); else preferences->changeColumnPreference ( 10, newsize ); break; case 1: if ( listview->columns() == 3 ) preferences->changeColumnPreference ( 2, newsize ); else preferences->changeColumnPreference ( 11, newsize ); break; case 2: preferences->changeColumnPreference ( 12, newsize ); break; diff --git a/noncore/apps/qashmoney/budgetdisplay.cpp b/noncore/apps/qashmoney/budgetdisplay.cpp index d4047bf..3fc4e6c 100755 --- a/noncore/apps/qashmoney/budgetdisplay.cpp +++ b/noncore/apps/qashmoney/budgetdisplay.cpp @@ -1,130 +1,130 @@ #include <qmessagebox.h> #include <qheader.h> #include <sqlite.h> #include "budgetdisplay.h" #include "budget.h" #include "datepicker.h" #include "transaction.h" extern Preferences *preferences; extern Budget *budget; extern Transaction *transaction; BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent ) { QFont font = this->font(); font.setWeight ( QFont::Bold ); //set the default date to today newDate = QDate::currentDate (); year = newDate.year(); month = newDate.month(); day = newDate.day(); datelabel = preferences->getDate ( year, month ); setCaption ( "Budget" ); firstline = new QHBox ( this ); firstline->setSpacing ( 2 ); secondline = new QHBox ( this ); secondline->setSpacing ( 10 ); menu = new QMenuBar ( this ); menu->setFrameStyle ( QFrame::Box | QFrame::Sunken ); budgetmenu = new QPopupMenu ( this ); lineitemsmenu = new QPopupMenu ( this ); datemenu = new QPopupMenu ( this ); menu->insertItem ( "Budget", budgetmenu ); menu->insertItem ( "Line Item", lineitemsmenu ); menu->insertItem ( "Date", datemenu ); - budgetmenu->insertItem ( "New", this, SLOT ( newBudget () ), 0, 1 ); - budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget () ), 0, 2 ); - budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget () ), 0, 3 ); - lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem () ), 0, 1 ); - lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem () ), 0, 2 ); - lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem () ), 0, 3 ); + budgetmenu->insertItem ( "New", this, SLOT ( newBudget() ), 0, 1 ); + budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget() ), 0, 2 ); + budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget() ), 0, 3 ); + lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem() ), 0, 1 ); + lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem() ), 0, 2 ); + lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem() ), 0, 3 ); datemenu->insertItem ( "Change", this, SLOT ( showCalendar() ) ); budgetbox = new QComboBox ( firstline ); - connect ( budgetbox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentBudget ( int ) ) ); + connect ( budgetbox, SIGNAL ( activated(int) ), this, SLOT ( setCurrentBudget(int) ) ); budgetview = new QComboBox ( firstline ); budgetview->insertItem ( "Month" ); budgetview->insertItem ( "Year" ); - connect ( budgetview, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentView ( int ) ) ); + connect ( budgetview, SIGNAL ( activated(int) ), this, SLOT ( setCurrentView(int) ) ); budgeted = new QLabel ( secondline ); budgeted->setFont ( font ); actual = new QLabel ( secondline ); actual->setFont ( font ); date = new QLabel ( secondline ); date->setFont ( font ); listview = new QListView ( this ); listview->setAllColumnsShowFocus ( TRUE ); listview->setShowSortIndicator ( TRUE ); listview->setRootIsDecorated ( TRUE ); listview->setMultiSelection ( FALSE ); listview->addColumn ( "Line Item", preferences->getColumnPreference ( 13 ) ); // column id 13 listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14 listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15 listview->addColumn ( "", 0 ); // line item ids listview->setColumnWidthMode ( 0, QListView::Manual ); listview->setColumnWidthMode ( 1, QListView::Manual ); listview->setColumnWidthMode ( 2, QListView::Manual ); listview->setColumnAlignment ( 1, Qt::AlignRight ); listview->setColumnAlignment ( 2, Qt::AlignRight ); listview->setColumnWidthMode ( 3, QListView::Manual ); listview->header()->setTracking ( FALSE ); - connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); - connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); + connect ( listview->header(), SIGNAL ( sizeChange(int,int,int) ), this, SLOT ( saveColumnSize(int,int,int) ) ); + connect ( listview->header(), SIGNAL ( clicked(int) ), this, SLOT ( saveSortingPreference(int) ) ); // pull the column sorting preference from the preferences table, and configure the listview accordingly int column = 0; int direction = 0; preferences->getSortingPreference ( 3, &column, &direction ); listview->setSorting ( column, direction ); displayBudgetNames(); layout = new QVBoxLayout ( this, 2, 2 ); layout->setMenuBar ( menu ); layout->addWidget ( firstline ); layout->addWidget ( secondline ); layout->addWidget ( listview ); } void BudgetDisplay::deleteBudget () { listview->clear(); transaction->clearBudgetIDs ( currentbudget ); budget->deleteBudget ( currentbudget ); if ( budgetbox->count() != 0 ) displayBudgetNames(); checkBudgets(); } void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize ) { switch ( column ) { case 0: preferences->changeColumnPreference ( 13, newsize ); break; case 1: preferences->changeColumnPreference ( 14, newsize ); break; case 2: preferences->changeColumnPreference ( 15, newsize ); break; } } void BudgetDisplay::saveSortingPreference ( int column ) { preferences->changeSortingPreference ( 3, column ); } int BudgetDisplay::getIDColumn () diff --git a/noncore/apps/qashmoney/calculator.cpp b/noncore/apps/qashmoney/calculator.cpp index 0e0a043..2c92103 100755 --- a/noncore/apps/qashmoney/calculator.cpp +++ b/noncore/apps/qashmoney/calculator.cpp @@ -1,106 +1,106 @@ #include "calculator.h" #include <qpushbutton.h> Calculator::Calculator ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) { display = new QLineEdit ( this, "display" ); display->setFrame ( FALSE ); display->setAlignment ( Qt::AlignRight ); QPushButton *one = new QPushButton ( "1", this, "one" ); // make buttons for first row one->setFlat ( TRUE ); - connect ( one, SIGNAL ( released () ), this, SLOT ( displayOne () ) ); + connect ( one, SIGNAL ( released() ), this, SLOT ( displayOne() ) ); QPushButton *two = new QPushButton ( "2", this, "two" ); two->setFlat ( TRUE ); - connect ( two, SIGNAL ( released () ), this, SLOT ( displayTwo () ) ); + connect ( two, SIGNAL ( released() ), this, SLOT ( displayTwo() ) ); QPushButton *three = new QPushButton ( "3", this, "three" ); three->setFlat ( TRUE ); - connect ( three, SIGNAL ( released () ), this, SLOT ( displayThree () ) ); + connect ( three, SIGNAL ( released() ), this, SLOT ( displayThree() ) ); QPushButton *four = new QPushButton ( "4", this, "four" ); // make buttons for second row four->setFlat ( TRUE ); - connect ( four, SIGNAL ( released () ), this, SLOT ( displayFour () ) ); + connect ( four, SIGNAL ( released() ), this, SLOT ( displayFour() ) ); QPushButton *five = new QPushButton ( "5", this, "five" ); five->setFlat ( TRUE ); - connect ( five, SIGNAL ( released () ), this, SLOT ( displayFive () ) ); + connect ( five, SIGNAL ( released() ), this, SLOT ( displayFive() ) ); QPushButton *six = new QPushButton ( "6", this, "six" ); six->setFlat ( TRUE ); - connect ( six, SIGNAL ( released () ), this, SLOT ( displaySix () ) ); + connect ( six, SIGNAL ( released() ), this, SLOT ( displaySix() ) ); QPushButton *seven = new QPushButton ( "7", this, "seven" ); // make buttons for third row seven->setFlat ( TRUE ); - connect ( seven, SIGNAL ( released () ), this, SLOT ( displaySeven () ) ); + connect ( seven, SIGNAL ( released() ), this, SLOT ( displaySeven() ) ); QPushButton *eight = new QPushButton ( "8", this, "eight" ); eight->setFlat ( TRUE ); - connect ( eight, SIGNAL ( released () ), this, SLOT ( displayEight () ) ); + connect ( eight, SIGNAL ( released() ), this, SLOT ( displayEight() ) ); QPushButton *nine = new QPushButton ( "9", this, "nine" ); nine->setFlat ( TRUE ); - connect ( nine, SIGNAL ( released () ), this, SLOT ( displayNine () ) ); + connect ( nine, SIGNAL ( released() ), this, SLOT ( displayNine() ) ); QPushButton *zero = new QPushButton ( "0", this, "zero" ); zero->setFlat ( TRUE ); - connect ( zero, SIGNAL ( released () ), this, SLOT ( displayZero () ) ); + connect ( zero, SIGNAL ( released() ), this, SLOT ( displayZero() ) ); QPushButton *dp = new QPushButton ( ".", this, "dp" ); dp->setFlat ( TRUE ); - connect ( dp, SIGNAL ( released () ), this, SLOT ( displayPoint () ) ); + connect ( dp, SIGNAL ( released() ), this, SLOT ( displayPoint() ) ); QPushButton *back = new QPushButton ( "<-", this, "back" ); back->setFlat ( TRUE ); - connect ( back, SIGNAL ( released () ), this, SLOT ( back () ) ); + connect ( back, SIGNAL ( released() ), this, SLOT ( back() ) ); layout = new QGridLayout ( this, 5, 3, 5, 1, "calculatorlayout" ); layout->addMultiCellWidget ( display, 0, 0, 0, 2 ); layout->addWidget ( one, 1, 0 ); layout->addWidget ( two, 1, 1 ); layout->addWidget ( three, 1, 2 ); layout->addWidget ( four, 2, 0 ); layout->addWidget ( five, 2, 1 ); layout->addWidget ( six, 2, 2 ); layout->addWidget ( seven, 3, 0 ); layout->addWidget ( eight, 3, 1 ); layout->addWidget ( nine, 3, 2 ); layout->addWidget ( zero, 4, 0 ); layout->addWidget ( dp, 4, 1 ); layout->addWidget ( back, 4, 2 ); } void Calculator::displayOne () { display->insert ( "1" ); } void Calculator::displayTwo () { display->insert ( "2" ); } void Calculator::displayThree () { display->insert ( "3" ); } void Calculator::displayFour () { display->insert ( "4" ); } void Calculator::displayFive () { display->insert ( "5" ); } void Calculator::displaySix () { display->insert ( "6" ); } void Calculator::displaySeven () { display->insert ( "7" ); } void Calculator::displayEight () { display->insert ( "8" ); } void Calculator::displayNine () { display->insert ( "9" ); } void Calculator::displayZero () { display->insert ( "0" ); } diff --git a/noncore/apps/qashmoney/datepicker.cpp b/noncore/apps/qashmoney/datepicker.cpp index 02fbcf3..7997c0b 100755 --- a/noncore/apps/qashmoney/datepicker.cpp +++ b/noncore/apps/qashmoney/datepicker.cpp @@ -1,70 +1,70 @@ #include "datepicker.h" DatePicker::DatePicker ( QDate entrydate ) : QDialog ( 0, 0, TRUE ) { setCaption ( "Select Date" ); date = entrydate; day = date.day(); month = date.month(); year = date.year(); daylabel = new QLabel ( "Day", this ); monthlabel = new QLabel ( "Month", this ); yearlabel = new QLabel ( "Year", this ); daybox = new QComboBox ( this, "daybox" ); - connect ( daybox, SIGNAL ( activated ( int ) ), this, SLOT ( setDay ( int ) ) ); + connect ( daybox, SIGNAL ( activated(int) ), this, SLOT ( setDay(int) ) ); displayDays ( daybox ); monthbox = new QComboBox ( this, "monthbox" ); - connect ( monthbox, SIGNAL ( activated ( int ) ), this, SLOT ( setMonth ( int ) ) ); + connect ( monthbox, SIGNAL ( activated(int) ), this, SLOT ( setMonth(int) ) ); displayMonths ( monthbox ); yearbox = new QComboBox ( this, "yearbox" ); - connect ( yearbox, SIGNAL ( activated ( int ) ), this, SLOT ( setYear ( int ) ) ); + connect ( yearbox, SIGNAL ( activated(int) ), this, SLOT ( setYear(int) ) ); displayYears ( yearbox ); layout = new QGridLayout ( this, 2, 3, 5, 5, "datepickerlayout" ); layout->addWidget ( daylabel, 0, 2 ); layout->addWidget ( monthlabel, 0, 1 ); layout->addWidget ( yearlabel, 0, 0 ); layout->addWidget ( daybox, 1, 2 ); layout->addWidget ( monthbox, 1, 1 ); layout->addWidget ( yearbox, 1, 0 ); } void DatePicker::displayDays ( QComboBox *daybox ) { int counter; int days = date.daysInMonth(); for ( counter = 1; counter <= days; counter++ ) daybox->insertItem ( QString::number ( counter ) ); daybox->setCurrentItem ( ( date.day() ) - 1 ); } void DatePicker::displayMonths ( QComboBox *monthbox ) { int counter; for ( counter = 1; counter <= 12; counter++ ) monthbox->insertItem ( QString::number ( counter ) ); monthbox->setCurrentItem ( ( date.month() ) - 1 ); } void DatePicker::displayYears ( QComboBox *yearbox ) { int counter; int indexcounter = 0; int yearindex = 0; int year = date.year(); for ( counter = ( year - 1 ); counter <= ( year + 1 ); counter++ ) { yearbox->insertItem ( QString::number ( counter ) ); if ( date.year() == counter ) yearindex = indexcounter; indexcounter ++; } yearbox->setCurrentItem ( yearindex ); } void DatePicker::setDay ( int index ) { day = daybox->text ( index ).toInt(); } diff --git a/noncore/apps/qashmoney/memorydialog.cpp b/noncore/apps/qashmoney/memorydialog.cpp index e9ebd54..ba11540 100755 --- a/noncore/apps/qashmoney/memorydialog.cpp +++ b/noncore/apps/qashmoney/memorydialog.cpp @@ -1,75 +1,75 @@ #include "memorydialog.h" #include "memory.h" #include <qmessagebox.h> extern Memory *memory; MemoryDialog::MemoryDialog () : QDialog ( 0, 0, TRUE ) { setCaption ( tr ( "Edit Memory" ) ); listbox = new QListBox ( this, "listbox" ); memory->displayMemoryItems ( listbox ); listbox->clearSelection(); secondline = new QHBox ( this ); newbutton = new QPushButton ( secondline ); newbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/new.png") ); - connect ( newbutton, SIGNAL ( released () ), this, SLOT ( addItem () ) ); + connect ( newbutton, SIGNAL ( released() ), this, SLOT ( addItem() ) ); editbutton = new QPushButton ( secondline ); editbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); - connect ( editbutton, SIGNAL ( released () ), this, SLOT ( editItem () ) ); + connect ( editbutton, SIGNAL ( released() ), this, SLOT ( editItem() ) ); deletebutton = new QPushButton( secondline ); deletebutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/delete.png") ); - connect ( deletebutton, SIGNAL ( released () ), this, SLOT ( deleteItem () ) ); + connect ( deletebutton, SIGNAL ( released() ), this, SLOT ( deleteItem() ) ); lineedit = new QLineEdit ( this ); layout = new QVBoxLayout ( this, 2, 2 ); layout->addWidget ( listbox ); layout->addWidget ( secondline ); layout->addWidget ( lineedit ); } MemoryDialog::~MemoryDialog() { } void MemoryDialog::addItem () { if ( lineedit->text().length() != 0 ) { memory->addMemoryItem ( lineedit->text() ); listbox->clear (); memory->displayMemoryItems ( listbox ); listbox->clearFocus(); listbox->clearSelection (); lineedit->clear(); } } void MemoryDialog::editItem () { if ( listbox->currentItem() != -1 ) { lineedit->setText ( listbox->currentText() ); memory->deleteMemoryItem ( listbox->currentText() ); listbox->clear (); memory->displayMemoryItems ( listbox ); listbox->clearSelection(); } else QMessageBox::warning ( this, "QashMoney", "Please select an item to edit." ); } void MemoryDialog::deleteItem () { if ( listbox->currentItem() != -1 ) { memory->deleteMemoryItem ( listbox->currentText() ); listbox->clear (); memory->displayMemoryItems ( listbox ); listbox->clearSelection(); diff --git a/noncore/apps/qashmoney/newaccount.cpp b/noncore/apps/qashmoney/newaccount.cpp index 7e57a18..5932182 100755 --- a/noncore/apps/qashmoney/newaccount.cpp +++ b/noncore/apps/qashmoney/newaccount.cpp @@ -31,102 +31,102 @@ NewAccount::NewAccount ( QWidget *parent, const char *name, bool modal ) : QDial childlabel = new QLabel ( "Child of", this ); childbox = new QComboBox ( FALSE, this ); hideChildPulldownMenu (); balancelabel = new QLabel ( "Balance", this ); balancebox = new QHBox ( this ); accountbalance = new QLineEdit ( balancebox ); accountbalance->setText ( "0.00" ); balancecalculator = new QPushButton( balancebox ); balancecalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); creditlimitlabel = new QLabel ( "Credit Limit", this ); creditlimitbox = new QHBox ( this ); creditlimit = new QLineEdit ( creditlimitbox ); creditlimitbox->setEnabled ( FALSE ); creditlimitcalculator = new QPushButton( creditlimitbox ); creditlimitcalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); currencybox = new Currency ( this ); typelabel = new QLabel ( "Type", this ); accounttype = new QComboBox ( FALSE, this ); accounttype->insertItem( tr( "Bank" ) ); accounttype->insertItem( tr( "Cash" ) ); accounttype->insertItem( tr( "Credit Card" ) ); accounttype->insertItem( tr( "Equity" ) ); accounttype->insertItem( tr( "Asset" ) ); accounttype->insertItem( tr( "Liability" ) ); layout = new QGridLayout ( this, 7, 2, 4, 2 ); layout->addWidget ( namelabel , 0, 0, Qt::AlignLeft ); layout->addWidget ( accountbox, 1, 0, Qt::AlignLeft ); layout->addWidget ( datelabel, 2, 0, Qt::AlignLeft ); layout->addWidget ( datebox, 3, 0, Qt::AlignLeft ); layout->addWidget ( childcheckbox, 4, 0, Qt::AlignLeft ); layout->addWidget ( childlabel, 5, 0, Qt::AlignLeft ); layout->addWidget ( childbox, 6, 0, Qt::AlignLeft ); layout->addWidget ( balancelabel, 0, 1, Qt::AlignLeft ); layout->addWidget ( balancebox, 1, 1, Qt::AlignLeft ); layout->addWidget ( creditlimitlabel, 2, 1, Qt::AlignLeft ); layout->addWidget ( creditlimitbox, 3, 1, Qt::AlignLeft ); layout->addWidget ( currencybox, 4, 1, Qt::AlignLeft ); layout->addWidget ( typelabel, 5, 1, Qt::AlignLeft ); layout->addWidget ( accounttype, 6, 1, Qt::AlignLeft ); - connect ( childcheckbox, SIGNAL ( clicked () ), this, SLOT ( showChildPulldownMenu() ) ); + connect ( childcheckbox, SIGNAL ( clicked() ), this, SLOT ( showChildPulldownMenu() ) ); connect ( balancecalculator, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); connect ( creditlimitcalculator, SIGNAL ( released() ), this, SLOT ( showCreditLimitCalculator() ) ); - connect ( accounttype, SIGNAL ( activated ( int ) ), this, SLOT ( activateCreditLimit ( int ) ) ); - connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); - connect ( descriptionbutton, SIGNAL ( released () ), this, SLOT ( addAccountDescription() ) ); + connect ( accounttype, SIGNAL ( activated(int) ), this, SLOT ( activateCreditLimit(int) ) ); + connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) ); + connect ( descriptionbutton, SIGNAL ( released() ), this, SLOT ( addAccountDescription() ) ); } NewAccount::~NewAccount () { } void NewAccount::showChildPulldownMenu () { if ( childcheckbox->isChecked() == TRUE ) { childlabel->setEnabled ( TRUE ); childbox->setEnabled ( TRUE ); } else hideChildPulldownMenu(); } void NewAccount::hideChildPulldownMenu () { childlabel->setEnabled ( FALSE ); childbox->setEnabled ( FALSE ); } void NewAccount::showCalculator () { Calculator *calculator = new Calculator ( this ); calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); if ( calculator->exec () == QDialog::Accepted ) accountbalance->setText ( calculator->display->text() ); } void NewAccount::showCreditLimitCalculator () { Calculator *calculator = new Calculator ( this ); calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); if ( calculator->exec () == QDialog::Accepted ) creditlimit->setText ( calculator->display->text() ); } void NewAccount::activateCreditLimit ( int index ) { if ( index == 2 || index == 5 ) creditlimitbox->setEnabled ( TRUE ); else { creditlimit->clear (); creditlimitbox->setEnabled ( FALSE ); } diff --git a/noncore/apps/qashmoney/newtransaction.cpp b/noncore/apps/qashmoney/newtransaction.cpp index 5c78139..87b7f7e 100755 --- a/noncore/apps/qashmoney/newtransaction.cpp +++ b/noncore/apps/qashmoney/newtransaction.cpp @@ -1,136 +1,136 @@ #include "newtransaction.h" #include "calculator.h" #include "datepicker.h" #include "budget.h" #include <qmultilineedit.h> extern Budget *budget; extern Preferences *preferences; NewTransaction::NewTransaction ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) { transactiondescription = ""; currentlineitem = -1; currentbudget = -1; dateedited = FALSE; setCaption( tr( "Transaction" ) ); // START FIRST COLUMN namelabel = new QLabel ( "Transaction", this ); transactionnamebox = new QHBox ( this ); transactionname = new QComboBox ( transactionnamebox ); transactionname->setEditable ( TRUE ); descriptionbutton = new QPushButton ( transactionnamebox ); descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) ); - connect ( descriptionbutton, SIGNAL ( released () ), this, SLOT ( addTransactionDescription() ) ); + connect ( descriptionbutton, SIGNAL ( released() ), this, SLOT ( addTransactionDescription() ) ); amountlabel = new QLabel ( "Amount", this ); transactionamountbox = new QHBox ( this ); transactionamount = new QLineEdit ( transactionamountbox ); transactionamount->setAlignment ( Qt::AlignRight ); transactionamount->setText ( "0.00" ); calculatorbutton = new QPushButton( transactionamountbox ); calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); datelabel = new QLabel ( "Date", this ); transactiondatebox = new QHBox ( this ); transactiondate = new QLineEdit ( transactiondatebox ); transactiondate->setAlignment ( Qt::AlignRight ); transactiondate->setDisabled ( TRUE ); datebutton = new QPushButton( transactiondatebox ); datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); - connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); + connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) ); clearedcheckbox = new QCheckBox ( "Cleared", this ); depositbox = new QCheckBox ( "Credit", this ); // START SECOND COLUMN numberlabel = new QLabel ( "Number", this ); transactionnumber = new QLineEdit ( this ); budgetlabel = new QLabel ( "Budget", this ); budgetbox = new QComboBox ( FALSE, this ); lineitemlabel = new QLabel ( "LineItem", this ); lineitembox = new QComboBox ( FALSE, this ); layout = new QGridLayout ( this, 7, 2, 2, 2 ); layout->addWidget ( namelabel, 0, 0, Qt::AlignLeft ); layout->addWidget ( transactionnamebox, 1, 0, Qt::AlignLeft ); layout->addWidget ( amountlabel, 2, 0, Qt::AlignLeft ); layout->addWidget ( transactionamountbox, 3, 0, Qt::AlignLeft ); layout->addWidget ( datelabel, 4, 0, Qt::AlignLeft ); layout->addWidget ( transactiondatebox, 5, 0, Qt::AlignLeft ); layout->addWidget ( clearedcheckbox, 6, 0, Qt::AlignLeft ); layout->addWidget ( numberlabel, 0, 1, Qt::AlignLeft ); layout->addWidget ( transactionnumber, 1, 1, Qt::AlignLeft ); layout->addWidget ( budgetlabel, 2, 1, Qt::AlignLeft ); layout->addWidget ( budgetbox, 3, 1, Qt::AlignLeft ); layout->addWidget ( lineitemlabel, 4, 1, Qt::AlignLeft ); layout->addWidget ( lineitembox, 5, 1, Qt::AlignLeft ); layout->addWidget ( depositbox, 6, 1, Qt::AlignLeft ); if ( budget->getNumberOfBudgets() != 0 ) { budgetnameslist = budget->getBudgetNames(); budgetidslist = budget->getBudgetIDs(); budgetbox->insertStringList ( *budgetnameslist ); lineitemlabel->setEnabled ( FALSE ); lineitembox->setEnabled ( FALSE ); - connect ( budgetbox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentBudget ( int ) ) ); - connect ( lineitembox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentLineItem ( int ) ) ); + connect ( budgetbox, SIGNAL ( activated(int) ), this, SLOT ( setCurrentBudget(int) ) ); + connect ( lineitembox, SIGNAL ( activated(int) ), this, SLOT ( setCurrentLineItem(int) ) ); } else { budgetlabel->setEnabled ( FALSE ); budgetbox->setEnabled ( FALSE ); lineitemlabel->setEnabled ( FALSE ); lineitembox->setEnabled ( FALSE ); } } NewTransaction::~NewTransaction () { } void NewTransaction::showCalculator () { Calculator *calculator = new Calculator ( this ); calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); if ( calculator->exec () == QDialog::Accepted ) transactionamount->setText ( calculator->display->text() ); } void NewTransaction::showCalendar () { QDate newDate = QDate::currentDate (); DatePicker *dp = new DatePicker ( newDate ); dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); int response = dp->exec(); if ( response == QDialog::Accepted ) { // Set date integers year = dp->getYear(); month = dp->getMonth(); day = dp->getDay(); // Set dateedited to TRUE // This tells the transactiondisplay object that the user edited an transaction // and did change the date3 dateedited = TRUE; // Display date with our selected format transactiondate->setText ( preferences->getDate ( year, month, day ) ); } } bool NewTransaction::getDateEdited () diff --git a/noncore/apps/qashmoney/preferencedialogs.cpp b/noncore/apps/qashmoney/preferencedialogs.cpp index 5408a5b..b83c957 100755 --- a/noncore/apps/qashmoney/preferencedialogs.cpp +++ b/noncore/apps/qashmoney/preferencedialogs.cpp @@ -1,216 +1,216 @@ #include "preferencedialogs.h" #include "preferences.h" extern Preferences *preferences; DatePreferences::DatePreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) { setCaption( tr( "Date" ) ); QLabel *datelabel = new QLabel ( "Format", this ); dateformat = new QComboBox ( this ); dateformat->setEditable ( FALSE ); dateformat->insertItem ( "yyyymmdd" ); dateformat->insertItem ( "yymmdd" ); dateformat->insertItem ( "mmddyyyy" ); dateformat->insertItem ( "mmddyy" ); dateformat->insertItem ( "yyyyddmm" ); dateformat->insertItem ( "yyddmm" ); dateformat->insertItem ( "ddmmyyyy" ); dateformat->insertItem ( "ddmmyy" ); - connect ( dateformat, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateFormat ( int ) ) ); + connect ( dateformat, SIGNAL ( activated(int) ), this, SLOT ( changeDateFormat(int) ) ); QLabel *dateseparatorlabel = new QLabel ( "Separator", this ); dateseparator = new QComboBox ( this ); dateseparator->insertItem ( "/" ); dateseparator->insertItem ( "-" ); dateseparator->insertItem ( "." ); - connect ( dateseparator, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateSeparator ( int ) ) ); + connect ( dateseparator, SIGNAL ( activated(int) ), this, SLOT ( changeDateSeparator(int) ) ); defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); - connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultDatePreferences () ) ); + connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultDatePreferences() ) ); dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); layout = new QVBoxLayout ( this, 2, 2 ); layout->addWidget ( datelabel ); layout->addWidget ( dateformat ); layout->addWidget ( dateseparatorlabel ); layout->addWidget ( dateseparator ); layout->insertSpacing ( 4, 5 ); layout->addWidget ( defaults ); } DatePreferences::~DatePreferences () { } void DatePreferences::changeDateFormat ( int index ) { index ++; preferences->changePreference ( 1, index ); } void DatePreferences::changeDateSeparator ( int index ) { index ++; preferences->changePreference ( 2, index ); } void DatePreferences::setDefaultDatePreferences () { preferences->setDefaultDatePreferences (); dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); } // START TRANSACTION PREFERENCES TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) { setCaption( tr ( "Transaction" ) ); showclearedtransactions = new QCheckBox ( this ); showclearedtransactions->setText ( "Show Cleared Transactions" ); limittransactionsbox = new QHBox ( this ); limittransactionsbox->setSpacing ( 2 ); limittransactionslabel = new QLabel ( "Show ", limittransactionsbox ); limittransactions = new QComboBox ( limittransactionsbox ); QLabel *limittransactionslabel2 = new QLabel ( "of cleared transactions. ", limittransactionsbox ); limittransactions->insertItem ( "14 days" ); limittransactions->insertItem ( "30 days" ); limittransactions->insertItem ( "90 days" ); limittransactions->insertItem ( "180 days" ); limittransactions->insertItem ( "365 days" ); limittransactions->insertItem ( "All" ); limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) ); excludetransfers = new QCheckBox ( this ); excludetransfers->setText ( "Include Transfers In Limit View" ); if ( preferences->getPreference ( 3 ) == 1 ) showclearedtransactions->setChecked ( TRUE ); else showclearedtransactions->setChecked ( FALSE ); if ( preferences->getPreference ( 6 ) == 1 ) excludetransfers->setChecked ( TRUE ); else excludetransfers->setChecked ( FALSE ); defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); - connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultTransactionPreferences () ) ); + connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultTransactionPreferences() ) ); layout = new QVBoxLayout ( this, 2, 2 ); layout->addWidget ( showclearedtransactions ); layout->addWidget ( limittransactionsbox ); layout->addWidget ( excludetransfers ); layout->insertSpacing ( 3, 5 ); layout->addWidget ( defaults ); - connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) ); - connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) ); - connect ( limittransactions, SIGNAL ( activated ( int ) ), this, SLOT ( changeLimitTransactionsPreference ( int ) ) ); + connect ( showclearedtransactions, SIGNAL ( toggled(bool) ), this, SLOT ( changeShowClearedPreference(bool) ) ); + connect ( excludetransfers, SIGNAL ( toggled(bool) ), this, SLOT ( changeExcludeTranfersPreference(bool) ) ); + connect ( limittransactions, SIGNAL ( activated(int) ), this, SLOT ( changeLimitTransactionsPreference(int) ) ); } TransactionPreferences::~TransactionPreferences () { } void TransactionPreferences::changeLimitTransactionsPreference ( int pref ) { preferences->changePreference ( 7, pref ); } void TransactionPreferences::changeShowClearedPreference ( bool state ) { if ( state == TRUE ) preferences->changePreference ( 3, 1 ); else preferences->changePreference ( 3, 0 ); } void TransactionPreferences::changeExcludeTranfersPreference ( bool state ) { if ( state == TRUE ) preferences->changePreference ( 6, 1 ); else preferences->changePreference ( 6, 0 ); } void TransactionPreferences::setDefaultTransactionPreferences () { preferences->changePreference ( 3, 0 ); preferences->changePreference ( 6, 0 ); preferences->changePreference ( 7, 0 ); showclearedtransactions->setChecked ( FALSE ); limittransactions->setCurrentItem ( 0 ); } // START ACCOUNT PREFERNCES AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) { setCaption( tr ( "Account" ) ); currencysupport = new QCheckBox ( this ); currencysupport->setText ( "Enable Currency Support" ); onetouch = new QCheckBox ( this ); onetouch->setText ( "One Touch Account Viewing" ); if ( preferences->getPreference ( 4 ) == 1 ) currencysupport->setChecked ( TRUE ); else currencysupport->setChecked ( FALSE ); if ( preferences->getPreference ( 5 ) == 1 ) onetouch->setChecked ( TRUE ); else onetouch->setChecked ( FALSE ); defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); - connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultAccountPreferences () ) ); + connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultAccountPreferences() ) ); layout = new QVBoxLayout ( this, 2, 2 ); layout->addWidget ( currencysupport ); layout->addWidget ( onetouch ); layout->insertSpacing ( 2, 5 ); layout->addWidget ( defaults ); - connect ( currencysupport, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeCurrencySupport ( bool ) ) ); - connect ( onetouch, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeOneTouchViewing ( bool ) ) ); + connect ( currencysupport, SIGNAL ( toggled(bool) ), this, SLOT ( changeCurrencySupport(bool) ) ); + connect ( onetouch, SIGNAL ( toggled(bool) ), this, SLOT ( changeOneTouchViewing(bool) ) ); } AccountPreferences::~AccountPreferences () { } void AccountPreferences::changeCurrencySupport ( bool state ) { if ( state == TRUE ) preferences->changePreference ( 4, 1 ); else preferences->changePreference ( 4, 0 ); } void AccountPreferences::changeOneTouchViewing ( bool state ) { if ( state == TRUE ) preferences->changePreference ( 5, 1 ); else preferences->changePreference ( 5, 0 ); } void AccountPreferences::setDefaultAccountPreferences () { preferences->changePreference ( 4, 0 ); preferences->changePreference ( 5, 0 ); currencysupport->setChecked ( FALSE ); onetouch->setChecked ( FALSE ); } diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp index d4cbc14..1455eb0 100755 --- a/noncore/apps/qashmoney/qashmoney.cpp +++ b/noncore/apps/qashmoney/qashmoney.cpp @@ -1,118 +1,118 @@ #include "qashmoney.h" #include "preferencedialogs.h" #include "memorydialog.h" #include <qheader.h> Budget *budget = new Budget (); Preferences *preferences = new Preferences (); Account *account = new Account (); Transaction *transaction = new Transaction (); Transfer *transfer = new Transfer (); Memory *memory = new Memory (); QashMoney::QashMoney () : QWidget () { preferences->addPreferences (); preferences->initializeColumnPreferences (); preferences->initializeSortingPreferences (); // set the text in the upper part of the frame setCaption ( tr ( "QashMoney" ) ); // Create new menubar for our mainwindow // and add menu items mainmenu = new QMenuBar ( this ); mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); preferencesmenu = new QPopupMenu ( this ); utilitiesmenu = new QPopupMenu ( this ); mainmenu->insertItem ( "Preferences", preferencesmenu ); mainmenu->insertItem ( "Utilities", utilitiesmenu ); - preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog () ) ); - preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog () ) ); - preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog () ) ); - utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog () ) ); + preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog() ) ); + preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog() ) ); + preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog() ) ); + utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog() ) ); // create the main tabwidget for displaying accounts and transactions maintabs = new QTabWidget ( this ); tab = new QWidget ( this ); tab_2 = new QWidget ( this ); tab_3 = new QWidget ( this ); maintabs->addTab ( tab, "Accounts" ); maintabs->addTab ( tab_2, "Transactions" ); maintabs->addTab ( tab_3, "Budgets" ); tabheight = tab->height(); maintabs->setTabEnabled ( tab_2, FALSE ); // create a new account display object accountdisplay = new AccountDisplay ( maintabs ); accountdisplay->setTabs ( tab_2, maintabs ); - connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( setTransactionTab () ) ); + connect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( setTransactionTab() ) ); // set the connection to disable the one touch account viewing if we are transfering money - connect ( accountdisplay->transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( toggleOneTouchViewing ( bool ) ) ); + connect ( accountdisplay->transferbutton, SIGNAL ( toggled(bool) ), this, SLOT ( toggleOneTouchViewing(bool) ) ); // create a new transactiondisplay object transactiondisplay = new TransactionDisplay ( maintabs ); transactiondisplay->hide(); // create new budgetdisplay object budgetdisplay = new BudgetDisplay ( maintabs ); budgetdisplay->hide(); tabslayout = new QVBoxLayout ( maintabs, 4, 2 ); tabslayout->addSpacing ( tabheight ); tabslayout->addWidget ( accountdisplay ); tabslayout->addWidget ( transactiondisplay ); tabslayout->addWidget ( budgetdisplay ); // connect a change in the maintabs with changing the tab display - connect ( maintabs, SIGNAL ( currentChanged ( QWidget * ) ), this, SLOT ( changeTabDisplay () ) ); + connect ( maintabs, SIGNAL ( currentChanged(QWidget*) ), this, SLOT ( changeTabDisplay() ) ); // create layout that will contain the menubar and the maintabs layout = new QVBoxLayout ( this, 2, 2 ); layout->setMenuBar ( mainmenu ); layout->addWidget ( maintabs ); } QashMoney::~QashMoney () { delete budget; delete preferences; delete account; delete transaction; delete transfer; delete memory; } void QashMoney::changeTabDisplay () { // if the user pressed the transactions tab, hide the account display // object and create a new transaction display if ( maintabs->currentPageIndex() == 1 ) { // initialize variables bool children = FALSE; // hide the account display and define accountid int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); //remove all the columns from the transactiondisplay int columns = transactiondisplay->listview->columns(); int counter; for ( counter = 0; counter <= columns; counter++ ) transactiondisplay->listview->removeColumn ( 0 ); // set the account name and account balance QString name = account->getAccountName ( accountid ); QString balance = account->getAccountBalance ( accountid ); transactiondisplay->name->setText ( name ); transactiondisplay->balance->setText ( balance ); // clear the limitbox transactiondisplay->limitbox->clear(); // get parent account id int parentaccountid = account->getParentAccountID ( accountid ); // add columns based on which account is selected @@ -307,96 +307,96 @@ void QashMoney::displayTransactionPreferencesDialog () QString displaytext = "%"; displaytext.prepend ( transactiondisplay->limitbox->text() ); setTransactionDisplayDate(); if ( transaction->getNumberOfTransactions() > 0 ) transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); if ( transfer->getNumberOfTransfers() != 0 ) transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); } else { accountdisplay->listview->clearSelection(); maintabs->setTabEnabled ( tab_2, FALSE ); } } void QashMoney::displayAccountPreferencesDialog () { // display a dialog for setting preferences for accounts AccountPreferences *ap = new AccountPreferences ( this ); ap->exec (); if ( accountdisplay->isVisible() && account->getNumberOfAccounts() != 0 ) { accountdisplay->listview->clear(); account->displayAccounts ( accountdisplay->listview ); accountdisplay->listview->clearSelection(); maintabs->setTabEnabled ( tab_2, FALSE ); } changeTabDisplay(); } void QashMoney::displayMemoryDialog () { // opens a dialog to add, edit and delete memory items MemoryDialog *md = new MemoryDialog (); md->exec(); } void QashMoney::showTransactions () { maintabs->setCurrentPage ( 1 ); } void QashMoney::enableOneTouchViewing () { if ( preferences->getPreference ( 5 ) == 1 ) - connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); + connect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) ); else - disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); + disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) ); } void QashMoney::disableOneTouchViewing () { - disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); + disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) ); } void QashMoney::toggleOneTouchViewing ( bool state ) { if ( state == TRUE ) disableOneTouchViewing(); else enableOneTouchViewing(); } void QashMoney::setTransactionDisplayDate () { // determine how many days of transactions to show int limittype = preferences->getPreference ( 7 ); if ( limittype != 5 ) // set today's date if we are not showing all transactions { QDate today = QDate::currentDate (); switch ( limittype ) // if we are not showing all transactions { case 0: // viewing two weeks newdate = today.addDays ( -14 ); break; case 1: // viewing one month newdate = today.addDays ( -30 ); break; case 2: // three months newdate = today.addDays ( -90 ); break; case 3: // six months newdate = today.addDays ( -180 ); break; case 4: // one year newdate = today.addDays ( -365 ); break; } } else newdate = QDate ( 1900, 1, 1 ); } diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp index 474f11e..0b94d62 100755 --- a/noncore/apps/qashmoney/transactiondisplay.cpp +++ b/noncore/apps/qashmoney/transactiondisplay.cpp @@ -1,114 +1,114 @@ #include "transactiondisplay.h" #include "newtransaction.h" #include "account.h" #include "budget.h" #include "memory.h" #include "transfer.h" #include "calculator.h" #include "datepicker.h" #include <qmessagebox.h> #include <qheader.h> #include <qmultilineedit.h> extern Transaction *transaction; extern Budget *budget; extern Account *account; extern Preferences *preferences; extern Memory *memory; extern Transfer *transfer; TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent ) { // set transactiondisplay variables; accountid = 0; children = TRUE; firstline = new QHBox ( this ); firstline->setSpacing ( 2 ); newtransaction = new QPushButton ( firstline ); newtransaction->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); - connect ( newtransaction, SIGNAL ( released () ), this, SLOT ( addTransaction () ) ); + connect ( newtransaction, SIGNAL ( released() ), this, SLOT ( addTransaction() ) ); edittransaction = new QPushButton ( firstline ); edittransaction->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); - connect ( edittransaction, SIGNAL ( released () ), this, SLOT ( checkListViewEdit () ) ); + connect ( edittransaction, SIGNAL ( released() ), this, SLOT ( checkListViewEdit() ) ); deletetransaction = new QPushButton ( firstline ); deletetransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); - connect ( deletetransaction, SIGNAL ( released () ), this, SLOT ( checkListViewDelete () ) ); + connect ( deletetransaction, SIGNAL ( released() ), this, SLOT ( checkListViewDelete() ) ); toggletransaction = new QPushButton ( firstline ); toggletransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/redo.png") ); - connect ( toggletransaction, SIGNAL ( released () ), this, SLOT ( checkListViewToggle () ) ); + connect ( toggletransaction, SIGNAL ( released() ), this, SLOT ( checkListViewToggle() ) ); viewtransactionnotes = new QPushButton ( firstline ); viewtransactionnotes->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/info.png") ); - connect ( viewtransactionnotes, SIGNAL ( released () ), this, SLOT ( showTransactionNotes () ) ); + connect ( viewtransactionnotes, SIGNAL ( released() ), this, SLOT ( showTransactionNotes() ) ); secondline = new QHBox ( this ); secondline->setSpacing ( 5 ); name = new QLabel ( secondline ); balance = new QLabel ( secondline ); QLabel *limit = new QLabel ( "Limit", secondline ); limitbox = new QLineEdit ( secondline ); limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) ); - connect ( limitbox, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( limitDisplay ( const QString & ) ) ); + connect ( limitbox, SIGNAL ( textChanged(const QString&) ), this, SLOT ( limitDisplay(const QString&) ) ); listview = new QListView ( this ); listview->setAllColumnsShowFocus ( TRUE ); listview->setShowSortIndicator ( TRUE ); listview->header()->setTracking ( FALSE ); - connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); - connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); + connect ( listview->header(), SIGNAL ( sizeChange(int,int,int) ), this, SLOT ( saveColumnSize(int,int,int) ) ); + connect ( listview->header(), SIGNAL ( clicked(int) ), this, SLOT ( saveSortingPreference(int) ) ); layout = new QVBoxLayout ( this, 2, 2 ); layout->addWidget ( firstline ); layout->addWidget ( secondline ); layout->addWidget ( listview ); } void TransactionDisplay::addTransaction () { // create local variables int cleared = -1; // create new transaction window NewTransaction *newtransaction = new NewTransaction ( this ); int width = this->size().width(); newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) ); newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) ); newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) ); newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) ); // enter today's date in the date box as defaul QDate today = QDate::currentDate (); int defaultday = today.day(); int defaultmonth = today.month(); int defaultyear = today.year(); newtransaction->transactiondate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); // add memory items to the transactionname combobox memory->displayMemoryItems ( newtransaction->transactionname ); newtransaction->transactionname->insertItem ( "", 0 ); if ( newtransaction->exec () == QDialog::Accepted ) { if ( newtransaction->clearedcheckbox->isChecked () == TRUE ) // set a parent id and type for a child transaction cleared = 1; else cleared = 0; float amount = newtransaction->transactionamount->text().toFloat(); if ( newtransaction->depositbox->isChecked() == FALSE ) amount = amount * -1; // add the transaction name to the memory items memory->addMemoryItem ( newtransaction->transactionname->currentText() ); // add the transaction @@ -168,97 +168,97 @@ void TransactionDisplay::showCalendar () { year = dp->getYear(); month = dp->getMonth(); day = dp->getDay(); date->setText ( preferences->getDate ( year, month, day ) ); } } void TransactionDisplay::editTransfer () { transferid = listview->currentItem()->text ( getIDColumn() ).toInt(); fromaccount = transfer->getFromAccountID ( transferid ); toaccount = transfer->getToAccountID ( transferid ); year = transfer->getYear ( transferid ); month = transfer->getMonth ( transferid ); day = transfer->getDay ( transferid ); QDialog *editransfer = new QDialog ( this, "edittransfer", TRUE ); editransfer->setCaption ( "Transfer" ); QStringList accountnames = account->getAccountNames(); QStringList accountids = account->getAccountIDs(); QLabel *fromaccountlabel = new QLabel ( "From Account:", editransfer ); QFont f = this->font(); f.setWeight ( QFont::Bold ); fromaccountlabel->setFont ( f ); QComboBox *fromaccountbox = new QComboBox ( editransfer ); fromaccountbox->insertStringList ( accountnames ); fromaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( fromaccount ) ) ); QLabel *toaccountlabel = new QLabel ( "To Account:", editransfer ); toaccountlabel->setFont ( f ); QComboBox *toaccountbox = new QComboBox ( editransfer ); toaccountbox->insertStringList ( accountnames ); toaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( toaccount ) ) ); QLabel *datelabel = new QLabel ( "Date", editransfer ); QHBox *datebox = new QHBox ( editransfer ); datebox->setSpacing ( 2 ); date = new QLineEdit ( datebox ); date->setAlignment ( Qt::AlignRight ); date->setDisabled ( TRUE ); date->setText ( preferences->getDate ( year, month, day ) ); QPushButton *datebutton = new QPushButton ( datebox ); datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); - connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); + connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) ); QLabel *amounttlabel = new QLabel ( "Amount", editransfer ); QHBox *amountbox = new QHBox ( editransfer ); amountbox->setSpacing ( 2 ); amount = new QLineEdit ( amountbox ); amount->setAlignment ( Qt::AlignRight ); amount->setText ( transfer->getAmount ( transferid ) ); QPushButton *calculatorbutton = new QPushButton( amountbox ); calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); QCheckBox *clearedcheckbox = new QCheckBox ( "Cleared", editransfer ); QBoxLayout *layout = new QVBoxLayout ( editransfer, 4, 2 ); layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); layout->addWidget ( fromaccountbox, Qt::AlignLeft ); layout->addWidget ( toaccountlabel, Qt::AlignLeft ); layout->addWidget ( toaccountbox, Qt::AlignLeft ); layout->addSpacing ( 5 ); layout->addWidget ( datelabel, Qt::AlignLeft ); layout->addWidget ( datebox, Qt::AlignLeft ); layout->addWidget ( amounttlabel, Qt::AlignLeft ); layout->addWidget ( amountbox, Qt::AlignLeft ); layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); if ( editransfer->exec() == QDialog::Accepted ) { //get fromaccount fromaccount = ( accountids.operator[] ( fromaccountbox->currentItem() ) ).toInt(); //get to account toaccount = ( accountids.operator[] ( toaccountbox->currentItem() ) ).toInt(); //set cleared flag int cleared = 0; if ( clearedcheckbox->isChecked() == TRUE ) cleared = 1; //update transfer transfer->updateTransfer ( fromaccount, account->getParentAccountID ( fromaccount ), toaccount, account->getParentAccountID ( toaccount ), day, month, year, amount->text().toFloat(), cleared, transferid ); account->updateAccountBalance ( fromaccount ); if ( account->getParentAccountID ( fromaccount ) != -1 ) account->changeParentAccountBalance ( account->getParentAccountID ( fromaccount ) ); updateAndDisplay ( toaccount ); diff --git a/noncore/apps/qashmoney/transferdialog.cpp b/noncore/apps/qashmoney/transferdialog.cpp index 558abec..7a12fbf 100755 --- a/noncore/apps/qashmoney/transferdialog.cpp +++ b/noncore/apps/qashmoney/transferdialog.cpp @@ -1,81 +1,81 @@ #include "transferdialog.h" #include "datepicker.h" #include "calculator.h" extern Preferences *preferences; extern Account *account; TransferDialog::TransferDialog ( QWidget *parent, int fromaccountid, int toaccountid ) : QDialog ( parent, 0, TRUE ) { dateedited = FALSE; setCaption ( "Transfer" ); fromaccountlabel = new QLabel ( "From account:", this ); QFont f = this->font(); f.setWeight ( QFont::Bold ); fromaccountlabel->setFont ( f ); fromaccount = new QLabel ( account->getAccountName ( fromaccountid ), this ); toaccountlabel = new QLabel ( "To Account:", this ); toaccountlabel->setFont ( f ); toaccount = new QLabel ( account->getAccountName ( toaccountid ), this ); datelabel = new QLabel ( "Date", this ); datebox = new QHBox ( this ); datebox->setSpacing ( 2 ); date = new QLineEdit ( datebox ); date->setAlignment ( Qt::AlignRight ); date->setDisabled ( TRUE ); datebutton = new QPushButton ( datebox ); datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); - connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); + connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) ); amounttlabel = new QLabel ( "Amount", this ); amountbox = new QHBox ( this ); amountbox->setSpacing ( 2 ); amount = new QLineEdit ( amountbox ); amount->setAlignment ( Qt::AlignRight ); calculatorbutton = new QPushButton( amountbox ); calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); clearedcheckbox = new QCheckBox ( "Cleared", this ); layout = new QVBoxLayout ( this, 4, 2 ); layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); layout->addWidget ( fromaccount, Qt::AlignLeft ); layout->addWidget ( toaccountlabel, Qt::AlignLeft ); layout->addWidget ( toaccount, Qt::AlignLeft ); layout->addSpacing ( 5 ); layout->addWidget ( datelabel, Qt::AlignLeft ); layout->addWidget ( datebox, Qt::AlignLeft ); layout->addWidget ( amounttlabel, Qt::AlignLeft ); layout->addWidget ( amountbox, Qt::AlignLeft ); layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); } bool TransferDialog::getDateEdited () { return dateedited; } void TransferDialog::showCalendar () { QDate newDate = QDate::currentDate (); DatePicker *dp = new DatePicker ( newDate ); if ( dp->exec () == QDialog::Accepted ) { // Set date integers year = dp->getYear(); month = dp->getMonth(); day = dp->getDay(); // Set dateedited to TRUE // This tells the accountdisplay object that the user edited an account // and did change the date dateedited = TRUE; // Display date with our selected format diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp index f35dfcd..4c6d809 100644 --- a/noncore/apps/tableviewer/tableviewer.cpp +++ b/noncore/apps/tableviewer/tableviewer.cpp @@ -110,104 +110,104 @@ TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f QString::null, this, SLOT(firstItem()), navigation, "First Item"); QToolButton *previousItemButton = new QToolButton( QIconSet(Resource::loadPixmap("back")), "Previous Item", QString::null, this, SLOT(previousItem()), navigation, "Previous Item"); QToolButton *nextItemButton = new QToolButton( QIconSet(Resource::loadPixmap("forward")), "Next Item", QString::null, this, SLOT(nextItem()), navigation, "Next Item"); QToolButton *lastItemButton = new QToolButton( QIconSet(Resource::loadPixmap("fastforward")), "Last Item", QString::null, this, SLOT(lastItem()), navigation, "Last Item"); navigation->addSeparator(); QToolButton *browseButton = new QToolButton( QIconSet(Resource::loadPixmap("day")), "View Single Item", QString::null, this, SLOT(browseViewSlot()), navigation, "View Single Item"); QToolButton *listButton = new QToolButton( QIconSet(Resource::loadPixmap("month")), "View Multiple Items", QString::null, this, SLOT(listViewSlot()), navigation, "View Multiple Items"); setToolBarsMovable(FALSE); setToolBarsMovable(FALSE); setToolBarsMovable(FALSE); /* Build widgets */ browseView = new TVBrowseView(&ts, this, 0); listView = new TVListView(&ts, this, 0); filterView = new TVFilterView(&ts, this, 0); fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer", this, "fileselector"); fileSelector->setNewVisible(FALSE); fileSelector->setCloseVisible(FALSE); cw = new QWidgetStack(this, 0); cw->addWidget(listView, ListState); cw->addWidget(browseView, BrowseState); cw->addWidget(filterView, FilterState); cw->addWidget(fileSelector, FileState); current_view = FileState; cw->raiseWidget(current_view); fileSelector->reread(); - connect(browseView, SIGNAL(searchOnKey(int, TVVariant)), - this, SLOT(searchOnKey(int, TVVariant))); + connect(browseView, SIGNAL(searchOnKey(int,TVVariant)), + this, SLOT(searchOnKey(int,TVVariant))); connect(browseView, SIGNAL(sortChanged(int)), this, SLOT(setPrimaryKey(int))); connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot())); - connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), - this, SLOT(openDocument(const DocLnk &))); + connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)), + this, SLOT(openDocument(const DocLnk&))); main_layout->addWidget(menu); main_layout->addWidget(cw); setCentralWidget(cw); } /*! Destroys the TableViewerWindow */ TableViewerWindow::~TableViewerWindow() { if(dirty) saveDocument(); } /*! Opens a file dialog and loads the file specified by the dialog */ void TableViewerWindow::selectDocument() { if(dirty) saveDocument(); current_view = FileState; cw->raiseWidget(current_view); fileSelector->reread(); } void TableViewerWindow::saveDocument() { if(!dirty) return; FileManager fm; QIODevice *dev = fm.saveFile(doc); if(!ds->saveSource(dev, doc.type())){ qWarning("Save unsuccessful"); return; } dev->close(); dirty = FALSE; } void TableViewerWindow::newDocument() { DocLnk nf; diff --git a/noncore/apps/tableviewer/ui/commonwidgets.cpp b/noncore/apps/tableviewer/ui/commonwidgets.cpp index 4c47951..e82018c 100644 --- a/noncore/apps/tableviewer/ui/commonwidgets.cpp +++ b/noncore/apps/tableviewer/ui/commonwidgets.cpp @@ -1,88 +1,88 @@ /********************************************************************** ** 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 <qlineedit.h> #include <qlayout.h> #include <qlabel.h> #include <qcombobox.h> #include <qpe/datebookmonth.h> #include <qpopupmenu.h> #include <qspinbox.h> #include "commonwidgets.h" DateEdit::DateEdit( QWidget *parent, const char *name, WFlags f ) : QToolButton(parent, name) { QPopupMenu *m1 = new QPopupMenu(this); dateSelector = new DateBookMonth(m1, 0, TRUE); m1->insertItem(dateSelector); setPopup(m1); setPopupDelay(0); - connect(dateSelector, SIGNAL(dateClicked(int, int, int)), + connect(dateSelector, SIGNAL(dateClicked(int,int,int)), this, SLOT(subValueChanged())); setText(dateSelector->selectedDate().toString()); } DateEdit::~DateEdit() {} QDate DateEdit::date() const { return dateSelector->selectedDate(); } void DateEdit::setDate(QDate d) { dateSelector->setDate(d.year(), d.month(), d.day()); setText(d.toString()); } QSizePolicy DateEdit::sizePolicy() const { QSizePolicy sp; sp.setHorData(QToolButton::sizePolicy().horData()); sp.setVerData(QSizePolicy::Fixed); return sp; } void DateEdit::clear() { QDate today = QDate::currentDate(); dateSelector->setDate(today.year(), today.month(), today.day()); setText(today.toString()); } void DateEdit::subValueChanged() { QDate current = dateSelector->selectedDate(); setText(current.toString()); emit valueChanged(current); } TimeEdit::TimeEdit( QWidget *parent, const char *name, WFlags f ) : QWidget(parent, name, f) { QHBoxLayout *layout = new QHBoxLayout(this, 0); diff --git a/noncore/apps/tableviewer/ui/tvbrowseview.cpp b/noncore/apps/tableviewer/ui/tvbrowseview.cpp index 22bac55..8a65ed1 100644 --- a/noncore/apps/tableviewer/ui/tvbrowseview.cpp +++ b/noncore/apps/tableviewer/ui/tvbrowseview.cpp @@ -9,98 +9,98 @@ ** 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 "tvbrowseview.h" #include "browsekeyentry.h" #include <qtoolbutton.h> #include <qtextview.h> #include <qtextbrowser.h> #include <qlayout.h> #include "../xmlencodeattr.h" /*! \class TVBrowseView \brief The widget describing how to draw the browse view user interface This widget allows for the user to browse through the table, one element at a time, or search on a single key. Its main goal is to show a single element in a readable format and make it easy for the user to rapidly find specific elements in the table. */ /*! Constructs a new TVBrowseView widget */ TVBrowseView::TVBrowseView(TableState *t, QWidget* parent, const char *name, WFlags fl ) { if (!name) setName("BrowseView"); // setSizePolicy(QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 0, 0, sizePolicy().hasHeightForWidth() ) ); QVBoxLayout *vlayout = new QVBoxLayout(this); textViewDisplay = new QTextBrowser(this, "textViewDisplay"); vlayout->addWidget( textViewDisplay ); keyEntry = new TVBrowseKeyEntry(this, "keyEntry"); vlayout->addWidget( keyEntry ); /* connect the signals down */ - connect(keyEntry, SIGNAL(searchOnKey(int, TVVariant)), - this, SIGNAL(searchOnKey(int, TVVariant))); + connect(keyEntry, SIGNAL(searchOnKey(int,TVVariant)), + this, SIGNAL(searchOnKey(int,TVVariant))); connect(keyEntry, SIGNAL(sortChanged(int)), this, SIGNAL(sortChanged(int))); ts = t; keyEntry->setTableState(t); } /*! Destroys the TVBrowseView widget */ TVBrowseView::~TVBrowseView() { } void TVBrowseView::rebuildData() { if(!ts) return; if(!ts->current_elem) { /* also disable buttons */ textViewDisplay->setText(""); return; } setDisplayText(ts->current_elem); } /* Reset to initial state */ void TVBrowseView::reset() { textViewDisplay->setText(""); keyEntry->reset(); } /*! sets the data element to be displayed to element */ void TVBrowseView::setDisplayText(const DataElem *element) { QString rep = ""; KeyListIterator it(*ts->kRep); while (it.current()) { if (element->hasValidValue(it.currentKey())) { if(it.currentKey() == ts->current_column) { rep += "<A name=\"ckey\"></A><B><FONT COLOR=#FF0000>" + encodeAttr(it.current()->name()) diff --git a/noncore/apps/tableviewer/ui/tvfilterview.cpp b/noncore/apps/tableviewer/ui/tvfilterview.cpp index b03e846..22f1fb7 100644 --- a/noncore/apps/tableviewer/ui/tvfilterview.cpp +++ b/noncore/apps/tableviewer/ui/tvfilterview.cpp @@ -44,97 +44,97 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent, 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"); hlayout->addWidget(newFilterButton); deleteFilterButton = new QPushButton(this, "delete Filter"); deleteFilterButton->setMaximumSize(QSize(50, 32767)); deleteFilterButton->setText("Delete"); hlayout->addWidget(deleteFilterButton); clearFilterButton = new QPushButton(this, "delete Filter"); clearFilterButton->setMaximumSize(QSize(60, 32767)); clearFilterButton->setText("Clear All"); hlayout->addWidget(clearFilterButton); vlayout->addLayout(hlayout); QHBoxLayout *hlayout2 = new QHBoxLayout; keyNameCombo = new QComboBox(FALSE, this, "key name"); keyNameCombo->setEnabled(FALSE); hlayout2->addWidget(keyNameCombo); QLabel *label = new QLabel(this); label->setText("has value"); hlayout2->addWidget(label); keyEntry = new TVFilterKeyEntry(this, "key entry"); keyEntry->setEnabled(FALSE); vlayout->addLayout(hlayout2); vlayout->addWidget(keyEntry); connect(newFilterButton, SIGNAL( clicked() ), this, SLOT( newTerm() )); connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm())); connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms())); connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() )); connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() )); connect(display, SIGNAL(selectionChanged(QListViewItem*)), this, - SLOT(setTerm(QListViewItem *))); + SLOT(setTerm(QListViewItem*))); ts = t; current = 0; terms.setAutoDelete(true); do_filter = false; #ifdef Q_WS_QWS QPEApplication::showDialog( this ); #endif } /*! Destroys the TVFilterView widget */ TVFilterView::~TVFilterView() { } void TVFilterView::rebuildData() { } void TVFilterView::reset() { keyNameCombo->clear(); keyIds.clear(); } void TVFilterView::rebuildKeys() { int i; if (!ts) return; if(!ts->kRep) return; keyEntry->setTableState(ts); /* set up the list of keys that can be compared on */ keyNameCombo->clear(); KeyListIterator it(*ts->kRep); i = 0; while(it.current()) { if(ts->kRep->validIndex(it.currentKey())) { keyNameCombo->insertItem(it.current()->name()); keyIds.insert(i, it.currentKey()); ++i; } ++it; diff --git a/noncore/apps/tableviewer/ui/tvlistview.cpp b/noncore/apps/tableviewer/ui/tvlistview.cpp index b25e813..b10ff1d 100644 --- a/noncore/apps/tableviewer/ui/tvlistview.cpp +++ b/noncore/apps/tableviewer/ui/tvlistview.cpp @@ -59,98 +59,98 @@ public: } QString key(int i, bool a) const { return data_reference->toSortableQString(i); } void setDataElem(DataElem *d) { data_reference = d; } DataElem *getDataElem() { return data_reference; } private: DataElem *data_reference; }; TVListViewItem::TVListViewItem(QListView *parent, DataElem *d) : QListViewItem(parent) { data_reference = d; } TVListViewItem::~TVListViewItem() { data_reference = 0; } TVListView::TVListView(TableState *t, QWidget* parent, const char *name, WFlags fl ) : QWidget(parent, name, fl) { if (!name) setName("TVListView"); // the next two lines need to be rationalized. resize(318,457); setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth())); setCaption(tr("List View")); QVBoxLayout *layout = new QVBoxLayout(this); layout->setSpacing(0); layout->setMargin(0); listViewDisplay = new TVListViewPrivate(this, "listViewDisplay"); layout->addWidget(listViewDisplay); - connect(listViewDisplay, SIGNAL(currentChanged(QListViewItem *)), this, - SLOT(setCurrent(QListViewItem *))); + connect(listViewDisplay, SIGNAL(currentChanged(QListViewItem*)), this, + SLOT(setCurrent(QListViewItem*))); connect(listViewDisplay, SIGNAL(sortChanged(int)), this, SLOT(setSorting(int))); listViewDisplay->setShowSortIndicator(true); it = new QListViewItemIterator(listViewDisplay); ts = t; } TVListView::~TVListView() { } void TVListView::addItem(DataElem *d) { TVListViewItem *i = new TVListViewItem(listViewDisplay, d); delete it; it = new QListViewItemIterator(i); } /* remove current (it) item */ void TVListView::removeItem() { QListViewItemIterator other(*it); QListViewItemIterator tmp = *it; (*it)++; if (!it->current()) { *it = tmp; (*it)--; if (!it->current()) { delete it; it = 0; } } delete other.current(); } void TVListView::clearItems() { /* This is ok since the destructor for TVListItem does not know about the data_reference pointer.. and hence will leave it alone */ listViewDisplay->clear(); delete it; it = new QListViewItemIterator(listViewDisplay); } diff --git a/noncore/apps/tinykate/libkate/document/katedialogs.cpp b/noncore/apps/tinykate/libkate/document/katedialogs.cpp index 2f0ed7b..f4edd7e 100644 --- a/noncore/apps/tinykate/libkate/document/katedialogs.cpp +++ b/noncore/apps/tinykate/libkate/document/katedialogs.cpp @@ -10,105 +10,105 @@ /*************************************************************************** * * * 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 "katedialogs.h" #include <klocale.h> #include <kdebug.h> #include <qgroupbox.h> #include <qvgroupbox.h> #include <qhgroupbox.h> #include <qhbox.h> #include <qvbox.h> #include <qlayout.h> #include <qpushbutton.h> #include <qwidgetstack.h> #include <qlabel.h> #include <qlistview.h> #include <qlineedit.h> #include <qcombobox.h> #include <qcheckbox.h> //FIXME #include <kcharsets.h> #include <kglobal.h> #include <qmap.h> #include <kmessagebox.h> #include <kstddirs.h> /******************************************************************************************************************* * Context Editor * *******************************************************************************************************************/ StyleChanger::StyleChanger( QWidget *parent ) : QWidget(parent) { QLabel *label; QGridLayout *glay = new QGridLayout( this, 4, 3, 0, KDialog::spacingHint() ); CHECK_PTR(glay); glay->addColSpacing( 1, KDialog::spacingHint() ); // Looks better glay->setColStretch( 2, 10 ); col = new KColorButton(this); CHECK_PTR(col); - connect(col,SIGNAL(changed(const QColor &)),this,SLOT(changed())); + connect(col,SIGNAL(changed(const QColor&)),this,SLOT(changed())); label = new QLabel(col,i18n("Normal:"),this); CHECK_PTR(label); glay->addWidget(label,0,0); glay->addWidget(col,1,0); selCol = new KColorButton(this); CHECK_PTR(selCol); - connect(selCol,SIGNAL(changed(const QColor &)),this,SLOT(changed())); + connect(selCol,SIGNAL(changed(const QColor&)),this,SLOT(changed())); label = new QLabel(selCol,i18n("Selected:"),this); CHECK_PTR(label); glay->addWidget(label,2,0); glay->addWidget(selCol,3,0); bold = new QCheckBox(i18n("Bold"),this); CHECK_PTR(bold); connect(bold,SIGNAL(clicked()),SLOT(changed())); glay->addWidget(bold,1,2); italic = new QCheckBox(i18n("Italic"),this); CHECK_PTR(italic); connect(italic,SIGNAL(clicked()),SLOT(changed())); glay->addWidget(italic,2,2); } void StyleChanger::setRef(ItemStyle *s) { style = s; col->setColor(style->col); selCol->setColor(style->selCol); bold->setChecked(style->bold); italic->setChecked(style->italic); } void StyleChanger::setEnabled(bool enable) { col->setEnabled(enable); selCol->setEnabled(enable); bold->setEnabled(enable); italic->setEnabled(enable); } void StyleChanger::changed() { if (style) { style->col = col->color(); style->selCol = selCol->color(); style->bold = bold->isChecked(); style->italic = italic->isChecked(); } } HighlightDialog::HighlightDialog( HlManager *hlManager, ItemStyleList *styleList, HlDataList *highlightDataList, int hlNumber, QWidget *parent, const char *name, bool modal ) @@ -241,97 +241,97 @@ void HighlightDialogPage::changed() void HighlightDialogPage::writeback() { if (hlData) { hlData->wildcards = wildcards->text(); hlData->mimetypes = mimetypes->text(); } } void HighlightDialogPage::saveData() { kdDebug(13010)<<"HighlightDialogPage::saveData()"<<endl; writeback(); } void HighlightDialogPage::hlEdit() { HlEditDialog diag(0,0,"hlEdit", true,hlData); diag.show(); } void HighlightDialogPage::hlNew() { HlEditDialog diag(0,0,"hlEdit",true,0); diag.show(); } HlEditDialog::HlEditDialog(HlManager *,QWidget *parent, const char *name, bool modal,HlData *data) :KDialogBase(KDialogBase::Swallow, i18n("Highlight Conditions"), Ok|Cancel, Ok, parent, name, modal) { currentItem=0; transTableCnt=0; QHBox *wid=new QHBox(this); QVBox *lbox=new QVBox(wid); contextList=new KListView(lbox); contextList->setRootIsDecorated(true); contextList->addColumn(i18n("Syntax structure")); contextList->setSorting(-1); QHBox *bbox=new QHBox(lbox); QPushButton *addContext=new QPushButton(i18n("New Context"),bbox); QPushButton *addItem=new QPushButton(i18n("New Item"),bbox); QVGroupBox *opt = new QVGroupBox( i18n("Options"), wid); stack=new QWidgetStack(opt); initContextOptions(contextOptions=new QVBox(stack)); stack->addWidget(contextOptions,HlEContext); initItemOptions(itemOptions=new QVBox(stack)); stack->addWidget(itemOptions,HlEItem); stack->raiseWidget(HlEContext); setMainWidget(wid); if (data!=0) loadFromDocument(data); else newDocument(); - connect(contextList,SIGNAL(currentChanged( QListViewItem*)),this,SLOT(currentSelectionChanged ( QListViewItem * ))); + connect(contextList,SIGNAL(currentChanged(QListViewItem*)),this,SLOT(currentSelectionChanged(QListViewItem*))); connect(addContext,SIGNAL(clicked()),this,SLOT(contextAddNew())); connect(addItem,SIGNAL(clicked()),this,SLOT(ItemAddNew())); } void HlEditDialog::newDocument() { KStandardDirs *dirs = KGlobal::dirs(); QStringList list=dirs->findAllResources("data","kate/syntax/syntax.template",false,true); for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { HlData data("","",*it); loadFromDocument(&data); return; } KMessageBox::error(this,i18n("Can't find template file")); } void HlEditDialog::initContextOptions(QVBox *co) { if( co!=0) { QHBox *tmp = new QHBox(co); (void) new QLabel(i18n("Description:"),tmp); ContextDescr=new QLineEdit(tmp); tmp= new QHBox(co); (void) new QLabel(i18n("Attribute:"),tmp); ContextAttribute=new QComboBox(tmp); tmp= new QHBox(co); (void) new QLabel(i18n("LineEnd:"),tmp); ContextLineEnd = new QComboBox(tmp); connect(ContextDescr,SIGNAL(textChanged(const QString&)),this,SLOT(contextDescrChanged(const QString&))); connect(ContextLineEnd,SIGNAL(activated(int)),this,SLOT(contextLineEndChanged(int))); connect(ContextAttribute,SIGNAL(activated(int)),this,SLOT(contextAttributeChanged(int))); } else kdDebug(13010)<<"initContextOptions: Widget is 0"<<endl; } void HlEditDialog::insertTranslationList(QString tag, QString trans,int length) { ItemInfo data(trans,length); id2tag.insert(transTableCnt,tag); id2info.insert(transTableCnt,data); tag2id.insert(tag,transTableCnt); transTableCnt++; } diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp index f05e21a..0c742d7 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp @@ -123,97 +123,97 @@ const char * KateActionGroup::typeName(int type) return ""; } const int KateDocument::maxAttribs = 32; QStringList KateDocument::searchForList = QStringList(); QStringList KateDocument::replaceWithList = QStringList(); uint KateDocument::uniqueID = 0; QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0; KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, QWidget *parentWidget, const char *widgetName, QObject *, const char *) : Kate::Document (), myFont(KGlobalSettings::generalFont()), myFontBold(KGlobalSettings::generalFont()), myFontItalic(KGlobalSettings::generalFont()), myFontBI(KGlobalSettings::generalFont()), myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI), hlManager(HlManager::self ()) { d(this)->hlSetByUser = false; PreHighlightedTill=0; RequestPreHighlightTill=0; m_bSingleViewMode=bSingleViewMode; m_bBrowserView = bBrowserView; m_url = QString::null; // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports // (esp. it doesn't distinguish between UTF-8 and iso10646-1) myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name()); maxLength = -1; setFont (KGlobalSettings::generalFont()); myDocID = uniqueID; uniqueID++; myDocName = QString (""); fileInfo = new QFileInfo (); myCmd = new KateCmd (this); - connect(this,SIGNAL(modifiedChanged ()),this,SLOT(slotModChanged ())); + connect(this,SIGNAL(modifiedChanged()),this,SLOT(slotModChanged())); buffer = new KWBuffer; connect(buffer, SIGNAL(linesChanged(int)), this, SLOT(slotBufferChanged())); // connect(buffer, SIGNAL(textChanged()), this, SIGNAL(textChanged())); connect(buffer, SIGNAL(needHighlight(long,long)),this,SLOT(slotBufferHighlight(long,long))); colors[0] = KGlobalSettings::baseColor(); colors[1] = KGlobalSettings::highlightColor(); m_attribs = new Attribute[maxAttribs]; m_highlight = 0L; tabChars = 8; m_singleSelection = false; newDocGeometry = false; readOnly = false; newDoc = false; modified = false; undoList.setAutoDelete(true); undoState = 0; undoSteps = 50; pseudoModal = 0L; clear(); setHighlight(0); //calls updateFontData() // if the user changes the highlight with the dialog, notify the doc connect(hlManager,SIGNAL(changed()),SLOT(hlChanged())); newDocGeometry = false; readConfig(); setReadOnly(false); } void KateDocument::setDontChangeHlOnSave() { d(this)->hlSetByUser = true; } void KateDocument::setFont (QFont font) { kdDebug()<<"Kate:: setFont"<<endl; diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp index a85fb87..8e68262 100644 --- a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp +++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp @@ -490,82 +490,82 @@ ColorConfig::ColorConfig( QWidget *parent, char *name ) label->setAlignment( AlignRight|AlignVCenter ); m_back = new KColorButton( this ); glay->addWidget( label, 0, 0 ); glay->addWidget( m_back, 0, 1 ); label = new QLabel( i18n("Selected:"), this); label->setAlignment( AlignRight|AlignVCenter ); m_selected = new KColorButton( this ); glay->addWidget( label, 2, 0 ); glay->addWidget( m_selected, 2, 1 ); // QWhatsThis help QWhatsThis::add(m_back, i18n("Sets the background color of the editing area")); QWhatsThis::add(m_selected, i18n("Sets the background color of the selection. To set the text color for selected text, use the "<b>Configure Highlighting</b>" dialog.")); } ColorConfig::~ColorConfig() { } void ColorConfig::setColors(QColor *colors) { m_back->setColor( colors[0] ); m_selected->setColor( colors[1] ); } void ColorConfig::getColors(QColor *colors) { colors[0] = m_back->color(); colors[1] = m_selected->color(); } FontConfig::FontConfig( QWidget *parent, char *name ) : QWidget( parent, name ) { // sizemanagment QGridLayout *grid = new QGridLayout( this, 1, 1 ); // QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); // QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); // int size = cfg. readNumEntry ( "FontSize", 10 ); // OFontSelector *m_fontselect; m_fontselect = new Opie::OFontSelector ( false, this, "FontTab" ); // m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); // QWhatsThis::add( m_fontselect, // tr( "Select the desired name, style and size of the default font applications will use." ) ); - connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), - this, SLOT( slotFontSelected( const QFont & ))); + connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), + this, SLOT( slotFontSelected(const QFont&))); grid->addWidget( m_fontselect, 0, 0); // #if 0 // m_fontchooser = new KFontChooser ( this ); // m_fontchooser->enableColumn(KFontChooser::StyleList, false); // grid->addWidget( m_fontchooser, 0, 0); -// connect (m_fontchooser, SIGNAL (fontSelected( const QFont & )), this, SLOT (slotFontSelected( const QFont & ))); +// connect (m_fontchooser, SIGNAL (fontSelected(const QFont&)), this, SLOT (slotFontSelected(const QFont&))); // #endif } FontConfig::~FontConfig() { } void FontConfig::setFont ( const QFont &font ) { //#if 0 m_fontselect->setFont (font); myFont = font; //#endif } void FontConfig::slotFontSelected( const QFont &font ) { myFont = font; } diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index 19a0127..32c1eab 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp @@ -1,93 +1,93 @@ /*************************************************************************** tinykate.cpp Tiny KATE mainwindow ------------------- begin : November 2002 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> ***************************************************************************/ /*************************************************************************** * * * This program is free softwaSre; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation. * * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * * * ***************************************************************************/ #include <qaction.h> #include <qtoolbutton.h> #include <qmenubar.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> #include <opie2/ofiledialog.h> #include "tinykate.h" #include <katedocument.h> #include <kglobal.h> TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) { shutDown=false; nextUnnamed=0; currentView=0; viewCount=0; setCaption(tr("TinyKATE")); KGlobal::setAppName("TinyKATE"); QMenuBar *mb = new QMenuBar( this ); mb->setMargin( 0 ); tabwidget=new OTabWidget(this); setCentralWidget(tabwidget); - connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); + connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*))); //FILE ACTIONS QPopupMenu *popup = new QPopupMenu( this ); // Action for creating a new document QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); a->addTo( popup ); connect(a, SIGNAL(activated()), this, SLOT(slotNew())); // Action for opening an exisiting document a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); // Action for saving document a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSave())); // Action for saving document to a new name a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); // Action for closing the currently active document a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotClose())); mb->insertItem(tr("File"),popup); //EDIT ACTIONS // Action for cutting text editCut = new QToolButton( 0 ); editCut->setAutoRaise( true ); editCut->setIconSet( Resource::loadPixmap( "cut" ) ); // Action for Copying text editCopy = new QToolButton( 0 ); editCopy->setAutoRaise( true ); editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); // Action for pasting text editPaste = new QToolButton( 0 ); editPaste->setAutoRaise( true ); diff --git a/noncore/apps/zsafe/scqtfiledlg.cpp b/noncore/apps/zsafe/scqtfiledlg.cpp index dd72fdf..52b8d0d 100644 --- a/noncore/apps/zsafe/scqtfiledlg.cpp +++ b/noncore/apps/zsafe/scqtfiledlg.cpp @@ -150,103 +150,103 @@ ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags Layout3->addWidget( CancelButton ); Layout4->addLayout( Layout3 ); Layout3_2 = new QHBoxLayout; Layout3_2->setSpacing( 6 ); Layout3_2->setMargin( 0 ); FNameLineEdit = new QLineEdit( this, "FNameLineEdit" ); QToolTip::add( FNameLineEdit, tr( "shows the selected filename" ) ); QWhatsThis::add( FNameLineEdit, tr( "Filename LineEdit\n" "\n" "shows the selected file\n" "and allows the direct filename\n" "edit" ) ); Layout3_2->addWidget( FNameLineEdit ); MkDirButton = new QToolButton( this, "MkDirButton" ); MkDirButton->setText( tr( "" ) ); MkDirButton->setPixmap( image2 ); MkDirButton->setUsesBigPixmap( FALSE ); QToolTip::add( MkDirButton, tr( "confirms the selection and closes the form" ) ); QWhatsThis::add( MkDirButton, tr( "OKButton" ) ); Layout3_2->addWidget( MkDirButton ); Layout4->addLayout( Layout3_2 ); DirComboBox = new QComboBox( FALSE, this, "DirComboBox" ); DirComboBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, DirComboBox->sizePolicy().hasHeightForWidth() ) ); DirComboBox->setEditable( TRUE ); DirComboBox->setDuplicatesEnabled( FALSE ); QWhatsThis::add( DirComboBox, tr( "ComboBox Directory \n" "edit or select the directories name" ) ); Layout4->addWidget( DirComboBox ); Layout5->addLayout( Layout4 ); ListView = new QListView( this, "ListView" ); ListView->addColumn( tr( "Name" ) ); ListView->addColumn( tr( "size" ) ); ListView->addColumn( tr( "type" ) ); ListView->setRootIsDecorated( TRUE ); QToolTip::add( ListView, tr( "directory listview" ) ); QWhatsThis::add( ListView, tr( "Directory ListView\n" "\n" "shows the list of dirs and files" ) ); Layout5->addWidget( ListView ); ScQtFileDlgLayout->addLayout( Layout5 ); // signals and slots connections connect( OkButton, SIGNAL( clicked() ), this, SLOT( slotOK() ) ); - connect( DirComboBox, SIGNAL( activated(int) ), this, SLOT( slotDirComboBoxChanged( int ) ) ); - connect( TypeComboBox, SIGNAL( activated(int) ), this, SLOT( slotTypeComboBoxChanged( int ) ) ); + connect( DirComboBox, SIGNAL( activated(int) ), this, SLOT( slotDirComboBoxChanged(int) ) ); + connect( TypeComboBox, SIGNAL( activated(int) ), this, SLOT( slotTypeComboBoxChanged(int) ) ); connect( CancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); - connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem *) ) ); - connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem *) ) ); - connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotDoubleClicked(QListViewItem *) ) ); - connect( FNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileTextChanged( const QString & ) ) ); + connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) ); + connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) ); + connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotDoubleClicked(QListViewItem*) ) ); + connect( FNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileTextChanged(const QString&) ) ); connect( FNameLineEdit, SIGNAL( returnPressed() ), this, SLOT( slotOK() ) ); connect( MkDirButton, SIGNAL( clicked() ), this, SLOT( slotMkDir() ) ); } /* * 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!" ); } void ScQtFileDlg::slotDirComboBoxChanged( int ) { qWarning( "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" ); } void ScQtFileDlg::slotDoubleClicked(QListViewItem *) { qWarning( "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" ); } void ScQtFileDlg::slotFileTextChanged( const QString & ) { qWarning( "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" ); } void ScQtFileDlg::slotMkDir() { qWarning( "ScQtFileDlg::slotMkDir(): Not implemented yet!" ); } void ScQtFileDlg::slotOK() { qWarning( "ScQtFileDlg::slotOK(): Not implemented yet!" ); } void ScQtFileDlg::slotSelectionChanged(QListViewItem *) { qWarning( "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" ); } void ScQtFileDlg::slotTypeComboBoxChanged( int ) diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index a3e805e..a3467e5 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -645,102 +645,102 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) h->addWidget (menu); h->addWidget (New); h->addWidget (Edit); h->addWidget (Delete); h->addWidget (Find); */ ListView = new ZListView( this, "ListView" ); ListView->addColumn( tr( "Name" ) ); ListView->addColumn( tr( "Field 2" ) ); ListView->addColumn( tr( "Field 3" ) ); ListView->addColumn( tr( "Comment" ) ); ListView->addColumn( tr( "Field 4" ) ); ListView->addColumn( tr( "Field 5" ) ); ListView->setAllColumnsShowFocus(TRUE); #ifdef DESKTOP ListView->setResizePolicy(QScrollView::AutoOneFit); // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) ); #else ListView->setResizePolicy(QScrollView::AutoOneFit); // ListView->setGeometry( QRect( 0, 22, // this->width(), this->height() - 30 ) ); // ListView->setMaximumSize( QSize( 440, 290 ) ); #endif ListView->setVScrollBarMode( QListView::Auto ); QBoxLayout * l = new QVBoxLayout( this ); l->addWidget (menu); l->addWidget (ListView); #ifndef DESKTOP // start a timer (100 ms) to load the default document docuTimer.start( 100, true ); connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) ); raiseFlag = true; connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); #else // open the default document openDocument(filename); #endif // signals and slots connections for QTollButton connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) ); connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) ); connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) ); connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) ); // signals and slots connections for QListView - connect( ListView, SIGNAL( selectionChanged( QListViewItem* ) ), - this, SLOT( listViewSelected( QListViewItem* ) ) ); - connect( ListView, SIGNAL( doubleClicked( QListViewItem* ) ), - this, SLOT( showInfo( QListViewItem* ) ) ); - connect( ListView, SIGNAL( returnPressed( QListViewItem* ) ), - this, SLOT( showInfo( QListViewItem* ) ) ); + connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), + this, SLOT( listViewSelected(QListViewItem*) ) ); + connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), + this, SLOT( showInfo(QListViewItem*) ) ); + connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), + this, SLOT( showInfo(QListViewItem*) ) ); } const QColor *ZSafe::evenRowColor = &Qt::white; // const QColor *ZSafe::oddRowColor = &Qt::lightGray; const QColor *ZSafe::oddRowColor = new QColor(216,240,255); /* * Destroys the object and frees any allocated resources */ ZSafe::~ZSafe() { // no need to delete child widgets, Qt does it all for us quitMe(); } // load the default document void ZSafe::slotLoadDocu() { openDocument (filename); } void ZSafe::deletePwd() { if (!selectedItem) return; if (!isCategory(selectedItem)) { switch( QMessageBox::information( this, tr("ZSafe"), tr("Do you want to delete?"), tr("&Delete"), tr("D&on't Delete"), 0 // Enter == button 0 ) ) { // Escape == button 2 case 0: // Delete clicked, Alt-S or Enter pressed. // Delete modified = true; selectedItem->parent()->takeItem(selectedItem); selectedItem = NULL; break; case 1: // Don't delete break; } } else { delCategory(); } @@ -2534,98 +2534,98 @@ void ZSafe::quitMe () case 1: // // Save with new password modified = false; saveDocument(filename, TRUE); exitZs (1); break; case 2: // Don't Save clicked or Alt-D pressed // don't save but exitZs exitZs (1); break; } } exitZs (1); } void ZSafe::categoryFieldActivated( const QString& category) { if (categoryDialog) setCategoryDialogFields(categoryDialog, category); } void ZSafe::addCategory() { if (filename.isEmpty()) { QMessageBox::critical( 0, tr("ZSafe"), tr("No document defined.\nYou have to create a new document")); return; } else { // open the 'Category' dialog bool initIcons = false; // open the 'Category' dialog CategoryDialog *dialog; if (categoryDialog) { dialog = categoryDialog; } else { categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); #ifdef WIN32 categoryDialog->setCaption ("Qt " + tr("Category")); #endif dialog = categoryDialog; connect( dialog->CategoryField, - SIGNAL( activated ( const QString &)), - this, SLOT( categoryFieldActivated( const QString & ) ) ); + SIGNAL( activated(const QString&)), + this, SLOT( categoryFieldActivated(const QString&) ) ); initIcons = true; } #ifdef DESKTOP #ifndef WIN32 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); #else // read all categories from the config file and store // into a list QFile f (cfgFile); QStringList list; if ( f.open(IO_ReadOnly) ) { // file opened successfully QTextStream t( &f ); // use a text stream QString s; int n = 1; while ( !t.eof() ) { // until end of file... s = t.readLine(); // line of text excluding '\n' list.append(s); } f.close(); } #endif #else // read all categories from the config file and store // into a list QFile f (cfgFile); QStringList list; if ( f.open(IO_ReadOnly) ) { // file opened successfully QTextStream t( &f ); // use a text stream QString s; while ( !t.eof() ) { // until end of file... s = t.readLine(); // line of text excluding '\n' list.append(s); } f.close(); } #endif QStringList::Iterator it = list.begin(); QString categ; QString firstCategory; dialog->CategoryField->clear(); // remove all items while( it != list.end() ) { QString *cat = new QString (*it); if (cat->contains("-field1", FALSE)) { #ifdef DESKTOP #ifndef WIN32 @@ -2941,98 +2941,98 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) { QString app_key = APP_KEY; #ifndef DESKTOP conf->setGroup ("fieldDefs"); #else #ifndef WIN32 app_key += "/fieldDefs/"; #endif #endif QString category = dialog->CategoryField->currentText(); // #ifndef WIN32 conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); conf->writeEntry(app_key+category+"-field3", dialog->Field3->text()); conf->writeEntry(app_key+category+"-field4", dialog->Field4->text()); conf->writeEntry(app_key+category+"-field5", dialog->Field5->text()); conf->writeEntry(app_key+category+"-field6", dialog->Field6->text()); // #endif saveConf(); #ifndef DESKTOP conf->setGroup ("zsafe"); #endif } void ZSafe::editCategory() { if (!selectedItem) return; if (isCategory(selectedItem)) { QString category = selectedItem->text(0); bool initIcons = false; // open the 'Category' dialog CategoryDialog *dialog; if (categoryDialog) { dialog = categoryDialog; } else { categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); #ifdef WIN32 categoryDialog->setCaption ("Qt " + tr("Category")); #endif dialog = categoryDialog; connect( dialog->CategoryField, - SIGNAL( activated ( const QString &)), - this, SLOT( categoryFieldActivated( const QString & ) ) ); + SIGNAL( activated(const QString&)), + this, SLOT( categoryFieldActivated(const QString&) ) ); initIcons = true; } setCategoryDialogFields(dialog); #ifdef DESKTOP #ifndef WIN32 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); #else // read all categories from the config file and store // into a list QFile f (cfgFile); QStringList list; if ( f.open(IO_ReadOnly) ) { // file opened successfully QTextStream t( &f ); // use a text stream QString s; int n = 1; while ( !t.eof() ) { // until end of file... s = t.readLine(); // line of text excluding '\n' list.append(s); } f.close(); } #endif #else // read all categories from the config file and store // into a list QFile f (cfgFile); QStringList list; if ( f.open(IO_ReadOnly) ) { // file opened successfully QTextStream t( &f ); // use a text stream QString s; while ( !t.eof() ) { // until end of file... s = t.readLine(); // line of text excluding '\n' list.append(s); } f.close(); } #endif QStringList::Iterator it = list.begin(); QString categ; dialog->CategoryField->clear(); // remove all items int i=0; bool foundCategory = false; while( it != list.end() ) { QString *cat = new QString (*it); if (cat->contains("-field1", FALSE)) { diff --git a/noncore/comm/keypebble/krfbcanvas.cpp b/noncore/comm/keypebble/krfbcanvas.cpp index 75cba68..cd1fda0 100644 --- a/noncore/comm/keypebble/krfbcanvas.cpp +++ b/noncore/comm/keypebble/krfbcanvas.cpp @@ -40,99 +40,99 @@ void KRFBCanvas::openConnection(KRFBServer server) void KRFBCanvas::openURL( const QUrl &url ) { if ( loggedIn_ ) { qWarning( "openURL invoked when logged in\n" ); return; } QCString host = url.host().latin1(); int display = url.port(); // connection_->connectTo( host, display ); } void KRFBCanvas::closeConnection() { loggedIn_ = false; connection_->disconnect(); viewport()->setMouseTracking( false ); viewport()->setBackgroundMode( PaletteDark ); setBackgroundMode( PaletteDark ); update(); } void KRFBCanvas::bell() { if ( connection_->options()->deIconify ) { topLevelWidget()->raise(); topLevelWidget()->show(); } } void KRFBCanvas::loggedIn() { qWarning( "Ok, we're logged in" ); // // 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 ) ), + connect( connection_->buffer(), SIGNAL( sizeChanged(int,int) ), this, SLOT( resizeContents(int,int) ) ); - connect( connection_->buffer(), SIGNAL( updated( int, int, int, int ) ), + connect( connection_->buffer(), SIGNAL( updated(int,int,int,int) ), this, SLOT( viewportUpdate(int,int,int,int) ) ); connect( connection_->buffer(), SIGNAL( bell() ), this, SLOT( bell() ) ); connect( qApp->clipboard(), SIGNAL( dataChanged() ), this, SLOT( clipboardChanged() ) ); } void KRFBCanvas::viewportPaintEvent( QPaintEvent *e ) { QRect r = e->rect(); if ( loggedIn_ ) { QPixmap p; bitBlt( viewport(), r.x(), r.y(), connection_->buffer()->pixmap(), r.x() + contentsX(), r.y() + contentsY(), r.width(), r.height() ); } else { QScrollView::viewportPaintEvent( e ); } } void KRFBCanvas::viewportUpdate( int x, int y, int w, int h ) { updateContents( x, y, w, h ); } void KRFBCanvas::contentsMousePressEvent( QMouseEvent *e ) { if (nextDoubleClick) { connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),LeftButton,LeftButton)); connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),LeftButton,0)); connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); } if (nextRightClick) { connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),RightButton,RightButton)); connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),RightButton,0)); connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonPress, e->pos(),NoButton,NoButton)); connection_->buffer()->mouseEvent( &QMouseEvent(QEvent::MouseButtonRelease, e->pos(),NoButton,0)); } else if ( loggedIn_ ) connection_->buffer()->mouseEvent( e ); } diff --git a/noncore/comm/keypebble/krfbconnection.cpp b/noncore/comm/keypebble/krfbconnection.cpp index e6c33c6..b447046 100644 --- a/noncore/comm/keypebble/krfbconnection.cpp +++ b/noncore/comm/keypebble/krfbconnection.cpp @@ -1,158 +1,158 @@ #include <assert.h> #include <qsocket.h> #include <qtimer.h> #include <string.h> #include "krfbconnection.h" #include "krfblogin.h" #include "krfbdecoder.h" #include "krfbbuffer.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; } KRFBConnection::~KRFBConnection() { if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) { disconnectDone(); } delete options_; } 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( error(int) ), SLOT( gotSocketError(int) ) ); connect( sock, SIGNAL( connected() ), SLOT( gotSocketConnection() ) ); qWarning( "Connecting..." ); currentState_ = Connecting; sock->connectToHost( options_->hostname.latin1(), portBase_ + options_->display ); } void KRFBConnection::disconnect() { qWarning( "Disconnecting from server" ); if ( ( currentState_ != Disconnected ) && ( currentState_ != Disconnecting ) && sock ) { currentState_ = Disconnecting; connect( sock, SIGNAL( delayedCloseFinished() ), SLOT( disconnectDone() ) ); sock->close(); if ( sock->state() != QSocket::Closing ) disconnectDone(); } } void KRFBConnection::disconnectDone() { currentState_ = Disconnected; delete sock; sock = 0; minData_ = 0; delete updater; delete decoder_; delete buffer_; emit disconnected(); } void KRFBConnection::gotSocketConnection() { currentState_ = LoggingIn; qWarning( "Connected, logging in..." ); static QString statusMsg = tr( "Connected" ); emit statusChanged( statusMsg ); // Do some login stuff login = new KRFBLogin( this ); } void KRFBConnection::gotRFBConnection() { qWarning( "Logged into server" ); 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_ ); - connect( decoder_, SIGNAL( status( const QString & ) ), - this, SIGNAL( statusChanged( const QString & ) ) ); + connect( decoder_, SIGNAL( status(const QString&) ), + this, SIGNAL( statusChanged(const QString&) ) ); emit loggedIn(); 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 ); 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; break; case QSocket::ErrHostNotFound: msg = host; break; case QSocket::ErrSocketRead: msg = read; break; default: msg = confused; }; QObject::disconnect( sock, SIGNAL( readyRead() ), this, SLOT( gotMoreData() ) ); delete sock; sock = 0; currentState_ = Disconnected; emit error( msg ); } void KRFBConnection::gotMoreData() { diff --git a/noncore/comm/keypebble/krfblogin.cpp b/noncore/comm/keypebble/krfblogin.cpp index 0b4a757..2bbd110 100644 --- a/noncore/comm/keypebble/krfblogin.cpp +++ b/noncore/comm/keypebble/krfblogin.cpp @@ -3,98 +3,98 @@ 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, AuthFailed, AuthTooMany }; typedef unsigned char CARD8; typedef unsigned short CARD16; typedef unsigned long CARD32; const int endianTest = 1; // Endian stuff #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)) 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 & ) ) ); + connect( this, SIGNAL( error(const QString&) ), + con, SIGNAL( error(const QString&) ) ); qWarning( "Waiting for server version..." ); 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" ); 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 ); emit error( msg ); currentState = Error; return; } diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp index c678edf..88cb50b 100644 --- a/noncore/comm/keypebble/kvnc.cpp +++ b/noncore/comm/keypebble/kvnc.cpp @@ -15,102 +15,102 @@ static int u_id = 1; static int get_unique_id() { return u_id++; } /* XPM */ static char * menu_xpm[] = { "12 12 5 1", " c None", ". c #000000", "+ c #FFFDAD", "@ c #FFFF00", "# c #E5E100", " ", " ", " ......... ", " .+++++++. ", " .+@@@@#. ", " .+@@@#. ", " .+@@#. ", " .+@#. ", " .+#. ", " .+. ", " .. ", " "}; const int StatusTextId = 0; KVNC::KVNC( QWidget *parent, const char *name, WFlags f) : QMainWindow( 0, name ,WStyle_ContextHelp) { setCaption( tr("VNC Viewer") ); fullscreen = false; stack = new QWidgetStack( this ); setCentralWidget( stack ); bookmarkSelector=new KVNCBookmarkDlg(); stack->addWidget(bookmarkSelector,get_unique_id()); stack->raiseWidget( bookmarkSelector ); canvas = new KRFBCanvas( stack, "canvas" ); stack->addWidget(canvas,get_unique_id()); setCentralWidget( stack ); - connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem *)), - this, SLOT(openConnection(QListBoxItem *)) ); - connect( canvas->connection(), SIGNAL(statusChanged(const QString &)), - this, SLOT(statusMessage(const QString &)) ); - connect( canvas->connection(), SIGNAL(error(const QString &)), - this, SLOT(error(const QString &)) ); + connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem*)), + this, SLOT(openConnection(QListBoxItem*)) ); + connect( canvas->connection(), SIGNAL(statusChanged(const QString&)), + this, SLOT(statusMessage(const QString&)) ); + connect( canvas->connection(), SIGNAL(error(const QString&)), + this, SLOT(error(const QString&)) ); connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); setupActions(); cornerButton = new QPushButton( this ); cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); canvas->setCornerWidget( cornerButton ); stack->raiseWidget( bookmarkSelector ); bar= new QToolBar( this ); setToolBarsMovable( false ); setRightJustification(false); QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect( n, SIGNAL( activated() ), this, SLOT( newConnection() ) ); n->addTo( bar ); QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); connect( o, SIGNAL( activated() ), this, SLOT( openConnection() ) ); o->addTo( bar ); QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); connect( d, SIGNAL( activated() ), this, SLOT( deleteBookmark() ) ); d->addTo( bar ); } KVNC::~KVNC() { } void KVNC::newConnection() { curServer=new KRFBServer; KVNCConnDlg dlg( curServer,this); diff --git a/noncore/games/bounce/game.cpp b/noncore/games/bounce/game.cpp index c07f453..1f1f8cd 100644 --- a/noncore/games/bounce/game.cpp +++ b/noncore/games/bounce/game.cpp @@ -276,103 +276,103 @@ void JezzView::viewportMouseReleaseEvent( QMouseEvent *ev ) void JezzView::changeCursor() { m_vertical = !m_vertical; if ( m_vertical ) { setCursor( sizeVerCursor ); } else { setCursor( sizeHorCursor ); } } /*************************************************************************/ JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name ) : QWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ), m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false ) { QString path = QPEApplication::qpeDir()+"pics/bounce/"; // load gfx m_ballPixmaps = new QCanvasPixmapArray( path + "ball%1.png", 25 ); for ( unsigned n=0; n < m_ballPixmaps->count(); n++ ) m_ballPixmaps->image(n)->setOffset( 0, 0 ); m_arrowPixmaps = new QCanvasPixmapArray( path + "arrow%1.png", 2 ); for ( unsigned n=0; n < m_arrowPixmaps->count(); n++ ) m_arrowPixmaps->image(n)->setOffset( 0, 0 ); QPixmap tiles( path + "tiles.png" ); // create field m_field = new JezzField( tiles, this, "m_field" ); m_field->resize( TILE_SIZE*FIELD_WIDTH, TILE_SIZE*FIELD_HEIGHT ); for ( int x=0; x<FIELD_WIDTH; x++ ) m_field->setTile( x, 0, TILE_BORDER ); for ( int y=1; y<FIELD_HEIGHT-1; y++ ) { m_field->setTile( 0, y, TILE_BORDER ); for ( int x=1; x<FIELD_WIDTH-1; x++ ) m_field->setTile( x, y, TILE_FREE ); m_field->setTile( FIELD_WIDTH-1, y, TILE_BORDER ); } for ( int x=0; x<FIELD_WIDTH; x++ ) m_field->setTile( x, FIELD_HEIGHT-1, TILE_BORDER ); - connect( m_field, SIGNAL(ballCollision(Ball *, int, int, int)), this, SLOT(ballCollision(Ball *, int, int, int)) ); + connect( m_field, SIGNAL(ballCollision(Ball*,int,int,int)), this, SLOT(ballCollision(Ball*,int,int,int)) ); // create view m_view = new JezzView( m_field, this, "m_view" ); m_view->move( 0, 0 ); m_view->adjustSize(); - connect( m_view, SIGNAL(buildWall(int, int, bool)), this, SLOT(buildWall(int, int, bool)) ); + connect( m_view, SIGNAL(buildWall(int,int,bool)), this, SLOT(buildWall(int,int,bool)) ); // create balls for ( int n=0; n<ballNum; n++ ) { Ball *ball = new Ball( m_ballPixmaps, m_field ); m_balls.append( ball ); ball->setVelocity( ((rand() & 1)*2-1)*2, ((rand() & 1)*2-1)*2 ); ball->setFrame( rand() % 25 ); ball->move( 4*TILE_SIZE + ( rand() - 50 ) % ( (FIELD_WIDTH-8)*TILE_SIZE ), 4*TILE_SIZE + rand() % ( (FIELD_HEIGHT-8)*TILE_SIZE ) ); ball->show(); } // create arrow arrow = new Arrow( m_arrowPixmaps, m_field ); arrow->show(); // create text label m_text = new QCanvasText( m_field ); // create game clock m_clock = new QTimer( this ); connect( m_clock, SIGNAL(timeout()), this, SLOT(tick()) ); m_clock->start( GAME_DELAY ); // setup geometry setFixedSize( m_view->size() ); } 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!!!"); 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(); @@ -480,107 +480,107 @@ void JezzGame::ballCollision( Ball*, int, int, int tile ) // stop walls if ( (tile==TILE_WALLUP || tile==TILE_WALLLEFT) && m_wall1 ) { m_wall1->finish(); m_wall1->fill( false ); delete m_wall1; m_wall1 = 0; } if ( (tile==TILE_WALLDOWN || tile==TILE_WALLRIGHT) && m_wall2 ) { m_wall2->finish(); m_wall2->fill( false ); delete m_wall2; m_wall2 = 0; } // update view m_field->update(); m_view->repaint(); // send death msg emit died(); } } void JezzGame::buildWall( int x, int y, bool vertical ) { if ( !m_running ) return; if ( m_field->tile(x, y)==TILE_FREE ) { // check whether there is a ball at the moment QCanvasItemList cols = m_field->collisions( QRect(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE) ); if ( cols.count()>0 ) { //kdDebug() << "Direct collision" << endl; emit ballCollision( (Ball*)cols.first(), x, y, TILE_WALLUP ); return; } // start walls if ( !m_wall1 ) { m_wall1 = new Wall( m_field, x, y, vertical? Wall::Up : Wall::Left, vertical? TILE_WALLUP : TILE_WALLLEFT, this, "m_wall1" ); - connect( m_wall1, SIGNAL(finished(Wall *, int)), - this, SLOT(wallFinished(Wall *, int)) ); } + connect( m_wall1, SIGNAL(finished(Wall*,int)), + this, SLOT(wallFinished(Wall*,int)) ); } if ( !m_wall2 ) { m_wall2 = new Wall( m_field, x, y, vertical? Wall::Down: Wall::Right, vertical? TILE_WALLDOWN : TILE_WALLRIGHT, this, "m_wall2" ); - connect( m_wall2, SIGNAL(finished(Wall *, int)), - this, SLOT(wallFinished(Wall *, int)) ); + connect( m_wall2, SIGNAL(finished(Wall*,int)), + this, SLOT(wallFinished(Wall*,int)) ); } } } void JezzGame::wallFinished( Wall *wall, int tile ) { if ( tile==TILE_WALLEND ) { if ( m_wall1 ) { m_wall1->fill( false ); delete m_wall1; m_wall1 = 0; } if ( m_wall2 ) { m_wall2->fill( false ); delete m_wall2; m_wall2 = 0; } } else { if ( m_wall1==wall && m_wall1 ) { m_wall1->fill( true ); delete m_wall1; m_wall1 = 0; } if ( m_wall2==wall && m_wall2 ) { m_wall2->fill( true ); delete m_wall2; m_wall2 = 0; } } m_field->update(); m_view->repaint(); makeBlack(); } void JezzGame::tick() { if ( m_running ) { diff --git a/noncore/games/buzzword/buzzword.cpp b/noncore/games/buzzword/buzzword.cpp index 13eb481..b7f2573 100644 --- a/noncore/games/buzzword/buzzword.cpp +++ b/noncore/games/buzzword/buzzword.cpp @@ -66,97 +66,97 @@ void BuzzItem::flip() label->setBackgroundColor(label->colorGroup().highlight()); emit clicked(_row, _column); } BuzzWord::BuzzWord(QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { setCaption(tr("buZzword")); menu = menuBar(); game = new QPopupMenu; game->insertItem(tr("&New game"), this, SLOT(newGame()), Key_N ); menu->insertItem( tr("&Game"), game ); gridVal = 4; grid = NULL; gameOver = false; newGame(); } void BuzzWord::drawGrid() { QStringList l; QString path = QPEApplication::qpeDir()+"share/buzzword/"; QFile f( path + "buzzwords" ); if ( !f.open( IO_ReadOnly ) ) return; QTextStream t( &f ); while (!t.atEnd()) { l << t.readLine(); } f.close(); grid = new QGrid(gridVal, this); // grid->setFixedSize( 480, 480 ); for( int c = 0 ; c < gridVal ; c++ ) { for( int r = 0 ; r < gridVal ; r++ ) { uint pos = rand() % l. count(); QString word = QStringList::split(" ", l[pos]).join("\n"); BuzzItem* bi = new BuzzItem( c, r, word, grid ); - connect( bi, SIGNAL(clicked(int, int)), this, SLOT(clicked(int,int)) ); + connect( bi, SIGNAL(clicked(int,int)), this, SLOT(clicked(int,int)) ); map[c][r] = 0; l.remove( l.at( pos )); } } } void BuzzWord::clicked(int row, int column) { if ( ! gameOver ) { int rowTotal = 0; int columnTotal = 0; map[column][row] = 1; for( int c = 0 ; c < gridVal ; c++ ) { for( int r = 0 ; r < gridVal ; r++ ) { if ( map[c][r] == 1 ) rowTotal++; if ( rowTotal == 4 ) { bingo(); } } rowTotal = 0; } for( int r = 0 ; r < gridVal ; r++ ) { for( int c = 0 ; c < gridVal ; c++ ) { if ( map[c][r] == 1 ) columnTotal++; if ( columnTotal == 4 ) { bingo(); } } columnTotal = 0; } if ( map[0][0] && map[1][1] && map[2][2] && map[3][3] ) bingo(); diff --git a/noncore/games/kpacman/kpacman.cpp b/noncore/games/kpacman/kpacman.cpp index be2e46d..9820e5a 100644 --- a/noncore/games/kpacman/kpacman.cpp +++ b/noncore/games/kpacman/kpacman.cpp @@ -1,85 +1,85 @@ #include "portable.h" #if defined( KDE2_PORT ) #include <kpacman.h> #include <kpacman.moc> #include <kcolordlg.h> #elif defined( QPE_PORT ) #include <qmenubar.h> #include <qpe/config.h> #include <qapplication.h> #include "kpacman.h" #endif Kpacman::Kpacman(QWidget *parent, const char *name) : KTMainWindow(parent, name) { schemesPopup = new QList<QPopupMenu>; schemesPopup->setAutoDelete(TRUE); menu(); m_view = new QWidget( this, "m_view" ); m_view->setBackgroundColor( black ); m_layout = new QGridLayout( m_view ); m_layout->setMargin( 7 ); view = new KpacmanWidget( this, QString(name)+"widget"); m_layout->addWidget( view, 0, 0 ); setCaption( tr("KPacman") ); view->referee->setFocus(); - connect(view->referee, SIGNAL(setScore(int, int)), - view->score, SLOT(setScore(int, int))); + connect(view->referee, SIGNAL(setScore(int,int)), + view->score, SLOT(setScore(int,int))); connect(view->referee, SIGNAL(setPoints(int)), view->score, SLOT(set(int))); connect(view->referee, SIGNAL(setLifes(int)), view->status, SLOT(setLifes(int))); connect(view->referee, SIGNAL(setLevel(int)), view->status, SLOT(setLevel(int))); connect(view->referee, SIGNAL(forcedHallOfFame(bool)), this, SLOT(forcedHallOfFame(bool))); connect(view->referee, SIGNAL(togglePaused()), this, SLOT(togglePaused())); connect(view->referee, SIGNAL(toggleNew()), this, SLOT(toggleNew())); connect(view->score, SIGNAL(toggleNew()), this, SLOT(toggleNew())); connect(view->score, SIGNAL(forcedHallOfFame(bool)), this, SLOT(forcedHallOfFame(bool))); APP_CONFIG_BEGIN( cfg ); focusOutPause = !cfg->readBoolEntry("FocusOutPause", TRUE); focusInContinue = !cfg->readBoolEntry("FocusInContinue", TRUE); hideMouseCursor = !cfg->readBoolEntry("HideMouseCursor", TRUE); APP_CONFIG_END( cfg ); toggleFocusOutPause(); toggleFocusInContinue(); toggleHideMouseCursor(); setCentralWidget( m_view ); } Kpacman::~Kpacman() { /* APP_CONFIG_BEGIN( cfg ); cfg->writeEntry("FocusOutPause", focusOutPause); cfg->writeEntry("FocusInContinue", focusInContinue); cfg->writeEntry("HideMouseCursor", hideMouseCursor); APP_CONFIG_END( cfg ); */ delete _menuBar; } void Kpacman::menu() { gamePopup = new QPopupMenu(); CHECK_PTR( gamePopup ); newID = gamePopup->insertItem(tr("&New"), this, SLOT(newKpacman()),Key_F2); pauseID = gamePopup->insertItem(tr("&Pause"), this, SLOT(pauseKpacman()), Key_F3); hofID = gamePopup->insertItem(tr("&Hall of fame"), this, SLOT(toggleHallOfFame()), Key_F4); diff --git a/noncore/games/oyatzee/oyatzee.cpp b/noncore/games/oyatzee/oyatzee.cpp index 86318db..a55aa73 100644 --- a/noncore/games/oyatzee/oyatzee.cpp +++ b/noncore/games/oyatzee/oyatzee.cpp @@ -1,80 +1,80 @@ #include "oyatzee.h" #include <qmessagebox.h> #include <qpushbutton.h> #include <qpainter.h> #include <qlayout.h> #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 ); lastPlayerFinished = false; currentPlayer = 1; ps.append( new Player( "Carsten" ) ); ps.append( new Player( "Julia" ) ); ps.append( new Player( "Christine" ) ); ps.append( new Player( "Stephan" ) ); QVBoxLayout *vbox = new QVBoxLayout( thing ); sb = new Scoreboard( ps, thing , "sb" ); - connect( sb->pb , SIGNAL( item( int ) ), this , SLOT( slotEndRound( int ) ) ); + 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 ); /* * 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; QValueListInt numbers; Dice *d = dw->diceList.first(); for ( ; d != 0 ; d = dw->diceList.next() ) { numbers.append( d->hasValue() ); } int points = 0; switch ( item ) { case Ones: points = getPoints( 1 , numbers ); break; case Twos: points = getPoints( 2 , numbers ); break; case Threes: points = getPoints( 3 , numbers ); break; case Fours: points = getPoints( 4 , numbers ); break; @@ -601,87 +601,87 @@ 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() ); 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(); } /* * Possibilityboard */ Possibilityboard::Possibilityboard( QWidget *parent , const char* name ) : Board ( parent , name ) { begriffe.append( "1er" ); begriffe.append( "2er" ); begriffe.append( "3er" ); begriffe.append( "4er" ); begriffe.append( "5er" ); begriffe.append( "6er" ); begriffe.append( "Total" ); begriffe.append( "Bonus" ); begriffe.append( "3oaK" ); begriffe.append( "4oaK" ); begriffe.append( "Full House" ); begriffe.append( "Short S" ); begriffe.append( "Long S" ); begriffe.append( "Yatzee!" ); begriffe.append( "Chance" ); begriffe.append( "Score" ); - connect( this , SIGNAL( clicked( QPoint ) ), this , SLOT( slotClicked( QPoint ) ) ); + connect( this , SIGNAL( clicked(QPoint) ), this , SLOT( slotClicked(QPoint) ) ); } void Possibilityboard::slotClicked( QPoint p) { emit item( p.y()/(this->height()/17) ); } void Possibilityboard::paintEvent( QPaintEvent* ) { QPainter p; p.begin( this ); const int cell_width = this->width(); const int cell_height = this->height()/17; p.setBrush( Qt::blue ); QValueListInt::Iterator listIt = list.begin(); for ( ; listIt != list.end() ; ++listIt ) { p.drawRect( 0 , (*listIt) * cell_height , cell_width , cell_height ); } p.setBrush( Qt::black ); p.setBrush( Qt::NoBrush ); QStringList::Iterator begriffeIt = begriffe.begin(); for ( int i = 1 ; i < 18 ; ++i ) { p.drawText( 0 , i*cell_height , cell_width , cell_height , Qt::AlignCenter , *begriffeIt ); ++begriffeIt; } } void Possibilityboard::setIntlist( QValueListInt &l ) { list = l; } diff --git a/noncore/multimedia/camera/gui/mainwindow.cpp b/noncore/multimedia/camera/gui/mainwindow.cpp index 2f42049..e4e1b6c 100644 --- a/noncore/multimedia/camera/gui/mainwindow.cpp +++ b/noncore/multimedia/camera/gui/mainwindow.cpp @@ -53,98 +53,98 @@ using namespace Opie; #include <assert.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> #include <errno.h> #include <unistd.h> #define CAPTUREFILE "/tmp/capture.dat" #define OUTPUTFILE "/tmp/output.avi" #define OUTPUT_TO_CUSTOM 250 #define OUTPUT_TO_DOCFOLDER 251 CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) :QMainWindow( parent, name, f ), _rotation( 270 ), // FIXME: get this from current settings (ODevice?) _capturing( false ), _pics( 1 ), _videos( 1 ) { #ifdef QT_NO_DEBUG if ( !ZCameraIO::instance()->isOpen() ) { QVBox* v = new QVBox( this ); v->setMargin( 10 ); QLabel* l1 = new QLabel( v ); l1->setPixmap( Resource::loadPixmap( "camera/error" ) ); QLabel* l2 = new QLabel( v ); l2->setText( "<b>Sorry. could not detect your camera :-(</b><p>" "* Is the sharpzdc_cs module loaded ?<br>" "* Is /dev/sharpzdc read/writable ?<p>" ); connect( new QPushButton( "Exit", v ), SIGNAL( clicked() ), this, SLOT( close() ) ); setCentralWidget( v ); return; } #endif init(); _rotation = 270; //TODO: grab these from the actual settings preview = new PreviewWidget( this, "camera preview widget" ); //setCentralWidget( preview ); <--- don't do this! preview->resize( QSize( 240, 288 ) ); preview->show(); // construct a System Channel to receive setRotation messages _sysChannel = new QCopChannel( "QPE/System", this ); - connect( _sysChannel, SIGNAL( received( const QCString&, const QByteArray& ) ), - this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); + connect( _sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), + this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); connect( preview, SIGNAL( contextMenuRequested() ), this, SLOT( showContextMenu() ) ); connect( ZCameraIO::instance(), SIGNAL( shutterClicked() ), this, SLOT( shutterClicked() ) ); updateCaption(); }; CameraMainWindow::~CameraMainWindow() { // write back configuration OConfigGroupSaver cgs( oApp->config(), "General" ); cgs.config()->writeEntry( "flip", flip ); cgs.config()->writeEntry( "quality", quality ); cgs.config()->writeEntry( "zoom", zoom ); cgs.config()->writeEntry( "captureX", captureX ); cgs.config()->writeEntry( "captureY", captureY ); cgs.config()->writeEntry( "captureFormat", captureFormat ); cgs.config()->writeEntry( "outputTo", outputTo ); cgs.config()->writeEntry( "prefix", prefix ); cgs.config()->writeEntry( "appendSettings", appendSettings ); } void CameraMainWindow::init() { // get values from configuration OConfigGroupSaver cgs( oApp->config(), "General" ); flip = cgs.config()->readEntry( "flip", "A" ); quality = cgs.config()->readNumEntry( "quality", 50 ); zoom = cgs.config()->readNumEntry( "zoom", 1 ); captureX = cgs.config()->readNumEntry( "captureX", 480 ); captureY = cgs.config()->readNumEntry( "captureY", 640 ); captureFormat = cgs.config()->readEntry( "captureFormat", "JPEG" ); outputTo = cgs.config()->readEntry( "outputTo", "Documents Folder" ); prefix = cgs.config()->readEntry( "prefix", "Untitled" ); appendSettings = cgs.config()->readBoolEntry( "appendSettings", true ); // create action groups QAction* a; resog = new QActionGroup( 0, "reso", true ); resog->setToggleAction( true ); new QAction( " 64 x 48", 0, 0, resog, "64x48", true ); new QAction( "128 x 96", 0, 0, resog, "128x96", true ); new QAction( "192 x 144", 0, 0, resog, "192x144", true ); new QAction( "256 x 192", 0, 0, resog, "256x192", true ); diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 870b4f3..f3eafab 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -34,97 +34,97 @@ #include "audiowidget.h" #include "mediaplayerstate.h" #include "playlistwidget.h" #include <qpe/qpeapplication.h> namespace { const int xo = -2; // movable x offset const int yo = 22; // movable y offset const MediaWidget::SkinButtonInfo skinInfo[] = { { MediaWidget::Play, "play", MediaWidget::ToggleButton }, { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, { MediaWidget::Next, "next", MediaWidget::NormalButton }, { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, { MediaWidget::Back, "back", MediaWidget::NormalButton } }; const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); void changeTextColor( QWidget * w) { QPalette p = w->palette(); p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); w->setPalette( p ); } } AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), audioSliderBeingMoved( false ) { setCaption( tr("OpiePlayer") ); loadSkin(); connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); - connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); + connect( &mediaPlayerState, SIGNAL( isSeekableToggled(bool) ), this, SLOT( setSeekable(bool) ) ); connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); // Intialise state setLength( mediaPlayerState.length() ); setPosition( mediaPlayerState.position() ); setLooping( mediaPlayerState.isFullscreen() ); // setPaused( mediaPlayerState->paused() ); setPlaying( mediaPlayerState.isPlaying() ); } AudioWidget::~AudioWidget() { // mediaPlayerState->setPlaying(false); } MediaWidget::GUIInfo AudioWidget::guiInfo() { return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount ); } void AudioWidget::resizeEvent( QResizeEvent *e ) { int h = height(); int w = width(); songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); slider.setFixedWidth( w - 110 ); slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); slider.setBackgroundOrigin( QWidget::ParentOrigin ); time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; MediaWidget::resizeEvent( e ); } void AudioWidget::sliderPressed() { audioSliderBeingMoved = TRUE; } void AudioWidget::sliderReleased() { audioSliderBeingMoved = FALSE; if ( slider.width() == 0 ) diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 9f51006..1e6bc4d 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -1,93 +1,93 @@ #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <qfileinfo.h> #include "mediaplayer.h" #include "playlistwidget.h" #include "audiowidget.h" #include "videowidget.h" #include "volumecontrol.h" #include "lib.h" #include "mediaplayerstate.h" // for setBacklight() #include <linux/fb.h> #include <sys/file.h> #include <sys/ioctl.h> #define FBIOBLANK 0x4611 MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { m_audioUI = 0; m_videoUI = 0; m_xineControl = 0; xine = new XINE::Lib( XINE::Lib::InitializeInThread ); fd=-1;fl=-1; playList.setCaption( tr( "OpiePlayer: Initializating" ) ); qApp->processEvents(); // QPEApplication::grabKeyboard(); // EVIL connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); - connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); + connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); // What is pauseCheck good for? (Simon) -// connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); +// connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) ); connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); - connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); + connect( &mediaPlayerState, SIGNAL( blankToggled(bool) ), this, SLOT ( blank(bool) ) ); volControl = new VolumeControl; Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); m_skinLoader = new SkinLoader; m_skinLoader->schedule( AudioWidget::guiInfo() ); m_skinLoader->schedule( VideoWidget::guiInfo() ); m_skinLoader->start(); } MediaPlayer::~MediaPlayer() { // this shold never happen, but one never knows... if ( xine ) { xine->ensureInitialized(); delete xine; } delete m_xineControl; delete m_audioUI; delete m_videoUI; delete volControl; } void MediaPlayer::pauseCheck( bool b ) { if ( b && !mediaPlayerState.isPlaying() ) { mediaPlayerState.setPaused( FALSE ); } } void MediaPlayer::play() { mediaPlayerState.setPlaying( FALSE ); mediaPlayerState.setPlaying( TRUE ); } void MediaPlayer::setPlaying( bool play ) { if ( !play ) { return; } if ( mediaPlayerState.isPaused() ) { mediaPlayerState.setPaused( FALSE ); return; } QString tickerText, time, fileName; if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index f193001..08c62a2 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp @@ -1,85 +1,85 @@ /* Copyright (C) 2002 Simon Hausmann <simon@lst.de> (C) 2002 Max Reiss <harlekin@handhelds.org> (C) 2002 L. Potter <ljp@llornkcor.com> (C) 2002 Holger Freyther <zecke@handhelds.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <assert.h> #include "mediawidget.h" #include "playlistwidget.h" #include "skin.h" MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { - connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), - this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); - connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), - this, SLOT( setLength( long ) ) ); - connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), - this, SLOT( setPlaying( bool ) ) ); + connect( &mediaPlayerState, SIGNAL( displayTypeChanged(MediaPlayerState::DisplayType) ), + this, SLOT( setDisplayType(MediaPlayerState::DisplayType) ) ); + connect( &mediaPlayerState, SIGNAL( lengthChanged(long) ), + this, SLOT( setLength(long) ) ); + connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), + this, SLOT( setPlaying(bool) ) ); setBackgroundMode( NoBackground ); } MediaWidget::~MediaWidget() { } void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) { buttonMask = skin.buttonMask( skinInfo, buttonCount ); buttons.clear(); buttons.reserve( buttonCount ); for ( uint i = 0; i < buttonCount; ++i ) { Button button = setupButton( skinInfo[ i ], skin ); buttons.push_back( button ); } } MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) { Button button; button.command = buttonInfo.command; button.type = buttonInfo.type; button.mask = skin.buttonMaskImage( buttonInfo.fileName ); return button; } void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) { Skin skin( guiInfo.fileNameInfix ); skin.setCachable( false ); loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); } void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) { backgroundPixmap = skin.backgroundPixmap(); buttonUpImage = skin.buttonUpImage(); buttonDownImage = skin.buttonDownImage(); setupButtons( skinInfo, buttonCount, skin ); } diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 9a9e1ec..0a84268 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -18,184 +18,184 @@ + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this 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 <qtoolbar.h> #include <opie/ofiledialog.h> #include <qmessagebox.h> #include "playlistselection.h" #include "playlistwidget.h" #include "mediaplayer.h" #include "mediaplayerstate.h" #include "inputDialog.h" #include "om3u.h" #include "playlistfileview.h" //only needed for the random play #include <assert.h> PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl ) : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 ) { mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" ); m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer"); d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", this , SLOT(addSelected() ) ); d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", this , SLOT(removeSelected() ) ); d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", - this , SLOT( btnPlay( bool) ), TRUE ); + this , SLOT( btnPlay(bool) ), TRUE ); d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", - mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); + mediaPlayerState, SLOT( setShuffled(bool) ), TRUE ); d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", - mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); + mediaPlayerState, SLOT( setLooping(bool) ), TRUE ); (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); pmPlayList->insertSeparator(-1); (void)new MenuItem( pmPlayList, tr( "Add File" ), this,SLOT( openFile() ) ); (void)new MenuItem( pmPlayList, tr("Add URL"), this,SLOT( openURL() ) ); pmPlayList->insertSeparator(-1); (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), this, SLOT(writem3u() ) ); pmPlayList->insertSeparator(-1); (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), audioView, SLOT( scanFiles() ) ); (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), videoView, SLOT( scanFiles() ) ); pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); Config cfg( "OpiePlayer" ); bool b= cfg.readBoolEntry("FullScreen", 0); mediaPlayerState->setFullscreen( b ); pmView->setItemChecked( -16, b ); (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp() ) ); (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected() ) ); (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown() ) ); QVBox *stretch2 = new QVBox( vbox1 ); connect( tbDeletePlaylist, ( SIGNAL( released() ) ), SLOT( deletePlaylist() ) ); - connect( pmView, SIGNAL( activated( int ) ), - this, SLOT( pmViewActivated( int ) ) ); - connect( skinsMenu, SIGNAL( activated( int ) ) , - this, SLOT( skinsMenuActivated( int ) ) ); - connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), - this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); - connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), - this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); - connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), - this,SLOT( playIt( QListViewItem *) ) ); - connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), - this, SLOT( addToSelection( QListViewItem *) ) ); - connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), - this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); - connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), - this,SLOT( playIt( QListViewItem *) ) ); - connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), - this, SLOT( addToSelection( QListViewItem *) ) ); - connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), - this, SLOT( loadList( const DocLnk & ) ) ); + connect( pmView, SIGNAL( activated(int) ), + this, SLOT( pmViewActivated(int) ) ); + connect( skinsMenu, SIGNAL( activated(int) ) , + this, SLOT( skinsMenuActivated(int) ) ); + connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), + this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int) ) ); + connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), + this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); + connect( audioView, SIGNAL( returnPressed(QListViewItem*) ), + this,SLOT( playIt(QListViewItem*) ) ); + connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ), + this, SLOT( addToSelection(QListViewItem*) ) ); + connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), + this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); + connect( videoView, SIGNAL( returnPressed(QListViewItem*) ), + this,SLOT( playIt(QListViewItem*) ) ); + connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ), + this, SLOT( addToSelection(QListViewItem*) ) ); + connect( playLists, SIGNAL( fileSelected(const DocLnk&) ), + this, SLOT( loadList(const DocLnk&) ) ); connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), - this, SLOT( tabChanged( QWidget* ) ) ); - connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), - d->tbPlay, SLOT( setOn( bool ) ) ); - connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), - d->tbLoop, SLOT( setOn( bool ) ) ); - connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), - d->tbShuffle, SLOT( setOn( bool ) ) ); - connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), - this, SLOT( playIt( QListViewItem *) ) ); - connect ( gammaSlider, SIGNAL( valueChanged( int ) ), - mediaPlayerState, SLOT( setVideoGamma( int ) ) ); + this, SLOT( tabChanged(QWidget*) ) ); + connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), + d->tbPlay, SLOT( setOn(bool) ) ); + connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), + d->tbLoop, SLOT( setOn(bool) ) ); + connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ), + d->tbShuffle, SLOT( setOn(bool) ) ); + connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ), + this, SLOT( playIt(QListViewItem*) ) ); + connect ( gammaSlider, SIGNAL( valueChanged(int) ), + mediaPlayerState, SLOT( setVideoGamma(int) ) ); connect( this, SIGNAL(skinSelected() ), m_mp, SLOT( reloadSkins() ) ); // see which skins are installed populateSkinsMenu(); initializeStates(); channel = new QCopChannel( "QPE/Application/opieplayer2", this ); - connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); + connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); loadList(DocLnk( currentPlaylist ) ); tabWidget->showPage( playListTab ); } PlayListWidget::~PlayListWidget() { delete d; delete m_mp; } void PlayListWidget::initializeStates() { d->tbPlay->setOn( mediaPlayerState->isPlaying() ); d->tbLoop->setOn( mediaPlayerState->isLooping() ); 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>>>>>>>>>>>>>>>>>>>"); if( d->selectedFiles->first() ) { m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); do { // qDebug(d->selectedFiles->current()->file()); m3uList->add( d->selectedFiles->current()->file() ); } while ( d->selectedFiles->next() ); m3uList->write(); m3uList->close(); delete m3uList; } } } @@ -458,144 +458,144 @@ void PlayListWidget::addSelected() { d->selectedFiles->addToSelection( lnk ); } currentFileListView->clearSelection(); writeCurrentM3u(); } void PlayListWidget::removeSelected() { d->selectedFiles->removeSelected( ); writeCurrentM3u(); } void PlayListWidget::playIt( QListViewItem *it) { if(!it) return; mediaPlayerState->setPlaying(FALSE); mediaPlayerState->setPlaying(TRUE); d->selectedFiles->unSelect(); } void PlayListWidget::addToSelection( QListViewItem *it) { d->setDocumentUsed = FALSE; if(it) { if ( currentTab() == CurrentPlayList ) return; DocLnk lnk; QString filename; filename=it->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); writeCurrentM3u(); // tabWidget->setCurrentPage(0); } } void PlayListWidget::tabChanged(QWidget *) { d->tbPlay->setEnabled( true ); - disconnect( audioView, SIGNAL( itemsSelected( bool ) ), - d->tbPlay, SLOT( setEnabled( bool ) ) ); - disconnect( videoView, SIGNAL( itemsSelected( bool ) ), - d->tbPlay, SLOT( setEnabled( bool ) ) ); + disconnect( audioView, SIGNAL( itemsSelected(bool) ), + d->tbPlay, SLOT( setEnabled(bool) ) ); + disconnect( videoView, SIGNAL( itemsSelected(bool) ), + d->tbPlay, SLOT( setEnabled(bool) ) ); currentFileListView = 0; switch ( currentTab() ) { case CurrentPlayList: { if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); } d->tbRemoveFromList->setEnabled(TRUE); d->tbAddToList->setEnabled(FALSE); d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() ); } break; case AudioFiles: { audioView->populateView(); if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); } d->tbRemoveFromList->setEnabled(FALSE); d->tbAddToList->setEnabled(TRUE); - connect( audioView, SIGNAL( itemsSelected( bool ) ), - d->tbPlay, SLOT( setEnabled( bool ) ) ); + connect( audioView, SIGNAL( itemsSelected(bool) ), + d->tbPlay, SLOT( setEnabled(bool) ) ); d->tbPlay->setEnabled( audioView->hasSelection() ); currentFileListView = audioView; } break; case VideoFiles: { videoView->populateView(); if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); } d->tbRemoveFromList->setEnabled(FALSE); d->tbAddToList->setEnabled(TRUE); - connect( videoView, SIGNAL( itemsSelected( bool ) ), - d->tbPlay, SLOT( setEnabled( bool ) ) ); + connect( videoView, SIGNAL( itemsSelected(bool) ), + d->tbPlay, SLOT( setEnabled(bool) ) ); d->tbPlay->setEnabled( videoView->hasSelection() ); currentFileListView = videoView; } break; case PlayLists: { if( tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->show(); } playLists->reread(); d->tbAddToList->setEnabled(FALSE); d->tbPlay->setEnabled( false ); } break; }; } void PlayListWidget::btnPlay(bool b) { // mediaPlayerState->setPlaying(false); mediaPlayerState->setPlaying(b); insanityBool=FALSE; } void PlayListWidget::deletePlaylist() { switch( QMessageBox::information( this, (tr("Remove Playlist?")), (tr("You really want to delete\nthis playlist?")), (tr("Yes")), (tr("No")), 0 )){ case 0: // Yes clicked, QFile().remove(playLists->selectedDocument().file()); QFile().remove(playLists->selectedDocument().linkFile()); playLists->reread(); break; case 1: // Cancel break; }; } void PlayListWidget::playSelected() { btnPlay( TRUE); } bool PlayListWidget::inFileListMode() const { diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index fec91ea..33fe188 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp @@ -56,97 +56,97 @@ PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name ) setToolBarsMovable( FALSE ); // Create Toolbar QToolBar *toolbar = new QToolBar( this ); toolbar->setHorizontalStretchable( TRUE ); // Create Menubar QMenuBar *menu = new QMenuBar( toolbar ); menu->setMargin( 0 ); bar = new QToolBar( this ); bar->setLabel( tr( "Play Operations" ) ); tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); tbDeletePlaylist->setFlat( TRUE ); tbDeletePlaylist->setFixedSize( 20, 20 ); tbDeletePlaylist->hide(); pmPlayList = new QPopupMenu( this ); menu->insertItem( tr( "File" ), pmPlayList ); pmView = new QPopupMenu( this ); menu->insertItem( tr( "View" ), pmView ); pmView->isCheckable(); skinsMenu = new QPopupMenu( this ); pmView->insertItem( tr( "Skins" ), skinsMenu ); skinsMenu->isCheckable(); gammaMenu = new QPopupMenu( this ); pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); gammaSlider->setRange( -40, 40 ); gammaSlider->setTickmarks( QSlider::Left ); gammaSlider->setTickInterval( 20 ); gammaSlider->setFocusPolicy( QWidget::StrongFocus ); gammaSlider->setValue( 0 ); gammaSlider->setMinimumHeight( 50 ); gammaLCD = new QLCDNumber( 3, gammaMenu ); gammaLCD-> setFrameShape ( QFrame::NoFrame ); gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); gammaMenu->insertItem( gammaSlider ); gammaMenu->insertItem( gammaLCD ); - connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); + connect( gammaSlider, SIGNAL( valueChanged(int) ), gammaLCD, SLOT( display(int) ) ); vbox5 = new QVBox( this ); QVBox *vbox4 = new QVBox( vbox5 ); QHBox *hbox6 = new QHBox( vbox4 ); tabWidget = new QTabWidget( hbox6, "tabWidget" ); playListTab = new QWidget( tabWidget, "PlayListTab" ); tabWidget->insertTab( playListTab, "Playlist"); QGridLayout *Playout = new QGridLayout( playListTab ); Playout->setSpacing( 2); Playout->setMargin( 2); // Add the playlist area QVBox *vbox3 = new QVBox( playListTab ); d->playListFrame = vbox3; QHBox *hbox2 = new QHBox( vbox3 ); d->selectedFiles = new PlayListSelection( hbox2 ); vbox1 = new QVBox( hbox2 ); QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); QVBox *stretch1 = new QVBox( vbox1 ); // add stretch Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); QWidget *aTab; aTab = new QWidget( tabWidget, "aTab" ); QGridLayout *Alayout = new QGridLayout( aTab ); Alayout->setSpacing( 2 ); Alayout->setMargin( 2 ); // no m3u's here please audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" ); Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); tabWidget->insertTab( aTab, tr( "Audio" ) ); QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); QWidget *vTab; vTab = new QWidget( tabWidget, "vTab" ); QGridLayout *Vlayout = new QGridLayout( vTab ); Vlayout->setSpacing( 2 ); Vlayout->setMargin( 2 ); videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" ); Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); diff --git a/noncore/multimedia/opieplayer2/threadutil.cpp b/noncore/multimedia/opieplayer2/threadutil.cpp index ff38b1e..fb951b4 100644 --- a/noncore/multimedia/opieplayer2/threadutil.cpp +++ b/noncore/multimedia/opieplayer2/threadutil.cpp @@ -195,97 +195,97 @@ void Thread::start() 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 ) ); pthread_attr_destroy( &attributes ); return; } pthread_attr_destroy( &attributes ); } void Thread::terminate() { AutoLock lock( d->guard ); if ( !d->isRunning ) return; pthread_cancel( d->self ); } bool Thread::wait() { AutoLock lock( d->guard ); if ( !d->isRunning ) return true; return d->finishCondition.wait( d->guard ); } bool Thread::isRunning() const { AutoLock lock( d->guard ); return d->isRunning; } void Thread::exit() { pthread_exit( 0 ); } OnewayNotifier::OnewayNotifier() { int fds[ 2 ]; pipe( fds ); m_readFd = fds[ 0 ]; m_writeFd = fds[ 1 ]; m_notifier = new QSocketNotifier( m_readFd, QSocketNotifier::Read ); - connect( m_notifier, SIGNAL( activated( int ) ), + connect( m_notifier, SIGNAL( activated(int) ), this, SLOT( wakeUp() ) ); } OnewayNotifier::~OnewayNotifier() { delete m_notifier; ::close( m_readFd ); ::close( m_writeFd ); } void OnewayNotifier::notify() { const char c = 42; ::write( m_writeFd, &c, 1 ); } void OnewayNotifier::wakeUp() { char c = 0; if ( ::read( m_readFd, &c, 1 ) != 1 ) return; emit awake(); } ChannelMessage::ChannelMessage( int type ) : m_type( type ), m_isCall( false ), m_replied( false ), m_inEventHandler( false ) { } ChannelMessage::~ChannelMessage() { if ( m_guard.isLocked() ) m_guard.unlock(); } void ChannelMessage::reply() { if ( !m_isCall ) { qDebug( "ChannelMessage::reply() - can't reply oneway message!" ); return; } if ( m_inEventHandler ) diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index c829e03..a4d09f5 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -26,98 +26,98 @@ -_. . . )=. = 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 "videowidget.h" #include "mediaplayerstate.h" #include "playlistwidget.h" #ifdef Q_WS_QWS # define USE_DIRECT_PAINTER # include <qdirectpainter_qws.h> # include <qgfxraster_qws.h> #endif namespace { const int xo = 2; // movable x offset const int yo = 0; // movable y offset const MediaWidget::SkinButtonInfo skinInfo[] = { { MediaWidget::Play, "play", MediaWidget::ToggleButton }, { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, { MediaWidget::Next, "fwd", MediaWidget::NormalButton }, { MediaWidget::Previous, "back", MediaWidget::NormalButton }, { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton } }; const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); } VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false ) { setCaption( tr("OpiePlayer - Video") ); videoFrame = new XineVideoWidget ( this, "Video frame" ); - connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); - connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); + connect ( videoFrame, SIGNAL( videoResized(const QSize&)), this, SIGNAL( videoResized(const QSize&))); + connect ( videoFrame, SIGNAL( clicked() ), this, SLOT ( backToNormal() ) ); slider = 0; loadSkin(); setLength( mediaPlayerState.length() ); setPosition( mediaPlayerState.position() ); setFullscreen( mediaPlayerState.isFullscreen() ); setPlaying( mediaPlayerState.isPlaying() ); } VideoWidget::~VideoWidget() { } MediaWidget::GUIInfo VideoWidget::guiInfo() { return GUIInfo( "V" /* infix */, ::skinInfo, ::buttonCount ); } void VideoWidget::resizeEvent( QResizeEvent *e ) { int h = height(); int w = width(); //int Vh = 160; //int Vw = 220; slider->setFixedWidth( w - 20 ); slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); slider->setBackgroundOrigin( QWidget::ParentOrigin ); slider->setFocusPolicy( QWidget::NoFocus ); slider->setBackgroundPixmap( backgroundPixmap ); upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; if(w>h) upperLeftOfButtonMask.ry() = 0; else upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; MediaWidget::resizeEvent( e ); } void VideoWidget::sliderPressed() { videoSliderBeingMoved = TRUE; } void VideoWidget::sliderReleased() { videoSliderBeingMoved = FALSE; diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index a392f4a..70f2ffd 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -20,104 +20,104 @@ =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this 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 <qtimer.h> #include <qmessagebox.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include "xinecontrol.h" #include "mediaplayerstate.h" #include "xinevideowidget.h" XineControl::XineControl( XineVideoWidget *xineWidget, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) { libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); init(); } XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) { xine->ensureInitialized(); xine->setWidget( xineWidget ); init(); } void XineControl::init() { - connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); - connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); - connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); - connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); - connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); - connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); + connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); + connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) ); + connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) ); + connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) ); + connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) ); + connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) ); connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); - connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); + connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) ); disabledSuspendScreenSaver = FALSE; } XineControl::~XineControl() { #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( disabledSuspendScreenSaver ) { disabledSuspendScreenSaver = FALSE; // Re-enable the suspend mode 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 + ">>>>"); 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"); libXine->setShowVideo( false ); hasAudioChannel = TRUE; } else { displayType = MediaPlayerState::Video; qDebug("HAS VIDEO"); libXine->setShowVideo( true ); hasVideoChannel = TRUE; } // determine if slider is shown mediaPlayerState.setIsSeekable( libXine->isSeekable() ); // which gui (video / audio) mediaPlayerState.setDisplayType( displayType ); diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 0a6e5ae..f2035ef 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp @@ -716,130 +716,130 @@ void QtRec::initIconView() { 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); 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(); fileS = cfg.readEntry( filePath, "0" );// file length in seconds mediaLocation = getStorage( filePath); if( info.exists()) { item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate); item->setPixmap( 0, image0); if( currentFileName == filePath) ListView1->setSelected( item, true); } } } void QtRec::initConnections() { connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); connect( toBeginningButton, SIGNAL( pressed()), this, SLOT( rewindPressed() )); connect( toBeginningButton, SIGNAL( released()), this, SLOT( rewindReleased() )); connect( toEndButton, SIGNAL( pressed()), this, SLOT( FastforwardPressed() )); connect( toEndButton, SIGNAL( released()), this, SLOT( FastforwardReleased() )); connect( deleteSoundButton, SIGNAL(released()), this, SLOT( deleteSound() )); connect( Stop_PushButton, SIGNAL(released()), this, SLOT( doPlayBtn() )); connect( Rec_PushButton, SIGNAL(released()), this, SLOT( newSound() ) ); - connect( TabWidget, SIGNAL( currentChanged( QWidget*)), + connect( TabWidget, SIGNAL( currentChanged(QWidget*)), this, SLOT(thisTab(QWidget*) )); connect( OutputSlider, SIGNAL(sliderReleased()), this, SLOT( changedOutVolume()) ); connect( InputSlider, SIGNAL(sliderReleased()), this, SLOT( changedInVolume()) ); - connect( sampleRateComboBox, SIGNAL(activated( int)), + connect( sampleRateComboBox, SIGNAL(activated(int)), this, SLOT( changesamplerateCombo(int)) ); - connect( bitRateComboBox, SIGNAL(activated( int)), + connect( bitRateComboBox, SIGNAL(activated(int)), this, SLOT( changebitrateCombo(int)) ); - connect( directoryComboBox, SIGNAL(activated( int)), + connect( directoryComboBox, SIGNAL(activated(int)), this, SLOT( changeDirCombo(int)) ); - connect( sizeLimitCombo, SIGNAL(activated( int)), + connect( sizeLimitCombo, SIGNAL(activated(int)), this, SLOT( changeSizeLimitCombo(int)) ); - connect( stereoCheckBox, SIGNAL(toggled( bool)), + connect( stereoCheckBox, SIGNAL(toggled(bool)), this, SLOT( changeStereoCheck(bool)) ); - connect( outMuteCheckBox, SIGNAL(toggled( bool)), + connect( outMuteCheckBox, SIGNAL(toggled(bool)), this, SLOT( doVolMuting(bool)) ); - connect( inMuteCheckBox , SIGNAL(toggled( bool)), + connect( inMuteCheckBox , SIGNAL(toggled(bool)), this, SLOT( doMicMuting(bool)) ); - connect( ListView1,SIGNAL(doubleClicked( QListViewItem*)), + connect( ListView1,SIGNAL(doubleClicked(QListViewItem*)), this,SLOT( itClick(QListViewItem*))); - connect( ListView1, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), - this,SLOT( listPressed(int, QListViewItem *, const QPoint&, int)) ); - connect( timeSlider, SIGNAL( sliderMoved( int)), + connect( ListView1, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), + this,SLOT( listPressed(int,QListViewItem*,const QPoint&,int)) ); + connect( timeSlider, SIGNAL( sliderMoved(int)), this, SLOT( changeTimeSlider(int) )); - connect( timeSlider, SIGNAL( sliderPressed( )), + connect( timeSlider, SIGNAL( sliderPressed()), this, SLOT( timeSliderPressed() )); - connect( timeSlider, SIGNAL( sliderReleased( )), + connect( timeSlider, SIGNAL( sliderReleased()), this, SLOT( timeSliderReleased() )); connect( compressionCheckBox, SIGNAL( toggled(bool)), this, SLOT( compressionSelected(bool))); connect( autoMuteCheckBox, SIGNAL( toggled(bool)), this, SLOT( slotAutoMute(bool))); } void QtRec::initConfig() { int index, fred, i; Config cfg("OpieRec"); cfg.setGroup("Settings"); index = cfg.readNumEntry("samplerate",22050); bool ok; for(int ws=0;ws<sampleRateComboBox->count();ws++) { fred = sampleRateComboBox->text(ws).toInt(&ok, 10); if( index == fred) { filePara.sampleRate = fred; sampleRateComboBox->setCurrentItem(ws); } } i = cfg.readNumEntry("bitrate",16); if(i == 16) bitRateComboBox->setCurrentItem( 1); else if(i == 24) bitRateComboBox->setCurrentItem( 2); else if(i == 32) bitRateComboBox->setCurrentItem( 3); else bitRateComboBox->setCurrentItem( 0); filePara.resolution = i; i = cfg.readNumEntry("sizeLimit", 5 ); QString temp; sizeLimitCombo->setCurrentItem((i/5)); stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1)); if( stereoCheckBox->isChecked()) { filePara.channels = 2; } else { filePara.channels = 1; } compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1)); if( compressionCheckBox->isChecked()) { @@ -1611,97 +1611,97 @@ void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) { } break; case 2: showListMenu(item); ListView1->clearSelection(); break; }; } void QtRec::showListMenu(QListViewItem * item) { if(item == NULL) return; QPopupMenu *m = new QPopupMenu(this); m->insertItem( tr("Play"), this, SLOT( doMenuPlay() )); if(Ir::supported()) m->insertItem( tr( "Send with Ir" ), this, SLOT( doBeam() )); m->insertItem( tr( "Rename" ), this, SLOT( doRename() )); // #if defined (QTOPIA_INTERNAL_FSLP) // m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); // #endif m->insertSeparator(); m->insertItem( tr("Delete"), this, SLOT( deleteSound() ) ); m->exec( QCursor::pos() ); qApp->processEvents(); } void QtRec::fileBeamFinished( Ir *ir) { if(ir) QMessageBox::message( tr("Ir Beam out"), tr("Ir sent.") ,tr("Ok") ); } void QtRec::doBeam() { qApp->processEvents(); if( ListView1->currentItem() == NULL) return; Ir ir; if( ir.supported()) { QString file = ListView1->currentItem()->text(0); Config cfg("OpieRec"); cfg.setGroup("Sounds"); int nFiles = cfg.readNumEntry("NumberofFiles",0); for(int i=0;i<nFiles+1;i++) { if( cfg.readEntry( QString::number( i),"").find( file, 0, true) != -1) { QString filePath = cfg.readEntry(file,""); Ir *file = new Ir(this, "IR"); connect( file, SIGNAL( done(Ir*)), - this, SLOT( fileBeamFinished( Ir * ))); + this, SLOT( fileBeamFinished(Ir*))); file->send( filePath, "OPieRec audio file\n" + filePath ); } } } } void QtRec::doMenuPlay() { qApp->processEvents(); currentFile = ListView1->currentItem()->text(0); } void QtRec::doRename() { QRect r = ListView1->itemRect( ListView1->currentItem( )); r = QRect( ListView1->viewportToContents( r.topLeft() ), r.size() ); r.setX( ListView1->contentsX() ); if ( r.width() > ListView1->visibleWidth() ) r.setWidth( ListView1->visibleWidth() ); renameBox = new QLineEdit( ListView1->viewport(), "qt_renamebox" ); renameBox->setFrame(true); renameBox->setText( ListView1->currentItem()->text(0) ); 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()); 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); diff --git a/noncore/multimedia/powerchord/powerchordbase.cpp b/noncore/multimedia/powerchord/powerchordbase.cpp index 0b97984..7978426 100644 --- a/noncore/multimedia/powerchord/powerchordbase.cpp +++ b/noncore/multimedia/powerchord/powerchordbase.cpp @@ -339,103 +339,103 @@ PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl ) tuner_calib_freq->setWrapping( TRUE ); tuner_calib_freq->setMaxValue( 500 ); tuner_calib_freq->setMinValue( 300 ); tuner_calib_freq->setValue( 440 ); tuner_lab3 = new QLabel( Tuner, "tuner_lab3" ); tuner_lab3->setGeometry( QRect( 185, 225, 40, 21 ) ); tuner_lab3->setText( tr( "Pitch" ) ); tuner_pic1 = new QLabel( Tuner, "tuner_pic1" ); tuner_pic1->setGeometry( QRect( 195, 155, 31, 31 ) ); tuner_pic1->setFrameShape( QLabel::NoFrame ); tuner_pic1->setPixmap( image6 ); tuner_pic1->setScaledContents( TRUE ); tabs->insertTab( Tuner, tr( "Tuner" ) ); tab_3 = new QWidget( tabs, "tab_3" ); chordlistlab1 = new QLabel( tab_3, "chordlistlab1" ); chordlistlab1->setGeometry( QRect( 5, 5, 216, 16 ) ); chordlistlab1->setText( tr( "Chord list" ) ); chordlist = new QListBox( tab_3, "chordlist" ); chordlist->setGeometry( QRect( 5, 25, 220, 200 ) ); list_remove_btn = new QPushButton( tab_3, "list_remove_btn" ); list_remove_btn->setGeometry( QRect( 150, 230, 71, 25 ) ); list_remove_btn->setText( tr( "Remove" ) ); tabs->insertTab( tab_3, tr( "Chords" ) ); // hope this does what it's supposed to!! // setPalette( QPalette( QColor( 232, 227, 215) ) ); // signals and slots connections //cxm connect( tuning, SIGNAL( activated(int) ), frets, SLOT( Tune(int) ) ); connect( span, SIGNAL( activated(int) ), frets, SLOT( Span(int) ) ); connect( transport_rec, SIGNAL( clicked() ), this, SLOT( transport_rec_cb() )); connect( play_sound, SIGNAL( clicked() ), this, SLOT( play_chord_cb() )); connect( tuner_start, SIGNAL( clicked() ), this, SLOT( tuner_start_cb() )); connect( tuner_note, SIGNAL( textChanged(const QString&) ), vu, SLOT( AnnotL(const QString&) )); connect( this, SIGNAL( frequency_change(int) ), vu, SLOT( Value(int) )); connect( chordnote, SIGNAL( activated(int) ), frets, SLOT( Base(int) ) ); connect( chordkey, SIGNAL( activated(int) ), frets, SLOT( Chord(int) ) ); connect( chordfret, SIGNAL( activated(int) ), frets, SLOT( Fret(int) ) ); connect( list_remove_btn, SIGNAL( clicked() ), this, SLOT( list_remove_cb() ) ); - connect( frets, SIGNAL( s1nameChanged(const QString &) ), s1_1, SLOT( setText(const QString&) ) ); - connect( frets, SIGNAL( s2nameChanged(const QString &) ), s1_2, SLOT( setText(const QString&) ) ); - connect( frets, SIGNAL( s3nameChanged(const QString &) ), s1_3, SLOT( setText(const QString&) ) ); - connect( frets, SIGNAL( s4nameChanged(const QString &) ), s1_4, SLOT( setText(const QString&) ) ); - connect( frets, SIGNAL( s5nameChanged(const QString &) ), s1_5, SLOT( setText(const QString&) ) ); - connect( frets, SIGNAL( s6nameChanged(const QString &) ), s1_6, SLOT( setText(const QString&) ) ); - connect( frets, SIGNAL( nameChanged(const QString &) ), chordname, SLOT( setText(const QString&) ) ); + connect( frets, SIGNAL( s1nameChanged(const QString&) ), s1_1, SLOT( setText(const QString&) ) ); + connect( frets, SIGNAL( s2nameChanged(const QString&) ), s1_2, SLOT( setText(const QString&) ) ); + connect( frets, SIGNAL( s3nameChanged(const QString&) ), s1_3, SLOT( setText(const QString&) ) ); + connect( frets, SIGNAL( s4nameChanged(const QString&) ), s1_4, SLOT( setText(const QString&) ) ); + connect( frets, SIGNAL( s5nameChanged(const QString&) ), s1_5, SLOT( setText(const QString&) ) ); + connect( frets, SIGNAL( s6nameChanged(const QString&) ), s1_6, SLOT( setText(const QString&) ) ); + connect( frets, SIGNAL( nameChanged(const QString&) ), chordname, SLOT( setText(const QString&) ) ); } static int known=0; #include <qmessagebox.h> void PowerchordBase::transport_rec_cb(){ chordlist->insertItem(chordname->text(),-1); if (!known){ QMessageBox::information(this, "Powerchord", "This chord has been saved\ninto the list of chords,\nfor later playback."); known = 1; } } void PowerchordBase::list_remove_cb(){ if (chordlist->count() > 0){ chordlist->removeItem(0); } } void PowerchordBase::play_chord_cb(){ // QMessageBox::information(this, "Coming soon!", "This button plays\nthe chord by synthesizing\nthe sound of the notes."); if (audio_timer){ audio_timer->stop(); // set pixmap? synth->Stop(); delete(audio_timer); audio_timer = 0; }else{ // get notes from chord engine int note; int base; int octave; note = frets->ce.noteindex(0); if (note >= 0){ // fprintf(stderr, "Note was %d\n", note); base = note % 12; octave = note / 12; synth->note_start(0, base, octave); }else{ // subtle bug here - replay second note if 1st one muted note = frets->ce.noteindex(1); base = note % 12; octave = note / 12; synth->note_start(1, base, octave); } diff --git a/noncore/multimedia/showimg/ImageFileSelector.cpp b/noncore/multimedia/showimg/ImageFileSelector.cpp index 7872c09..d2b65a9 100644 --- a/noncore/multimedia/showimg/ImageFileSelector.cpp +++ b/noncore/multimedia/showimg/ImageFileSelector.cpp @@ -54,102 +54,102 @@ void ThumbWidget::paintEvent( QPaintEvent *e ) void ThumbWidget::mouseReleaseEvent(QMouseEvent* ) { emit clicked(fl); } ImageFileSelectorItem::ImageFileSelectorItem( QListView *parent, const DocLnk &f) : QListViewItem( parent ), fl( f ) { setText( 0, f.name() ); QFileInfo fi(f.file()); setText( 1, (fi.extension()).upper() ); setPixmap( 0, f.pixmap() ); } ImageFileSelectorItem::~ImageFileSelectorItem() { } ImageFileSelector::ImageFileSelector( CURRENT_VIEW scv,QWidget *parent,const char * ) : QWidgetStack(parent) { detailed=new QListView(this); detailed->addColumn (tr("Title")); detailed->addColumn (tr("Type")); detailed->setAllColumnsShowFocus( true ); tList.setAutoDelete(true); thumb =new QScrollView(this); thumb->setVScrollBarMode (QScrollView::Auto ); thumb->viewport()->setBackgroundColor(colorGroup().base()); background=new QWidget(0); background->setBackgroundColor(colorGroup().base()); thumb->addChild(background); gl = new QGridLayout(background,1,2,4,4); - connect( detailed, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ), - this, SLOT( fileClicked( int, QListViewItem *, const QPoint &, int ) ) ); - connect( detailed, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint &, int ) ), - this, SLOT( filePressed( int, QListViewItem *, const QPoint &, int ) ) ); - connect( detailed, SIGNAL( returnPressed( QListViewItem * ) ), - this, SLOT( fileClicked( QListViewItem * ) ) ); + connect( detailed, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), + this, SLOT( fileClicked(int,QListViewItem*,const QPoint&,int) ) ); + connect( detailed, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), + this, SLOT( filePressed(int,QListViewItem*,const QPoint&,int) ) ); + connect( detailed, SIGNAL( returnPressed(QListViewItem*) ), + this, SLOT( fileClicked(QListViewItem*) ) ); cView=UNKNOWN; setView(scv); reread(); } ImageFileSelector::~ImageFileSelector() { } void ImageFileSelector::switchView() { CURRENT_VIEW v=cView; if ( v==DETAILED ) v=THUMBNAIL; else v=DETAILED; setView(v); } void ImageFileSelector::setView(CURRENT_VIEW v) { if ( v==cView ) return; cView=v; if ( cView!=DETAILED ) { raiseWidget(thumb); updateSizes(); } else { raiseWidget(detailed); updateSizes(); } } void ImageFileSelector::resizeEvent(QResizeEvent *) { updateSizes(); } @@ -168,97 +168,97 @@ void ImageFileSelector::reread(bool) { // qDebug("reread"); 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; // int totalHeight=4; ThumbWidget *l=0; int width=80; gl->expand(dit.count()/2,2); int i,j; i=j=0; detailed->setUpdatesEnabled(false); thumb->setUpdatesEnabled(false); for ( ; dit.current(); ++dit ) { item = new ImageFileSelectorItem( detailed, **dit ); if ( item->file().file() == oldFile ) detailed->setCurrentItem( item ); } QListViewItemIterator it( detailed ); ImageFileSelectorItem *ii; // iterate through all items of the listview for ( ; it.current(); ++it ) { ii=(ImageFileSelectorItem *)it.current(); QImage img( ii->file().file() ); if( !img.isNull()) { img=img.smoothScale(64,64); QPixmap pix; pix.convertFromImage(img); l=new ThumbWidget(pix,ii->file().name(),ii->file(),background,width); l->setBackgroundColor(colorGroup().base()); gl->addWidget(l,j,i); i++; if ( i==2 ) { i=0; j++; } tList.append(l); - connect(l,SIGNAL(clicked(const DocLnk &)),this,SLOT(thumbClicked(const DocLnk &))); + connect(l,SIGNAL(clicked(const DocLnk&)),this,SLOT(thumbClicked(const DocLnk&))); } } if ( !detailed->selectedItem() ) detailed->setCurrentItem( detailed->firstChild() ); detailed->setUpdatesEnabled(true); thumb->setUpdatesEnabled(true); detailed->update(); thumb->update(); } int ImageFileSelector::fileCount() { return count; } const DocLnk * ImageFileSelector::selected() { qDebug("image selected"); 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; if ( button == Qt::LeftButton ) { fileClicked( i ); } } // pressed to get 'right down' void ImageFileSelector::filePressed( int, QListViewItem *, const QPoint &, int ) { } void ImageFileSelector::fileClicked( QListViewItem *i) { if ( !i ) return; emit fileSelected( ( (ImageFileSelectorItem*)i )->file() ); emit closeMe(); } diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp index ba76e57..02a1d91 100644 --- a/noncore/multimedia/showimg/showimg.cpp +++ b/noncore/multimedia/showimg/showimg.cpp @@ -263,98 +263,98 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags ) // optionsMenuFile->insertItem( tr("Slideshow") ); optionsMenuFile->insertSeparator(); optionsMenuFile->insertItem( tr("Preferences.."), this, SLOT(settings()), 0); // optionsMenuFile->insertItem( tr("Help"), this, SLOT(help()), 0); QStrList fmt = QImage::outputFormats(); fileMenuView = new QPopupMenu( this ); //menubarView->insertItem( tr("File"),fileMenu ); fileMenuView->insertItem( tr("Image Info ..."),this, SLOT(displayInfoDialog()),0 ); fileMenuView->insertSeparator(); viewMenuView = new QPopupMenu(this ); viewMenuView->setCheckable ( true ); //menubarView->insertItem( tr("View"),viewMenu ); viewMenuView->insertItem(tr("Horizontal flip"), this, SLOT(hFlip()), 0); viewMenuView->insertItem(tr("Vertical flip"), this, SLOT(vFlip()), 0); stack = new QWidgetStack( this ); stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); setCentralWidget( stack ); 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); 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 & ) ) ); + connect( fileSelector, SIGNAL( fileSelected(const DocLnk&) ), + this, SLOT( openFile(const DocLnk&) ) ); imageList = fileSelector->fileList(); slideAction->setEnabled( imageList.count() != 0); iconToolBar = new QToolBar(this); QAction *a; a = new QAction( tr( "Open ..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( open() ) ); a->addTo( fileMenuView); a->addTo( iconToolBar ); a = new QAction( tr( "Rotate 90"), Resource::loadPixmap( "rotate90" ), QString::null, 0, this, 0); connect( a, SIGNAL( activated() ), this, SLOT( rot90() ) ); a->addTo( iconToolBar ); a->addTo( viewMenuView ); a = new QAction( tr( "Rotate 180" ), Resource::loadPixmap( "repeat" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( rot180() ) ); a->addTo( iconToolBar ); a->addTo( viewMenuView ); a = new QAction( tr( "Rotate 270"), Resource::loadPixmap( "rotate270" ), QString::null, 0, this, 0); connect( a, SIGNAL( activated() ), this, SLOT( rot270() ) ); //a->addTo( iconToolBar ); a->addTo( viewMenuView ); viewMenuView->insertSeparator(); viewMenuView->insertItem(tr("Brightness ..."), this, SLOT(displayControlsDialog()), 0); viewMenuView->insertItem(tr("Black And White"), this, SLOT(blackAndWhite()), 0,BLACKANDWHITE); viewMenuView->insertSeparator(); sss = new QAction( tr( "Scale to Screen"), Resource::loadPixmap( "scale" ), QString::null, 0, this, 0,true); connect( sss, SIGNAL( activated() ), this, SLOT( switchSizeToScreen() ) ); sss->addTo( iconToolBar ); sss->addTo( viewMenuView ); sss->setOn(isSized); viewMenuView->insertSeparator(); a = new QAction( tr( "Fullscreen" ), Resource::loadPixmap( "fullscreen" ), diff --git a/noncore/net/linphone/qlinphone.cpp b/noncore/net/linphone/qlinphone.cpp index 3cc2ebc..ba4ee5f 100644 --- a/noncore/net/linphone/qlinphone.cpp +++ b/noncore/net/linphone/qlinphone.cpp @@ -67,97 +67,97 @@ extern "C" { LinphoneCoreVTable lcvtable={ show: qt_show, inv_recv: qt_inv_recv, bye_recv : stub, notify_recv : qt_notify_recv, display_status : qt_display_status, display_message : qt_display_message, display_warning : qt_display_warning, display_url : qt_display_url, display_question : stub }; } //extern "C" void UpdateStatusBarTask::execute() { static_cast<QLinphoneMainWidget*>(_w)->displayStatus(_msg); } void InviteReceivedTask::execute() { static_cast<QLinphoneMainWidget*>(_w)->inviteReceived(_msg); } void DisplayMessageTask::execute() { switch(_msgtype) { case Info: QMessageBox::information(0,QObject::tr("Information"),_msg); break; case Warn: QMessageBox::warning(0,QObject::tr("Warning"),_msg); break; } } QLinphoneMainWidget::QLinphoneMainWidget(QWidget* parent , const char* name , WFlags fl ) : _QLinphoneMainWidget( parent, name, fl ) { readConfig(); createLinphoneCore(); - connect( CheckBox1, SIGNAL( toggled( bool ) ), this, SLOT( slotHide( bool ) ) ); + connect( CheckBox1, SIGNAL( toggled(bool) ), this, SLOT( slotHide(bool) ) ); CheckBox1->setChecked( true ); } QLinphoneMainWidget::~QLinphoneMainWidget() { linphone_core_destroy(_core); writeConfig(); } void QLinphoneMainWidget::slotHide( bool show ) { if ( show ) { TabWidget2->show(); } else { TabWidget2->hide(); } } void QLinphoneMainWidget::callOrAccept() { if (linphone_core_inc_invite_pending(_core)) { linphone_core_accept_dialog(_core,NULL); return; } QString url=sip_url->text(); linphone_core_invite(_core,(char*)url.ascii()); } void QLinphoneMainWidget::terminateCall() { linphone_core_terminate_dialog(_core,NULL); } void QLinphoneMainWidget::inviteReceived(QString &tmp) { sip_url->setText(tmp); } void QLinphoneMainWidget::displayStatus(QString &msg) { status_bar->setText(msg); } void QLinphoneMainWidget::pushGuiTask(GuiTask* g) { _mutex.lock(); _actionq.enqueue(g); _mutex.unlock(); printf("New action added to task list.\n"); } void QLinphoneMainWidget::processGuiTasks() { GuiTask *g; _mutex.lock(); while(!_actionq.isEmpty()) { g=_actionq.dequeue(); diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index c2185f2..64557ee 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -1,71 +1,71 @@ #include "accountview.h" #include "accountitem.h" #include "selectstore.h" /* OPIE */ #include <libmailwrapper/settings.h> #include <libmailwrapper/mailwrapper.h> #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> #include <qpe/qpeapplication.h> /* QT */ #include <qmessagebox.h> #include <qpopupmenu.h> AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) : QListView( parent, name, flags ) { - connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), - SLOT( refresh( QListViewItem * ) ) ); - connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, - SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); + connect( this, SIGNAL( selectionChanged(QListViewItem*) ), + SLOT( refresh(QListViewItem*) ) ); + connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, + SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); setSorting(0); } AccountView::~AccountView() { imapAccounts.clear(); mhAccounts.clear(); } void AccountView::slotContextMenu(int id) { AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); if (!view) return; view->contextMenuSelected(id); } void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) { if (button==1) {return;} if (!item) return; AccountViewItem *view = static_cast<AccountViewItem *>(item); QPopupMenu*m = view->getContextMenu(); if (!m) return; connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); m->setFocus(); m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); delete m; } void AccountView::populate( QList<Account> list ) { clear(); imapAccounts.clear(); mhAccounts.clear(); mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); Account *it; for ( it = list.first(); it; it = list.next() ) { if ( it->getType().compare( "IMAP" ) == 0 ) { IMAPaccount *imap = static_cast<IMAPaccount *>(it); qDebug( "added IMAP " + imap->getAccountName() ); imapAccounts.append(new IMAPviewItem( imap, this )); } else if ( it->getType().compare( "POP3" ) == 0 ) diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 6708779..f51a8fe 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp @@ -17,97 +17,97 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m QString vfilename = Global::applicationFileName("addressbook", "businesscard.vcf"); Contact c; if (QFile::exists(vfilename)) { c = Contact::readVCard( vfilename )[0]; } QStringList mails = c.emailList(); QString defmail = c.defaultEmail(); if (defmail.length()!=0) { fromBox->insertItem(defmail); } QStringList::ConstIterator sit = mails.begin(); for (;sit!=mails.end();++sit) { if ( (*sit)==defmail) continue; fromBox->insertItem((*sit)); } senderNameEdit->setText(c.firstName()+" "+c.lastName()); Config cfg( "mail" ); cfg.setGroup( "Compose" ); checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); attList->addColumn( tr( "Name" ) ); attList->addColumn( tr( "Size" ) ); QList<Account> accounts = settings->getAccounts(); Account *it; for ( it = accounts.first(); it; it = accounts.next() ) { if ( it->getType().compare( "SMTP" ) == 0 ) { SMTPaccount *smtp = static_cast<SMTPaccount *>(it); smtpAccountBox->insertItem( smtp->getAccountName() ); smtpAccounts.append( smtp ); } } if ( smtpAccounts.count() > 0 ) { fillValues( smtpAccountBox->currentItem() ); } else { QMessageBox::information( this, tr( "Problem" ), tr( "<p>Please create an SMTP account first.</p>" ), tr( "Ok" ) ); return; } - connect( smtpAccountBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); + connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); } void ComposeMail::pickAddress( QLineEdit *line ) { QString names = AddressPicker::getNames(); if ( line->text().isEmpty() ) { line->setText( names ); } else if ( !names.isEmpty() ) { line->setText( line->text() + ", " + names ); } } void ComposeMail::setTo( const QString & to ) { /* QString toline; QStringList toEntry = to; for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) { toline += (*it); } toLine->setText( toline ); */ toLine->setText( to ); } void ComposeMail::setSubject( const QString & subject ) { subjectLine->setText( subject ); } void ComposeMail::setInReplyTo( const QString & messageId ) { } void ComposeMail::setMessage( const QString & text ) { message->setText( text ); } void ComposeMail::pickAddressTo() diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 60bffa5..edeb1de 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp @@ -239,294 +239,294 @@ void EditAccounts::slotEditNews() slotEditAccount( a ); } void EditAccounts::slotDeleteNews() { qDebug( "Delete News Account" ); 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 ); } void EditAccounts::slotAdjustColumns() { int currPage = configTab->currentPageIndex(); configTab->showPage( mailTab ); mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); mailList->setColumnWidth( 1, 50 ); configTab->showPage( newsTab ); newsList->setColumnWidth( 0, newsList->visibleWidth() ); configTab->setCurrentPage( currPage ); } void EditAccounts::accept() { settings->saveAccounts(); QDialog::accept(); } /** * SelectMailType */ SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) : SelectMailTypeUI( parent, name, modal, flags ) { selected = selection; selected->replace( 0, selected->length(), typeBox->currentText() ); - connect( typeBox, SIGNAL( activated( const QString & ) ), SLOT( slotSelection( const QString & ) ) ); + connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); } void SelectMailType::slotSelection( const QString &sel ) { selected->replace( 0, selected->length(), sel ); } /** * IMAPconfig */ IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : IMAPconfigUI( parent, name, modal, flags ) { data = account; fillValues(); - connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); + connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); ComboBox1->insertItem( "Only if available", 0 ); ComboBox1->insertItem( "Always, Negotiated", 1 ); ComboBox1->insertItem( "Connect on secure port", 2 ); ComboBox1->insertItem( "Run command instead", 3 ); CommandEdit->hide(); ComboBox1->setCurrentItem( data->ConnectionType() ); } void IMAPconfig::slotConnectionToggle( int index ) { if ( index == 2 ) { portLine->setText( IMAP_SSL_PORT ); } else if ( index == 3 ) { portLine->setText( IMAP_PORT ); CommandEdit->show(); } else { portLine->setText( IMAP_PORT ); } } void IMAPconfig::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); ComboBox1->setCurrentItem( data->ConnectionType() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); prefixLine->setText(data->getPrefix()); } void IMAPconfig::accept() { data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setConnectionType( ComboBox1->currentItem() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); data->setPrefix(prefixLine->text()); QDialog::accept(); } /** * POP3config */ POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : POP3configUI( parent, name, modal, flags ) { data = account; fillValues(); - connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); + connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); ComboBox1->insertItem( "Only if available", 0 ); ComboBox1->insertItem( "Always, Negotiated", 1 ); ComboBox1->insertItem( "Connect on secure port", 2 ); ComboBox1->insertItem( "Run command instead", 3 ); CommandEdit->hide(); ComboBox1->setCurrentItem( data->ConnectionType() ); } void POP3config::slotConnectionToggle( int index ) { // 2 is ssl connection if ( index == 2 ) { portLine->setText( POP3_SSL_PORT ); } else if ( index == 3 ) { portLine->setText( POP3_PORT ); CommandEdit->show(); } else { portLine->setText( POP3_PORT ); } } void POP3config::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); ComboBox1->setCurrentItem( data->ConnectionType() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); } void POP3config::accept() { data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setConnectionType( ComboBox1->currentItem() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); QDialog::accept(); } /** * SMTPconfig */ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : SMTPconfigUI( parent, name, modal, flags ) { data = account; - connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); - connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); + connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); + connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); fillValues(); - connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); + connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); ComboBox1->insertItem( "Only if available", 0 ); ComboBox1->insertItem( "Always, Negotiated", 1 ); ComboBox1->insertItem( "Connect on secure port", 2 ); ComboBox1->insertItem( "Run command instead", 3 ); CommandEdit->hide(); ComboBox1->setCurrentItem( data->ConnectionType() ); } void SMTPconfig::slotConnectionToggle( int index ) { // 2 is ssl connection if ( index == 2 ) { portLine->setText( SMTP_SSL_PORT ); } else if ( index == 3 ) { portLine->setText( SMTP_PORT ); CommandEdit->show(); } else { portLine->setText( SMTP_PORT ); } } void SMTPconfig::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); ComboBox1->setCurrentItem( data->ConnectionType() ); loginBox->setChecked( data->getLogin() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); } void SMTPconfig::accept() { data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setConnectionType( ComboBox1->currentItem() ); data->setLogin( loginBox->isChecked() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); QDialog::accept(); } /** * NNTPconfig */ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : NNTPconfigUI( parent, name, modal, flags ) { data = account; - connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); - connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); + connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); + connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); fillValues(); - connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); + connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); } void NNTPconfig::slotSSL( bool enabled ) { if ( enabled ) { portLine->setText( NNTP_SSL_PORT ); } else { portLine->setText( NNTP_PORT ); } } void NNTPconfig::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); sslBox->setChecked( data->getSSL() ); loginBox->setChecked( data->getLogin() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); } void NNTPconfig::accept() { data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setSSL( sslBox->isChecked() ); data->setLogin( loginBox->isChecked() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); QDialog::accept(); } diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index dfc00d8..df7f773 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp @@ -277,100 +277,100 @@ int MHwrapper::deleteAllMail(const Folder*tfolder) if (r!=MAIL_NO_ERROR) { qDebug("error selecting folder!"); 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"); 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; } } if (l) mailmessage_list_free(l); return res; } int MHwrapper::deleteMbox(const Folder*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"); 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(OProcess *)), - this, SLOT( processEnded(OProcess *))); - connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), - this, SLOT( oprocessStderr(OProcess *, char *, int))); + connect(process, SIGNAL(processExited(OProcess*)), + this, SLOT( processEnded(OProcess*))); + connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)), + this, SLOT( oprocessStderr(OProcess*,char*,int))); *process << command; removeMboxfailed = false; if(!process->start(OProcess::Block, OProcess::All) ) { qDebug("could not start process"); return 0; } qDebug("mail box deleted"); 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") ); removeMboxfailed = true; } void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) { init_storage(); if (!m_storage) { return; } target_stat.message_count = 0; target_stat.message_unseen = 0; target_stat.message_recent = 0; QString f = buildPath(mailbox); int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, &target_stat.message_recent,&target_stat.message_unseen); if (r != MAIL_NO_ERROR) { Global::statusMessage(tr("Error retrieving status")); } } const QString&MHwrapper::getType()const { return wrapperType; } const QString&MHwrapper::getName()const { return MHName; diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index a3c68ae..d75d52a 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp @@ -1,83 +1,83 @@ #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <qdir.h> #include <qt.h> #include <qmessagebox.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <libetpan/libetpan.h> #include "smtpwrapper.h" #include "mailwrapper.h" #include "abstractmail.h" #include "logindialog.h" #include "mailtypes.h" #include "sendmailprogress.h" const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; progressMailSend*SMTPwrapper::sendProgress = 0; SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) : QObject() { m_SmtpAccount = aSmtp; Config cfg( "mail" ); cfg.setGroup( "Status" ); m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); emit queuedMails( m_queuedMail ); - connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); + connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); m_smtp = 0; } SMTPwrapper::~SMTPwrapper() { disc_server(); } void SMTPwrapper::emitQCop( int queued ) { QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); env << queued; } QString SMTPwrapper::mailsmtpError( int errnum ) { switch ( errnum ) { case MAILSMTP_NO_ERROR: return tr( "No error" ); case MAILSMTP_ERROR_UNEXPECTED_CODE: return tr( "Unexpected error code" ); case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: return tr( "Service not available" ); case MAILSMTP_ERROR_STREAM: return tr( "Stream error" ); case MAILSMTP_ERROR_HOSTNAME: return tr( "gethostname() failed" ); case MAILSMTP_ERROR_NOT_IMPLEMENTED: return tr( "Not implemented" ); case MAILSMTP_ERROR_ACTION_NOT_TAKEN: return tr( "Error, action not taken" ); case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: return tr( "Data exceeds storage allocation" ); case MAILSMTP_ERROR_IN_PROCESSING: return tr( "Error in processing" ); case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: return tr( "Starttls not supported" ); // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: // return tr( "Insufficient system storage" ); case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: return tr( "Mailbox unavailable" ); case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: return tr( "Mailbox name not allowed" ); case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: return tr( "Bad command sequence" ); case MAILSMTP_ERROR_USER_NOT_LOCAL: return tr( "User not local" ); case MAILSMTP_ERROR_TRANSACTION_FAILED: return tr( "Transaction failed" ); case MAILSMTP_ERROR_MEMORY: diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 2a1f90d..3f34fe7 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -10,172 +10,172 @@ #include "defines.h" #include "mainwindow.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) : QMainWindow( parent, name, flags ) { setCaption( tr( "Mail" ) ); setToolBarsMovable( false ); toolBar = new QToolBar( this ); menuBar = new QMenuBar( toolBar ); mailMenu = new QPopupMenu( menuBar ); menuBar->insertItem( tr( "Mail" ), mailMenu ); settingsMenu = new QPopupMenu( menuBar ); menuBar->insertItem( tr( "Settings" ), settingsMenu ); addToolBar( toolBar ); toolBar->setHorizontalStretchable( true ); QLabel *spacer = new QLabel( toolBar ); spacer->setBackgroundMode( QWidget::PaletteButton ); toolBar->setStretchableWidget( spacer ); composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 0, 0, this ); composeMail->addTo( toolBar ); composeMail->addTo( mailMenu ); sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 0, 0, this ); sendQueued->addTo( toolBar ); sendQueued->addTo( mailMenu ); /* syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 0, 0, this ); syncFolders->addTo( toolBar ); syncFolders->addTo( mailMenu ); */ showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 0, 0, this, 0, true ); showFolders->addTo( toolBar ); showFolders->addTo( mailMenu ); showFolders->setOn( true ); - connect(showFolders, SIGNAL( toggled( bool ) ), - SLOT( slotShowFolders( bool ) ) ); + connect(showFolders, SIGNAL( toggled(bool) ), + SLOT( slotShowFolders(bool) ) ); /* searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), 0, 0, this ); searchMails->addTo( toolBar ); searchMails->addTo( mailMenu ); */ deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); deleteMails->addTo( toolBar ); deleteMails->addTo( mailMenu ); connect( deleteMails, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , 0, 0, this ); editSettings->addTo( settingsMenu ); connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , 0, 0, this ); editAccounts->addTo( settingsMenu ); //setCentralWidget( view ); QVBox* wrapperBox = new QVBox( this ); setCentralWidget( wrapperBox ); QWidget *view = new QWidget( wrapperBox ); layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); folderView = new AccountView( view ); folderView->header()->hide(); folderView->setRootIsDecorated( true ); folderView->addColumn( tr( "Mailbox" ) ); layout->addWidget( folderView ); mailView = new QListView( view ); mailView->addColumn( tr( "" ) ); mailView->addColumn( tr( "Subject" ),QListView::Manual ); mailView->addColumn( tr( "Sender" ),QListView::Manual ); mailView->addColumn( tr( "Size" ),QListView::Manual); mailView->addColumn( tr( "Date" )); mailView->setAllColumnsShowFocus(true); mailView->setSorting(-1); statusWidget = new StatusWidget( wrapperBox ); statusWidget->hide(); layout->addWidget( mailView ); layout->setStretchFactor( folderView, 1 ); layout->setStretchFactor( mailView, 2 ); slotAdjustLayout(); QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); - connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, - SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); - connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, - SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); + connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, + SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) ); + connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, + SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); // Added by Stefan Eilers to allow starting by addressbook.. // copied from old mail2 #if !defined(QT_NO_COP) - connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), - this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); + connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), + 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"); } void MainWindow::slotAdjustLayout() { QWidget *d = QApplication::desktop(); if ( d->width() < d->height() ) { layout->setDirection( QBoxLayout::TopToBottom ); } else { layout->setDirection( QBoxLayout::LeftToRight ); } } void MainWindow::slotAdjustColumns() { bool hidden = folderView->isHidden(); if ( hidden ) folderView->show(); folderView->setColumnWidth( 0, folderView->visibleWidth() ); if ( hidden ) folderView->hide(); mailView->setColumnWidth( 0, 10 ); 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" ); } diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index f015228..8636957 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp @@ -240,101 +240,101 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int } break ; case 1: if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { setText(); } else { if ( m_recMail.Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); } } break; } delete menu; } void ViewMail::setMail( RecMail mail ) { m_recMail = mail; m_mail[0] = mail.getFrom(); m_mail[1] = mail.getSubject(); m_mail[3] = mail.getDate(); m_mail[4] = mail.Msgid(); m_mail2[0] = mail.To(); m_mail2[1] = mail.CC(); m_mail2[2] = mail.Bcc(); setText(); } ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) : ViewMailBase(parent, name, fl), _inLoop(false) { m_gotBody = false; deleted = false; connect( reply, SIGNAL(activated()), SLOT(slotReply())); connect( forward, SIGNAL(activated()), SLOT(slotForward())); - connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) ); - connect( showHtml, SIGNAL( toggled( bool ) ), SLOT( slotShowHtml( bool ) ) ); + connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); + connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); attachments->setEnabled(m_gotBody); - connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); + connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); readConfig(); attachments->setSorting(-1); } void ViewMail::readConfig() { Config cfg( "mail" ); cfg.setGroup( "Settings" ); m_showHtml = cfg.readBoolEntry( "showHtml", false ); showHtml->setOn( m_showHtml ); } void ViewMail::setText() { QString toString; QString ccString; QString bccString; for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { toString += (*it); } for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { ccString += (*it); } for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { bccString += (*it); } setCaption( caption().arg( m_mail[0] ) ); m_mailHtml = "<html><body>" "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + "</td></tr></table><font face=fixed>"; if ( !m_showHtml ) { browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 4064549..4c39569 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp @@ -131,237 +131,237 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) cdUpButton = new QToolButton( view,"cdUpButton"); cdUpButton->setPixmap(Resource::loadPixmap("up")); cdUpButton ->setFixedSize( QSize( 20, 20 ) ); connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); cdUpButton->hide(); // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton"); // docButton->setFixedSize( QSize( 20, 20 ) ); // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); // docButton->setFlat(TRUE); // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); homeButton = new QToolButton(view,"homeButton"); homeButton->setPixmap( Resource::loadPixmap("home")); homeButton->setFixedSize( QSize( 20, 20 ) ); connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); homeButton->hide(); TabWidget = new QTabWidget( view, "TabWidget" ); layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); // TabWidget->setTabShape(QTabWidget::Triangular); tab = new QWidget( TabWidget, "tab" ); tabLayout = new QGridLayout( tab ); tabLayout->setSpacing( 2); tabLayout->setMargin( 2); Local_View = new QListView( tab, "Local_View" ); // Local_View->setResizePolicy( QListView::AutoOneFit ); Local_View->addColumn( tr("File"),150); Local_View->addColumn( tr("Date"),-1); Local_View->setColumnAlignment(1,QListView::AlignRight); Local_View->addColumn( tr("Size"),-1); Local_View->setColumnAlignment(2,QListView::AlignRight); Local_View->setAllColumnsShowFocus(TRUE); Local_View->setMultiSelection( TRUE); Local_View->setSelectionMode(QListView::Extended); Local_View->setFocusPolicy(QWidget::ClickFocus); QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); tabLayout->addWidget( Local_View, 0, 0 ); - connect( Local_View, SIGNAL( clicked( QListViewItem*)), - this,SLOT( localListClicked(QListViewItem *)) ); -// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), -// this,SLOT( localListClicked(QListViewItem *)) ); - connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), - this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); + connect( Local_View, SIGNAL( clicked(QListViewItem*)), + this,SLOT( localListClicked(QListViewItem*)) ); +// connect( Local_View, SIGNAL( doubleClicked(QListViewItem*)), +// this,SLOT( localListClicked(QListViewItem*)) ); + connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), + this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); TabWidget->insertTab( tab, tr( "Local" ) ); tab_2 = new QWidget( TabWidget, "tab_2" ); tabLayout_2 = new QGridLayout( tab_2 ); tabLayout_2->setSpacing( 2); tabLayout_2->setMargin( 2); Remote_View = new QListView( tab_2, "Remote_View" ); Remote_View->addColumn( tr("File"),150); Remote_View->addColumn( tr("Date"),-1); // Remote_View->setColumnAlignment(1,QListView::AlignRight); Remote_View->addColumn( tr("Size"),-1); Remote_View->setColumnAlignment(2,QListView::AlignRight); Remote_View->setColumnAlignment(3,QListView::AlignCenter); Remote_View->addColumn( tr("Dir"),-1); Remote_View->setColumnAlignment(4,QListView::AlignRight); Remote_View->setAllColumnsShowFocus(TRUE); Remote_View->setMultiSelection( FALSE); Remote_View->setSelectionMode(QListView::Extended); Remote_View->setFocusPolicy(QWidget::ClickFocus); QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); - connect( Remote_View, SIGNAL( clicked( QListViewItem*)), - this,SLOT( remoteListClicked(QListViewItem *)) ); - connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), - this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); + connect( Remote_View, SIGNAL( clicked(QListViewItem*)), + this,SLOT( remoteListClicked(QListViewItem*)) ); + connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), + this,SLOT( RemoteListPressed(int,QListViewItem*,const QPoint&,int)) ); tabLayout_2->addWidget( Remote_View, 0, 0 ); TabWidget->insertTab( tab_2, tr( "Remote" ) ); tab_3 = new QWidget( TabWidget, "tab_3" ); tabLayout_3 = new QGridLayout( tab_3 ); tabLayout_3->setSpacing( 2); tabLayout_3->setMargin( 2); TextLabel1 = new QLabel( tab_3, "TextLabel1" ); TextLabel1->setText( tr( "Username" ) ); tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); UsernameComboBox->setEditable(TRUE); tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); - connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this, - SLOT( UsernameComboBoxEdited(const QString & ) )); + connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this, + SLOT( UsernameComboBoxEdited(const QString&) )); TextLabel2 = new QLabel( tab_3, "TextLabel2" ); TextLabel2->setText( tr( "Password" ) ); tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); PasswordEdit->setEchoMode(QLineEdit::Password); tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); - connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this, - SLOT( PasswordEditEdited(const QString & ) )); + connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this, + SLOT( PasswordEditEdited(const QString&) )); //PasswordEdit->setFixedWidth(85); TextLabel3 = new QLabel( tab_3, "TextLabel3" ); TextLabel3->setText( tr( "Remote server" ) ); tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); ServerComboBox->setEditable(TRUE); tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); - connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); - connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, - SLOT(serverComboEdited(const QString & ) )); + connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) )); + connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this, + SLOT(serverComboEdited(const QString&) )); QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); TextLabel5->setText( tr( "Remote path" ) ); tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); remotePath = new QLineEdit( "/", tab_3, "remotePath" ); tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); TextLabel4 = new QLabel( tab_3, "TextLabel4" ); TextLabel4->setText( tr( "Port" ) ); tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); PortSpinBox->setMaxValue(32786); tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); serverListView = new QListBox( tab_3, "ServerListView" ); tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); - connect( serverListView, SIGNAL( highlighted( const QString &)), - this,SLOT( serverListClicked( const QString &) ) ); + connect( serverListView, SIGNAL( highlighted(const QString&)), + this,SLOT( serverListClicked(const QString&) ) ); connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); connectServerBtn->setToggleButton(TRUE); - connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); + connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) )); newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); QPushButton *deleteServerBtn; deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); tabLayout_3->addItem( spacer, 5, 0 ); TabWidget->insertTab( tab_3, tr( "Config" ) ); #if 0 - connect(TabWidget,SIGNAL(currentChanged(QWidget *)), + connect(TabWidget,SIGNAL(currentChanged(QWidget*)), this,SLOT(tabChanged(QWidget*))); #endif currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); currentDir.setPath( QDir::currentDirPath()); // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); currentPathCombo ->setFixedWidth(220); currentPathCombo->setEditable(TRUE); currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); #if 0 - connect( currentPathCombo, SIGNAL( activated( const QString & ) ), - this, SLOT( currentPathComboActivated( const QString & ) ) ); + connect( currentPathCombo, SIGNAL( activated(const QString&) ), + this, SLOT( currentPathComboActivated(const QString&) ) ); connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), this,SLOT(currentPathComboChanged())); #endif ProgressBar = new QProgressBar( view, "ProgressBar" ); 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"); } OpieFtp::~OpieFtp() { } void OpieFtp::cleanUp() { if(conn) FtpQuit(conn); QString sfile=QDir::homeDirPath(); if(sfile.right(1) != "/") sfile+="/._temp"; else sfile+="._temp"; QFile file( sfile); if(file.exists()) file.remove(); Config cfg("opieftp"); cfg.setGroup("Server"); cfg.writeEntry("currentServer", currentServerConfig); exit(0); } void OpieFtp::tabChanged(QWidget *) { if (TabWidget->currentPageIndex() == 0) { currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index b0771f6..667e977 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp @@ -1,79 +1,79 @@ #include <qpe/resource.h> #include <qwhatsthis.h> #include <qhbox.h> #include "ircchanneltab.h" #include "ircservertab.h" IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { m_mainWindow = mainWindow; m_parentTab = parentTab; m_channel = channel; m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); QHBox *hbox = new QHBox(this); m_textview = new QTextView(hbox); m_textview->setHScrollBarMode(QScrollView::AlwaysOff); m_textview->setVScrollBarMode(QScrollView::AlwaysOn); m_listVisible = TRUE; m_listButton = new QPushButton(">", m_textview); m_textview->setCornerWidget(m_listButton); m_textview->setTextFormat(RichText); QWhatsThis::add(m_textview, tr("Channel discussion")); connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList())); m_list = new IRCChannelList(m_channel, hbox); m_list->update(); m_list->setMaximumWidth(LISTWIDTH); m_field = new IRCHistoryLineEdit(this); QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); m_popup = new QPopupMenu(m_list); m_lines = 0; /* Required so that embedded-style "right" clicks work */ QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); - connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); + connect(m_list, SIGNAL(mouseButtonPressed(int,QListBoxItem*,const QPoint&)), this, SLOT(mouseButtonPressed(int,QListBoxItem*,const QPoint&))); /* Construct the popup menu */ QPopupMenu *ctcpMenu = new QPopupMenu(m_list); m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); m_layout->add(hbox); hbox->show(); m_layout->add(m_field); m_field->setFocus(); connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); settingsChanged(); } void IRCChannelTab::scrolling(){ m_textview->ensureVisible(0, m_textview->contentsHeight()); } void IRCChannelTab::appendText(QString text) { /* not using append because it creates layout problems */ QString txt = m_textview->text() + text + "\n"; if (m_maxLines > 0 && m_lines >= m_maxLines) { int firstBreak = txt.find('\n'); if (firstBreak != -1) { txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); } } else { m_lines++; } m_textview->ensureVisible(0, m_textview->contentsHeight()); m_textview->setText(txt); m_textview->ensureVisible(0, m_textview->contentsHeight()); emit changed(this); } IRCChannelTab::~IRCChannelTab() { m_parentTab->removeChannelTab(this); } void IRCChannelTab::processCommand() { QString text = m_field->text(); if (text.length()>0) { if (session()->isSessionActive()) { if (text.startsWith("/") && !text.startsWith("//")) { /* Command mode */ m_parentTab->executeCommand(this, text);; diff --git a/noncore/net/opieirc/ircsession.cpp b/noncore/net/opieirc/ircsession.cpp index 6404d71..3b176d0 100644 --- a/noncore/net/opieirc/ircsession.cpp +++ b/noncore/net/opieirc/ircsession.cpp @@ -1,57 +1,57 @@ #include "ircsession.h" #include "ircmessageparser.h" #include "ircversion.h" IRCSession::IRCSession(IRCServer *server) { m_server = server; m_connection = new IRCConnection(m_server); m_parser = new IRCMessageParser(this); - connect(m_connection, SIGNAL(messageArrived(IRCMessage *)), this, SLOT(handleMessage(IRCMessage *))); + connect(m_connection, SIGNAL(messageArrived(IRCMessage*)), this, SLOT(handleMessage(IRCMessage*))); connect(m_parser, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); connect(m_connection, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); } IRCSession::~IRCSession() { /* We want this to get deleted automatically */ m_channels.setAutoDelete(TRUE); m_people.setAutoDelete(TRUE); delete m_parser; delete m_connection; } void IRCSession::beginSession() { m_connection->doConnect(); } void IRCSession::join(QString channelname) { m_connection->sendLine("JOIN "+channelname); } void IRCSession::quit(){ m_connection->sendLine("QUIT :[OI] I'm too good to need a reason"); } void IRCSession::quit(QString message){ m_connection->sendLine("QUIT :" + message); } void IRCSession::topic(IRCChannel *channel, QString message){ m_connection->sendLine("TOPIC :" + channel->channelname() + " " + message); } void IRCSession::mode(IRCChannel *channel, QString message){ m_connection->sendLine("MODE " + channel->channelname() + " " + message); } void IRCSession::mode(IRCPerson *person, QString message){ m_connection->sendLine("MODE " + person->nick() + " " + message); } void IRCSession::mode(QString message){ m_connection->sendLine("MODE " + message); } void IRCSession::raw(QString message){ m_connection->sendLine(message); } diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index 7414154..0923a11 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp @@ -1,91 +1,91 @@ #include <qmenubar.h> #include <qpe/resource.h> #include <qwhatsthis.h> #include "mainwindow.h" #include "ircservertab.h" #include "ircserverlist.h" #include "ircsettings.h" MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { setCaption(tr("IRC Client")); m_tabWidget = new IRCTabWidget(this); QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here")); - connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); + connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*))); setCentralWidget(m_tabWidget); setToolBarsMovable(FALSE); QMenuBar *menuBar = new QMenuBar(this); QPopupMenu *irc = new QPopupMenu(this); menuBar->insertItem(tr("IRC"), irc); QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); connect(a, SIGNAL(activated()), this, SLOT(newConnection())); a->setWhatsThis(tr("Create a new connection to an IRC server")); a->addTo(irc); a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); connect(a, SIGNAL(activated()), this, SLOT(settings())); a->addTo(irc); loadSettings(); } /*IRCTabWidget MainWindow::getTabWidget(){ return m_tabWidget; } */ void MainWindow::loadSettings() { Config config("OpieIRC"); config.setGroup("OpieIRC"); IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); IRCTab::m_maxLines = config.readNumEntry("Lines", 100); } void MainWindow::selected(QWidget *) { m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); emit updateScroll(); } void MainWindow::addTab(IRCTab *tab) { - connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); + connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*))); m_tabWidget->addTab(tab, tab->title()); m_tabWidget->showPage(tab); tab->setID(m_tabWidget->currentPageIndex()); m_tabs.append(tab); } void MainWindow::changeEvent(IRCTab *tab) { if (tab->id() != m_tabWidget->currentPageIndex()) m_tabWidget->setTabColor(tab->id(), blue); } void MainWindow::killTab(IRCTab *tab) { m_tabWidget->removePage(tab); m_tabs.remove(tab); /* there might be nicer ways to do this .. */ delete tab; } void MainWindow::newConnection() { IRCServerList list(this, "ServerList", TRUE); if (list.exec() == QDialog::Accepted && list.hasServer()) { IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); addTab(serverTab); serverTab->doConnect(); } } void MainWindow::settings() { IRCSettings settings(this, "Settings", TRUE); if (settings.exec() == QDialog::Accepted) { QListIterator<IRCTab> it(m_tabs); for (; it.current(); ++it) { /* Inform all tabs about the new settings */ it.current()->settingsChanged(); } } } diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp index 6b6d247..c3850eb 100644 --- a/noncore/net/opietooth/lib/startdunconnection.cpp +++ b/noncore/net/opietooth/lib/startdunconnection.cpp @@ -1,67 +1,67 @@ #include "startdunconnection.h" using namespace OpieTooth; StartDunConnection::StartDunConnection() { m_dunConnect = 0l; setConnectionType(); } StartDunConnection::~StartDunConnection() { delete m_dunConnect; } StartDunConnection::StartDunConnection( QString mac ) { m_dunConnect = 0l; m_mac = mac; setConnectionType(); } void StartDunConnection::setName( QString name ) { m_name = name; } QString StartDunConnection::name() { return m_name; } void StartDunConnection::setConnectionType() { m_connectionType = Pan; } 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( OProcess* ) ) , - this, SLOT( slotExited( OProcess* ) ) ); - connect( m_dunConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), - this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); + connect( m_dunConnect, SIGNAL( processExited(OProcess*) ) , + this, SLOT( slotExited(OProcess*) ) ); + connect( m_dunConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), + this, SLOT( slotStdOut(OProcess*,char*,int) ) ); if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { qWarning( "could not start" ); delete m_dunConnect; } } void StartDunConnection::slotExited( OProcess* proc ) { delete m_dunConnect; } void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) {} void StartDunConnection::stop() { if ( m_dunConnect ) { delete m_dunConnect; m_dunConnect = 0l; } } diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp index 6e0ab7e..a42b407 100644 --- a/noncore/net/opietooth/lib/startpanconnection.cpp +++ b/noncore/net/opietooth/lib/startpanconnection.cpp @@ -1,82 +1,82 @@ #include "startpanconnection.h" using namespace OpieTooth; StartPanConnection::StartPanConnection() { m_panConnect = 0l; setConnectionType(); } StartPanConnection::~StartPanConnection() { delete m_panConnect; } StartPanConnection::StartPanConnection( QString mac ) { m_panConnect = 0l; m_mac = mac; setConnectionType(); } void StartPanConnection::setName( QString name ) { m_name = name; } QString StartPanConnection::name() { return m_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 ); *m_panConnect << "pand" << "--connect" << m_mac; - connect( m_panConnect, SIGNAL( processExited( OProcess* ) ) , - this, SLOT( slotExited( OProcess* ) ) ); - connect( m_panConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), - this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); + connect( m_panConnect, SIGNAL( processExited(OProcess*) ) , + this, SLOT( slotExited(OProcess*) ) ); + connect( m_panConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), + this, SLOT( slotStdOut(OProcess*,char*,int) ) ); if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { qWarning( "could not start" ); 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); *m_panConnect << "pand" << "--kill" << m_mac; - connect( m_panConnect, SIGNAL( processExited( OProcess* ) ) , - this, SLOT( slotExited( OProcess* ) ) ); - connect( m_panConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), - this, SLOT( slotStdOut( OProcess*, char*, int ) ) ); + connect( m_panConnect, SIGNAL( processExited(OProcess*) ) , + this, SLOT( slotExited(OProcess*) ) ); + connect( m_panConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), + this, SLOT( slotStdOut(OProcess*,char*,int) ) ); if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { qWarning( "could not stop" ); delete m_panConnect; } } diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 0ea45d2..29030ab 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -20,110 +20,110 @@ #include "hciconfwrapper.h" #include "devicehandler.h" #include "btconnectionitem.h" #include "rfcommassigndialogimpl.h" /* OPIE */ #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> /* QT */ #include <qframe.h> #include <qlabel.h> #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> #include <qimage.h> #include <qpixmap.h> #include <qtabwidget.h> #include <qscrollview.h> #include <qvbox.h> #include <qmessagebox.h> #include <qcheckbox.h> #include <qlineedit.h> #include <qlistview.h> #include <qdir.h> #include <qpopupmenu.h> #include <qtimer.h> #include <qlist.h> /* STD */ #include <remotedevice.h> #include <services.h> #include <stdlib.h> using namespace OpieTooth; BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) : BluetoothBase( parent, name, fl ) { m_localDevice = new Manager( "hci0" ); connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); // not good since lib is async - // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), - // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); - connect( ListView2, SIGNAL( clicked( QListViewItem* )), - this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); - connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), - this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); - connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), - this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); - connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), - this, SLOT( deviceActive( const QString& , bool ) ) ); - connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), - this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); - connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ), - this, SLOT( addSignalStrength( const QString&, const QString& ) ) ); + // connect( ListView2, SIGNAL( expanded(QListViewItem*) ), + // this, SLOT( addServicesToDevice(QListViewItem*) ) ); + connect( ListView2, SIGNAL( clicked(QListViewItem*)), + this, SLOT( startServiceActionClicked(QListViewItem*) ) ); + connect( ListView2, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), + this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) ); + connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ), + this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) ); + connect( m_localDevice, SIGNAL( available(const QString&,bool) ), + this, SLOT( deviceActive(const QString&,bool) ) ); + connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), + this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); + connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), + this, SLOT( addSignalStrength(const QString&,const QString&) ) ); // let hold be rightButtonClicked() QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); //Load all icons needed m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); m_onPix = Resource::loadPixmap( "opietooth/connected" ); m_findPix = Resource::loadPixmap( "opietooth/find" ); QPalette pal = this->palette(); QColor col = pal.color( QPalette::Active, QColorGroup::Background ); pal.setColor( QPalette::Active, QColorGroup::Button, col ); pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); pal.setColor( QPalette::Normal, QColorGroup::Button, col ); pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); this->setPalette( pal ); setCaption( tr( "Bluetooth Manager" ) ); readConfig(); initGui(); ListView2->setRootIsDecorated(true); writeToHciConfig(); // search conncetions addConnectedDevices(); addSignalStrength(); m_iconLoader = new BTIconLoader(); readSavedDevices(); } /** * Reads all options from the config file */ void BlueBase::readConfig() { Config cfg( "bluetoothmanager" ); cfg.setGroup( "bluezsettings" ); m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); @@ -592,97 +592,97 @@ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) * Find out if a device can currently be reached * @param device */ void BlueBase::deviceActive( const RemoteDevice &device ) { // search by mac, async, gets a signal back // 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"); QMap<QString,BTDeviceItem*>::Iterator it; it = m_deviceList.find( device ); if( it == m_deviceList.end() ) return; BTDeviceItem* deviceItem = it.data(); if ( connected ) { deviceItem->setPixmap( 1, m_onPix ); } else { deviceItem->setPixmap( 1, m_offPix ); } m_deviceList.remove( it ); } /** * Open the "scan for devices" dialog */ void BlueBase::startScan() { ScanDialog *scan = new ScanDialog( this, "ScanDialog", true, WDestructiveClose ); - QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), - this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); + QObject::connect( scan, SIGNAL( selectedDevices(const QValueList<RemoteDevice>&) ), + this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) ); QPEApplication::showDialog( scan ); } /** * Set the informations about the local device in information Tab */ void BlueBase::setInfo() { StatusLabel->setText( status() ); } /** * Decontructor */ BlueBase::~BlueBase() { writeSavedDevices(); delete m_iconLoader; } /** * find searches the ListView for a BTDeviceItem containig * the same Device if found return true else false * @param dev RemoteDevice to find * @return returns true if found */ bool BlueBase::find( const RemoteDevice& rem ) { QListViewItemIterator it( ListView2 ); BTListItem* item; BTDeviceItem* device; for (; it.current(); ++it ) { item = (BTListItem*) it.current(); if ( item->typeId() != BTListItem::Device ) continue; device = (BTDeviceItem*)item; if ( rem.equals( device->remoteDevice() ) ) return true; } return false; // not found } diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp index 15973d4..46a0e3d 100644 --- a/noncore/net/opietooth/manager/obexdialog.cpp +++ b/noncore/net/opietooth/manager/obexdialog.cpp @@ -1,86 +1,86 @@ #include "obexdialog.h" #include <qpushbutton.h> #include <qmultilineedit.h> #include <qlineedit.h> #include <qlayout.h> #include <qlabel.h> #include <qfileinfo.h> #include <qpe/resource.h> #include <opie/oprocess.h> #include <opie/ofiledialog.h> using namespace OpieTooth; ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "ObexDialog" ); setCaption( tr( "beam files " ) ) ; m_device = device; layout = new QVBoxLayout( this ); QLabel* info = new QLabel( this ); info->setText( tr("Which file should be beamed?") ); cmdLine = new QLineEdit( this ); QPushButton *browserButton; browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); chNameLine = new QLineEdit( this ); sendButton = new QPushButton( this ); sendButton->setText( tr( "Send" ) ); layout->addWidget(info); layout->addWidget(cmdLine); layout->addWidget(browserButton); layout->addWidget(chNameLine); layout->addWidget(sendButton); - connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); + connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); } ObexDialog::~ObexDialog() { } void ObexDialog::browse() { MimeTypes types; QStringList all; all << "*/*"; types.insert("All Files", all ); QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); cmdLine->setText( str ); } 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"); delete obexSend; } } diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp index 1f347ce..4e58552 100644 --- a/noncore/net/opietooth/manager/pppdialog.cpp +++ b/noncore/net/opietooth/manager/pppdialog.cpp @@ -1,68 +1,68 @@ #include "pppdialog.h" #include <qpushbutton.h> #include <qmultilineedit.h> #include <qlineedit.h> #include <qlayout.h> #include <qlabel.h> #include <opie/oprocess.h> using namespace OpieTooth; PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "PPPDialog" ); setCaption( tr( "ppp connection " ) ) ; m_device = device; layout = new QVBoxLayout( this ); QLabel* info = new QLabel( this ); info->setText( tr("Enter an ppp script name:") ); cmdLine = new QLineEdit( this ); outPut = new QMultiLineEdit( this ); QFont outPut_font( outPut->font() ); outPut_font.setPointSize( 8 ); outPut->setFont( outPut_font ); outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); connectButton = new QPushButton( this ); connectButton->setText( tr( "Connect" ) ); layout->addWidget(info); layout->addWidget(cmdLine); layout->addWidget(outPut); layout->addWidget(connectButton); - connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); + connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); } 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(OProcess*, char*, int ) ), - this, SLOT(fillOutPut(OProcess*, char*, int ) ) ); + connect( pppDial, SIGNAL(receivedStdout(OProcess*,char*,int) ), + this, SLOT(fillOutPut(OProcess*,char*,int) ) ); if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { qWarning("could not start"); 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/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index de4f742..c8ea3e3 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp @@ -21,98 +21,98 @@ #include <qheader.h> #include <qlistview.h> #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qprogressbar.h> #include <qlist.h> #include <manager.h> #include <device.h> namespace OpieTooth { #include <remotedevice.h> /** */ ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { setCaption( tr( "Scan for devices" ) ); Layout11 = new QVBoxLayout( this ); Layout11->setSpacing( 6 ); Layout11->setMargin( 0 ); progress = new QProgressBar( this, "progbar"); progress->setTotalSteps(20); StartStopButton = new QPushButton( this, "StartButton" ); StartStopButton->setText( tr( "Start scan" ) ); ListView1 = new QListView( this, "ListView1" ); //ListView1->addColumn( tr( "Add" ) ); ListView1->addColumn( tr( "Add Device" ) ); //ListView1->addColumn( tr( "Type" ) ); Layout11->addWidget( ListView1 ); Layout11->addWidget( progress ); Layout11->addWidget( StartStopButton ); localDevice = new Manager( "hci0" ); connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); - connect( localDevice, SIGNAL( foundDevices( const QString& , RemoteDevice::ValueList ) ), - this, SLOT( fillList( const QString& , RemoteDevice::ValueList ) ) ) ; + connect( localDevice, SIGNAL( foundDevices(const QString&,RemoteDevice::ValueList) ), + this, SLOT( fillList(const QString&,RemoteDevice::ValueList) ) ) ; progressStat = 0; m_search = false; } // hack, make cleaner later void ScanDialog::progressTimer() { progressStat++; if ( progressStat++ < 20 && m_search ) { QTimer::singleShot( 2000, this, SLOT( progressTimer() ) ); progress->setProgress( progressStat++ ); } } void ScanDialog::accept() { emitToManager(); QDialog::accept(); } void ScanDialog::startSearch() { if ( m_search ) { stopSearch(); return; } m_search = true; progress->setProgress(0); progressStat = 0; // empty list before a new scan ListView1->clear(); progressTimer(); // when finished, it emmite foundDevices() // checken ob initialisiert , qcop ans applet. StartStopButton->setText( tr( "Stop scan" ) ); localDevice->searchDevices(); } void ScanDialog::stopSearch() { m_search = true; } void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { progress->setProgress(0); diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index b39203b..8ae87fe 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp @@ -76,323 +76,323 @@ using namespace Opie; class DefaultWindowDecoration : public WindowDecorationInterface { public: DefaultWindowDecoration() : ref(0) {} QString name() const { return "Default"; } QPixmap icon() const { return QPixmap(); } QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_WindowDecoration ) *iface = this; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_REFCOUNT private: ulong ref; }; QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) { QWidget* tab = new QWidget( parent, "StyleTab" ); QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); m_style_list = new QListBox( tab, "m_style_list" ); vertLayout->addWidget( m_style_list ); QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) ); m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); - connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( ))); + connect ( m_style_settings, SIGNAL( clicked()), this, SLOT( styleSettingsClicked())); vertLayout-> addWidget ( m_style_settings ); QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); QString s = cfg. readEntry ( "Style", "Light" ); #if QT_VERSION >= 300 m_style_list->insertStringList(QStyleFactory::styles()); #else m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); #endif { QString path = QPEApplication::qpeDir ( ); path.append( "/plugins/styles/" ); QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { QString libstr = path; libstr.append( "/" ); libstr.append( *it ); QLibrary *lib = new QLibrary ( libstr ); StyleInterface *iface; if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) { StyleListItem *slit = new StyleListItem ( lib, iface ); m_style_list-> insertItem ( slit ); if ( slit-> key ( ) == s ) m_style_list-> setCurrentItem ( slit ); } else delete lib; } } m_original_style = m_style_list-> currentItem ( ); styleClicked ( m_original_style ); - connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) ); + connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) ); return tab; } QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) { QWidget* tab = new QWidget( parent, "DecoTab" ); QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); m_deco_list = new QListBox( tab, "m_deco_list" ); vertLayout->addWidget( m_deco_list ); QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) ); QString s = cfg. readEntry ( "Decoration", "libflat.so" ); m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); { QString path = QPEApplication::qpeDir(); path.append( "/plugins/decorations/" ); QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { QString libstr = path; libstr.append( "/" ); libstr.append( *it ); QLibrary *lib = new QLibrary ( libstr ); WindowDecorationInterface *iface; if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) { DecoListItem *dlit = new DecoListItem ( lib, iface ); m_deco_list-> insertItem ( dlit ); if ( dlit-> key ( ) == s ) m_deco_list-> setCurrentItem ( dlit ); } else delete lib; } } m_original_deco = m_deco_list-> currentItem ( ); if ( m_deco_list-> currentItem ( ) < 0 ) m_deco_list-> setCurrentItem ( 0 ); decoClicked ( m_original_deco ); - connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) ); + connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) ); return tab; } QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) { QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); int size = cfg. readNumEntry ( "FontSize", 10 ); m_fontselect = new OFontSelector ( false, parent, "FontTab" ); m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); - connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), - this, SLOT( fontClicked ( const QFont & ))); + connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), + this, SLOT( fontClicked(const QFont&))); return m_fontselect; } QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) { QWidget *tab = new QWidget( parent, "ColorTab" ); QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); gridLayout->setRowStretch ( 3, 10 ); m_color_list = new QListBox ( tab ); gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); - connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) ); + connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) ); QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) ); m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); QString path = QPEApplication::qpeDir ( ); path.append( "/etc/colors/" ); QStringList sl = QDir ( path ). entryList ( "*.scheme" ); for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { QString name = (*it). left ((*it). find ( ".scheme" )); QString pathstr = path; pathstr.append( *it ); Config config ( pathstr, Config::File ); config. setGroup ( "Colors" ); m_color_list-> insertItem ( new ColorListItem ( name, config )); } m_color_list-> setCurrentItem ( 0 ); QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); tempButton->setText( tr( "Edit..." ) ); connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); gridLayout->addWidget( tempButton, 0, 1 ); QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); tempButton = new QPushButton( tab, "deleteSchemeButton" ); tempButton->setText( tr( "Delete" ) ); connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); gridLayout->addWidget( tempButton, 1, 1 ); QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); tempButton = new QPushButton( tab, "saveSchemeButton" ); tempButton->setText( tr( "Save" ) ); connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); gridLayout->addWidget( tempButton, 2, 1 ); QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); return tab; } QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) { QWidget *tab = new QWidget ( parent ); QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); QLabel *l = new QLabel ( tab ); l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); m_except = new QListView ( tab ); m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 ); m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 ); m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 ); m_except-> addColumn ( tr( "Binary file(s)" )); m_except-> setColumnAlignment ( 0, AlignCenter ); m_except-> setColumnAlignment ( 1, AlignCenter ); m_except-> setColumnAlignment ( 2, AlignCenter ); m_except-> setAllColumnsShowFocus ( true ); m_except-> setMinimumHeight ( 30 ); m_except-> header ( )-> setClickEnabled ( false ); m_except-> header ( )-> setResizeEnabled ( false ); m_except-> header ( )-> setMovingEnabled ( false ); m_except-> setSorting ( -1 ); lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); - connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); + connect ( m_except, SIGNAL( clicked(QListViewItem*,const QPoint&,int)), this, SLOT( clickedExcept(QListViewItem*,const QPoint&,int))); QToolButton *tb = new QToolButton ( tab ); tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); tb-> setFocusPolicy ( QWidget::StrongFocus ); lay-> addWidget ( tb, 2, 1 ); - connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); + connect ( tb, SIGNAL( clicked()), this, SLOT( addExcept())); QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); tb = new QToolButton ( tab ); tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); tb-> setFocusPolicy ( QWidget::StrongFocus ); lay-> addWidget ( tb, 3, 1 ); - connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); + connect ( tb, SIGNAL( clicked()), this, SLOT( delExcept())); QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); tb = new QToolButton ( tab ); tb-> setIconSet ( Resource::loadIconSet ( "up" )); tb-> setFocusPolicy ( QWidget::StrongFocus ); lay-> addWidget ( tb, 4, 1 ); - connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); + connect ( tb, SIGNAL( clicked()), this, SLOT( upExcept())); QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); tb = new QToolButton ( tab ); tb-> setIconSet ( Resource::loadIconSet ( "down" )); tb-> setFocusPolicy ( QWidget::StrongFocus ); lay-> addWidget ( tb, 5, 1 ); - connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); + connect ( tb, SIGNAL( clicked()), this, SLOT( downExcept())); QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); lay-> setRowStretch ( 6, 10 ); lay-> setColStretch ( 0, 10 ); QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); QListViewItem *lvit = 0; for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); } vertLayout-> addSpacing ( 3 ); QFrame *f = new QFrame ( tab ); f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); vertLayout-> addWidget ( f ); vertLayout-> addSpacing ( 3 ); QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); QLabel* label = new QLabel( tr( "Tab style:" ), tab ); gridLayout-> addWidget ( label, 0, 0 ); QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); btngrp-> hide ( ); btngrp-> setExclusive ( true ); m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); m_tabstyle_list-> insertItem ( tr( "Tabs" )); m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); m_tabstyle_list-> insertItem ( tr( "Drop down list" )); m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); m_tabstyle_list-> setCurrentItem ( style ); gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); btngrp-> insert ( m_tabstyle_top ); gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); @@ -442,97 +442,97 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) if (rotDirection == -1) { rot = ODevice::inst ( )-> direction ( ); } else { rot = (ODirection)rotDirection; } m_rotdir_cw-> setChecked ( rot == CW ); m_rotdir_ccw-> setChecked ( rot == CCW ); m_rotdir_flip-> setChecked ( rot == Flip ); return tab; } Appearance::Appearance( QWidget* parent, const char* name, WFlags ) : QDialog ( parent, name, true, WStyle_ContextHelp ) { setCaption( tr( "Appearance Settings" ) ); Config config( "qpe" ); config.setGroup( "Appearance" ); QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); m_sample = new SampleWindow ( this ); m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); QWidget *styletab; m_color_list = 0; tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); top-> addWidget ( tw, 10 ); top-> addWidget ( m_sample, 1 ); tw-> setCurrentTab ( styletab ); - connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); + connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; } Appearance::~Appearance() {} void Appearance::tabChanged ( QWidget *w ) { if ( w == m_advtab ) { m_sample-> hide ( ); updateGeometry ( ); // shouldn't be necessary ... } else m_sample-> show ( ); } void Appearance::accept ( ) { bool newtabpos = m_tabstyle_top-> isChecked ( ); int newtabstyle = m_tabstyle_list-> currentItem ( ); Config config ( "qpe" ); config. setGroup ( "Appearance" ); if ( m_style_changed ) { StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); if ( item ) config.writeEntry( "Style", item-> key ( )); } if ( m_deco_changed ) { DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); if ( item ) config.writeEntry( "Decoration", item-> key ( )); } if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { config. writeEntry ( "TabStyle", newtabstyle + 1 ); config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); } if ( m_font_changed ) { diff --git a/noncore/settings/appearance2/sample.cpp b/noncore/settings/appearance2/sample.cpp index b3a9d48..f6c4dca 100644 --- a/noncore/settings/appearance2/sample.cpp +++ b/noncore/settings/appearance2/sample.cpp @@ -46,127 +46,127 @@ class SampleText : public QWidget { public: SampleText( const QString &t, bool h, QWidget *parent ) : QWidget( parent ), hl(h), text(t) { if ( hl ) setBackgroundMode( PaletteHighlight ); else setBackgroundMode( PaletteBase ); } QSize sizeHint() const { QFontMetrics fm(font()); return QSize( fm.width(text)+10, fm.height()+4 ); } void paintEvent( QPaintEvent * ) { QPainter p(this); if ( hl ) p.setPen( colorGroup().highlightedText() ); else p.setPen( colorGroup().text() ); p.drawText( rect(), AlignCenter, text ); } private: bool hl; QString text; }; SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0) { init(); } QSize SampleWindow::sizeHint() const { return container->sizeHint() + QSize( 10, 35 ); } void SampleWindow::setFont( const QFont &f ) { QWidget::setFont( f ); popup->setFont( f ); - QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); + QTimer::singleShot ( 0, this, SLOT( fixGeometry())); } static void setStyleRecursive ( QWidget *w, QStyle *s ) { w->setStyle( s ); QObjectList *childObjects=(QObjectList*)w->children(); if ( childObjects ) { QObject * o; for(o=childObjects->first();o!=0;o=childObjects->next()) { if( o->isWidgetType() ) { setStyleRecursive((QWidget *)o,s); } } } } void SampleWindow::setStyle2 ( QStyle *sty, const QPalette &pal ) { typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); QPixmapCache::clear ( ); QPalette p = pal; // ette ( ); sty-> polish ( p ); qt_set_draw_menu_bar_impl ( 0 ); setStyleRecursive ( this, sty ); setPalette ( p ); - QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); + QTimer::singleShot ( 0, this, SLOT( fixGeometry())); } void SampleWindow::setDecoration( WindowDecorationInterface *i ) { iface = i; wd.rect = QRect( 0, 0, 150, 75 ); wd.caption = tr("Sample"); wd.palette = palette(); wd.flags = WindowDecorationInterface::WindowData::Dialog | WindowDecorationInterface::WindowData::Active; wd.reserved = 1; th = iface->metric(WindowDecorationInterface::TitleHeight, &wd); tb = iface->metric(WindowDecorationInterface::TopBorder, &wd); lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd); rb = iface->metric(WindowDecorationInterface::RightBorder, &wd); bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd); int yoff = th + tb; int xoff = lb; wd.rect.setX( 0 ); wd.rect.setWidth( width() - lb - rb ); wd.rect.setY( 0 ); wd.rect.setHeight( height() - yoff - bb ); container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() ); setMinimumSize( container->sizeHint().width()+lb+rb, container->sizeHint().height()+tb+th+bb ); } void SampleWindow::paintEvent( QPaintEvent * ) { if ( !iface ) return; QPainter p( this ); p.translate( lb, th+tb ); iface->drawArea(WindowDecorationInterface::Border, &p, &wd); iface->drawArea(WindowDecorationInterface::Title, &p, &wd); p.setPen(palette().active().color(QColorGroup::HighlightedText)); QFont f( font() ); f.setWeight( QFont::Bold ); p.setFont(f); diff --git a/noncore/settings/aqpkg/inputdlg.cpp b/noncore/settings/aqpkg/inputdlg.cpp index 06e934c..30f0527 100644 --- a/noncore/settings/aqpkg/inputdlg.cpp +++ b/noncore/settings/aqpkg/inputdlg.cpp @@ -30,98 +30,98 @@ #include <qlayout.h> #include <qlabel.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qspinbox.h> #include <qcombobox.h> #include <qwidgetstack.h> #include <qvalidator.h> #include <qapplication.h> #include "inputdlg.h" #include "global.h" InputDialog :: InputDialog( const QString &label, QWidget* parent, const char* name, bool modal ) : QDialog( parent, name, modal ) { lineEdit = 0; QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); QLabel* l = new QLabel( label, this ); vbox->addWidget( l ); lineEdit = new QLineEdit( this ); vbox->addWidget( lineEdit ); QHBoxLayout *hbox = new QHBoxLayout( 6 ); vbox->addLayout( hbox, AlignRight ); ok = new QPushButton( tr( "&OK" ), this ); ok->setDefault( TRUE ); QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this ); QSize bs( ok->sizeHint() ); if ( cancel->sizeHint().width() > bs.width() ) bs.setWidth( cancel->sizeHint().width() ); ok->setFixedSize( bs ); cancel->setFixedSize( bs ); hbox->addWidget( new QWidget( this ) ); hbox->addWidget( ok ); hbox->addWidget( cancel ); connect( lineEdit, SIGNAL( returnPressed() ), this, SLOT( tryAccept() ) ); - connect( lineEdit, SIGNAL( textChanged( const QString & ) ), - this, SLOT( textChanged( const QString & ) ) ); + connect( lineEdit, SIGNAL( textChanged(const QString&) ), + this, SLOT( textChanged(const QString&) ) ); connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); resize( QMAX( sizeHint().width(), 240 ), sizeHint().height() ); } /*! Destructor. */ InputDialog::~InputDialog() { } void InputDialog :: setText( const QString &text ) { lineEdit->setText( text ); lineEdit->selectAll(); } QString InputDialog :: getText() { return lineEdit->text(); } QString InputDialog::getText( const QString &caption, const QString &label, const QString &text, bool *ok, QWidget *parent, const char *name ) { InputDialog *dlg = new InputDialog( label, parent, name, true ); dlg->setCaption( caption ); dlg->setText( text ); QString result; *ok = dlg->exec() == QDialog::Accepted; if ( *ok ) result = dlg->getText(); delete dlg; return result; } void InputDialog :: textChanged( const QString &s ) { ok->setEnabled( !s.isEmpty() ); diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index d927a36..d2babb4 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp @@ -127,98 +127,98 @@ InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManag else if ( item->option == "D" ) { remove.append( QString( " %1\n" ).arg( item->packageName ) ); } else if ( item->option == "U" || item->option == "R" ) { QString type; if ( item->option == "R" ) type = tr( "(ReInstall)" ); else type = tr( "(Upgrade)" ); upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); } } output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); displayAvailableSpace( destination->currentText() ); } InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) : QWidget( 0, 0, 0 ) { setCaption( title ); init( FALSE ); pIpkg = ipkg; output->setText( initialText ); } InstallDlgImpl::~InstallDlgImpl() { if ( pIpkg ) delete pIpkg; } void InstallDlgImpl :: init( bool displayextrainfo ) { QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 4 ); layout->setMargin( 4 ); if ( displayextrainfo ) { QLabel *label = new QLabel( tr( "Destination" ), this ); layout->addWidget( label, 0, 0 ); destination = new QComboBox( FALSE, this ); layout->addWidget( destination, 0, 1 ); - connect( destination, SIGNAL( highlighted( const QString & ) ), - this, SLOT( displayAvailableSpace( const QString & ) ) ); + connect( destination, SIGNAL( highlighted(const QString&) ), + this, SLOT( displayAvailableSpace(const QString&) ) ); QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); layout->addWidget( label2, 1, 0 ); txtAvailableSpace = new QLabel( "", this ); layout->addWidget( txtAvailableSpace, 1, 1 ); } else { destination = 0x0; txtAvailableSpace = 0x0; } QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); GroupBox2->layout()->setSpacing( 0 ); GroupBox2->layout()->setMargin( 4 ); QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); output = new QMultiLineEdit( GroupBox2 ); GroupBox2Layout->addWidget( output ); layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); layout->addWidget( btnInstall, 3, 0 ); connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); layout->addWidget( btnOptions, 3, 1 ); connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); } void InstallDlgImpl :: optionsSelected() { if ( btnOptions->text() == tr( "Options" ) ) { InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true ); if ( opt.exec() == QDialog::Accepted ) { // set options selected from dialog flags = opt.getFlags(); infoLevel = opt.getInfoLevel(); #ifdef QWS Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); cfg.writeEntry( "installFlags", flags ); cfg.writeEntry( "infoLevel", infoLevel ); #endif } @@ -233,119 +233,119 @@ void InstallDlgImpl :: optionsSelected() text << "*"; map.insert( tr( "All" ), text ); QString filename = Opie::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); if( !filename.isEmpty() ) { QString currentFileName = QFileInfo( filename ).fileName(); DocLnk doc; doc.setType( "text/plain" ); doc.setFile( filename ); doc.setName( currentFileName ); FileManager fm; fm.saveFile( doc, output->text() ); } } } void InstallDlgImpl :: installSelected() { if ( btnInstall->text() == tr( "Abort" ) ) { if ( pIpkg ) { displayText( tr( "\n**** User Clicked ABORT ***" ) ); pIpkg->abort(); displayText( tr( "**** Process Aborted ****" ) ); } btnInstall->setText( tr( "Close" ) ); btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); return; } else if ( btnInstall->text() == tr( "Close" ) ) { emit reloadData( this ); return; } // Disable buttons btnOptions->setEnabled( false ); // btnInstall->setEnabled( false ); btnInstall->setText( tr( "Abort" ) ); btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); if ( pIpkg ) { output->setText( "" ); - connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); + connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&))); connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); pIpkg->runIpkg(); } else { output->setText( "" ); Destination *d = dataMgr->getDestination( destination->currentText() ); QString dest = d->getDestinationName(); QString destDir = d->getDestinationPath(); int instFlags = flags; if ( d->linkToRoot() ) instFlags |= MAKE_LINKS; #ifdef QWS // Save settings Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); cfg.writeEntry( "dest", dest ); #endif pIpkg = new Ipkg; - connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); + connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&))); connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); firstPackage = TRUE; ipkgFinished(); // First run through the remove list, then the install list then the upgrade list /* pIpkg->setOption( "remove" ); QListIterator<InstallData> it( removeList ); InstallData *idata; for ( ; it.current(); ++it ) { idata = it.current(); pIpkg->setDestination( idata->destination->getDestinationName() ); pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); pIpkg->setPackage( idata->packageName ); int tmpFlags = flags; if ( idata->destination->linkToRoot() ) tmpFlags |= MAKE_LINKS; pIpkg->setFlags( tmpFlags, infoLevel ); pIpkg->runIpkg(); } pIpkg->setOption( "install" ); pIpkg->setDestination( dest ); pIpkg->setDestinationDir( destDir ); pIpkg->setFlags( instFlags, infoLevel ); QListIterator<InstallData> it2( installList ); for ( ; it2.current(); ++it2 ) { pIpkg->setPackage( it2.current()->packageName ); pIpkg->runIpkg(); } flags |= FORCE_REINSTALL; QListIterator<InstallData> it3( updateList ); for ( ; it3.current() ; ++it3 ) { idata = it3.current(); if ( idata->option == "R" ) pIpkg->setOption( "reinstall" ); else pIpkg->setOption( "upgrade" ); pIpkg->setDestination( idata->destination->getDestinationName() ); pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); pIpkg->setPackage( idata->packageName ); diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp index 3761b67..866afed 100644 --- a/noncore/settings/aqpkg/ipkg.cpp +++ b/noncore/settings/aqpkg/ipkg.cpp @@ -243,104 +243,104 @@ void Ipkg :: removeStatusEntry() value = value.stripWhiteSpace(); } else { key = ""; value = ""; } if ( key == "Package" && value == package ) { //skip lines from the deleted package while ( ( !readStream.atEnd() ) && ( line.stripWhiteSpace() != "" ) ) { line = readStream.readLine(); } } else { //write other lines into the tempfile writeStream << line << "\n"; // Improve UI responsiveness i++; if ( ( i % 50 ) == 0 ) qApp->processEvents(); } } readFile.close(); writeFile.close(); // Remove old status file and put tmp stats file in its place remove( statusFile ); rename( outStatusFile, statusFile ); } int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) { // If one is already running - should never be but just to be safe if ( proc ) { delete proc; proc = 0; } // OK we're gonna use OProcess to run this thing proc = new OProcess(); aborted = false; // Connect up our slots - connect(proc, SIGNAL(processExited(OProcess *)), + connect(proc, SIGNAL(processExited(OProcess*)), this, SLOT( processFinished())); - connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), - this, SLOT(commandStdout(OProcess *, char *, int))); + connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)), + this, SLOT(commandStdout(OProcess*,char*,int))); - connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), - this, SLOT(commandStderr(OProcess *, char *, int))); + connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)), + this, SLOT(commandStderr(OProcess*,char*,int))); for ( QStringList::Iterator it = cmd.begin(); it != cmd.end(); ++it ) { *proc << (*it).latin1(); } // Start the process going finished = false; if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { emit outputText( tr("Couldn't start ipkg process" ) ); } } void Ipkg::commandStdout(OProcess*, char *buffer, int buflen) { QString lineStr = buffer; if ( lineStr[buflen-1] == '\n' ) buflen --; lineStr = lineStr.left( buflen ); emit outputText( lineStr ); // check if we are installing dependant packages if ( option == "install" || option == "reinstall" ) { // Need to keep track of any dependant packages that get installed // so that we can create links to them as necessary if ( lineStr.startsWith( "Installing " ) ) { int start = lineStr.find( " " ) + 1; int end = lineStr.find( " ", start ); QString *package = new QString( lineStr.mid( start, end-start ) ); dependantPackages->append( package ); } } else if ( option == "remove" && !( flags & FORCE_DEPENDS ) && lineStr.find( "is depended upon by packages:" ) != -1 ) { // Ipkg should send this to STDERR, but doesn't - so trap here error = true; } buffer[0] = '\0'; } void Ipkg::commandStderr(OProcess*, char *buffer, int buflen) { QString lineStr = buffer; diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 6f5c712..6b31cd1 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -55,114 +55,114 @@ #include <qlayout.h> #include <qlineedit.h> #include <qlistview.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qpopupmenu.h> #include <qprogressbar.h> #include <qtimer.h> #include <qwhatsthis.h> #include <qwidgetstack.h> /* STD */ #include <linux/limits.h> #include <unistd.h> extern int compareVersions( const char *v1, const char *v2 ); MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl || WStyle_ContextHelp ) { // Disable suspend mode QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; LOCAL_SERVER = QObject::tr( "Installed packages" ); LOCAL_IPKGS = QObject::tr( "Local packages" ); setCaption( tr( "AQPkg - Package Manager" ) ); // Create UI widgets initMainWidget(); initProgressWidget(); // Build menu and tool bars setToolBarsMovable( FALSE ); QToolBar *bar = new QToolBar( this ); bar->setHorizontalStretchable( TRUE ); QMenuBar *mb = new QMenuBar( bar ); mb->setMargin( 0 ); bar = new QToolBar( this ); // Find toolbar findBar = new QToolBar( this ); addToolBar( findBar, QMainWindow::Top, true ); findBar->setHorizontalStretchable( true ); findEdit = new QLineEdit( findBar ); QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); findBar->setStretchableWidget( findEdit ); - connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); + connect( findEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( findPackage(const QString&) ) ); // Quick jump toolbar jumpBar = new QToolBar( this ); addToolBar( jumpBar, QMainWindow::Top, true ); jumpBar->setHorizontalStretchable( true ); QWidget *w = new QWidget( jumpBar ); jumpBar->setStretchableWidget( w ); QGridLayout *layout = new QGridLayout( w ); char text[2]; text[1] = '\0'; for ( int i = 0 ; i < 26 ; ++i ) { text[0] = 'A' + i; LetterPushButton *b = new LetterPushButton( text, w ); - connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); + connect( b, SIGNAL( released(QString) ), this, SLOT( letterPushed(QString) ) ); layout->addWidget( b, i / 13, i % 13); } QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); a->addTo( jumpBar ); jumpBar->hide(); // Packages menu QPopupMenu *popup = new QPopupMenu( this ); a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); a->addTo( popup ); a->addTo( bar ); actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); actionUpgrade->addTo( popup ); actionUpgrade->addTo( bar ); iconDownload = Resource::loadPixmap( "aqpkg/download" ); iconRemove = Resource::loadPixmap( "aqpkg/remove" ); actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); actionDownload->addTo( popup ); actionDownload->addTo( bar ); a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); a->addTo( popup ); a->addTo( bar ); popup->insertSeparator(); a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to configure this application." ) ); connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); a->addTo( popup ); mb->insertItem( tr( "Actions" ), popup ); // View menu popup = new QPopupMenu( this ); @@ -220,141 +220,141 @@ MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); a->addTo( popup ); mb->insertItem( tr( "View" ), popup ); // Finish find toolbar creation a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); a->addTo( findBar ); findBar->hide(); // Create widget stack and add UI widgets stack = new QWidgetStack( this ); stack->addWidget( progressWindow, 2 ); stack->addWidget( networkPkgWindow, 1 ); setCentralWidget( stack ); stack->raiseWidget( progressWindow ); // Delayed call to finish initialization QTimer::singleShot( 100, this, SLOT( init() ) ); } MainWindow :: ~MainWindow() { delete mgr; // Reenable suspend mode QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; } void MainWindow :: initMainWidget() { networkPkgWindow = new QWidget( this ); QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); serversList = new QComboBox( networkPkgWindow ); connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); installedIcon = Resource::loadPixmap( "installed" ); updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); packagesList = new QListView( networkPkgWindow ); packagesList->addColumn( tr( "Packages" ), 225 ); QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold ); - connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), - this, SLOT(slotDisplayPackage(QListViewItem *)) ); + connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), + this, SLOT(slotDisplayPackage(QListViewItem*)) ); QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); hbox1->addWidget( l ); hbox1->addWidget( serversList ); vbox->addWidget( packagesList ); downloadEnabled = TRUE; } void MainWindow :: initProgressWidget() { progressWindow = new QWidget( this ); QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); m_status = new QLabel( progressWindow ); m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); layout->addWidget( m_status ); m_progress = new QProgressBar( progressWindow ); layout->addWidget( m_progress ); } void MainWindow :: init() { #ifdef QWS // read download directory from config file Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); #endif stack->raiseWidget( progressWindow ); mgr = new DataManager(); - connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); - connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), - this, SLOT( setProgressMessage( const QString & ) ) ); - connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); + connect( mgr, SIGNAL( progressSetSteps(int) ), this, SLOT( setProgressSteps(int) ) ); + connect( mgr, SIGNAL( progressSetMessage(const QString&) ), + this, SLOT( setProgressMessage(const QString&) ) ); + connect( mgr, SIGNAL( progressUpdate(int) ), this, SLOT( updateProgress(int) ) ); mgr->loadServers(); showUninstalledPkgs = false; showInstalledPkgs = false; showUpgradedPkgs = false; categoryFilterEnabled = false; updateData(); stack->raiseWidget( networkPkgWindow ); } void MainWindow :: setDocument( const QString &doc ) { // Remove path from package QString package = Utils::getPackageNameFromIpkFilename( doc ); // First select local server for ( int i = 0 ; i < serversList->count() ; ++i ) { if ( serversList->text( i ) == LOCAL_IPKGS ) { serversList->setCurrentItem( i ); break; } } serverSelected( 0 ); // Now set the check box of the selected package for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { if ( item->text().startsWith( package ) ) { item->setOn( true ); break; } } } void MainWindow :: displaySettings() { SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); if ( dlg->showDlg() ) { stack->raiseWidget( progressWindow ); updateData(); @@ -725,128 +725,128 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) // Display this widget once everything is done if ( doProgress && raiseProgress ) { stack->raiseWidget( networkPkgWindow ); } } void MainWindow :: searchForPackage( const QString &text ) { if ( !text.isEmpty() ) { // look through package list for text startng at current position QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); if ( start == 0 ) start = (QCheckListItem *)packagesList->firstChild(); for ( QCheckListItem *item = start; item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { if ( item->text().lower().find( text ) != -1 ) { packagesList->ensureItemVisible( item ); packagesList->setCurrentItem( item ); break; } } } } void MainWindow :: updateServer() { QString serverName = serversList->currentText(); // Update the current server // Display dialog // Disable buttons to stop silly people clicking lots on them :) // First, write out ipkg_conf file so that ipkg can use it mgr->writeOutIpkgConf(); Ipkg *ipkg = new Ipkg; ipkg->setOption( "update" ); InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), tr( "Update lists" ) ); - connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); + connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) ); reloadDocuments = FALSE; stack->addWidget( dlg, 3 ); stack->raiseWidget( dlg ); // delete progDlg; } void MainWindow :: upgradePackages() { // We're gonna do an upgrade of all packages // First warn user that this isn't recommended // TODO - ODevice???? QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , 0, this ); warn.adjustSize(); if ( warn.exec() == QMessageBox::Yes ) { // First, write out ipkg_conf file so that ipkg can use it mgr->writeOutIpkgConf(); // Now run upgrade Ipkg *ipkg = new Ipkg; ipkg->setOption( "upgrade" ); InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), tr ( "Upgrade" ) ); - connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); + connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) ); reloadDocuments = TRUE; stack->addWidget( dlg, 3 ); stack->raiseWidget( dlg ); } } void MainWindow :: downloadPackage() { bool doUpdate = true; if ( downloadEnabled ) { // See if any packages are selected bool found = false; if ( serversList->currentText() != LOCAL_SERVER ) { for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 && !found; item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) found = true; } } // If user selected some packages then download the and store the locally // otherwise, display dialog asking user what package to download from an http server // and whether to install it if ( found ) downloadSelectedPackages(); else downloadRemotePackage(); } else { doUpdate = false; for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) { QString name = item->text(); int pos = name.find( "*" ); name.truncate( pos ); // if (there is a (installed), remove it pos = name.find( "(installed)" ); @@ -861,179 +861,179 @@ void MainWindow :: downloadPackage() msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) { doUpdate = true; QFile f( p->getFilename() ); f.remove(); } } } } if ( doUpdate ) { reloadData( 0x0 ); } } void MainWindow :: downloadSelectedPackages() { // First, write out ipkg_conf file so that ipkg can use it mgr->writeOutIpkgConf(); // Display dialog to user asking where to download the files to bool ok = FALSE; QString dir = ""; #ifdef QWS // read download directory from config file Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); #endif QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); if ( ok && !text.isEmpty() ) dir = text; // user entered something and pressed ok else return; // user entered nothing or pressed cancel #ifdef QWS // Store download directory in config file cfg.writeEntry( "downloadDir", dir ); #endif // Get starting directory char initDir[PATH_MAX]; getcwd( initDir, PATH_MAX ); // Download each package Ipkg ipkg; - connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); + connect( &ipkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&))); ipkg.setOption( "download" ); ipkg.setRuntimeDirectory( dir ); for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) { ipkg.setPackage( item->text() ); ipkg.runIpkg( ); } } } void MainWindow :: downloadRemotePackage() { // Display dialog bool ok; QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); if ( !ok || package.isEmpty() ) return; // DownloadRemoteDlgImpl dlg( this, "Install", true ); // if ( dlg.exec() == QDialog::Rejected ) // return; // grab details from dialog // QString package = dlg.getPackageLocation(); InstallData *item = new InstallData(); item->option = "I"; item->packageName = package; QList<InstallData> workingPackages; workingPackages.setAutoDelete( TRUE ); workingPackages.append( item ); InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); - connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); + connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) ); reloadDocuments = TRUE; stack->addWidget( dlg, 3 ); stack->raiseWidget( dlg ); } void MainWindow :: applyChanges() { stickyOption = ""; // First, write out ipkg_conf file so that ipkg can use it mgr->writeOutIpkgConf(); // Now for each selected item // deal with it QList<InstallData> workingPackages; workingPackages.setAutoDelete( TRUE ); for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) { InstallData *instdata = dealWithItem( item ); if ( instdata ) workingPackages.append( instdata ); else return; } } if ( workingPackages.count() == 0 ) { // Nothing to do QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); return; } // do the stuff InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); - connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); + connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) ); reloadDocuments = TRUE; stack->addWidget( dlg, 3 ); stack->raiseWidget( dlg ); } // decide what to do - either remove, upgrade or install // Current rules: // If not installed - install // If installed and different version available - upgrade // If installed and version up to date - remove InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) { QString name = item->text(); // Get package Server *s = mgr->getServer( serversList->currentText() ); Package *p = s->getPackage( name ); // If the package has a filename then it is a local file if ( p->isPackageStoredLocally() ) name = p->getFilename(); QString option; QString dest = "root"; if ( !p->isInstalled() ) { InstallData *newitem = new InstallData(); newitem->option = "I"; newitem->packageName = name; return newitem; } else { InstallData *newitem = new InstallData(); newitem->option = "D"; // If local file, remove using package name, not filename if ( p->isPackageStoredLocally() ) name = item->text(); if ( !p->isPackageStoredLocally() ) newitem->packageName = p->getInstalledPackageName(); else newitem->packageName = name; if ( p->getInstalledTo() ) { newitem->destination = p->getInstalledTo(); } diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 6e9dd99..b9dbb6e 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp @@ -66,155 +66,155 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const Opie::OTabWidget *tabwidget = new Opie::OTabWidget( this ); layout->addWidget( tabwidget ); tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); tabwidget->setCurrentTab( tr( "Servers" ) ); dataMgr = dataManager; setupData(); changed = false; newserver = false; newdestination = false; } SettingsImpl :: ~SettingsImpl() { } bool SettingsImpl :: showDlg() { QPEApplication::execDialog( this ); if ( changed ) dataMgr->writeOutIpkgConf(); return changed; } QWidget *SettingsImpl :: initServerTab() { QWidget *control = new QWidget( this ); QVBoxLayout *vb = new QVBoxLayout( control ); QScrollView *sv = new QScrollView( control ); vb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QGridLayout *layout = new QGridLayout( container ); layout->setSpacing( 2 ); layout->setMargin( 4 ); servers = new QListBox( container ); servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); - connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) ); + connect( servers, SIGNAL( highlighted(int) ), this, SLOT( editServer(int) ) ); layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); layout->addWidget( btn, 1, 0 ); btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); layout->addWidget( btn, 1, 1 ); QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); grpbox->layout()->setSpacing( 2 ); grpbox->layout()->setMargin( 4 ); layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); QLabel *label = new QLabel( tr( "Name:" ), grpbox ); grplayout->addWidget( label, 0, 0 ); servername = new QLineEdit( grpbox ); grplayout->addWidget( servername, 0, 1 ); label = new QLabel( tr( "Address:" ), grpbox ); grplayout->addWidget( label, 1, 0 ); serverurl = new QLineEdit( grpbox ); grplayout->addWidget( serverurl, 1, 1 ); active = new QCheckBox( tr( "Active Server" ), grpbox ); grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); return control; } QWidget *SettingsImpl :: initDestinationTab() { QWidget *control = new QWidget( this ); QVBoxLayout *vb = new QVBoxLayout( control ); QScrollView *sv = new QScrollView( control ); vb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QGridLayout *layout = new QGridLayout( container ); layout->setSpacing( 2 ); layout->setMargin( 4 ); destinations = new QListBox( container ); destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); - connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) ); + connect( destinations, SIGNAL( highlighted(int) ), this, SLOT( editDestination(int) ) ); layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); layout->addWidget( btn, 1, 0 ); btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); layout->addWidget( btn, 1, 1 ); QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); grpbox->layout()->setSpacing( 2 ); grpbox->layout()->setMargin( 4 ); layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); QLabel *label = new QLabel( tr( "Name:" ), grpbox ); grplayout->addWidget( label, 0, 0 ); destinationname = new QLineEdit( grpbox ); grplayout->addWidget( destinationname, 0, 1 ); label = new QLabel( tr( "Location:" ), grpbox ); grplayout->addWidget( label, 1, 0 ); destinationurl = new QLineEdit( grpbox ); grplayout->addWidget( destinationurl, 1, 1 ); linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); return control; } QWidget *SettingsImpl :: initProxyTab() { QWidget *control = new QWidget( this ); QVBoxLayout *vb = new QVBoxLayout( control ); QScrollView *sv = new QScrollView( control ); vb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 977c283..6b83bc9 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp @@ -5,99 +5,99 @@ /* OPIE */ #include <opie2/ostorageinfo.h> #include <qpe/qpeapplication.h> /* 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> #include <qmessagebox.h> #include <qcombobox.h> #include <qlist.h> #include <stdlib.h> #include <qregexp.h> #include <qtextstream.h> #include <qtextview.h> /* STD */ #include <errno.h> #include <stdlib.h> #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 * )), + connect(backupList, SIGNAL(clicked(QListViewItem*)), this, SLOT(selectItem(QListViewItem*))); - connect(restoreSource, SIGNAL(activated( int )), + connect(restoreSource, SIGNAL(activated(int)), this, SLOT(sourceDirChanged(int))); connect(updateList, SIGNAL(clicked()), this, SLOT( fileListUpdate())); //add directorys for backing up applicationSettings = new QListViewItem(backupList, "Application Settings", "", "Settings/"); selectItem(applicationSettings); applicationSettings = new QListViewItem(backupList, "Application Data", "", "Applications/"); selectItem(applicationSettings); documents= new QListViewItem(backupList, "Documents", "", "Documents/"); selectItem(documents); scanForApplicationSettings(); OStorageInfo storage; backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); if ( storage.hasCf() ) { backupLocations.insert( "CF", storage.cfPath() ); qDebug( "Cf Path: " + storage.cfPath() ); } if ( storage.hasSd() ) { backupLocations.insert( "SD", storage.sdPath() ); qDebug( " Sd Path: " + storage.sdPath() ); } if ( storage.hasMmc() ) { backupLocations.insert( "MMC", storage.mmcPath() ); qDebug( "Mmc Path: " + storage.mmcPath() ); } 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 ) { storeToLocation->insertItem(it.key()); restoreSource->insertItem(it.key()); //check for last locations if ( it.key() == lastStoreLocation ) diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp index 7df41d4..c995d6e 100644 --- a/noncore/settings/netsystemtime/mainwindow.cpp +++ b/noncore/settings/netsystemtime/mainwindow.cpp @@ -32,120 +32,120 @@ #include "settingstabwidget.h" #include "ntptabwidget.h" #include "predicttabwidget.h" #include <qpe/config.h> #include <qpe/datebookdb.h> #include <qpe/qpeapplication.h> #include <qpe/qpedialog.h> #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) #include <qpe/qcopenvelope_qws.h> #endif #include <qlayout.h> #include <qmessagebox.h> #include <qsocket.h> #include <qstring.h> #include <qtimer.h> MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f ) : QDialog( 0x0, 0x0, TRUE, 0 ) { setCaption( tr( "SystemTime" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); layout->setMargin( 2 ); layout->setSpacing( 4 ); // Create main tabbed control mainWidget = new OTabWidget( this ); // Default object pointers to null ntpProcess = 0x0; ntpTab = 0x0; // Add tab widgets mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) ); mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) ); mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) ); mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) ); Config config( "ntp" ); config.setGroup( "settings" ); slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", FALSE ) ); slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", FALSE ) ); mainWidget->setCurrentTab( tr( "Time" ) ); layout->addWidget( mainWidget ); - connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), - this, SLOT(slotQCopReceive(const QCString&, const QByteArray&)) ); + connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), + this, SLOT(slotQCopReceive(const QCString&,const QByteArray&)) ); // Create NTP socket ntpSock = new QSocket( this ); connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) ); slotProbeNTPServer(); // Create timer for automatic time lookups ntpTimer = new QTimer( this ); // Connect everything together connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) ); - connect( timeTab, SIGNAL(tzChanged(const QString &)), predictTab, SLOT(slotTZChanged(const QString &)) ); + connect( timeTab, SIGNAL(tzChanged(const QString&)), predictTab, SLOT(slotTZChanged(const QString&)) ); connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) ); - connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime( int )) ); - connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat &)), - timeTab, SLOT(slotDateFormatChanged(const DateFormat &)) ); + connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime(int)) ); + connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat&)), + timeTab, SLOT(slotDateFormatChanged(const DateFormat&)) ); connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) ); connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) ); connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) ); connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) ); - connect( predictTab, SIGNAL(setTime(const QDateTime &)), this, SLOT(slotSetTime(const QDateTime &)) ); + connect( predictTab, SIGNAL(setTime(const QDateTime&)), this, SLOT(slotSetTime(const QDateTime&)) ); // Do initial time server check slotNTPDelayChanged( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); slotCheckNtp( -1 ); // Display app //showMaximized(); (void)new QPEDialogListener(this); } MainWindow::~MainWindow() { if ( ntpProcess ) delete ntpProcess; } void MainWindow::accept() { // Turn off the screensaver (Note: needs to be encased in { } so that it deconstructs and sends) { QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); disableScreenSaver << 0 << 0 << 0; } // Update the systemtime timeTab->saveSettings( TRUE ); // Save format options formatTab->saveSettings( TRUE ); // Save settings options settingsTab->saveSettings(); // Since time has changed quickly load in the DateBookDB to allow the alarm server to get a better // grip on itself (example re-trigger alarms for when we travel back in time). DateBookDB db; // Turn back on the screensaver QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); enableScreenSaver << -1 << -1 << -1; // Exit app qApp->quit(); } void MainWindow::reject() { // Reset time settings diff --git a/noncore/settings/netsystemtime/settingstabwidget.cpp b/noncore/settings/netsystemtime/settingstabwidget.cpp index 2a7e28d..ad80e05 100644 --- a/noncore/settings/netsystemtime/settingstabwidget.cpp +++ b/noncore/settings/netsystemtime/settingstabwidget.cpp @@ -33,102 +33,102 @@ #include <qcheckbox.h> #include <qcombobox.h> #include <qlabel.h> #include <qlayout.h> #include <qscrollview.h> #include <qspinbox.h> SettingsTabWidget::SettingsTabWidget( QWidget *parent ) : QWidget( parent, 0x0, 0 ) { QVBoxLayout *tmpvb = new QVBoxLayout( this ); QScrollView *sv = new QScrollView( this ); tmpvb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QGridLayout *layout = new QGridLayout( container ); layout->setMargin( 2 ); layout->setSpacing( 4 ); // Time server selector layout->addWidget( new QLabel( tr( "Time server" ), container ), 0, 0 ); cbTimeServer = new QComboBox( TRUE, container ); layout->addMultiCellWidget( cbTimeServer, 1, 1, 0, 1 ); // Lookup delay selector layout->addWidget( new QLabel( tr( "minutes between time updates" ), container ), 2, 1 ); sbNtpDelay = new QSpinBox( 1, 9999999, 1, container ); sbNtpDelay->setWrapping( TRUE ); sbNtpDelay->setMaximumWidth( 50 ); connect( sbNtpDelay, SIGNAL(valueChanged(int)), this, SIGNAL(ntpDelayChanged(int)) ); layout->addWidget( sbNtpDelay, 2, 0 ); // Prediction delay selector layout->addWidget( new QLabel( tr( "minutes between prediction updates" ), container ), 3, 1 ); sbPredictDelay = new QSpinBox( 42, 9999999, 1, container ); sbPredictDelay->setWrapping( TRUE ); sbPredictDelay->setMaximumWidth( 50 ); layout->addWidget( sbPredictDelay, 3, 0 ); // Space filler layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 4, 0 ); // Display time server information selector chNtpTab = new QCheckBox( tr( "Display time server information" ), container ); - connect( chNtpTab, SIGNAL( toggled( bool ) ), this, SIGNAL( displayNTPTab( bool ) ) ); + connect( chNtpTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayNTPTab(bool) ) ); layout->addMultiCellWidget( chNtpTab, 5, 5, 0, 1 ); // Display time prediction information selector chPredictTab = new QCheckBox( tr( "Display time prediction information" ), container ); - connect( chPredictTab, SIGNAL( toggled( bool ) ), this, SIGNAL( displayPredictTab( bool ) ) ); + connect( chPredictTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayPredictTab(bool) ) ); layout->addMultiCellWidget( chPredictTab, 6, 6, 0, 1 ); // Space filler layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 ); // Initialize values QString ntpSrvsFile = QPEApplication::qpeDir(); ntpSrvsFile.append( "etc/ntpservers" ); Config ntpSrvs( ntpSrvsFile, Config::File ); ntpSrvs.setGroup( "servers" ); int srvCount = ntpSrvs.readNumEntry( "count", 0 ); for ( int i = 0; i < srvCount; i++ ) { ntpSrvs.setGroup( QString::number( i ) ); cbTimeServer->insertItem( ntpSrvs.readEntry( "name" ) ); } if ( srvCount==0 ) cbTimeServer->insertItem( "time.fu-berlin.de" ); Config config( "ntp" ); config.setGroup( "settings" ); sbPredictDelay->setValue( config.readNumEntry( "minLookupDiff", 720 ) ); sbNtpDelay->setValue( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); cbTimeServer->setCurrentItem( config.readNumEntry( "ntpServer", 0 ) ); chNtpTab->setChecked( config.readBoolEntry( "displayNtpTab", FALSE ) ); chPredictTab->setChecked( config.readBoolEntry( "displayPredictTab", FALSE ) ); } SettingsTabWidget::~SettingsTabWidget() { } void SettingsTabWidget::saveSettings() { int srvCount = cbTimeServer->count(); bool serversChanged = TRUE; int curSrv = cbTimeServer->currentItem(); QString edit = cbTimeServer->currentText(); for ( int i = 0; i < srvCount; i++ ) { if ( edit == cbTimeServer->text( i ) ) serversChanged = FALSE; } if ( serversChanged ) { QString ntpSrvsFile = QPEApplication::qpeDir(); ntpSrvsFile.append( "etc/ntpservers" ); Config ntpSrvs( ntpSrvsFile, Config::File ); diff --git a/noncore/settings/netsystemtime/timetabwidget.cpp b/noncore/settings/netsystemtime/timetabwidget.cpp index 6f24462..1ea460e 100644 --- a/noncore/settings/netsystemtime/timetabwidget.cpp +++ b/noncore/settings/netsystemtime/timetabwidget.cpp @@ -57,97 +57,97 @@ TimeTabWidget::TimeTabWidget( QWidget *parent ) : QWidget( parent, 0x0, 0 ) { // Synchronize HW clock to systemtime // This app will update systemtime // - if Cancel is clicked, will reset systemtime to HW clock's time // - if Ok is clicked, will leave systemtime as is system("/sbin/hwclock --systohc --utc"); QVBoxLayout *tmpvb = new QVBoxLayout( this ); QScrollView *sv = new QScrollView( this ); tmpvb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QGridLayout *layout = new QGridLayout( container ); layout->setMargin( 2 ); layout->setSpacing( 4 ); // Hours layout->addMultiCellWidget( new QLabel( tr( "Hour" ), container ), 1, 1, 0, 1 ); sbHour = new QSpinBox( container ); sbHour->setWrapping( TRUE ); layout->addMultiCellWidget( sbHour, 2, 2, 0, 1 ); // Minutes layout->addMultiCellWidget( new QLabel( tr( "Minute" ), container ), 1, 1, 2, 3 ); sbMin = new QSpinBox( container ); sbMin->setWrapping( TRUE ); sbMin->setMinValue( 0 ); sbMin->setMaxValue( 59 ); layout->addMultiCellWidget( sbMin, 2, 2, 2, 3 ); // AM/PM cbAmpm = new QComboBox( container ); cbAmpm->insertItem( tr( "AM" ), ValueAM ); cbAmpm->insertItem( tr( "PM" ), ValuePM ); layout->addMultiCellWidget( cbAmpm, 2, 2, 4, 5 ); // Date layout->addWidget( new QLabel( tr( "Date" ), container ), 4, 0 ); btnDate = new DateButton( TRUE, container ); layout->addMultiCellWidget( btnDate, 4, 4, 1, 5 ); // Timezone layout->addMultiCellWidget( new QLabel( tr( "Time zone" ), container ), 6, 6, 0, 1 ); selTimeZone = new TimeZoneSelector( container ); - connect( selTimeZone, SIGNAL(signalNewTz(const QString &)), this, SLOT(slotTZChanged(const QString &)) ); + connect( selTimeZone, SIGNAL(signalNewTz(const QString&)), this, SLOT(slotTZChanged(const QString&)) ); layout->addMultiCellWidget( selTimeZone, 6, 6, 2, 5 ); // Space filler layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 ); // Set NTP time button QPushButton *pb = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ), tr( "Get time from the network" ), container ); connect( pb, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) ); layout->addMultiCellWidget( pb, 8, 8, 0, 5 ); // Set predicted time button pb = new QPushButton( Resource::loadPixmap( "netsystemtime/predicttab" ), tr( "Set predicted time" ), container ); connect( pb, SIGNAL(clicked()), this, SIGNAL(getPredictedTime()) ); layout->addMultiCellWidget( pb, 9, 9, 0, 5 ); // Space filler at bottom of widget layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 10, 0 ); // Initialize values Config config( "locale" ); config.setGroup( "Location" ); selTimeZone->setCurrentZone( config.readEntry( "Timezone", "America/New_York" ) ); use12HourTime = FALSE; setDateTime( QDateTime::currentDateTime() ); } TimeTabWidget::~TimeTabWidget() { } void TimeTabWidget::saveSettings( bool commit ) { if ( commit ) { // Set timezone and announce to world QString tz = selTimeZone->currentZone(); Config config("locale"); config.setGroup( "Location" ); config.writeEntry( "Timezone", tz ); setenv( "TZ", tz, 1 ); QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); setTimeZone << tz; // If controls have a valid date & time, update systemtime int hour = sbHour->value(); if ( use12HourTime && cbAmpm->currentItem() == ValuePM ) diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp index 698dfd3..ff65424 100644 --- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp @@ -1,77 +1,77 @@ #include "interfaceinformationimp.h" #include "interfaceadvanced.h" /* OPIE */ #include <qpe/config.h> #include <qpe/qpeapplication.h> /* QT */ #include <qcheckbox.h> #include <qpushbutton.h> #include <qlabel.h> #include <qgroupbox.h> #include <qmessagebox.h> #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. */ InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i) { - connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); - connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); + connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*))); + connect(i, SIGNAL(updateMessage(const QString&)), this, SLOT(showMessage(const QString&))); updateInterface(interface); connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); Config cfg("networksettings", Config::User); cfg.setGroup("interface"); CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) ); } InterfaceInformationImp::~InterfaceInformationImp() { Config cfg("networksettings", Config::User); cfg.setGroup("interface"); cfg.writeEntry("silent", CheckBoxSilent->isChecked() ); } /** * Update the interface information and buttons. * @param Intarface *i the interface to update (should be the one we already * know about). */ void InterfaceInformationImp::updateInterface(Interface *) { if(interface->getStatus()) { startButton->setEnabled(false); stopButton->setEnabled(true); restartButton->setEnabled(true); } else { startButton->setEnabled(true); stopButton->setEnabled(false); restartButton->setEnabled(false); } macAddressLabel->setText(interface->getMacAddress()); ipAddressLabel->setText(interface->getIp()); subnetMaskLabel->setText(interface->getSubnetMask()); broadcastLabel->setText(interface->getBroadcast()); } /** * Create the advanced widget. Fill it with the current interface's information. * Display it. */ void InterfaceInformationImp::advanced() diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index b0a1dd9..1e16b97 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp @@ -52,97 +52,97 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); //FIXME: disable profiles for the moment: tabWidget->setTabEnabled( tab, false ); // Load connections. // /usr/local/kde/lib/libinterfaces.la #ifdef QWS loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); #else loader = KLibLoader::self(); loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); #endif getAllInterfaces(); 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"); continue; } bool found = false; for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) { if(it.key() == (*ni)) found = true; } if(!found) { if(!(*ni).contains("_")) { Interface *i = new Interface(this, *ni, false); i->setAttached(false); i->setHardwareName(tr("Disconnected")); interfaceNames.insert(i->getInterfaceName(), i); updateInterface(i); - connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); + connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*))); } } } //getInterfaceList(); connectionList->header()->hide(); Config cfg("NetworkSetup"); profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) profilesList->insertItem((*it)); currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); QFile file(scheme); if ( file.open(IO_ReadOnly) ) { // file opened successfully QTextStream stream( &file ); // use a text stream while ( !stream.eof() ) { // until end of file... QString line = stream.readLine(); // line of text excluding '\n' if(line.contains("SCHEME")) { line = line.mid(7, line.length()); currentProfileLabel->setText(line); break; } } file.close(); } makeChannel(); } /** * Deconstructor. Save profiles. Delete loaded libraries. */ MainWindowImp::~MainWindowImp() { // Save profiles. Config cfg("NetworkSetup"); cfg.setGroup("General"); cfg.writeEntry("Profiles", profiles.join(" ")); // Delete all interfaces that don't have owners. QMap<Interface*, QListViewItem*>::Iterator iIt; for( iIt = items.begin(); iIt != items.end(); ++iIt ) @@ -207,114 +207,114 @@ void MainWindowImp::getAllInterfaces() procTs.readLine(); // eat a line while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) { 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() ); 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); i->setAttached(true); if ((flags & IFF_UP) == IFF_UP) i->setStatus(true); else i->setStatus(false); 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); interfaceNames.insert(i->getInterfaceName(), i); updateInterface(i); - connect(i, SIGNAL(updateInterface(Interface *)), - this, SLOT(updateInterface(Interface *))); + 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() ); interfaceNames.insert(i->getInterfaceName(), i); updateInterface(i); - connect(i, SIGNAL(updateInterface(Interface *)), - this, SLOT(updateInterface(Interface *))); + 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()); #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()); } ++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) { @@ -667,82 +667,82 @@ void MainWindowImp::removeProfile() break; } } } } /** * A new profile has been selected, change. * @param newProfile the new profile. */ void MainWindowImp::changeProfile() { if(profilesList->currentItem() == -1) { QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok); return; } QString newProfile = profilesList->text(profilesList->currentItem()); if(newProfile != currentProfileLabel->text()) { currentProfileLabel->setText(newProfile); QFile::remove(scheme); QFile file(scheme); if ( file.open(IO_ReadWrite) ) { QTextStream stream( &file ); stream << QString("SCHEME=%1").arg(newProfile); file.close(); } // restart all up devices? if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok) { // Go through them one by one QMap<Interface*, QListViewItem*>::Iterator it; for( it = items.begin(); it != items.end(); ++it ) { if(it.key()->getStatus() == true) it.key()->restart(); } } } // TODO change the profile in the modules } 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&)) ); + 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+"<"); 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()); QMap<Module*, QLibrary*>::Iterator it; for( it = libraries.begin(); it != libraries.end(); ++it ) { qDebug("plugin >%s<", it.key()->type().latin1() ); if(it.key()->type() == dest) { it.key()->receive( param, arg ); found = true; } } if (found) QPEApplication::setKeepRunning(); else qDebug("Huh what do ya want"); } diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index 7d21605..3b2393c 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp @@ -527,98 +527,98 @@ void IPWidget::hitIPSelect( int i ) DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) : QWidget(parent, name), _pppdata(pd) { QGridLayout *tl = new QGridLayout(this, 7, 2, 0 ); dnsdomain_label = new QLabel(tr("Domain name:"), this); tl->addWidget(dnsdomain_label, 0, 0); dnsdomain = new QLineEdit(this); tl->addWidget(dnsdomain, 0, 1); QString tmp = tr("If you enter a domain name here, this domain\n" "name is used for your computer while you are\n" "connected. When the connection is closed, the\n" "original domain name of your computer is\n" "restored.\n" "\n" "If you leave this field blank, no changes are\n" "made to the domain name."); QWhatsThis::add(dnsdomain_label,tmp); QWhatsThis::add(dnsdomain,tmp); conf_label = new QLabel(tr("Configuration:"), this); tl->addWidget(conf_label, 1, 0); bg = new QButtonGroup("Group", this); connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int))); bg->hide(); autodns = new QRadioButton(tr("Automatic"), this); bg->insert(autodns, 0); tl->addWidget(autodns, 1, 1); if(!_pppdata->pppdVersionMin(2, 3, 7)) autodns->setEnabled(false); mandns = new QRadioButton(tr("Manual"), this); bg->insert(mandns, 1); tl->addWidget(mandns, 2, 1); dns_label = new QLabel(tr("DNS IP address:"), this); tl->addWidget(dns_label, 3, 0); QHBoxLayout *l2 = new QHBoxLayout; tl->addLayout(l2, 3, 1); dnsipaddr = new IPLineEdit(this); connect(dnsipaddr, SIGNAL(returnPressed()), SLOT(adddns())); - connect(dnsipaddr, SIGNAL(textChanged(const QString &)), - SLOT(DNS_Edit_Changed(const QString &))); + connect(dnsipaddr, SIGNAL(textChanged(const QString&)), + SLOT(DNS_Edit_Changed(const QString&))); l2->addWidget(dnsipaddr, 1); l2->addStretch(1); tmp = tr("<p>Allows you to specify a new DNS server to be\n" "used while you are connected. When the\n" "connection is closed, this DNS entry will be\n" "removed again.\n" "\n" "To add a DNS server, type in the IP address of\n" "the DNS server here and click on <b>Add</b>"); QWhatsThis::add(dns_label, tmp); QWhatsThis::add(dnsipaddr, tmp); QHBoxLayout *l1 = new QHBoxLayout; tl->addLayout(l1, 4, 1); add = new QPushButton(tr("Add"), this); connect(add, SIGNAL(clicked()), SLOT(adddns())); l1->addWidget(add); // l1->addStretch(1); QWhatsThis::add(add, tr("Click this button to add the DNS server\n" "specified in the field above. The entry\n" "will then be added to the list below")); remove = new QPushButton(tr("Remove"), this); connect(remove, SIGNAL(clicked()), SLOT(removedns())); l1->addWidget(remove); QWhatsThis::add(remove, tr("Click this button to remove the selected DNS\n" "server entry from the list below")); servers_label = new QLabel(tr("DNS address list:"), this); servers_label->setAlignment(AlignTop|AlignLeft); tl->addWidget(servers_label, 5, 0); dnsservers = new QListBox(this); dnsservers->setMinimumSize(150, 80); connect(dnsservers, SIGNAL(highlighted(int)), SLOT(DNS_Entry_Selected(int))); tl->addWidget(dnsservers, 5, 1); tmp = tr("<p>This shows all defined DNS servers to use\n" "while you are connected. Use the <b>Add</b> and\n" "<b>Remove</b> buttons to modify the list"); QWhatsThis::add(servers_label,tmp); QWhatsThis::add(dnsservers,tmp); exdnsdisabled_toggle = new QCheckBox(tr("Disable DNS servers during connection"), this); @@ -1139,73 +1139,73 @@ void ScriptWidget::insertButton() break; } adjustScrollBar(); se->setText(""); } void ScriptWidget::removeButton() { if(sl->currentItem() >= 0) { int stlc = stl->currentItem(); sl->removeItem(sl->currentItem()); stl->removeItem(stlc); adjustScrollBar(); insert->setEnabled(sl->currentItem() != -1); remove->setEnabled(sl->currentItem() != -1); } } ///////////////////////////////////////////////////////////////////////////// // // Used to specify a new phone number // ///////////////////////////////////////////////////////////////////////////// PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) : QDialog(parent,"PhoneNumberDialog",true) { setCaption( tr("Add Phone Number") ); QVBoxLayout *layout = new QVBoxLayout( this ); layout->setSpacing( 3 ); layout->setMargin( 3 ); // QHBox *hbox = new QHBox(this); // setMainWidget(hbox); // hbox->setSpacing( 2 );//KDialog::spacingHint()); QLabel *label = new QLabel(this, tr("Enter a phone number:")); layout->addWidget( label ); le = new QLineEdit(this, "lineEdit"); layout->addWidget( le ); - connect(le, SIGNAL(textChanged(const QString &)), - this, SLOT(textChanged(const QString &))); + connect(le, SIGNAL(textChanged(const QString&)), + this, SLOT(textChanged(const QString&))); le->setFocus(); textChanged(""); } QString PhoneNumberDialog::phoneNumber() { QString s = le->text(); return s; } void PhoneNumberDialog::textChanged(const QString &s) { // enableButtonOK(s.length() > 0); } //#include "edit.moc" diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp index ff1b11b..81dab38 100644 --- a/noncore/settings/networksettings/ppp/general.cpp +++ b/noncore/settings/networksettings/ppp/general.cpp @@ -39,98 +39,98 @@ #include <qcombobox.h> #include <qlabel.h> #include <qlayout.h> #include <qpushbutton.h> #include <qslider.h> #include <qspinbox.h> #include <qwhatsthis.h> /* STD */ #include <termios.h> #include <string.h> ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) : QWidget(parent, name), _pppdata(pd) { int k; QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); QLabel *label1; label1 = new QLabel(tr("Modem &name:"), this); tl->addWidget(label1, 0, 0); modemname = new QLineEdit(this, "modemName"); modemname->setText( _pppdata->devname() ); label1->setBuddy(modemname); tl->addWidget(modemname, 0, 1); label1 = new QLabel(tr("Modem de&vice:"), this); tl->addWidget(label1, 1, 0); modemdevice = new QComboBox(false, this); modemdevice->setEditable( true ); modemdevice->setDuplicatesEnabled ( false ); modemdevice->setInsertionPolicy( QComboBox::AtTop ); label1->setBuddy(modemdevice); Config cfg("NetworkSetupPPP"); cfg.setGroup("Devices_General"); QStringList devs = cfg.readListEntry("devices",','); if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0"; modemdevice->insertStringList( devs ); tl->addWidget(modemdevice, 1, 1); // connect(modemdevice, SIGNAL(activated(int)), // SLOT(setmodemdc(int))); - // connect(modemdevice, SIGNAL(textChanged( const QString & ) ), - // SLOT( setmodemdc( const QString &) ) ); + // connect(modemdevice, SIGNAL(textChanged(const QString&) ), + // SLOT( setmodemdc(const QString&) ) ); QString tmp = tr("This specifies the serial port your modem is attached \n" "to. On Linux/x86, typically this is either /dev/ttyS0 \n" "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n" "\n" "If you have an internal ISDN card with AT command\n" "emulation (most cards under Linux support this), you\n" "should select one of the /dev/ttyIx devices."); QWhatsThis::add(label1,tmp); QWhatsThis::add(modemdevice,tmp); label1 = new QLabel(tr("&Flow control:"), this); tl->addWidget(label1, 2, 0); flowcontrol = new QComboBox(false, this); label1->setBuddy(flowcontrol); flowcontrol->insertItem(tr("Hardware [CRTSCTS]")); flowcontrol->insertItem(tr("Software [XON/XOFF]")); flowcontrol->insertItem(tr("None")); tl->addWidget(flowcontrol, 2, 1); // connect(flowcontrol, SIGNAL(activated(int)), // SLOT(setflowcontrol(int))); tmp = tr("<p>Specifies how the serial port and modem\n" "communicate. You should not change this unless\n" "you know what you are doing.\n" "\n" "<b>Default</b>: CRTSCTS"); QWhatsThis::add(label1,tmp); QWhatsThis::add(flowcontrol,tmp); QLabel *labelenter = new QLabel(tr("&Line termination:"), this); tl->addWidget(labelenter, 3, 0); enter = new QComboBox(false, this); labelenter->setBuddy(enter); enter->insertItem("CR"); enter->insertItem("LF"); enter->insertItem("CR/LF"); tl->addWidget(enter, 3, 1); // connect(enter, SIGNAL(activated(int)), SLOT(setenter(int))); tmp = tr("<p>Specifies how AT commands are sent to your\n" "modem. Most modems will work fine with the\n" "default <i>CR/LF</i>. If your modem does not react\n" "to the init string, you should try different\n" diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp index e466358..e21bbc7 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.cpp +++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp @@ -351,101 +351,101 @@ void KPPPWidget::shutDown() { interruptConnection(); saveMyself(); } void KPPPWidget::log_window_toggled(bool on) { _pppdata->set_show_log_window(on); } // void KPPPWidget::resetaccounts() { // connectto_c->clear(); // int count = _pppdata->count(); // // enable/disable controls // connectto_c->setEnabled(count > 0); // connect_b->setEnabled(count > 0); // log->setEnabled(count > 0); // ID_Edit->setEnabled(count > 0); // PW_Edit->setEnabled(count > 0); // //load the accounts // for(int i=0; i < count; i++) { // _pppdata->setAccountbyIndex(i); // connectto_c->insertItem(_pppdata->accname()); // } // //set the default account // if(!_pppdata->defaultAccount().isEmpty()) { // for(int i=0; i < count; i++) // if(_pppdata->defaultAccount() == connectto_c->text(i)) { // connectto_c->setCurrentItem(i); // _pppdata->setAccountbyIndex(i); // ID_Edit->setText(_pppdata->storedUsername()); // PW_Edit->setText(_pppdata->storedPassword()); // } // } // else // if(count > 0) { // _pppdata->setDefaultAccount(connectto_c->text(0)); // _pppdata->save(); // ID_Edit->setText(_pppdata->storedUsername()); // PW_Edit->setText(_pppdata->storedPassword()); // } -// connect(ID_Edit, SIGNAL(textChanged(const QString &)), -// this, SLOT(usernameChanged(const QString &))); +// connect(ID_Edit, SIGNAL(textChanged(const QString&)), +// this, SLOT(usernameChanged(const QString&))); -// connect(PW_Edit, SIGNAL(textChanged(const QString &)), -// this, SLOT(passwordChanged(const QString &))); +// connect(PW_Edit, SIGNAL(textChanged(const QString&)), +// this, SLOT(passwordChanged(const QString&))); // if (ID_Edit->text().isEmpty()) // ID_Edit->setFocus(); // else if (PW_Edit->text().isEmpty()) // PW_Edit->setFocus(); // } void KPPPWidget::interruptConnection() { // interrupt dial up // if (con->isVisible()) emit con->cancelbutton(); // disconnect if online if (_pppdata->pppdRunning()) emit disconnect(); } void KPPPWidget::sigPPPDDied() { qDebug( "Received a SIGUSR1" ); // 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" ); // 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." ); QApplication::flushX(); execute_command(_pppdata->command_on_disconnect()); // stopAccounting(); con_win->stopClock(); @@ -676,98 +676,98 @@ void KPPPWidget::disconnect() { // void KPPPWidget::helpbutton() { // kapp->invokeHelp(); // } void KPPPWidget::quitbutton() { if(_pppdata->pppdRunning()) { int ok = QMessageBox::warning(this, QObject::tr("Exiting kPPP will close your PPP Session."), QObject::tr("Quit kPPP?")); if(ok == QMessageBox::Yes) { Modem::modem->killPPPDaemon(); QApplication::flushX(); execute_command(_pppdata->command_on_disconnect()); removedns(); Modem::modem->unlockdevice(); } } else { if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword()) _pppdata->setStoredPassword(""); } _pppdata->save(); qApp->quit(); } // void KPPPWidget::rulesetLoadError() { // QMessageBox::warning(this,"error", ruleset_load_errmsg); // } // void KPPPWidget::startAccounting() { // // volume accounting // stats->totalbytes = 0; // kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl; // // load the ruleset // if(!_pppdata->AcctEnabled()) // return; // QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile()); // // if(::access(d.data(), X_OK) != 0) // acct = new Accounting(this, stats); // // else // // acct = new ExecutableAccounting(this); // // connect to the accounting object -// connect(acct, SIGNAL(changed(QString, QString)), -// con_win, SLOT(slotAccounting(QString, QString))); +// connect(acct, SIGNAL(changed(QString,QString)), +// con_win, SLOT(slotAccounting(QString,QString))); // // if(!acct->loadRuleSet(_pppdata->accountingFile())) { // // QString s= QObject::tr("Can not load the accounting " // // "ruleset \"%1\"!").arg(_pppdata->accountingFile()); // // starting the messagebox with a timer will prevent us // // from blocking the calling function ConnectWidget::timerEvent // ruleset_load_errmsg = s; // QTimer::singleShot(0, this, SLOT(rulesetLoadError())); // return; // } // //else // // acct->slotStart(); // } // void KPPPWidget::stopAccounting() { // // store volume accounting // // if(stats->totalbytes != 0) // // _pppdata->setTotalBytes(stats->totalbytes); // if(!_pppdata->AcctEnabled()) // return; // // if(acct != 0) { // // acct->slotStop(); // // delete acct; // // acct = 0; // // } // } // void KPPPWidget::showStats() { // if(statdlg) { // statdlg->show(); // statdlg->raise(); // } // } void KPPPWidget::usernameChanged(const QString &) { // store username for later use _pppdata->setStoredUsername(ID_Edit->text()); } void KPPPWidget::passwordChanged(const QString &) { // store the password if so requested if(_pppdata->storePassword()) diff --git a/noncore/settings/networksettings/ppp/pppdargs.cpp b/noncore/settings/networksettings/ppp/pppdargs.cpp index 66a4d82..d6d8d88 100644 --- a/noncore/settings/networksettings/ppp/pppdargs.cpp +++ b/noncore/settings/networksettings/ppp/pppdargs.cpp @@ -10,98 +10,98 @@ * Copyright (C) 1997 Jay Painter * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * 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 program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <qlayout.h> #include <qbuttongroup.h> #include <qapplication.h> #include "pppdargs.h" #include "pppdata.h" PPPdArguments::PPPdArguments( PPPData *pd, QWidget *parent, const char *name) : QDialog(parent, name, TRUE), _pppdata(pd) { setCaption(tr("Customize pppd Arguments")); // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); QVBoxLayout *l = new QVBoxLayout(this, 10, 10); QHBoxLayout *tl = new QHBoxLayout(10); l->addLayout(tl); QVBoxLayout *l1 = new QVBoxLayout(); QVBoxLayout *l2 = new QVBoxLayout(); tl->addLayout(l1, 1); tl->addLayout(l2, 0); QHBoxLayout *l11 = new QHBoxLayout(10); l1->addLayout(l11); argument_label = new QLabel(tr("Argument:"), this); l11->addWidget(argument_label); argument = new QLineEdit(this); connect(argument, SIGNAL(returnPressed()), SLOT(addbutton())); l11->addWidget(argument); - connect(argument, SIGNAL(textChanged(const QString &)), - this, SLOT(textChanged(const QString &))); + connect(argument, SIGNAL(textChanged(const QString&)), + this, SLOT(textChanged(const QString&))); arguments = new QListBox(this); arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10); connect(arguments, SIGNAL(highlighted(int)), this, SLOT(itemSelected(int))); l1->addWidget(arguments, 1); add = new QPushButton(tr("Add"), this); connect(add, SIGNAL(clicked()), SLOT(addbutton())); l2->addWidget(add); l2->addStretch(1); remove = new QPushButton(tr("Remove"), this); connect(remove, SIGNAL(clicked()), SLOT(removebutton())); l2->addWidget(remove); defaults = new QPushButton(tr("Defaults"), this); connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton())); l2->addWidget(defaults); l->addSpacing(5); //load info from gpppdata init(); add->setEnabled(false); remove->setEnabled(false); argument->setFocus(); } void PPPdArguments::addbutton() { if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) { arguments->insertItem(argument->text()); argument->setText(""); } } void PPPdArguments::removebutton() { if(arguments->currentItem() >= 0) arguments->removeItem(arguments->currentItem()); } void PPPdArguments::defaultsbutton() { // all of this is a hack diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp index 92339d6..dd1db28 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp @@ -9,97 +9,97 @@ #include <string.h> #include <qapplication.h> #include <qfile.h> #include <qdir.h> #include <qdialog.h> #include <qtextstream.h> #include <qmessagebox.h> #include <qlineedit.h> #include <qlabel.h> #include <qspinbox.h> #include <qradiobutton.h> #include <qpushbutton.h> #include <qcheckbox.h> #include <qtabwidget.h> #include <qcombobox.h> #include <qlistview.h> #include <qvbox.h> #include <qprogressbar.h> #ifdef QWS #include <qpe/resource.h> #include <opie2/oprocess.h> #include <opie2/onetwork.h> #include <opie2/opcap.h> #else #define OProcess KProcess #include <kprocess.h> #endif #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" #define PREUP "/etc/network/if-pre-up.d/wireless-tools" /** * Constructor, read in the wireless.opts file for parsing later. */ 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")); } connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); - connect( netView, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectNetwork( QListViewItem* ) ) ); + 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; } /** * Change the profile for both wireless settings and network settings. */ void WLANImp::setProfile(const QString &profile){ interfaceSetup->setProfile(profile); parseOpts(); } void WLANImp::parseOpts() { bool error; QString opt; if (! interfaces->isInterfaceSet()) return; opt = interfaces->getInterfaceOption("wireless_essid", error); if(opt == "any" || opt == "off" || opt.isNull()){ essid->setEditText("any"); } else { essid->setEditText(opt); } opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace(); for ( int i = 0; i < mode->count(); i++) if ( mode->text( i ) == opt ) mode->setCurrentItem( i ); opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace(); if (! opt.isNull()) { specifyAp->setChecked(true); macEdit->setText(opt); } opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace(); if (! opt.isNull()) { specifyChan->setChecked(true); networkChannel->setValue(opt.toInt()); diff --git a/noncore/settings/packagemanager/filterdlg.cpp b/noncore/settings/packagemanager/filterdlg.cpp index 0da9d19..eeed398 100644 --- a/noncore/settings/packagemanager/filterdlg.cpp +++ b/noncore/settings/packagemanager/filterdlg.cpp @@ -23,97 +23,97 @@ -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "filterdlg.h" FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name, const QString &server, const QString &destination, OPackageManager::Status status, const QString &category ) : QDialog( parent, QString::null, true ) { setCaption( tr( "Filter packages" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); QScrollView *sv = new QScrollView( this ); layout->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); layout = new QVBoxLayout( container, 4, 4 ); // Category m_categoryCB = new QCheckBox( tr( "Category:" ), container ); connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) ); m_category = new QComboBox( container ); m_category->insertStringList( pm->categories() ); initItem( m_category, m_categoryCB, category ); layout->addWidget( m_categoryCB ); layout->addWidget( m_category ); // Package name m_nameCB = new QCheckBox( tr( "Names containing:" ), container ); connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) ); m_name = new QLineEdit( name, container ); if ( !name.isNull() ) m_nameCB->setChecked( true ); m_name->setEnabled( !name.isNull() ); layout->addWidget( m_nameCB ); layout->addWidget( m_name ); // Status m_statusCB = new QCheckBox( tr( "With the status:" ), container ); connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) ); m_status = new QComboBox( container ); - connect( m_status, SIGNAL(activated(const QString &)), this, SLOT(slotStatusChanged(const QString &)) ); + connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) ); QString currStatus; switch ( status ) { case OPackageManager::All : currStatus = tr( "All" ); break; case OPackageManager::Installed : currStatus = tr( "Installed" ); break; case OPackageManager::NotInstalled : currStatus = tr( "Not installed" ); break; case OPackageManager::Updated : currStatus = tr( "Updated" ); break; default : currStatus = QString::null; }; m_status->insertItem( tr( "All" ) ); m_status->insertItem( tr( "Installed" ) ); m_status->insertItem( tr( "Not installed" ) ); m_status->insertItem( tr( "Updated" ) ); initItem( m_status, m_statusCB, currStatus ); layout->addWidget( m_statusCB ); layout->addWidget( m_status ); // Server m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container ); connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) ); m_server = new QComboBox( container ); m_server->insertStringList( *(pm->servers()) ); initItem( m_server, m_serverCB, server ); layout->addWidget( m_serverCB ); layout->addWidget( m_server ); // Destination m_destCB = new QCheckBox( tr( "Installed on device at:" ), container ); connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) ); m_destination = new QComboBox( container ); m_destination->insertStringList( *(pm->destinations()) ); initItem( m_destination, m_destCB, destination ); layout->addWidget( m_destCB ); layout->addWidget( m_destination ); //showMaximized(); } void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ) { if ( !selection.isNull() ) { checkBox->setChecked( true ); diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 8fd960f..b334bca 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp @@ -73,130 +73,130 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) { // setCaption( tr( "Package Manager" ) ); m_iconNull.fill( colorGroup().base() ); connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); // Initialize widget stack, package list and status widget initStatusWidget(); initPackageList(); m_widgetStack.addWidget( &m_statusWidget, 2 ); m_widgetStack.addWidget( &m_packageList, 1 ); setCentralWidget( &m_widgetStack ); // Initialize remaining user interface items initUI(); // Initialize package information QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); } void MainWindow::closeEvent( QCloseEvent *event ) { // Close app only if either the package or status widgets are currently active bool close = m_widgetStack.visibleWidget() == &m_packageList || m_widgetStack.visibleWidget() == &m_statusWidget; if ( close ) { // TODO - write out application configuration settings // Write out package manager configuration settings m_packman.saveSettings(); event->accept(); } else { delete m_widgetStack.visibleWidget(); m_widgetStack.raiseWidget( &m_packageList ); event->ignore(); } } void MainWindow::initPackageList() { m_packageList.addColumn( tr( "Packages" ) ); QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); - connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), - this, SLOT(slotDisplayPackageInfo(QListViewItem *)) ); + connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), + this, SLOT(slotDisplayPackageInfo(QListViewItem*)) ); } void MainWindow::initStatusWidget() { QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); layout->addWidget( &m_statusText ); connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); - connect( &m_packman, SIGNAL(statusText(const QString &)), this, SLOT(slotStatusText(const QString &)) ); + connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) ); connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); layout->addWidget( &m_statusBar ); } void MainWindow::initUI() { // Build menu and tool bars setToolBarsMovable( false ); m_menuBar.setHorizontalStretchable( true ); QMenuBar *mb = new QMenuBar( &m_menuBar ); mb->setMargin( 0 ); // Find toolbar addToolBar( &m_findBar, QMainWindow::Top, true ); m_findBar.setHorizontalStretchable( true ); m_findEdit = new QLineEdit( &m_findBar ); QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); m_findBar.setStretchableWidget( m_findEdit ); - connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) ); + connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) ); // Packages menu QPopupMenu *popup = new QPopupMenu( this ); QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); a->addTo( popup ); a->addTo( &m_toolBar ); QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); actionUpgrade->addTo( popup ); actionUpgrade->addTo( &m_toolBar ); QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); actionDownload->addTo( popup ); actionDownload->addTo( &m_toolBar ); a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); a->addTo( popup ); a->addTo( &m_toolBar ); popup->insertSeparator(); a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to configure this application." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); a->addTo( popup ); mb->insertItem( tr( "Actions" ), popup ); // View menu popup = new QPopupMenu( this ); m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); m_actionShowNotInstalled->setToggleAction( true ); m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); m_actionShowNotInstalled->addTo( popup ); m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp index 086e91b..1dc23a4 100644 --- a/noncore/settings/packagemanager/oipkg.cpp +++ b/noncore/settings/packagemanager/oipkg.cpp @@ -271,146 +271,146 @@ OPackageList *OIpkg::installedPackages( const QString &destName, const QString & else if ( key.isEmpty() && value.isEmpty() ) newPackage = true; // Skip past all description lines if ( key == "Description" ) { line = t.readLine(); while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) line = t.readLine(); } else line = t.readLine(); } f.close(); return pl; } bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination, const QObject *receiver, const char *slotOutput, bool rawOutput ) { if ( command == OPackage::NotDefined ) return false; // Set ipkg run-time options/arguments m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); m_ipkgArgs.verbosity = m_ipkgExecVerbosity; if ( m_ipkgArgs.dest ) free( m_ipkgArgs.dest ); if ( !destination.isNull() ) { int len = destination.length() + 1; m_ipkgArgs.dest = (char *)malloc( len ); strncpy( m_ipkgArgs.dest, destination, destination.length() ); m_ipkgArgs.dest[ len - 1 ] = '\0'; } else m_ipkgArgs.dest = 0x0; // Connect output signal to widget if ( rawOutput ) { // if ( slotOutput ) -// connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); +// connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); } else { // TODO - connect to local slot and parse output before emitting signalIpkgMessage } switch( command ) { case OPackage::Update : { - connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); + connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); ipkg_lists_update( &m_ipkgArgs ); }; break; case OPackage::Upgrade : { - connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); + connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); ipkg_packages_upgrade( &m_ipkgArgs ); }; break; case OPackage::Install : { - connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); + connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) { ipkg_packages_install( &m_ipkgArgs, (*it) ); } }; break; case OPackage::Remove : { - connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); + connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) { ipkg_packages_remove( &m_ipkgArgs, (*it), true ); } }; break; case OPackage::Download : { - connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); + connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) { ipkg_packages_download( &m_ipkgArgs, (*it) ); } }; break; case OPackage::Info : { - connect( this, SIGNAL(signalIpkgStatus(char *)), receiver, slotOutput ); + connect( this, SIGNAL(signalIpkgStatus(char*)), receiver, slotOutput ); ipkg_packages_info( &m_ipkgArgs, (*parameters->begin()), &fIpkgStatus, 0x0 ); }; break; case OPackage::Files : { - connect( this, SIGNAL(signalIpkgList(char *)), receiver, slotOutput ); + connect( this, SIGNAL(signalIpkgList(char*)), receiver, slotOutput ); ipkg_package_files( &m_ipkgArgs, (*parameters->begin()), &fIpkgFiles, 0x0 ); }; break; default : break; }; return true; } void OIpkg::ipkgMessage( char *msg ) { emit signalIpkgMessage( msg ); } void OIpkg::ipkgStatus( char *status ) { emit signalIpkgStatus( status ); } void OIpkg::ipkgList( char *filelist ) { emit signalIpkgList( filelist ); } void OIpkg::loadConfiguration() { if ( m_confInfo ) delete m_confInfo; // Load configuration item list m_confInfo = new OConfItemList(); QStringList confFiles; QDir confDir( IPKG_CONF_DIR ); if ( confDir.exists() ) { confDir.setNameFilter( "*.conf" ); confDir.setFilter( QDir::Files ); confFiles = confDir.entryList( "*.conf", QDir::Files ); confFiles << IPKG_CONF; for ( QStringList::Iterator it = confFiles.begin(); it != confFiles.end(); ++it ) { // Create absolute file path if necessary QString absFile = (*it); if ( !absFile.startsWith( "/" ) ) absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index 4bc86fa..8ad0a3f 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp @@ -66,106 +66,106 @@ SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) //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"); systemZaurus=TRUE; } } if(!systemZaurus) { stereoCheckBox->setChecked(TRUE); } stereoCheckBox->setEnabled(FALSE); sixteenBitCheckBox->setEnabled(FALSE); #else #endif int sRate=cfg.readNumEntry("SizeLimit", 30); qDebug("%d",sRate); 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 timeLimitComboBox->setCurrentItem(5); sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); cfg.setGroup("Defaults"); keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); updateStorageCombo(); Config vmCfg("Vmemo"); vmCfg.setGroup("Defaults"); adpcmCheckBox->setChecked( vmCfg.readBoolEntry("use_ADPCM", 0)); - connect( LocationComboBox,SIGNAL(activated(const QString &)), this, - SLOT( setLocation(const QString &))); - connect( keyComboBox,SIGNAL(activated( int)), this, - SLOT( setKeyButton( int))); - connect( timeLimitComboBox,SIGNAL(activated( const QString &)), this, - SLOT( setSizeLimitButton(const QString &))); - connect( restartCheckBox,SIGNAL( toggled( bool)), this, - SLOT( restartOpie( bool))); - connect( adpcmCheckBox,SIGNAL( toggled( bool)), this, - SLOT( slotAdpcm( bool))); + connect( LocationComboBox,SIGNAL(activated(const QString&)), this, + SLOT( setLocation(const QString&))); + connect( keyComboBox,SIGNAL(activated(int)), this, + SLOT( setKeyButton(int))); + connect( timeLimitComboBox,SIGNAL(activated(const QString&)), this, + SLOT( setSizeLimitButton(const QString&))); + connect( restartCheckBox,SIGNAL( toggled(bool)), this, + SLOT( restartOpie(bool))); + connect( adpcmCheckBox,SIGNAL( toggled(bool)), this, + SLOT( slotAdpcm(bool))); // connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); } void SoundSettings::updateStorageCombo() { Config config( "Vmemo" ); config.setGroup( "System" ); QString loc = config.readEntry("RecLocation","/"); int i=0; 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); 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); LocationComboBox->setCurrentItem(set); } void SoundSettings::setLocation(const QString & string) { Config config( "Vmemo" ); config.setGroup( "System" ); config.writeEntry("RecLocation",string); qDebug("set location "+string); config.write(); } void SoundSettings::cleanUp() { Config cfg("Vmemo"); cfg.writeEntry("Alert",AlertCheckBox->isChecked()); cfg.setGroup("Record"); diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp index 0aeb251..d6ecec5 100644 --- a/noncore/settings/sysinfo/benchmarkinfo.cpp +++ b/noncore/settings/sysinfo/benchmarkinfo.cpp @@ -100,97 +100,97 @@ BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) test_alu = new QCheckListItem( tests, tr( "1. Integer Arithmetic " ), QCheckListItem::CheckBox ); test_fpu = new QCheckListItem( tests, tr( "2. Floating Point Unit " ), QCheckListItem::CheckBox ); test_txt = new QCheckListItem( tests, tr( "3. Text Rendering " ), QCheckListItem::CheckBox ); test_gfx = new QCheckListItem( tests, tr( "4. Gfx Rendering " ), QCheckListItem::CheckBox ); test_ram = new QCheckListItem( tests, tr( "5. RAM Performance " ), QCheckListItem::CheckBox ); test_sd = new QCheckListItem( tests, tr( "6. SD Card Performance " ), QCheckListItem::CheckBox ); test_cf = new QCheckListItem( tests, tr( "7. CF Card Performance " ), QCheckListItem::CheckBox ); test_alu->setText( 1, "n/a" ); test_fpu->setText( 1, "n/a" ); test_txt->setText( 1, "n/a" ); test_gfx->setText( 1, "n/a" ); test_ram->setText( 1, "n/a" ); test_sd->setText( 1, "n/a" ); test_cf->setText( 1, "n/a" ); test_alu->setText( 2, "n/a" ); test_fpu->setText( 2, "n/a" ); test_txt->setText( 2, "n/a" ); test_gfx->setText( 2, "n/a" ); test_ram->setText( 2, "n/a" ); test_sd->setText( 2, "n/a" ); test_cf->setText( 2, "n/a" ); startButton = new QPushButton( tr( "&Start Tests!" ), this ); connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); vb->addWidget( tests, 2 ); QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" ); if ( f.open( IO_ReadOnly ) ) { machineCombo = new QComboBox( this ); QTextStream ts( &f ); while( !ts.eof() ) { QString machline = ts.readLine(); qDebug( "sysinfo: parsing benchmark results for '%s'", (const char*) machline ); 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 ) ) ); + 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." ); 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++) ); } void BenchmarkInfo::run() { startButton->setText( "> Don't touch! Running Tests! Don't touch! <" ); qApp->processEvents(); QTime t; if ( test_alu->isOn() ) { int d = round( dhry_main( DHRYSTONE_RUNS ) ); test_alu->setText( 1, QString( "%1 dhrys" ).arg( QString::number( d ) ) ); test_alu->setOn( false ); } if ( test_fpu->isOn() ) { t.start(); BenchFFT(); test_fpu->setText( 1, QString( "%1 secs" ).arg( QString::number( t.elapsed() / 1000.0 ) ) ); test_fpu->setOn( false ); diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp index 9cb8ad2..e688a29 100644 --- a/noncore/settings/sysinfo/modulesinfo.cpp +++ b/noncore/settings/sysinfo/modulesinfo.cpp @@ -9,98 +9,98 @@ ** ** Based on ProcessInfo by Dan Williams <williamsdr@acm.org> ** ** 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 "modulesinfo.h" #include "detail.h" /* OPIE */ #include <qpe/qpeapplication.h> /* QT */ #include <qfile.h> #include <qlayout.h> #include <qmessagebox.h> #include <qtimer.h> #include <qwhatsthis.h> ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 4 ); layout->setMargin( 4 ); ModulesView = new QListView( this ); int colnum = ModulesView->addColumn( tr( "Module" ) ); colnum = ModulesView->addColumn( tr( "Size" ) ); ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); colnum = ModulesView->addColumn( tr( "Use#" ) ); ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); colnum = ModulesView->addColumn( tr( "Used by" ) ); ModulesView->setAllColumnsShowFocus( TRUE ); layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 ); QWhatsThis::add( ModulesView, tr( "This is a list of all the kernel modules currently loaded on this handheld device.\n\nClick and hold on a module to see additional information about the module, or to unload it." ) ); // Test if we have /sbin/modinfo, and if so, allow module detail window if ( QFile::exists( "/sbin/modinfo" ) ) { QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold ); - connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), - this, SLOT( viewModules( QListViewItem * ) ) ); + connect( ModulesView, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), + this, SLOT( viewModules(QListViewItem*) ) ); } CommandCB = new QComboBox( FALSE, this ); CommandCB->insertItem( "modprobe -r" ); CommandCB->insertItem( "rmmod" ); // I can't think of other useful commands yet. Anyone? layout->addWidget( CommandCB, 1, 0 ); QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command to module selected above." ) ); QPushButton *btn = new QPushButton( this ); btn->setMinimumSize( QSize( 50, 24 ) ); btn->setMaximumSize( QSize( 50, 24 ) ); btn->setText( tr( "Send" ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); layout->addWidget( btn, 1, 1 ); QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) ); QTimer *t = new QTimer( this ); connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); t->start( 5000 ); updateData(); ModulesDtl = new Detail(); QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) ); } ModulesInfo::~ModulesInfo() {} void ModulesInfo::updateData() { char modname[64]; char usage[200]; int modsize, usecount; QString selectedmod; QListViewItem *curritem = ModulesView->currentItem(); if ( curritem ) { selectedmod = curritem->text( 0 ); } ModulesView->clear(); FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r"); if ( procfile ) diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp index 2a90b0f..69b4ab5 100644 --- a/noncore/settings/sysinfo/processinfo.cpp +++ b/noncore/settings/sysinfo/processinfo.cpp @@ -6,98 +6,98 @@ ** Copyright (C) 2002, Dan Williams ** williamsdr@acm.org ** http://draknor.net ** ** 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 "processinfo.h" #include "detail.h" /* OPIE */ #include <qpe/qpeapplication.h> /* QT */ #include <qdir.h> #include <qlayout.h> #include <qmessagebox.h> #include <qtimer.h> #include <qwhatsthis.h> /* STD */ #include <sys/types.h> #include <signal.h> ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 4 ); layout->setMargin( 4 ); ProcessView = new QListView( this, "ProcessView" ); int colnum = ProcessView->addColumn( tr( "PID" ) ); ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); colnum = ProcessView->addColumn( tr( "Command" ),96 ); colnum = ProcessView->addColumn( tr( "Status" ) ); colnum = ProcessView->addColumn( tr( "Time" ) ); ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); ProcessView->setAllColumnsShowFocus( TRUE ); QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold ); - connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), - this, SLOT( viewProcess( QListViewItem * ) ) ); + connect( ProcessView, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), + this, SLOT( viewProcess(QListViewItem*) ) ); layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 ); QWhatsThis::add( ProcessView, tr( "This is a list of all the processes on this handheld device.\n\nClick and hold on a process to see additional information about the process, or to send a signal to it." ) ); SignalCB = new QComboBox( FALSE, this, "SignalCB" ); SignalCB->insertItem( " 1: SIGHUP" ); SignalCB->insertItem( " 2: SIGINT" ); SignalCB->insertItem( " 3: SIGQUIT" ); SignalCB->insertItem( " 5: SIGTRAP" ); SignalCB->insertItem( " 6: SIGABRT" ); SignalCB->insertItem( " 9: SIGKILL" ); SignalCB->insertItem( "14: SIGALRM" ); SignalCB->insertItem( "15: SIGTERM" ); SignalCB->insertItem( "18: SIGCONT" ); SignalCB->insertItem( "19: SIGSTOP" ); layout->addWidget( SignalCB, 1, 0 ); QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) ); SendButton = new QPushButton( this, "SendButton" ); SendButton->setMinimumSize( QSize( 50, 24 ) ); SendButton->setMaximumSize( QSize( 50, 24 ) ); SendButton->setText( tr( "Send" ) ); connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); layout->addWidget( SendButton, 1, 1 ); QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) ); QTimer *t = new QTimer( this ); connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); t->start( 5000 ); updateData(); ProcessDtl = new Detail(); QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) ); } ProcessInfo::~ProcessInfo() {} void ProcessInfo::updateData() { int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime, signal, blocked, sigignore, sigcatch; uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode, endcode, startstack, kstkesp, kstkeip, wchan; char state; char comm[64]; QString selectedpid; diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp index ff5957c..15aeaf5 100644 --- a/noncore/settings/tabmanager/tabmanager.cpp +++ b/noncore/settings/tabmanager/tabmanager.cpp @@ -1,87 +1,87 @@ #include "tabmanager.h" #include "app.h" #include "wait.h" #include "tabapplnk.h" #include <qpe/applnk.h> #include <qdir.h> #include <qfile.h> #include <qtextstream.h> #include <qlistview.h> #include <qheader.h> #include <qcombobox.h> #include <qlineedit.h> #include <qlabel.h> #include <qmessagebox.h> #include <stdlib.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #define HOME_APP_DIR QPEApplication::qpeDir()+"/apps" #define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info" #define NEW_FOLDER "EmptyTab" #define NEW_APPLICATION "NewApp" #define APPLICATION_EXTENSION ".desktop" #define APPLICATION_EXTENSION_LENGTH 8 /** * Constructor. Sets up signals. Performs initial scan of applications * and tabs */ TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false), application(NULL){ rescanFolder(HOME_APP_DIR); // Connect the signals and slots - connect(tabList, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(editItem(QListViewItem*))); + connect(tabList, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(editItem(QListViewItem*))); (tabList->header())->hide(); - connect(tabList, SIGNAL(moveItem(QListViewItem *, QListViewItem *)), this, SLOT(moveApplication(QListViewItem *, QListViewItem *))); + connect(tabList, SIGNAL(moveItem(QListViewItem*,QListViewItem*)), this, SLOT(moveApplication(QListViewItem*,QListViewItem*))); } /** * If anything in the tab's have been changed then update the system or alert * the user. */ TabManager::~TabManager(){ if(changed){ // Prompt. //int answer = QMessageBox::warning(this, "Message", "Should your desktop be","Yes", "Cancel", 0, 1 ); //if (answer) // return; QCopEnvelope e("QPE/System", "linkChanged(QString)"); QString link; //we'll just send an empty string 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()); 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. if(fi->isDir()){ if(fi->fileName() != ".." && fi->fileName() != ".") { QListViewItem* newItem; if(!parent) newItem = new QListViewItem(tabList, fi->fileName()); else newItem = new QListViewItem(parent, fi->fileName()); itemList.insert(newItem, directory + "/" + fi->fileName() + "/.directory" ); rescanFolder(directory + "/" + fi->fileName(), newItem); diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp index 5411995..a1130d4 100644 --- a/noncore/settings/usermanager/usermanager.cpp +++ b/noncore/settings/usermanager/usermanager.cpp @@ -32,97 +32,97 @@ UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWind accounts=new Passwd(); accounts->open(); // This actually loads the files /etc/passwd & /etc/group into memory. // Create the toolbar. QToolBar *toolbar = new QToolBar(this,"Toolbar"); toolbar->setHorizontalStretchable(1); // Is there any other way to get the toolbar to stretch of the full screen!? adduserToolButton = new QToolButton(Resource::loadPixmap("usermanager/adduser"),"Add User",0,this,SLOT(addUser()),toolbar,"Add User"); edituserToolButton = new QToolButton(Resource::loadPixmap("usermanager/edituser"),"Edit User",0,this,SLOT(editUser()),toolbar,"Edit User"); deleteuserToolButton = new QToolButton(Resource::loadPixmap("usermanager/deleteuser"),"Delete User",0,this,SLOT(delUser()),toolbar,"Delete User"); QToolButton *userstext = new QToolButton(0,"User",0,0,0,toolbar,"User"); userstext->setUsesTextLabel(true); toolbar->addSeparator(); addgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/addgroup"),"Add Group",0,this,SLOT(addGroup()),toolbar,"Add Group"); editgroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/editgroup"),"Edit Group",0,this,SLOT(editGroup()),toolbar,"Edit Group"); deletegroupToolButton = new QToolButton(Resource::loadPixmap("usermanager/deletegroup"),"Delete Group",0,this,SLOT(delGroup()),toolbar,"Delete Group"); QToolButton *groupstext = new QToolButton(0,"Group",0,0,0,toolbar,"Group"); groupstext->setUsesTextLabel(true); addToolBar(toolbar,"myToolBar"); // Add a tabwidget and all the tabs. myTabWidget = new QTabWidget(this,"My Tab Widget"); setupTabAccounts(); setupTabAllUsers(); setupTabAllGroups(); userPopupMenu.insertItem("Copy",0); getUsers(); // Fill out the iconview & listview with all users. getGroups(); // Fill out the group listview with all groups. setCentralWidget(myTabWidget); } UserConfig::~UserConfig() { accounts->close(); delete accounts; } void UserConfig::setupTabAccounts() { QWidget *tabpage = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(tabpage); layout->setMargin(5); usersIconView=new QListView(tabpage,"users"); usersIconView->addColumn("Icon"); usersIconView->addColumn("Username"); usersIconView->setAllColumnsShowFocus(true); layout->addWidget(usersIconView); - connect(usersIconView,SIGNAL(returnPressed(QListViewItem *)),this,SLOT(showUserMenu(QListViewItem *))); + connect(usersIconView,SIGNAL(returnPressed(QListViewItem*)),this,SLOT(showUserMenu(QListViewItem*))); myTabWidget->addTab(tabpage,"Users"); } void UserConfig::setupTabAllUsers() { QWidget *tabpage = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(tabpage); layout->setMargin(5); usersListView=new QListView(tabpage,"allusers"); usersListView->addColumn("UID"); usersListView->addColumn("Login"); usersListView->addColumn("Username"); layout->addWidget(usersListView); usersListView->setSorting(1,1); usersListView->setAllColumnsShowFocus(true); myTabWidget->addTab(tabpage,"All Users"); } void UserConfig::setupTabAllGroups() { QWidget *tabpage = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(tabpage); layout->setMargin(5); groupsListView=new QListView(tabpage,"groups"); groupsListView->addColumn("GID"); groupsListView->addColumn("Groupname"); layout->addWidget(groupsListView); groupsListView->setSorting(1,1); groupsListView->setAllColumnsShowFocus(true); myTabWidget->addTab(tabpage,"All Groups"); } void UserConfig::getUsers() { QString mytext; QPixmap mypixmap; QListViewItem *listviewitem; // Empty the iconview & the listview. usersIconView->clear(); usersListView->clear(); // availableUID is used as a deposite for the next available UID on the system, this should start at an ID over 500. availableUID=500; for(QStringList::Iterator it=accounts->passwdStringList.begin(); it!=accounts->passwdStringList.end(); ++it) { accounts->splitPasswdEntry(*it); // Split the string into it's components and store in variables in the accounts object. ("pr_name" and so on.) if(accounts->pw_name.find(QRegExp("^#"),0)) { // Skip commented lines. diff --git a/noncore/styles/liquid/liquidset.cpp b/noncore/styles/liquid/liquidset.cpp index 7747da7..a7cfccc 100644 --- a/noncore/styles/liquid/liquidset.cpp +++ b/noncore/styles/liquid/liquidset.cpp @@ -75,95 +75,95 @@ LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) grid-> addColSpacing ( 3, 8 ); grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); m_menubtn = new OColorButton ( this, mcol ); grid-> addWidget ( m_menubtn, 0, 2 ); m_textbtn = new OColorButton ( this, tcol ); grid-> addWidget ( m_textbtn, 0, 5 ); m_opacsld = new QSlider ( Horizontal, this ); m_opacsld-> setRange ( -20, 20 ); m_opacsld-> setSteps ( 1, 1 ); m_opacsld-> setValue ( opacity ); m_opacsld-> setTickmarks ( QSlider::Below ); grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); vbox-> addSpacing ( 4 ); QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); shadow-> setChecked ( m_shadow ); vbox-> addWidget ( shadow ); vbox-> addSpacing ( 4 ); QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this ); flattb-> setChecked ( m_flat ); vbox-> addWidget ( flattb ); vbox-> addSpacing ( 4 ); QHBoxLayout *hbox = new QHBoxLayout ( vbox ); hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); m_contsld = new QSlider ( Horizontal, this ); m_contsld-> setRange ( 0, 10 ); m_contsld-> setSteps ( 1, 1 ); m_contsld-> setValue ( contrast ); m_contsld-> setTickmarks ( QSlider::Below ); hbox-> addWidget ( m_contsld, 10 ); vbox-> addStretch ( 10 ); changeType ( m_type ); - connect ( cb, SIGNAL( highlighted ( int ) ), this, SLOT( changeType ( int ) ) ); - connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); - connect ( flattb, SIGNAL( toggled ( bool ) ), this, SLOT( changeFlat ( bool ) ) ); + connect ( cb, SIGNAL( highlighted(int) ), this, SLOT( changeType(int) ) ); + connect ( shadow, SIGNAL( toggled(bool) ), this, SLOT( changeShadow(bool) ) ); + connect ( flattb, SIGNAL( toggled(bool) ), this, SLOT( changeFlat(bool) ) ); } void LiquidSettings::changeType ( int t ) { bool custom = ( t == Custom ); m_menulbl-> setEnabled ( custom ); m_textlbl-> setEnabled ( custom ); m_opaclbl-> setEnabled ( custom ); m_menubtn-> setEnabled ( custom ); m_textbtn-> setEnabled ( custom ); m_opacsld-> setEnabled ( custom ); m_type = t; } void LiquidSettings::changeShadow ( bool b ) { m_shadow = b; } void LiquidSettings::changeFlat ( bool b ) { m_flat = b; } bool LiquidSettings::writeConfig ( ) { Config config ( "qpe" ); config. setGroup ( "Liquid-Style" ); config. writeEntry ( "Type", m_type ); config. writeEntry ( "Color", m_menubtn-> color ( ). name ( )); config. writeEntry ( "TextColor", m_textbtn-> color ( ). name ( )); config. writeEntry ( "Opacity", m_opacsld-> value ( )); config. writeEntry ( "ShadowText", m_shadow ); config. writeEntry ( "StippleContrast", m_contsld-> value ( )); config. writeEntry ( "FlatToolButtons", m_flat ); config. write ( ); return true; } diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.cpp b/noncore/todayplugins/fortune/fortunepluginwidget.cpp index b210fa9..e6a0d09 100644 --- a/noncore/todayplugins/fortune/fortunepluginwidget.cpp +++ b/noncore/todayplugins/fortune/fortunepluginwidget.cpp @@ -19,66 +19,66 @@ #include <qvaluelist.h> #include <qtl.h> #include <qstring.h> #include <qscrollview.h> #include <qobject.h> #include <qlayout.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <opie/oprocess.h> #include <opie/oticker.h> FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) : QWidget( parent, name ) { fortune = NULL; getFortune(); } FortunePluginWidget::~FortunePluginWidget() { if( fortuneProcess ){ delete fortuneProcess; } } /** * Get the fortunes */ void FortunePluginWidget::getFortune() { QVBoxLayout* layoutFortune = new QVBoxLayout( this ); if ( fortune ) { delete fortune; } fortune = new OTicker( this ); // fortune->setReadOnly( TRUE ); // fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); fortune->setText( QString("Obtaining fortune...") ); layoutFortune->addWidget( fortune ); fortuneProcess = new OProcess(); *fortuneProcess << "fortune"; - connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*, char*, int ) ), - this, SLOT(slotStdOut(OProcess*, char*, int) ) ); + connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*,char*,int) ), + this, SLOT(slotStdOut(OProcess*,char*,int) ) ); if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { qWarning("could not start :("); 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/helpwindow.cpp b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp index 2274402..db662e8 100644 --- a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp +++ b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp @@ -1,164 +1,164 @@ /**************************************************************************** ** ** 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 <qstatusbar.h> #include <qmenubar.h> #include <qtoolbar.h> #include <qtoolbutton.h> #include <qcombobox.h> #include <ctype.h> HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() { readHistory(); readBookmarks(); 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() ) ); setCentralWidget( browser ); if ( !home_.isEmpty() ) //////////////////////////////// browser->setSource( home_ ); //////////////////////////////// - connect( browser, SIGNAL( highlighted( const QString&) ), - statusBar(), SLOT( message( const QString&)) ); + connect( browser, SIGNAL( highlighted(const QString&) ), + statusBar(), SLOT( message(const QString&)) ); setGeometry( 0,0,236,280); QPopupMenu* file = new QPopupMenu( this ); // file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N ); file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O ); // file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P ); file->insertSeparator(); file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q ); // file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X ); // The same three icons are used twice each. ////F FIXME QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/"; QIconSet icon_back( QPixmap(pixs+"back.png") ); QIconSet icon_forward( QPixmap(pixs+"forward.png") ); QIconSet icon_home( QPixmap(pixs+"home.png") ); QPopupMenu* go = new QPopupMenu( this ); backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left ); forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right ); go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) ); hist = new QPopupMenu( this ); QStringList::Iterator it = history.begin(); for ( ; it != history.end(); ++it ) mHistory[ hist->insertItem( *it ) ] = *it; - connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) ); + connect( hist, SIGNAL( activated(int) ), this, SLOT( histChosen(int) ) ); bookm = new QPopupMenu( this ); bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); bookm->insertSeparator(); QStringList::Iterator it2 = bookmarks.begin(); for ( ; it2 != bookmarks.end(); ++it2 ) mBookmarks[ bookm->insertItem( *it2 ) ] = *it2; - connect( bookm, SIGNAL( activated( int ) ), - this, SLOT( bookmChosen( int ) ) ); + connect( bookm, SIGNAL( activated(int) ), + this, SLOT( bookmChosen(int) ) ); menuBar()->insertItem( tr("&File"), file ); menuBar()->insertItem( tr("&Go"), go ); menuBar()->insertItem( tr( "History" ), hist ); menuBar()->insertItem( tr( "Bookmarks" ), bookm ); // menuBar()->insertSeparator(); // menuBar()->insertItem( tr("&Help"), help ); menuBar()->setItemEnabled( forwardId, FALSE); menuBar()->setItemEnabled( backwardId, FALSE); - connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) ); - connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) ); + connect( browser, SIGNAL( backwardAvailable(bool) ), this, SLOT( setBackwardAvailable(bool) ) ); + connect( browser, SIGNAL( forwardAvailable(bool) ), this, SLOT( setForwardAvailable(bool) ) ); QToolBar* toolbar = new QToolBar( this ); addToolBar( toolbar, "Toolbar"); QToolButton* button; button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar ); connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); button->setEnabled( FALSE ); button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar ); connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); button->setEnabled( FALSE ); button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar ); toolbar->addSeparator(); pathCombo = new QComboBox( TRUE, toolbar ); - connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) ); + connect( pathCombo, SIGNAL( activated(const QString&) ), this, SLOT( pathSelected(const QString&) ) ); toolbar->setStretchableWidget( pathCombo ); // pathCombo->setMaximumWidth(190); // setRightJustification( TRUE ); // setDockEnabled( Left, FALSE ); // setDockEnabled( Right, FALSE ); pathCombo->insertItem( home_ ); browser->setFocus(); } void HelpWindow::setBackwardAvailable( bool b) { menuBar()->setItemEnabled( backwardId, b); } void HelpWindow::setForwardAvailable( bool b) { menuBar()->setItemEnabled( forwardId, b); } void HelpWindow::textChanged() { if ( browser->documentTitle().isNull() ) { setCaption( "Stockticker Lookup - " + browser->context() ); selectedURL = browser->context(); } else { setCaption( "Stockticker Lookup - " + browser->documentTitle() ) ; selectedURL = browser->documentTitle(); } if ( !selectedURL.isEmpty() && pathCombo ) { bool exists = FALSE; int i; for ( i = 0; i < pathCombo->count(); ++i ) { if ( pathCombo->text( i ) == selectedURL ) { exists = TRUE; break; } } if ( !exists ) { pathCombo->insertItem( selectedURL, 0 ); diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp index 73f8bb3..64798f4 100644 --- a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp +++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp @@ -18,72 +18,72 @@ #include <opie/oprocess.h> #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(); layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 3); QLabel *label; label = new QLabel(this); label->setText( tr("Enter something to lookup / search.")); label->setMaximumHeight(60); layout->addMultiCellWidget( label, 1, 1, 0, 3); connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(doLookup())); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); layout->addItem( spacer, 8, 0 ); } 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); /* OProcess proc; proc << "/usr/bin/wget"; proc<<"-O"<< tempHtml<< url; - connect( &proc, SIGNAL( processExited( OProcess *)),this, SLOT( showBrowser(OProcess *))); + connect( &proc, SIGNAL( processExited(OProcess*)),this, SLOT( showBrowser(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"); 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/weather/weatherpluginwidget.cpp b/noncore/todayplugins/weather/weatherpluginwidget.cpp index 4491b91..15d1c6e 100644 --- a/noncore/todayplugins/weather/weatherpluginwidget.cpp +++ b/noncore/todayplugins/weather/weatherpluginwidget.cpp @@ -60,97 +60,97 @@ WeatherPluginWidget::WeatherPluginWidget( QWidget *parent, const char* name ) startTimer(1000); } WeatherPluginWidget::~WeatherPluginWidget() { QFile file( localFile ); if ( file.exists() ) { file.remove(); } } void WeatherPluginWidget::timerEvent( QTimerEvent *e ) { killTimer( e->timerId() ); retreiveData(); } void WeatherPluginWidget::retreiveData() { Config config( "todayweatherplugin"); config.setGroup( "Config" ); location = config.readEntry( "Location", "" ); useMetric = config.readBoolEntry( "Metric", TRUE ); frequency = config.readNumEntry( "Frequency", 5 ); startTimer( frequency * 60000 ); localFile = "/tmp/"; localFile.append( location ); localFile.append( ".TXT" ); remoteFile = "http://weather.noaa.gov/pub/data/observations/metar/stations/"; remoteFile.append( location ); remoteFile.append( ".TXT" ); QFile file( localFile ); if ( file.exists() ) { file.remove(); } OProcess *proc = new OProcess; *proc << "wget" << "-q" << remoteFile << "-O" << localFile; - connect( proc, SIGNAL( processExited( OProcess * ) ), this, SLOT( dataRetrieved( OProcess * ) ) ); + connect( proc, SIGNAL( processExited(OProcess*) ), this, SLOT( dataRetrieved(OProcess*) ) ); proc->start(); } void WeatherPluginWidget::displayWeather() { weatherData = QString::null; QFile file( localFile ); if ( file.size() > 0 && file.open( IO_ReadOnly ) ) { QTextStream data( &file ); while ( !data.eof() ) { weatherData.append( data.readLine() ); } file.close(); weatherData = weatherData.simplifyWhiteSpace(); QString tmpstr; tmpstr.append( tr( "Temp: " ) ); getTemp( weatherData ); tmpstr.append( dataStr ); tmpstr.append( tr( " Wind: " ) ); getWind( weatherData ); tmpstr.append( dataStr ); tmpstr.append( tr( "\nPres: " ) ); getPressure( weatherData ); tmpstr.append( dataStr ); weatherLabel->setText( tmpstr ); tmpstr = "todayweatherplugin/"; getIcon( weatherData ); tmpstr.append( dataStr ); QImage logo1 = Resource::loadImage( tmpstr ); QPixmap pic; pic.convertFromImage( logo1 ); weatherIcon->setPixmap( pic ); } else { weatherLabel->setText( tr( "Current weather data not available." ) ); } } diff --git a/noncore/tools/calc2/calc.cpp b/noncore/tools/calc2/calc.cpp index f75eb69..3dcdf6e 100644 --- a/noncore/tools/calc2/calc.cpp +++ b/noncore/tools/calc2/calc.cpp @@ -1,95 +1,95 @@ /********************************************************************** ** 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 <qvaluelist.h> #include <qpe/qpeapplication.h> #include <qdir.h> #include <qwidgetstack.h> #include "calc.h" #include "plugininterface.h" calc::calc (QWidget * p, const char *n):QWidget (p, n) { setCaption (tr ("Calculator")); // widgets LCD = new QLCDNumber (this); LCD->setMaximumSize (QSize (240, 30)); LCD->setNumDigits(12); LCD->setSegmentStyle(QLCDNumber::Filled); pluginWidgetStack = new QWidgetStack (this); // layout widgets calculatorLayout = new QVBoxLayout (this); calculatorLayout->addWidget (LCD); calculatorLayout->addWidget (pluginWidgetStack); // no formatting of display for now - connect (&engine, SIGNAL(display (double)), LCD, SLOT(display (double))); - connect (&engine, SIGNAL(display (const QString &)), LCD, SLOT(display (const QString &))); + connect (&engine, SIGNAL(display(double)), LCD, SLOT(display(double))); + connect (&engine, SIGNAL(display(const QString&)), LCD, SLOT(display(const QString&))); connect (&engine, SIGNAL(setBinMode()), LCD, SLOT(setBinMode())); connect (&engine, SIGNAL(setOctMode()), LCD, SLOT(setOctMode())); connect (&engine, SIGNAL(setDecMode()), LCD, SLOT(setDecMode())); connect (&engine, SIGNAL(setHexMode()), LCD, SLOT(setHexMode())); #ifndef NO_PLUGINS // load plugins QValueList < Plugin >::Iterator mit; for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) { (*mit).interface->release (); (*mit).library->unload (); delete (*mit).library; } pluginList.clear (); QString path = QPEApplication::qpeDir() + "/plugins/calculator"; QDir dir (path, "lib*.so"); QStringList list = dir.entryList (); QStringList::Iterator it; for (it = list.begin (); it != list.end (); ++it) { CalcInterface *iface = 0; QLibrary *lib = new QLibrary (path + "/" + *it); Plugin plugin; plugin.pluginWidget = 0; if (lib->queryInterface (IID_Calc, (QUnknownInterface **) & iface) == QS_OK) { plugin.library = lib; plugin.interface = iface; plugin.pluginWidget = plugin.interface->getPlugin(&engine,pluginWidgetStack); if (plugin.pluginWidget) pluginWidgetStack->addWidget (plugin.pluginWidget, pluginList.count()); pluginList.append (plugin); } else { delete lib; } } setMode (1); #else // load simple interface #endif } calc::~calc () { #ifndef NO_PLUGINS diff --git a/noncore/tools/calculator/calculatorimpl.cpp b/noncore/tools/calculator/calculatorimpl.cpp index 163b4da..dead03d 100644 --- a/noncore/tools/calculator/calculatorimpl.cpp +++ b/noncore/tools/calculator/calculatorimpl.cpp @@ -175,97 +175,97 @@ CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name, bgr_command.insert( PushButtonMR); bgr_command.insert( PushButtonMC); bgr_command.insert( PushButtonCE); connect( &bgr_command, SIGNAL(clicked(int) ), this, SLOT(command_buttons(int))); bgr_digits.insert(PushButton0); bgr_digits.insert(PushButton1); bgr_digits.insert(PushButton2); bgr_digits.insert(PushButton3); bgr_digits.insert(PushButton4); bgr_digits.insert(PushButton5); bgr_digits.insert(PushButton6); bgr_digits.insert(PushButton7); bgr_digits.insert(PushButton8); bgr_digits.insert(PushButton9); connect( &bgr_digits, SIGNAL(clicked(int) ), this, SLOT(enterNumber(int))); bgr_std.insert(PushButtonEquals); bgr_std.insert(PushButtonDecimal); bgr_std.insert(PushButtonAdd); bgr_std.insert(PushButtonMinus); bgr_std.insert(PushButtonDivide); bgr_std.insert(PushButtonTimes); connect( &bgr_std, SIGNAL(clicked(int) ), this, SLOT(std_buttons(int))); // change the / to a proper division signal PushButtonDivide->setText(QChar(0xF7)); func_buttons[0] = PushButtonF1; func_buttons[1] = PushButtonF2; func_buttons[2] = PushButtonF3; func_buttons[3] = PushButtonF4; func_buttons[4] = PushButtonF5; func_buttons[5] = PushButtonF6; func_buttons[6] = PushButtonF7; func_buttons[7] = PushButtonF8; func_buttons[8] = PushButtonF9; func_buttons[9] = PushButtonF10; func_buttons[10] = PushButtonF11; func_buttons[11] = PushButtonF12; for ( int x = 0 ; x < func_button_count ; x++ ) { QPushButton* tmpbutton = func_buttons[x]; faces << tmpbutton->text(); bgr_function.insert(tmpbutton); } connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(do_convert(int) ) ); - connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(std_funcs (int) ) ); + connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(std_funcs(int) ) ); 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); // 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++; } entry_list = new double[conversion_mode_count*func_button_count]; preoffset_list = new double[conversion_mode_count*func_button_count]; postoffset_list = new double[conversion_mode_count*func_button_count]; myfile.close(); myfile.open( IO_Translate | IO_ReadOnly ); QTextStream ts2(&myfile); // second pass, read in values int x = 0; while ( ! ts2.eof() ) { line = ts2.readLine(); if ( line.contains("STARTTYPE") ) { captions << tr( line.remove(0,10) ); ComboBoxFunction->insertItem(captions.last()); while ( !line.contains("ENDTYPE") ) { line = ts2.readLine(); if ( line.contains("NAME") ) { faces << tr( line.remove(0,5) ); line2 = ts2.readLine(); line2.remove(0,6); entry_list[x] = line2.toDouble(); diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index 4d92683..118cf1f 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp @@ -76,145 +76,145 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f ) : QVBox( parent, name , f ) { setSpacing( 4 ); setMargin( 1 ); snoozeBtn = new QPushButton ( this ); snoozeBtn->setText( tr( "Snooze" ) ); aclock = new AnalogClock( this ); aclock->display( QTime::currentTime() ); aclock->setLineWidth( 2 ); QHBox *hb = new QHBox( this ); hb->setMargin( 0 ); QWidget *space = new QWidget( hb ); lcd = new QLCDNumber( hb ); lcd->setSegmentStyle( QLCDNumber::Flat ); lcd->setFrameStyle( QFrame::NoFrame ); lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); lcd->setFixedHeight( 23 ); ampmLabel = new QLabel( tr( "PM" ), hb ); ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) ); ampmLabel->setAlignment( AlignLeft | AlignBottom ); space = new QWidget( hb ); date = new QLabel( this ); date->setAlignment( AlignHCenter | AlignVCenter ); date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); date->setText( TimeString::longDateString( QDate::currentDate() ) ); QWidget *controls = new QWidget( this ); QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 ); QButtonGroup *grp = new QButtonGroup( controls ); grp->setRadioButtonExclusive( true ); grp->hide(); clockRB = new QRadioButton ( tr( "Clock" ), controls ); gl->addWidget( clockRB, 0, 0 ); grp->insert( clockRB ); swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls ); gl->addWidget( swatchRB, 1, 0 ); grp->insert( swatchRB ); - connect( grp, SIGNAL( clicked( int ) ), this, SLOT( modeSelect( int ) ) ); + connect( grp, SIGNAL( clicked(int) ), this, SLOT( modeSelect(int) ) ); grp->setButton( 0 ); set = new QPushButton ( controls ); set->setMaximumSize( 50, 30 ); gl->addWidget( set , 0, 1 ); set->setText( tr( "Start" ) ); set->setEnabled( FALSE ); grp->insert( set ); reset = new QPushButton ( controls ); gl->addWidget( reset, 1, 1 ); reset->setText( tr( "Reset" ) ); reset->setEnabled( FALSE ); grp->insert( reset ); alarmOffBtn = new QPushButton ( controls ); gl->addWidget( alarmOffBtn, 0, 2 ); alarmBtn = new QPushButton ( controls ); gl->addWidget( alarmBtn, 1, 2 ); alarmBtn->setText( tr( "Set Alarm" ) ); OClickableLabel *click = new OClickableLabel( controls, "label" ); click->setText( tr( "Set date and time." ) ); gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter ); connect( click, SIGNAL( clicked() ), this, SLOT( slotAdjustTime() ) ); connect( set , SIGNAL( pressed() ), SLOT( slotSet() ) ); connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) ); connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) ); - connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), - this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); + connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), + this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); t = new QTimer( this ); connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) ); t->start( 1000 ); connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) ); swatch_running = FALSE; swatch_totalms = 0; - connect( qApp, SIGNAL( clockChanged( bool ) ), this, SLOT( changeClock( bool ) ) ); + connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( changeClock(bool) ) ); Config config( "qpe" ); config.setGroup( "Time" ); ampm = config.readBoolEntry( "AMPM", TRUE ); QString tmp = config.readEntry( "clockAlarmHour", "" ); bool ok; hour = tmp.toInt( &ok, 10 ); tmp = config.readEntry( "clockAlarmMinute", "" ); minute = tmp.toInt( &ok, 10 ); if ( config.readEntry( "clockAlarmSet", "FALSE" ) == "TRUE" ) { alarmOffBtn->setText( tr( "Alarm Is On" ) ); alarmBool = TRUE; snoozeBtn->show(); } else { alarmOffBtn->setText( tr( "Alarm Is Off" ) ); alarmBool = FALSE; snoozeBtn->hide(); } QTimer::singleShot( 0, this, SLOT( updateClock() ) ); Config cfg( "Clock" ); cfg.setGroup( "Mode" ); int mode = cfg.readBoolEntry( "clockMode"); setSwatchMode( mode); modeSelect( mode); } Clock::~Clock() { toggleScreenSaver( true ); } void Clock::updateClock() { if ( clockRB->isChecked() ) { QTime tm = QDateTime::currentDateTime().time(); QString s; if ( ampm ) { int hour = tm.hour(); diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp index e869317..77e1790 100644 --- a/noncore/tools/formatter/formatter.cpp +++ b/noncore/tools/formatter/formatter.cpp @@ -115,99 +115,99 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, WFlags fl, bool tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1); deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" ); tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1); TextLabel5 = new QLabel( tab_2, "TextLabel5" ); TextLabel5->setText( tr( "CAUTION:\n" "Changing parameters on this\n" "page may cause your system\n" "to stop functioning properly!" ) );//idiot message tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1); editPushButton = new QPushButton( tab_2, "editPushButton" ); editPushButton->setText( tr( "Edit fstab" ) ); editPushButton->setMaximumWidth(100); tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 ); fsckButton = new QPushButton( tab_2, "fsckPushButton" ); fsckButton->setText( tr( "Check Disk" ) ); fsckButton->setMaximumWidth(100); tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); TextLabel3 = new QLabel( tab_2, "TextLabel3" ); TextLabel3->setText( tr( "Device" ) ); tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); tabLayout_2->addItem( spacer_3, 5, 0 ); TextLabel1 = new QLabel( tab_2, "TextLabel1" ); TextLabel1->setText( tr( "Mount Point" ) ); tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); tabLayout_2->addItem( spacer_4, 2, 1 ); TabWidget->insertTab( tab_2, tr( "Advanced" ) ); FormatterAppLayout->addWidget( TabWidget, 0, 1 ); connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) ); connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) ); connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) ); - connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int ) )); - connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int ) )); - connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int ) )); + connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int) )); + connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int) )); + connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int) )); fillCombos(); } FormatterApp::~FormatterApp() {} void FormatterApp::doFormat() { int err=0; Output *outDlg; QString umountS, remountS; QString text = storageComboBox->currentText(); QString currentText = storageComboBox->currentText(); QString cmd; QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); QString fs = fileSystemsCombo->currentText(); #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap #else currentText = diskDevice = "/dev/fd0"; umountS = "umount -v /floppy 2>&1"; remountS = "mount -v /floppy 2>&1"; #endif if( currentText.find("CF",0,TRUE) != -1) { umountS = "umount "; remountS = "mount "; // umountS = "/sbin/cardctl eject"; // remountS = "/sbin/cardctl insert"; } if( currentText.find("SD",0,TRUE) != -1) { umountS = "umount "; remountS = "mount "; // umountS = "/etc/sdcontrol compeject"; // remountS = "/etc/sdcontrol insert"; } switch ( QMessageBox::warning(this,tr("Format?") , tr("Really format\n") +diskName+" "+ currentText + tr("\nwith %1 filesystem?\nYou will loose all data!!").arg( fs ) ,tr("Yes") ,tr("No") diff --git a/noncore/tools/remote/buttondialog.cpp b/noncore/tools/remote/buttondialog.cpp index 6ea4801..580f101 100644 --- a/noncore/tools/remote/buttondialog.cpp +++ b/noncore/tools/remote/buttondialog.cpp @@ -1,104 +1,104 @@ /* Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. Copyright (C) 2002 Thomas Stephens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "buttondialog.h" ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name, bool modal, WFlags f):QDialog(parent, name, modal, f) { setCaption(tr(buttonName)); QVBoxLayout *layout = new QVBoxLayout(this); QHBoxLayout *hlayout1 = new QHBoxLayout(this); QHBoxLayout *hlayout2 = new QHBoxLayout(this); QHBoxLayout *hlayout3 = new QHBoxLayout(this); layout->addSpacing(5); layout->addLayout(hlayout1); layout->addSpacing(5); layout->addLayout(hlayout2); layout->addSpacing(5); layout->addLayout(hlayout3); layout->addSpacing(5); remote = new QComboBox(false, this, "remote"); QLabel *remoteLabel = new QLabel(remote, "Remote: ", this, "remoteLabel"); hlayout1->addSpacing(5); hlayout1->addWidget(remoteLabel); hlayout1->addSpacing(5); hlayout1->addWidget(remote); hlayout1->addSpacing(5); remote->insertItem("Remote "); remote->insertStringList(getRemotes()); - connect(remote, SIGNAL(activated(const QString &)), this, SLOT(remoteSelected(const QString&)) ); + connect(remote, SIGNAL(activated(const QString&)), this, SLOT(remoteSelected(const QString&)) ); button = new QComboBox(false, this, "button"); QLabel *buttonLabel = new QLabel(remote, "Button: ", this, "buttonLabel"); hlayout2->addSpacing(5); hlayout2->addWidget(buttonLabel); hlayout2->addSpacing(5); hlayout2->addWidget(button); hlayout2->addSpacing(5); button->insertItem("Button "); - connect(button, SIGNAL(activated(const QString &)), this, SLOT(buttonSelected(const QString&)) ); + connect(button, SIGNAL(activated(const QString&)), this, SLOT(buttonSelected(const QString&)) ); label = new QLineEdit(this, "label"); label->setText(buttonName); QLabel *labelLabel = new QLabel(label, "Label: ", this, "labelLabel"); hlayout3->addSpacing(5); hlayout3->addWidget(labelLabel); hlayout3->addSpacing(5); hlayout3->addWidget(label); hlayout3->addSpacing(5); } void ButtonDialog::remoteSelected(const QString &string) { button->insertStringList(getButtons(string.latin1()) ); list="SEND_ONCE"; list+=string; } void ButtonDialog::buttonSelected(const QString &string) { list+=string; } QStringList ButtonDialog::getList() { return list; } QString ButtonDialog::getLabel() { return label->text(); } QStringList ButtonDialog::getRemotes() { const char write_buffer[] = "LIST\n"; const char *readbuffer; int i, numlines; QStringList list; addr.sun_family=AF_UNIX; strcpy(addr.sun_path,"/dev/lircd"); fd = socket(AF_UNIX, SOCK_STREAM, 0); if(fd == -1) { QMessageBox *mb = new QMessageBox("Error!", "couldnt connect to socket", diff --git a/noncore/tools/remote/recorddialog.cpp b/noncore/tools/remote/recorddialog.cpp index cfab730..1ce5472 100644 --- a/noncore/tools/remote/recorddialog.cpp +++ b/noncore/tools/remote/recorddialog.cpp @@ -4,79 +4,79 @@ Copyright (C) 2002 Thomas Stephens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "recorddialog.h" RecordDialog::RecordDialog(QWidget *parent, const char *name) :QDialog(parent, name) { QVBoxLayout *layout = new QVBoxLayout(this); QHBoxLayout *hlayout = new QHBoxLayout(this); layout->insertSpacing(0,5); output = new QTextView("Please enter the name of the new remote, and press Return\n", 0, this, "output"); layout->insertWidget(-1, output); layout->insertSpacing(-1, 5); layout->insertLayout(-1, hlayout); layout->insertSpacing(-1, 5); hlayout->insertSpacing(0, 5); input = new QLineEdit(this, "input"); hlayout->insertWidget(-1, input, 1); hlayout->insertSpacing(-1, 5); QPushButton *ret = new QPushButton("Return", this, "return"); hlayout->insertWidget(-1, ret); hlayout->insertSpacing(-1, 5); connect(ret, SIGNAL(clicked()), this, SLOT(retPressed()) ); where = 0; record = new OProcess; } void RecordDialog::retPressed() { printf("RecordDialog::retPressed: ret pressed\n"); if(where == 0) { - connect(record, SIGNAL(receivedStdout(OProcess *, char *, int)), this, SLOT(incoming(OProcess *, char *, int)) ); - connect(record, SIGNAL(receivedStderr(OProcess *, char *, int)), this, SLOT(incoming(OProcess *, char *, int)) ); - connect(record, SIGNAL(processExited(OProcess *)), this, SLOT(done(OProcess *)) ); + connect(record, SIGNAL(receivedStdout(OProcess*,char*,int)), this, SLOT(incoming(OProcess*,char*,int)) ); + connect(record, SIGNAL(receivedStderr(OProcess*,char*,int)), this, SLOT(incoming(OProcess*,char*,int)) ); + connect(record, SIGNAL(processExited(OProcess*)), this, SLOT(done(OProcess*)) ); printf("RecordDialog::retPressed: starting irrecord\n"); QString file = "/tmp/" + input->text(); *record<<"irrecord"<<file.latin1(); if(!record->start(OProcess::NotifyOnExit, OProcess::AllOutput)) { QMessageBox *mb = new QMessageBox("Error!", "Could not start irrecord. You must<br>use an lirc ipkg that includes<br>irrecord", QMessageBox::NoIcon, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); mb->exec(); return; } // record->resume(); where = 1; } } void RecordDialog::incoming(OProcess *proc, char *buffer, int len) { // output->setText(output->text() + QString(buffer).truncate(len-1)); printf("RecordDialog::incoming: got text from irrecord\n"); } void RecordDialog::done(OProcess *proc) { } diff --git a/noncore/tools/remote/topgroup.cpp b/noncore/tools/remote/topgroup.cpp index 93cffbb..427cb8f 100644 --- a/noncore/tools/remote/topgroup.cpp +++ b/noncore/tools/remote/topgroup.cpp @@ -1,54 +1,54 @@ /* Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. Copyright (C) 2002 Thomas Stephens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "topgroup.h" TopGroup::TopGroup(QWidget *parent, const char *name):QWidget(parent,name) { QHBoxLayout *layout = new QHBoxLayout(this, 0, -1, 0); QPushButton *power = new QPushButton("Power",this,"power"); layout->addWidget(power); connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); // power->setGeometry(5, 5,40, 20); layout->addSpacing(5); QPushButton *source = new QPushButton("Source",this,"source"); layout->addWidget(source); connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); // source->setGeometry(50,5,40,20); remotes = new QComboBox(false, this, "remotes"); - connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); + connect(remotes, SIGNAL(activated(const QString&)), this->parentWidget(), SLOT(remoteSelected(const QString&)) ); remotes->insertItem("Select Remote"); // remotes->setGeometry(135,5,95,20); QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel"); // remoteLabel->setGeometry(90,5,40,20); remoteLabel->setAlignment(AlignRight | AlignVCenter); layout->addWidget(remoteLabel); layout->addWidget(remotes); } void TopGroup::updateRemotes(Config *cfg) { remotes->clear(); remotes->insertItem(QString("SelectRemote")); cfg->setGroup("Remotes"); remotes->insertStringList(cfg->readListEntry("remoteList", ',') ); } diff --git a/noncore/tools/remote/topgroupconf.cpp b/noncore/tools/remote/topgroupconf.cpp index d763a3a..0419a65 100644 --- a/noncore/tools/remote/topgroupconf.cpp +++ b/noncore/tools/remote/topgroupconf.cpp @@ -1,70 +1,70 @@ /* Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. Copyright (C) 2002 Thomas Stephens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "topgroupconf.h" TopGroupConf::TopGroupConf(QWidget *parent, const char *name):QWidget(parent,name) { QHBoxLayout *layout = new QHBoxLayout(this); QPushButton *power = new QPushButton("Power",this,"power"); layout->addWidget(power); connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); // power->setGeometry(5, 5,40, 20); layout->addSpacing(5); QPushButton *source = new QPushButton("Source",this,"source"); layout->addWidget(source); connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); // source->setGeometry(50,5,40,20); remotes = new QComboBox(true, this, "remotes"); remotes->insertItem(QString("Remotes")); layout->addWidget(remotes); layout->setStretchFactor(remotes, 1); - connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); + connect(remotes, SIGNAL(activated(const QString&)), this->parentWidget(), SLOT(remoteSelected(const QString&)) ); QPushButton *newrem = new QPushButton("New", this, "new"); layout->addWidget(newrem); connect(newrem, SIGNAL(pressed()), this->parentWidget(), SLOT(newPressed()) ); /* remotes = new QComboBox(false, this, "remotes"); - connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); + connect(remotes, SIGNAL(activated(const QString&)), this->parentWidget(), SLOT(remoteSelected(const QString&)) ); remotes->insertItem("Select Remote"); // remotes->setGeometry(135,5,95,20); QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel"); // remoteLabel->setGeometry(90,5,40,20); remoteLabel->setAlignment(AlignRight | AlignVCenter); layout->addWidget(remoteLabel); layout->addWidget(remotes); */ } void TopGroupConf::updateRemotes(QStringList list) { remotes->insertStringList(list); } QString TopGroupConf::getRemotesText() { return remotes->currentText(); } diff --git a/noncore/unsupported/filebrowser/filebrowser.cpp b/noncore/unsupported/filebrowser/filebrowser.cpp index 8cf8a60..92a688a 100644 --- a/noncore/unsupported/filebrowser/filebrowser.cpp +++ b/noncore/unsupported/filebrowser/filebrowser.cpp @@ -215,100 +215,100 @@ QPixmap FileItem::drawThumbnail(const QFileInfo &file) { if (!cachedFile.dir().exists()) { QString cmd = "/bin/mkdir -p \"" + cachedFile.dirPath() +"\""; system( (const char *) cmd ); } if (thumb.save(cachedFile.filePath(), QPixmap::imageFormat(file.filePath()), 70)) { // make thumbnail modify time the same as the image QString cmd = "/bin/touch -r \"" + file.filePath() +"\" " + "\"" + cachedFile.filePath() + "\""; system( (const char *) cmd ); } return thumb; } } // // FileView // FileView::FileView( const QString & dir, QWidget * parent, const char * name, bool hidden, bool symlinks, bool thumbnails ) : QListView( parent, name ), menuTimer( this ), le( NULL ), itemToRename( NULL ), showHidden( hidden ), showSymlinks( symlinks ), showThumbnails( thumbnails ), menuKeepsOpen( FALSE ) { addColumn( "Name" ); addColumn( "Size" ); addColumn( "Date" ); addColumn( "Type" ); setMultiSelection( TRUE ); //header()->hide(); setColumnWidthMode( 0, Manual ); setColumnWidthMode( 3, Manual ); // right align yize column setColumnAlignment( 1, AlignRight ); generateDir( dir ); - connect( this, SIGNAL( clicked( QListViewItem * )), - SLOT( itemClicked( QListViewItem * )) ); - connect( this, SIGNAL( doubleClicked( QListViewItem * )), - SLOT( itemDblClicked( QListViewItem * )) ); + connect( this, SIGNAL( clicked(QListViewItem*)), + SLOT( itemClicked(QListViewItem*)) ); + connect( this, SIGNAL( doubleClicked(QListViewItem*)), + SLOT( itemDblClicked(QListViewItem*)) ); connect( this, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); } void FileView::resizeEvent( QResizeEvent *e ) { setColumnWidth( 0, width() - 2 * lineWidth() - 20 - columnWidth( 1 ) - columnWidth( 2 ) ); // hide type column, we use it for "sort by type" only //setColumnWidth( 3, 0 ); QListView::resizeEvent( e ); } void FileView::updateDir() { generateDir( currentDir ); } void FileView::setDir( const QString & dir ) { if ( dir.startsWith( "/dev" ) ) { QMessageBox::warning( this, tr( "File Manager" ), tr( "Can't show /dev/ directory." ), tr( "&Ok" ) ); return; } dirHistory += currentDir; generateDir( dir ); } void FileView::generateDir( const QString & dir ) { if(menuKeepsOpen){ cancelMenuTimer(); } QDir d( dir ); if( d.exists() && !d.isReadable() ) return; currentDir = d.canonicalPath(); if( !showHidden) d.setFilter( QDir::Dirs | QDir::Files ); else d.setFilter( QDir::Dirs | QDir::Files |QDir::Hidden | QDir::All); d.setSorting( QDir::Name | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed ); const QFileInfoList * list = d.entryInfoList(); @@ -863,98 +863,98 @@ void FileBrowser::init(const QString & dir) viewMenu->insertItem( tr( "Hidden"), this, SLOT( updateShowHidden() ) ); viewMenu->insertItem( tr( "Symlinks"), this, SLOT( updateShowSymlinks() ) ); viewMenu->insertItem( tr( "Thumbnails"), this, SLOT( updateShowThumbnails() ) ); viewMenu->setItemChecked( viewMenu->idAt( 0 ), showHidden ); viewMenu->setItemChecked( viewMenu->idAt( 1 ), showSymlinks ); viewMenu->setItemChecked( viewMenu->idAt( 2 ), showThumbnails ); menuBar->insertItem( tr("View"), viewMenu ); toolBar = new QToolBar( this ); lastAction = new QAction( tr("Previous dir"), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 ); connect( lastAction, SIGNAL( activated() ), fileView, SLOT( lastDir() ) ); lastAction->addTo( toolBar ); lastAction->setEnabled( FALSE ); upAction = new QAction( tr("Parent dir"), Resource::loadIconSet( "up" ), QString::null, 0, this, 0 ); connect( upAction, SIGNAL( activated() ), fileView, SLOT( parentDir() ) ); upAction->addTo( toolBar ); QAction *a = new QAction( tr("New folder"), Resource::loadPixmap( "newfolder" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), fileView, SLOT( newFolder() ) ); a->addTo( toolBar ); a = new QAction( tr("Cut"), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), fileView, SLOT( cut() ) ); a->addTo( toolBar ); a = new QAction( tr("Copy"), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), fileView, SLOT( copy() ) ); a->addTo( toolBar ); pasteAction = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); connect( pasteAction, SIGNAL( activated() ), fileView, SLOT( paste() ) ); pasteAction->addTo( toolBar ); // dirLabel = new QLabel(this, "DirLabel"); connect( fileView, SIGNAL( dirChanged() ), SLOT( updateDirMenu() ) ); updateDirMenu(); QCopChannel* pcmciaChannel = new QCopChannel( "QPE/Card", this ); - connect( pcmciaChannel, SIGNAL(received(const QCString &, const QByteArray &)), - this, SLOT(pcmciaMessage( const QCString &, const QByteArray &)) ); + connect( pcmciaChannel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(pcmciaMessage(const QCString&,const QByteArray&)) ); } void FileBrowser::pcmciaMessage( const QCString &msg, const QByteArray &) { if ( msg == "mtabChanged()" ) { // ## Only really needed if current dir is on a card fileView->updateDir(); } } void FileBrowser::changeCaption(const QString & dir) { setCaption( dir); } void FileBrowser::dirSelected( int id ) { int i = 0, j; QString dir; // Bulid target dir from menu while( (j = dirMenu->idAt( i )) != id ){ dir += dirMenu->text( j ).stripWhiteSpace(); if( dirMenu->text( j ) != "/" ) dir += "/"; i++; } dir += dirMenu->text( dirMenu->idAt( i ) ).stripWhiteSpace(); fileView->setDir( dir ); } void FileBrowser::updateDirMenu() { QString spc, cd = fileView->cd(); QStringList l = QStringList::split( "/", cd ); int i = 0; dirMenu->clear(); dirMenu->insertItem( tr( "/" ), this, SLOT( dirSelected(int) ) ); for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it ) { spc.fill( ' ', i++); dirMenu->insertItem( spc + (*it), this, SLOT( dirSelected(int) ) ); } dirMenu->setItemChecked( dirMenu->idAt( l.count() ), TRUE ); lastAction->setEnabled( fileView->history().count() != 0 ); upAction->setEnabled( cd != "/" ); diff --git a/noncore/unsupported/gsmtool/gsmtool.cpp b/noncore/unsupported/gsmtool/gsmtool.cpp index 5940b0e..47920e5 100644 --- a/noncore/unsupported/gsmtool/gsmtool.cpp +++ b/noncore/unsupported/gsmtool/gsmtool.cpp @@ -1,91 +1,91 @@ #include "gsmtool.h" #include <qpushbutton.h> #include <qcombobox.h> #include <qlineedit.h> #include <qlabel.h> #include <qtabwidget.h> #include <qlistview.h> #include <qtextbrowser.h> #include <qmultilineedit.h> #include <termios.h> #include <gsmlib/gsm_me_ta.h> #include <gsmlib/gsm_unix_serial.h> #include <gsmlib/gsm_sms.h> #include <gsmlib/gsm_sorted_sms_store.h> using namespace gsmlib; /* * Constructs a GSMTool which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl ) : GSMToolBase( parent, name, fl ) { devicelocked = 0; me = NULL; sms_store = NULL; setConnected(FALSE); /* FIXME: Persistent settings for device/baudrate */ connect(ConnectButton, SIGNAL(clicked()), this, SLOT(doConnectButton())); connect(SMSDeleteButton, SIGNAL(clicked()), this, SLOT(doSMSDeleteButton())); connect(SMSSendButton, SIGNAL(clicked()), this, SLOT(doSMSSendButton())); connect(NewSMSClearButton, SIGNAL(clicked()), this, SLOT(doNewSMSClearButton())); connect(NewSMSSaveButton, SIGNAL(clicked()), this, SLOT(doNewSMSSaveButton())); connect(NewSMSSendButton, SIGNAL(clicked()), this, SLOT(doNewSMSSendButton())); connect(ScanButton, SIGNAL(clicked()), this, SLOT(doScanButton())); - connect(TabWidget2, SIGNAL(currentChanged(QWidget *)), this, SLOT(doTabChanged())); + connect(TabWidget2, SIGNAL(currentChanged(QWidget*)), this, SLOT(doTabChanged())); connect(SMSStoreList, SIGNAL(activated(int)), this, SLOT(doSMSStoreChanged())); connect(SMSViewType, SIGNAL(activated(int)), this, SLOT(doSMSTypeChanged())); - connect(SMSList, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(doSelectedSMSChanged(QListViewItem *))); + connect(SMSList, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(doSelectedSMSChanged(QListViewItem*))); timerid = -1; // Is this not possible normally? } /* * Destroys the object and frees any allocated resources */ GSMTool::~GSMTool() { // no need to delete child widgets, Qt does it all for us if (devicelocked) unlockDevice(); } const speed_t GSMTool::baudrates[12] = { B300, B600, B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400, B460800 }; int GSMTool::lockDevice( ) { devicelocked = 1; /* FIXME */ return 0; } void GSMTool::unlockDevice( ) { devicelocked = 0; } void GSMTool::setConnected( bool conn ) { TabWidget2->setTabEnabled(tab_2, conn); TabWidget2->setTabEnabled(tab_3, conn); //TabWidget2->setTabEnabled(tab_4, conn); NewSMSSendButton->setEnabled(conn); MfrLabel->setEnabled(conn); MfrText->setEnabled(conn); ModelLabel->setEnabled(conn); ModelText->setEnabled(conn); RevisionLabel->setEnabled(conn); RevisionText->setEnabled(conn); SerialLabel->setEnabled(conn); SerialText->setEnabled(conn); } void GSMTool::doTabChanged() { int index = TabWidget2->currentPageIndex(); diff --git a/noncore/unsupported/mail2/bend/bend.cpp b/noncore/unsupported/mail2/bend/bend.cpp index e2ece2a..ab6eb45 100644 --- a/noncore/unsupported/mail2/bend/bend.cpp +++ b/noncore/unsupported/mail2/bend/bend.cpp @@ -41,84 +41,84 @@ BenD::BenD(QWidget *parent, const char *name, WFlags fl) _intervalMs = _config->readNumEntry("CheckEvery", 5) * 60000; _intervalTimer = new QTimer(); _intervalTimer->start(_intervalMs); connect(_intervalTimer, SIGNAL(timeout()), SLOT(slotCheck())); QTimer::singleShot(0, this, SLOT(slotCheck())); } } void BenD::drawButton(QPainter *) { } void BenD::drawButtonText(QPainter *) { } void BenD::slotClicked() { QCopEnvelope e("QPE/System", "execute(QString)"); e << QString("mail"); ODevice *device = ODevice::inst(); if ( !device-> ledList ( ). isEmpty ( )) { OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0]; device->setLedState(led, Led_Off); } } void BenD::slotCheck() { // Check wether the check interval has been changed. int newIntervalMs = _config->readNumEntry("CheckEvery", 5) * 60000; if (newIntervalMs != _intervalMs) { _intervalTimer->changeInterval(newIntervalMs); _intervalMs = newIntervalMs; #ifndef QT_NO_DEBUG qWarning("BenD: Detected interval change"); #endif } QValueList<Account> acList = ConfigFile::getAccounts(); QValueList<Account>::Iterator ot; for (ot = acList.begin(); ot != acList.end(); ot++) { if (!((*ot).imapServer().isEmpty() || (*ot).imapPort().isEmpty() || (*ot).user().isEmpty() || (*ot).pass().isEmpty())) { if (!((*ot).imapSsl() && (*ot).imapSslPort().isEmpty())) { IMAPHandler *handler = new IMAPHandler(*ot); handler->iStatus("INBOX", "RECENT"); - connect(handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPStatus(IMAPResponse &))); + connect(handler, SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPStatus(IMAPResponse&))); } } } } void BenD::slotIMAPStatus(IMAPResponse &response) { - disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPStatus(IMAPResponse &))); + disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPStatus(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { if (response.STATUS()[0].recent().toInt() > 0) { ODevice *device = ODevice::inst(); if (isHidden()) show(); if (_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 (_config->readBoolEntry("PlaySound", false)) device->alarmSound(); } else { ODevice *device = ODevice::inst(); if (!isHidden()) hide(); if ( !device-> ledList ( ). isEmpty ( )) { OLed led = ( device-> ledList ( ). contains ( Led_Mail )) ? Led_Mail : device-> ledList ( ) [0]; device->setLedState(led, Led_Off); } } response.imapHandler()->iLogout(); } else qWarning("BenD: WARNING: Couldn't retrieve INBOX status."); } diff --git a/noncore/unsupported/mail2/composer.cpp b/noncore/unsupported/mail2/composer.cpp index cb80299..da1aee9 100644 --- a/noncore/unsupported/mail2/composer.cpp +++ b/noncore/unsupported/mail2/composer.cpp @@ -113,187 +113,187 @@ void Composer::slotPopupHandler(int itemid) if (tmp != QString(0)) attachView->currentItem()->setText(1, tmp); } else if (itemid == POPUP_ATTACH_REMOVE) { attachView->takeItem(attachView->currentItem()); } } void Composer::slotSendMail() { if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); return; } SendMail smail; smail.setFrom(from->currentText()); smail.setReplyTo(replyto->text()); smail.setTo(to->text()); smail.setCc(cc->text()); smail.setBcc(bcc->text()); smail.setSubject(subject->text()); smail.setMessage(message->text()); smail.setNeedsMime(attachView->childCount() == 0 ? false : true); smail.setAccount(accountsLoaded[from->currentItem()]); if (priority->currentItem() == POPUP_PRIO_LOW) { smail.setPriority("Low"); // No i18n on purpose } else if (priority->currentItem() == POPUP_PRIO_NORMAL) { smail.setPriority("Normal"); // No i18n on purpose } else if (priority->currentItem() == POPUP_PRIO_HIGH) { smail.setPriority("High"); // No i18n on purpose } QValueList<Attachment> attachments; QListViewItem *item; for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { attachments.append(((AttachViewItem *)item)->attachment()); } smail.setAttachments(attachments); QString header, message; MailFactory::genMail(header, message, smail, this); if (header.isNull() || message.isNull()) return; // Aborted. status->setStopEnabled(true); SmtpHandler *handler = new SmtpHandler(header, message, accountsLoaded[from->currentItem()], to->text()); connect(handler, SIGNAL(finished()), SLOT(slotSendFinished())); - connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendError(const QString &))); - connect(handler, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); + connect(handler, SIGNAL(error(const QString&)), SLOT(slotSendError(const QString&))); + connect(handler, SIGNAL(status(const QString&)), status, SLOT(setStatusText(const QString&))); } void Composer::slotSendQueued() { int effSendCount = 0; qDebug("Sending queued messages"); Config cfg( "mailqueue", Config::User ); cfg.setGroup( "Settings" ); _sendCount = 0; _sendError = 0; _toSend = cfg.readNumEntry( "count", 0 ); if (_toSend == 0) close(); qDebug("%i messages to send", _toSend); QString str; for (int i=1;i<=_toSend;i++) { qDebug("sending message %i",i); cfg.setGroup( "Mail_" + QString::number(i) ); SendMail smail; str = cfg.readEntry("from"); qDebug("setFrom %s",str.latin1()); smail.setFrom( str ); str = cfg.readEntry("reply"); qDebug("setReplyTo %s",str.latin1()); smail.setReplyTo( str ); QString toAdr = cfg.readEntry("to"); qDebug("to %s",toAdr.latin1()); smail.setTo( toAdr ); //to->text()); str = cfg.readEntry("cc"); qDebug("setCc %s",str.latin1()); smail.setCc( str ); //cc->text()); smail.setBcc( cfg.readEntry("bcc") ); //bcc->text()); str = cfg.readEntry("subject"); qDebug("setSubject %s",str.latin1()); smail.setSubject( str ); //subject->text()); str = cfg.readEntryCrypt("message"); qDebug("setMessage %s",str.latin1()); smail.setMessage( str ); //message->text()); smail.setNeedsMime( cfg.readBoolEntry("mime") ); //attachView->childCount() == 0 ? false : true); qDebug("setting account [%i]",cfg.readNumEntry("account")); Account accnt = accountsLoaded[ cfg.readNumEntry("account") ]; smail.setAccount( accnt ); //accountsLoaded[from->currentItem()]); int prio = cfg.readNumEntry( "priority" ); qDebug("setting priority %i",prio); if (prio == POPUP_PRIO_LOW) { smail.setPriority("Low"); // No i18n on purpose } else if (prio == POPUP_PRIO_NORMAL) { smail.setPriority("Normal"); // No i18n on purpose } else if (prio == POPUP_PRIO_HIGH) { smail.setPriority("High"); // No i18n on purpose } QValueList<Attachment> attachments; Attachment a; QString an; int ac = cfg.readNumEntry( "attachments", 0 ); qDebug("%i Attachments",ac); for (int j = 0; i < ac; ac++) { an = "Attachment_" + QString::number( j ); qDebug(an.latin1()); a.setFileName(cfg.readEntry( an + "fileName" )); a.setNewName(cfg.readEntry( an + "newName" )); a.setDescription(cfg.readEntry( an + "description" )); a.setDocLnk( DocLnk( cfg.readEntry( an + "docLnk" )) ); attachments.append( a ); } smail.setAttachments(attachments); qDebug("putting mail together"); QString header, message; MailFactory::genMail(header, message, smail, this); if (header.isNull() || message.isNull()) continue;//return; // Aborted. // abort->setEnabled(true); qDebug("Sending to %s",toAdr.latin1()); SmtpHandler *handler = new SmtpHandler(header, message, accnt ,toAdr); effSendCount++; connect(handler, SIGNAL(finished()), SLOT(slotSendQueuedFinished())); - connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendQueuedError(const QString &))); - connect(handler, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); + connect(handler, SIGNAL(error(const QString&)), SLOT(slotSendQueuedError(const QString&))); + connect(handler, SIGNAL(status(const QString&)), status, SLOT(setStatusText(const QString&))); } if (effSendCount < _toSend) { _toSend = effSendCount; QMessageBox::information(this, tr("Error"), tr("<p>There was a problem sending some of the queued mails.</p>"), tr("Ok")); } } void Composer::slotQueueMail() { if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); return; } Config cfg( "mailqueue", Config::User ); cfg.setGroup( "Settings" ); int count = cfg.readNumEntry( "count", 0 ); count++; cfg.writeEntry( "count", count ); qDebug("queueing mail %i",count); cfg.setGroup( "Mail_" + QString::number( count )); cfg.writeEntry( "from", from->currentText() ); cfg.writeEntry( "reply", replyto->text()); cfg.writeEntry( "to", to->text()); cfg.writeEntry( "cc", cc->text()); cfg.writeEntry( "bcc", bcc->text()); cfg.writeEntry( "subject", subject->text()); cfg.writeEntryCrypt( "message", message->text()); cfg.writeEntry( "mime", attachView->childCount() == 0 ); cfg.writeEntry( "account", from->currentItem()); cfg.writeEntry( "priority", priority->currentItem() ); cfg.writeEntry( "attachments", attachView->childCount() ); Attachment a; QListViewItem *item; QString an; int i = 0; for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { a = ((AttachViewItem *)item)->attachment(); an = "Attachment_" + QString::number( i++ ); cfg.writeEntry( an + "fileName", a.fileName() ); cfg.writeEntry( an + "newName", a.newName() ); cfg.writeEntry( an + "description", a.description() ); cfg.writeEntry( an + "docLnk", a.docLnk().file() ); diff --git a/noncore/unsupported/mail2/folderwidget.cpp b/noncore/unsupported/mail2/folderwidget.cpp index d27968b..a0520b1 100644 --- a/noncore/unsupported/mail2/folderwidget.cpp +++ b/noncore/unsupported/mail2/folderwidget.cpp @@ -15,300 +15,300 @@ #include "rename.h" FolderWidgetItem::FolderWidgetItem(Folder &folder, QListView *parent) : QListViewItem(parent), _folder(folder) { setPixmap(0, QPixmap(Resource::loadPixmap("mail/inbox"))); setText(0, _folder.topFolder().account().user() + " (" + _folder.topFolder().account().imapServer() + ")"); setOpen(true); } FolderWidgetItem::FolderWidgetItem(Folder &folder, FolderWidgetItem *parent) : QListViewItem(parent), _folder(folder) { if (_folder.noCache()) { setText(0, QObject::tr("<Foldertree not known.>")); } else { if (folder.fullName().upper() == "INBOX") { setPixmap(0, QPixmap(Resource::loadPixmap("mail/inbox"))); setText(0, QObject::tr("Inbox")); } else { setPixmap(0, QPixmap(Resource::loadPixmap("mail/folder"))); setText(0, folder.fullName()); } setOpen(true); } } FolderWidget::FolderWidget(QWidget *parent, const char *name, WFlags fl) : ListViewPlus(parent, name, fl) { header()->hide(); addColumn(""); setSorting(-1); QPopupMenu *menu = new QPopupMenu(); menu->insertItem(tr("Rename"), MENU_RENAME); menu->insertItem(tr("Delete"), MENU_DELETE); menu->insertItem(tr("Move"), MENU_MOVE); menu->insertItem(tr("Copy"), MENU_COPY); menu->insertSeparator(); menu->insertItem(tr("Create folder"), MENU_CREATE); menu->insertSeparator(); menu->insertItem(tr("Rescan folder list"), MENU_RESCAN); setPopup(menu); getAccounts(); connect(menu, SIGNAL(activated(int)), SLOT(slotMenuActivated(int))); - connect(this, SIGNAL(clicked(QListViewItem *)), SLOT(slotItemClicked(QListViewItem *))); + connect(this, SIGNAL(clicked(QListViewItem*)), SLOT(slotItemClicked(QListViewItem*))); } FolderWidget::~FolderWidget() { // TODO: Save folder tree. } void FolderWidget::update() { getAccounts(); } void FolderWidget::getAccounts() { clear(); QValueList<Account> accounts = ConfigFile::getAccounts(); QValueList<Account>::Iterator it; for (it = accounts.begin(); it != accounts.end(); it++) { FolderWidgetItem *item = addAccount(*it); QFile f((QString) getenv("HOME") + "/Applications/mail/foldercache/foldercache-" + (*it).accountName()); if (!f.open(IO_ReadOnly)) { Folder folder; folder.setNoCache(true); addFolder(folder, item); } else { QTextStream t(&f); while (!t.atEnd()) { QString separator = t.readLine(); QString fullname = t.readLine(); Folder folder; folder.setSeparator(separator); folder.setFullName(fullname); folder.setTopFolder(item->folder().topFolder()); addFolder(folder, item); } f.close(); } } } FolderWidgetItem *FolderWidget::addAccount(Account &account) { TopFolder tf; tf.setAccount(account); // XXX This has to change!!! The folderwidget may not create an // XXX IMAPHandler!!!! Do this in IMAPHandler! tf.setIMAPHandler(new IMAPHandler(account)); Folder folder; folder.setTopFolder(tf); connect(tf.handler(), SIGNAL(IMAPLookingUpHost()), SLOT(slotIMAPLookingUpHost())); connect(tf.handler(), SIGNAL(IMAPHostFound()), SLOT(slotIMAPHostFound())); connect(tf.handler(), SIGNAL(IMAPConnected()), SLOT(slotIMAPConnected())); connect(tf.handler(), SIGNAL(IMAPDisconnected()), SLOT(slotIMAPDisconnected())); connect(tf.handler(), SIGNAL(IMAPError(int)), SLOT(slotIMAPError(int))); return new FolderWidgetItem(folder, this); } FolderWidgetItem *FolderWidget::addFolder(Folder &folder, FolderWidgetItem *folderWidgetItem) { return new FolderWidgetItem(folder, folderWidgetItem); } void FolderWidget::slotMenuActivated(int itemid) { if (currentItem() == NULL) { QMessageBox::information(this, tr("Error"), tr("<p>Please select an item first.</p>"), tr("Ok")); return; } if (itemid == MENU_RENAME) { if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return; Folder folder = ((FolderWidgetItem *)currentItem())->folder(); QString newName = Rename::rename(folder.fullName(), this); if (newName.isNull()) return; folder.topFolder().handler()->iRename(folder.fullName(), newName); - connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPRename(IMAPResponse &))); + connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPRename(IMAPResponse&))); } else if (itemid == MENU_DELETE) { if (((FolderWidgetItem *)currentItem())->folder().fullName().isEmpty()) return; Folder folder = ((FolderWidgetItem *)currentItem())->folder(); int ret = QMessageBox::information(this, tr("Question"), tr("<p>Do you really want to delete <pre>%1</pre>?").arg(folder.fullName()), tr("Yes"), tr("No")); if (ret == 1) return; _createFolder = folder; folder.topFolder().handler()->iDelete(folder.fullName()); - connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPDelete(IMAPResponse &))); + connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPDelete(IMAPResponse&))); } else if (itemid == MENU_MOVE) { } else if (itemid == MENU_COPY) { } else if (itemid == MENU_CREATE) { Folder folder = (((FolderWidgetItem *)currentItem())->folder()); _createFolder = folder; QString folderName = Rename::getText(tr("Foldername"), tr("<p>Please enter the name of the new folder.</p>"), this); if (folderName.isNull()) return; folder.topFolder().handler()->iCreate(folder.fullName() + folder.separator() + folderName); - connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPCreate(IMAPResponse &))); + connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPCreate(IMAPResponse&))); } else if (itemid == MENU_RESCAN) { Folder folder = (((FolderWidgetItem *)currentItem())->folder()); _rescanAccount = folder.topFolder().account(); folder.topFolder().handler()->iList("", "*"); - connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &))); + connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPList(IMAPResponse&))); } } void FolderWidget::slotItemClicked(QListViewItem *item) { if (item == NULL) return; Folder folder = ((FolderWidgetItem *)item)->folder(); if (folder.fullName().isEmpty()) return; emit folderSelected(folder); } void FolderWidget::slotIMAPLookingUpHost() { emit status(tr("Looking up host...")); emit connecting(); } void FolderWidget::slotIMAPHostFound() { emit status(tr("Host found.")); } void FolderWidget::slotIMAPConnected() { emit status(tr("Connected to host.")); emit connected(); } void FolderWidget::slotIMAPError(int error) { if (error == IMAPBase::IMAPErrConnectionRefused) { QMessageBox::warning(this, tr("Error"), tr("<p>The IMAP connection was refused.</p>"), tr("Ok")); } else if (error == IMAPBase::IMAPErrHostNotFound) { QMessageBox::warning(this, tr("Error"), tr("<p>The host was not found.</p>"), tr("Ok")); } else if (error == IMAPBase::IMAPErrSocketRead) { QMessageBox::warning(this, tr("Error"), tr("<p>There was an error while reading from the socket.</p>"), tr("Ok")); } else if (error == IMAPBase::IMAPErrLoginFailed) { QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Check your password/username.</p>"), tr("Ok")); } else { QMessageBox::warning(this, tr("Error"), tr("<p>An unknown error was encountered.</p>"), tr("Ok")); } } void FolderWidget::slotIMAPDisconnected() { emit status(tr("Disconnected.")); emit disconnected(); } void FolderWidget::slotIMAPLogin(IMAPResponse &response) { - disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPLogin(IMAPResponse &))); + disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPLogin(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { emit status(tr("Login successful!")); } else { QMessageBox::warning(this, tr("Error"), tr("<p>Login failed. Go away.</p>"), tr("Ok")); } } void FolderWidget::slotIMAPRename(IMAPResponse &response) { - disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPRename(IMAPResponse &))); + disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPRename(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { emit status(tr("Renaming successful!")); } else { QMessageBox::warning(this, tr("Error"), tr("<p>Renaming failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); } } void FolderWidget::slotIMAPDelete(IMAPResponse &response) { - disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPDelete(IMAPResponse &))); + disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPDelete(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { emit status(tr("Deletion successful!")); _rescanAccount = _createFolder.topFolder().account(); _createFolder.topFolder().handler()->iList(".", "*"); - connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &))); + connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPList(IMAPResponse&))); } else { QMessageBox::warning(this, tr("Error"), tr("<p>Delete failed. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); } } void FolderWidget::slotIMAPCreate(IMAPResponse &response) { - disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPCreate(IMAPResponse &))); + disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPCreate(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { emit status(tr("Folder created. Rescanning...")); _rescanAccount = _createFolder.topFolder().account(); _createFolder.topFolder().handler()->iList(".", "*"); - connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPList(IMAPResponse &))); + connect(_createFolder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPList(IMAPResponse&))); } else { QMessageBox::warning(this, tr("Error"), tr("<p>The folder could not be created. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); } } void FolderWidget::slotIMAPList(IMAPResponse &response) { - disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPList(IMAPResponse &))); + disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPList(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { QDir d((QString) getenv("HOME") + "/Applications/mail/foldercache"); if (!d.exists()) { system("mkdir -p $HOME/Applications/mail/foldercache"); qWarning("Created $HOME/Applications/mail/foldercache."); } QFile f((QString) getenv("HOME") + "/Applications/mail/foldercache/foldercache-" + _rescanAccount.accountName()); if (!f.open(IO_WriteOnly)) { QMessageBox::critical(this, tr("Error"), tr("<p>Couldn't open folder cache file for writing!</p>"), tr("Ok")); return; } QTextStream t(&f); QValueList<IMAPResponseLIST>::Iterator it; QValueList<IMAPResponseLIST> lists = response.LIST(); for (it = lists.begin(); it != lists.end(); it++) { t << (*it).folderSeparator() << "\n"; t << (*it).folder() << "\n"; } f.close(); emit status(tr("Got folder list.")); getAccounts(); } else { QMessageBox::warning(this, tr("Error"), tr("<p>Couldn't retrieve the folder list. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); } } diff --git a/noncore/unsupported/mail2/libmail/imaphandler.cpp b/noncore/unsupported/mail2/libmail/imaphandler.cpp index dc97b28..8da0acd 100644 --- a/noncore/unsupported/mail2/libmail/imaphandler.cpp +++ b/noncore/unsupported/mail2/libmail/imaphandler.cpp @@ -1,62 +1,62 @@ #include "imapresponse.h" #include "imaphandler.h" #include "imapbase.h" IMAPHandler::IMAPHandler(const Account &account) : QObject(), _account(account) { _ready = false; _loggingin = false; _loggedin = false; _tag = 0; _ibase = new IMAPBase(account); - connect(_ibase, SIGNAL(dataReceived(const QString &)), SLOT(slotDataReceived(const QString &))); + connect(_ibase, SIGNAL(dataReceived(const QString&)), SLOT(slotDataReceived(const QString&))); connect(_ibase, SIGNAL(lookingUpHost()), SLOT(slotLookingUpHost())); connect(_ibase, SIGNAL(hostFound()), SLOT(slotHostFound())); connect(_ibase, SIGNAL(connected()), SLOT(slotConnected())); connect(_ibase, SIGNAL(disconnected()), SLOT(slotDisconnected())); connect(_ibase, SIGNAL(error(int)), SLOT(slotError(int))); } void IMAPHandler::doLogin() { if (_loggedin) return; if (_loggingin) return; _loggingin = true; iLogin(_account.user(), _account.pass()); } QString IMAPHandler::iCapability() { _ibase->sendCommand(QString("%1 CAPABILITY\r\n") .arg(tag())); return tag(false); } QString IMAPHandler::iNoop() { _ibase->sendCommand(QString("%1 NOOP\r\n") .arg(tag())); return tag(false); } QString IMAPHandler::iLogout() { _ibase->sendCommand(QString("%1 LOGOUT\r\n") .arg(tag())); return tag(false); } QString IMAPHandler::iAuthenticate(const QString &mechanism) { _ibase->sendCommand(QString("%1 AUTHENTICATE \"%2\"\r\n") .arg(tag()) .arg(escape(mechanism))); return tag(false); } QString IMAPHandler::iLogin(const QString &user, const QString &pass) { _ibase->sendCommand(QString("%1 LOGIN \"%2\" \"%3\"\r\n") @@ -254,93 +254,93 @@ QString IMAPHandler::iCopy(const QString &message, const QString &mailbox) .arg(escape(mailbox))); return tag(false); } QString IMAPHandler::iUid(const QString &command, const QString &arguments) { doLogin(); _ibase->sendCommand(QString("%1 UID %2 %3\r\n") .arg(tag()) .arg(command) .arg(arguments)); return tag(false); } QString IMAPHandler::iX(const QString &commandAtom, const QString &arguments) { doLogin(); _ibase->sendCommand(QString("%1 X%2 %3\r\n") .arg(tag()) .arg(commandAtom) .arg(arguments)); return tag(false); } QString IMAPHandler::escape(const QString &in) { QString in_ = in; return in_.replace(QRegExp("\""), "\\\""); } QString IMAPHandler::tag(bool count) { return QString("a%1").arg(count ? _tag++ : _tag); } void IMAPHandler::slotDataReceived(const QString &data) { if (!_ready) { // The first data is always the greeting string. // We can ignore it. _ready = true; return; } IMAPResponseParser parser; -// connect ( &parser, SIGNAL( needMoreData ( QString & )), _ibase, SLOT( tryRead ( QString & ))); +// connect ( &parser, SIGNAL( needMoreData(QString&)), _ibase, SLOT( tryRead(QString&))); parser. parse ( data ); IMAPResponse response = parser.response(); -// disconnect ( &parser, SIGNAL( needMoreData ( QString & )), _ibase, SLOT( tryRead ( QString & ))); +// disconnect ( &parser, SIGNAL( needMoreData(QString&)), _ibase, SLOT( tryRead(QString&))); response.setImapHandler(this); if (!_loggingin) { qDebug("Emitting gotResponse!\n" ); emit gotResponse(response); } else { if (response.statusResponse().status() == IMAPResponseEnums::OK) { _loggingin = false; _loggedin = true; qWarning("OK. Logged in. Leaving loggingin state."); } else { _loggingin = false; emit IMAPError(IMAPBase::IMAPErrLoginFailed); } } } void IMAPHandler::slotLookingUpHost() { emit IMAPLookingUpHost(); } void IMAPHandler::slotHostFound() { emit IMAPHostFound(); } void IMAPHandler::slotConnected() { emit IMAPConnected(); } void IMAPHandler::slotDisconnected() { _loggedin = false; emit IMAPDisconnected(); } void IMAPHandler::slotError(int err) { emit IMAPError(err); } diff --git a/noncore/unsupported/mail2/listviewplus.cpp b/noncore/unsupported/mail2/listviewplus.cpp index ce5f35f..722b347 100644 --- a/noncore/unsupported/mail2/listviewplus.cpp +++ b/noncore/unsupported/mail2/listviewplus.cpp @@ -1,54 +1,54 @@ #include <qpopupmenu.h> #include <qtimer.h> #include "listviewplus.h" ListViewPlus::ListViewPlus(QWidget *parent, const char *name, WFlags fl) : QListView(parent, name, fl) { } void ListViewPlus::keyPressEvent(QKeyEvent *event) { switch(event->key()) { case Qt::Key_Space: // FALLTHROUGH case Qt::Key_Enter: if (currentItem() != 0) emit clicked(currentItem()); break; default: break; } QListView::keyPressEvent(event); } void ListViewPlus::setPopup(QPopupMenu *popup, int delay) { _popup = popup; _delay = delay; - connect(this, SIGNAL(pressed(QListViewItem *, const QPoint &, int)), SLOT(_initPopup(QListViewItem *, const QPoint &, int))); - connect(this, SIGNAL(clicked(QListViewItem *, const QPoint &, int)), SLOT(_cancelPopup(QListViewItem *, const QPoint &, int))); + connect(this, SIGNAL(pressed(QListViewItem*,const QPoint&,int)), SLOT(_initPopup(QListViewItem*,const QPoint&,int))); + connect(this, SIGNAL(clicked(QListViewItem*,const QPoint&,int)), SLOT(_cancelPopup(QListViewItem*,const QPoint&,int))); } void ListViewPlus::_initPopup(QListViewItem *, const QPoint &point, int) { _point = point; _timer = new QTimer(); _timer->start(_delay, true); connect(_timer, SIGNAL(timeout()), this, SLOT(_showPopup())); } void ListViewPlus::_cancelPopup(QListViewItem *, const QPoint &, int) { delete _timer; } void ListViewPlus::_showPopup() { _popup->popup(_point); } diff --git a/noncore/unsupported/mail2/mailtable.cpp b/noncore/unsupported/mail2/mailtable.cpp index fd179f0..56feab0 100644 --- a/noncore/unsupported/mail2/mailtable.cpp +++ b/noncore/unsupported/mail2/mailtable.cpp @@ -29,143 +29,143 @@ MailTableItem::MailTableItem(QListView *parent, IMAPResponseFETCH fetch) void MailTableItem::paintCell(QPainter *painter, const QColorGroup &cg, int col, int width, int align) { QColor color = cg.color(QColorGroup::Text); QFont font = painter->font(); if (_draft) { color = QColor("#707070"); } else if (_new) { color = QColor("#ff0000"); font.setBold(true); } else if (_unseen) { font.setBold(true); } painter->setFont(font); QColorGroup cg_(cg); cg_.setColor(QColorGroup::Text, color); QListViewItem::paintCell(painter, cg_, col, width, align); } MailTable::MailTable(QWidget *parent, const char *name, WFlags fl) : ListViewPlus(parent, name, fl), _parent(parent) { _stopped = false; setSorting(-1); setAllColumnsShowFocus(true); addColumn(tr("From"), 100); addColumn(tr("Subject"), 100); addColumn(tr("Date"), 100); QPopupMenu *menu = new QPopupMenu(this); menu->insertItem(tr("Copy"), MENU_COPY); QPopupMenu *markMenu = new QPopupMenu(this); markMenu->insertItem(tr("Seen"), MENU_MARK_READ); markMenu->insertItem(tr("Unseen"), MENU_MARK_UNREAD); markMenu->insertSeparator(); markMenu->insertItem(tr("Marked"), MENU_MARK_MARKED); markMenu->insertItem(tr("Unmarked"), MENU_MARK_UNMARKED); menu->insertItem(tr("Mark as..."), markMenu, MENU_MARK); menu->insertSeparator(); menu->insertItem(tr("Delete Mail"), MENU_DELETE); setPopup(menu); - connect(this, SIGNAL(clicked(QListViewItem *)), SLOT(itemClicked(QListViewItem *))); + connect(this, SIGNAL(clicked(QListViewItem*)), SLOT(itemClicked(QListViewItem*))); } void MailTable::setFolder(Folder folder) { folder.topFolder().handler()->iSelect(folder.fullName()); _handler = folder.topFolder().handler(); - connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPSelect(IMAPResponse &))); + connect(folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPSelect(IMAPResponse&))); } void MailTable::setHeaders(QValueList<IMAPResponseFETCH> response) { clear(); QValueList<IMAPResponseFETCH>::Iterator it; for (it = response.begin(); it != response.end(); it++) { (void) new MailTableItem(this, *it); } } void MailTable::slotIMAPSelect(IMAPResponse &response) { - disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPSelect(IMAPResponse &))); + disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPSelect(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { clear(); QString mails = response.EXISTS()[0].mails(); if (mails.toInt() == 0) { emit status(tr("Mailbox contained no mails.")); return; } int a = mails.toInt() / 5; int b = mails.toInt() % 5; _downloadSteps = a; if (b > 0) _downloadSteps++; _lastStep = b; _currentProgress = 0; emit totalSteps(_downloadSteps); emit progress(_currentProgress); emit stopEnabled(true); response.imapHandler()->iFetch(QString("1:%1").arg((a == 0) ? b : 5), "ENVELOPE FLAGS UID"); emit status(tr("Getting mail headers...")); - connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPFetch(IMAPResponse &))); + connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPFetch(IMAPResponse&))); } else { QMessageBox::warning(this, tr("Error"), tr("<p>An error occoured during the selection of the mailbox. (Server said: %1)</p>").arg(response.statusResponse().comment()), tr("Ok")); } } void MailTable::slotIMAPFetch(IMAPResponse &response) { - disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPFetch(IMAPResponse &))); + disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPFetch(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { QValueList<IMAPResponseFETCH>::Iterator it; QValueList<IMAPResponseFETCH> fetch = response.FETCH(); for (it = fetch.begin(); it != fetch.end(); it++) { (void) new MailTableItem(this, *it); } emit progress(++_currentProgress); if (_currentProgress != _downloadSteps) { if (_stopped) { _currentProgress = 0; _downloadSteps = 0; _lastStep = 0; _stopped = false; emit status(tr("Stopped")); emit resetProgress(); emit stopEnabled(false); } else { response.imapHandler()->iFetch(QString("%1:%2").arg(_currentProgress * 5 + 1).arg((_currentProgress + 1 == _downloadSteps) ? _currentProgress * 5 + _lastStep : _currentProgress * 5 + 5), "ENVELOPE FLAGS UID"); - connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPFetch(IMAPResponse &))); + connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPFetch(IMAPResponse&))); } } else { _currentProgress = 0; _downloadSteps = 0; _lastStep = 0; emit status(tr("Got all mail headers.")); emit resetProgress(); emit stopEnabled(false); } } else { emit status(tr("<font color=#ff0000>Couldn't fetch mail.")); } } void MailTable::itemClicked(QListViewItem *item) { if (item == NULL) return; emit mailClicked(((MailTableItem *)item)->fetch(), _handler); } diff --git a/noncore/unsupported/mail2/mainwindow.cpp b/noncore/unsupported/mail2/mainwindow.cpp index 0d09ec8..ce80391 100644 --- a/noncore/unsupported/mail2/mainwindow.cpp +++ b/noncore/unsupported/mail2/mainwindow.cpp @@ -1,94 +1,94 @@ #include <qmessagebox.h> #include <qaction.h> #include <qapplication.h> #include <qpe/qcopenvelope_qws.h> #include "mailstatusbar.h" #include "folderwidget.h" #include "mainwindow.h" #include "configdiag.h" #include "configfile.h" #include "searchdiag.h" #include "mailtable.h" #include "composer.h" #include "viewmail.h" #include "mailfactory.h" MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl) : MainWindowBase(parent, name, fl) { status->setStopEnabled(false); - connect(folderView, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); + connect(folderView, SIGNAL(status(const QString&)), status, SLOT(setStatusText(const QString&))); connect(folderView, SIGNAL(folderSelected(Folder)), mailView, SLOT(setFolder(Folder))); - connect(mailView, SIGNAL(mailClicked(IMAPResponseFETCH, IMAPHandler *)), SLOT(mailClicked(IMAPResponseFETCH, IMAPHandler *))); - connect(mailView, SIGNAL(status(const QString &)), status, SLOT(setStatusText(const QString &))); + connect(mailView, SIGNAL(mailClicked(IMAPResponseFETCH,IMAPHandler*)), SLOT(mailClicked(IMAPResponseFETCH,IMAPHandler*))); + connect(mailView, SIGNAL(status(const QString&)), status, SLOT(setStatusText(const QString&))); connect(mailView, SIGNAL(totalSteps(int)), status, SLOT(setProgressTotalSteps(int))); connect(mailView, SIGNAL(progress(int)), status, SLOT(setProgress(int))); connect(mailView, SIGNAL(resetProgress()), status, SLOT(resetProgress())); connect(mailView, SIGNAL(stopEnabled(bool)), status, SLOT(setStopEnabled(bool))); connect(status, SIGNAL(stop()), mailView, SLOT(stop())); connect(compose, SIGNAL(activated()), SLOT(slotComposeNoParams())); connect(sendQueue, SIGNAL(activated()), SLOT(slotSendQueued())); connect(findmails, SIGNAL(activated()), SLOT(slotSearch())); connect(configure, SIGNAL(activated()), SLOT(slotConfigure())); // Added by Stefan Eilers to allow starting by addressbook.. #if !defined(QT_NO_COP) // QCopChannel *addressChannel = new QCopChannel("QPE/Application/mail" , this ); -// connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), -// this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); - connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), - this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); +// connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)), +// this, SLOT ( appMessage(const QCString&,const QByteArray&) ) ); + connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), + this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); #endif } // Added by Stefan Eilers to allow starting by addressbook.. void MainWindow::appMessage(const QCString &msg, const QByteArray &data) { if (msg == "writeMail(QString,QString)") { QDataStream stream(data,IO_ReadOnly); QString name, email; stream >> name >> email; qWarning("opie-mail:: Should send mail to %s with address %s", name.latin1(), email.latin1() ); slotCompose( name, email ); }else{ QString str_message = msg; qWarning("opie-mail:: Received unknown QCop-Message: %s", str_message.latin1() ); } } void MainWindow::slotCompose( const QString& name, const QString& email ) { Composer composer(this, 0, true); // If there is a mailaddress given, create message.. if ( ! name.isEmpty() ){ qWarning("opie-mail:: Compose mail for %s with address %s", name.latin1(), email.latin1() ); SendMail compMail; compMail.setTo( "\"" + name + "\"" + " " + "<"+ email + ">"); composer.setSendMail( compMail ); } composer.showMaximized(); composer.exec(); } void MainWindow::slotComposeNoParams() { slotCompose( 0l, 0l); } void MainWindow::slotSendQueued() { Composer composer(this, 0, true, true); // composer.sendQueue(); composer.showMaximized(); composer.exec(); // composer.close(); diff --git a/noncore/unsupported/mail2/searchdiag.cpp b/noncore/unsupported/mail2/searchdiag.cpp index 907f6ff..6fb4e4d 100644 --- a/noncore/unsupported/mail2/searchdiag.cpp +++ b/noncore/unsupported/mail2/searchdiag.cpp @@ -1,128 +1,128 @@ #include <qmessagebox.h> #include <qpushbutton.h> #include <qcombobox.h> #include <qlineedit.h> #include <qpe/qpeapplication.h> #include "imaphandler.h" #include "searchdiag.h" #include "viewmail.h" #define INMENU_BODY 0 #define INMENU_HEADERF 1 #define INMENU_SUBJECT 2 #define INMENU_FROM 3 #define INMENU_TO 4 SearchDiag::SearchDiag(QWidget *parent, const char *name, WFlags fl) : SearchDiagBase(parent, name, fl) { _selected = false; in->insertItem(tr("Body"), INMENU_BODY); in->insertItem(tr("Header Field"), INMENU_HEADERF); in->insertItem(tr("Subject"), INMENU_SUBJECT); in->insertItem(tr("From"), INMENU_FROM); in->insertItem(tr("To"), INMENU_TO); connect(folderView, SIGNAL(folderSelected(Folder)), SLOT(folderSelected(Folder))); connect(in, SIGNAL(activated(int)), SLOT(slotInItemActivated(int))); - connect(mailTable, SIGNAL(mailClicked(IMAPResponseFETCH, IMAPHandler *)), SLOT(slotMailClicked(IMAPResponseFETCH, IMAPHandler *))); + connect(mailTable, SIGNAL(mailClicked(IMAPResponseFETCH,IMAPHandler*)), SLOT(slotMailClicked(IMAPResponseFETCH,IMAPHandler*))); } void SearchDiag::accept() { if (searchFor->text().isEmpty()) { QMessageBox::information(this, tr("Error"), tr("<p>Please enter what to search for.</p>"), tr("Ok")); return; } if (!_selected) { QMessageBox::information(this, tr("Error"), tr("<p>Please select a folder.</p>"), tr("Ok")); return; } if (in->currentItem() == INMENU_HEADERF && other->currentText().isEmpty()) { QMessageBox::information(this, tr("Error"), tr("<p>Please enter a header field to search in.</p>"), tr("Ok")); return; } _folder.topFolder().handler()->iSelect(_folder.fullName()); - connect(_folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPSelect(IMAPResponse &))); + connect(_folder.topFolder().handler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPSelect(IMAPResponse&))); } void SearchDiag::folderSelected(Folder folder) { _selected = true; _folder = folder; } void SearchDiag::slotIMAPSelect(IMAPResponse &response) { - disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPSelect(IMAPResponse &))); + disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPSelect(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { if (in->currentItem() == INMENU_BODY) { response.imapHandler()->iSearch("BODY \"" + searchFor->text() + "\""); } else if (in->currentItem() == INMENU_HEADERF) { response.imapHandler()->iSearch("HEADER \""+ other->currentText() + "\" \"" + searchFor->text() + "\""); } else if (in->currentItem() == INMENU_SUBJECT) { response.imapHandler()->iSearch("SUBJECT \"" + searchFor->text() + "\""); } else if (in->currentItem() == INMENU_FROM) { response.imapHandler()->iSearch("FROM \"" + searchFor->text() + "\""); } else if (in->currentItem() == INMENU_TO) { response.imapHandler()->iSearch("TO \"" + searchFor->text() + "\""); } else return; - connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPSearch(IMAPResponse &))); + connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPSearch(IMAPResponse&))); } else { QMessageBox::warning(this, tr("Error"), tr("<p>Could not select the folder. Aborting. (Server said: %1)").arg(response.statusResponse().comment()), tr("Ok")); } } void SearchDiag::slotIMAPSearch(IMAPResponse &response) { - disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPSearch(IMAPResponse &))); + disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPSearch(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { IMAPResponseSEARCH results = response.SEARCH()[0]; if (results.mails().count() == 0) { QMessageBox::information(this, tr("Results"), tr("<p>No mails match your criteria.</p>"), tr("Ok")); return; } response.imapHandler()->iFetch(results.mails().join(","), "ENVELOPE FLAGS UID"); - connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPFetch(IMAPResponse &))); + connect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPFetch(IMAPResponse&))); } else { QMessageBox::warning(this, tr("Error"), tr("<p>Search failed. (Server said: %1)").arg(response.statusResponse().comment()), tr("Ok")); } } void SearchDiag::slotIMAPFetch(IMAPResponse &response) { - disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPSearch(IMAPResponse &))); + disconnect(response.imapHandler(), SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPSearch(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { mailTable->setHeaders(response.FETCH()); } else { QMessageBox::warning(this, tr("Error"), tr("<p>Couldn't fetch the mail headers. (Server said: %1)").arg(response.statusResponse().comment())); } } void SearchDiag::slotMailClicked(IMAPResponseFETCH fetch, IMAPHandler *) { ViewMail viewMail(fetch, _folder.topFolder().handler(), this, 0, true); viewMail.showMaximized(); viewMail.exec(); } void SearchDiag::slotInItemActivated(int index) { if (index == INMENU_HEADERF) { other->setEnabled(true); } else { other->setEnabled(false); } } diff --git a/noncore/unsupported/mail2/viewmail.cpp b/noncore/unsupported/mail2/viewmail.cpp index da6924d..0cfb6e5 100644 --- a/noncore/unsupported/mail2/viewmail.cpp +++ b/noncore/unsupported/mail2/viewmail.cpp @@ -14,97 +14,97 @@ AttachItem::AttachItem(QListView *parent, AttachItemStore &attachItemStore) setText(1, _attachItemStore.fileName()); setText(2, _attachItemStore.description()); } AttachItem::AttachItem(QListViewItem *parent, AttachItemStore &attachItemStore) : QListViewItem(parent), _attachItemStore(attachItemStore) { setText(0, _attachItemStore.mimeType()); setText(1, _attachItemStore.fileName()); setText(2, _attachItemStore.description()); } ViewMail::ViewMail(IMAPResponseFETCH &mail, IMAPHandler *handler, QWidget *parent, const char *name, WFlags fl) : ViewMailBase(parent, name, fl), _inLoop(false), _mail(mail), _handler(handler) { setCaption(caption().arg(mail.envelope().from()[0].name())); _gotBody = false; _mailHtml = tr( "<html><body>" "<div align=center><b>%1</b></div>" "<b>From:</b> %2<br>" "<b>To:</b> %3<br>" "%4" "%5" "<b>Date:</b> %6<hr>" "<font face=fixed>%7</font>") .arg(deHtml(mail.envelope().subject().isNull() ? tr("(no subject)") : deHtml(mail.envelope().subject()))) .arg(deHtml(mail.envelope().from().toString().isNull() ? tr("(no from)") : mail.envelope().from().toString())) .arg(deHtml(mail.envelope().to().toString().isNull() ? tr("(no recipient)") : mail.envelope().to().toString())) .arg(mail.envelope().cc().toString().isNull() ? QString(0) : tr("<b>Cc:</b> %1<br>").arg(deHtml(mail.envelope().cc().toString()))) .arg(mail.envelope().bcc().toString().isNull() ? QString(0) : tr("<b>Bcc:</b> %1<br>").arg(deHtml(mail.envelope().bcc().toString()))) .arg(mail.envelope().mailDate().isNull() ? tr("(no date)") : mail.envelope().mailDate()) .arg("%1"); connect(reply, SIGNAL(activated()), SLOT(slotReply())); connect(forward, SIGNAL(activated()), SLOT(slotForward())); attachments->setEnabled(_gotBody); browser->setText(QString(_mailHtml).arg(tr("Getting mail body from server. Please wait..."))); _handler->iUid("FETCH", QString("%1 (BODY[1])").arg(mail.uid())); - connect(_handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPUid(IMAPResponse &))); + connect(_handler, SIGNAL(gotResponse(IMAPResponse&)), SLOT(slotIMAPUid(IMAPResponse&))); } ViewMail::~ViewMail() { hide(); } void ViewMail::hide() { QWidget::hide(); if (_inLoop) { _inLoop = false; qApp->exit_loop(); } } void ViewMail::exec() { show(); if (!_inLoop) { _inLoop = true; qApp->enter_loop(); } } QString ViewMail::deHtml(const QString &string) { QString string_ = string; string_.replace(QRegExp("&"), "&"); string_.replace(QRegExp("<"), "<"); string_.replace(QRegExp(">"), ">"); string_.replace(QRegExp("\\n"), "<br>"); return string_; } void ViewMail::slotReply() { if (!_gotBody) { QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); return; } QString rtext; rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose .arg(_mail.envelope().from()[0].toString()) .arg(_mail.envelope().mailDate()); @@ -134,65 +134,65 @@ void ViewMail::slotReply() } void ViewMail::slotForward() { if (!_gotBody) { QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); return; } QString ftext; ftext += QString("\n----- Forwarded message from %1 -----\n\n") .arg(_mail.envelope().from()[0].toString()); if (!_mail.envelope().mailDate().isNull()) ftext += QString("Date: %1\n") .arg(_mail.envelope().mailDate()); if (!_mail.envelope().from()[0].toString().isNull()) ftext += QString("From: %1\n") .arg(_mail.envelope().from()[0].toString()); if (!_mail.envelope().to().toString().isNull()) ftext += QString("To: %1\n") .arg(_mail.envelope().to().toString()); if (!_mail.envelope().cc().toString().isNull()) ftext += QString("Cc: %1\n") .arg(_mail.envelope().cc().toString()); if (!_mail.envelope().bcc().toString().isNull()) ftext += QString("Bcc: %1\n") .arg(_mail.envelope().bcc().toString()); if (!_mail.envelope().subject().isNull()) ftext += QString("Subject: %1\n") .arg(_mail.envelope().subject()); ftext += QString("\n%1\n") .arg(_mail.bodyPart(1).data()); ftext += QString("----- End forwarded message -----\n"); SendMail sendMail; sendMail.setSubject("Fwd: " + _mail.envelope().subject()); sendMail.setMessage(ftext); Composer composer(this, 0, true); composer.setSendMail(sendMail); composer.showMaximized(); composer.exec(); } void ViewMail::slotIMAPUid(IMAPResponse &response) { - disconnect(_handler, SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPUid(IMAPResponse &))); + disconnect(_handler, SIGNAL(gotResponse(IMAPResponse&)), this, SLOT(slotIMAPUid(IMAPResponse&))); if (response.statusResponse().status() == IMAPResponseEnums::OK) { QValueList<IMAPResponseBodyPart> bodyParts; bodyParts.append(response.FETCH()[0].bodyPart(0)); _mail.setBodyParts(bodyParts); browser->setText(QString(_mailHtml).arg(deHtml(response.FETCH()[0].bodyPart(0).data()))); // fillList(response.FETCH()[0].bodyStructure()); _gotBody = true; } else { QMessageBox::warning(this, tr("Error"), tr("<p>I was unable to retrieve the mail from the server. You can try again later or give up.</p>"), tr("Ok")); } } diff --git a/noncore/unsupported/mailit/addatt.cpp b/noncore/unsupported/mailit/addatt.cpp index 19ac58f..420f84c 100644 --- a/noncore/unsupported/mailit/addatt.cpp +++ b/noncore/unsupported/mailit/addatt.cpp @@ -45,104 +45,104 @@ FileItem::FileItem(QListView *parent, DocLnk* dl) } else if (fileType == "File") { setPixmap(0, Resource::loadPixmap("exec")); }*/ } FileItem::~FileItem() { if (doclnk!=NULL) delete doclnk; doclnk=NULL; } AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) : QDialog(parent, name, f) { setCaption(tr("Adding attachments") ); QGridLayout *top = new QGridLayout(this, 1,1 ); QHBox *buttons=new QHBox(this); /*fileCategoryButton = new QPushButton(this);*/ attachButton = new QPushButton(tr("attach..."), buttons); removeButton = new QPushButton(tr("Remove"), buttons); /*fileCategories = new QPopupMenu(fileCategoryButton); fileCategoryButton->setPopup(fileCategories); fileCategories->insertItem("Document"); fileCategories->insertItem("Picture"); fileCategories->insertItem("Sound"); fileCategories->insertItem("Movie"); fileCategories->insertItem("File"); fileCategoryButton->setText("Document"); top->addWidget(fileCategoryButton, 0, 0);*/ top->addWidget(buttons,1,0); //buttons->addWidget(attachButton,0,0); //buttons->addWidget(removeButton,0,1); //connect(fileCategories, SIGNAL(activated(int)), this, // SLOT(fileCategorySelected(int)) );*/ connect(attachButton, SIGNAL(clicked()), this, SLOT(addattachment()) ); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeattachment()) ); /*listView = new QListView(this, "AttView"); listView->addColumn("Documents");* - connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, + connect(listView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(addattachment()) );*/ attView = new QListView(this, "Selected"); attView->addColumn(tr("Attached")); attView->addColumn(tr("File type")); - connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, + connect(attView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(removeattachment()) ); //top->addWidget(ofs, 0,0); top->addWidget(attView, 0,0); clear(); } void AddAtt::clear() { attView->clear(); //getFiles(); modified = FALSE; } /*void AddAtt::fileCategorySelected(int id) { fileCategoryButton->setText(fileCategories->text(id)); getFiles(); }*/ void AddAtt::addattachment() { // ### FIXME wrong use -zecke OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); ofs.showMaximized(); if (ofs.exec()==QDialog::Accepted) { DocLnk* dl=new DocLnk(ofs.selectedDocument()); FileItem* fi=new FileItem(attView,dl); fi->setPixmap(0,dl->pixmap()); fi->setText(1,dl->type()); attView->insertItem(fi); modified = TRUE; } } void AddAtt::removeattachment() { if (attView->selectedItem() != NULL) { attView->takeItem(attView->selectedItem()); } modified = TRUE; } diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 8359acf..86c7987 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp @@ -14,128 +14,128 @@ ** 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 <qapplication.h> #include <qmessagebox.h> #include <qvbox.h> #include <qfile.h> #include <qcheckbox.h> #include <qmenubar.h> #include <qaction.h> #include <qwhatsthis.h> #include <qpe/resource.h> #include "emailclient.h" #include "writemail.h" QCollection::Item AccountList::newItem(QCollection::Item d) { return dupl( (MailAccount *) d); } MailAccount* AccountList::dupl(MailAccount *in) { ac = new MailAccount(*in); return ac; } EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { emailHandler = new EmailHandler(); addressList = new AddressList(); sending = FALSE; receiving = FALSE; previewingMail = FALSE; mailIdCount = 1; accountIdCount = 1; allAccounts = FALSE; init(); connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); - connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this, - SLOT(smtpError(int,const QString &)) ); - connect(emailHandler, SIGNAL(popError(int,const QString &)), this, - SLOT(popError(int,const QString &)) ); + connect(emailHandler, SIGNAL(smtpError(int,const QString&)), this, + SLOT(smtpError(int,const QString&)) ); + connect(emailHandler, SIGNAL(popError(int,const QString&)), this, + SLOT(popError(int,const QString&)) ); - connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); - connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); + connect(inboxView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(inboxItemSelected()) ); + connect(outboxView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(outboxItemSelected()) ); - connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); - connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); + connect(inboxView, SIGNAL(pressed(QListViewItem*)), this, SLOT(inboxItemPressed()) ); + connect(inboxView, SIGNAL(clicked(QListViewItem*)), this, SLOT(inboxItemReleased()) ); - connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, - SLOT(mailArrived(const Email &, bool)) ); + connect(emailHandler, SIGNAL(mailArrived(const Email&,bool)), this, + SLOT(mailArrived(const Email&,bool)) ); connect(emailHandler, SIGNAL(mailTransfered(int)), this, SLOT(allMailArrived(int)) ); mailconf = new Config("mailit"); //In case Synchronize is not defined in settings.txt readSettings(); updateAccounts(); lineShift = "\n"; readMail(); lineShift = "\r\n"; mailboxView->setCurrentTab(0); //ensure that inbox has focus /*channel = new QCopChannel( "QPE/Application/mailit", this ); - connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT(receive(const QCString&, const QByteArray&)) );*/ + connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(receive(const QCString&,const QByteArray&)) );*/ } EmailClient::~EmailClient() { //needs to be moved from destructor to closewindow event saveMail(getPath(FALSE) + "inbox.txt", inboxView); //does not currently work. Defining outbox in the same //format as inbox is not a good solution as they have //different properties saveMail(getPath(FALSE) + "outbox.txt", outboxView); saveSettings(); mailconf->write(); delete mailconf; } void EmailClient::init() { initStatusBar(this); setToolBarsMovable(FALSE); bar = new QToolBar(this); QWhatsThis::add(bar,tr("Main operation toolbar")); bar->setHorizontalStretchable( TRUE ); mb = new QMenuBar( bar ); QPopupMenu *mail = new QPopupMenu(mb); mb->insertItem( tr( "&Mail" ), mail); QPopupMenu *configure = new QPopupMenu(mb); mb->insertItem( tr( "Accounts" ), configure); selectAccountMenu = new QPopupMenu(mb); editAccountMenu = new QPopupMenu(mb); deleteAccountMenu = new QPopupMenu(mb); mail->insertItem(tr("Get Mail in"), selectAccountMenu); configure->insertItem(tr("Edit account"), editAccountMenu); configure->insertItem(tr("Delete account"), deleteAccountMenu); bar = new QToolBar(this); getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); @@ -172,100 +172,100 @@ void EmailClient::init() QWidget* widget = new QWidget( mailboxView, "widget" ); grid_2 = new QGridLayout( widget ); // grid_2->setSpacing(6); // grid_2->setMargin( 11 ); inboxView = new QListView( widget, "inboxView" ); inboxView->addColumn( tr( "From" ) ); inboxView->addColumn( tr( "Subject" ) ); inboxView->addColumn( tr( "Date" ) ); inboxView->setMinimumSize( QSize( 0, 0 ) ); inboxView->setAllColumnsShowFocus(TRUE); QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n" "It keeps the fetched mail which can be \n" "viewed by double clicking the entry.\n" "blue attachment icon shows whether this \n" "mailhas attachments.\n")); grid_2->addWidget( inboxView, 2, 0 ); mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); grid_3 = new QGridLayout( widget_2 ); // grid_3->setSpacing(6); // grid_3->setMargin( 11 ); outboxView = new QListView( widget_2, "outboxView" ); outboxView->addColumn( tr( "To" ) ); outboxView->addColumn( tr( "Subject" ) ); outboxView->setAllColumnsShowFocus(TRUE); QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" "It keeps the queued mails to send which can be \n" "reviewed by double clicking the entry.")); grid_3->addWidget( outboxView, 0, 0 ); mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); setCentralWidget(mailboxView); } void EmailClient::initStatusBar(QWidget* parent) { statusBar = new QStatusBar(parent); statusBar->setSizeGripEnabled(FALSE); status1Label = new QLabel( tr("Idle"), statusBar); status2Label = new QLabel("", statusBar); - connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), - status2Label, SLOT(setText(const QString &)) ); - connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), - status2Label, SLOT(setText(const QString &)) ); + connect(emailHandler, SIGNAL(updatePopStatus(const QString&)), + status2Label, SLOT(setText(const QString&)) ); + connect(emailHandler, SIGNAL(updateSmtpStatus(const QString&)), + status2Label, SLOT(setText(const QString&)) ); progressBar = new QProgressBar(statusBar); connect(emailHandler, SIGNAL(mailboxSize(int)), this, SLOT(setTotalSize(int)) ); connect(emailHandler, SIGNAL(currentMailSize(int)), this, SLOT(setMailSize(int)) ); connect(emailHandler, SIGNAL(downloadedSize(int)), this, SLOT(setDownloadedSize(int)) ); statusBar->addWidget(status1Label); statusBar->addWidget(progressBar); statusBar->addWidget(status2Label); } void EmailClient::compose() { emit composeRequested(); } void EmailClient::cancel() { emailHandler->cancel(); } AddressList* EmailClient::getAdrListRef() { return addressList; } //this needs to be rewritten to syncronize with outboxView void EmailClient::enqueMail(const Email &mail) { if (accountList.count() == 0) { QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n"); return; } if (accountList.count() > 0) { currentAccount = accountList.first(); qWarning("using account " + currentAccount->name); } Email addMail = mail; addMail.from = currentAccount->name; addMail.fromMail = currentAccount->emailAddress; diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index 06e978d..02b3e9a 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp @@ -1,106 +1,106 @@ /********************************************************************** ** Copyright (C) 2001 Trolltech AS. All rights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qfileinfo.h> #include <stdlib.h> #include <qapplication.h> #include <qmessagebox.h> #include <qcstring.h> #include "emailhandler.h" #include <qpe/applnk.h> #include <qpe/filemanager.h> QCollection::Item EnclosureList::newItem(QCollection::Item d) { return dupl( (Enclosure *) d); } Enclosure* EnclosureList::dupl(Enclosure *in) { ac = new Enclosure(*in); return ac; } EmailHandler::EmailHandler() { qDebug("EMailHandler::EmailHandler"); smtpClient = new SmtpClient(); popClient = new PopClient(); - connect(smtpClient, SIGNAL(errorOccurred(int, const QString &)), this, - SIGNAL(smtpError(int, const QString &)) ); + connect(smtpClient, SIGNAL(errorOccurred(int,const QString&)), this, + SIGNAL(smtpError(int,const QString&)) ); connect(smtpClient, SIGNAL(mailSent()), this, SIGNAL(mailSent()) ); - connect(smtpClient, SIGNAL(updateStatus(const QString &)), this, - SIGNAL(updateSmtpStatus(const QString &)) ); - - connect(popClient, SIGNAL(errorOccurred(int, const QString &)), this, - SIGNAL(popError(int, const QString &)) ); - connect(popClient, SIGNAL(newMessage(const QString &, int, uint, bool)), - this, SLOT(messageArrived(const QString &, int, uint, bool)) ); - connect(popClient, SIGNAL(updateStatus(const QString &)), this, - SIGNAL(updatePopStatus(const QString &)) ); + connect(smtpClient, SIGNAL(updateStatus(const QString&)), this, + SIGNAL(updateSmtpStatus(const QString&)) ); + + connect(popClient, SIGNAL(errorOccurred(int,const QString&)), this, + SIGNAL(popError(int,const QString&)) ); + connect(popClient, SIGNAL(newMessage(const QString&,int,uint,bool)), + this, SLOT(messageArrived(const QString&,int,uint,bool)) ); + connect(popClient, SIGNAL(updateStatus(const QString&)), this, + SIGNAL(updatePopStatus(const QString&)) ); connect(popClient, SIGNAL(mailTransfered(int)), this, SIGNAL(mailTransfered(int)) ); //relaying size information connect(popClient, SIGNAL(currentMailSize(int)), this, SIGNAL(currentMailSize(int)) ); connect(popClient, SIGNAL(downloadedSize(int)), this, SIGNAL(downloadedSize(int)) ); } void EmailHandler::sendMail(QList<Email> *mailList) { Email *currentMail; QString temp; QString userName = QString::null; // not supported by ALL SMTP servers in the MAIL From field // userName = "\""+mailAccount.name+"\""; userName += "<" + mailAccount.emailAddress + ">"; for (currentMail = mailList->first(); currentMail != 0; currentMail = mailList->next()) { if (encodeMime(currentMail) == 0) { smtpClient->addMail(userName, currentMail->subject, currentMail->recipients, currentMail->rawMail); } else { //error temp = tr("Could not locate all files in \nmail with subject: ") + currentMail->subject; temp += tr("\nMail has NOT been sent"); QMessageBox::warning(qApp->activeWindow(), tr("Attachment error"), temp, tr("OK\n")); } } smtpClient->newConnection(mailAccount.smtpServer, 25); } void EmailHandler::setAccount(MailAccount account) { mailAccount = account; } void EmailHandler::getMail() { popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); if (mailAccount.synchronize) { popClient->setSynchronize(mailAccount.lastServerMailCount); } else { diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp index 6e298c7..fec4d78 100644 --- a/noncore/unsupported/mailit/mailitwindow.cpp +++ b/noncore/unsupported/mailit/mailitwindow.cpp @@ -1,113 +1,113 @@ /********************************************************************** ** Copyright (C) 2001 Trolltech AS. All rights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qwhatsthis.h> #include <qmessagebox.h> #include "mailitwindow.h" MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags /*fl*/) : QMainWindow(parent, name, WStyle_ContextHelp) { currentCaption = tr("Mailit"); setCaption(tr(currentCaption)); views = new QWidgetStack(this); setCentralWidget(views); QWhatsThis::add(views,tr("Central view area")); emailClient = new EmailClient(views, "client"); writeMail = new WriteMail(views, "writing"); readMail = new ReadMail(views, "reading"); views->raiseWidget(emailClient); connect(emailClient, SIGNAL(composeRequested()), this, SLOT(compose()) ); - connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, - SLOT(viewMail(QListView *, Email *)) ); - connect(emailClient, SIGNAL(mailUpdated(Email *)), this, - SLOT(updateMailView(Email *)) ); + connect(emailClient, SIGNAL(viewEmail(QListView*,Email*)), this, + SLOT(viewMail(QListView*,Email*)) ); + connect(emailClient, SIGNAL(mailUpdated(Email*)), this, + SLOT(updateMailView(Email*)) ); connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); - connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, + connect(writeMail, SIGNAL(sendMailRequested(const Email&)), this, SLOT(showEmailClient()) ); - connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, - SLOT(enqueMail(const Email &)) ); + connect(writeMail, SIGNAL(sendMailRequested(const Email&)), emailClient, + SLOT(enqueMail(const Email&)) ); connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); - connect(readMail, SIGNAL(replyRequested(Email &, bool&)), this, - SLOT(composeReply(Email &, bool&)) ); - connect(readMail, SIGNAL(forwardRequested(Email &)), this, - SLOT(composeForward(Email &)) ); + connect(readMail, SIGNAL(replyRequested(Email&,bool&)), this, + SLOT(composeReply(Email&,bool&)) ); + connect(readMail, SIGNAL(forwardRequested(Email&)), this, + SLOT(composeForward(Email&)) ); - connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, - SLOT(deleteMail(EmailListItem *, bool &)) ); - connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, - SLOT(moveMailFront(Email *)) ); + connect(readMail, SIGNAL(removeItem(EmailListItem*,bool&)), emailClient, + SLOT(deleteMail(EmailListItem*,bool&)) ); + connect(readMail, SIGNAL(viewingMail(Email*)), emailClient, + SLOT(moveMailFront(Email*)) ); - connect(emailClient, SIGNAL(newCaption(const QString &)), - this, SLOT(updateCaption(const QString &)) ); + connect(emailClient, SIGNAL(newCaption(const QString&)), + this, SLOT(updateCaption(const QString&)) ); - connect(readMail, SIGNAL(download(Email *)), emailClient, SLOT(download(Email*)) ); + connect(readMail, SIGNAL(download(Email*)), emailClient, SLOT(download(Email*)) ); viewingMail = FALSE; } MailItWindow::~MailItWindow() { } void MailItWindow::closeEvent(QCloseEvent *e) { if (views->visibleWidget() == emailClient) { e->accept(); } else { showEmailClient(); } } void MailItWindow::compose() { viewingMail = FALSE; emailClient->hide(); readMail->hide(); views->raiseWidget(writeMail); writeMail->setAddressList(emailClient->getAdrListRef()); writeMail->newMail(); setCaption( tr( "Write mail" ) ); } void MailItWindow::composeReply(Email &mail, bool& replyAll) { compose(); writeMail->reply(mail,replyAll) ; } void MailItWindow::composeForward(Email &mail) { compose(); writeMail->forward(mail) ; } void MailItWindow::showEmailClient() { viewingMail = FALSE; writeMail->hide(); readMail->hide(); views->raiseWidget(emailClient); setCaption( tr(currentCaption) ); diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index a09bc30..7f1c0b8 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -131,118 +131,118 @@ void MainWindow::makeMenu() cfgact = new QAction( tr( "Servers" ), QString::null, 0, this, 0 ); connect( cfgact, SIGNAL( activated() ), SLOT( showSettingsSrv() ) ); cfgact->addTo( cfgMenu ); cfgact = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); connect( cfgact, SIGNAL( activated() ), SLOT( showSettingsDst() ) ); cfgact->addTo( cfgMenu ); QAction *a; // SECTIONS sectionBar = new QToolBar( this ); addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); sectionBar->setHorizontalStretchable( true ); QLabel *label = new QLabel( sectionBar, "section" ); // label->setBackgroundMode( NoBackground ); label->font().setPointSize( 8 ); label->setText( tr( "Section:" ) ); sectionBar->setStretchableWidget( label ); section = new QComboBox( false, sectionBar ); section->font().setPointSize( 8 ); label = new QLabel( " / ", sectionBar ); label->font().setPointSize( 8 ); // label->setBackgroundMode( PaletteForeground ); subsection = new QComboBox( false, sectionBar ); subsection->font().setPointSize( 8 ); a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); a->addTo( sectionBar ); setSections(); setSubSections(); sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); sectionAction->setToggleAction( true ); sectionAction->addTo( viewMenu ); // sectionBar->setStretchableWidget( section ); //FIND findBar = new QToolBar(this); addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); label = new QLabel( tr("Filter: "), findBar ); // label->setBackgroundMode( PaletteForeground ); findBar->setHorizontalStretchable( TRUE ); findEdit = new QLineEdit( findBar, "findEdit" ); findBar->setStretchableWidget( findEdit ); - connect( findEdit, SIGNAL( textChanged( const QString & ) ), + connect( findEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( displayList() ) ); a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); a->addTo( findBar ); a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); a->addTo( findBar ); findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); findAction->setToggleAction( true ); findAction->addTo( viewMenu ); //SEARCH searchBar = new QToolBar(this); addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); label = new QLabel( tr("Search: "), searchBar ); // label->setBackgroundMode( PaletteForeground ); searchBar->setHorizontalStretchable( TRUE ); searchEdit = new QLineEdit( searchBar, "seachEdit" ); searchBar->setStretchableWidget( searchEdit ); -// connect( searchEdit, SIGNAL( textChanged( const QString & ) ), +// connect( searchEdit, SIGNAL( textChanged(const QString&) ), // this, SLOT( displayList() ) ); a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); a->addTo( searchBar ); searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); searchCommit->addTo( searchBar ); a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); a->addTo( searchBar ); searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); searchAction->setToggleAction( true ); searchAction->addTo( viewMenu ); //DEST destBar = new QToolBar(this); addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); label = new QLabel( tr("Destination: "), destBar ); // label->setBackgroundMode( PaletteForeground ); destBar->setHorizontalStretchable( TRUE ); destination = new QComboBox( false, destBar ); destination->insertStringList( settings->getDestinationNames() ); setComboName(destination,settings->getDestinationName()); connect( destination, SIGNAL(activated(int)), settings, SLOT(activeDestinationChange(int)) ); // space->setBackgroundMode( PaletteForeground ); CheckBoxLink = new QCheckBox( tr("Link"), destBar); // CheckBoxLink->setBackgroundMode( PaletteForeground ); CheckBoxLink->setChecked( settings->createLinks() ); connect( CheckBoxLink, SIGNAL(toggled(bool)), settings, SLOT(linkEnabled(bool)) ); destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); a->addTo( destBar ); destBar->setStretchableWidget( CheckBoxLink ); destAction->setToggleAction( true ); destAction->addTo( viewMenu ); // helpMenu helpMenu->insertSeparator(); a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 ); a->addTo( helpMenu ); helpMenu->insertSeparator(); a = new QAction( tr( "Install" ), Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 ); @@ -423,93 +423,93 @@ void MainWindow::findShow(bool b) if (b) findBar->show(); else findBar->hide(); findAction->setOn( b ); } void MainWindow::findClose() { findAction->setOn( false ); } void MainWindow::searchShow(bool b) { if (b) searchBar->show(); else searchBar->hide(); searchAction->setOn( b ); } void MainWindow::searchClose() { searchAction->setOn( false ); } void MainWindow::destShow(bool b) { if (b) destBar->show(); else destBar->hide(); destAction->setOn( b ); } void MainWindow::destClose() { destAction->setOn( false ); } void MainWindow::setDocument(const QString &fileName) { if ( !QFile::exists( fileName ) ) return; ipkg->installFile( fileName ); QCopEnvelope e("QPE/System", "linkChanged(QString)"); QString lf = QString::null; e << lf; } void MainWindow::makeChannel() { channel = new QCopChannel( "QPE/Application/oipkg", this ); - connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT(receive(const QCString&, const QByteArray&)) ); + connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), + this, SLOT(receive(const QCString&,const QByteArray&)) ); } void MainWindow::receive(const QCString &msg, const QByteArray &arg) { pvDebug(3, "QCop "+msg+" "+QCString(arg)); if ( msg == "installFile(QString)" ) { ipkg->installFile( QString(arg) ); }else if( msg == "removeFile(QString)" ) { ipkg->removeFile( QString(arg) ); }else if( msg == "createLinks(QString)" ) { ipkg->createLinks( QString(arg) ); }else if( msg == "removeLinks(QString)" ) { ipkg->removeLinks( QString(arg) ); }else{ pvDebug(2,"Huh what do ya want") } } void MainWindow::createLinks() { pvDebug(2,"creating links..."); ipkg->createLinks( settings->destinationurl->text() ); } void MainWindow::removeLinks() { pvDebug(2,"removing links..."); ipkg->removeLinks( settings->destinationurl->text() ); } void MainWindow::remotePackageQuery() { packageListSearch.query( searchEdit->text() ); packageListSearch.update(); displayList(); } diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 1610a37..1b4812d 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp @@ -166,75 +166,75 @@ QString PackageListItem::key( int column, bool ascending ) const } } void PackageListItem::setOn( bool b ) { QCheckListItem::setOn( b ); package->toggleProcess(); package->setLink( settings->createLinks() ); displayDetails(); } void PackageListItem::displayDetails() { QString sod; sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); setText(0, package->name()+sod ); nameItem->setText( 0, QObject::tr("Name: ")+package->name()); linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No"))); destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); repaint(); } QPopupMenu* PackageListItem::getPopupMenu() { popupMenu->clear(); destsMenu->clear(); QAction *popupAction; qDebug("PackageListItem::showPopup "); if (!package->installed()){ popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); QStringList dests = settings->getDestinationNames(); QString ad = settings->getDestinationName(); for (uint i = 0; i < dests.count(); i++ ) { popupAction = new QAction( dests[i], QString::null, 0, popupMenu, 0 ); popupAction->addTo( destsMenu ); if ( dests[i] == ad && getPackage()->toInstall() ) { popupAction->setToggleAction( true ); popupAction->setOn(true); } } - connect( destsMenu, SIGNAL( activated( int ) ), - this, SLOT( menuAction( int ) ) ); + connect( destsMenu, SIGNAL( activated(int) ), + this, SLOT( menuAction(int) ) ); popupMenu->popup( QCursor::pos() ); }else{ popupMenu->insertItem( QObject::tr("Remove")); - connect( popupMenu, SIGNAL( activated( int ) ), - this, SLOT( menuAction( int ) ) ); + connect( popupMenu, SIGNAL( activated(int) ), + this, SLOT( menuAction(int) ) ); popupMenu->popup( QCursor::pos() ); } return popupMenu; } void PackageListItem::menuAction( int i ) { if (!package->installed()){ package->setDest( destsMenu->text(i) ); package->setLink( settings->createLinks() ); } package->setOn(); displayDetails(); } //void PackageListItem::toggleProcess() //{ // package->toggleProcess() ; // displayDetails(); //} diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 3c7435d..98ebf88 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp @@ -1,81 +1,81 @@ /*************************************************************************** * * * 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 "packagelistview.h" #include <qpopupmenu.h> #include <qaction.h> #include "listviewitemoipkg.h" #include "packagelistitem.h" #include "pksettings.h" PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) : QListView(p,n) { settings = s; popupTimer = new QTimer( this ); setSelectionMode(QListView::NoSelection); addColumn( tr("Package") ); setRootIsDecorated( true ); connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); - connect( this, SIGNAL( pressed( QListViewItem* ) ), - this, SLOT( setCurrent( QListViewItem* ) ) ); - connect( this, SIGNAL( clicked( QListViewItem* ) ), - this, SLOT( stopTimer( QListViewItem* ) ) ); + connect( this, SIGNAL( pressed(QListViewItem*) ), + this, SLOT( setCurrent(QListViewItem*) ) ); + connect( this, SIGNAL( clicked(QListViewItem*) ), + this, SLOT( stopTimer(QListViewItem*) ) ); } //PackageListView::~PackageListView() //{ //} void PackageListView::setCurrent( QListViewItem* p ) { qDebug("PackageListView::setCurrent "); activeItem = (ListViewItemOipkg*)p; if ( activeItem != 0 ) popupTimer->start( 750, true ); // if ( activeItem->getType() != ListViewItemOipkg::Package ){ // qDebug("PackageListView::setCurrent !p "); // activePackage = 0; // activePackageListItem = 0; // qDebug("PackageListView::setCurrent returning "); // return; // }; // activePackageListItem = (PackageListItem*)p; // activePackage = activePackageListItem->getPackage(); // if (activePackage == 0 ) // { // qDebug("PackageListView::setCurrent if (!activePackage)"); // return; // } qDebug("PackageListView::setCurrent popupTimer->start"); } void PackageListView::showPopup() { qDebug("PackageListView::showPopup"); QPopupMenu *popup = activeItem->getPopupMenu(); if (popup == 0) return; popup->popup( QCursor::pos() ); qDebug("PackageListView::showPopup"); } void PackageListView::stopTimer( QListViewItem* ) { popupTimer->stop(); } diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index 063b018..aac011e 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp @@ -1,97 +1,97 @@ #include "pksettings.h" #include <qpe/process.h> #include <qpe/resource.h> #include <qpe/stringutil.h> #include <qpe/qpeapplication.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/applnk.h> #include <qpe/config.h> #include <qprogressbar.h> #include <qcombobox.h> #include <qdict.h> #include <qfile.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qlistview.h> #include <qlistbox.h> #include <qcheckbox.h> #include <qmessagebox.h> #include <qpainter.h> #include <qpixmap.h> #include <qregexp.h> #include <qstring.h> #include <qobject.h> #include <qtextstream.h> #include <qtextview.h> #include <qtoolbutton.h> #include <qtabwidget.h> #include <stdlib.h> #include <unistd.h> #include "debug.h" //#include "utils.h" PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) : PackageManagerSettingsBase( parent, name, fl ) { connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); // connect( CheckBoxLink, SIGNAL(toggled(bool)), // activeLinkDestination, SLOT(setEnabled(bool)) ); // connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); -// connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); +// connect( settingName, SIGNAL(textChanged(const QString&)), this, SLOT(installationSettingSetName(const QString&)) ); // connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); // connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); // connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); servername->setEnabled(FALSE); serverurl->setEnabled(FALSE); serverurlDic.setAutoDelete(TRUE); destinationname->setEnabled(FALSE); destinationurl->setEnabled(FALSE); destinationurlDic.setAutoDelete(TRUE); readSettings(); activeLinkDestination->hide(); serverChanged = false; // get rid of setups // Settings->hide(); // settingName->hide(); // newsetting->hide(); // renamesetting->hide(); // removesetting->hide(); } PackageManagerSettings::~PackageManagerSettings() { } void PackageManagerSettings::newServer() { int i = servers->count(); if ( servername->isEnabled() || serverurl->text().isEmpty() ) { serverurlDic.insert(i,new QString("http://")); servers->insertItem(tr("New")); activeServers->insertItem(tr("New")); } else { // allows one-level undo serverurlDic.insert(i,new QString(serverurl->text())); servers->insertItem(servername->text()); activeServers->insertItem(servername->text()); } changed = true; servers->setSelected(i,TRUE); editServer(i); changed = true; } void PackageManagerSettings::newDestination() { int i = destinations->count(); diff --git a/noncore/unsupported/qpdf/qbusybar.cpp b/noncore/unsupported/qpdf/qbusybar.cpp index ce7ab8e..e942f06 100644 --- a/noncore/unsupported/qpdf/qbusybar.cpp +++ b/noncore/unsupported/qpdf/qbusybar.cpp @@ -1,68 +1,68 @@ #include <qapplication.h> #include <qtimer.h> #include <qpainter.h> #include "qbusybar.h" QBusyBar::QBusyBar ( QWidget *parent, const char *name, int flags ) : QWidget ( parent, name, flags | WRepaintNoErase ) { m_busy = 0; m_div = 0; m_pos = 0; m_fade = 0; m_fadecols = 0; m_speed = 500; m_timer = new QTimer ( this ); - connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( slotTimeout ( ))); + connect ( m_timer, SIGNAL( timeout()), this, SLOT( slotTimeout())); setParameters ( 12, 8, 200 ); } void QBusyBar::setParameters ( int d, int s, int v ) { bool running = m_timer-> isActive ( ); if ( running ) m_timer-> stop ( ); m_div = d; m_speed = v; delete [] m_fadecols; m_fade = s; m_fadecols = new QColor [m_fade]; int rt, gt, bt; int rf, gf, bf; colorGroup ( ). color ( QColorGroup::Highlight ). rgb ( &rf, &gf, &bf ); colorGroup ( ). color ( QColorGroup::Background ). rgb ( &rt, >, &bt ); for ( int i = 0; i < s; i++ ) m_fadecols [i]. setRgb ( rf + ( rt - rf ) * i / s, gf + ( gt - gf ) * i / s, bf + ( bt - bf ) * i / s ); if ( running ) { m_pos = 0; m_timer-> start ( m_speed ); } } QBusyBar::~QBusyBar ( ) { delete [] m_fadecols; } bool QBusyBar::isBusy ( ) const { return m_busy; } void QBusyBar::beginBusy ( ) { setBusy ( true ); } diff --git a/noncore/unsupported/qpdf/qpdf.cpp b/noncore/unsupported/qpdf/qpdf.cpp index 5cdcccf..75e86d0 100644 --- a/noncore/unsupported/qpdf/qpdf.cpp +++ b/noncore/unsupported/qpdf/qpdf.cpp @@ -40,155 +40,155 @@ #ifdef QPDF_QPE_ONLY #include <qpe/fileselector.h> #else #include <opie/ofileselector.h> #endif int main ( int argc, char **argv ) { QPEApplication app ( argc, argv ); // read config file globalParams = new GlobalParams ( "" ); globalParams-> setErrQuiet ( true ); QPdfDlg *dlg = new QPdfDlg ( ); app. showMainDocumentWidget ( dlg ); if (( app. argc ( ) == 3 ) && ( app. argv ( ) [1] == QCString ( "-f" ))) dlg-> openFile ( app. argv ( ) [2] ); return app. exec ( ); } QPdfDlg::QPdfDlg ( ) : QMainWindow ( ) { setCaption ( tr( "QPdf" )); setIcon ( Resource::loadPixmap ( "qpdf_icon" )); m_busy = false; m_doc = 0; m_pages = 0; m_zoom = 72; m_currentpage = 0; m_fullscreen = false; m_renderok = false; setToolBarsMovable ( false ); m_stack = new QWidgetStack ( this ); m_stack-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); setCentralWidget ( m_stack ); m_outdev = new QPEOutputDev ( m_stack ); - connect ( m_outdev, SIGNAL( selectionChanged ( const QRect & )), this, SLOT( copyToClipboard ( const QRect & ))); + connect ( m_outdev, SIGNAL( selectionChanged(const QRect&)), this, SLOT( copyToClipboard(const QRect&))); #ifdef QPDF_QPE_ONLY m_filesel = new FileSelector ( "application/pdf", m_stack, "fs", false, true ); #else m_filesel = new OFileSelector ( "application/pdf", m_stack, "fs", false, true ); #endif - connect ( m_filesel, SIGNAL( closeMe ( )), this, SLOT( closeFileSelector ( ))); - connect ( m_filesel, SIGNAL( fileSelected ( const DocLnk & )), this, SLOT( openFile ( const DocLnk & ))); + connect ( m_filesel, SIGNAL( closeMe()), this, SLOT( closeFileSelector())); + connect ( m_filesel, SIGNAL( fileSelected(const DocLnk&)), this, SLOT( openFile(const DocLnk&))); m_tb_menu = new QToolBar ( this ); m_tb_menu-> setHorizontalStretchable ( true ); QMenuBar *mb = new QMenuBar ( m_tb_menu ); m_pm_zoom = new QPopupMenu ( mb ); m_pm_zoom-> setCheckable ( true ); mb-> insertItem ( tr( "Zoom" ), m_pm_zoom ); m_pm_zoom-> insertItem ( tr( "Fit to width" ), 1 ); m_pm_zoom-> insertItem ( tr( "Fit to page" ), 2 ); m_pm_zoom-> insertSeparator ( ); m_pm_zoom-> insertItem ( tr( "50%" ), 50 ); m_pm_zoom-> insertItem ( tr( "75%" ), 75 ); m_pm_zoom-> insertItem ( tr( "100%" ), 100 ); m_pm_zoom-> insertItem ( tr( "125%" ), 125 ); m_pm_zoom-> insertItem ( tr( "150%" ), 150 ); m_pm_zoom-> insertItem ( tr( "200%" ), 200 ); - connect ( m_pm_zoom, SIGNAL( activated ( int )), this, SLOT( setZoom ( int ))); + connect ( m_pm_zoom, SIGNAL( activated(int)), this, SLOT( setZoom(int))); m_tb_tool = new QToolBar ( this ); - new QToolButton ( Resource::loadIconSet ( "fileopen" ), tr( "Open..." ), QString::null, this, SLOT( openFile ( )), m_tb_tool, "open" ); + new QToolButton ( Resource::loadIconSet ( "fileopen" ), tr( "Open..." ), QString::null, this, SLOT( openFile()), m_tb_tool, "open" ); m_tb_tool-> addSeparator ( ); - m_to_find = new QToolButton ( Resource::loadIconSet ( "find" ), tr( "Find..." ), QString::null, this, SLOT( toggleFindBar ( )), m_tb_tool, "find" ); + m_to_find = new QToolButton ( Resource::loadIconSet ( "find" ), tr( "Find..." ), QString::null, this, SLOT( toggleFindBar()), m_tb_tool, "find" ); m_to_find-> setToggleButton ( true ); m_tb_tool-> addSeparator ( ); - m_to_full = new QToolButton ( Resource::loadIconSet ( "fullscreen" ), tr( "Fullscreen" ), QString::null, this, SLOT( toggleFullscreen ( )), m_tb_tool, "fullscreen" ); + m_to_full = new QToolButton ( Resource::loadIconSet ( "fullscreen" ), tr( "Fullscreen" ), QString::null, this, SLOT( toggleFullscreen()), m_tb_tool, "fullscreen" ); m_to_full-> setToggleButton ( true ); m_tb_tool-> addSeparator ( ); - new QToolButton ( Resource::loadIconSet ( "fastback" ), tr( "First page" ), QString::null, this, SLOT( firstPage ( )), m_tb_tool, "first" ); - new QToolButton ( Resource::loadIconSet ( "back" ), tr( "Previous page" ), QString::null, this, SLOT( prevPage ( )), m_tb_tool, "prev" ); - new QToolButton ( Resource::loadIconSet ( "down" ), tr( "Goto page..." ), QString::null, this, SLOT( gotoPageDialog ( )), m_tb_tool, "goto" ); - new QToolButton ( Resource::loadIconSet ( "forward" ), tr( "Next page" ), QString::null, this, SLOT( nextPage ( )), m_tb_tool, "next" ); - new QToolButton ( Resource::loadIconSet ( "fastforward" ), tr( "Last page" ), QString::null, this, SLOT( lastPage ( )), m_tb_tool, "last" ); + new QToolButton ( Resource::loadIconSet ( "fastback" ), tr( "First page" ), QString::null, this, SLOT( firstPage()), m_tb_tool, "first" ); + new QToolButton ( Resource::loadIconSet ( "back" ), tr( "Previous page" ), QString::null, this, SLOT( prevPage()), m_tb_tool, "prev" ); + new QToolButton ( Resource::loadIconSet ( "down" ), tr( "Goto page..." ), QString::null, this, SLOT( gotoPageDialog()), m_tb_tool, "goto" ); + new QToolButton ( Resource::loadIconSet ( "forward" ), tr( "Next page" ), QString::null, this, SLOT( nextPage()), m_tb_tool, "next" ); + new QToolButton ( Resource::loadIconSet ( "fastforward" ), tr( "Last page" ), QString::null, this, SLOT( lastPage()), m_tb_tool, "last" ); m_tb_find = new QToolBar ( this ); addToolBar ( m_tb_find, "Search", QMainWindow::Top, true ); m_tb_find-> setHorizontalStretchable ( true ); m_tb_find-> hide ( ); m_findedit = new QLineEdit ( m_tb_find, "findedit" ); m_tb_find-> setStretchableWidget ( m_findedit ); - connect ( m_findedit, SIGNAL( textChanged ( const QString & )), this, SLOT( findText ( const QString & ))); + connect ( m_findedit, SIGNAL( textChanged(const QString&)), this, SLOT( findText(const QString&))); - new QToolButton ( Resource::loadIconSet ( "next" ), tr( "Next" ), QString::null, this, SLOT( findText ( )), m_tb_find, "findnext" ); + new QToolButton ( Resource::loadIconSet ( "next" ), tr( "Next" ), QString::null, this, SLOT( findText()), m_tb_find, "findnext" ); openFile ( ); } QPdfDlg::~QPdfDlg ( ) { delete m_doc; } // vv Fullscreen handling (for broken QT-lib) [David Hedbor, www.eongames.com] void QPdfDlg::resizeEvent ( QResizeEvent * ) { if ( m_fullscreen && ( size ( ) != qApp-> desktop ( )-> size ( ))) setFullscreen ( true ); } void QPdfDlg::focusInEvent ( QFocusEvent * ) { if ( m_fullscreen ) setFullscreen ( true ); } void QPdfDlg::toggleFullscreen ( ) { if ( m_to_full-> isOn ( ) == m_fullscreen ) m_to_full-> setOn ( !m_fullscreen ); m_fullscreen = !m_fullscreen; setFullscreen ( m_fullscreen ); } void QPdfDlg::setFullscreen ( bool b ) { static QSize normalsize; if ( b ) { if ( !normalsize. isValid ( )) normalsize = size ( ); setFixedSize ( qApp-> desktop ( )-> size ( )); showNormal ( ); reparent ( 0, WStyle_Customize | WStyle_NoBorder, QPoint ( 0, 0 )); showFullScreen ( ); } else { showNormal ( ); reparent ( 0, 0, QPoint ( 0, 0 )); @@ -450,91 +450,91 @@ void QPdfDlg::renderPage ( ) m_renderok = true; } } void QPdfDlg::closeFileSelector ( ) { m_tb_menu-> show ( ); m_tb_tool-> show ( ); m_stack-> raiseWidget ( m_outdev ); } void QPdfDlg::openFile ( ) { m_tb_menu-> hide ( ); m_tb_tool-> hide ( ); m_tb_find-> hide ( ); m_stack-> raiseWidget ( m_filesel ); } void QPdfDlg::openFile ( const QString &f ) { DocLnk nf; nf. setType ( "application/pdf" ); nf. setFile ( f ); QFileInfo fi ( f ); nf. setName ( fi. baseName ( )); openFile ( nf ); } void QPdfDlg::openFile ( const DocLnk &f ) { QString fn = f. file ( ); QFileInfo fi ( fn ); if ( fi. exists ( )) { delete m_doc; m_doc = new PDFDoc ( new GString ( fn. local8Bit ( )), 0, 0 ); if ( m_doc-> isOk ( )) { m_currentdoc = f. name ( ); int sep = m_currentdoc. findRev ( '/' ); if ( sep > 0 ) m_currentdoc = m_currentdoc. mid ( sep + 1 ); m_pages = m_doc-> getNumPages ( ); m_currentpage = 0; - QTimer::singleShot ( 0, this, SLOT( delayedInit ( ))); + QTimer::singleShot ( 0, this, SLOT( delayedInit())); } else { delete m_doc; m_doc = 0; m_currentdoc = QString::null; } updateCaption ( ); } else QMessageBox::warning ( this, tr( "Error" ), tr( "File does not exist!" )); } void QPdfDlg::setDocument ( const QString &f ) { if ( f. find ( ".desktop", 0, true ) == -1 ) openFile ( f ); else openFile ( DocLnk ( f )); closeFileSelector ( ); } void QPdfDlg::delayedInit ( ) { closeFileSelector ( ); m_currentpage = 0; m_zoom = 0; m_renderok = false; setZoom ( 100 ); gotoPage ( 1 ); m_renderok = true; renderPage ( ); m_outdev-> setFocus ( ); } diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp index 0fce355..3cb8faf 100644 --- a/x11/libqpe-x11/qpe/qpeapplication.cpp +++ b/x11/libqpe-x11/qpe/qpeapplication.cpp @@ -246,107 +246,107 @@ QPEApplication::QPEApplication(int &arg, char** argv, Type t) atoms[n] = &d->wm_take_focus; names[n++] = "WM_TAKE_FOCUS"; atoms[n] = &d->wm_context_help; names[n++] = "_NET_WM_CONTEXT_HELP"; atoms[n] = &d->wm_context_accept; names[n++] = "_NET_WM_CONTEXT_ACCEPT"; atoms[n] = &d->wm_protocols; names[n++] = "WM_PROTOCOLS"; XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_re); // now copy the values over to the properties for (int i = 0; i < n; i++ ) *atoms[i] = atoms_re[i]; // done with X11 Stuff int dw = desktop()->width(); if ( dw < 200 ) { setFont( QFont( "helvetica", 8 ) ); AppLnk::setSmallIconSize( 10 ); AppLnk::setBigIconSize( 28 ); }else if ( dw > 600 ) { setFont( QFont( "helvetica", 12 ) ); AppLnk::setSmallIconSize( 24 ); AppLnk::setBigIconSize( 48 ); }else if ( dw > 200 ) { setFont( QFont( "helvetica", 10 ) ); AppLnk::setSmallIconSize( 16 ); AppLnk::setBigIconSize( 32 ); } QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); connect( this, SIGNAL( lastWindowClosed() ), this, SLOT(hideOrQuit() ) ); QString qcopfn( "/tmp/qcop-msg-" ); qcopfn += QString( argv[0] ); // append command name to the QCOP name QFile file( qcopfn ); if (file.open(IO_ReadOnly ) ) { flock( file.handle(), LOCK_EX ); } /* Hmmm damn we need to make the parent 0l otherwise it get's deleted * past the QApplication */ m_sys = new QCopChannel( "QPE/System", 0l); - connect(m_sys, SIGNAL( received( const QCString&, const QByteArray& ) ), - this, SLOT(systemMessage( const QCString&, const QByteArray& ) ) ); + connect(m_sys, SIGNAL( received(const QCString&,const QByteArray&) ), + this, SLOT(systemMessage(const QCString&,const QByteArray&) ) ); // private channel QPE/Application/appname QCString channel = QCString( argv[0] ); channel.replace( QRegExp( ".*/"), "" ); d->appName = channel; channel = "QPE/Application/"+ channel; m_pid = new QCopChannel( channel, 0l ); - connect(m_pid, SIGNAL( received( const QCString&, const QByteArray& ) ), - this, SLOT( pidMessage( const QCString&, const QByteArray& ) ) ); + connect(m_pid, SIGNAL( received(const QCString&,const QByteArray&) ), + this, SLOT( pidMessage(const QCString&,const QByteArray&) ) ); // read the Pre QCOP Stuff from the file if ( file.isOpen() ) { d->keep_running = FALSE; QDataStream ds( &file ); QCString chanel, message; QByteArray data; while (!ds.atEnd() ) { ds >> chanel >> message >> data; d->enqueueQCop( chanel, message, data ); } flock( file.handle(), LOCK_UN ); file.close(); file.remove(); } // read in some stuff from the command line // we do not have setArgs so we need to take // care of that for ( int a = 0; a < arg; a++ ) { if ( qstrcmp( argv[a], "-preload" ) == 0 ) { d->preloaded = TRUE; }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) { d->preloaded = TRUE; d->forceshow = TRUE; } } initTranslations(); applyStyle(); if ( type() == GuiServer ) ; installEventFilter( this ); QPEMenuToolFocusManager::initialize(); } void QPEApplication::initTranslations() { // Translations add it QStringList langs = Global::languageList(); for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { QString lang = *it; QTranslator * trans; QString tfn; trans = new QTranslator( this ); tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; if ( trans->load( tfn ) ) diff --git a/x11/libqpe-x11/qt/qcopchannel_qws.cpp b/x11/libqpe-x11/qt/qcopchannel_qws.cpp index 706756e..a82ba4d 100644 --- a/x11/libqpe-x11/qt/qcopchannel_qws.cpp +++ b/x11/libqpe-x11/qt/qcopchannel_qws.cpp @@ -1,64 +1,64 @@ #include "../../ipc/client/ocopclient.h" #include <qcopchannel_qws.h> QList<QCopChannel>* QCopChannel::m_list = 0; QMap<QCString, int> QCopChannel::m_refCount; QCopChannel::QCopChannel( const QCString& channel, QObject* parent, const char* name ) : QObject( parent, name ),m_chan(channel) { if (!m_list ) { m_list = new QList<QCopChannel>; /* only connect once */ - connect(OCOPClient::self(), SIGNAL(called(const QCString&, const QCString&, const QByteArray& ) ), - this, SLOT(rev(const QCString&, const QCString&, const QByteArray&) ) ); + connect(OCOPClient::self(), SIGNAL(called(const QCString&,const QCString&,const QByteArray&) ), + this, SLOT(rev(const QCString&,const QCString&,const QByteArray&) ) ); } /* first registration or ref count is 0 for m_chan*/ if (!m_refCount.contains( m_chan ) || !m_refCount[m_chan] ) { qWarning("adding channel %s", m_chan.data() ); m_refCount[m_chan] = 1; OCOPClient::self()->addChannel( m_chan ); }else{ qWarning("reffing up for %s %d", m_chan.data(), m_refCount[m_chan] ); m_refCount[m_chan]++; } m_list->append(this); } void QCopChannel::receive( const QCString& msg, const QByteArray& ar ) { emit received( msg, ar ); } QCopChannel::~QCopChannel() { if (m_refCount[m_chan] == 1 ) { OCOPClient::self()->delChannel( m_chan ); m_refCount[m_chan] = 0; }else m_refCount[m_chan]--; m_list->remove(this); if (m_list->count() == 0 ) { delete m_list; m_list = 0; } } QCString QCopChannel::channel()const { return m_chan; } bool QCopChannel::isRegistered( const QCString& chan) { if (m_refCount.contains(chan) ) { qDebug("Client:locally contains"); return true; } return OCOPClient::self()->isRegistered( chan ); } bool QCopChannel::send( const QCString& chan, const QCString& msg ) { QByteArray ar; return send(chan, msg, ar ); } bool QCopChannel::send( const QCString& chan, const QCString& msg, const QByteArray& ar ) { OCOPClient::self()->send( chan, msg, ar ); |