author | zecke <zecke> | 2004-02-02 16:22:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-02 16:22:20 (UTC) |
commit | 9191120c28d3c125897b01680f57925c431c7104 (patch) (side-by-side diff) | |
tree | 29f9183396b639d9f4618d60845e74048703d789 | |
parent | 44e49951c71b277bd05ecc9857ec39d73a61b35e (diff) | |
download | opie-9191120c28d3c125897b01680f57925c431c7104.zip opie-9191120c28d3c125897b01680f57925c431c7104.tar.gz opie-9191120c28d3c125897b01680f57925c431c7104.tar.bz2 |
Use @slash to avoid problems with warning due /* in a comment
-rw-r--r-- | libopie/ofiledialog.h | 4 | ||||
-rw-r--r-- | libopie/ofileselector.cpp | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/libopie/ofiledialog.h b/libopie/ofiledialog.h index 91e0586..3b905c0 100644 --- a/libopie/ofiledialog.h +++ b/libopie/ofiledialog.h @@ -1,101 +1,101 @@ /* =. This file is part of the OPIE Project .=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 OpieFileDialog_h #define OpieFileDialog_h #include <qdialog.h> #include <opie/ofileselector.h> /** * This class places a OFileSelector inside a QDialog. * It provides static method for letting a user chose * a file for either opening or saving. * Most of the time the c'tor will not be used instead using * the static member functions is prefered. * * <pre> * QMap<QString, QStringList> mimeTypes; * QStringList types; - * types << "text[slash]* "; + * types << "text@slash* "; * mimeTypes.insert( tr("Text"), types ); - * mimeTypes.insert( tr("All"), " * / * " ); // remove the spaces in the 2nd comment + * mimeTypes.insert( tr("All"), " *@slash* " ); // remove the spaces in the 2nd comment * QString fileName= OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, * "foo","bar", mimeTypes); * </pre> * * @short A small QDialog swalloing a FileSelector * @see QDialog * @see OFileSelector * @version 0.1-unfinished * @author Holger Freyther ( zecke@handhelds.org ) */ class OFileDialog : public QDialog { Q_OBJECT public: OFileDialog(const QString &caption, QWidget *, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const MimeTypes &mimetypes = MimeTypes() ); QString mimetype() const; QString fileName() const; DocLnk selectedDocument()const; // static methods static QString getOpenFileName(int selector, const QString& startDir = QString::null, const QString &fileName = QString::null, const MimeTypes& mime = MimeTypes(), QWidget *wid = 0, const QString &caption = QString::null ); static QString getSaveFileName(int selector, const QString& startDir = QString::null, const QString& fileName = QString::null, const MimeTypes& mimefilter = MimeTypes(), QWidget *wid = 0, const QString &caption = QString::null ); //let's OFileSelector catch up first //static QString getExistingDirectory(const QString& startDir = QString::null, // QWidget *parent = 0, // const QString& caption = QString::null ); private: class OFileDialogPrivate; OFileDialogPrivate *d; OFileSelector *file; private slots: void slotFileSelected( const QString & ); void slotDirSelected(const QString & ); void slotSelectorOk(); }; #endif diff --git a/libopie/ofileselector.cpp b/libopie/ofileselector.cpp index 9afe9c7..9ac2981 100644 --- a/libopie/ofileselector.cpp +++ b/libopie/ofileselector.cpp @@ -545,196 +545,196 @@ void OFileViewFileListView::slotFSActivated( int id ) { bool OFileViewFileListView::compliesMime( const QString& str) { if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() ) return true; for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) { QRegExp reg( (*it) ); reg.setWildcard( true ); if ( str.find( reg ) != -1 ) return true; } return false; } /* * The listView giving access to the file system! */ class OFileViewFileSystem : public OFileViewInterface { public: OFileViewFileSystem( OFileSelector* ); ~OFileViewFileSystem(); QString selectedName() const; QString selectedPath() const; QString directory()const; void reread(); int fileCount()const; QWidget* widget( QWidget* parent ); void activate( const QString& ); private: OFileViewFileListView* m_view; bool m_all : 1; }; OFileViewFileSystem::OFileViewFileSystem( OFileSelector* sel) : OFileViewInterface( sel ) { m_view = 0; m_all = false; } OFileViewFileSystem::~OFileViewFileSystem() { } QString OFileViewFileSystem::selectedName()const{ if (!m_view ) return QString::null; QString cFN=currentFileName(); if (cFN.startsWith("/")) return cFN; return m_view->currentDir() + "/" + cFN; } QString OFileViewFileSystem::selectedPath()const{ return QString::null; } QString OFileViewFileSystem::directory()const{ if (!m_view) return QString::null; OFileSelectorItem* item = m_view->currentItem(); if (!item ) return QString::null; return QDir(item->directory() ).absPath(); } void OFileViewFileSystem::reread() { if (!m_view) return; m_view->reread( m_all ); } int OFileViewFileSystem::fileCount()const{ if (!m_view ) return -1; return m_view->fileCount(); } QWidget* OFileViewFileSystem::widget( QWidget* parent ) { if (!m_view ) { m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); } return m_view; } void OFileViewFileSystem::activate( const QString& str) { m_all = (str != QObject::tr("Files") ); } /* Selector */ /** * @short new and complete c'tor * * Create a OFileSelector to let the user select a file. It can * either be used to open a file, select a save name in a dir or * as a dropin for the FileSelector. * * <pre> * QMap<QString, QStringList> mimeTypes; * QStringList types; - * types << "text[slash]* "; - * types << "audio[slash]*"; + * types << "text@slash* "; + * types << "audio@slash*"; * mimeTypes.insert( tr("Audio and Text"), types ); - * mimeTypes.insert( tr("All"), "*[slash]*); + * mimeTypes.insert( tr("All"), "*@slash*); * * now you could create your fileselector * </pre> * * * @param parent the parent of this widget * @param mode The mode from the enum Mode (Open,Save,FILESELECTOR) * @param sel The selector to be used * @param dirName The name of the dir to start int * @param fileName The fileName placed in the fileselector lineedit * @param mimetypes The MimeType map of used mimetypes * @param showNew Show a New Button. Most likely to be used in the FileSelector view. * @param showClose Show a Close Button. Most likely to be used in FileSelector view. * */ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, const QString& dirName, const QString& fileName, const MimeTypes& mimetypes, bool showNew, bool showClose) : QWidget( parent, "OFileSelector" ) { m_current = 0; m_shNew = showNew; m_shClose = showClose; m_mimeType = mimetypes; m_startDir = dirName; m_mode = mode; m_selector = sel; initUI(); m_lneEdit->setText( fileName ); initMime(); initViews(); QString str; switch ( m_selector ) { default: case Normal: str = QObject::tr("Documents"); m_cmbView->setCurrentItem( 0 ); break; case Extended: str = QObject::tr("Files"); m_cmbView->setCurrentItem( 1 ); break; case ExtendedAll: str = QObject::tr("All Files"); m_cmbView->setCurrentItem( 2 ); break; } slotViewChange( str ); } /** * This a convience c'tor to just substitute the use of FileSelector */ OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, bool showNew, bool showClose ) : QWidget( parent, name ) { m_current = 0; m_shNew = showNew; m_shClose = showClose; m_startDir = QPEApplication::documentDir(); if (!mimeFilter.isEmpty() ) m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) ); m_mode = OFileSelector::FileSelector; m_selector = OFileSelector::Normal; initUI(); initMime(); initViews(); m_cmbView->setCurrentItem( 0 ); slotViewChange( QObject::tr("Documents") ); } /* * INIT UI will set up the basic GUI * Layout: Simple VBoxLayout * On top a WidgetStack containing the Views... * - List View * - Document View * Below we will have a Label + LineEdit * Below we will have two ComoBoxes one for choosing the view one for * choosing the mimetype */ void OFileSelector::initUI() { QVBoxLayout* lay = new QVBoxLayout( this ); m_stack = new QWidgetStack( this ); lay->addWidget( m_stack, 1000 ); m_nameBox = new QHBox( this ); |