author | zecke <zecke> | 2002-09-10 12:31:45 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-10 12:31:45 (UTC) |
commit | f244f5ec5351693d366739cfb7bf509d10601cdf (patch) (side-by-side diff) | |
tree | 93610410c6a6a8d34c8a465e2b55e13c2b6acc9a | |
parent | df13a75ca2c9014c78cb9a6458ceb734e2e0af65 (diff) | |
download | opie-f244f5ec5351693d366739cfb7bf509d10601cdf.zip opie-f244f5ec5351693d366739cfb7bf509d10601cdf.tar.gz opie-f244f5ec5351693d366739cfb7bf509d10601cdf.tar.bz2 |
Fix for QTopia1.6
-rw-r--r-- | libopie/libopie.pro | 19 | ||||
-rw-r--r-- | libopie/odevice.h | 2 | ||||
-rw-r--r-- | libopie/ofileselector.cc | 13 | ||||
-rw-r--r-- | libopie/ofileview.h | 28 | ||||
-rw-r--r-- | libopie/ofontmenu.h | 2 |
5 files changed, 39 insertions, 25 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro index 891c03e..6c47e86 100644 --- a/libopie/libopie.pro +++ b/libopie/libopie.pro @@ -1,25 +1,40 @@ TEMPLATE = lib CONFIG += qte warn_on release -HEADERS = ofontmenu.h ofileselector.h ofiledialog.h ofileview.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h colordialog.h colorpopupmenu.h oclickablelabel.h oprocctrl.h oprocess.h odevice.h otimepicker.h otabwidget.h otabbar.h otabinfo.h -SOURCES = ofontmenu.cc ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp colordialog.cpp colorpopupmenu.cpp oclickablelabel.cpp oprocctrl.cpp oprocess.cpp odevice.cpp otimepicker.cpp otabwidget.cpp otabbar.cpp +HEADERS = ofontmenu.h ofileselector.h \ + ofiledialog.h tododb.h \ + todoevent.h todoresource.h \ + todovcalresource.h xmltree.h \ + colordialog.h colorpopupmenu.h \ + oclickablelabel.h oprocctrl.h \ + oprocess.h odevice.h \ + otimepicker.h otabwidget.h \ + otabbar.h otabinfo.h +SOURCES = ofontmenu.cc ofileselector.cc \ + ofiledialog.cc xmltree.cc \ + tododb.cpp todoevent.cpp \ + todovcalresource.cpp colordialog.cpp \ + colorpopupmenu.cpp oclickablelabel.cpp \ + oprocctrl.cpp oprocess.cpp \ + odevice.cpp otimepicker.cpp \ + otabwidget.cpp otabbar.cpp TARGET = opie INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(QTDIR)/lib$(PROJMAK) #VERSION = 1.0.0 INTERFACES = otimepickerbase.ui TRANSLATIONS = ../i18n/de/libopie.ts \ ../i18n/en/libopie.ts \ ../i18n/es/libopie.ts \ ../i18n/fr/libopie.ts \ ../i18n/hu/libopie.ts \ ../i18n/ja/libopie.ts \ ../i18n/ko/libopie.ts \ ../i18n/no/libopie.ts \ ../i18n/pl/libopie.ts \ ../i18n/pt/libopie.ts \ ../i18n/pt_BR/libopie.ts \ ../i18n/sl/libopie.ts \ ../i18n/zh_CN/libopie.ts \ ../i18n/zh_TW/libopie.ts diff --git a/libopie/odevice.h b/libopie/odevice.h index 9dda68e..2f676ff 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h @@ -1,119 +1,117 @@ /* This file is part of the OPIE libraries Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _LIBOPIE_ODEVICE_H_ #define _LIBOPIE_ODEVICE_H_ #include <qstring.h> class ODeviceData; enum OModel { OMODEL_Unknown, OMODEL_iPAQ_H31xx, OMODEL_iPAQ_H36xx, OMODEL_iPAQ_H37xx, OMODEL_iPAQ_H38xx, OMODEL_Zaurus_SL5000 }; enum OVendor { OVENDOR_Unknown, OVENDOR_HP, OVENDOR_Sharp }; enum OSystem { OSYSTEM_Unknown, OSYSTEM_Familiar, OSYSTEM_Zaurus, OSYSTEM_OpenZaurus }; enum OLedState { OLED_Off, OLED_On, OLED_BlinkSlow, OLED_BlinkFast }; class ODevice { public: - -public: static ODevice *inst ( ); // system enum PowerButtonHandler { KERNEL, OPIE }; virtual bool setPowerButtonHandler ( PowerButtonHandler h ); virtual bool suspend ( ); virtual bool setDisplayStatus ( bool on ); virtual bool setDisplayBrightness ( int brightness ); virtual int displayBrightnessResolution ( ) const; // information QString modelString ( ); OModel model ( ); QString vendorString ( ); OVendor vendor ( ); QString systemString ( ); OSystem system ( ); QString systemVersionString ( ); // input / output virtual void alarmSound ( ); virtual void keySound ( ); virtual void touchSound ( ); virtual uint hasLeds ( ) const; virtual OLedState led ( uint which ) const; virtual bool setLed ( uint which, OLedState st ); virtual ~ODevice ( ); protected: ODevice ( ); virtual void init ( ); ODeviceData *d; private: ODevice ( const ODevice & ); }; #endif diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index 3c3a6c4..b3aacd6 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc @@ -92,411 +92,404 @@ namespace { private: bool mLocked:1; bool dir:1; QString m_dir; }; }; OFileSelector::OFileSelector( QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName, const QMap<QString,QStringList>& mimeTypes) : QWidget( wid, "OFileSelector") { m_mimetypes = mimeTypes; if (mode == SAVE ) m_name = fileName; initVars(); m_mode = mode; m_selector = selector; m_currentDir = dirName; init(); //QTimer::singleShot(6*1000, this, SLOT( slotTest() ) ); } OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, const char *name, bool newVisible, bool closeVisible ) : QWidget( parent, name ) { if (!mimeFilter.isEmpty() ) { QStringList list = QStringList::split(";", mimeFilter ); m_mimetypes.insert(mimeFilter, list ); } initVars(); m_currentDir = QPEApplication::documentDir(); m_mode = FILESELECTOR; m_selector = NORMAL; m_shClose = closeVisible; m_shNew = newVisible; m_shLne = false; m_shPerm = false; m_shYesNo = false; init(); } OFileSelector::~OFileSelector() { } void OFileSelector::setNewVisible( bool visible ) { m_shNew = visible; if( m_selector == NORMAL ){ delete m_select; // we need to initialize but keep the selected mimetype QString mime = currentMimeType(); m_select = new FileSelector( mime , m_stack, "fileselector", m_shNew, m_shClose); connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); connect(m_select, SIGNAL(closeMe() ), this, SIGNAL(closeMe() ) ); //connect to close me and other signals as well m_stack->addWidget( m_select, NORMAL ); }else{ m_new->show(); } } void OFileSelector::setCloseVisible( bool visible ) { m_shClose = visible; if( m_selector == NORMAL ){ setNewVisible( m_shNew ); // yeah baby }else{ m_close->show(); } } void OFileSelector::reread() { if( m_selector == NORMAL ){ setNewVisible( m_shNew ); // make it a initializeSelector }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ reparse(); //}else{ //; } } const DocLnk *OFileSelector::selected() { - if( m_selector == NORMAL ){ - return m_select->selected(); - }else{ DocLnk *lnk = new DocLnk(selectedDocument() ); return lnk; - } } void OFileSelector::setYesCancelVisible( bool show ) { initializeYes(); // FIXME if YesCancel is not shown we will initialize it to hide it :( m_shYesNo = show; if( m_shYesNo ) m_boxOk->show(); else m_boxOk->hide(); } void OFileSelector::setToolbarVisible( bool show ) { m_shTool = show; initializeListView(); // FIXME see above waste of memory if(!m_shTool ){ m_location->hide(); m_up->hide(); m_homeButton->hide(); m_docButton->hide(); }else{ m_location->show(); m_up->show(); m_homeButton->show(); m_docButton->show(); } } void OFileSelector::setPermissionBarVisible( bool show ) { m_shPerm = show; initializePerm(); if( m_shPerm ) m_checkPerm->show(); else m_checkPerm->hide(); } void OFileSelector::setLineEditVisible( bool show ) { if( show ){ initializeName(); m_boxName->show(); }else{ if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go m_boxName->hide(); } } m_shLne = show; } void OFileSelector::setChooserVisible( bool show ) { m_shChooser = show; initializeChooser(); if( m_shChooser ){ m_boxView->hide(); }else{ m_boxView->show(); } } QCheckBox* OFileSelector::permissionCheckbox() { if( m_selector == NORMAL ) return 0l; else return m_checkPerm; } bool OFileSelector::setPermission()const { return m_checkPerm == 0 ? false : m_checkPerm->isChecked(); } void OFileSelector::setPermissionChecked( bool check ) { if( m_checkPerm ) m_checkPerm->setChecked( check ); } void OFileSelector::setMode(int mode) // FIXME do direct raising { m_mode = mode; if( m_selector == NORMAL ) return; } void OFileSelector::setShowDirs(bool ) { m_dir = true; reparse(); } void OFileSelector::setCaseSensetive(bool caSe ) { m_case = caSe; reparse(); } void OFileSelector::setShowFiles(bool show ) { m_files = show; reparse(); } /// bool OFileSelector::cd(const QString &path ) { m_currentDir = path; reparse(); return true; } void OFileSelector::setSelector(int mode ) { QString text; switch( mode ){ case NORMAL: text = tr("Documents"); break; case EXTENDED: text = tr("Files"); break; case EXTENDED_ALL: text = tr("All Files"); break; } slotViewCheck( text ); } void OFileSelector::setPopupMenu(QPopupMenu *popup ) { m_custom = popup; m_showPopup = true; } //void OFileSelector::updateL QString OFileSelector::selectedName() const { QString name; if( m_selector == NORMAL ){ - const DocLnk *lnk = m_select->selected(); - name = lnk->file(); - delete lnk; + DocLnk lnk = m_select->selectedDocument(); + name = lnk.file(); }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ if ( m_shLne ) { name = m_currentDir + "/" +m_edit->text(); }else{ QListViewItem *item = m_View->currentItem(); if( item != 0 ) name = m_currentDir + "/" + item->text( 1 ); } }else { // installed view ; } return name; } QStringList OFileSelector::selectedNames()const { QStringList list; if( m_selector == NORMAL ){ list << selectedName(); }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { list << selectedName(); // FIXME implement multiple Selections } return list; } /** If mode is set to the Dir selection this will return the selected path. * * */ QString OFileSelector::selectedPath()const { QString path; if( m_selector == NORMAL ){ path = QPEApplication::documentDir(); }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ ; } return path; } QStringList OFileSelector::selectedPaths() const { QStringList list; list << selectedPath(); return list; } QString OFileSelector::directory()const { if( m_selector == NORMAL ) return QPEApplication::documentDir(); return QDir(m_currentDir).absPath(); } int OFileSelector::fileCount() { int count; switch( m_selector ){ case NORMAL: count = m_select->fileCount(); break; //case CUSTOM: case EXTENDED: case EXTENDED_ALL: default: count = m_View->childCount(); break; } return count; } DocLnk OFileSelector::selectedDocument() const { DocLnk lnk; switch( m_selector ){ case NORMAL:{ - const DocLnk *lnk2 = m_select->selected(); - lnk = DocLnk(*lnk2 ); // copy - delete lnk2; + lnk = m_select->selectedDocument(); break; } case EXTENDED: case EXTENDED_ALL: default: lnk = DocLnk( selectedName() ); // new DocLnk break; } return lnk; } QValueList<DocLnk> OFileSelector::selectedDocuments() const { QValueList<DocLnk> docs; docs.append( selectedDocument() ); return docs; } // slots internal void OFileSelector::slotOk() { emit ok(); } void OFileSelector::slotCancel() { emit cancel(); } void OFileSelector::slotViewCheck(const QString &sel) { if( sel == tr("Documents" ) ){ if( m_select == 0 ){ // autMime? fix cause now we use All and not the current // yes currentMime fixes that for us QString mime = currentMimeType(); m_select = new FileSelector(mime, m_stack, "fileselector", m_shNew, m_shClose); connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); connect(m_select, SIGNAL(closeMe() ), this, SIGNAL(closeMe() ) ); //connect to close me and other signals as well m_stack->addWidget( m_select, NORMAL ); } m_stack->raiseWidget( NORMAL ); m_selector = NORMAL; }else if( sel == tr("Files") ){ m_selector = EXTENDED; initializeListView(); reparse(); m_stack->raiseWidget( EXTENDED ); }else if( sel == tr("All Files") ){ m_selector = EXTENDED_ALL; initializeListView(); reparse(); m_stack->raiseWidget( EXTENDED ); // same widget other QFileFilter } } // not yet finished..... QString OFileSelector::currentMimeType() const{ QString mime; QString currentText; if (m_shChooser ) currentText = m_mimeCheck->currentText(); if (tr("All") == currentText ) return QString::null; else if (currentText.isEmpty() ) { ; }else { QMap<QString, QStringList>::ConstIterator it; it = m_mimetypes.find( currentText ); if ( it == m_mimetypes.end() ) { mime = it.data().join(";"); }else{ mime = currentText; } } return mime; } void OFileSelector::slotMimeCheck(const QString &mime) { if( m_selector == NORMAL ){ //if( m_autoMime ){ QString newMimeType; if (mime != tr("All") ) { QMap<QString, QStringList>::Iterator it; it = m_mimetypes.find(mime); if ( it != m_mimetypes.end() ) { newMimeType = it.data().join(";"); }else{ newMimeType = mime; } } delete m_select; diff --git a/libopie/ofileview.h b/libopie/ofileview.h index ed256f1..e072477 100644 --- a/libopie/ofileview.h +++ b/libopie/ofileview.h @@ -1,79 +1,87 @@ /* =. This file is part of the OPIE Project .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> .>+-= - _;:, .> :=|. This library is free software; you can + _;:, .> :=|. This library is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This library is distributed in the hope that + .%`+i> _;_. + .i_,=:_. -<s. This library is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. - : = ...= . :.=- + : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ofileview_h #define ofileview_h #include <qobject.h> #include <qwidget.h> class QFileInfo; class QDir; class DocLnk; -class OFileSelectorView : public QWidget { + +/** + * A OFileView is a specialised View for the + * OFileSelector + * With a View you can chage the user visible + * representation of a OFileLister + * OFileView is just a basic interface which helps you to + * write new views + */ +class OFileView { Q_OBJECT public: - OFileSelectorView(QWidget *widget, - const char *name ) - : QWidget(widget, name ) -{ }; + OFileView(QWidget *widget, + const char *name ); + virtual OFileView(); virtual ~OFileSelectorView() = 0; virtual void addFile(const QString &mine, QFileInfo *info, bool isSymlink = FALSE ) = 0; virtual void addDir (const QString &mine, QFileInfo *info, bool isSymlink = FALSE ) = 0; virtual void addSymlink(const QString &mime, QFileInfo *info, bool isSymlink = FALSE ) = 0; virtual void cd(const QString &path ) = 0; signals: void fileSelected(const QString &); void fileSelected(const DocLnk & ); void contextMenu(); void changedDir(const QString &); void changedDir(const QDir & ); }; class OFileViewFactory { // Q_OBJECT public: OFileViewFactory() {} ; virtual ~OFileViewFactory() = 0; OFileSelectorView* newView(QWidget *parent, const char *name ); QString name()const; }; #endif diff --git a/libopie/ofontmenu.h b/libopie/ofontmenu.h index 609f240..5fd515f 100644 --- a/libopie/ofontmenu.h +++ b/libopie/ofontmenu.h @@ -1,83 +1,83 @@ /* =. This file is part of the OPIE Project - .=l. Copyright (c) 2002 zekce <zecke@handhelds.org> + .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> .>+-= _;:, .> :=|. This library is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This library is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ofontmenu_h #define ofontmenu_h #include <qpopupmenu.h> #include <qlist.h> namespace { struct WidSize { QWidget *wid; int size; }; }; // if i would be on kde this would be a KActionMenu... class Config; class OFontMenu : public QPopupMenu { Q_OBJECT public: OFontMenu(QWidget *parent, const char* name, const QList<QWidget> &list ); void save(Config *cfg ); void restore(Config *cfg ); void setWidgets(const QList<QWidget> &list ); void addWidget(QWidget *wid ); void forceSize(QWidget *wid, int size ); void removeWidget(QWidget *wid ); const QList<QWidget> &widgets()const; signals: void fontChanged(int size ); private: QList<QWidget> m_list; QList<WidSize> m_wids; int m_size; class OFontMenuPrivate; OFontMenuPrivate *d; private slots: virtual void slotSmall(); virtual void slotMedium(); virtual void slotLarge(); void setFontSize(int size ); }; #endif |