27 files changed, 1 insertions, 130 deletions
diff --git a/noncore/applets/autorotateapplet/autorotate.cpp b/noncore/applets/autorotateapplet/autorotate.cpp index e7891c8..5152904 100644 --- a/noncore/applets/autorotateapplet/autorotate.cpp +++ b/noncore/applets/autorotateapplet/autorotate.cpp @@ -1,98 +1,90 @@ /* * copyright : (c) 2003 by Greg Gilbert * email : greg@treke.net * based on the cardmon applet by Max Reiss * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * *************************************************************************/ #include "autorotate.h" /* OPIE */ #include <opie2/odevice.h> #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/resource.h> /* QT */ -#include <qapplication.h> -#include <qfile.h> -#include <qcopchannel_qws.h> -#include <qmessagebox.h> #include <qpainter.h> -#include <qpixmap.h> -#include <qimage.h> -#include <qtimer.h> -#include <qtextstream.h> using namespace Opie; AutoRotate::AutoRotate(QWidget * parent):QWidget(parent) { setFixedWidth( AppLnk::smallIconSize() ); setFixedHeight( AppLnk::smallIconSize() ); enabledPm.convertFromImage( Resource::loadImage("autorotate/rotate").smoothScale( height(), width() ) ); disabledPm.convertFromImage( Resource::loadImage("autorotate/norotate").smoothScale( height(), width() ) ); repaint(true); popupMenu = 0; show(); } AutoRotate::~AutoRotate() { if (popupMenu) { delete popupMenu; } } void AutoRotate::mousePressEvent(QMouseEvent *) { QPopupMenu *menu = new QPopupMenu(this); menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 ); QPoint p = mapToGlobal(QPoint(0, 0)); QSize s = menu->sizeHint(); int opt = menu->exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), p.y() - s.height()), 0); if (opt==1) { setRotateEnabled( !isRotateEnabled() ); repaint(true); } delete menu; } void AutoRotate::paintEvent(QPaintEvent *) { QPainter p(this); p.drawPixmap( 0, 0, isRotateEnabled()? enabledPm : disabledPm ); } void AutoRotate::setRotateEnabled(bool status) { Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); cfg.writeEntry( "rotateEnabled", status ); } bool AutoRotate::isRotateEnabled() { Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); bool res = cfg.readBoolEntry( "rotateEnabled" ); if (res ) qDebug("Enabled"); else qDebug("Disabled"); return res; } diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp index 06746a7..7483592 100644 --- a/noncore/applets/memoryapplet/swapfile.cpp +++ b/noncore/applets/memoryapplet/swapfile.cpp @@ -1,137 +1,133 @@ /********************************************************************** ** 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 "swapfile.h" #include <qlabel.h> #include <qtimer.h> -#include <qfile.h> -#include <qtextstream.h> #include <qlayout.h> #include <qpushbutton.h> #include <qhbuttongroup.h> #include <qradiobutton.h> #include <qlineedit.h> #include <qprogressbar.h> #include <qcombobox.h> #include <qvgroupbox.h> #include <qhbox.h> #include <qmessagebox.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <qfile.h> -#include <qtextstream.h> #include <qcopchannel_qws.h> #include <qpe/resource.h> #include <unistd.h> #include <fcntl.h> #include <sys/vfs.h> #include <mntent.h> #include <unistd.h>
#include <sys/types.h>
Swapfile::Swapfile( QWidget *parent, const char *name, WFlags f ) : QWidget( parent, name, f ) { // are we running as root? isRoot = geteuid() == 0; QVBoxLayout* vb = new QVBoxLayout(this, 5); QHButtonGroup* cfsdRBG = new QHButtonGroup(tr("Swapfile location"), this); cfsdRBG->setRadioButtonExclusive(true); vb->addWidget(cfsdRBG); ramRB = new QRadioButton(tr("RAM"), cfsdRBG); cfRB = new QRadioButton(tr("CF Card"), cfsdRBG); sdRB = new QRadioButton(tr("SD Card"), cfsdRBG); QHBox *hb1 = new QHBox(this); hb1->setSpacing(5); swapPath1 = new QLineEdit(hb1); swapPath1->setEnabled(false); QPushButton* swapOn = new QPushButton(tr(" On "), hb1); QPushButton* swapOff = new QPushButton(tr(" Off "), hb1); vb->addWidget(hb1); QVGroupBox* box1 = new QVGroupBox(tr("Manage Swapfile"), this); vb->addWidget(box1); 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 &))); QCopChannel *sdChannel = new QCopChannel("QPE/Card", this); 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() { } diff --git a/noncore/applets/networkapplet/networkapplet.cpp b/noncore/applets/networkapplet/networkapplet.cpp index 9a08568..955ed2e 100644 --- a/noncore/applets/networkapplet/networkapplet.cpp +++ b/noncore/applets/networkapplet/networkapplet.cpp @@ -1,146 +1,140 @@ /* This file is part of the Opie Project =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .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 "networkapplet.h" /* OPIE */ #include <opie2/odebug.h> #include <opie2/onetwork.h> #include <opie2/otaskbarapplet.h> #include <qpe/applnk.h> -#include <qpe/qlibrary.h> #include <qpe/resource.h> #include <qpainter.h> /* QT */ -#include <qhostaddress.h> -#include <qimage.h> #include <qlabel.h> #include <qlayout.h> -#include <qlineedit.h> #include <qobjectlist.h> -#include <qpushbutton.h> -#include <qtoolbutton.h> #include <assert.h> IfaceUpDownButton::IfaceUpDownButton( QWidget* parent, const char* name ) :QToolButton( parent, name ) { _iface = ONetwork::instance()->interface( name ); assert( _iface ); setToggleButton( true ); //setAutoRaise( true ); setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) ); setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) ); setOn( _iface->isUp() ); //setFixedWidth( 16 ); connect( this, SIGNAL( clicked() ), this, SLOT( clicked() ) ); } IfaceUpDownButton::~IfaceUpDownButton() { } void IfaceUpDownButton::clicked() { _iface->setUp( isOn() ); setOn( _iface->isUp() ); // it might not have worked... repaint(); } IfaceIPAddress::IfaceIPAddress( QWidget* parent, const char* name ) :QLineEdit( parent, name ) { setFont( QFont( "fixed" ) ); _iface = ONetwork::instance()->interface( name ); setFixedWidth( 105 ); setText( _iface->ipV4Address() ); connect( this, SIGNAL( returnPressed() ), this, SLOT( returnPressed() ) ); } IfaceIPAddress::~IfaceIPAddress() { } void IfaceIPAddress::returnPressed() { QHostAddress a; a.setAddress( text() ); QHostAddress mask; mask.setAddress( _iface->ipV4Netmask() ); // setIPV4Address destroys the netmask... _iface->setIPV4Address( a ); _iface->setIPV4Netmask( mask ); // recover the old netmask setText( _iface->ipV4Address() ); repaint(); } NetworkAppletControl::NetworkAppletControl( OTaskbarApplet* parent, const char* name ) :QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), l(0) { setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); l = new QVBoxLayout( this, 4, 2 ); } void NetworkAppletControl::build() { ONetwork::InterfaceIterator it = ONetwork::instance()->iterator(); while ( it.current() ) { QHBoxLayout* h = new QHBoxLayout( l ); QLabel* symbol = new QLabel( this ); symbol->setPixmap( Resource::loadPixmap( guessDevice( it.current() ) ) ); h->addWidget( symbol ); symbol->show(); QLabel* name = new QLabel( it.current()->name(), this ); name->setFixedWidth( 35 ); h->addWidget( name ); name->show(); IfaceIPAddress* ip = new IfaceIPAddress( this, it.current()->name() ); h->addWidget( ip ); ip->show(); IfaceUpDownButton* tb = new IfaceUpDownButton( this, it.current()->name() ); tb->show(); h->addWidget( tb ); ++it; } } diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index e2b0c2a..7b8bdd9 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp @@ -1,126 +1,123 @@ /********************************************************************** ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> ** All rights reserved. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #include "notes.h" #include <qapplication.h> #include <stdlib.h> #include <qstringlist.h> #include <qpe/filemanager.h> -#include <qpe/resource.h> #include <qpe/qpeapplication.h> #include <qpe/timestring.h> -#include <qpe/resource.h> -#include <qpe/config.h> #include <qpe/applnk.h> -#include <qpe/config.h> #include <qpe/ir.h> +#include <qpe/config.h> // #include <qsocket.h> // #include <qclipboard.h> #include <qmultilineedit.h> #include <qlistbox.h> #include <qpopupmenu.h> #include <qmessagebox.h> #include <qdir.h> #include <qfile.h> #include <qpoint.h> #include <qpushbutton.h> #include <qpainter.h> #include <qlayout.h> #include <qframe.h> #include <qpixmap.h> #include <qstring.h> #include <qtimer.h> /* XPM */ static char * notes_xpm[] = { "16 16 11 1", " c None", ". c #000000", "+ c #7F7F7F", "@ c #BFBFBF", "# c #BFC1FF", "$ c #FF0000", "% c #FFFFFF", "& c #00037F", "* c #0006FF", "= c #0005BF", "- c #7F0000", " .. ", " .. ", " ... ", " .+ ", " .@. ", " . .+ ", " ..#.@. ", " ..###.+.. ", " ..###$...##.. ", "..###$$$%+$$##&.", ".*=####$-###&=&.", ".=**=###==&=&=..", " ..=**=#&=&=.. ", " ..=*=&=.. ", " ..=.. ", " . "}; NotesControl::NotesControl( QWidget *, const char * ) : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop ) // : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) { QDir d( QDir::homeDirPath()+"/notes"); if( !d.exists()) { qDebug("make dir"); 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")); diff --git a/noncore/applets/wirelessapplet/advancedconfig.cpp b/noncore/applets/wirelessapplet/advancedconfig.cpp index 97b008d..aba0fee 100644 --- a/noncore/applets/wirelessapplet/advancedconfig.cpp +++ b/noncore/applets/wirelessapplet/advancedconfig.cpp @@ -1,55 +1,54 @@ /********************************************************************** ** Copyright (C) 2002 Michael 'Mickey' Lauer ** <mickey@tm.informatik.uni-frankfurt.de> ** http://www.Vanille.de ** ** 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 "advancedconfig.h" #include <qpe/config.h> -#include <qwidget.h> #include <qcheckbox.h> AdvancedConfig::AdvancedConfig( QWidget* parent, const char* name, bool modal, WFlags fl ) : AdvancedConfigBase( parent, name, modal, fl ) { Config cfg( "qpe" ); cfg.setGroup( "Wireless" ); bool rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false ); bool rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false ); bool rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false ); bool rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false ); cbESSID->setChecked( rocESSID ); cbFrequency->setChecked( rocFREQ ); cbAccessPoint->setChecked( rocAP ); cbMODE->setChecked( rocMODE ); } AdvancedConfig::~AdvancedConfig() { } void AdvancedConfig::accept() { Config cfg( "qpe" ); cfg.setGroup( "Wireless" ); cfg.writeEntry( "renew_dhcp_on_essid_change", cbESSID->isChecked() ); cfg.writeEntry( "renew_dhcp_on_freq_change", cbFrequency->isChecked() ); cfg.writeEntry( "renew_dhcp_on_ap_change", cbAccessPoint->isChecked() ); cfg.writeEntry( "renew_dhcp_on_mode_change", cbMODE->isChecked() ); AdvancedConfigBase::accept(); } diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp index cee789c..9ce6618 100644 --- a/noncore/applets/wirelessapplet/wireless.cpp +++ b/noncore/applets/wirelessapplet/wireless.cpp @@ -1,138 +1,133 @@ /********************************************************************** ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer <mickey@vanille.de> ** ** 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 "wireless.h" #include "mgraph.h" #include "advancedconfig.h" #include "connect0.xpm" #include "connect1.xpm" #include "connect2.xpm" #include "connect3.xpm" #include "connect4.xpm" #include "connect5.xpm" #include "nowireless.xpm" /* OPIE */ #include <opie2/onetwork.h> #include <opie2/otaskbarapplet.h> -#include <qpe/qpeapplication.h> #include <qpe/config.h> /* QT */ -#include <qpoint.h> #include <qradiobutton.h> #include <qpushbutton.h> #include <qpainter.h> #include <qlabel.h> #include <qslider.h> #include <qbuttongroup.h> #include <qlayout.h> -#include <qframe.h> -#include <qpixmap.h> -#include <qstring.h> #include <qfile.h> #include <qtextstream.h> /* STD */ #include <sys/types.h> #include <signal.h> #define STYLE_BARS 0 #define STYLE_ANTENNA 1 //#define MDEBUG #undef MDEBUG WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) { readConfig(); writeConfigEntry( "UpdateFrequency", updateFrequency ); writeConfigEntry( "DisplayStyle", displayStyle ); setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); /* status label */ statusLabel = new QLabel( this, "statuslabel" ); QString text( "Wireless Status:<br>" "*** Unknown ***<br>" "Card not inserted ?<br>" "Or Sharp ROM ?<br>" "CELL: 00:00:00:00:00:00" ); /* QString text( "Station: Unknown<br>" "ESSID: Unknown<br>" "MODE: Unknown<br>" "FREQ: Unknown<br>" "CELL: AA:BB:CC:DD:EE:FF" ); */ statusLabel->setText( text ); 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 ) ) ); setFixedSize( sizeHint() ); setFocusPolicy( QWidget::NoFocus ); applet->displayStyleChange( displayStyle ); applet->updateDelayChange( updateFrequency ); connect( group, SIGNAL( clicked( int ) ), diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 5148172..c44d387 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -1,133 +1,123 @@ /*************************************************************************** AdvancedFm.cpp ------------------- ** Created: Sat Mar 9 23:33:09 2002 copyright : (C) 2002 by ljp email : ljp@llornkcor.com * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #define DEVELOPERS_VERSION #include "advancedfm.h" -#include <qpe/filemanager.h> -#include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/mimetype.h> #include <qpe/applnk.h> -#include <qpe/ir.h> #include <qpe/resource.h> #include <qpe/menubutton.h> -#include <qdatetime.h> -#include <qfile.h> #include <qcombobox.h> #include <qpopupmenu.h> #include <qlistview.h> -#include <qlabel.h> -#include <qwidget.h> -#include <qlayout.h> -#include <qimage.h> #include <qmessagebox.h> #include <qlineedit.h> -#include <qpe/qpemessagebox.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&)) ); } 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(); thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); thisDir->setMatchAllDirs(TRUE); thisDir->setNameFilter(filterStr); QString fileL, fileS, fileDate; QString fs= getFileSystemType((const QString &) path); setCaption(tr("AdvancedFm :: ")+fs+" :: " +checkDiskSpace((const QString &) path)+ tr(" kB free") ); bool isDir=FALSE; const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); QFileInfoListIterator it(*list); QFileInfo *fi; while ( (fi=it.current()) ) { if (fi->isSymLink() ) { QString symLink=fi->readLink(); QFileInfo sym( symLink); fileS.sprintf( "%10i", sym.size() ); fileL = fi->fileName() +" -> " + sym.filePath().data(); fileDate = sym.lastModified().toString(); } else { fileS.sprintf( "%10i", fi->size() ); fileL = fi->fileName(); fileDate= fi->lastModified().toString(); diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 18bbd43..9ad1146 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -1,130 +1,119 @@ /***************************************************************************
AdvancedFm.cpp
-------------------
** Created: Sat Mar 9 23:33:09 2002
copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "advancedfm.h"
#include "output.h"
#include "filePermissions.h"
#include <qpe/lnkproperties.h>
#include <qpe/qpeapplication.h>
-#include <qpe/resource.h>
-#include <qpe/qcopenvelope_qws.h>
#include <qpe/applnk.h>
-#include <qpe/ir.h>
#include <qmessagebox.h>
-#include <qmultilineedit.h>
-#include <qstring.h>
-#include <qlayout.h>
-#include <qpixmap.h>
-#include <qcombobox.h>
#include <qpopupmenu.h>
-#include <qtabwidget.h>
-#include <qtoolbutton.h>
-#include <qlineedit.h>
#include <qlistview.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#include <sys/sendfile.h>
#include <fcntl.h>
void AdvancedFm::doDirChange() {
QString pathItem = CurrentView()->currentItem()->text(0);
if( pathItem == "../") {
ListClicked( CurrentView()->currentItem());
} else {
if( pathItem.find(" -> ",0,TRUE) != -1)
pathItem = dealWithSymName((const QString&)pathItem)+"/";
// qWarning(pathItem);
gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
}
}
void AdvancedFm::showMenuHidden() {
if (b) {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
} else {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
}
b = !b;
populateView();
}
void AdvancedFm::showHidden() {
if (b) {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
} else {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
}
populateView();
}
QString AdvancedFm::dealWithSymName(const QString &fileName) {
QString strItem = fileName;
return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
}
void AdvancedFm::runThis() {
if( !CurrentView()->currentItem()) return;
QString fs;
QDir *thisDir = CurrentDir();
QString curFile = CurrentView()->currentItem()->text(0);
QString path = thisDir->canonicalPath();
if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
curFile = dealWithSymName((const QString&)curFile);
if(curFile != "../") {
fs = getFileSystemType((const QString &) path);
QFileInfo fileInfo( path + "/" + curFile);
// qDebug( fileInfo.owner());
if( (fileInfo.permission( QFileInfo::ExeUser)
| fileInfo.permission( QFileInfo::ExeGroup)
| fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
| fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
QCopEnvelope e("QPE/System", "execute(QString)" );
e << curFile;
} else {
curFile = path + "/" + curFile;
DocLnk nf(curFile);
QString execStr = nf.exec();
// qDebug( execStr);
if( execStr.isEmpty() ) {
} else {
nf.execute();
}
}
}
}
void AdvancedFm::runText() {
if( !CurrentView()->currentItem()) return;
QString curFile = CurrentView()->currentItem()->text(0);
if(curFile != "../") {
if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
curFile = dealWithSymName((const QString&)curFile);
diff --git a/noncore/apps/checkbook/cfg.cpp b/noncore/apps/checkbook/cfg.cpp index 0d5d9ed..24fa4cb 100644 --- a/noncore/apps/checkbook/cfg.cpp +++ b/noncore/apps/checkbook/cfg.cpp @@ -1,130 +1,127 @@ /* This file is part of the OPIE Project =. .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> 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 <stdio.h> -#include <qstring.h> -#include <qstringlist.h> #include <qwidget.h> -#include <qpe/resource.h> #include <qpe/config.h> #include "cfg.h" // --- Cfg -------------------------------------------------------------------- Cfg::Cfg() { _currencySymbol="$"; _showLocks=FALSE; _showBalances=FALSE; _pCategories=new CategoryList(); _bDirty=false; } // --- readStringList --------------------------------------------------------- // Reads the entries for the control from a configuration file and returns // them in a StringList. Later this list can be used to create the control. It // is assumed, that the group is already set. Key is used to enumerate the // entries. void Cfg::readStringList(Config &cfg, const char *sKey, QStringList &lst) { QString sEntry; int iCount; // read count of elements sEntry.sprintf("%s_Count", sKey); iCount=cfg.readNumEntry(sEntry, 0); // read entries for(int i=1; i<=iCount; i++) { sEntry.sprintf("%s%d", sKey, i); QString sType=cfg.readEntry(sEntry); if( sType!=NULL ) lst.append(sType); } } // --- readConfig ------------------------------------------------------------- // Reads the member data from the given config file. It will also set the group // "Config" void Cfg::readConfig(Config &config) { // set group config.setGroup( "Config" ); // read scalars _currencySymbol = config.readEntry( "CurrencySymbol", "$" ); _showLocks = config.readBoolEntry( "ShowLocks", FALSE ); _showBalances = config.readBoolEntry( "ShowBalances", FALSE ); _openLastBook = config.readBoolEntry( "OpenLastBook", FALSE ); _sLastBook = config.readEntry("LastBook", ""); _showLastTab = config.readBoolEntry( "ShowLastTab", FALSE ); _bSavePayees = config.readBoolEntry( "SavePayees", FALSE ); // Account types readStringList(config, "AccType", _AccountTypes); if( _AccountTypes.isEmpty() ) { _AccountTypes+= (const char *)QWidget::tr("Savings"); _AccountTypes+= (const char *)QWidget::tr("Checking"); _AccountTypes+= (const char *)QWidget::tr("CD"); _AccountTypes+= (const char *)QWidget::tr("Money market"); _AccountTypes+= (const char *)QWidget::tr("Mutual fund"); _AccountTypes+= (const char *)QWidget::tr("Other"); writeStringList(config, "AccType", _AccountTypes); config.write(); } // Payees readStringList(config, "Payee", _Payees); // Read Categories QStringList lst; readStringList(config, "Category", lst); if( lst.isEmpty() ) { QString type=QWidget::tr("Expense"); lst += QWidget::tr( "Automobile" )+";"+type; lst += QWidget::tr( "Bills" )+";"+type; lst += QWidget::tr( "CDs" )+";"+type; lst += QWidget::tr( "Clothing" )+";"+type; lst += QWidget::tr( "Computer" )+";"+type; lst += QWidget::tr( "DVDs" )+";"+type; lst += QWidget::tr( "Electronics" )+";"+type; lst += QWidget::tr( "Entertainment" )+";"+type; lst += QWidget::tr( "Food" )+";"+type; lst += QWidget::tr( "Gasoline" )+";"+type; lst += QWidget::tr( "Misc" )+";"+type; lst += QWidget::tr( "Movies" )+";"+type; lst += QWidget::tr( "Rent" )+";"+type; lst += QWidget::tr( "Travel" )+";"+type; type=QWidget::tr( "Income" ); lst += QWidget::tr( "Work" )+";"+type; lst += QWidget::tr( "Family Member" )+";"+type; lst += QWidget::tr( "Misc. Credit" )+";"+type; diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index 4ca764f..26b2533 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp @@ -1,132 +1,131 @@ /* This file is part of the OPIE Project =. .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> 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 "checkbook.h" #include "cbinfo.h" #include "transaction.h" #include "traninfo.h" #include "graph.h" #include "graphinfo.h" #include "password.h" -#include "mainwindow.h" #include "cfg.h" #include <qpe/qpeapplication.h> #include <qpe/qpemessagebox.h> #include <qpe/resource.h> #include <qcheckbox.h> #include <qcombobox.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qmultilineedit.h> #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 *) ) ); // 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 diff --git a/noncore/apps/checkbook/configuration.cpp b/noncore/apps/checkbook/configuration.cpp index dfae446..872d9b2 100644 --- a/noncore/apps/checkbook/configuration.cpp +++ b/noncore/apps/checkbook/configuration.cpp @@ -1,138 +1,134 @@ /* This file is part of the OPIE Project =. .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> 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 "configuration.h" -#include "mainwindow.h" #include "listedit.h" -#include "tabledef.h" #include <qcheckbox.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qwhatsthis.h> #include <qlistview.h> -#include <qpushbutton.h> #include <qtabwidget.h> -#include <qpe/resource.h> Configuration::Configuration( QWidget *parent, Cfg &cfg ) : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { setCaption( tr( "Configure 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 QTabWidget( this ); layout->addWidget( _mainWidget ); // Settings tab _mainWidget->addTab( initSettings(cfg), tr( "&Settings" ) ); // Account Types tab ColumnDef *d; _listEditTypes=new ListEdit(_mainWidget, "TYPES" ); d=new ColumnDef( tr("Type"), (ColumnDef::ColumnType)(ColumnDef::typeString | ColumnDef::typeUnique), tr("New Account Type")); _listEditTypes->addColumnDef( d ); _listEditTypes->addData( cfg.getAccountTypes() ); _mainWidget->addTab( _listEditTypes, tr( "&Account Types" ) ); // Categories tab _listEditCategories=new ListEdit(_mainWidget, "CATEGORIES" ); _listEditCategories->addColumnDef( new ColumnDef( tr("Category"), (ColumnDef::ColumnType)(ColumnDef::typeString | ColumnDef::typeUnique), tr("New Category")) ); d=new ColumnDef( tr("Type"), ColumnDef::typeList, tr("Expense") ); d->addColumnValue( tr("Expense") ); d->addColumnValue( tr("Income") ); _listEditCategories->addColumnDef( d ); QStringList lst=cfg.getCategories(); _listEditCategories->addData( lst ); _mainWidget->addTab( _listEditCategories, tr( "&Categories" ) ); // Payees tab _listEditPayees=new ListEdit(_mainWidget, "PAYEES"); _listEditPayees->addColumnDef( new ColumnDef( tr("Payee"), (ColumnDef::ColumnType)(ColumnDef::typeString | ColumnDef::typeUnique), tr("New Payee")) ); _listEditPayees->addData( cfg.getPayees() ); _mainWidget->addTab( _listEditPayees, tr("&Payees") ); } Configuration::~Configuration() { } // ---- initSettings ---------------------------------------------------------- QWidget *Configuration::initSettings(Cfg &cfg) { QWidget *control = new QWidget( _mainWidget ); QFontMetrics fm = fontMetrics(); int fh = fm.height(); 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( 4 ); layout->setMargin( 4 ); QLabel *label = new QLabel( tr( "Enter currency symbol:" ), container ); QWhatsThis::add( label, tr( "Enter your local currency symbol here." ) ); label->setMaximumHeight( fh + 3 ); layout->addWidget( label, 0, 0 ); symbolEdit = new QLineEdit( cfg.getCurrencySymbol(), container ); QWhatsThis::add( symbolEdit, tr( "Enter your local currency symbol here." ) ); symbolEdit->setMaximumHeight( fh + 5 ); symbolEdit->setFocus(); layout->addWidget( symbolEdit, 0, 1 ); lockCB = new QCheckBox( tr( "Show whether checkbook is password\nprotected" ), container ); QWhatsThis::add( lockCB, tr( "Click here to select whether or not the main window will display that the checkbook is protected with a password." ) ); lockCB->setChecked( cfg.getShowLocks() ); layout->addMultiCellWidget( lockCB, 1, 1, 0, 1 ); balCB = new QCheckBox( tr( "Show checkbook balances" ), container ); QWhatsThis::add( balCB, tr( "Click here to select whether or not the main window will display the current balance for each checkbook." ) ); balCB->setMaximumHeight( fh + 5 ); balCB->setChecked( cfg.getShowBalances() ); layout->addMultiCellWidget( balCB, 2, 2, 0, 1 ); openLastBookCB = new QCheckBox( tr("Open last checkbook" ), container ); QWhatsThis::add( openLastBookCB, tr("Click here to select whether the last open checkbook will be opened at startup.") ); openLastBookCB->setMaximumHeight(fh+5); openLastBookCB->setChecked( cfg.isOpenLastBook() ); diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index 60aea42..d0fac3b 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp @@ -1,143 +1,139 @@ /* This file is part of the OPIE Project =. .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> 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 "mainwindow.h" #include "cbinfo.h" #include "configuration.h" #include "password.h" #include "checkbook.h" -#include "listedit.h" #include <qpe/config.h> -#include <qpe/global.h> #include <qpe/qpeapplication.h> #include <qpe/qpemessagebox.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <qmenubar.h> #include <qaction.h> -#include <qcheckbox.h> #include <qdir.h> -#include <qlineedit.h> #include <qwhatsthis.h> MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ ) : QMainWindow( parent, name, WStyle_ContextHelp ) { setCaption( tr( "Checkbook" ) ); cbDir = Global::applicationFileName( "checkbook", "" ); lockIcon = Resource::loadPixmap( "locked" ); // Load configuration options Config config( "checkbook" ); _cfg.readConfig( config ); // Build menu and tool bars setToolBarsMovable( FALSE ); QToolBar *bar = new QToolBar( this ); bar->setHorizontalStretchable( TRUE ); QMenuBar *mb = new QMenuBar( bar ); mb->setMargin( 0 ); QPopupMenu *popup = new QPopupMenu( this ); bar = new QToolBar( this ); QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) ); connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); a->addTo( popup ); a->addTo( bar ); actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); actionOpen->setWhatsThis( tr( "Select a checkbook and then click here to edit it.\n\nYou also can select Edit from the Checkbook menu, or click and hold on a checkbook name." ) ); connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); actionOpen->addTo( popup ); actionOpen->addTo( bar ); actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); actionDelete->addTo( popup ); actionDelete->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 app." ) ); connect( a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) ); a->addTo( popup ); a->addTo( bar ); mb->insertItem( tr( "Checkbook" ), popup ); // Load Checkbook selection list checkbooks = new CBInfoList(); QDir checkdir( cbDir ); if (checkdir.exists() == true) { QStringList cblist = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, QDir::Time ); CBInfo *cb = 0x0; QString filename; for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ ) { filename = cbDir; filename.append( (*it) ); cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); checkbooks->inSort( cb ); } } // Build Checkbook selection list control cbList = 0x0; buildList(); // open last book? if( _cfg.isOpenLastBook() ) { this->show(); this->showMaximized(); QListViewItem *itm=cbList->firstChild(); while( itm ) { if( itm->text(posName)==_cfg.getLastBook() ) { openBook( itm ); break; } itm=itm->nextSibling(); } } } diff --git a/noncore/apps/checkbook/tabledef.cpp b/noncore/apps/checkbook/tabledef.cpp index 13edded..9a42308 100644 --- a/noncore/apps/checkbook/tabledef.cpp +++ b/noncore/apps/checkbook/tabledef.cpp @@ -1,76 +1,74 @@ /* This file is part of the OPIE Project =. .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> 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 "tabledef.h" -#include <qstring.h> -#include <qpe/resource.h> // --- ColumnDef -------------------------------------------------------------- ColumnDef::ColumnDef(const char *sName, ColumnType type, const char *sNewValue) { _sName=sName; _type=type; _sNewValue=sNewValue; } // --- addColumnValue --------------------------------------------------------- void ColumnDef::addColumnValue(const QString &sValue) { if( (_type & 0x00ffffff) !=typeList ) qDebug("Column %s is not a list", (const char *)_sName); else _valueList.append(sValue); } void ColumnDef::addColumnValue(const char *sValue) { if( (_type & 0x00ffffff)!=typeList ) qDebug("Column %s is not a list", (const char *)_sName); else _valueList.append(sValue); } // --- TableDef --------------------------------------------------------------- TableDef::TableDef(const char *sName) { _sName=sName; _vColumns.setAutoDelete(TRUE); } // --- ~TableDef -------------------------------------------------------------- TableDef::~TableDef() { } // --- addColumnDef ----------------------------------------------------------- void TableDef::addColumnDef(ColumnDef *pDef) { _vColumns.append(pDef); } diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp index 9379da0..a72a48b 100644 --- a/noncore/apps/checkbook/transaction.cpp +++ b/noncore/apps/checkbook/transaction.cpp @@ -1,131 +1,130 @@ /* This file is part of the OPIE Project =. .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> 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 "transaction.h" #include "traninfo.h" #include "cfg.h" #include "checkbook.h" #include <qpe/datebookmonth.h> -#include <qpe/resource.h> #include <qbuttongroup.h> #include <qcombobox.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qmultilineedit.h> #include <qradiobutton.h> #include <qwhatsthis.h> Transaction::Transaction( QWidget *parent, bool bNew, const QString &acctname, TranInfo *info, Cfg *pCfg ) : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { QString tempstr = tr( "Transaction for " ); tempstr.append( acctname ); setCaption( tempstr ); _bNew=bNew; 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 ) ) ); 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 &) ) ); // Category label = new QLabel( tr( "Category:" ), container ); QWhatsThis::add( label, tr( "Select transaction category here." ) ); layout->addWidget( label, 3, 0 ); catList = new QComboBox( container ); diff --git a/noncore/apps/confedit/editwidget.cpp b/noncore/apps/confedit/editwidget.cpp index f7dc408..21f69c7 100644 --- a/noncore/apps/confedit/editwidget.cpp +++ b/noncore/apps/confedit/editwidget.cpp @@ -1,97 +1,89 @@ #include "editwidget.h" #include <qlabel.h> #include <qlineedit.h> -#include <qpushbutton.h> #include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qtimer.h> -#include <qpopupmenu.h> -#include <qaction.h> -#include "listviewitemconfigentry.h" EditWidget::EditWidget( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { EditWidgetLayout = new QGridLayout( this ); EditWidgetLayout->setSpacing( 0 ); EditWidgetLayout->setMargin( 0 ); // setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) ); TextLabelFileName = new QLabel( this, "TextLabelFileName" ); TextLabelFileName->setText( tr( "File Name:" ) ); EditWidgetLayout->addWidget( TextLabelFileName, 0, 0 ); TextFileName = new QLabel( this, "TextFileName" ); EditWidgetLayout->addWidget( TextFileName, 0, 1 ); TextLabelGroup = new QLabel( this, "TextLabelGroup" ); TextLabelGroup->setText( tr( "Group:" ) ); EditWidgetLayout->addWidget( TextLabelGroup, 1, 0 ); LineEditGroup = new QLineEdit( this, "LineEditGroup" ); EditWidgetLayout->addWidget( LineEditGroup, 1, 1 ); TextLabelKey = new QLabel( this, "TextLabelKey" ); TextLabelKey->setText( tr( "Key:" ) ); EditWidgetLayout->addWidget( TextLabelKey, 2, 0 ); LineEditKey = new QLineEdit( this, "LineEditKey" ); EditWidgetLayout->addWidget( LineEditKey, 2, 1 ); TextLabelValue = new QLabel( this, "TextLabelValue" ); TextLabelValue->setText( tr( "Value:" ) ); EditWidgetLayout->addWidget( TextLabelValue, 3, 0 ); LineEditValue = new QLineEdit( this, "LineEditValue" ); EditWidgetLayout->addWidget( LineEditValue, 3, 1 ); // layoutType(Nothing); } EditWidget::~EditWidget() { } void EditWidget::layoutType(int t) { switch (t) { case Entry: LineEditGroup->setEnabled(false); TextLabelKey->show(); LineEditKey->show(); TextLabelValue->show(); LineEditValue->show(); TextLabelGroup->show(); LineEditGroup->show(); TextLabelFileName->show(); TextFileName->show(); break; case Group: LineEditGroup->setEnabled(true); TextLabelKey->hide(); LineEditKey->hide(); TextLabelValue->hide(); LineEditValue->hide(); TextLabelGroup->show(); LineEditGroup->show(); TextLabelFileName->show(); TextFileName->show(); break; default: TextLabelKey->hide(); LineEditKey->hide(); TextLabelValue->hide(); LineEditValue->hide(); TextLabelGroup->hide(); LineEditGroup->hide(); TextLabelFileName->hide(); TextFileName->hide(); } // update(); // updateGeometry(); // adjustSize(); } diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp index ce6504c..1ff2c44 100644 --- a/noncore/apps/confedit/listviewitemconffile.cpp +++ b/noncore/apps/confedit/listviewitemconffile.cpp @@ -1,110 +1,109 @@ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ // (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "listviewitemconffile.h" #include <qmessagebox.h> #include <qtextstream.h> -#include <qstring.h> #include "listviewitemconfigentry.h" #define tr QObject::tr ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent) : ListViewItemConf(parent), _valid(false) { confFileInfo = file; // parseFile(); displayText(); } ListViewItemConfFile::~ListViewItemConfFile() { } void ListViewItemConfFile::displayText() { setText(0,(_changed?"*":"")+confFileInfo->fileName()); } QString ListViewItemConfFile::fileName() { return confFileInfo->fileName(); } void ListViewItemConfFile::parseFile() { //qDebug("ListViewItemConfFile::parseFile BEGIN"); QFile confFile(confFileInfo->absFilePath()); if(! confFile.open(IO_ReadOnly)) QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); QTextStream t( &confFile ); QString s; QString group; ListViewItemConfigEntry *groupItem; ListViewItemConfigEntry *item; while ( !t.atEnd() ) { s = t.readLine().stripWhiteSpace(); //qDebug( "line: >%s<\n", s.latin1() ); if (s.contains("<?xml")) { _valid = false; break; }else if ( s[0] == '[' && s[s.length()-1] == ']' ) { // qDebug("got group"+s); group = s.mid(1,s.length()-2); if (!groupItem) groupItem = new ListViewItemConfigEntry(this, tr("no group") ); groupItem = new ListViewItemConfigEntry(this, group ); insertItem( groupItem ); } else if ( int pos = s.find('=') ) { // qDebug("got key"+s); if (!groupItem) qDebug("PANIK NO GROUP! >%s<",group.latin1()); item = new ListViewItemConfigEntry(this, group, s ); groupItem->insertItem( item ); } } confFile.close(); setExpandable( _valid ); // qDebug("ListViewItemConfFile::parseFile END"); } void ListViewItemConfFile::remove() { QFile::remove(confFileInfo->absFilePath()); QFile::remove(backupFileName()); delete this; } void ListViewItemConfFile::revert() { if (!_changed) { // read the backup file QFile conf(confFileInfo->absFilePath()); QFile back(backupFileName()); if (!back.open(IO_ReadOnly)) return; if (!conf.open(IO_WriteOnly)) return; #define SIZE 124 char buf[SIZE]; while (int c = back.readBlock(buf, SIZE) ) conf.writeBlock(buf,c); conf.close(); back.close(); } parseFile(); expand(); } diff --git a/noncore/apps/confedit/listviewitemconfigentry.cpp b/noncore/apps/confedit/listviewitemconfigentry.cpp index 5ef9f61..0970125 100644 --- a/noncore/apps/confedit/listviewitemconfigentry.cpp +++ b/noncore/apps/confedit/listviewitemconfigentry.cpp @@ -1,108 +1,107 @@ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ // (c) 2002 Patrick S. Vogtp <tille@handhelds.org> #include "listviewitemconfigentry.h" -#include "listviewitemconffile.h" #include <qtextstream.h> ListViewItemConfigEntry::ListViewItemConfigEntry(ListViewItemConfFile *parent, QString group, QString key) : ListViewItemConf(parent) { _fileItem = parent; _file = parent->fileName(); _group = group; setKey(key); _groupOrig = group; _keyOrig = _key; _valueOrig = _value; } ListViewItemConfigEntry::~ListViewItemConfigEntry() { } bool ListViewItemConfigEntry::isGroup() { return _key.isEmpty(); } bool ListViewItemConfigEntry::isKey() { return !_key.isEmpty(); } QString ListViewItemConfigEntry::getFile() { return _file; } void ListViewItemConfigEntry::setGroup(QString g) { if (g==_group) return; _group = g; changed(); } QString ListViewItemConfigEntry::getGroup() { return _group; } void ListViewItemConfigEntry::setKey(QString key) { int pos = key.find("="); _key = key.left(pos).stripWhiteSpace(); _value = key.right(key.length() - pos - 1).stripWhiteSpace(); displayText(); } QString ListViewItemConfigEntry::getKey() { return _key; } QString ListViewItemConfigEntry::getValue() { return _value; } void ListViewItemConfigEntry::keyChanged(QString k) { if (k==_key) return; _key = k; changed(); } void ListViewItemConfigEntry::valueChanged(QString v) { if (v==_value) return; _value = v; changed(); } void ListViewItemConfigEntry::displayText() { QString s; if (_changed) s="*"; if (isGroup()) { s += "["+_group+"]"; _type = Group; }else{ s += _key+" = "+_value; _type = Key; } setText(0,s); } void ListViewItemConfigEntry::changed() { _changed=true; displayText(); diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp index 4fe45ba..5f7ad50 100644 --- a/noncore/apps/confedit/mainwindow.cpp +++ b/noncore/apps/confedit/mainwindow.cpp @@ -1,124 +1,115 @@ /*************************************************************************** * * * 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 <qaction.h> -#include <qmessagebox.h> -#include <qpopupmenu.h> -#include <qtoolbutton.h> -#include <qstring.h> #include <qlabel.h> -#include <qfile.h> -#include <qpushbutton.h> #include <qlayout.h> #include <qlineedit.h> -#include <qcursor.h> #include "listviewconfdir.h" -#include "listviewitemconf.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( 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) { // qDebug("MainWindow::setCurrent"); if (!item) return; _item = (ListViewItemConf*) item; if (!_item) return; popupTimer->start( 750, true ); if (_item->getType() == ListViewItemConf::File) { editor->layoutType(EditWidget::File); _currentItem=0; _fileItem = (ListViewItemConfFile*)item; return; } _fileItem = 0; _currentItem = (ListViewItemConfigEntry*)item; if (!_currentItem) return; diff --git a/noncore/apps/keyz-cfg/main.cpp b/noncore/apps/keyz-cfg/main.cpp index 264db20..55cc23e 100644 --- a/noncore/apps/keyz-cfg/main.cpp +++ b/noncore/apps/keyz-cfg/main.cpp @@ -1,24 +1,22 @@ #include <stdio.h> #include <qpe/qpeapplication.h> -#include <qpe/qcopenvelope_qws.h> #include <qmainwindow.h> -#include "cfgfile.h" #include "cfgdlg.h" int main( int argc, char **argv ) { QPEApplication app(argc, argv); CfgFile cfile; CfgParser cp; cp.load(QPEApplication::qpeDir()+"/share/zkb/zkb.xml", cfile); QMainWindow m; CfgDlg c(&m, &cfile, &app); app.showMainWidget(&m); m.hide(); c.showMaximized(); int ret = app.exec(); return ret; } diff --git a/noncore/apps/keyz-cfg/zkb.cpp b/noncore/apps/keyz-cfg/zkb.cpp index abe1f5f..f315d4b 100644 --- a/noncore/apps/keyz-cfg/zkb.cpp +++ b/noncore/apps/keyz-cfg/zkb.cpp @@ -1,97 +1,96 @@ -#include <qnamespace.h> #include "zkb.h" #include <stdio.h> // Implementation of Action class Action::Action():state(0), keycode(0), unicode(0), flags(0) { } Action::Action(State* s, ushort kc, ushort uni, int f): state(s), keycode(kc), unicode(uni), flags(f) { } Action::~Action() { } State* Action::getState() const { return state; } void Action::setState(State* s) { state = s; setDefined(true); } bool Action::hasEvent() const { return flags & Event; } void Action::setEvent(bool e) { flags = (flags & ~Event) | ((e) ? Event : 0); if (e) { setDefined(true); } else { if (state == 0) { setDefined(false); } } } bool Action::isDefined() const { return flags & Defined; } void Action::setDefined(bool d) { flags = (flags & ~Defined) | ((d) ? Defined : 0); } int Action::getKeycode() const { return keycode; } void Action::setKeycode(int c) { keycode = (ushort) c; setEvent(true); } int Action::getUnicode() const { return unicode; } void Action::setUnicode(int u) { unicode = (ushort) u; setEvent(true); } int Action::getModifiers() const { int ret = 0; if (flags & Shift_Mod) { ret |= Qt::ShiftButton; } if (flags & Ctrl_Mod) { ret |= Qt::ControlButton; } if (flags & Alt_Mod) { ret |= Qt::AltButton; } if (flags & Keypad_Mod) { ret |= Qt::Keypad; } return ret; } void Action::setModifiers(int m) { int n = 0; if (m & Qt::ShiftButton) { n |= Shift_Mod; } if (m & Qt::ControlButton) { n |= Ctrl_Mod; } diff --git a/noncore/apps/keyz-cfg/zkbnames.cpp b/noncore/apps/keyz-cfg/zkbnames.cpp index c20a114..b2180ba 100644 --- a/noncore/apps/keyz-cfg/zkbnames.cpp +++ b/noncore/apps/keyz-cfg/zkbnames.cpp @@ -1,98 +1,97 @@ #include <qmap.h> -#include <qstring.h> #include "zkbnames.h" QString Null_String((const char*) 0); // Implementation of KeyNames static struct { int key; char *name; } Key_Names[] = { { 32, "Space" }, { 39, "Apostrophe" }, { 44, "Comma" }, { 46, "Period" }, { 47, "Slash" }, { 65, "A" }, { 66, "B" }, { 67, "C" }, { 68, "D" }, { 69, "E" }, { 70, "F" }, { 71, "G" }, { 72, "H" }, { 73, "I" }, { 74, "J" }, { 75, "K" }, { 76, "L" }, { 77, "M" }, { 78, "N" }, { 79, "O" }, { 80, "P" }, { 81, "Q" }, { 82, "R" }, { 83, "S" }, { 84, "T" }, { 85, "U" }, { 86, "V" }, { 87, "W" }, { 88, "X" }, { 89, "Y" }, { 90, "Z" }, { 4096, "Cancel" }, { 4097, "Tab" }, { 4099, "Backspace" }, { 4100, "Enter" }, { 4114, "Left" }, { 4115, "Up" }, { 4116, "Right" }, { 4117, "Down" }, { 4128, "Left Shift" }, { 4130, "Right Shift" }, { 4152, "Calendar" }, { 4153, "Addressbook" }, { 4154, "Menu" }, { 4155, "Home" }, { 4156, "Mail" }, { 4165, "Fn" }, { 4173, "Middle" }, { 4176, "OK" }, { 4177, "Off" }, { 4178, "Light" }, { 0, 0 } }; static QMap<QString, int> kn_map; static QMap<int, QString> kn_rmap; void init_kn_maps() { int i = 0; while (Key_Names[i].name != 0) { int key = Key_Names[i].key; QString name(Key_Names[i].name); kn_map.insert(name, key); kn_rmap.insert(key, name); i++; } } int KeyNames::find(const QString& key) { if (kn_map.isEmpty()) { init_kn_maps(); } QMap<QString, int>::Iterator it = kn_map.find(key); if (it == kn_map.end()) { return -1; } else { return it.data(); } } const QString& KeyNames::find(int k) { if (kn_map.isEmpty()) { init_kn_maps(); } diff --git a/noncore/apps/opie-bartender/bac.cpp b/noncore/apps/opie-bartender/bac.cpp index ac8a83e..c97a253 100644 --- a/noncore/apps/opie-bartender/bac.cpp +++ b/noncore/apps/opie-bartender/bac.cpp @@ -1,118 +1,115 @@ /**************************************************************************** ** ** Created: Sun Jul 21 19:00:14 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 "bac.h" #include <qcombobox.h> #include <qlabel.h> #include <qlcdnumber.h> #include <qpushbutton.h> #include <qspinbox.h> #include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.h> BacDialog::BacDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "BacDialog" ); setCaption( tr( "Blood Alcohol Estimator" ) ); Layout7 = new QVBoxLayout( this); Layout7->setSpacing( 6 ); Layout7->setMargin( 0 ); Layout1 = new QHBoxLayout; Layout1->setSpacing( 6 ); Layout1->setMargin( 0 ); NumberSpinBox = new QSpinBox( this, "NumberSpinBox" ); Layout1->addWidget( NumberSpinBox ); TextLabel1 = new QLabel(this, "TextLabel1" ); TextLabel1->setText( tr( "Number of Drinks Consumed" ) ); Layout1->addWidget( TextLabel1 ); Layout7->addLayout( Layout1 ); Layout2 = new QHBoxLayout; Layout2->setSpacing( 6 ); Layout2->setMargin( 0 ); WeightSpinBox = new QSpinBox( this, "WeightSpinBox" ); Layout2->addWidget( WeightSpinBox ); WeightSpinBox->setMaxValue(500); TextLabel2 = new QLabel( this, "TextLabel2" ); TextLabel2->setText( tr( "Weight" ) ); Layout2->addWidget( TextLabel2 ); Layout7->addLayout( Layout2 ); Layout3 = new QHBoxLayout; Layout3->setSpacing( 6 ); Layout3->setMargin( 0 ); TimeSpinBox = new QSpinBox( this, "TimeSpinBox" ); Layout3->addWidget( TimeSpinBox ); TimeSpinBox->setMaxValue(24); TextLabel3 = new QLabel( this, "TextLabel3" ); TextLabel3->setText( tr( "Period of Time (hours)" ) ); Layout3->addWidget( TextLabel3 ); Layout7->addLayout( Layout3 ); Layout4 = new QHBoxLayout; Layout4->setSpacing( 6 ); Layout4->setMargin( 0 ); GenderComboBox = new QComboBox( FALSE, this, "GenderComboBox" ); GenderComboBox->insertItem( tr( "Male" ) ); GenderComboBox->insertItem( tr( "Female" ) ); GenderComboBox->insertItem( tr( "Unknown" ) ); Layout4->addWidget( GenderComboBox ); TextLabel4 = new QLabel( this, "TextLabel4" ); TextLabel4->setText( tr( "Gender" ) ); Layout4->addWidget( TextLabel4 ); Layout7->addLayout( Layout4 ); Layout6 = new QHBoxLayout; Layout6->setSpacing( 6 ); Layout6->setMargin( 0 ); TypeDrinkComboBox = new QComboBox( FALSE,this, "TypeDrinkComboBox" ); TypeDrinkComboBox->insertItem( tr( "Beer" ) ); TypeDrinkComboBox->insertItem( tr( "Wine" ) ); TypeDrinkComboBox->insertItem( tr( "Shot" ) ); Layout6->addWidget( TypeDrinkComboBox ); TextLabel1_2 = new QLabel( this, "TextLabel1_2" ); TextLabel1_2->setText( tr( "Type of drink" ) ); Layout6->addWidget( TextLabel1_2 ); Layout7->addLayout( Layout6 ); PushButton1 = new QPushButton( this, "PushButton1" ); PushButton1->setText( tr( "Calculate" ) ); Layout7->addWidget( PushButton1 ); connect(PushButton1,SIGNAL( clicked()), this, SLOT( calculate())); LCDNumber1 = new QLCDNumber( this, "LCDNumber1" ); LCDNumber1->setMaximumHeight( 50); LCDNumber1->setNumDigits(6); LCDNumber1->setSmallDecimalPoint(TRUE); LCDNumber1->setFrameStyle(QFrame::Box); LCDNumber1->setLineWidth(2); LCDNumber1->setSegmentStyle( QLCDNumber::Filled); QPalette palette = LCDNumber1->palette(); palette.setColor(QPalette::Normal, QColorGroup::Foreground, Qt::red); palette.setColor(QPalette::Normal, QColorGroup::Light, Qt::black); palette.setColor(QPalette::Normal, QColorGroup::Dark, Qt::darkGreen); LCDNumber1->setPalette(palette); diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp index 740478f..3c010e9 100644 --- a/noncore/apps/opie-bartender/bartender.cpp +++ b/noncore/apps/opie-bartender/bartender.cpp @@ -1,142 +1,131 @@ /**************************************************************************** ** ** Created: Sat Jul 20 08:10:53 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 "bartender.h" -#include "newdrinks.h" #include "showdrinks.h" #include "inputDialog.h" #include "searchresults.h" #include "bac.h" #include <qpe/qpetoolbar.h> #include <qmenubar.h> //#include <opie2/colorpopupmenu.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> -#include <qcstring.h> #include <qlineedit.h> #include <qdir.h> #include <qpushbutton.h> #include <qlistbox.h> -#include <qstringlist.h> #include <qmultilineedit.h> #include <qmessagebox.h> -#include <qfile.h> #include <qtextstream.h> -#include <qfile.h> #include <qaction.h> #include <qheader.h> #include <qlistview.h> -#include <qwidget.h> #include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qimage.h> -#include <qpixmap.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <errno.h> Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { if ( !name ) setName( "Bartender" ); QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2); layout->setMargin( 2); connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); setCaption( tr( "Bartender" ) ); ToolBar1 = new QToolBar( this, "ToolBar1" ); ToolBar1->setFixedHeight(22); 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))); 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")) ); diff --git a/noncore/apps/opie-bartender/inputDialog.cpp b/noncore/apps/opie-bartender/inputDialog.cpp index 4f4cb84..29643ff 100644 --- a/noncore/apps/opie-bartender/inputDialog.cpp +++ b/noncore/apps/opie-bartender/inputDialog.cpp @@ -1,47 +1,43 @@ /**************************************************************************** inputDialog.cpp ------------------- ** Created: Sat Mar 9 23:33:09 2002 copyright : (C) 2002 by ljp email : ljp@llornkcor.com ** 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 "inputDialog.h" #include <qlineedit.h> -#include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.h> 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 ) ); } InputDialog::~InputDialog() { inputText = LineEdit1->text(); } void InputDialog::setInputText(const QString &string) { LineEdit1->setText( string); } diff --git a/noncore/apps/opie-bartender/newdrinks.cpp b/noncore/apps/opie-bartender/newdrinks.cpp index 86bcc3c..a7ada3a 100644 --- a/noncore/apps/opie-bartender/newdrinks.cpp +++ b/noncore/apps/opie-bartender/newdrinks.cpp @@ -1,67 +1,60 @@ /**************************************************************************** ** 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 "newdrinks.h" -#include <qpe/resource.h> -#include <qaction.h> #include <qlabel.h> #include <qlineedit.h> #include <qmultilineedit.h> -#include <qpushbutton.h> -#include <qwidget.h> #include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.h> New_Drink::New_Drink( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { QString drinkName = name; if ( !name ) setName( drinkName ); setCaption( drinkName); Layout5 = new QGridLayout( this); Layout5->setSpacing( 6 ); Layout5->setMargin( 4 ); // Layout4 = new QHBoxLayout; // Layout4->setSpacing( 6 ); // Layout4->setMargin( 4 ); TextLabel1 = new QLabel( this, "TextLabel1" ); TextLabel1->setText( tr( "Name" ) ); Layout5->addMultiCellWidget( TextLabel1, 0, 0, 0, 0); LineEdit1 = new QLineEdit( this, "LineEdit1" ); Layout5->addMultiCellWidget( LineEdit1, 0, 0, 1, 2); TextLabel2 = new QLabel( this, "TextLabel2" ); TextLabel2->setText( tr( "Ingredients" ) ); Layout5->addMultiCellWidget( TextLabel2, 1, 1, 0, 0); MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" ); Layout5->addMultiCellWidget( MultiLineEdit1, 2, 2, 0, 2); } /* * Destroys the object and frees any allocated resources */ New_Drink::~New_Drink() { // no need to delete child widgets, Qt does it all for us } diff --git a/noncore/apps/opie-bartender/searchresults.cpp b/noncore/apps/opie-bartender/searchresults.cpp index 1a82c6c..4900d1f 100644 --- a/noncore/apps/opie-bartender/searchresults.cpp +++ b/noncore/apps/opie-bartender/searchresults.cpp @@ -1,52 +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 <qpe/resource.h> -#include <qaction.h> -#include <qlabel.h> -#include <qlineedit.h> #include <qlistbox.h> -#include <qpushbutton.h> -#include <qwidget.h> #include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.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 *)) ); } Search_Results::~Search_Results() { } void Search_Results::listSelected(QListBoxItem *) { QDialog::accept(); } diff --git a/noncore/apps/opie-bartender/showdrinks.cpp b/noncore/apps/opie-bartender/showdrinks.cpp index 745f7db..dcfce16 100644 --- a/noncore/apps/opie-bartender/showdrinks.cpp +++ b/noncore/apps/opie-bartender/showdrinks.cpp @@ -1,56 +1,47 @@ /**************************************************************************** ** 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 "showdrinks.h" -#include "bartender.h" -#include <qpe/resource.h> -#include <qaction.h> -#include <qlabel.h> -#include <qlineedit.h> #include <qmultilineedit.h> #include <qpushbutton.h> -#include <qwidget.h> #include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.h> //extern Bartender *bart; Show_Drink::Show_Drink( 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 ); editDrinkButton = new QPushButton( tr("Edit"), this,"editBtn"); Layout5->addMultiCellWidget( editDrinkButton, 0, 0, 0, 0 ); connect(editDrinkButton, SIGNAL(clicked()), this, SLOT(slotEditDrink())); MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" ); MultiLineEdit1->setWordWrap(QMultiLineEdit::WidgetWidth); Layout5->addMultiCellWidget( MultiLineEdit1, 1, 3, 0, 3 ); } Show_Drink::~Show_Drink() { } void Show_Drink::slotEditDrink() { reject(); } |