-rw-r--r-- | libopie2/opieui/fileselector/ofiledialog.cpp | 4 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 56 |
2 files changed, 26 insertions, 34 deletions
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp index 2d38961..11a9e33 100644 --- a/libopie2/opieui/fileselector/ofiledialog.cpp +++ b/libopie2/opieui/fileselector/ofiledialog.cpp @@ -1,58 +1,58 @@ /* =. This file is part of the OPIE Project .=l. Copyright (C) Holger Freyther <freyther@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. + - . .-<_> .<> Foundation; version 2 of the License. + ._= =} : .%`+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. */ /* OPIE */ #include <opie2/ofiledialog.h> #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> /* QT */ #include <qfileinfo.h> #include <qstring.h> #include <qapplication.h> #include <qlayout.h> /* TRANSLATOR Opie::Ui::OFileDialog */ using namespace Opie::Ui; namespace { /* * helper functions to load the start dir * and to save it * helper to extract the dir out of a file name */ /** * This method will use Config( argv[0] ); * @param key The group key used */ QString lastUsedDir( const QString& key ) diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 02404e5..5b5dc2f 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp @@ -1,76 +1,74 @@ /* - Â Â Â Â Â Â Â Â This file is part of the Opie Project - - Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org> - =. - .=l. -Â Â Â Â Â Â .>+-= -Â _;:, Â Â .> Â Â :=|. This program is free software; you can -.> <`_, Â > Â . Â <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public -.="- .-=="i, Â Â .._ License as published by the Free Software -Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, -Â Â Â ._= =} Â Â Â : or (at your option) any later version. -Â Â .%`+i> Â Â Â _;_. -Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that -Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; - : .. Â Â .:, Â Â . . . without even the implied warranty of -Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A -Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU -..}^=.= Â Â Â = Â Â Â ; Library General Public License for more -++= Â -. Â Â .` Â Â .: details. - : Â Â = Â ...= . :.=- -Â -. Â .:....=;==+<; You should have received a copy of the GNU -Â -_. . . Â )=. Â = Library General Public License along with -Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. + =. This file is part of the OPIE Project + .=l. Copyright (C) Holger Freyther <freyther@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; version 2 of the License. + ._= =} : + .%`+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. + */ /* hacky but we need to get FileSelector::filter */ #define private public #include <qpe/fileselector.h> #undef private #include "ofileselector_p.h" /* OPIE */ #include <opie2/odebug.h> #include <opie2/ofileselector.h> #include <opie2/oresource.h> #include <qpe/qpeapplication.h> #include <qpe/mimetype.h> #include <qpe/storage.h> /* QT */ #include <qcombobox.h> #include <qdir.h> #include <qhbox.h> #include <qheader.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qlistview.h> #include <qpopupmenu.h> #include <qwidgetstack.h> #include <qregexp.h> #include <qobjectlist.h> using namespace Opie::Ui::Internal; namespace Opie { namespace Ui { namespace Internal { /* * Create a path by adding a '/'/QDir::seperator in between * base and ending, but only if base is not empty */ static inline QString createNewPath(const QString& base, const QString &ending) { return base == QString::fromLatin1("/") ? base + ending : base + "/" + ending; } OFileViewInterface::OFileViewInterface( OFileSelector* _selector ) @@ -586,115 +584,109 @@ void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) if ( selector()->mode() == OFileSelector::FileSelector ) { odebug << "slot Current Changed" << oendl; QStringList str = QStringList::split("->", sel->text(1) ); QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace()); emit selector()->fileSelected( path ); DocLnk lnk( path ); emit selector()->fileSelected( lnk ); } } #endif } void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { if (!item || ( button != Qt::LeftButton) ) return; OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); if (!sel->isLocked() ) { QStringList str = QStringList::split("->", sel->text(1) ); if (sel->isDir() ) { m_currentDir = createNewPath(sel->directory(),str[0].stripWhiteSpace()); emit selector()->dirSelected( m_currentDir ); reread( m_all ); } else { // file odebug << "slot Clicked" << oendl; selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace()); emit selector()->fileSelected( path ); DocLnk lnk( path ); emit selector()->fileSelected( lnk ); } } // not locked } void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { MimeType type( info->absFilePath() ); if (!compliesMime( type.id() ) ) return; QPixmap pix = type.pixmap(); QString dir, name; bool locked; - if ( pix.isNull() ) - { - QWMatrix matrix; - QPixmap pixer( Opie::Core::OResource::loadPixmap( "UnknownDocument" ) ); - matrix.scale( .4, .4 ); - pix = pixer.xForm( matrix ); - } + if ( pix.isNull() ) pix = Opie::Core::OResource::loadPixmap( "UnknownDocument", Opie::Core::OResource::SmallIcon ); dir = info->dirPath( true ); locked = false; if ( symlink ) name = info->fileName() + " -> " + createNewPath(info->dirPath(),info->readLink()); else { name = info->fileName(); if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) { locked = true; - pix = Opie::Core::OResource::loadPixmap( "locked" ); + pix = Opie::Core::OResource::loadPixmap( "locked", Opie::Core::OResource::SmallIcon ); } } (void)new OFileSelectorItem( m_view, pix, name, info->lastModified().toString(), QString::number( info->size() ), dir, locked ); } void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { bool locked = false; QString name; QPixmap pix; if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) { locked = true; if ( symlink ) pix = Opie::Core::OResource::loadPixmap( "opie/symlink" ); else pix = Opie::Core::OResource::loadPixmap( "lockedfolder" ); } else pix = symlink ? Opie::Core::OResource::loadPixmap( "opie/symlink" ) : Opie::Core::OResource::loadPixmap( "folder" ); name = symlink ? info->fileName() + " -> " + createNewPath(info->dirPath(true),info->readLink()) : info->fileName(); (void)new OFileSelectorItem( m_view, pix, name, info->lastModified().toString(), QString::number( info->size() ), info->dirPath( true ), locked, true ); } void OFileViewFileListView::addSymlink( QFileInfo* , bool ) { } void OFileViewFileListView::cdUP() { QDir dir( m_currentDir ); dir.cdUp(); if (!dir.exists() ) m_currentDir = "/"; else m_currentDir = dir.absPath(); |