-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 2 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 2 | ||||
-rw-r--r-- | core/settings/citytime/citytimebase.cpp | 36 | ||||
-rw-r--r-- | noncore/applets/memoryapplet/swapfile.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/zsafe/scqtfiledlg.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 8 | ||||
-rw-r--r-- | noncore/multimedia/powerchord/powerchordbase.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/mediummount/mediumglobal.cc | 2 | ||||
-rw-r--r-- | noncore/settings/sound/soundsettingsbase.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 2 |
11 files changed, 38 insertions, 38 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 9c13017..312c663 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -1,653 +1,653 @@ /* * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) * * This file is an add-on for the OPIE 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 pacakaging * 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. * * * This is a rewrite of the abeditor.h file, modified to provide a more * intuitive interface to TrollTech's original Address Book editor. This * is made to operate exactly in interface with the exception of name. * */ #include "contacteditor.h" #include "namelineedit.h" #include <opie2/odebug.h> #include <opie2/opimcontact.h> #include <qpe/categoryselect.h> #include <qpe/qpeapplication.h> #include <qpe/qpedialog.h> #include <qpe/resource.h> #include <qlabel.h> #include <qtabwidget.h> #include <qlayout.h> #include <qlineedit.h> #include <qmultilineedit.h> #include <qtoolbutton.h> #include <qlistbox.h> #include <qmessagebox.h> #include <qwhatsthis.h> #include <assert.h> static inline bool containsAlphaNum( const QString &str ); static inline bool constainsWhiteSpace( const QString &str ); // helper functions, convert our comma delimited list to proper // file format... void parseEmailFrom( const QString &txt, QString &strDefaultEmail, QString &strAll ); // helper convert from file format to comma delimited... void parseEmailTo( const QString &strDefaultEmail, const QString &strOtherEmail, QString &strBack ); ContactEditor::ContactEditor( const Opie::OPimContact &entry, QWidget *parent, const char *name, WFlags ) : QDialog( parent, name, TRUE, WStyle_ContextHelp ), defaultEmailChooserPosition( -1 ), m_personalView ( false ), cmbDefaultEmail( 0 ), initializing ( false ) { initializing = true; init(); setEntry( entry ); // cmbDefaultEmail = 0; // defaultEmailChooserPosition = -1; initializing = false; } ContactEditor::~ContactEditor() { } void ContactEditor::init() { owarn << "init() START" << oendl; uint i = 0; QStringList trlChooserNames; for (i = 0; i <= 6; i++) { slHomeAddress.append( "" ); slBusinessAddress.append( "" ); } trlChooserNames = Opie::OPimContactFields::trphonefields( false ); slChooserNames = Opie::OPimContactFields::untrphonefields( false ); slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); // Ok, we have to remove elements from the list of dynamic entries // which are now stored in special (not dynamic) widgets.. // Otherwise we will get problems with field assignments! (se) slDynamicEntries.remove("Anniversary"); slDynamicEntries.remove("Birthday"); slDynamicEntries.remove("Gender"); // The same with translated fields.. But I will // use the translation map to avoid mismatches.. QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields(); trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); trlDynamicEntries.remove( translMap[Qtopia::Gender] ); // Last Check to be sure.. assert( slDynamicEntries.count() == trlDynamicEntries.count() ); assert( slChooserNames.count() == trlChooserNames.count() ); for (i = 0; i < slChooserNames.count(); i++) slChooserValues.append(""); QVBoxLayout *vb = new QVBoxLayout( this ); tabMain = new QTabWidget( this ); vb->addWidget( tabMain ); QWidget *tabViewport = new QWidget ( tabMain ); vb = new QVBoxLayout( tabViewport ); svGeneral = new QScrollView( tabViewport ); vb->addWidget( svGeneral, 0, 0 ); svGeneral->setResizePolicy( QScrollView::AutoOneFit ); // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); svGeneral->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( svGeneral->viewport() ); svGeneral->addChild( container ); QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); gl->setResizeMode( QLayout::FreeResize ); btnFullName = new QPushButton( tr( "Full Name..." ), container ); QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); gl->addWidget( btnFullName, 0, 0 ); txtFullName = new ABOOK::NameLineEdit( container ); QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); gl->addWidget( txtFullName, 0, 1 ); QLabel *l = new QLabel( tr( "Job Title" ), container ); QWhatsThis::add( l, tr( "The jobtitle.." ) ); gl->addWidget( l, 1, 0 ); txtJobTitle = new QLineEdit( container ); QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); gl->addWidget( txtJobTitle, 1, 1 ); l = new QLabel( tr("Suffix"), container ); QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); gl->addWidget( l, 2, 0 ); txtSuffix = new QLineEdit( container ); QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); gl->addWidget( txtSuffix, 2, 1 ); l = new QLabel( tr( "Organization" ), container ); QWhatsThis::add( l, tr( "The working place of the contact" ) ); gl->addWidget( l, 3, 0 ); txtOrganization = new QLineEdit( container ); QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); gl->addWidget( txtOrganization, 3, 1 ); // Chooser 1 cmbChooserField1 = new QComboBox( FALSE, container ); QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); cmbChooserField1->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField1, 4, 0 ); // Textfield for chooser 1. // Now use Widgetstack to contain the textfield and the default-email combo ! m_widgetStack1 = new QWidgetStack( container ); txtChooserField1 = new QLineEdit( m_widgetStack1 ); m_widgetStack1 -> addWidget( txtChooserField1, TextField ); gl->addWidget( m_widgetStack1, 4, 1 ); m_widgetStack1 -> raiseWidget( TextField ); // Chooser 2 cmbChooserField2 = new QComboBox( FALSE, container ); QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); cmbChooserField2->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField2, 5, 0 ); // Textfield for chooser 2 // Now use WidgetStack to contain the textfield and the default-email combo! m_widgetStack2 = new QWidgetStack( container ); txtChooserField2 = new QLineEdit( m_widgetStack2 ); m_widgetStack2 -> addWidget( txtChooserField2, TextField ); gl->addWidget( m_widgetStack2, 5, 1 ); m_widgetStack2 -> raiseWidget( TextField ); // Chooser 3 cmbChooserField3 = new QComboBox( FALSE, container ); QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); cmbChooserField3->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField3, 6, 0 ); // Textfield for chooser 2 // Now use WidgetStack to contain the textfield and the default-email combo! m_widgetStack3 = new QWidgetStack( container ); txtChooserField3 = new QLineEdit( m_widgetStack3 ); m_widgetStack3 -> addWidget( txtChooserField3, TextField ); gl->addWidget( m_widgetStack3, 6, 1 ); m_widgetStack3 -> raiseWidget( TextField ); l = new QLabel( tr( "File As" ), container ); QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); gl->addWidget( l, 7, 0 ); cmbFileAs = new QComboBox( TRUE, container ); gl->addWidget( cmbFileAs, 7, 1 ); labCat = new QLabel( tr( "Category" ), container ); gl->addWidget( labCat, 8, 0 ); cmbCat = new CategorySelect( container ); gl->addWidget( cmbCat, 8, 1 ); labCat->show(); cmbCat->show(); btnNote = new QPushButton( tr( "Notes..." ), container ); gl->addWidget( btnNote, 9, 1 ); tabMain->insertTab( tabViewport, tr( "General" ) ); tabViewport = new QWidget ( tabMain ); vb = new QVBoxLayout( tabViewport ); svAddress = new QScrollView( tabViewport ); vb->addWidget( svAddress, 0, 0 ); svAddress->setResizePolicy( QScrollView::AutoOneFit ); svAddress->setFrameStyle( QFrame::NoFrame ); container = new QWidget( svAddress->viewport() ); svAddress->addChild( container ); gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem cmbAddress = new QComboBox( FALSE, container ); cmbAddress->insertItem( tr( "Business" ) ); cmbAddress->insertItem( tr( "Home" ) ); gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); l = new QLabel( tr( "Address" ), container ); gl->addWidget( l, 1, 0 ); txtAddress = new QLineEdit( container ); gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); l = new QLabel( tr( "City" ), container ); gl->addWidget( l, 2, 0 ); txtCity = new QLineEdit( container ); gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); l = new QLabel( tr( "State" ), container ); gl->addWidget( l, 3, 0 ); txtState = new QLineEdit( container ); gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); l = new QLabel( tr( "Zip Code" ), container ); gl->addWidget( l, 4, 0 ); txtZip = new QLineEdit( container ); gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); l = new QLabel( tr( "Country" ), container ); gl->addWidget( l, 5, 0 ); cmbCountry = new QComboBox( TRUE, container ); - cmbCountry->insertItem( tr( "" ) ); + cmbCountry->insertItem( "" ); cmbCountry->insertItem( tr ( "United States" ) ); cmbCountry->insertItem( tr ( "United Kingdom" ) ); cmbCountry->insertItem( tr ( "Afghanistan" ) ); cmbCountry->insertItem( tr ( "Albania" ) ); cmbCountry->insertItem( tr ( "Algeria" ) ); cmbCountry->insertItem( tr ( "American Samoa" ) ); cmbCountry->insertItem( tr ( "Andorra" ) ); cmbCountry->insertItem( tr ( "Angola" ) ); cmbCountry->insertItem( tr ( "Anguilla" ) ); cmbCountry->insertItem( tr ( "Antarctica" ) ); cmbCountry->insertItem( tr ( "Argentina" ) ); cmbCountry->insertItem( tr ( "Armenia" ) ); cmbCountry->insertItem( tr ( "Aruba" ) ); cmbCountry->insertItem( tr ( "Australia" ) ); cmbCountry->insertItem( tr ( "Austria" ) ); cmbCountry->insertItem( tr ( "Azerbaijan" ) ); cmbCountry->insertItem( tr ( "Bahamas" ) ); cmbCountry->insertItem( tr ( "Bahrain" ) ); cmbCountry->insertItem( tr ( "Bangladesh" ) ); cmbCountry->insertItem( tr ( "Barbados" ) ); cmbCountry->insertItem( tr ( "Belarus" ) ); cmbCountry->insertItem( tr ( "Belgium" ) ); cmbCountry->insertItem( tr ( "Belize" ) ); cmbCountry->insertItem( tr ( "Benin" ) ); cmbCountry->insertItem( tr ( "Bermuda" ) ); cmbCountry->insertItem( tr ( "Bhutan" ) ); cmbCountry->insertItem( tr ( "Bolivia" ) ); cmbCountry->insertItem( tr ( "Botswana" ) ); cmbCountry->insertItem( tr ( "Bouvet Island" ) ); cmbCountry->insertItem( tr ( "Brazil" ) ); cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); cmbCountry->insertItem( tr ( "Bulgaria" ) ); cmbCountry->insertItem( tr ( "Burkina Faso" ) ); cmbCountry->insertItem( tr ( "Burundi" ) ); cmbCountry->insertItem( tr ( "Cambodia" ) ); cmbCountry->insertItem( tr ( "Cameroon" ) ); cmbCountry->insertItem( tr ( "Canada" ) ); cmbCountry->insertItem( tr ( "Cape Verde" ) ); cmbCountry->insertItem( tr ( "Cayman Islands" ) ); cmbCountry->insertItem( tr ( "Chad" ) ); cmbCountry->insertItem( tr ( "Chile" ) ); cmbCountry->insertItem( tr ( "China" ) ); cmbCountry->insertItem( tr ( "Christmas Island" ) ); cmbCountry->insertItem( tr ( "Colombia" ) ); cmbCountry->insertItem( tr ( "Comoros" ) ); cmbCountry->insertItem( tr ( "Congo" ) ); cmbCountry->insertItem( tr ( "Cook Island" ) ); cmbCountry->insertItem( tr ( "Costa Rica" ) ); cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); cmbCountry->insertItem( tr ( "Croatia" ) ); cmbCountry->insertItem( tr ( "Cuba" ) ); cmbCountry->insertItem( tr ( "Cyprus" ) ); cmbCountry->insertItem( tr ( "Czech Republic" ) ); cmbCountry->insertItem( tr ( "Denmark" ) ); cmbCountry->insertItem( tr ( "Djibouti" ) ); cmbCountry->insertItem( tr ( "Dominica" ) ); cmbCountry->insertItem( tr ( "Dominican Republic" ) ); cmbCountry->insertItem( tr ( "East Timor" ) ); cmbCountry->insertItem( tr ( "Ecuador" ) ); cmbCountry->insertItem( tr ( "Egypt" ) ); cmbCountry->insertItem( tr ( "El Salvador" ) ); cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); cmbCountry->insertItem( tr ( "Eritrea" ) ); cmbCountry->insertItem( tr ( "Estonia" ) ); cmbCountry->insertItem( tr ( "Ethiopia" ) ); cmbCountry->insertItem( tr ( "Falkland Islands" ) ); cmbCountry->insertItem( tr ( "Faroe Islands" ) ); cmbCountry->insertItem( tr ( "Fiji" ) ); cmbCountry->insertItem( tr ( "Finland" ) ); cmbCountry->insertItem( tr ( "France" ) ); cmbCountry->insertItem( tr ( "French Guiana" ) ); cmbCountry->insertItem( tr ( "French Polynesia" ) ); cmbCountry->insertItem( tr ( "Gabon" ) ); cmbCountry->insertItem( tr ( "Gambia" ) ); cmbCountry->insertItem( tr ( "Georgia" ) ); cmbCountry->insertItem( tr ( "Germany" ) ); cmbCountry->insertItem( tr ( "Ghana" ) ); cmbCountry->insertItem( tr ( "Gibraltar" ) ); cmbCountry->insertItem( tr ( "Greece" ) ); cmbCountry->insertItem( tr ( "Greenland" ) ); cmbCountry->insertItem( tr ( "Grenada" ) ); cmbCountry->insertItem( tr ( "Guadeloupe" ) ); cmbCountry->insertItem( tr ( "Guam" ) ); cmbCountry->insertItem( tr ( "Guatemala" ) ); cmbCountry->insertItem( tr ( "Guinea" ) ); cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); cmbCountry->insertItem( tr ( "Guyana" ) ); cmbCountry->insertItem( tr ( "Haiti" ) ); cmbCountry->insertItem( tr ( "Holy See" ) ); cmbCountry->insertItem( tr ( "Honduras" ) ); cmbCountry->insertItem( tr ( "Hong Kong" ) ); cmbCountry->insertItem( tr ( "Hungary" ) ); cmbCountry->insertItem( tr ( "Iceland" ) ); cmbCountry->insertItem( tr ( "India" ) ); cmbCountry->insertItem( tr ( "Indonesia" ) ); cmbCountry->insertItem( tr ( "Ireland" ) ); cmbCountry->insertItem( tr ( "Israel" ) ); cmbCountry->insertItem( tr ( "Italy" ) ); cmbCountry->insertItem( tr ( "Jamaica" ) ); cmbCountry->insertItem( tr ( "Japan" ) ); cmbCountry->insertItem( tr ( "Jordan" ) ); cmbCountry->insertItem( tr ( "Kazakhstan" ) ); cmbCountry->insertItem( tr ( "Kenya" ) ); cmbCountry->insertItem( tr ( "Kiribati" ) ); cmbCountry->insertItem( tr ( "Korea" ) ); cmbCountry->insertItem( tr ( "Kuwait" ) ); cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); cmbCountry->insertItem( tr ( "Laos" ) ); cmbCountry->insertItem( tr ( "Latvia" ) ); cmbCountry->insertItem( tr ( "Lebanon" ) ); cmbCountry->insertItem( tr ( "Lesotho" ) ); cmbCountry->insertItem( tr ( "Liberia" ) ); cmbCountry->insertItem( tr ( "Liechtenstein" ) ); cmbCountry->insertItem( tr ( "Lithuania" ) ); cmbCountry->insertItem( tr ( "Luxembourg" ) ); cmbCountry->insertItem( tr ( "Macau" ) ); cmbCountry->insertItem( tr ( "Macedonia" ) ); cmbCountry->insertItem( tr ( "Madagascar" ) ); cmbCountry->insertItem( tr ( "Malawi" ) ); cmbCountry->insertItem( tr ( "Malaysia" ) ); cmbCountry->insertItem( tr ( "Maldives" ) ); cmbCountry->insertItem( tr ( "Mali" ) ); cmbCountry->insertItem( tr ( "Malta" ) ); cmbCountry->insertItem( tr ( "Martinique" ) ); cmbCountry->insertItem( tr ( "Mauritania" ) ); cmbCountry->insertItem( tr ( "Mauritius" ) ); cmbCountry->insertItem( tr ( "Mayotte" ) ); cmbCountry->insertItem( tr ( "Mexico" ) ); cmbCountry->insertItem( tr ( "Micronesia" ) ); cmbCountry->insertItem( tr ( "Moldova" ) ); cmbCountry->insertItem( tr ( "Monaco" ) ); cmbCountry->insertItem( tr ( "Mongolia" ) ); cmbCountry->insertItem( tr ( "Montserrat" ) ); cmbCountry->insertItem( tr ( "Morocco" ) ); cmbCountry->insertItem( tr ( "Mozambique" ) ); cmbCountry->insertItem( tr ( "Myanmar" ) ); cmbCountry->insertItem( tr ( "Namibia" ) ); cmbCountry->insertItem( tr ( "Nauru" ) ); cmbCountry->insertItem( tr ( "Nepal" ) ); cmbCountry->insertItem( tr ( "Netherlands" ) ); cmbCountry->insertItem( tr ( "New Caledonia" ) ); cmbCountry->insertItem( tr ( "New Zealand" ) ); cmbCountry->insertItem( tr ( "Nicaragua" ) ); cmbCountry->insertItem( tr ( "Niger" ) ); cmbCountry->insertItem( tr ( "Nigeria" ) ); cmbCountry->insertItem( tr ( "Niue" ) ); cmbCountry->insertItem( tr ( "Norway" ) ); cmbCountry->insertItem( tr ( "Oman" ) ); cmbCountry->insertItem( tr ( "Pakistan" ) ); cmbCountry->insertItem( tr ( "Palau" ) ); cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); cmbCountry->insertItem( tr ( "Panama" ) ); cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); cmbCountry->insertItem( tr ( "Paraguay" ) ); cmbCountry->insertItem( tr ( "Peru" ) ); cmbCountry->insertItem( tr ( "Philippines" ) ); cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); cmbCountry->insertItem( tr ( "Poland" ) ); cmbCountry->insertItem( tr ( "Portugal" ) ); cmbCountry->insertItem( tr ( "Puerto Rico" ) ); cmbCountry->insertItem( tr ( "Qatar" ) ); cmbCountry->insertItem( tr ( "Reunion" ) ); cmbCountry->insertItem( tr ( "Romania" ) ); cmbCountry->insertItem( tr ( "Russia" ) ); cmbCountry->insertItem( tr ( "Rwanda" ) ); cmbCountry->insertItem( tr ( "Saint Lucia" ) ); cmbCountry->insertItem( tr ( "Samoa" ) ); cmbCountry->insertItem( tr ( "San Marino" ) ); cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); cmbCountry->insertItem( tr ( "Senegal" ) ); cmbCountry->insertItem( tr ( "Seychelles" ) ); cmbCountry->insertItem( tr ( "Sierra Leone" ) ); cmbCountry->insertItem( tr ( "Singapore" ) ); cmbCountry->insertItem( tr ( "Slovakia" ) ); cmbCountry->insertItem( tr ( "Slovenia" ) ); cmbCountry->insertItem( tr ( "Solomon Islands" ) ); cmbCountry->insertItem( tr ( "Somalia" ) ); cmbCountry->insertItem( tr ( "South Africa" ) ); cmbCountry->insertItem( tr ( "Spain" ) ); cmbCountry->insertItem( tr ( "Sri Lanka" ) ); cmbCountry->insertItem( tr ( "St. Helena" ) ); cmbCountry->insertItem( tr ( "Sudan" ) ); cmbCountry->insertItem( tr ( "Suriname" ) ); cmbCountry->insertItem( tr ( "Swaziland" ) ); cmbCountry->insertItem( tr ( "Sweden" ) ); cmbCountry->insertItem( tr ( "Switzerland" ) ); cmbCountry->insertItem( tr ( "Taiwan" ) ); cmbCountry->insertItem( tr ( "Tajikistan" ) ); cmbCountry->insertItem( tr ( "Tanzania" ) ); cmbCountry->insertItem( tr ( "Thailand" ) ); cmbCountry->insertItem( tr ( "Togo" ) ); cmbCountry->insertItem( tr ( "Tokelau" ) ); cmbCountry->insertItem( tr ( "Tonga" ) ); cmbCountry->insertItem( tr ( "Tunisia" ) ); cmbCountry->insertItem( tr ( "Turkey" ) ); cmbCountry->insertItem( tr ( "Turkmenistan" ) ); cmbCountry->insertItem( tr ( "Tuvalu" ) ); cmbCountry->insertItem( tr ( "Uganda" ) ); cmbCountry->insertItem( tr ( "Ukraine" ) ); cmbCountry->insertItem( tr ( "Uruguay" ) ); cmbCountry->insertItem( tr ( "Uzbekistan" ) ); cmbCountry->insertItem( tr ( "Vanuatu" ) ); cmbCountry->insertItem( tr ( "Venezuela" ) ); cmbCountry->insertItem( tr ( "Vietnam" ) ); cmbCountry->insertItem( tr ( "Virgin Islands" ) ); cmbCountry->insertItem( tr ( "Western Sahara" ) ); cmbCountry->insertItem( tr ( "Yemen" ) ); cmbCountry->insertItem( tr ( "Yugoslavia" ) ); cmbCountry->insertItem( tr ( "Zambia" ) ); cmbCountry->insertItem( tr ( "Zimbabwe" ) ); if (cmbCountry->listBox()!=0) cmbCountry->listBox()->sort(); cmbCountry->setMaximumWidth( 135 ); gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); // Chooser 4 cmbChooserField4 = new QComboBox( FALSE, container ); cmbChooserField4->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField4, 6, 0 ); // Textfield for chooser 2 // Now use WidgetStack to contain the textfield and the default-email combo! m_widgetStack4 = new QWidgetStack( container ); txtChooserField4 = new QLineEdit( m_widgetStack4 ); m_widgetStack4 -> addWidget( txtChooserField4, TextField ); gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); m_widgetStack4 -> raiseWidget( TextField ); QSpacerItem *space = new QSpacerItem(1,1, QSizePolicy::Maximum, QSizePolicy::MinimumExpanding ); gl->addItem( space, 7, 0 ); tabMain->insertTab( tabViewport, tr( "Address" ) ); tabViewport = new QWidget ( tabMain ); vb = new QVBoxLayout( tabViewport ); svDetails = new QScrollView( tabViewport ); vb->addWidget( svDetails, 0, 0 ); svDetails->setResizePolicy( QScrollView::AutoOneFit ); svDetails->setFrameStyle( QFrame::NoFrame ); container = new QWidget( svDetails->viewport() ); svDetails->addChild( container ); gl = new QGridLayout( container, 1, 2, 2, 4 ); int counter = 0; // Birthday QHBox* hBox = new QHBox( container ); l = new QLabel( tr("Birthday"), container ); gl->addWidget( l, counter, 0 ); QPopupMenu* m1 = new QPopupMenu( container ); birthdayPicker = new DateBookMonth( m1, 0, TRUE ); m1->insertItem( birthdayPicker ); birthdayButton= new QToolButton( hBox, "buttonStart" ); birthdayButton->setPopup( m1 ); birthdayButton->setPopupDelay(0); QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), tr( "Delete" ), hBox, 0 ); gl->addWidget( hBox, counter , 1 ); connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); ++counter; // Anniversary hBox = new QHBox( container ); l = new QLabel( tr("Anniversary"), container ); gl->addWidget( l, counter, 0 ); m1 = new QPopupMenu( container ); anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); m1->insertItem( anniversaryPicker ); anniversaryButton= new QToolButton( hBox, "buttonStart" ); anniversaryButton->setPopup( m1 ); anniversaryButton->setPopupDelay(0); deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), tr( "Delete" ), hBox, 0 ); gl->addWidget( hBox, counter , 1 ); connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); ++counter; // Gender l = new QLabel( tr("Gender"), container ); gl->addWidget( l, counter, 0 ); cmbGender = new QComboBox( container ); cmbGender->insertItem( "", 0 ); cmbGender->insertItem( tr("Male"), 1); cmbGender->insertItem( tr("Female"), 2); gl->addWidget( cmbGender, counter, 1 ); ++counter; // Create Labels and lineedit fields for every dynamic entry QStringList::ConstIterator it = slDynamicEntries.begin(); QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { if (((*it) == "Anniversary") || ((*it) == "Birthday")|| ((*it) == "Gender")) continue; l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); listName.append( l ); gl->addWidget( l, i, 0 ); QLineEdit *e = new QLineEdit( container ); listValue.append( e ); gl->addWidget( e, i, 1); } // Fill labels with names.. // loadFields(); tabMain->insertTab( tabViewport, tr( "Details" ) ); dlgNote = new QDialog( this, "Note Dialog", TRUE ); dlgNote->setCaption( tr("Enter Note") ); QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); txtNote = new QMultiLineEdit( dlgNote ); vbNote->addWidget( txtNote ); connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); dlgName = new QDialog( this, "Name Dialog", TRUE ); dlgName->setCaption( tr("Edit Name") ); gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); l = new QLabel( tr("First Name"), dlgName ); gl->addWidget( l, 0, 0 ); txtFirstName = new ABOOK::NameLineEdit( dlgName ); gl->addWidget( txtFirstName, 0, 1 ); l = new QLabel( tr("Middle Name"), dlgName ); gl->addWidget( l, 1, 0 ); txtMiddleName = new ABOOK::NameLineEdit( dlgName ); gl->addWidget( txtMiddleName, 1, 1 ); l = new QLabel( tr("Last Name"), dlgName ); gl->addWidget( l, 2, 0 ); txtLastName = new ABOOK::NameLineEdit( dlgName ); gl->addWidget( txtLastName, 2, 1 ); // l = new QLabel( tr("Suffix"), dlgName ); // gl->addWidget( l, 3, 0 ); // txtSuffix = new QLineEdit( dlgName ); // gl->addWidget( txtSuffix, 3, 1 ); space = new QSpacerItem(1,1, QSizePolicy::Maximum, QSizePolicy::MinimumExpanding ); gl->addItem( space, 4, 0 ); cmbChooserField1->insertStringList( trlChooserNames ); cmbChooserField2->insertStringList( trlChooserNames ); cmbChooserField3->insertStringList( trlChooserNames ); cmbChooserField4->insertStringList( trlChooserNames ); cmbChooserField1->setCurrentItem( 0 ); cmbChooserField2->setCurrentItem( 1 ); cmbChooserField3->setCurrentItem( 2 ); connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); connect( txtFullName, SIGNAL(textChanged(const QString&)), this, SLOT(slotFullNameChange(const QString&)) ); connect( txtSuffix, SIGNAL(textChanged(const QString&)), this, SLOT(slotSuffixChange(const QString&)) ); diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index 798e1f1..4589c9d 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp @@ -1,318 +1,318 @@ /*************************************************************************** * * * 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 "olistview.h" #include "olistviewitem.h" #include "resultitem.h" #include "adresssearch.h" #include "todosearch.h" #include "datebooksearch.h" #include "applnksearch.h" #include "doclnksearch.h" #include "mainwindow.h" #include <opie2/odebug.h> #include <opie2/owait.h> #include <qpe/qpemessagebox.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> #include <qpe/global.h> #include <qtoolbar.h> #include <qaction.h> #include <qmessagebox.h> #include <qpopupmenu.h> #include <qtoolbutton.h> #include <qstring.h> #include <qlabel.h> #include <qfile.h> #include <qhbuttongroup.h> #include <qhbox.h> #include <qpushbutton.h> #include <qintdict.h> #include <qlayout.h> #include <qlineedit.h> #include <qsignalmapper.h> #include <qtextbrowser.h> #include <qregexp.h> #include <qwhatsthis.h> #include <qmenubar.h> static const char* const image1_data[] = { "14 14 3 1", ". c None", "# c #000000", "a c #ff0000", "..............", "..##.......###", ".#aa#....##aa#", "#aaaa#.##aaaa#", ".##aaa#aaaaa##", "...#aaaaaaa#..", "....#aaaaa#...", "...#aaaaa#....", "..#aaaaaaa#...", ".#aaaaaaaaa#..", "#aaaa###aaaa#.", "#aaa#..##aaa#.", "#aaa#...#aa#..", ".###.....##..."}; MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ), _currentItem(0) { setCaption( tr("OSearch") ); setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); QFrame *mainFrame = new QFrame( this, "mainFrame" ); mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); mainLayout = new QVBoxLayout( mainFrame ); mainLayout->setSpacing( 0 ); mainLayout->setMargin( 3 ); resultsList = new OListView( mainFrame ); resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); mainLayout->addWidget( resultsList ); detailsFrame = new QFrame( mainFrame, "detailsFrame" ); QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); richEdit = new QTextView( detailsFrame ); QWhatsThis::add( richEdit, tr("The details of the current result") ); richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); detailsLayout->addWidget( richEdit ); buttonBox = new QHBox( mainFrame, "Button Box" ); _buttonCount = 0; mainLayout->addWidget( detailsFrame ); mainLayout->addWidget( buttonBox ); detailsFrame->hide(); buttonBox->hide(); searches.append( new AppLnkSearch( resultsList, tr("Applications") ) ); searches.append( new DocLnkSearch( resultsList, tr("Documents") ) ); searches.append( new TodoSearch( resultsList, tr("Todo List") ) ); searches.append( new DatebookSearch( resultsList, tr("Calendar") ) ); searches.append( new AdressSearch( resultsList, tr("Contacts") ) ); setCentralWidget( mainFrame ); popupTimer = new QTimer(); searchTimer = new QTimer(); connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); signalMapper = new QSignalMapper( this ); connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); makeMenu(); Config cfg( "osearch", Config::User ); cfg.setGroup( "search_settings" ); actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); // actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); } void MainWindow::makeMenu() { QToolBar *toolBar = new QToolBar( this ); QToolBar *searchBar = new QToolBar(this); QMenuBar *menuBar = new QMenuBar( toolBar ); QPopupMenu *searchMenu = new QPopupMenu( menuBar ); // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); setToolBarsMovable( false ); toolBar->setHorizontalStretchable( true ); menuBar->insertItem( tr( "Search" ), searchMenu ); menuBar->insertItem( tr( "Settings" ), cfgMenu ); //SETTINGS MENU cfgMenu->insertItem( tr( "Search" ), searchOptions ); QPopupMenu *pop; for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ pop = s->popupMenu(); if (pop){ cfgMenu->insertItem( s->text(0), pop ); } } //SEARCH SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); SearchAllAction->addTo( searchMenu ); searchMenu->insertItem( tr( "Options" ), searchOptions ); //SEARCH OPTIONS //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); //actionWholeWordsOnly->addTo( searchOptions ); actionCaseSensitiv = new QAction( tr("Case sensitive"),QString::null, 0, this, 0, true ); actionCaseSensitiv->addTo( searchOptions ); actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); actionWildcards->addTo( searchOptions ); //SEARCH BAR LabelEnterText = new QLabel( searchBar, "Label" ); LabelEnterText->setAutoMask( FALSE ); LabelEnterText->setText( tr( "Search for: " ) ); addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); searchEdit->setFocus(); searchBar->setHorizontalStretchable( TRUE ); searchBar->setStretchableWidget( searchEdit ); //Search button SearchAllAction->addTo( searchBar ); //image ripped of off opie-login/loginwindow.cpp QPixmap image1( ( const char** ) image1_data ); //Clear text ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); - ClearSearchText->setText( tr( "" ) ); + ClearSearchText->setText( "" ); ClearSearchText->setPixmap( image1 ); connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) ); connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); } MainWindow::~MainWindow() { Config cfg( "osearch", Config::User ); cfg.setGroup( "search_settings" ); cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); cfg.writeEntry( "wildcards", actionWildcards->isOn() ); //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); } void MainWindow::setCurrent(QListViewItem *item) { if (!item) return; _currentItem = (OListViewItem*)item; // _currentItem = dynamic_cast<OListViewItem*>(item); if (_currentItem->rtti() == OListViewItem::Result){ ResultItem *res = (ResultItem*)item; // ResultItem *res = dynamic_cast<ResultItem*>(item); richEdit->setText( res->toRichText() ); QIntDict<QString> acts = res->actions(); QButton *button; for (uint i = 0; i < acts.count(); i++){ button = buttonMap[i]; if (!button) { owarn << " no button for " << *acts[i] << oendl; button = new QPushButton( buttonBox ); buttonMap.insert( i, button ); signalMapper->setMapping(button, i ); connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); } button->setText( *acts[i] ); button->show(); } for (uint i = acts.count(); i < _buttonCount; i++){ button = buttonMap[i]; if (button) button->hide(); } _buttonCount = acts.count(); detailsFrame->show(); buttonBox->show(); }else { detailsFrame->hide(); buttonBox->hide(); } popupTimer->start( 300, true ); } void MainWindow::stopTimer(QListViewItem*) { popupTimer->stop(); } void MainWindow::showPopup() { popupTimer->stop(); if (!_currentItem) return; QPopupMenu *pop = _currentItem->popupMenu(); if (pop) pop->popup( QCursor::pos() ); } void MainWindow::setSearch( const QString &key ) { searchTimer->stop(); _searchString = key; searchTimer->start( 300 ); } void MainWindow::searchStringChanged() { #ifdef NEW_OWAIT OWait("setting search string"); #endif searchTimer->stop(); QString ss = _searchString; //ss = Global::stringQuote( _searchString ); // if (actionWholeWordsOnly->isOn()) // ss = "\\s"+_searchString+"\\s"; // Opie:Core::odebug << " set searchString >" << ss << "<" << oendl; QRegExp re( ss ); re.setCaseSensitive( actionCaseSensitiv->isOn() ); re.setWildcard( actionWildcards->isOn() ); for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) s->setSearch( re ); } void MainWindow::searchAll() { #ifdef NEW_OWAIT OWait("searching..."); #endif for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ s->doSearch(); //resultsList->repaint(); } } void MainWindow::slotAction( int act ) { if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){ ResultItem *res = (ResultItem*)_currentItem; // ResultItem *res = dynamic_cast<ResultItem*>(item); res->action(act); } } void MainWindow::optionChanged(int ) { searchStringChanged(); } diff --git a/core/settings/citytime/citytimebase.cpp b/core/settings/citytime/citytimebase.cpp index 77cb91d..bcdd422 100644 --- a/core/settings/citytime/citytimebase.cpp +++ b/core/settings/citytime/citytimebase.cpp @@ -1,415 +1,415 @@ // changes by Maximilian Reiss <harlekin@handhelds.org> #include "citytimebase.h" #include "zonemap.h" /* OPIE */ #include <opie2/odebug.h> /* QT */ #include <qlabel.h> #include <qtoolbutton.h> #include <qlayout.h> #include <qwhatsthis.h> /* * Constructs a CityTimeBase which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags ) : QWidget( parent, name, WStyle_ContextHelp ) { if ( !name ) setName( "CityTimeBase" ); setCaption( tr( "City Time" ) ); CityTimeBaseLayout = new QVBoxLayout( this ); CityTimeBaseLayout->setSpacing( 3 ); CityTimeBaseLayout->setMargin( 0 ); frmMap = new ZoneMap( this, "frmMap" ); frmMap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, frmMap->sizePolicy().hasHeightForWidth() ) ); CityTimeBaseLayout->addWidget( frmMap ); buttonWidget = new QWidget( this ); QWhatsThis::add( buttonWidget, tr( "Click on one of the set cities to replace it" ) ); Layout2 = new QGridLayout( buttonWidget ); Layout2->setSpacing( 3 ); Layout2->setMargin( 4 ); cmdCity7 = new QToolButton( buttonWidget, "cmdCity7" ); cmdCity7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity7->sizePolicy().hasHeightForWidth() ) ); QFont cmdCity7_font( cmdCity7->font() ); cmdCity7_font.setBold( TRUE ); cmdCity7->setFont( cmdCity7_font ); cmdCity7->setFocusPolicy( QToolButton::TabFocus ); - cmdCity7->setText( tr( "" ) ); + cmdCity7->setText( "" ); cmdCity7->setToggleButton( TRUE ); cmdCity7->setToggleButton( TRUE ); Layout2->addWidget( cmdCity7, 0, 2 ); lblCTime9 = new QLabel( buttonWidget, "lblCTime9" ); lblCTime9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime9->sizePolicy().hasHeightForWidth() ) ); QFont lblCTime9_font( lblCTime9->font() ); lblCTime9_font.setPointSize( 10 ); lblCTime9->setFont( lblCTime9_font ); - lblCTime9->setText( tr( "" ) ); + lblCTime9->setText( "" ); lblCTime9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); Layout2->addWidget( lblCTime9, 2, 3 ); cmdCity8 = new QToolButton( buttonWidget, "cmdCity8" ); cmdCity8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity8->sizePolicy().hasHeightForWidth() ) ); QFont cmdCity8_font( cmdCity8->font() ); cmdCity8_font.setBold( TRUE ); cmdCity8->setFont( cmdCity8_font ); cmdCity8->setFocusPolicy( QToolButton::TabFocus ); - cmdCity8->setText( tr( "" ) ); + cmdCity8->setText( "" ); cmdCity8->setToggleButton( TRUE ); cmdCity8->setToggleButton( TRUE ); Layout2->addWidget( cmdCity8, 1, 2 ); cmdCity2 = new QToolButton( buttonWidget, "cmdCity2" ); QFont cmdCity2_font( cmdCity2->font() ); cmdCity2_font.setBold( TRUE ); cmdCity2->setFont( cmdCity2_font ); cmdCity2->setFocusPolicy( QToolButton::TabFocus ); - cmdCity2->setText( tr( "" ) ); + cmdCity2->setText( "" ); cmdCity2->setToggleButton( TRUE ); cmdCity2->setToggleButton( TRUE ); Layout2->addWidget( cmdCity2, 1, 0 ); lblCTime6 = new QLabel( buttonWidget, "lblCTime6" ); QFont lblCTime6_font( lblCTime6->font() ); lblCTime6_font.setPointSize( 10 ); lblCTime6->setFont( lblCTime6_font ); - lblCTime6->setText( tr( "" ) ); + lblCTime6->setText( "" ); lblCTime6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); Layout2->addWidget( lblCTime6, 5, 1 ); cmdCity6 = new QToolButton( buttonWidget, "cmdCity6" ); cmdCity6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity6->sizePolicy().hasHeightForWidth() ) ); QFont cmdCity6_font( cmdCity6->font() ); cmdCity6_font.setBold( TRUE ); cmdCity6->setFont( cmdCity6_font ); cmdCity6->setFocusPolicy( QToolButton::TabFocus ); - cmdCity6->setText( tr( "" ) ); + cmdCity6->setText( "" ); cmdCity6->setToggleButton( TRUE ); cmdCity6->setToggleButton( TRUE ); Layout2->addWidget( cmdCity6, 5, 0 ); cmdCity4 = new QToolButton( buttonWidget, "cmdCity4" ); cmdCity4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity4->sizePolicy().hasHeightForWidth() ) ); QFont cmdCity4_font( cmdCity4->font() ); cmdCity4_font.setBold( TRUE ); cmdCity4->setFont( cmdCity4_font ); cmdCity4->setFocusPolicy( QToolButton::TabFocus ); - cmdCity4->setText( tr( "" ) ); + cmdCity4->setText( "" ); cmdCity4->setToggleButton( TRUE ); cmdCity4->setToggleButton( TRUE ); Layout2->addWidget( cmdCity4, 3, 0 ); lblCTime5 = new QLabel( buttonWidget, "lblCTime5" ); QFont lblCTime5_font( lblCTime5->font() ); lblCTime5_font.setPointSize( 10 ); lblCTime5->setFont( lblCTime5_font ); - lblCTime5->setText( tr( "" ) ); + lblCTime5->setText( "" ); lblCTime5->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); Layout2->addWidget( lblCTime5, 4, 1 ); lblCTime2 = new QLabel( buttonWidget, "lblCTime2" ); lblCTime2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, lblCTime2->sizePolicy().hasHeightForWidth() ) ); QFont lblCTime2_font( lblCTime2->font() ); lblCTime2_font.setPointSize( 10 ); lblCTime2->setFont( lblCTime2_font ); - lblCTime2->setText( tr( "" ) ); + lblCTime2->setText( "" ); lblCTime2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); Layout2->addWidget( lblCTime2, 1, 1 ); lblCTime1 = new QLabel( buttonWidget, "lblCTime1" ); lblCTime1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, lblCTime1->sizePolicy().hasHeightForWidth() ) ); QFont lblCTime1_font( lblCTime1->font() ); lblCTime1_font.setPointSize( 10 ); lblCTime1->setFont( lblCTime1_font ); - lblCTime1->setText( tr( "" ) ); + lblCTime1->setText( "" ); lblCTime1->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); Layout2->addWidget( lblCTime1, 0, 1 ); cmdCity3 = new QToolButton( buttonWidget, "cmdCity3" ); cmdCity3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity3->sizePolicy().hasHeightForWidth() ) ); QFont cmdCity3_font( cmdCity3->font() ); cmdCity3_font.setBold( TRUE ); cmdCity3->setFont( cmdCity3_font ); cmdCity3->setFocusPolicy( QToolButton::TabFocus ); - cmdCity3->setText( tr( "" ) ); + cmdCity3->setText( "" ); cmdCity3->setToggleButton( TRUE ); cmdCity3->setToggleButton( TRUE ); Layout2->addWidget( cmdCity3, 2, 0 ); lblCTime8 = new QLabel( buttonWidget, "lblCTime8" ); lblCTime8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime8->sizePolicy().hasHeightForWidth() ) ); QFont lblCTime8_font( lblCTime8->font() ); lblCTime8_font.setPointSize( 10 ); lblCTime8->setFont( lblCTime8_font ); - lblCTime8->setText( tr( "" ) ); + lblCTime8->setText( "" ); lblCTime8->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); Layout2->addWidget( lblCTime8, 1, 3 ); cmdCity1 = new QToolButton( buttonWidget, "cmdCity1" ); cmdCity1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity1->sizePolicy().hasHeightForWidth() ) ); QFont cmdCity1_font( cmdCity1->font() ); cmdCity1_font.setBold( TRUE ); cmdCity1->setFont( cmdCity1_font ); cmdCity1->setFocusPolicy( QToolButton::TabFocus ); - cmdCity1->setText( tr( "" ) ); + cmdCity1->setText( "" ); cmdCity1->setToggleButton( TRUE ); cmdCity1->setToggleButton( TRUE ); Layout2->addWidget( cmdCity1, 0, 0 ); lblCTime7 = new QLabel( buttonWidget, "lblCTime7" ); lblCTime7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime7->sizePolicy().hasHeightForWidth() ) ); QFont lblCTime7_font( lblCTime7->font() ); lblCTime7_font.setPointSize( 10 ); lblCTime7->setFont( lblCTime7_font ); - lblCTime7->setText( tr( "" ) ); + lblCTime7->setText( "" ); lblCTime7->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); Layout2->addWidget( lblCTime7, 0, 3 ); lblCTime4 = new QLabel( buttonWidget, "lblCTime4" ); QFont lblCTime4_font( lblCTime4->font() ); lblCTime4_font.setPointSize( 10 ); lblCTime4->setFont( lblCTime4_font ); - lblCTime4->setText( tr( "" ) ); + lblCTime4->setText( "" ); lblCTime4->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); Layout2->addWidget( lblCTime4, 3, 1 ); cmdCity5 = new QToolButton( buttonWidget, "cmdCity5" ); cmdCity5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity5->sizePolicy().hasHeightForWidth() ) ); QFont cmdCity5_font( cmdCity5->font() ); cmdCity5_font.setBold( TRUE ); cmdCity5->setFont( cmdCity5_font ); cmdCity5->setFocusPolicy( QToolButton::TabFocus ); - cmdCity5->setText( tr( "" ) ); + cmdCity5->setText( "" ); cmdCity5->setToggleButton( TRUE ); cmdCity5->setToggleButton( TRUE ); Layout2->addWidget( cmdCity5, 4, 0 ); lblCTime3 = new QLabel( buttonWidget, "lblCTime3" ); QFont lblCTime3_font( lblCTime3->font() ); lblCTime3_font.setPointSize( 10 ); lblCTime3->setFont( lblCTime3_font ); - lblCTime3->setText( tr( "" ) ); + lblCTime3->setText( "" ); lblCTime3->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); Layout2->addWidget( lblCTime3, 2, 1 ); cmdCity9 = new QToolButton( buttonWidget, "cmdCity9" ); cmdCity9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity9->sizePolicy().hasHeightForWidth() ) ); QFont cmdCity9_font( cmdCity9->font() ); cmdCity9_font.setBold( TRUE ); cmdCity9->setFont( cmdCity9_font ); cmdCity9->setFocusPolicy( QToolButton::TabFocus ); - cmdCity9->setText( tr( "" ) ); + cmdCity9->setText( "" ); cmdCity9->setToggleButton( TRUE ); cmdCity9->setToggleButton( TRUE ); Layout2->addWidget( cmdCity9, 2, 2 ); CityTimeBaseLayout->addWidget( buttonWidget ); // signals and slots connections connect( frmMap, SIGNAL( signalTz(const QString&,const QString&) ), this, SLOT( slotNewTz(const QString&,const QString&) ) ); connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); connect( cmdCity1, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity2, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity7, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity3, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity4, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity5, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity6, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity8, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); connect( cmdCity9, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); // tab order setTabOrder( cmdCity1, cmdCity2 ); setTabOrder( cmdCity2, cmdCity3 ); setTabOrder( cmdCity3, cmdCity4 ); setTabOrder( cmdCity4, cmdCity5 ); setTabOrder( cmdCity5, cmdCity6 ); setTabOrder( cmdCity6, cmdCity7 ); setTabOrder( cmdCity7, cmdCity8 ); setTabOrder( cmdCity8, cmdCity9 ); setTabOrder( cmdCity9, frmMap ); } /* * Destroys the object and frees any allocated resources */ CityTimeBase::~CityTimeBase() { // no need to delete child widgets, Qt does it all for us } /* * Main event handler. Reimplemented to handle application * font changes */ bool CityTimeBase::event( QEvent* ev ) { bool ret = QWidget::event( ev ); if ( ev->type() == QEvent::ApplicationFontChange ) { QFont cmdCity7_font( cmdCity7->font() ); cmdCity7_font.setBold( TRUE ); cmdCity7->setFont( cmdCity7_font ); QFont lblCTime9_font( lblCTime9->font() ); lblCTime9_font.setPointSize( 10 ); lblCTime9->setFont( lblCTime9_font ); QFont cmdCity8_font( cmdCity8->font() ); cmdCity8_font.setBold( TRUE ); cmdCity8->setFont( cmdCity8_font ); QFont cmdCity2_font( cmdCity2->font() ); cmdCity2_font.setBold( TRUE ); cmdCity2->setFont( cmdCity2_font ); QFont lblCTime6_font( lblCTime6->font() ); lblCTime6_font.setPointSize( 10 ); lblCTime6->setFont( lblCTime6_font ); QFont cmdCity6_font( cmdCity6->font() ); cmdCity6_font.setBold( TRUE ); cmdCity6->setFont( cmdCity6_font ); QFont cmdCity4_font( cmdCity4->font() ); cmdCity4_font.setBold( TRUE ); cmdCity4->setFont( cmdCity4_font ); QFont lblCTime5_font( lblCTime5->font() ); lblCTime5_font.setPointSize( 10 ); lblCTime5->setFont( lblCTime5_font ); QFont lblCTime2_font( lblCTime2->font() ); lblCTime2_font.setPointSize( 10 ); lblCTime2->setFont( lblCTime2_font ); QFont lblCTime1_font( lblCTime1->font() ); lblCTime1_font.setPointSize( 10 ); lblCTime1->setFont( lblCTime1_font ); QFont cmdCity3_font( cmdCity3->font() ); cmdCity3_font.setBold( TRUE ); cmdCity3->setFont( cmdCity3_font ); QFont lblCTime8_font( lblCTime8->font() ); lblCTime8_font.setPointSize( 10 ); lblCTime8->setFont( lblCTime8_font ); QFont cmdCity1_font( cmdCity1->font() ); cmdCity1_font.setBold( TRUE ); cmdCity1->setFont( cmdCity1_font ); QFont lblCTime7_font( lblCTime7->font() ); lblCTime7_font.setPointSize( 10 ); lblCTime7->setFont( lblCTime7_font ); QFont lblCTime4_font( lblCTime4->font() ); lblCTime4_font.setPointSize( 10 ); lblCTime4->setFont( lblCTime4_font ); QFont cmdCity5_font( cmdCity5->font() ); cmdCity5_font.setBold( TRUE ); cmdCity5->setFont( cmdCity5_font ); QFont lblCTime3_font( lblCTime3->font() ); lblCTime3_font.setPointSize( 10 ); lblCTime3->setFont( lblCTime3_font ); QFont cmdCity9_font( cmdCity9->font() ); cmdCity9_font.setBold( TRUE ); cmdCity9->setFont( cmdCity9_font ); } return ret; } void CityTimeBase::beginNewTz() { owarn << "CityTimeBase::beginNewTz(): Not implemented yet!" << oendl; } void CityTimeBase::slotNewTz(const QString &, const QString &) { owarn << "CityTimeBase::slotNewTz(const QString &, const QString &): Not implemented yet!" << oendl; } diff --git a/noncore/applets/memoryapplet/swapfile.cpp b/noncore/applets/memoryapplet/swapfile.cpp index a71078f..96010c8 100644 --- a/noncore/applets/memoryapplet/swapfile.cpp +++ b/noncore/applets/memoryapplet/swapfile.cpp @@ -1,439 +1,439 @@ /********************************************************************** ** 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" /* OPIE */ #include <opie2/odebug.h> #include <qpe/resource.h> using namespace Opie::Core; /* QT */ #include <qfile.h> #include <qtextstream.h> #include <qlabel.h> #include <qtimer.h> #include <qlayout.h> #include <qpushbutton.h> #include <qhbuttongroup.h> #include <qradiobutton.h> #include <qlineedit.h> #include <qprogressbar.h> #include <qcombobox.h> #include <qvgroupbox.h> #include <qhbox.h> #include <qmessagebox.h> #include <qcopchannel_qws.h> /* STD */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <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); + swapStatus = new QLabel("", 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() { } 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"; } QFile f(fileName); if (f.open(IO_ReadOnly)) { QStringList list; QTextStream stream(&f); QString streamIn; streamIn = stream.read(); list = QStringList::split("\n", streamIn); for (QStringList::Iterator line = list.begin(); line != list.end(); line++) { if ((*line).startsWith("Socket 0:")) { if ((*line).startsWith("Socket 0: empty") && cardInPcmcia0) { cardInPcmcia0 = FALSE; } else if (!(*line).startsWith("Socket 0: empty") && !cardInPcmcia0) { cardInPcmcia0 = TRUE; } } else if ((*line).startsWith("Socket 1:")) { if ((*line).startsWith("Socket 1: empty") && cardInPcmcia1) { cardInPcmcia1 = FALSE; } else if (!(*line).startsWith("Socket 1: empty") && !cardInPcmcia1) { cardInPcmcia1 = TRUE; } } } f.close(); if (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1) { QString text = QString::null; QString what = QString::null; if (cardWas0 != cardInPcmcia0) { if (cardInPcmcia0) { cfRB->setEnabled(TRUE); } else { cfRB->setChecked(FALSE); cfRB->setEnabled(FALSE); } } if (cardWas1 != cardInPcmcia1) { if (cardInPcmcia1) { cfRB->setEnabled(TRUE); } else { cfRB->setChecked(FALSE); cfRB->setEnabled(FALSE); } } } } else { // no file found odebug << "no file found" << oendl; cardInPcmcia0 = FALSE; cardInPcmcia1 = FALSE; } Swapfile::cfsdchecked(); } void Swapfile::getStatusSd() { bool cardWas = cardInSd; // remember last state cardInSd = FALSE; #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) struct mntent *me; FILE *mntfp = setmntent("/etc/mtab", "r"); if (mntfp) { while ((me = getmntent(mntfp)) != 0) { QString fs = me->mnt_fsname; if (fs.left(14) == "/dev/mmc/part1" || fs.left(7) == "/dev/sd" || fs.left(9) == "/dev/mmcd") { cardInSd = TRUE; show(); } } endmntent(mntfp); } if (cardWas != cardInSd) { QString text = QString::null; QString what = QString::null; if (cardInSd) { sdRB->setEnabled(TRUE); } else { sdRB->setChecked(FALSE); sdRB->setEnabled(FALSE); } } #else #error "Not on Linux" #endif Swapfile::cfsdchecked(); } int rc=0; void Swapfile::swapon() { char swapcmd[128] ="swapon "; Swapfile::cfsdchecked(); strcat(swapcmd,swapPath1->text()); char *runcmd = swapcmd; rc = exec(QString("%1").arg(runcmd)); if (rc != 0) { setStatusMessage("Failed to attach swapfile.", true); } else { /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ setStatusMessage("Swapfile activated."); } Swapfile::status(); } void Swapfile::setStatusMessage(const QString& text, bool error /* = false */) { swapStatus->setText("<b>" + text + "</b>"); swapStatusIcon->setPixmap(Resource::loadPixmap(error ? "close" : "done")); } void Swapfile::swapoff() { char swapcmd[128] ="swapoff "; if (Swapfile::cfRB->isChecked() == TRUE) Swapfile::cfsdchecked(); strcat(swapcmd,swapPath1->text()); char *runcmd = swapcmd; rc = exec(QString("%1").arg(runcmd)); if (rc != 0) { setStatusMessage(tr("Failed to detach swapfile."), true); } else { /* QMessageBox::information(this, "Information", "Swapfile is inactive!"); */ setStatusMessage(tr("Swapfile deactivated.")); /* Swapfile::swapPath->clear();*/ } Swapfile::status(); } void Swapfile::cfsdchecked() { /* Swapfile::swapPath->clear();*/ Swapfile::swapPath1->clear(); if (Swapfile::ramRB->isChecked() == TRUE) { Swapfile::swapPath1->insert("/home/swapfile"); } if (Swapfile::sdRB->isChecked() == TRUE) { Swapfile::swapPath1->insert("/mnt/card/swapfile"); } if (Swapfile::cfRB->isChecked() == TRUE) { Swapfile::swapPath1->insert("/mnt/cf/swapfile"); } /* Swapfile::swapPath->insert(Swapfile::swapPath1->text());*/ } void Swapfile::makeswapfile() { int i = swapSize->currentItem(); mkswapProgress->setProgress(1); switch ( i ) { case 0: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=2048").arg(swapPath1->text())); break; case 1: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=4096").arg(swapPath1->text())); break; case 2: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=6144").arg(swapPath1->text())); break; case 3: rc=exec(QString("dd if=/dev/zero of=%1 bs=1k count=8192").arg(swapPath1->text())); break; } if (rc != 0) { setStatusMessage(tr("Failed to create swapfile."), true); } mkswapProgress->setProgress(2); rc=exec(QString("mkswap %1").arg(swapPath1->text())); if (rc != 0) { setStatusMessage(tr("Failed to initialize swapfile."), true); } mkswapProgress->setProgress(3); mkswapProgress->reset(); setStatusMessage(tr("Swapfile created.")); } void Swapfile::removeswapfile() { exec(QString("swapoff %1").arg(swapPath1->text())); rc=exec(QString("rm -rf %1").arg(swapPath1->text())); if (rc != 0) { setStatusMessage(tr("Failed to remove swapfile."), true); } Swapfile::status(); Swapfile::cfsdchecked(); setStatusMessage(tr("Swapfile removed.")); } void Swapfile::status() { FILE *fp; char buffer[128], swapfile[128], temp[128]; int swapsize=2000, i=1; fp=fopen("/proc/swaps", "r"); while ( (fgets(buffer,128,fp)) != NULL ) { sscanf(buffer, "%s %s %d %s %s\n", swapfile, temp, &swapsize, temp, temp); } fclose(fp); ramRB->setChecked(FALSE); cfRB->setChecked(FALSE); sdRB->setChecked(FALSE); i=strcmp(swapfile, "/home/swapfile"); if ( i == 0 ) { ramRB->setChecked(TRUE); /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ setStatusMessage(tr("Swapfile activated.")); } i=strcmp(swapfile, "/usr/mnt.rom/cf/swapfile"); if ( i == 0 ) { cfRB->setChecked(TRUE); /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ setStatusMessage(tr("Swapfile activated.")); } i=strcmp(swapfile, "/mnt/cf/swapfile"); if ( i == 0 ) { cfRB->setChecked(TRUE); /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ setStatusMessage(tr("Swapfile activated.")); } i=strcmp(swapfile, "/usr/mnt.rom/card/swapfile"); if ( i == 0 ) { sdRB->setChecked(TRUE); /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ setStatusMessage(tr("Swapfile activated.")); } i=strcmp(swapfile, "/mnt/card/swapfile"); if ( i == 0 ) { sdRB->setChecked(TRUE); /* QMessageBox::information(this, "Information", "Swapfile is active!"); */ setStatusMessage(tr("Swapfile activated.")); } Swapfile::cfsdchecked(); swapsize /=1000; switch ( swapsize ) { case 2: swapSize->setCurrentItem(0); break; case 4: swapSize->setCurrentItem(1); break; case 6: swapSize->setCurrentItem(2); break; case 8: swapSize->setCurrentItem(3); break; } } diff --git a/noncore/apps/zsafe/scqtfiledlg.cpp b/noncore/apps/zsafe/scqtfiledlg.cpp index c67bbd5..f036101 100644 --- a/noncore/apps/zsafe/scqtfiledlg.cpp +++ b/noncore/apps/zsafe/scqtfiledlg.cpp @@ -1,253 +1,253 @@ #include "scqtfiledlg.h" /* OPIE */ #include <opie2/odebug.h> using namespace Opie::Core; /* QT */ #include <qcombobox.h> #include <qlineedit.h> #include <qlistview.h> #include <qtoolbutton.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> static const char* const image0_data[] = { "24 16 3 1", ". c None", "# c #000040", "a c #808080", "........................", "........................", ".................####...", ".................####...", ".......##........#aa#...", "......###........#aa#...", ".....####........#aa#...", "....##############aa#...", "...###aaaaaaaaaaaaaa#...", "..####aaaaaaaaaaaaaa#...", "...###aaaaaaaaaaaaaa#...", "....#################...", ".....####...............", "......###...............", ".......##...............", "........................"}; static const char* const image1_data[] = { "24 16 4 1", ". c None", "a c #008080", "b c #808080", "# c #ff0000", "........................", "........................", "...####..........####...", "...#####........#####...", "....######.....#####a...", ".....######...#####ba...", ".....aa###########bba...", "....aaaaa#######aabba...", "...aaabbb######bbbbba...", "..aaaabb########bbbba...", "...aaa############bba...", "....a######aaa#####aa...", "....######.....######...", "...#####a........####...", "...####aa.........###...", "........................"}; static const char* const image2_data[] = { "17 15 4 1", "# c #000000", ". c #dcdcdc", "a c #ffff00", "b c #ffffff", ".................", "............#....", ".................", "............#....", ".........#.....#.", "....####..#.#.#..", "...#abab#..#.#...", "..##########..#.#", "..#babababab##...", "..#ababababa#.#..", "..#babababab#..#.", "..#ababababa#....", "..#babababab#....", "..#ababababa#....", "..###########...."}; /* * Constructs a ScQtFileDlg which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { QPixmap image0( ( const char** ) image0_data ); QPixmap image1( ( const char** ) image1_data ); QPixmap image2( ( const char** ) image2_data ); if ( !name ) setName( "ScQtFileDlg" ); resize( 196, 279 ); if (!name) setCaption( tr( "FileDlg" ) ); else setCaption(name); ScQtFileDlgLayout = new QVBoxLayout( this ); ScQtFileDlgLayout->setSpacing( 6 ); ScQtFileDlgLayout->setMargin( 11 ); Layout5 = new QVBoxLayout; Layout5->setSpacing( 6 ); Layout5->setMargin( 0 ); Layout4 = new QVBoxLayout; Layout4->setSpacing( 6 ); Layout4->setMargin( 0 ); Layout3 = new QHBoxLayout; Layout3->setSpacing( 6 ); Layout3->setMargin( 0 ); TypeComboBox = new QComboBox( FALSE, this, "TypeComboBox" ); TypeComboBox->setEditable( TRUE ); TypeComboBox->setInsertionPolicy( QComboBox::AtBottom ); TypeComboBox->setAutoCompletion( FALSE ); TypeComboBox->setDuplicatesEnabled( FALSE ); QToolTip::add( TypeComboBox, tr( "file type filter" ) ); QWhatsThis::add( TypeComboBox, tr( "ComboBox FileTypeFilter\n" "\n" "edit or select the filter" ) ); Layout3->addWidget( TypeComboBox ); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout3->addItem( spacer ); OkButton = new QToolButton( this, "OkButton" ); - OkButton->setText( tr( "" ) ); + OkButton->setText( "" ); OkButton->setPixmap( image0 ); OkButton->setUsesBigPixmap( FALSE ); QToolTip::add( OkButton, tr( "confirms the selection and closes the form" ) ); QWhatsThis::add( OkButton, tr( "OKButton" ) ); Layout3->addWidget( OkButton ); CancelButton = new QToolButton( this, "CancelButton" ); - CancelButton->setText( tr( "" ) ); + CancelButton->setText( "" ); CancelButton->setPixmap( image1 ); CancelButton->setUsesBigPixmap( FALSE ); QToolTip::add( CancelButton, tr( "cancels the selection and closes the form" ) ); QWhatsThis::add( CancelButton, tr( "CancelButton" ) ); 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->setText( "" ); 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( 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( 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() { owarn << "ScQtFileDlg::slotCancel(): Not implemented yet!" << oendl; } void ScQtFileDlg::slotDirComboBoxChanged( int ) { owarn << "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" << oendl; } void ScQtFileDlg::slotDoubleClicked(QListViewItem *) { owarn << "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" << oendl; } void ScQtFileDlg::slotFileTextChanged( const QString & ) { owarn << "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" << oendl; } void ScQtFileDlg::slotMkDir() { owarn << "ScQtFileDlg::slotMkDir(): Not implemented yet!" << oendl; } void ScQtFileDlg::slotOK() { owarn << "ScQtFileDlg::slotOK(): Not implemented yet!" << oendl; } void ScQtFileDlg::slotSelectionChanged(QListViewItem *) { owarn << "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" << oendl; } void ScQtFileDlg::slotTypeComboBoxChanged( int ) { owarn << "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" << oendl; } diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index ca3ff52..189453e 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -206,787 +206,787 @@ static const char* const passwords_data[] = { "#oopqpprprr#....", "#oopqpprprr#....", "############...."}; static const char* const software_data[] = { "16 16 5 1", ". c None", "# c #000000", "b c #838183", "c c #c5ffff", "a c #ffffff", "................", ".##############.", "#aaaaaaaaaaaaaa#", "#abbbbbbbbbbbbb#", "#ab##########ab#", "#ab#c########ab#", "#ab#c#c######ab#", "#ab##########ab#", "#ab##########ab#", "#ab##########ab#", "#ab##########ab#", "#ab##########ab#", "#aaaaaaaaaaaaab#", "#bbbbbbbbbbbbbb#", ".##############.", "................"}; static const char* const general_data[] = { "14 14 98 2", "Qt c None", ".k c #000000", "#x c #080808", "#F c #101008", "#q c #101010", "#i c #101410", "## c #101810", ".m c #181818", ".3 c #181c18", ".I c #182018", ".T c #202420", "#D c #202820", "#y c #292c29", ".c c #293029", ".d c #313031", "#E c #313429", "#r c #313831", ".j c #393c31", "#j c #394039", "#C c #414841", ".w c #4a554a", ".a c #4a594a", ".# c #525052", ".l c #52594a", "#f c #525952", "#v c #525d52", ".O c #5a4c4a", ".9 c #5a595a", ".A c #5a5d52", ".B c #624c52", ".0 c #625552", "#o c #626562", ".R c #626962", "#. c #626d5a", "#p c #626d62", ".2 c #627162", "#h c #6a6d62", "#z c #6a7562", "#w c #6a756a", ".C c #73656a", ".P c #73696a", "#a c #737d6a", ".U c #738573", ".E c #7b817b", "#B c #7b857b", "#s c #7b897b", "#n c #7b917b", ".b c #838d83", ".7 c #839583", ".n c #8b7d7b", "#g c #8b8583", ".g c #8b858b", ".r c #8b898b", ".s c #8b8d8b", ".i c #8b9183", ".8 c #8b918b", "#A c #8b9d8b", ".S c #8ba183", ".Z c #94918b", ".N c #949994", ".F c #949d94", ".x c #94a18b", ".v c #94a194", ".Y c #94aa94", ".h c #9c999c", ".Q c #9ca19c", "#u c #9ca59c", ".H c #9caa9c", "#e c #9cb29c", "#m c #a4b29c", "#t c #a4b2a4", ".M c #a4b69c", "#l c #a4b6a4", ".z c #a4baa4", ".f c #aca5ac", ".q c #acaaac", "#d c #acbeac", ".6 c #acc2ac", ".o c #b4b2b4", ".t c #b4beb4", "#k c #b4c2ac", ".5 c #b4cab4", ".D c #bdb6bd", ".G c #bdc6b4", "#c c #bdceb4", ".X c #bdd2bd", ".4 c #bdd6bd", ".1 c #c5bec5", ".e c #c5c2c5", ".u c #c5cac5", "#b c #c5d6c5", ".J c #c5dec5", ".p c #cdcacd", ".W c #cddecd", ".L c #cde2cd", ".K c #d5eacd", ".V c #d5ead5", ".y c #d5eed5", "QtQtQtQtQtQtQtQtQtQtQtQtQtQt", "QtQtQt.#.a.b.cQtQtQtQtQtQtQt", "QtQt.d.e.f.g.h.i.c.j.dQt.kQt", ".a.l.m.n.o.p.q.r.s.t.u.v.wQt", ".x.y.z.A.B.C.D.p.q.E.F.G.H.I", ".I.J.K.L.M.N.O.P.o.p.Q.R.S.T", "Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3", "Qt.3.X.W.4.X.5.6.7.8.9.s#.##", "QtQt#a.X#b#c.5.6#d#e#f#g#h#i", "QtQtQt#j.7#k.6#d#l#m#n#o#p#q", "QtQtQtQt.k#r#s#m#t.H#u#v#w#x", "QtQtQtQtQtQt.k#y#z.v#A#B#C#x", "QtQtQtQtQtQtQtQt.k#D.w#s#E.k", "QtQtQtQtQtQtQtQtQtQtQt#x#FQt"}; // exit ZSafe and clear the clipboard for security reasons void ZSafe::exitZs (int ec) { QClipboard *cb = QApplication::clipboard(); cb->clear(); exit (ec); } // save the configuration into the file void ZSafe::saveConf () { if (conf) { delete conf; #ifdef DESKTOP #ifndef WIN32 conf = new QSettings (); conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); #else conf = new QSettings (cfgFile); conf->insertSearchPath (QSettings::Unix, cfgFile); #endif #else conf = new Config (cfgFile, Config::File); conf->setGroup ("zsafe"); #endif } } /* * Constructs a ZSafe which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ), Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l) { IsCut = false; IsCopy = false; modified = false; // set the config file cfgFile=QDir::homeDirPath(); cfgFile += "/.zsafe.cfg"; // set the icon path #ifdef NO_OPIE QString qpedir ((const char *)getenv("QPEDIR")); #else QString qpedir ((const char *)getenv("OPIEDIR")); #endif #ifdef DESKTOP iconPath = QDir::homeDirPath() + "/pics/"; #else if (qpedir.isEmpty()) iconPath = "/home/QtPalmtop/pics/"; else iconPath = qpedir + "/pics/"; #endif // create a zsafe configuration object #ifdef DESKTOP #ifndef WIN32 conf = new QSettings (); conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); #else conf = new QSettings (cfgFile); conf->insertSearchPath (QSettings::Unix, cfgFile); #endif #else conf = new Config (cfgFile, Config::File); conf->setGroup ("zsafePrefs"); #endif #ifdef DESKTOP // #ifndef WIN32 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false); // #endif #else expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); #endif #ifndef DESKTOP conf->setGroup ("zsafe"); #endif QPixmap copy_img((const char**) copy_xpm); QPixmap cut_img((const char**) cut_xpm); QPixmap edit_img((const char**) edit_xpm); QPixmap editdelete_img((const char**) editdelete_xpm); QPixmap find_img((const char**) find_xpm); QPixmap folder_open_img((const char**) folder_open_xpm); QPixmap help_icon_img((const char**) help_icon_xpm); QPixmap new_img((const char**) new_xpm); QPixmap paste_img((const char**) paste_xpm); QPixmap quit_icon_img((const char**) quit_icon_xpm); QPixmap save_img((const char**) save_xpm); QPixmap trash_img((const char**) trash_xpm); QPixmap expand_img((const char**) expand_xpm); QPixmap export_img((const char**) export_xpm); QPixmap import_img((const char**) import_xpm); QPixmap bank_cards( ( const char** ) bank_cards_data ); QPixmap passwords( ( const char** ) passwords_data ); QPixmap software( ( const char** ) software_data ); QPixmap general( ( const char** ) general_data ); if ( !name ) setName( "ZSafe" ); #ifdef DESKTOP #ifdef WIN32 setGeometry(100, 150, DeskW, DeskH-30 ); #else resize( DeskW, DeskH-30 ); #endif #else #ifdef JPATCH_HDE int DeskS; if(DeskW > DeskH) { DeskS = DeskW; } else { DeskS = DeskH; } resize( DeskW, DeskH ); setMinimumSize( QSize( DeskS, DeskS ) ); setMaximumSize( QSize( DeskS, DeskS ) ); #else resize( DeskW, DeskH-30 ); #endif #endif setCaption( tr( "ZSafe" ) ); QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe"; QString filename = conf->readEntry(APP_KEY+"document"); if (filename.isEmpty() || filename.isNull()) { if ( !QDir( zsafeAppDirPath ).exists() ) { //FIXME: Pending someone to look into why QDir.mkdir does not work as expected QString cmdline = QString().sprintf( "mkdir -p %s", (const char*) zsafeAppDirPath ); ::system( cmdline ); } if ( !QDir( zsafeAppDirPath ).exists() ) { QMessageBox::critical( 0, "ZSafe", tr("Can't create application data directory.\nZSafe will now exit.")); exitZs (1); } } // set the default filename filename = zsafeAppDirPath + "/passwords.zsf"; // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); //if (filename == "INVALIDPWD") //filename = ""; QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); #ifdef WIN32 this->setCaption("Qt ZSafe: " + ti); #else this->setCaption("ZSafe: " + ti); #endif selectedItem = NULL; lastSearchedCategory = NULL; lastSearchedItem = NULL; lastSearchedName = ""; lastSearchedUsername = ""; lastSearchedComment = ""; infoForm = new InfoForm(); categoryDialog = NULL; // add a menu bar QMenuBar *menu = new QMenuBar( this ); // add file menu // QPopupMenu *file = new QPopupMenu( this ); file = new QPopupMenu( this ); // #ifdef DESKTOP file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) ); file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) ); file->insertSeparator(); // #endif file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) ); file->insertItem( save_img, tr("S&ave document with new Password"), this, SLOT(saveDocumentWithPwd()) ); file->insertSeparator(); file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) ); file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) ); file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) ); file->insertSeparator(); file->insertItem( expand_img, tr("&Open entries expanded"), this, SLOT(setExpandFlag()), 0, 'o'); file->setItemChecked('o', expandTree); file->insertSeparator(); file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) ); menu->insertItem( tr("&File"), file ); QPopupMenu *cat = new QPopupMenu( this ); cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) ); cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) ); cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) ); menu->insertItem( tr("&Category"), cat ); QPopupMenu *it = new QPopupMenu( this ); it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) ); it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) ); it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) ); it->insertSeparator(); it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) ); it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) ); it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) ); it->insertItem( find_img, tr("&Search"), this, SLOT(findPwd()) ); menu->insertItem( tr("&Entry"), it ); QPopupMenu *help = new QPopupMenu( this ); help->insertItem( help_icon_img, tr("&About"), this, SLOT(about()) ); menu->insertItem( tr("&Help"), help ); // toolbar icons New = new QToolButton( menu, "New" ); New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) ); New->setMouseTracking( TRUE ); - New->setText( tr( "" ) ); + New->setText( "" ); New->setPixmap( new_img ); QToolTip::add( New, tr( "New entry" ) ); Edit = new QToolButton( menu, "Edit" ); Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) ); - Edit->setText( tr( "" ) ); + Edit->setText( "" ); Edit->setPixmap( edit_img ); QToolTip::add( Edit, tr( "Edit category or entry" ) ); Delete = new QToolButton( menu, "Delete" ); Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); - Delete->setText( tr( "" ) ); + Delete->setText( "" ); Delete->setPixmap( trash_img ); QToolTip::add( Delete, tr( "Delete category or entry" ) ); Find = new QToolButton( menu, "Find" ); Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) ); - Find->setText( tr( "" ) ); + Find->setText( "" ); Find->setPixmap( find_img ); QToolTip::add( Find, tr( "Find entry" ) ); /* QBoxLayout * h = new QHBoxLayout( this ); 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*) ) ); } 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(); } } void ZSafe::editPwd() { if (!selectedItem) return; if (!isCategory(selectedItem)) { // open the 'New Entry' dialog NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE); #ifdef WIN32 dialog->setCaption ("Qt " + tr("Edit Entry")); dialog->setGeometry(200, 250, 220, 310 ); #endif // set the labels dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); // set the fields dialog->NameField->setText(selectedItem->text (0)); dialog->UsernameField->setText(selectedItem->text (1)); dialog->PasswordField->setText(selectedItem->text (2)); QString comment = selectedItem->text (3); comment.replace (QRegExp("<br>"), "\n"); dialog->Field5->setText(selectedItem->text (4)); dialog->Field6->setText(selectedItem->text (5)); dialog->CommentField->insertLine(comment); dialog->CommentField->setCursorPosition(0,0); DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); #ifdef DESKTOP result = Accepted; #endif if (result == Accepted) { modified = true; // edit the selected item QString name = dialog->NameField->text(); selectedItem->setText (0, tr (name)); QString user = dialog->UsernameField->text(); selectedItem->setText (1, tr (user)); QString pwd = dialog->PasswordField->text(); selectedItem->setText (2, tr (pwd)); QString comment = dialog->CommentField->text(); comment.replace (QRegExp("\n"), "<br>"); selectedItem->setText (3, tr (comment)); QString f5 = dialog->Field5->text(); selectedItem->setText (4, tr (f5)); QString f6 = dialog->Field6->text(); selectedItem->setText (5, tr (f6)); } delete dialog; } else { editCategory(); } } void ZSafe::newPwd() { if (!selectedItem) return; if (!isCategory(selectedItem)) selectedItem = selectedItem->parent(); if (isCategory(selectedItem)) { QString cat = selectedItem->text(0); // open the 'New Entry' dialog NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE); #ifdef WIN32 dialog->setCaption ("Qt " + tr("New Entry")); dialog->setGeometry(200, 250, 220, 310 ); #endif // set the labels dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); retype: DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); #ifdef DESKTOP result = Accepted; #endif if (result == Accepted) { QString name = dialog->NameField->text(); if (cat == name) { QMessageBox::critical( 0, tr("ZSafe"), tr("Entry name must be different\nfrom the category name.") ); goto retype; // it's not a good programming style :-) } modified = true; // add the new item QListViewItem *i = new ShadedListItem (0, selectedItem); i->setOpen (TRUE); i->setText (0, tr (name)); QString user = dialog->UsernameField->text(); i->setText (1, tr (user)); QString pwd = dialog->PasswordField->text(); i->setText (2, tr (pwd)); QString comment = dialog->CommentField->text(); comment.replace (QRegExp("\n"), "<br>"); i->setText (3, tr (comment)); QString f5 = dialog->Field5->text(); i->setText (4, tr (f5)); QString f6 = dialog->Field6->text(); i->setText (5, tr (f6)); } delete dialog; } } void ZSafe::findPwd() { // open the 'Search' dialog SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); #ifdef WIN32 dialog->setCaption ("Qt " + tr("Search")); #endif #ifdef DESKTOP #endif if (lastSearchedName) dialog->NameField->setText(lastSearchedName); else dialog->NameField->setText(""); if (lastSearchedUsername) dialog->UsernameField->setText(lastSearchedUsername); else dialog->UsernameField->setText(""); if (lastSearchedComment) dialog->CommentField->setText(lastSearchedComment); else dialog->CommentField->setText(""); DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP result = Accepted; #endif QString name; QString username; QString comment; if (result == Accepted) { name = dialog->NameField->text(); username = dialog->UsernameField->text(); comment = dialog->CommentField->text(); owarn << name << oendl; } else { delete dialog; return; } if (!name.isEmpty() && name != lastSearchedName || lastSearchedName.isEmpty() && !name.isEmpty()) { // set search at the beginning if a new name is given lastSearchedCategory = NULL; lastSearchedItem = NULL; } lastSearchedName = name; if (!username.isEmpty() && username != lastSearchedUsername || lastSearchedUsername.isEmpty() && !username.isEmpty()) { // set search at the beginning if a new name is given lastSearchedCategory = NULL; lastSearchedItem = NULL; } lastSearchedUsername = username; if (!comment.isEmpty() && comment != lastSearchedComment || lastSearchedComment.isEmpty() && !comment.isEmpty()) { // set search at the beginning if a new name is given lastSearchedCategory = NULL; lastSearchedItem = NULL; } lastSearchedComment = comment; ListView->clearSelection(); bool found=FALSE; // step through all categories QListViewItem *i; if (lastSearchedCategory) i = lastSearchedCategory; else i = ListView->firstChild(); for (; i != NULL; i = i->nextSibling()) { owarn << i->text(0) << oendl; i->setSelected(FALSE); // step through all subitems QListViewItem *si; if (lastSearchedItem) si = lastSearchedItem; else si = i->firstChild(); // for (si = i->firstChild(); for (; si != NULL; si = si->nextSibling()) { owarn << si->text(0) << oendl; if (si->isSelected()) si->setSelected(FALSE); // ListView->repaintItem(si); bool n=TRUE; bool u=TRUE; bool c=TRUE; if (!name.isEmpty()) n = (si->text(0)).contains (name, FALSE); if (!username.isEmpty()) u = (si->text(1)).contains (username, FALSE); if (!comment.isEmpty()) c = (si->text(3)).contains (comment, FALSE); if ((n && u && c ) && !found) { owarn << "Found" << oendl; selectedItem = si; si->setSelected(TRUE); ListView->setCurrentItem(si); ListView->ensureItemVisible(si); ListView->triggerUpdate(); lastSearchedCategory = i; // set to the next item lastSearchedItem = si->nextSibling(); if (!lastSearchedItem) { // no next item within category -> set next category lastSearchedCategory = i->nextSibling(); if (!lastSearchedCategory) lastSearchedItem = NULL; // END } found = TRUE; delete dialog; update(); return; } } lastSearchedCategory = i->nextSibling(); lastSearchedItem = NULL; } lastSearchedCategory = NULL; lastSearchedItem = NULL; delete dialog; update(); QMessageBox::information( this, tr("ZSafe"), diff --git a/noncore/multimedia/powerchord/powerchordbase.cpp b/noncore/multimedia/powerchord/powerchordbase.cpp index 98fe3f7..f0d1487 100644 --- a/noncore/multimedia/powerchord/powerchordbase.cpp +++ b/noncore/multimedia/powerchord/powerchordbase.cpp @@ -1,593 +1,593 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'powerchordbase.ui' ** ** Created: Sun Jan 13 23:05:11 2002 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include "powerchordbase.h" #include "fretboard.h" #include "vumeter.h" /* OPIE */ #include <opie2/odebug.h> #include <qpe/resource.h> using namespace Opie::Core; /* QT */ #include <qcombobox.h> #include <qlabel.h> #include <qlistbox.h> #include <qpushbutton.h> #include <qspinbox.h> #include <qtabwidget.h> #include <qlayout.h> #include <qtooltip.h> /* * Constructs a PowerchordBase which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ PowerchordBase::PowerchordBase( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { simulation_timer = 0; audio_timer = 0; // setPalette( QPalette( QColor( 232, 227, 215) ) ); // QPixmap image0(QString("/opt/Qtopia/pics/powerchord/image0")); QPixmap image1 = Resource::loadPixmap( "powerchord/image1"); QPixmap image2 = Resource::loadPixmap( "powerchord/image2"); QPixmap image3 = Resource::loadPixmap( "powerchord/image3"); QPixmap image4 = Resource::loadPixmap( "powerchord/image4"); QPixmap image5 = Resource::loadPixmap( "powerchord/image5"); image6 = Resource::loadPixmap( "powerchord/image6"); image_open = Resource::loadPixmap( "powerchord/image_open"); // image0.setMask(image0.createHeuristicMask()); image1.setMask(image1.createHeuristicMask()); // image2.setMask(image2.createHeuristicMask()); // image3.setMask(image3.createHeuristicMask()); // image4.setMask(image4.createHeuristicMask()); // image5.setMask(image5.createHeuristicMask()); // image6->setMask(image6->createHeuristicMask()); // image_open->setMask(image_open->createHeuristicMask()); if ( !name ) setName( "PowerchordBase" ); resize( 240, 284 ); setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, sizePolicy().hasHeightForWidth() ) ); setMinimumSize( QSize( 240, 284 ) ); setMaximumSize( QSize( 240, 284 ) ); setCaption( tr( "Powerchord" ) ); tabs = new QTabWidget( this, "tabs" ); tabs->setEnabled( TRUE ); tabs->setGeometry( QRect( 0, 0, 240, 286 ) ); tabs->setTabPosition( QTabWidget::Bottom ); tab = new QWidget( tabs, "tab" ); chordkey = new QComboBox( FALSE, tab, "chordkey" ); chordkey->insertItem( tr( "maj" ) ); chordkey->insertItem( tr( "min" ) ); chordkey->insertItem( tr( "7th" ) ); chordkey->insertItem( tr( "m7" ) ); chordkey->insertItem( tr( "maj7" ) ); chordkey->insertItem( tr( "6th" ) ); chordkey->insertItem( tr( "m6th" ) ); chordkey->insertItem( tr( "aug" ) ); chordkey->insertItem( tr( "dim" ) ); chordkey->insertItem( tr( "sus4" ) ); chordkey->insertItem( tr( "7sus4" ) ); chordkey->insertItem( tr( "9th" ) ); chordkey->insertItem( tr( "add9" ) ); chordkey->insertItem( tr( "m9th" ) ); chordkey->insertItem( tr( "maj9" ) ); chordkey->insertItem( tr( "sus2" ) ); chordkey->insertItem( tr( "7sus2" ) ); chordkey->insertItem( tr( "11th" ) ); chordkey->insertItem( tr( "m11th" ) ); chordkey->insertItem( tr( "13th" ) ); chordkey->insertItem( tr( "m13th" ) ); chordkey->insertItem( tr( "maj13" ) ); chordkey->insertItem( tr( "6/9" ) ); chordkey->insertItem( tr( "flat5" ) ); chordkey->insertItem( tr( "7#9" ) ); chordkey->insertItem( tr( QString::fromUtf8( "ø7" ) ) ); chordkey->insertItem( tr( "5" ) ); chordkey->setGeometry( QRect( 40, 0, 51, 21 ) ); chordfret = new QComboBox( FALSE, tab, "chordfret" ); chordfret->insertItem( tr( "open" ) ); chordfret->insertItem( tr( "1st" ) ); chordfret->insertItem( tr( "2nd" ) ); chordfret->insertItem( tr( "3rd" ) ); chordfret->insertItem( tr( "4th" ) ); chordfret->insertItem( tr( "5th" ) ); chordfret->insertItem( tr( "6th" ) ); chordfret->insertItem( tr( "7th" ) ); chordfret->insertItem( tr( "8th" ) ); chordfret->insertItem( tr( "9th" ) ); chordfret->insertItem( tr( "10th" ) ); chordfret->insertItem( tr( "11th" ) ); chordfret->insertItem( tr( "12th" ) ); chordfret->insertItem( tr( "13th" ) ); chordfret->insertItem( tr( "14th" ) ); chordfret->insertItem( tr( "15th" ) ); chordfret->insertItem( tr( "16th" ) ); chordfret->setGeometry( QRect( 90, 0, 55, 21 ) ); //cxm less 5 width chordnote = new QComboBox( FALSE, tab, "chordnote" ); chordnote->insertItem( tr( "C" ) ); chordnote->insertItem( tr( "C#" ) ); chordnote->insertItem( tr( "D" ) ); chordnote->insertItem( tr( "Eb" ) ); chordnote->insertItem( tr( "E" ) ); chordnote->insertItem( tr( "F" ) ); chordnote->insertItem( tr( "F#" ) ); chordnote->insertItem( tr( "G" ) ); chordnote->insertItem( tr( "G#" ) ); chordnote->insertItem( tr( "A" ) ); chordnote->insertItem( tr( "Bb" ) ); chordnote->insertItem( tr( "B" ) ); chordnote->setGeometry( QRect( 0, 0, 40, 21 ) ); chordnote->setCurrentItem( 9 ); QWidget* privateLayoutWidget = new QWidget( tab, "Layout1" ); privateLayoutWidget->setGeometry( QRect( 5, 232, 160, 20 ) ); Layout1 = new QHBoxLayout( privateLayoutWidget ); Layout1->setSpacing( 6 ); Layout1->setMargin( 0 ); s1_1 = new QLabel( privateLayoutWidget, "s1_1" ); s1_1->setText( tr( "E" ) ); s1_1->setAlignment( int( QLabel::AlignCenter ) ); Layout1->addWidget( s1_1 ); s1_2 = new QLabel( privateLayoutWidget, "s1_2" ); s1_2->setText( tr( "A" ) ); s1_2->setAlignment( int( QLabel::AlignCenter ) ); Layout1->addWidget( s1_2 ); s1_3 = new QLabel( privateLayoutWidget, "s1_3" ); s1_3->setText( tr( "E" ) ); s1_3->setAlignment( int( QLabel::AlignCenter ) ); Layout1->addWidget( s1_3 ); s1_4 = new QLabel( privateLayoutWidget, "s1_4" ); s1_4->setText( tr( "A" ) ); s1_4->setAlignment( int( QLabel::AlignCenter ) ); Layout1->addWidget( s1_4 ); s1_5 = new QLabel( privateLayoutWidget, "s1_5" ); s1_5->setText( tr( "C#" ) ); s1_5->setAlignment( int( QLabel::AlignCenter ) ); Layout1->addWidget( s1_5 ); s1_6 = new QLabel( privateLayoutWidget, "s1_6" ); s1_6->setText( tr( "E" ) ); s1_6->setAlignment( int( QLabel::AlignCenter ) ); Layout1->addWidget( s1_6 ); // sound_label = new QLabel( tab, "sound_label" ); // sound_label->setGeometry( QRect( 185, 160, 32, 17 ) ); // sound_label->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sound_label->sizePolicy().hasHeightForWidth() ) ); // sound_label->setPixmap( image0 ); // sound_label->pixmap()->setMask(*image0.mask()); // sound_label->setScaledContents( TRUE ); // sound_label->setBackgroundMode( QWidget::PaletteButton ); // sound_label->setBackgroundColor(this->backgroundColor()); // sound_label->setPalette( QPalette( QColor( 232, 227, 215) ) ); Frame6 = new QFrame( tab, "Frame6" ); Frame6->setGeometry( QRect( 170, 145, 66, 10 ) ); Frame6->setFrameShape( QFrame::HLine ); Frame6->setFrameShadow( QFrame::Raised ); chordshow_label = new QLabel( tab, "chordshow_label" ); chordshow_label->setGeometry( QRect( 185, 60, 32, 17 ) ); // chordshow_label->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, chordshow_label->sizePolicy().hasHeightForWidth() ) ); chordshow_label->setFrameShape( QLabel::NoFrame ); chordshow_label->setPixmap( image1 ); chordshow_label->setScaledContents( TRUE ); // chordshow_label->setBackgroundMode( QWidget::PaletteButton ); transport_rec = new QPushButton( tab, "transport_rec" ); transport_rec->setGeometry( QRect( 170, 80, 30, 30 ) ); - transport_rec->setText( tr( "" ) ); + transport_rec->setText( "" ); transport_rec->setPixmap( image2 ); play_sound = new QPushButton( tab, "play_sound" ); play_sound->setGeometry( QRect( 170, 180, 60, 55 ) ); - play_sound->setText( tr( "" ) ); + play_sound->setText( "" ); play_sound->setPixmap( image3 ); Frame6_2 = new QFrame( tab, "Frame6_2" ); Frame6_2->setGeometry( QRect( 170, 45, 66, 10 ) ); Frame6_2->setFrameShape( QFrame::HLine ); Frame6_2->setFrameShadow( QFrame::Raised ); transport_play = new QPushButton( tab, "transport_play" ); transport_play->setEnabled( FALSE ); transport_play->setGeometry( QRect( 200, 80, 30, 30 ) ); - transport_play->setText( tr( "" ) ); + transport_play->setText( "" ); transport_play->setPixmap( image3 ); transport_rew = new QPushButton( tab, "transport_rew" ); transport_rew->setEnabled( FALSE ); transport_rew->setGeometry( QRect( 170, 110, 30, 30 ) ); - transport_rew->setText( tr( "" ) ); + transport_rew->setText( "" ); transport_rew->setPixmap( image4 ); transport_fwd = new QPushButton( tab, "transport_fwd" ); transport_fwd->setEnabled( FALSE ); transport_fwd->setGeometry( QRect( 200, 110, 30, 30 ) ); - transport_fwd->setText( tr( "" ) ); + transport_fwd->setText( "" ); transport_fwd->setPixmap( image5 ); chordname = new QLabel( tab, "chordname" ); chordname->setGeometry( QRect( 146, 0, 90, 20 ) ); //cxm moved l 5 chordname->setText( tr( "A" ) ); chordname->setAlignment( int( QLabel::AlignCenter ) ); - QToolTip::add( chordname, tr( "" ) ); + QToolTip::add( chordname, "" ); synth = new gs(); tuner = new gt(); frets = new FretBoard( tab, "frets" ); frets->setGeometry( QRect( 0, 20, 168, 210 ) ); tabs->insertTab( tab, tr( "Guitar" ) ); tab_2 = new QWidget( tabs, "tab_2" ); optlab2 = new QLabel( tab_2, "optlab2" ); optlab2->setGeometry( QRect( 9, 58, 120, 41 ) ); optlab2->setText( tr( "Alternative tunings are possible" ) ); optlab2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); span = new QComboBox( FALSE, tab_2, "span" ); span->insertItem( tr( "2" ) ); span->insertItem( tr( "3" ) ); span->insertItem( tr( "4" ) ); span->insertItem( tr( "5" ) ); span->insertItem( tr( "6" ) ); span->setGeometry( QRect( 180, 20, 50, 21 ) ); span->setCurrentItem( 1 ); TextLabel1 = new QLabel( tab_2, "TextLabel1" ); TextLabel1->setGeometry( QRect( 3, 109, 226, 140 ) ); TextLabel1->setText( tr( QString::fromUtf8( "©2002 Camilo Mesias\n" "camilo@mesias.co.uk\n" "Version 0.0.7 beta" ) ) ); TextLabel1->setAlignment( int( QLabel::AlignBottom | QLabel::AlignLeft ) ); tuning = new QComboBox( FALSE, tab_2, "tuning" ); tuning->insertItem( tr( "EADGBE" ) ); tuning->insertItem( tr( "EBEG#BE" ) ); tuning->insertItem( tr( "EAEAC#E" ) ); tuning->insertItem( tr( "EADF#BE" ) ); tuning->insertItem( tr( "EADGCF" ) ); tuning->insertItem( tr( "DADGAD" ) ); tuning->insertItem( tr( "DGCGCD" ) ); tuning->insertItem( tr( "DADF#AD" ) ); tuning->insertItem( tr( "DADGBE" ) ); tuning->insertItem( tr( "DGDGBD" ) ); tuning->insertItem( tr( "DADACD" ) ); tuning->insertItem( tr( "CGCGAE" ) ); tuning->insertItem( tr( "FADGBE" ) ); tuning->insertItem( tr( "G minor" ) ); tuning->setGeometry( QRect( 140, 70, 91, 21 ) ); optlab1 = new QLabel( tab_2, "optlab1" ); optlab1->setGeometry( QRect( 8, 8, 160, 40 ) ); optlab1->setText( tr( "Span: the greatest number of frets over which you want chords to be generated" ) ); optlab1->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); tabs->insertTab( tab_2, tr( "Options" ) ); Tuner = new QWidget( tabs, "Tuner" ); Frame4 = new QFrame( Tuner, "Frame4" ); Frame4->setGeometry( QRect( 0, 0, 230, 126 ) ); Frame4->setFrameShape( QFrame::Box ); Frame4->setFrameShadow( QFrame::Raised ); vu = new VUMeter( Frame4, "vu" ); vu->setGeometry( QRect( 5, 5, 220, 115 ) ); tuner_note = new QComboBox( FALSE, Tuner, "tuner_note" ); tuner_note->insertItem( tr( "auto" ) ); tuner_note->insertItem( tr( "E" ) ); tuner_note->insertItem( tr( "D" ) ); tuner_note->insertItem( tr( "G" ) ); tuner_note->insertItem( tr( "A" ) ); tuner_note->insertItem( tr( "B" ) ); tuner_note->insertItem( tr( "C" ) ); tuner_note->insertItem( tr( "F" ) ); tuner_note->setGeometry( QRect( 5, 160, 90, 20 ) ); Frame8 = new QFrame( Tuner, "Frame8" ); Frame8->setGeometry( QRect( -2, 188, 231, 10 ) ); Frame8->setFrameShape( QFrame::HLine ); Frame8->setFrameShadow( QFrame::Raised ); tuner_start = new QPushButton( Tuner, "tuner_start" ); tuner_start->setGeometry( QRect( 100, 155, 91, 30 ) ); tuner_start->setText( tr( "Start" ) ); tuner_lab1 = new QLabel( Tuner, "tuner_lab1" ); tuner_lab1->setGeometry( QRect( 10, 130, 100, 21 ) ); tuner_lab1->setText( tr( "Tuner operation" ) ); tuner_lab2 = new QLabel( Tuner, "tuner_lab2" ); tuner_lab2->setGeometry( QRect( 10, 200, 100, 16 ) ); tuner_lab2->setText( tr( "Pitch calibration" ) ); tuner_calib_note = new QComboBox( FALSE, Tuner, "tuner_calib_note" ); tuner_calib_note->insertItem( tr( "A" ) ); tuner_calib_note->insertItem( tr( "C" ) ); tuner_calib_note->setGeometry( QRect( 5, 225, 90, 21 ) ); tuner_calib_freq = new QSpinBox( Tuner, "tuner_calib_freq" ); tuner_calib_freq->setGeometry( QRect( 105, 225, 71, 21 ) ); tuner_calib_freq->setSuffix( tr( "Hz" ) ); 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&) ) ); } static int known=0; #include <qmessagebox.h> void PowerchordBase::transport_rec_cb(){ chordlist->insertItem(chordname->text(),-1); if (!known){ QMessageBox::information(this, tr("Powerchord"), tr("<P>This chord has been saved into the list of chords, for later playback.<P>")); 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); } // init synth if (synth->Play()){ // error QMessageBox::information(this, tr("Powerchord"), tr("<P>Unable to open device for sound playback - check that no other application is using it.</P>")); return; } synth->fill_buffer(); // start timer audio_timer = new QTimer(); connect(audio_timer, SIGNAL( timeout() ), this, SLOT( audio_cb() )); // set pixmap on player? audio_timer->start(19); // 19 msec (fudge factor!!) } } void PowerchordBase::audio_cb(){ // play the next bit of audio until quiet // strum timing #define INTERVAL 2 if ((synth->Frames() % INTERVAL) == 0){ int string = synth->Frames() / INTERVAL; if (string <= 5){ int note; int base; int octave; note = frets->ce.noteindex(string); // check not muted... if (note > 0){ base = note % 12; octave = note / 12; synth->note_start(string, base, octave); } } } if (synth->Playing()){ synth->write_buffer(); synth->fill_buffer(); }else{ audio_timer->stop(); // set pixmap? synth->Stop(); delete(audio_timer); audio_timer = 0; } } // the real tuner // void PowerchordBase::tuner_start_cb(){ // if (tuner->Listening()){ // simulation_timer->stop(); // tuner->Stop(); // tuner_pic1->setPixmap( *image6 ); // }else{ // tuner_pic1->setPixmap( *image_open ); // if (!simulation_timer){ // simulation_timer = new QTimer(); // connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_cb() )); // } // simulation_timer->start(50); // tuner->Listen(); // } // } void PowerchordBase::tuner_cb(){ if (tuner->Listening()){ tuner->read_buffer(); tuner->process_buffer(); // update gui // do something with the note: tuner->Note() emit frequency_change(tuner->Tuning()); }else{ simulation_timer->stop(); tuner->Stop(); tuner_pic1->setPixmap( image6 ); } } void PowerchordBase::tuner_start_cb(){ if (0 == QMessageBox::information(this, tr("Powerchord"), tr("<P>Using the microphone, the note's frequency is analysed. This is a simulation.</P>"), tr("OK"), tr("Cancel"), 0, 1)){ if (simulation_timer){ simulation_timer->stop(); }else{ simulation_timer = new QTimer(); connect(simulation_timer, SIGNAL( timeout() ), this, SLOT( tuner_simulation_cb() )); } simulation_x = -45; simulation_v = 0; simulation_iter = 0; tuner_pic1->setPixmap( image_open ); simulation_timer->start(100); } } #include <stdio.h> void PowerchordBase::tuner_simulation_cb(){ if (simulation_x < -10 || simulation_x > 10){ simulation_v = (simulation_v/2)-(simulation_x/5); } simulation_x += simulation_v; simulation_iter++; if (simulation_x > 50){ simulation_x = 50; } if (simulation_x < -50){ simulation_x = -50; } if (simulation_iter > 50){ simulation_timer->stop(); emit frequency_change(0); tuner_pic1->setPixmap( image6 ); }else{ emit frequency_change(simulation_x); } } /* * Destroys the object and frees any allocated resources */ PowerchordBase::~PowerchordBase() { // no need to delete child widgets, Qt does it all for us } void PowerchordBase::change_handler() { owarn << "PowerchordBase::change_handler(): Not implemented yet!" << oendl; } diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 979b73a..6252fc2 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -1,218 +1,218 @@ #include <qlabel.h> #include <qvbox.h> #include <qheader.h> #include <qtimer.h> #include <qlayout.h> #include <opie2/odebug.h> #include <qpe/qpeapplication.h> #include "defines.h" #include "mainwindow.h" using namespace Opie::Core; 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) ) ); /* 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( "" ); 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(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 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&) ) ); #endif QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); } MainWindow::~MainWindow() { } void MainWindow::appMessage(const QCString &, const QByteArray &) { odebug << "appMessage not reached" << oendl; } void MainWindow::slotAdjustLayout() { QWidget *d = QApplication::desktop(); if ( d->width() < d->height() ) { layout->setDirection( QBoxLayout::TopToBottom ); } else { layout->setDirection( QBoxLayout::LeftToRight ); } } 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 ) { odebug << "slotShowFolders not reached" << oendl; } void MainWindow::refreshMailView(const QValueList<RecMailP>&) { odebug << "refreshMailView not reached" << oendl; } void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) { odebug << "mailLeftClicked not reached" << oendl; } void MainWindow::displayMail() { odebug << "displayMail not reached" << oendl; } void MainWindow::slotDeleteMail() { odebug << "deleteMail not reached" << oendl; } void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) { odebug << "mailHold not reached" << oendl; } void MainWindow::slotSendQueued() { } void MainWindow::slotEditAccounts() { } void MainWindow::slotComposeMail() { } diff --git a/noncore/settings/mediummount/mediumglobal.cc b/noncore/settings/mediummount/mediumglobal.cc index 0c6cf12..621784e 100644 --- a/noncore/settings/mediummount/mediumglobal.cc +++ b/noncore/settings/mediummount/mediumglobal.cc @@ -1,190 +1,190 @@ #include "mediumglobal.h" /* OPIE */ #include <opie2/odebug.h> using namespace Opie::Core; #include <qpe/config.h> /* QT */ #include <qlineedit.h> #include <qcheckbox.h> #include <qlabel.h> #include <qabstractlayout.h> // spacer item #include <qlayout.h> #include <qframe.h> #include <qgroupbox.h> #include <qwhatsthis.h> using namespace MediumMountSetting; /* TRANSLATOR MediumMountSetting::MediumGlobalWidget */ MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name ) : QWidget( wid, name, WStyle_ContextHelp ) { m_config = 0; initGUI(); readConfig(); } void MediumGlobalWidget::initGUI() { m_layout = new QVBoxLayout(this ); m_layout->setMargin( 4 ); // m_layout->setSpacing( 10 ); m_label = new QLabel( this ); m_label->setTextFormat( Qt::RichText ); - m_label->setText( tr("") ); + m_label->setText( "" ); QWhatsThis::add( this, tr("If a medium gets inserted into this device Opie " "tries to search the medium for Documents. On " "large mediums this can take some time. You can choose " "if Opie should scan for Documents globally or on a " "per medium level. You're also able to reconfigure " "each medium.") ); m_layout->addWidget( m_label ); m_check = new QCheckBox( tr("Enable medium checking" ), this ); connect( m_check, SIGNAL(stateChanged(int) ), this, SLOT(slotEnableChecking() ) ); m_layout->addWidget(m_check ); m_frame = new QFrame(this, "Frame" ); m_frame->setFrameShape( QFrame::Box ); m_frame->setFrameShadow( QFrame::Sunken ); m_box = new QVBoxLayout( m_frame ); m_box->setMargin( 5 ); m_useglobal = new QCheckBox( tr("Use global settings"), m_frame ); connect( m_useglobal, SIGNAL( stateChanged(int) ), this, SLOT( slotGlobalChanged() ) ); m_box->addWidget( m_useglobal ); m_global = new QGroupBox( tr("Which media files"), m_frame ); m_frameLay = new QGridLayout(m_global, 4, 3 ); m_frameLay->setMargin( 10 ); QSpacerItem *item2 = new QSpacerItem( 5, 8, QSizePolicy::Fixed, QSizePolicy::Fixed ); m_audio = new QCheckBox( tr("Audio"), m_global ); m_all = new QCheckBox( tr("All") , m_global ); m_image = new QCheckBox( tr("Image"), m_global ); m_text = new QCheckBox( tr("Text") , m_global ); m_video = new QCheckBox( tr("Video"), m_global ); connect(m_all, SIGNAL(stateChanged(int) ), this, SLOT(slotAllChanged() ) ); m_frameLay->addItem( item2, 0, 0 ); m_frameLay->addWidget( m_audio, 1, 0 ); m_frameLay->addWidget( m_image, 2, 0 ); m_frameLay->addWidget( m_all, 3, 0 ); m_frameLay->addWidget( m_text, 1, 2 ); m_frameLay->addWidget( m_video, 2, 2 ); m_frameLay->addRowSpacing( 0, 8 ); m_frameLay->addColSpacing( 1, 2 ); m_box->addWidget( m_global ); m_layout->addWidget( m_frame ); QSpacerItem *item1 = new QSpacerItem( 1, 24, QSizePolicy::Fixed, QSizePolicy::Expanding ); m_layout->addItem( item1 ); } void MediumGlobalWidget::readConfig() { if( m_config == 0 ) m_config = new Config("medium" ); m_config->setGroup("main"); m_useglobal->setChecked( m_config->readBoolEntry("global", false ) ); m_check->setChecked( m_config->readBoolEntry("use", true ) ); m_config->setGroup("mimetypes" ); m_all->setChecked ( m_config->readBoolEntry("all", false ) ); m_audio->setChecked( m_config->readBoolEntry("audio", true ) ); m_video->setChecked( m_config->readBoolEntry("video", true ) ); m_text->setChecked ( m_config->readBoolEntry("text", true ) ); m_image->setChecked( m_config->readBoolEntry("image", true ) ); slotAllChanged(); slotEnableChecking(); slotGlobalChanged(); if( m_all->isChecked() ){ m_video->setEnabled( false ); m_text->setEnabled( false ); m_audio->setEnabled( false ); m_image->setEnabled( false ); } } void MediumGlobalWidget::writeConfig() { m_config->setGroup( "main" ); m_config->writeEntry("global", m_useglobal->isChecked() ); m_config->writeEntry("use", m_check->isChecked() ); m_config->setGroup("mimetypes" ); m_config->writeEntry("all", m_all->isChecked() ); m_config->writeEntry("audio", m_audio->isChecked() ); m_config->writeEntry("video", m_video->isChecked() ); m_config->writeEntry("text", m_text->isChecked() ); m_config->writeEntry("image", m_image->isChecked() ); } MediumGlobalWidget::~MediumGlobalWidget() { delete m_config; } void MediumGlobalWidget::slotGlobalChanged() { int mode = GLOBAL_DISABLED; bool enabled = false; if( ( enabled =m_useglobal->isChecked() ) ){ mode = GLOBAL_ENABLED; }else mode = GLOBAL_DISABLED; owarn << "enabled = " << enabled << oendl; m_all->setEnabled ( enabled ); m_audio->setEnabled( enabled ); m_image->setEnabled( enabled ); m_text->setEnabled ( enabled ); m_video->setEnabled ( enabled ); slotAllChanged(); emit globalStateChanged( mode ); } void MediumGlobalWidget::slotEnableChecking() { int mode = ENABLE_CHECKS; bool enabled = false; if( ( enabled = m_check->isChecked() ) ){ mode = ENABLE_CHECKS; }else{ mode = DISABLE_CHECKS; } m_frame->setEnabled( enabled ); slotGlobalChanged(); emit enableStateChanged( mode ); } void MediumGlobalWidget::slotAllChanged() { bool enable = !m_all->isChecked(); m_audio->setEnabled( enable ); m_text->setEnabled( enable ); m_video->setEnabled( enable ); m_image->setEnabled( enable ); } diff --git a/noncore/settings/sound/soundsettingsbase.cpp b/noncore/settings/sound/soundsettingsbase.cpp index f283119..84187d2 100644 --- a/noncore/settings/sound/soundsettingsbase.cpp +++ b/noncore/settings/sound/soundsettingsbase.cpp @@ -1,180 +1,180 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'soundsettingsbase.ui' ** ** Created: Sun May 19 12:11:35 2002 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include "soundsettingsbase.h" #include <qcheckbox.h> #include <qcombobox.h> #include <qlabel.h> #include <qlayout.h> #include <qpixmap.h> static const char* const image0_data[] = { "16 16 3 1", ". c None", "a c #000000", "# c #ff0000", "............#...", "............##..", "..........#..#..", ".....a..#..#.#..", "....aa..##.#..#.", "...aaa...#.##.#.", "aaaaaa.#.#..#.##", "aaaaaa.#.##.#.##", "aaaaaa.#.##.#.##", "aaaaaa.#.##.#.##", "aaaaaa.#.#..#.##", "...aaa...#.##.#.", "....aa..#..#..#.", ".....a.....#.##.", "..........#..#..", "............##.."}; static const char* const image1_data[] = { "16 16 3 1", ". c None", "# c #000000", "a c #ff0000", "................", "................", "................", ".....#..........", "....##..........", "...###...a...a..", "######..aaa.aaa.", "######...aaaaa..", "######....aaa...", "######...aaaaa..", "######..aaa.aaa.", "...###...a...a..", "....##..........", ".....#..........", "................", "................"}; /* * Constructs a SoundSettingsBase which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ SoundSettingsBase::SoundSettingsBase( QWidget* parent, const char* name, bool modal, WFlags fl ) : QMainWindow( parent, name, fl ) { QPixmap image0( ( const char** ) image0_data ); QPixmap image1( ( const char** ) image1_data ); if ( !name ) setName( "SoundSettingsBase" ); // resize(255,301); setCaption( tr( "Vmemo Settings" ) ); SoundSettingsBaseLayout = new QGridLayout( this ); SoundSettingsBaseLayout->setSpacing( 4 ); SoundSettingsBaseLayout->setMargin( 4 ); QHBoxLayout *Layout11; Layout11 = new QHBoxLayout; Layout11->setSpacing( 4 ); Layout11->setMargin( 0 ); stereoCheckBox = new QCheckBox( this, "stereoCheckBox" ); stereoCheckBox->setText( tr( "Stereo" ) ); Layout11->addWidget( stereoCheckBox ); sixteenBitCheckBox = new QCheckBox( this, "sixteenBitCheckBox" ); sixteenBitCheckBox->setText( tr( "16 bit" ) ); Layout11->addWidget( sixteenBitCheckBox ); AlertCheckBox = new QCheckBox( this, "AlertCheckBox" ); AlertCheckBox->setText( tr( "Visual Alerts" ) ); Layout11->addWidget( AlertCheckBox ); SoundSettingsBaseLayout->addLayout( Layout11, 0, 0); sampleRateLabel = new QLabel(this, "sampleRateLabel" ); sampleRateLabel->setText( tr( "Sample Rate:" ) ); SoundSettingsBaseLayout->addMultiCellWidget( sampleRateLabel , 1, 1, 0, 0, 1); sampleRate = new QComboBox( FALSE,this, "sampleRate" ); sampleRate->insertItem( tr( "8000" ) ); sampleRate->insertItem( tr( "11025" ) ); sampleRate->insertItem( tr( "22050" ) ); sampleRate->insertItem( tr( "33075" ) ); sampleRate->insertItem( tr( "44100" ) ); SoundSettingsBaseLayout->addMultiCellWidget( sampleRate, 2, 2, 0, 0, 1 ); TextLabel1 = new QLabel( this, "TextLabel1" ); TextLabel1->setText( tr( "Recording Directory:" ) ); SoundSettingsBaseLayout->addMultiCellWidget( TextLabel1, 3, 3, 0, 0, 1); LocationComboBox = new QComboBox( FALSE, this, "LocationComboBox" ); SoundSettingsBaseLayout->addMultiCellWidget( LocationComboBox, 4, 4, 0, 8, 1); QLabel *TextLabelKey; TextLabelKey = new QLabel( this, "TextLabelKey" ); TextLabelKey->setText( tr( "Recording Key:" ) ); SoundSettingsBaseLayout->addMultiCellWidget(TextLabelKey , 5, 5, 0, 0, 1); keyComboBox = new QComboBox( FALSE, this, "keyComboBox" ); - keyComboBox->insertItem( tr( "" ) ); + keyComboBox->insertItem( "" ); keyComboBox->insertItem( tr( "Taskbar Icon" ) ); keyComboBox->insertItem( tr( "Key_Record" ) ); keyComboBox->insertItem( tr( "Key_Space" ) ); keyComboBox->insertItem( tr( "Key_Home" ) ); keyComboBox->insertItem( tr( "Key_Calender" ) ); keyComboBox->insertItem( tr( "Key_Contacts" ) ); keyComboBox->insertItem( tr( "Key_Menu" ) ); keyComboBox->insertItem( tr( "Key_Mail" ) ); SoundSettingsBaseLayout->addMultiCellWidget( keyComboBox , 6, 6, 0, 0 ,1); keyLabel= new QLabel( this, "keyLabel" ); SoundSettingsBaseLayout->addMultiCellWidget( keyLabel , 6, 6, 0, 2, 3); QLabel *timeLimitLabel; timeLimitLabel= new QLabel( this, "timeLimitLabel" ); timeLimitLabel->setText( tr( "Recording Limit in seconds:" ) ); SoundSettingsBaseLayout->addMultiCellWidget( timeLimitLabel , 7, 7, 0, 0, 1); timeLimitComboBox = new QComboBox( FALSE, this, "timeLimitComboBox" ); timeLimitComboBox->insertItem( tr( "30" ) ); timeLimitComboBox->insertItem( tr( "20" ) ); timeLimitComboBox->insertItem( tr( "15" ) ); timeLimitComboBox->insertItem( tr( "10" ) ); timeLimitComboBox->insertItem( tr( "5" ) ); timeLimitComboBox->insertItem( tr( "Unlimited" ) ); SoundSettingsBaseLayout->addMultiCellWidget(timeLimitComboBox , 8, 8, 0, 0, 1); restartCheckBox= new QCheckBox( this, "restartCheck" ); restartCheckBox->setText( tr( "Restart Opie if needed" ) ); SoundSettingsBaseLayout->addMultiCellWidget( restartCheckBox , 9, 9, 0, 0, 1); adpcmCheckBox = new QCheckBox( this, "adpcmCheck" ); adpcmCheckBox->setText( tr( "Use ADPCM compression" ) ); SoundSettingsBaseLayout->addMultiCellWidget( adpcmCheckBox , 10, 10, 0, 0, 1); QSpacerItem* spacer4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); SoundSettingsBaseLayout->addItem( spacer4, 10, 0 ); } /* * Destroys the object and frees any allocated resources */ SoundSettingsBase::~SoundSettingsBase() { // no need to delete child widgets, Qt does it all for us } diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 7f1c0b8..1719ed8 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -1,515 +1,515 @@ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // Copyright (C) 2000 Trolltech AS. // adadpted form qpe/qipkg // (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "mainwindow.h" #include <qmenubar.h> #include <qpe/qpemessagebox.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qtoolbar.h> #include <qpe/qcopenvelope_qws.h> #include <qaction.h> #include <qmessagebox.h> #include <qpopupmenu.h> #include <qtoolbutton.h> #include <qstring.h> #include <qlabel.h> #include <qfile.h> #include <qlistview.h> #include <qtextview.h> #include <qcheckbox.h> #include <qlineedit.h> #include <qtabwidget.h> #include <qcombobox.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qlayout.h> #include "pksettingsbase.h" #include "utils.h" #include "packagelistitem.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ) // packageListServers( QObject(parent), name ), // packageListSearch( parent, name ), // packageListDocLnk( parent, name ) { setCaption( tr("Package Manager") ); settings = new PackageManagerSettings(this,0,TRUE); listViewPackages = new PackageListView( this,"listViewPackages",settings ); setCentralWidget( listViewPackages ); listViewPackages->addList( tr("feeds"), &packageListServers ); listViewPackages->addList( tr("ipkgfind&killefiz"), &packageListSearch ); listViewPackages->addList( tr("documents"), &packageListDocLnk ); ipkg = new PmIpkg( settings, this ); packageListServers.setSettings( settings ); packageListSearch.setSettings( settings ); packageListDocLnk.setSettings( settings ); pvDebug(9,"packageListServers.update"); packageListServers.update(); pvDebug(9,"packageListDocLnk.update"); packageListDocLnk.update(); pvDebug(9,"makeMenu"); makeMenu(); makeChannel(); connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); connect( settings->removeLinksButton, SIGNAL( clicked()), SLOT(removeLinks()) ); connect( settings->createLinksButton, SIGNAL( clicked()), SLOT(createLinks()) ); pvDebug(9,"displayList"); displayList(); } void MainWindow::makeMenu() { QToolBar *toolBar = new QToolBar( this ); QMenuBar *menuBar = new QMenuBar( toolBar ); QPopupMenu *srvMenu = new QPopupMenu( menuBar ); QPopupMenu *viewMenu = new QPopupMenu( menuBar ); QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); QPopupMenu *helpMenu = new QPopupMenu( menuBar ); setToolBarsMovable( false ); toolBar->setHorizontalStretchable( true ); menuBar->insertItem( tr( "Package" ), srvMenu ); menuBar->insertItem( tr( "View" ), viewMenu ); menuBar->insertItem( tr( "Settings" ), cfgMenu ); menuBar->insertItem( tr( "Help" ), helpMenu ); // QLabel *spacer; // spacer = new QLabel( "", toolBar ); // spacer->setBackgroundColor( toolBar->backgroundColor() ); // toolBar->setStretchableWidget( spacer ); runAction = new QAction( tr( "Apply" ), Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 ); connect( runAction, SIGNAL( activated() ), this, SLOT( runIpkg() ) ); runAction->addTo( toolBar ); runAction->addTo( srvMenu ); srvMenu->insertSeparator(); updateAction = new QAction( tr( "Update" ), Resource::loadIconSet( "oipkg/update" ), QString::null, 0, this, 0 ); connect( updateAction, SIGNAL( activated() ), this , SLOT( updateList() ) ); updateAction->addTo( toolBar ); updateAction->addTo( srvMenu ); QAction *cfgact; cfgact = new QAction( tr( "Setups" ), QString::null, 0, this, 0 ); connect( cfgact, SIGNAL( activated() ), SLOT( showSettingsSetup() ) ); cfgact->addTo( cfgMenu ); 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&) ), 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&) ), // 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 ); a->addTo( helpMenu ); a = new QAction( tr( "Remove" ), Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 ); a->addTo( helpMenu ); helpMenu->insertSeparator(); a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 ); a->addTo( helpMenu ); helpMenu->insertSeparator(); a = new QAction( tr( "New version, installed" ), Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 ); a->addTo( helpMenu ); a = new QAction( tr( "New version, not installed" ), Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 ); a->addTo( helpMenu ); a = new QAction( tr( "Old version, installed" ), Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 ); a->addTo( helpMenu ); a = new QAction( tr( "Old version, not installed" ), Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 ); a->addTo( helpMenu ); a = new QAction( tr( "Old version, new version installed" ), Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 ); a->addTo( helpMenu ); a = new QAction( tr( "New version, old version installed" ), Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 ); a->addTo( helpMenu ); -// a = new QAction( tr( "" ), +// a = new QAction( "", // Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 ); // a->addTo( helpMenu ); // configure the menus Config cfg( "oipkg", Config::User ); cfg.setGroup( "gui" ); findShow( cfg.readBoolEntry( "findBar", true ) ); searchShow( cfg.readBoolEntry( "searchBar", true ) ); sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); destShow( cfg.readBoolEntry( "destBar", false ) ); setComboName(section,cfg.readEntry("default_section")); sectionChanged(); } MainWindow::~MainWindow() { Config cfg( "oipkg", Config::User ); cfg.setGroup( "gui" ); cfg.writeEntry( "findBar", !findBar->isHidden() ); cfg.writeEntry( "searchBar", !searchBar->isHidden() ); cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); cfg.writeEntry( "destBar", !destBar->isHidden() ); cfg.writeEntry( "default_section", section->currentText() ); } void MainWindow::runIpkg() { packageListServers.allPackages(); ipkg->loadList( &packageListSearch ); ipkg->loadList( &packageListDocLnk ); ipkg->loadList( &packageListServers ); ipkg->commit(); ipkg->clearLists(); // ##### If we looked in the list of files, we could send out accurate // ##### messages. But we don't bother yet, and just do an "all". QCopEnvelope e("QPE/System", "linkChanged(QString)"); QString lf = QString::null; e << lf; displayList(); } void MainWindow::updateList() { packageListServers.clear(); packageListSearch.clear(); packageListDocLnk.clear(); ipkg->update(); packageListServers.update(); packageListSearch.update(); packageListDocLnk.update(); } void MainWindow::filterList() { QString f = ""; if ( findAction->isOn() ) f = findEdit->text(); packageListServers.filterPackages( f ); } void MainWindow::displayList() { filterList(); listViewPackages->display(); } void MainWindow::sectionChanged() { disconnect( section, SIGNAL( activated(int) ), this, SLOT( sectionChanged() ) ); disconnect( subsection, SIGNAL(activated(int) ), this, SLOT( subSectionChanged() ) ); subsection->clear(); packageListServers.setSection( section->currentText() ); setSubSections(); connect( section, SIGNAL( activated(int) ), this, SLOT( sectionChanged() ) ); connect( subsection, SIGNAL(activated(int) ), this, SLOT( subSectionChanged() ) ); displayList(); } void MainWindow::subSectionChanged() { disconnect( section, SIGNAL( activated(int) ), this, SLOT( sectionChanged() ) ); disconnect( subsection, SIGNAL(activated(int) ), this, SLOT( subSectionChanged() ) ); packageListServers.setSubSection( subsection->currentText() ); connect( section, SIGNAL( activated(int) ), this, SLOT( sectionChanged() ) ); connect( subsection, SIGNAL(activated(int) ), this, SLOT( subSectionChanged() ) ); displayList(); } void MainWindow::setSections() { section->clear(); section->insertStringList( packageListServers.getSections() ); } void MainWindow::setSubSections() { subsection->clear(); subsection->insertStringList( packageListServers.getSubSections() ); } void MainWindow::showSettings(int i) { if ( settings->showDialog( i ) ) { updateList(); } setComboName(destination,settings->getDestinationName()); CheckBoxLink->setChecked( settings->createLinks() ); } void MainWindow::showSettingsSetup() { showSettings(0); } void MainWindow::showSettingsSrv() { showSettings(1); } void MainWindow::showSettingsDst() { showSettings(2); } void MainWindow::sectionShow(bool b) { if (b) sectionBar->show(); else sectionBar->hide(); sectionAction->setOn( b ); } void MainWindow::sectionClose() { sectionAction->setOn( false ); } 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&)) ); } 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(); } |