summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-27 23:12:20 (UTC)
committer zecke <zecke>2002-04-27 23:12:20 (UTC)
commita64cc0ad0574ae1e15c4965d2557c3e06cc3fd65 (patch) (unidiff)
tree80a622e1e82e46a24dc5968b7b89180d4420476c
parentdb95cde435e507833f58111237f86cb9f9ac927a (diff)
downloadopie-a64cc0ad0574ae1e15c4965d2557c3e06cc3fd65.zip
opie-a64cc0ad0574ae1e15c4965d2557c3e06cc3fd65.tar.gz
opie-a64cc0ad0574ae1e15c4965d2557c3e06cc3fd65.tar.bz2
compile it for Max
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc4
-rw-r--r--libopie/ofileview.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 0e508af..9cf3f36 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -830,215 +830,215 @@ void OFileSelector::initializeListView()
830 m_View->setSorting(1 ); 830 m_View->setSorting(1 );
831 m_View->setAllColumnsShowFocus( TRUE); 831 m_View->setAllColumnsShowFocus( TRUE);
832 // connect now 832 // connect now
833 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) ); 833 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) );
834 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); 834 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) );
835 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), 835 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
836 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); 836 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
837 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), 837 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )),
838 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); 838 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) );
839 839
840 840
841}; 841};
842 842
843/* If a item is locked depends on the mode 843/* If a item is locked depends on the mode
844 if we're in OPEN !isReadable is locked 844 if we're in OPEN !isReadable is locked
845 if we're in SAVE !isWriteable is locked 845 if we're in SAVE !isWriteable is locked
846 846
847 847
848 */ 848 */
849 849
850 850
851void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ 851void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){
852// qWarning("Add Files" ); 852// qWarning("Add Files" );
853 if( !m_files ){ 853 if( !m_files ){
854// qWarning("not mfiles" ); 854// qWarning("not mfiles" );
855 return; 855 return;
856 } 856 }
857 857
858 MimeType type( info->filePath() ); 858 MimeType type( info->filePath() );
859 QString name; 859 QString name;
860 QString dir; 860 QString dir;
861 bool locked= false; 861 bool locked= false;
862 if(mime == "All" ){ 862 if(mime == "All" ){
863 ; 863 ;
864 }else if( type.id() != mime ) { 864 }else if( type.id() != mime ) {
865 return; 865 return;
866 } 866 }
867 QPixmap pix = type.pixmap(); 867 QPixmap pix = type.pixmap();
868 if(pix.isNull() ) 868 if(pix.isNull() )
869 pix = Resource::loadPixmap( "UnknownDocument-14" ); 869 pix = Resource::loadPixmap( "UnknownDocument-14" );
870 dir = info->dirPath( true ); 870 dir = info->dirPath( true );
871 if( symlink ) { // check if the readLink is readable 871 if( symlink ) { // check if the readLink is readable
872 // do it right later 872 // do it right later
873 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 873 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
874 }else{ // keep track of the icons 874 }else{ // keep track of the icons
875 name = info->fileName(); 875 name = info->fileName();
876 if( m_mode == OPEN ){ 876 if( m_mode == OPEN ){
877 if( !info->isReadable() ){ 877 if( !info->isReadable() ){
878 locked = true; 878 locked = true;
879 pix = Resource::loadPixmap("locked" ); 879 pix = Resource::loadPixmap("locked" );
880 } 880 }
881 }else if( m_mode == SAVE ){ 881 }else if( m_mode == SAVE ){
882 if( !info->isWritable() ){ 882 if( !info->isWritable() ){
883 locked = true; 883 locked = true;
884 pix = Resource::loadPixmap("locked" ); 884 pix = Resource::loadPixmap("locked" );
885 } 885 }
886 } 886 }
887 } 887 }
888 new OFileSelectorItem( m_View, pix, name, 888 new OFileSelectorItem( m_View, pix, name,
889 info->lastModified().toString(), 889 info->lastModified().toString(),
890 QString::number( info->size() ), 890 QString::number( info->size() ),
891 dir, locked ); 891 dir, locked );
892} 892}
893 893
894void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) 894void OFileSelector::addDir(const QString &/*mime*/, QFileInfo *info, bool symlink )
895{ 895{
896 if(!m_dir ) 896 if(!m_dir )
897 return; 897 return;
898 //if( showDirs ) 898 //if( showDirs )
899 { 899 {
900 bool locked=false; 900 bool locked=false;
901 QString name; 901 QString name;
902 QPixmap pix; 902 QPixmap pix;
903 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ 903 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){
904 locked = true; 904 locked = true;
905 if( symlink ){ 905 if( symlink ){
906 pix = (*m_pixmaps)["symlinkedlocked"]; 906 pix = (*m_pixmaps)["symlinkedlocked"];
907 }else{ 907 }else{
908 pix = Resource::loadPixmap("lockedfolder" ); 908 pix = Resource::loadPixmap("lockedfolder" );
909 } 909 }
910 }else{ 910 }else{
911 if( symlink ){ 911 if( symlink ){
912 pix = (*m_pixmaps)["dirsymlink" ]; 912 pix = (*m_pixmaps)["dirsymlink" ];
913 }else{ 913 }else{
914 pix = Resource::loadPixmap("folder" ); 914 pix = Resource::loadPixmap("folder" );
915 } 915 }
916 } 916 }
917 if( symlink){ 917 if( symlink){
918 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink(); 918 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink();
919 919
920 }else{ 920 }else{
921 //if(info->isReadable() ) 921 //if(info->isReadable() )
922 name = info->fileName(); 922 name = info->fileName();
923 } 923 }
924 924
925 new OFileSelectorItem(m_View, pix, 925 new OFileSelectorItem(m_View, pix,
926 name, info->lastModified().toString(), 926 name, info->lastModified().toString(),
927 QString::number(info->size() ),info->dirPath(true), locked, true ); 927 QString::number(info->size() ),info->dirPath(true), locked, true );
928 928
929 } 929 }
930} 930}
931 931
932void OFileSelector::setShowDirs(bool dir ) 932void OFileSelector::setShowDirs(bool dir )
933{ 933{
934 m_dir = dir; 934 m_dir = dir;
935 reparse(); 935 reparse();
936} 936}
937 937
938void OFileSelector::slotFileSelected(const QString &string ) 938void OFileSelector::slotFileSelected(const QString &string )
939{ 939{
940 if(m_shLne ) 940 if(m_shLne )
941 m_edit->setText( string ); 941 m_edit->setText( string );
942 942
943 emit fileSelected( string ); 943 emit fileSelected( string );
944 // do AppLnk stuff 944 // do AppLnk stuff
945} 945}
946 946
947void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 947void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
948{ 948{
949 slotFileSelected(lnk.name() ); 949 slotFileSelected(lnk.name() );
950 emit fileSelected( lnk ); 950 emit fileSelected( lnk );
951} 951}
952 952
953void OFileSelector::slotSelectionChanged() // get the current items 953void OFileSelector::slotSelectionChanged() // get the current items
954 // fixme 954 // fixme
955{ 955{
956 qWarning("selection changed" ); 956 qWarning("selection changed" );
957} 957}
958 958
959void OFileSelector::slotCurrentChanged(QListViewItem *item ) 959void OFileSelector::slotCurrentChanged(QListViewItem *item )
960{ 960{
961// qWarning("current changed" ); 961// qWarning("current changed" );
962 if( item == 0 ) 962 if( item == 0 )
963 return; 963 return;
964 964
965 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 965 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
966 OFileSelectorItem *sel = (OFileSelectorItem*)item; 966 OFileSelectorItem *sel = (OFileSelectorItem*)item;
967 if(!sel->isDir() ){ 967 if(!sel->isDir() ){
968// qWarning("is not dir" ); 968// qWarning("is not dir" );
969 if(m_shLne ){ 969 if(m_shLne ){
970 m_edit->setText(sel->text(1) ); 970 m_edit->setText(sel->text(1) );
971// qWarning("setTexy" ); 971// qWarning("setTexy" );
972 } 972 }
973 } 973 }
974 }else { 974 }else {
975 qWarning("mode not extended" ); 975 qWarning("mode not extended" );
976 } 976 }
977} 977}
978 978
979// either select or change dir 979// either select or change dir
980void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &point, int ) 980void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &/*point*/, int )
981{ 981{
982 if( item == 0 ) 982 if( item == 0 )
983 return; 983 return;
984 984
985 if( button != Qt::LeftButton ) 985 if( button != Qt::LeftButton )
986 return; 986 return;
987 987
988// qWarning("clicked" ); 988// qWarning("clicked" );
989 if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 989 if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
990// qWarning("inside" ); 990// qWarning("inside" );
991 OFileSelectorItem *sel = (OFileSelectorItem*)item; 991 OFileSelectorItem *sel = (OFileSelectorItem*)item;
992 if(!sel->isLocked() ){ // not locked either changedir or open 992 if(!sel->isLocked() ){ // not locked either changedir or open
993 QStringList str = QStringList::split("->", sel->text(1) ); 993 QStringList str = QStringList::split("->", sel->text(1) );
994 if(sel->isDir() ){ 994 if(sel->isDir() ){
995 cd( sel->directory() + "/" + str[0] ); 995 cd( sel->directory() + "/" + str[0] );
996 } else { 996 } else {
997// qWarning("file" ); 997// qWarning("file" );
998 if(m_shLne ) 998 if(m_shLne )
999 m_edit->setText(str[0] ); 999 m_edit->setText(str[0] );
1000 emit fileSelected(str[0] ); 1000 emit fileSelected(str[0] );
1001 // emit DocLnk need to do it 1001 // emit DocLnk need to do it
1002 } 1002 }
1003 } else { 1003 } else {
1004 qWarning( "locked" ); 1004 qWarning( "locked" );
1005 } 1005 }
1006 }; 1006 };
1007} 1007}
1008 1008
1009void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) 1009void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int )
1010{ 1010{
1011 if (item == 0 ) 1011 if (item == 0 )
1012 return; 1012 return;
1013 1013
1014 if( button != Qt::RightButton ) 1014 if( button != Qt::RightButton )
1015 return; 1015 return;
1016// qWarning("right button" ); 1016// qWarning("right button" );
1017 slotContextMenu(item); 1017 slotContextMenu(item);
1018} 1018}
1019 1019
1020void OFileSelector::slotContextMenu(QListViewItem *item) 1020void OFileSelector::slotContextMenu(QListViewItem *item)
1021{ 1021{
1022// qWarning("context menu" ); 1022// qWarning("context menu" );
1023 if( item ==0 || !m_showPopup ) 1023 if( item ==0 || !m_showPopup )
1024 return; 1024 return;
1025 1025
1026 if( m_custom !=0){ 1026 if( m_custom !=0){
1027 m_custom->exec(); 1027 m_custom->exec();
1028 }else{ 1028 }else{
1029 QPopupMenu menu; 1029 QPopupMenu menu;
1030 QAction up; 1030 QAction up;
1031 up.setText("cd up"); 1031 up.setText("cd up");
1032 up.addTo( &menu ); 1032 up.addTo( &menu );
1033 connect(&up, SIGNAL(activated() ), 1033 connect(&up, SIGNAL(activated() ),
1034 this, SLOT(cdUP() ) ); 1034 this, SLOT(cdUP() ) );
1035 1035
1036 QAction act; 1036 QAction act;
1037 OFileSelectorItem *sel = (OFileSelectorItem*)item; 1037 OFileSelectorItem *sel = (OFileSelectorItem*)item;
1038 if(sel->isDir() ){ 1038 if(sel->isDir() ){
1039 act.setText( tr("Change Directory") ); 1039 act.setText( tr("Change Directory") );
1040 act.addTo(&menu ); 1040 act.addTo(&menu );
1041 connect(&act, SIGNAL(activated() ), 1041 connect(&act, SIGNAL(activated() ),
1042 this, SLOT(slotChangedDir() ) ); 1042 this, SLOT(slotChangedDir() ) );
1043 }else{ 1043 }else{
1044 act.setText( tr("Open file" ) ); 1044 act.setText( tr("Open file" ) );
diff --git a/libopie/ofileview.h b/libopie/ofileview.h
index 48a71ca..ed256f1 100644
--- a/libopie/ofileview.h
+++ b/libopie/ofileview.h
@@ -1,79 +1,79 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> 3             .=l. Copyright (c) 2002 zecke <zecke@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 5 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef ofileview_h 29#ifndef ofileview_h
30#define ofileview_h 30#define ofileview_h
31 31
32#include <qobject.h> 32#include <qobject.h>
33#include <qwidget.h> 33#include <qwidget.h>
34 34
35class QFileInfo; 35class QFileInfo;
36class QDir; 36class QDir;
37class DocLnk; 37class DocLnk;
38class OFileSelectorView : public QWidget { 38class OFileSelectorView : public QWidget {
39 Q_OBJECT 39 Q_OBJECT
40 public: 40 public:
41 OFileSelectorView(QWidget *widget, 41 OFileSelectorView(QWidget *widget,
42 const char *name ) 42 const char *name )
43 : QWidget(widget, name ) 43 : QWidget(widget, name )
44{ }; 44{ };
45 virtual ~OFileSelectorView(); 45 virtual ~OFileSelectorView() = 0;
46 46
47 virtual void addFile(const QString &mine, 47 virtual void addFile(const QString &mine,
48 QFileInfo *info, 48 QFileInfo *info,
49 bool isSymlink = FALSE ) = 0; 49 bool isSymlink = FALSE ) = 0;
50 50
51 virtual void addDir (const QString &mine, 51 virtual void addDir (const QString &mine,
52 QFileInfo *info, 52 QFileInfo *info,
53 bool isSymlink = FALSE ) = 0; 53 bool isSymlink = FALSE ) = 0;
54 54
55 virtual void addSymlink(const QString &mime, 55 virtual void addSymlink(const QString &mime,
56 QFileInfo *info, 56 QFileInfo *info,
57 bool isSymlink = FALSE ) = 0; 57 bool isSymlink = FALSE ) = 0;
58 58
59 virtual void cd(const QString &path ); 59 virtual void cd(const QString &path ) = 0;
60 signals: 60 signals:
61 void fileSelected(const QString &); 61 void fileSelected(const QString &);
62 void fileSelected(const DocLnk & ); 62 void fileSelected(const DocLnk & );
63 void contextMenu(); 63 void contextMenu();
64 void changedDir(const QString &); 64 void changedDir(const QString &);
65 void changedDir(const QDir & ); 65 void changedDir(const QDir & );
66}; 66};
67 67
68class OFileViewFactory { 68class OFileViewFactory {
69 // Q_OBJECT 69 // Q_OBJECT
70 public: 70 public:
71 OFileViewFactory() {} ; 71 OFileViewFactory() {} ;
72 virtual ~OFileViewFactory(); 72 virtual ~OFileViewFactory() = 0;
73 73
74 OFileSelectorView* newView(QWidget *parent, const char *name ); 74 OFileSelectorView* newView(QWidget *parent, const char *name );
75 QString name()const; 75 QString name()const;
76}; 76};
77 77
78 78
79#endif 79#endif