author | llornkcor <llornkcor> | 2002-06-05 00:54:49 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-05 00:54:49 (UTC) |
commit | 74b847188b101e34f9e36aa1323c77fa917f580a (patch) (unidiff) | |
tree | 35deac521ad103a4a256e098030333a736c924a5 | |
parent | ae8f8f544ddb0bf598cd709176f533e5a1a913c5 (diff) | |
download | opie-74b847188b101e34f9e36aa1323c77fa917f580a.zip opie-74b847188b101e34f9e36aa1323c77fa917f580a.tar.gz opie-74b847188b101e34f9e36aa1323c77fa917f580a.tar.bz2 |
fixed bug with keyboard cmmds interfere with typing into the combo box, use new OPIEDIR icon, fixed bug with ftp tab not showing ;)
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 137 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.pro | 2 |
2 files changed, 84 insertions, 55 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index a000e9b..ebd7fc3 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,859 +1,881 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #define DEVELOPERS_VERSION | 12 | #define DEVELOPERS_VERSION |
13 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties | 13 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties |
14 | 14 | ||
15 | #include "advancedfm.h" | 15 | #include "advancedfm.h" |
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | #include "filePermissions.h" | 17 | #include "filePermissions.h" |
18 | #include "output.h" | 18 | #include "output.h" |
19 | 19 | ||
20 | #include <opie/ofileselector.h> | ||
21 | #include <opie/ofiledialog.h> | ||
22 | |||
23 | |||
20 | #include <qpe/lnkproperties.h> | 24 | #include <qpe/lnkproperties.h> |
21 | #include <qpe/filemanager.h> | 25 | #include <qpe/filemanager.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpemenubar.h> | 27 | #include <qpe/qpemenubar.h> |
24 | #include <qpe/qpetoolbar.h> | 28 | #include <qpe/qpetoolbar.h> |
25 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 31 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
29 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
30 | #include <qpe/applnk.h> | 34 | #include <qpe/applnk.h> |
31 | #include <qpe/ir.h> | 35 | #include <qpe/ir.h> |
32 | 36 | ||
33 | //#include <opie/ofileselector.h> | 37 | //#include <opie/ofileselector.h> |
34 | #include <qmultilineedit.h> | 38 | #include <qmultilineedit.h> |
35 | 39 | ||
36 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
37 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
38 | #include <qtoolbutton.h> | 42 | #include <qtoolbutton.h> |
39 | #include <qdatetime.h> | 43 | #include <qdatetime.h> |
40 | #include <qdir.h> | 44 | #include <qdir.h> |
41 | #include <qfile.h> | 45 | #include <qfile.h> |
42 | #include <qstring.h> | 46 | #include <qstring.h> |
43 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
44 | #include <qpopupmenu.h> | 48 | #include <qpopupmenu.h> |
45 | #include <qlistview.h> | 49 | #include <qlistview.h> |
46 | #include <qmainwindow.h> | 50 | #include <qmainwindow.h> |
47 | #include <qlabel.h> | 51 | #include <qlabel.h> |
48 | #include <qprogressbar.h> | 52 | #include <qprogressbar.h> |
49 | #include <qspinbox.h> | 53 | #include <qspinbox.h> |
50 | #include <qtabwidget.h> | 54 | #include <qtabwidget.h> |
51 | #include <qwidget.h> | 55 | #include <qwidget.h> |
52 | #include <qlayout.h> | 56 | #include <qlayout.h> |
53 | #include <qimage.h> | 57 | #include <qimage.h> |
54 | #include <qpixmap.h> | 58 | #include <qpixmap.h> |
55 | #include <qmessagebox.h> | 59 | #include <qmessagebox.h> |
56 | #include <qlineedit.h> | 60 | #include <qlineedit.h> |
57 | #include <qregexp.h> | 61 | #include <qregexp.h> |
58 | 62 | ||
59 | #include <unistd.h> | 63 | #include <unistd.h> |
60 | #include <stdlib.h> | 64 | #include <stdlib.h> |
61 | #include <sys/stat.h> | 65 | #include <sys/stat.h> |
62 | #include <dirent.h> | 66 | #include <dirent.h> |
63 | #include <stdio.h> | 67 | #include <stdio.h> |
64 | #include <time.h> | 68 | #include <time.h> |
65 | #include <fcntl.h> | 69 | #include <fcntl.h> |
66 | #include <mntent.h> | 70 | #include <mntent.h> |
67 | #include <string.h> | 71 | #include <string.h> |
68 | #include <errno.h> | 72 | #include <errno.h> |
69 | 73 | ||
70 | AdvancedFm::AdvancedFm( ) | 74 | AdvancedFm::AdvancedFm( ) |
71 | : QMainWindow( ) | 75 | : QMainWindow( ) |
72 | { | 76 | { |
73 | setCaption( tr( "AdvancedFm" ) ); | 77 | setCaption( tr( "AdvancedFm" ) ); |
74 | // menuTimer( this ); | 78 | // menuTimer( this ); |
75 | 79 | ||
76 | QGridLayout *layout = new QGridLayout( this ); | 80 | QGridLayout *layout = new QGridLayout( this ); |
77 | layout->setSpacing( 2); | 81 | layout->setSpacing( 2); |
78 | layout->setMargin( 2); | 82 | layout->setMargin( 2); |
79 | 83 | ||
80 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 84 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
81 | 85 | ||
82 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 86 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
83 | // fileMenu = new QPopupMenu( this ); | 87 | // fileMenu = new QPopupMenu( this ); |
84 | fileMenu = new QPopupMenu( this ); | 88 | fileMenu = new QPopupMenu( this ); |
85 | viewMenu = new QPopupMenu( this ); | 89 | viewMenu = new QPopupMenu( this ); |
86 | 90 | ||
87 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 91 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
88 | 92 | ||
89 | menuBar->insertItem( tr( "File" ), fileMenu); | 93 | menuBar->insertItem( tr( "File" ), fileMenu); |
90 | menuBar->insertItem( tr( "View" ), viewMenu); | 94 | menuBar->insertItem( tr( "View" ), viewMenu); |
91 | 95 | ||
92 | qpeDirButton= new QPushButton(Resource::loadIconSet("go"),"",this,"QPEButton"); | 96 | qpeDirButton= new QPushButton(Resource::loadIconSet("launcher/opielogo16x16"),"",this,"QPEButton"); |
93 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 97 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
94 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 98 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
95 | qpeDirButton->setFlat(TRUE); | 99 | qpeDirButton->setFlat(TRUE); |
96 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 100 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); |
97 | 101 | ||
98 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); | 102 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); |
99 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 103 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
100 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 104 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
101 | cfButton->setFlat(TRUE); | 105 | cfButton->setFlat(TRUE); |
102 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 106 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
103 | 107 | ||
104 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); | 108 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); |
105 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 109 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
106 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 110 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
107 | sdButton->setFlat(TRUE); | 111 | sdButton->setFlat(TRUE); |
108 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 112 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
109 | 113 | ||
110 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | 114 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); |
111 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 115 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
112 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 116 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
113 | cdUpButton ->setFlat(TRUE); | 117 | cdUpButton ->setFlat(TRUE); |
114 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | 118 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
115 | 119 | ||
116 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 120 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
117 | docButton->setFixedSize( QSize( 20, 20 ) ); | 121 | docButton->setFixedSize( QSize( 20, 20 ) ); |
118 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 122 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
119 | docButton->setFlat(TRUE); | 123 | docButton->setFlat(TRUE); |
120 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 124 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
121 | 125 | ||
122 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 126 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); |
123 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 127 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
124 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 128 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
125 | homeButton->setFlat(TRUE); | 129 | homeButton->setFlat(TRUE); |
126 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 130 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
127 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 131 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
128 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 132 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
129 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 133 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
130 | 134 | ||
131 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 135 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
132 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 136 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
133 | fileMenu->insertSeparator(); | 137 | fileMenu->insertSeparator(); |
134 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 138 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
135 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 139 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
136 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 140 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
137 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 141 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
138 | fileMenu->insertSeparator(); | 142 | fileMenu->insertSeparator(); |
139 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 143 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
140 | fileMenu->setCheckable(TRUE); | 144 | fileMenu->setCheckable(TRUE); |
141 | 145 | ||
142 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 146 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
143 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 147 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
144 | viewMenu->insertSeparator(); | 148 | viewMenu->insertSeparator(); |
145 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 149 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
146 | viewMenu->setCheckable(TRUE); | 150 | viewMenu->setCheckable(TRUE); |
147 | 151 | ||
148 | 152 | ||
149 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 153 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
150 | currentPathCombo->setEditable(TRUE); | 154 | currentPathCombo->setEditable(TRUE); |
151 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 155 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
152 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 156 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
153 | 157 | ||
154 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 158 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
155 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 159 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
156 | 160 | ||
157 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 161 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
158 | this,SLOT(currentPathComboChanged())); | 162 | this,SLOT(currentPathComboChanged())); |
159 | 163 | ||
160 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 164 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
161 | 165 | ||
162 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 166 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
163 | 167 | ||
164 | 168 | ||
165 | TabWidget = new QTabWidget( this, "TabWidget" ); | 169 | TabWidget = new QTabWidget( this, "TabWidget" ); |
166 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); | 170 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); |
167 | 171 | ||
168 | tab = new QWidget( TabWidget, "tab" ); | 172 | tab = new QWidget( TabWidget, "tab" ); |
169 | tabLayout = new QGridLayout( tab ); | 173 | tabLayout = new QGridLayout( tab ); |
170 | tabLayout->setSpacing( 2); | 174 | tabLayout->setSpacing( 2); |
171 | tabLayout->setMargin( 2); | 175 | tabLayout->setMargin( 2); |
172 | 176 | ||
173 | Local_View = new QListView( tab, "Local_View" ); | 177 | Local_View = new QListView( tab, "Local_View" ); |
174 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 178 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
175 | Local_View->addColumn( tr("File"),130); | 179 | Local_View->addColumn( tr("File"),130); |
176 | Local_View->addColumn( tr("Size"),-1); | 180 | Local_View->addColumn( tr("Size"),-1); |
177 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 181 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
178 | Local_View->addColumn( tr("Date"),-1); | 182 | Local_View->addColumn( tr("Date"),-1); |
179 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 183 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
180 | Local_View->setAllColumnsShowFocus(TRUE); | 184 | Local_View->setAllColumnsShowFocus(TRUE); |
181 | Local_View->setMultiSelection( TRUE ); | 185 | Local_View->setMultiSelection( TRUE ); |
182 | Local_View->setSelectionMode(QListView::Extended); | 186 | Local_View->setSelectionMode(QListView::Extended); |
183 | 187 | ||
184 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 188 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
185 | 189 | ||
186 | 190 | ||
187 | 191 | ||
188 | tabLayout->addWidget( Local_View, 0, 0 ); | 192 | tabLayout->addWidget( Local_View, 0, 0 ); |
189 | 193 | ||
190 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 194 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
191 | this,SLOT( localListClicked(QListViewItem *)) ); | 195 | this,SLOT( localListClicked(QListViewItem *)) ); |
192 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 196 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
193 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 197 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
198 | |||
194 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 199 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
195 | 200 | ||
196 | TabWidget->insertTab( tab, tr("1")); | 201 | TabWidget->insertTab( tab, tr("1")); |
197 | 202 | ||
198 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 203 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
199 | tabLayout_2 = new QGridLayout( tab_2 ); | 204 | tabLayout_2 = new QGridLayout( tab_2 ); |
200 | tabLayout_2->setSpacing( 2); | 205 | tabLayout_2->setSpacing( 2); |
201 | tabLayout_2->setMargin( 2); | 206 | tabLayout_2->setMargin( 2); |
202 | 207 | ||
203 | Remote_View = new QListView( tab_2, "Remote_View" ); | 208 | Remote_View = new QListView( tab_2, "Remote_View" ); |
204 | Remote_View->addColumn( tr("File"),130); | 209 | Remote_View->addColumn( tr("File"),130); |
205 | Remote_View->addColumn( tr("Size"),-1); | 210 | Remote_View->addColumn( tr("Size"),-1); |
206 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 211 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
207 | Remote_View->addColumn( tr("Date"),-1); | 212 | Remote_View->addColumn( tr("Date"),-1); |
208 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 213 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
209 | Remote_View->setAllColumnsShowFocus(TRUE); | 214 | Remote_View->setAllColumnsShowFocus(TRUE); |
210 | Remote_View->setMultiSelection( TRUE ); | 215 | Remote_View->setMultiSelection( TRUE ); |
211 | Remote_View->setSelectionMode(QListView::Extended); | 216 | Remote_View->setSelectionMode(QListView::Extended); |
212 | 217 | ||
213 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 218 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
214 | 219 | ||
215 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 220 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
216 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 221 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
217 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 222 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
218 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 223 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
219 | connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 224 | // connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
220 | 225 | ||
221 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 226 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
222 | 227 | ||
223 | TabWidget->insertTab( tab_2, tr( "2")); | 228 | TabWidget->insertTab( tab_2, tr( "2")); |
224 | 229 | ||
225 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 230 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
226 | this,SLOT(tabChanged(QWidget*))); | 231 | this,SLOT(tabChanged(QWidget*))); |
227 | 232 | ||
228 | // tab_3 = new QWidget( TabWidget, "tab_3" ); | 233 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
229 | // tabLayout_3 = new QGridLayout( tab_3 ); | 234 | tabLayout_3 = new QGridLayout( tab_3 ); |
230 | // tabLayout_3->setSpacing( 2); | 235 | tabLayout_3->setSpacing( 2); |
231 | // tabLayout_3->setMargin( 2); | 236 | tabLayout_3->setMargin( 2); |
237 | |||
238 | |||
239 | // OFileDialog fileDialog; | ||
240 | // fileDialog; | ||
241 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | ||
242 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | ||
243 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | ||
232 | 244 | ||
233 | // OFileSelector *fileSelector; | 245 | QListView *fileTree; |
234 | // fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); | 246 | fileTree = new QListView( tab_3, "tree" ); |
235 | // tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); | ||
236 | 247 | ||
237 | // TabWidget->insertTab( tab_3, tr( "Files" ) ); | 248 | |
249 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | ||
238 | 250 | ||
251 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | ||
252 | /////////////// | ||
253 | |||
254 | //////////////////// | ||
255 | |||
256 | |||
239 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 257 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
240 | currentDir.setPath( QDir::currentDirPath()); | 258 | currentDir.setPath( QDir::currentDirPath()); |
241 | 259 | ||
242 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 260 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
243 | currentRemoteDir.setPath( QDir::currentDirPath()); | 261 | currentRemoteDir.setPath( QDir::currentDirPath()); |
244 | 262 | ||
245 | b = TRUE; | 263 | b = TRUE; |
246 | 264 | ||
247 | filterStr="*"; | 265 | filterStr="*"; |
248 | b=FALSE; | 266 | b=FALSE; |
249 | 267 | ||
250 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 268 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); |
251 | 269 | ||
252 | populateLocalView(); | 270 | populateLocalView(); |
253 | populateRemoteView(); | 271 | populateRemoteView(); |
272 | currentPathCombo->setFocus(); | ||
254 | } | 273 | } |
255 | 274 | ||
256 | AdvancedFm::~AdvancedFm() | 275 | AdvancedFm::~AdvancedFm() |
257 | { | 276 | { |
258 | } | 277 | } |
259 | 278 | ||
260 | void AdvancedFm::cleanUp() | 279 | void AdvancedFm::cleanUp() |
261 | { | 280 | { |
262 | QString sfile=QDir::homeDirPath(); | 281 | QString sfile=QDir::homeDirPath(); |
263 | if(sfile.right(1) != "/") | 282 | if(sfile.right(1) != "/") |
264 | sfile+="/._temp"; | 283 | sfile+="/._temp"; |
265 | else | 284 | else |
266 | sfile+="._temp"; | 285 | sfile+="._temp"; |
267 | QFile file( sfile); | 286 | QFile file( sfile); |
268 | if(file.exists()) | 287 | if(file.exists()) |
269 | file.remove(); | 288 | file.remove(); |
270 | } | 289 | } |
271 | 290 | ||
272 | void AdvancedFm::tabChanged(QWidget *w) | 291 | void AdvancedFm::tabChanged(QWidget *w) |
273 | { | 292 | { |
274 | if (TabWidget->currentPageIndex() == 0) { | 293 | if (TabWidget->currentPageIndex() == 0) { |
275 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 294 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
276 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 295 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
277 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 296 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
278 | } | 297 | } |
279 | if (TabWidget->currentPageIndex() == 1) { | 298 | if (TabWidget->currentPageIndex() == 1) { |
280 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 299 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
281 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 300 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
282 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 301 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
283 | } | 302 | } |
284 | } | 303 | } |
285 | 304 | ||
286 | 305 | ||
287 | void AdvancedFm::populateLocalView() | 306 | void AdvancedFm::populateLocalView() |
288 | { | 307 | { |
289 | QPixmap pm; | 308 | QPixmap pm; |
290 | Local_View->clear(); | 309 | Local_View->clear(); |
291 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 310 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
292 | currentDir.setMatchAllDirs(TRUE); | 311 | currentDir.setMatchAllDirs(TRUE); |
293 | currentDir.setNameFilter(filterStr); | 312 | currentDir.setNameFilter(filterStr); |
294 | QString fileL, fileS, fileDate; | 313 | QString fileL, fileS, fileDate; |
295 | // qDebug(currentDir.canonicalPath()); | 314 | // qDebug(currentDir.canonicalPath()); |
296 | // struct stat buf; | 315 | // struct stat buf; |
297 | // mode_t mode; | 316 | // mode_t mode; |
298 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 317 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
299 | setCaption("AdvancedFm :: "+fs); | 318 | setCaption("AdvancedFm :: "+fs); |
300 | bool isDir=FALSE; | 319 | bool isDir=FALSE; |
301 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 320 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
302 | QFileInfoListIterator it(*list); | 321 | QFileInfoListIterator it(*list); |
303 | QFileInfo *fi; | 322 | QFileInfo *fi; |
304 | while ( (fi=it.current()) ) { | 323 | while ( (fi=it.current()) ) { |
305 | if (fi->isSymLink() ) { | 324 | if (fi->isSymLink() ) { |
306 | QString symLink=fi->readLink(); | 325 | QString symLink=fi->readLink(); |
307 | // qDebug("Symlink detected "+symLink); | 326 | // qDebug("Symlink detected "+symLink); |
308 | QFileInfo sym( symLink); | 327 | QFileInfo sym( symLink); |
309 | fileS.sprintf( "%10li", sym.size() ); | 328 | fileS.sprintf( "%10li", sym.size() ); |
310 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 329 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
311 | fileDate = sym.lastModified().toString(); | 330 | fileDate = sym.lastModified().toString(); |
312 | } else { | 331 | } else { |
313 | fileS.sprintf( "%10li", fi->size() ); | 332 | fileS.sprintf( "%10li", fi->size() ); |
314 | fileL.sprintf( "%s",fi->fileName().data() ); | 333 | fileL.sprintf( "%s",fi->fileName().data() ); |
315 | fileDate= fi->lastModified().toString(); | 334 | fileDate= fi->lastModified().toString(); |
316 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 335 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
317 | fileL+="/"; | 336 | fileL+="/"; |
318 | isDir=TRUE; | 337 | isDir=TRUE; |
319 | // qDebug( fileL); | 338 | // qDebug( fileL); |
320 | } | 339 | } |
321 | } | 340 | } |
322 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 341 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
323 | if(fileL !="./" && fi->exists()) { | 342 | if(fileL !="./" && fi->exists()) { |
324 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 343 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
325 | 344 | ||
326 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 345 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
327 | 346 | ||
328 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 347 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
329 | pm = Resource::loadPixmap( "lockedfolder" ); | 348 | pm = Resource::loadPixmap( "lockedfolder" ); |
330 | else | 349 | else |
331 | pm= Resource::loadPixmap( "folder" ); | 350 | pm= Resource::loadPixmap( "folder" ); |
332 | // item->setPixmap( 0,pm ); | 351 | // item->setPixmap( 0,pm ); |
333 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 352 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
334 | pm = Resource::loadPixmap( "exec"); | 353 | pm = Resource::loadPixmap( "exec"); |
335 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 354 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
336 | | fileInfo.permission( QFileInfo::ExeGroup) | 355 | | fileInfo.permission( QFileInfo::ExeGroup) |
337 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 356 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
338 | pm = Resource::loadPixmap( "exec"); | 357 | pm = Resource::loadPixmap( "exec"); |
339 | // else { //is exec | 358 | // else { //is exec |
340 | // pm = Resource::loadPixmap( "exec"); | 359 | // pm = Resource::loadPixmap( "exec"); |
341 | // } | 360 | // } |
342 | // // item->setPixmap( 0,pm); | 361 | // // item->setPixmap( 0,pm); |
343 | } else if( !fi->isReadable() ) { | 362 | } else if( !fi->isReadable() ) { |
344 | pm = Resource::loadPixmap( "locked" ); | 363 | pm = Resource::loadPixmap( "locked" ); |
345 | // item->setPixmap( 0,pm); | 364 | // item->setPixmap( 0,pm); |
346 | } else { //everything else goes by mimetype | 365 | } else { //everything else goes by mimetype |
347 | MimeType mt(fi->filePath()); | 366 | MimeType mt(fi->filePath()); |
348 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 367 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
349 | if(pm.isNull()) | 368 | if(pm.isNull()) |
350 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 369 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
351 | // item->setPixmap( 0,pm); | 370 | // item->setPixmap( 0,pm); |
352 | } | 371 | } |
353 | item->setPixmap( 0,pm); | 372 | item->setPixmap( 0,pm); |
354 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 373 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
355 | // overlay link image | 374 | // overlay link image |
356 | pm= Resource::loadPixmap( "folder" ); | 375 | pm= Resource::loadPixmap( "folder" ); |
357 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 376 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
358 | QPainter painter( &pm ); | 377 | QPainter painter( &pm ); |
359 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 378 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
360 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 379 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
361 | item->setPixmap( 0, pm); | 380 | item->setPixmap( 0, pm); |
362 | } | 381 | } |
363 | } | 382 | } |
364 | isDir=FALSE; | 383 | isDir=FALSE; |
365 | ++it; | 384 | ++it; |
366 | } | 385 | } |
367 | 386 | ||
368 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 387 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
369 | struct stat buf; | 388 | struct stat buf; |
370 | // struct stat st; | 389 | // struct stat st; |
371 | dev_t devT; | 390 | dev_t devT; |
372 | // mode_t mode; | 391 | // mode_t mode; |
373 | DIR *dir; | 392 | DIR *dir; |
374 | // int fd = 0; | 393 | // int fd = 0; |
375 | struct dirent *mydirent; | 394 | struct dirent *mydirent; |
376 | // int i = 1; | 395 | // int i = 1; |
377 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 396 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
378 | while ((mydirent = readdir(dir)) != NULL) { | 397 | while ((mydirent = readdir(dir)) != NULL) { |
379 | lstat( mydirent->d_name, &buf); | 398 | lstat( mydirent->d_name, &buf); |
380 | qDebug(mydirent->d_name); | 399 | qDebug(mydirent->d_name); |
381 | // mode = buf.st_mode; | 400 | // mode = buf.st_mode; |
382 | fileL.sprintf("%s", mydirent->d_name); | 401 | fileL.sprintf("%s", mydirent->d_name); |
383 | // fileS.sprintf("%d, %d", ); //this isn't correct | 402 | // fileS.sprintf("%d, %d", ); //this isn't correct |
384 | devT = buf.st_dev; | 403 | devT = buf.st_dev; |
385 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 404 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
386 | // fileS.sprintf("%d,%d", devT, devT); | 405 | // fileS.sprintf("%d,%d", devT, devT); |
387 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 406 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
388 | if( fileL.find(".") == -1 ){ | 407 | if( fileL.find(".") == -1 ){ |
389 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 408 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); |
390 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 409 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
391 | item->setPixmap( 0,pm); | 410 | item->setPixmap( 0,pm); |
392 | } | 411 | } |
393 | } | 412 | } |
394 | 413 | ||
395 | closedir(dir); | 414 | closedir(dir); |
396 | } | 415 | } |
397 | 416 | ||
398 | Local_View->setSorting( 3,FALSE); | 417 | Local_View->setSorting( 3,FALSE); |
399 | fillCombo( (const QString &) currentDir.canonicalPath()); | 418 | fillCombo( (const QString &) currentDir.canonicalPath()); |
400 | } | 419 | } |
401 | 420 | ||
402 | 421 | ||
403 | void AdvancedFm::populateRemoteView() | 422 | void AdvancedFm::populateRemoteView() |
404 | { | 423 | { |
405 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 424 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
406 | // QListViewItemIterator it( Remote_View ); | 425 | // QListViewItemIterator it( Remote_View ); |
407 | // for ( ; it.current(); ++it ) { | 426 | // for ( ; it.current(); ++it ) { |
408 | // if ( it.current()->isSelected() ) { | 427 | // if ( it.current()->isSelected() ) { |
409 | // QString strItem = it.current()->text(0); | 428 | // QString strItem = it.current()->text(0); |
410 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; | 429 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; |
411 | // QFileInfo fi(localFile); | 430 | // QFileInfo fi(localFile); |
412 | // } | 431 | // } |
413 | // } | 432 | // } |
414 | QPixmap pm; | 433 | QPixmap pm; |
415 | Remote_View->clear(); | 434 | Remote_View->clear(); |
416 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 435 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
417 | currentRemoteDir.setMatchAllDirs(TRUE); | 436 | currentRemoteDir.setMatchAllDirs(TRUE); |
418 | currentRemoteDir.setNameFilter(filterStr); | 437 | currentRemoteDir.setNameFilter(filterStr); |
419 | QString fileL, fileS, fileDate; | 438 | QString fileL, fileS, fileDate; |
420 | 439 | ||
421 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 440 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
422 | setCaption("AdvancedFm :: "+fs); | 441 | setCaption("AdvancedFm :: "+fs); |
423 | bool isDir=FALSE; | 442 | bool isDir=FALSE; |
424 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 443 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
425 | QFileInfoListIterator it(*list); | 444 | QFileInfoListIterator it(*list); |
426 | QFileInfo *fi; | 445 | QFileInfo *fi; |
427 | while ( (fi=it.current()) ) { | 446 | while ( (fi=it.current()) ) { |
428 | if (fi->isSymLink() ){ | 447 | if (fi->isSymLink() ){ |
429 | QString symLink=fi->readLink(); | 448 | QString symLink=fi->readLink(); |
430 | // qDebug("Symlink detected "+symLink); | 449 | // qDebug("Symlink detected "+symLink); |
431 | QFileInfo sym( symLink); | 450 | QFileInfo sym( symLink); |
432 | fileS.sprintf( "%10li", sym.size() ); | 451 | fileS.sprintf( "%10li", sym.size() ); |
433 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 452 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
434 | fileDate = sym.lastModified().toString(); | 453 | fileDate = sym.lastModified().toString(); |
435 | } else { | 454 | } else { |
436 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 455 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
437 | fileS.sprintf( "%10li", fi->size() ); | 456 | fileS.sprintf( "%10li", fi->size() ); |
438 | fileL.sprintf( "%s",fi->fileName().data() ); | 457 | fileL.sprintf( "%s",fi->fileName().data() ); |
439 | fileDate= fi->lastModified().toString(); | 458 | fileDate= fi->lastModified().toString(); |
440 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 459 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
441 | fileL+="/"; | 460 | fileL+="/"; |
442 | isDir=TRUE; | 461 | isDir=TRUE; |
443 | // qDebug( fileL); | 462 | // qDebug( fileL); |
444 | } | 463 | } |
445 | } | 464 | } |
446 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); | 465 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); |
447 | if(fileL !="./" && fi->exists()) { | 466 | if(fileL !="./" && fi->exists()) { |
448 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 467 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
449 | QPixmap pm; | 468 | QPixmap pm; |
450 | 469 | ||
451 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 470 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
452 | if( !QDir( fi->filePath() ).isReadable()) | 471 | if( !QDir( fi->filePath() ).isReadable()) |
453 | pm = Resource::loadPixmap( "lockedfolder" ); | 472 | pm = Resource::loadPixmap( "lockedfolder" ); |
454 | else | 473 | else |
455 | pm= Resource::loadPixmap( "folder" ); | 474 | pm= Resource::loadPixmap( "folder" ); |
456 | // item->setPixmap( 0,pm ); | 475 | // item->setPixmap( 0,pm ); |
457 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 476 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
458 | pm = Resource::loadPixmap( "exec"); | 477 | pm = Resource::loadPixmap( "exec"); |
459 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 478 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
460 | | fileInfo.permission( QFileInfo::ExeGroup) | 479 | | fileInfo.permission( QFileInfo::ExeGroup) |
461 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 480 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
462 | pm = Resource::loadPixmap( "exec"); | 481 | pm = Resource::loadPixmap( "exec"); |
463 | // item->setPixmap( 0,pm); | 482 | // item->setPixmap( 0,pm); |
464 | } else if( !fi->isReadable() ) { | 483 | } else if( !fi->isReadable() ) { |
465 | pm = Resource::loadPixmap( "locked" ); | 484 | pm = Resource::loadPixmap( "locked" ); |
466 | // item->setPixmap( 0,pm); | 485 | // item->setPixmap( 0,pm); |
467 | } else { | 486 | } else { |
468 | MimeType mt(fi->filePath()); | 487 | MimeType mt(fi->filePath()); |
469 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 488 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
470 | if(pm.isNull()) | 489 | if(pm.isNull()) |
471 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 490 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
472 | // item->setPixmap( 0,pm); | 491 | // item->setPixmap( 0,pm); |
473 | } | 492 | } |
474 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 493 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
475 | // overlay link image | 494 | // overlay link image |
476 | pm= Resource::loadPixmap( "folder" ); | 495 | pm= Resource::loadPixmap( "folder" ); |
477 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 496 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
478 | QPainter painter( &pm ); | 497 | QPainter painter( &pm ); |
479 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 498 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
480 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 499 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
481 | // item->setPixmap( 0, pm); | 500 | // item->setPixmap( 0, pm); |
482 | } | 501 | } |
483 | item->setPixmap( 0, pm); | 502 | item->setPixmap( 0, pm); |
484 | } | 503 | } |
485 | isDir=FALSE; | 504 | isDir=FALSE; |
486 | ++it; | 505 | ++it; |
487 | } | 506 | } |
488 | 507 | ||
489 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 508 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
490 | struct stat buf; | 509 | struct stat buf; |
491 | // struct stat st; | 510 | // struct stat st; |
492 | // mode_t mode; | 511 | // mode_t mode; |
493 | DIR *dir; | 512 | DIR *dir; |
494 | // int fd = 0; | 513 | // int fd = 0; |
495 | struct dirent *mydirent; | 514 | struct dirent *mydirent; |
496 | // int i = 1; | 515 | // int i = 1; |
497 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 516 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
498 | while ((mydirent = readdir(dir)) != NULL) { | 517 | while ((mydirent = readdir(dir)) != NULL) { |
499 | lstat( mydirent->d_name, &buf); | 518 | lstat( mydirent->d_name, &buf); |
500 | qDebug(mydirent->d_name); | 519 | qDebug(mydirent->d_name); |
501 | // mode = buf.st_mode; | 520 | // mode = buf.st_mode; |
502 | fileL.sprintf("%s", mydirent->d_name); | 521 | fileL.sprintf("%s", mydirent->d_name); |
503 | // fileS.sprintf("%d, %d", ); //this isn't correct | 522 | // fileS.sprintf("%d, %d", ); //this isn't correct |
504 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 523 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
505 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 524 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
506 | if( fileL.find(".") == -1 ){ | 525 | if( fileL.find(".") == -1 ){ |
507 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 526 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
508 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 527 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
509 | item->setPixmap( 0,pm); | 528 | item->setPixmap( 0,pm); |
510 | } | 529 | } |
511 | } | 530 | } |
512 | 531 | ||
513 | closedir(dir); | 532 | closedir(dir); |
514 | } | 533 | } |
515 | 534 | ||
516 | Remote_View->setSorting( 3,FALSE); | 535 | Remote_View->setSorting( 3,FALSE); |
517 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 536 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
518 | } | 537 | } |
519 | 538 | ||
520 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) | 539 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) |
521 | { | 540 | { |
522 | if(selectedItem) { | 541 | if(selectedItem) { |
523 | QString strItem=selectedItem->text(0); | 542 | QString strItem=selectedItem->text(0); |
524 | QString strSize=selectedItem->text(1); | 543 | QString strSize=selectedItem->text(1); |
525 | strSize=strSize.stripWhiteSpace(); | 544 | strSize=strSize.stripWhiteSpace(); |
526 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 545 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
527 | // is symlink | 546 | // is symlink |
528 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 547 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
529 | if(QDir(strItem2).exists() ) { | 548 | if(QDir(strItem2).exists() ) { |
530 | currentDir.cd(strItem2, TRUE); | 549 | currentDir.cd(strItem2, TRUE); |
531 | populateLocalView(); | 550 | populateLocalView(); |
532 | } | 551 | } |
533 | } else { // not a symlink | 552 | } else { // not a symlink |
534 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 553 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
535 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 554 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
536 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 555 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
537 | currentDir.cd(strItem,FALSE); | 556 | currentDir.cd(strItem,FALSE); |
538 | populateLocalView(); | 557 | populateLocalView(); |
539 | } else { | 558 | } else { |
540 | currentDir.cdUp(); | 559 | currentDir.cdUp(); |
541 | populateLocalView(); | 560 | populateLocalView(); |
542 | } | 561 | } |
543 | if(QDir(strItem).exists()){ | 562 | if(QDir(strItem).exists()){ |
544 | currentDir.cd(strItem, TRUE); | 563 | currentDir.cd(strItem, TRUE); |
545 | populateLocalView(); | 564 | populateLocalView(); |
546 | } | 565 | } |
547 | } else { | 566 | } else { |
548 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 567 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
549 | if( QFile::exists(strItem ) ) { | 568 | if( QFile::exists(strItem ) ) { |
550 | qDebug("clicked item "+strItem); | 569 | // qDebug("clicked item "+strItem); |
551 | DocLnk doc( strItem, FALSE ); | 570 | // DocLnk doc( strItem, FALSE ); |
552 | doc.execute(); | 571 | // doc.execute(); |
553 | // Local_View->clearSelection(); | 572 | // Local_View->clearSelection(); |
554 | } | 573 | } |
555 | } //end not symlink | 574 | } //end not symlink |
556 | chdir(strItem.latin1()); | 575 | chdir(strItem.latin1()); |
557 | } | 576 | } |
558 | } | 577 | } |
559 | } | 578 | } |
560 | 579 | ||
561 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) | 580 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) |
562 | { | 581 | { |
563 | if(selectedItem) { | 582 | if(selectedItem) { |
564 | QString strItem=selectedItem->text(0); | 583 | QString strItem=selectedItem->text(0); |
565 | QString strSize=selectedItem->text(1); | 584 | QString strSize=selectedItem->text(1); |
566 | strSize=strSize.stripWhiteSpace(); | 585 | strSize=strSize.stripWhiteSpace(); |
567 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 586 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
568 | // is symlink | 587 | // is symlink |
569 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 588 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
570 | if(QDir(strItem2).exists() ) { | 589 | if(QDir(strItem2).exists() ) { |
571 | currentRemoteDir.cd(strItem2, TRUE); | 590 | currentRemoteDir.cd(strItem2, TRUE); |
572 | populateRemoteView(); | 591 | populateRemoteView(); |
573 | } | 592 | } |
574 | } else { // not a symlink | 593 | } else { // not a symlink |
575 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 594 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
576 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 595 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
577 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 596 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
578 | currentRemoteDir.cd(strItem,FALSE); | 597 | currentRemoteDir.cd(strItem,FALSE); |
579 | populateRemoteView(); | 598 | populateRemoteView(); |
580 | } else { | 599 | } else { |
581 | currentRemoteDir.cdUp(); | 600 | currentRemoteDir.cdUp(); |
582 | populateRemoteView(); | 601 | populateRemoteView(); |
583 | } | 602 | } |
584 | if(QDir(strItem).exists()){ | 603 | if(QDir(strItem).exists()){ |
585 | currentRemoteDir.cd(strItem, TRUE); | 604 | currentRemoteDir.cd(strItem, TRUE); |
586 | populateRemoteView(); | 605 | populateRemoteView(); |
587 | } | 606 | } |
588 | } else { | 607 | } else { |
589 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 608 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
590 | if( QFile::exists(strItem ) ) { | 609 | if( QFile::exists(strItem ) ) { |
591 | qDebug("clicked item "+strItem); | 610 | // qDebug("clicked item "+strItem); |
592 | DocLnk doc( strItem, FALSE ); | 611 | // DocLnk doc( strItem, FALSE ); |
593 | doc.execute(); | 612 | // doc.execute(); |
594 | // Remote_View->clearSelection(); | 613 | // Remote_View->clearSelection(); |
595 | } | 614 | } |
596 | } //end not symlink | 615 | } //end not symlink |
597 | chdir(strItem.latin1()); | 616 | chdir(strItem.latin1()); |
598 | } | 617 | } |
599 | } | 618 | } |
600 | } | 619 | } |
601 | 620 | ||
602 | void AdvancedFm::doLocalCd() | 621 | void AdvancedFm::doLocalCd() |
603 | { | 622 | { |
604 | localListClicked( Local_View->currentItem()); | 623 | localListClicked( Local_View->currentItem()); |
605 | } | 624 | } |
606 | 625 | ||
607 | void AdvancedFm::doRemoteCd() | 626 | void AdvancedFm::doRemoteCd() |
608 | { | 627 | { |
609 | localListClicked( Remote_View->currentItem()); | 628 | localListClicked( Remote_View->currentItem()); |
610 | } | 629 | } |
611 | 630 | ||
612 | void AdvancedFm::showHidden() | 631 | void AdvancedFm::showHidden() |
613 | { | 632 | { |
614 | if (b) { | 633 | if (b) { |
615 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 634 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
616 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 635 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
617 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 636 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
618 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 637 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
619 | b=FALSE; | 638 | b=FALSE; |
620 | 639 | ||
621 | } else { | 640 | } else { |
622 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 641 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
623 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 642 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
624 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 643 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
625 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 644 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
626 | b=TRUE; | 645 | b=TRUE; |
627 | } | 646 | } |
628 | populateLocalView(); | 647 | populateLocalView(); |
629 | 648 | ||
630 | } | 649 | } |
631 | 650 | ||
632 | void AdvancedFm::showRemoteHidden() | 651 | void AdvancedFm::showRemoteHidden() |
633 | { | 652 | { |
634 | if (b) { | 653 | if (b) { |
635 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 654 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
636 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); | 655 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); |
637 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 656 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
638 | b=TRUE; | 657 | b=TRUE; |
639 | 658 | ||
640 | } else { | 659 | } else { |
641 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 660 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
642 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 661 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
643 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 662 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
644 | b=FALSE; | 663 | b=FALSE; |
645 | } | 664 | } |
646 | populateRemoteView(); | 665 | populateRemoteView(); |
647 | } | 666 | } |
648 | 667 | ||
649 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 668 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
650 | { | 669 | { |
651 | switch (mouse) { | 670 | qDebug("list pressed"); |
671 | switch (mouse) { | ||
652 | case 1: | 672 | case 1: |
653 | break; | 673 | break; |
654 | case 2: | 674 | case 2: |
655 | menuTimer.start( 500, TRUE ); | 675 | menuTimer.start( 750, TRUE ); |
676 | qDebug("Start menu timer\n"); | ||
656 | break; | 677 | break; |
657 | }; | 678 | }; |
658 | } | 679 | } |
659 | 680 | ||
660 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 681 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
661 | { | 682 | { |
662 | 683 | ||
663 | switch (mouse) { | 684 | switch (mouse) { |
664 | case 1: | 685 | case 1: |
665 | break; | 686 | break; |
666 | case 2: | 687 | case 2: |
667 | menuTimer.start( 500, TRUE ); | 688 | menuTimer.start( 750, TRUE ); |
689 | qDebug("Start menu timer"); | ||
668 | break; | 690 | break; |
669 | }; | 691 | }; |
670 | } | 692 | } |
671 | 693 | ||
672 | void AdvancedFm::runThis() { | 694 | void AdvancedFm::runThis() { |
673 | // QFileInfo *fi; | 695 | // QFileInfo *fi; |
674 | QString fs; | 696 | QString fs; |
675 | if (TabWidget->currentPageIndex() == 0) { | 697 | if (TabWidget->currentPageIndex() == 0) { |
676 | QString curFile = Local_View->currentItem()->text(0); | 698 | QString curFile = Local_View->currentItem()->text(0); |
677 | if(curFile != "../") { | 699 | if(curFile != "../") { |
678 | 700 | ||
679 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 701 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
680 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 702 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
681 | qDebug( fileInfo.owner()); | 703 | qDebug( fileInfo.owner()); |
682 | if( (fileInfo.permission( QFileInfo::ExeUser) | 704 | if( (fileInfo.permission( QFileInfo::ExeUser) |
683 | | fileInfo.permission( QFileInfo::ExeGroup) | 705 | | fileInfo.permission( QFileInfo::ExeGroup) |
684 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 706 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
685 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 707 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
686 | // if( fileInfo.isExecutable() | | 708 | // if( fileInfo.isExecutable() | |
687 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 709 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
688 | e << curFile; | 710 | e << curFile; |
689 | } else { | 711 | } else { |
690 | curFile = currentDir.canonicalPath()+"/"+curFile; | 712 | curFile = currentDir.canonicalPath()+"/"+curFile; |
691 | DocLnk nf(curFile); | 713 | DocLnk nf(curFile); |
692 | QString execStr = nf.exec(); | 714 | QString execStr = nf.exec(); |
693 | qDebug( execStr); | 715 | qDebug( execStr); |
694 | if( execStr.isEmpty() ) { | 716 | if( execStr.isEmpty() ) { |
695 | } else { | 717 | } else { |
696 | nf.execute(); | 718 | nf.execute(); |
697 | } | 719 | } |
698 | } | 720 | } |
699 | } | 721 | } |
700 | // MimeType mt( curFile); | 722 | // MimeType mt( curFile); |
701 | } else { | 723 | } else { |
702 | QString curFile = Remote_View->currentItem()->text(0); | 724 | QString curFile = Remote_View->currentItem()->text(0); |
703 | if(curFile != "../") { | 725 | if(curFile != "../") { |
704 | 726 | ||
705 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 727 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
706 | qDebug("Filesystemtype is "+fs); | 728 | qDebug("Filesystemtype is "+fs); |
707 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 729 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
708 | if( (fileInfo.permission( QFileInfo::ExeUser) | 730 | if( (fileInfo.permission( QFileInfo::ExeUser) |
709 | | fileInfo.permission( QFileInfo::ExeGroup) | 731 | | fileInfo.permission( QFileInfo::ExeGroup) |
710 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 732 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
711 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 733 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
712 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 734 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
713 | e << curFile; | 735 | e << curFile; |
714 | } else { | 736 | } else { |
715 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 737 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
716 | DocLnk nf(curFile); | 738 | DocLnk nf(curFile); |
717 | QString execStr = nf.exec(); | 739 | QString execStr = nf.exec(); |
718 | qDebug(execStr); | 740 | qDebug(execStr); |
719 | if( execStr.isEmpty() ) { | 741 | if( execStr.isEmpty() ) { |
720 | } else { | 742 | } else { |
721 | nf.execute(); | 743 | nf.execute(); |
722 | } | 744 | } |
723 | } | 745 | } |
724 | } | 746 | } |
725 | // MimeType mt( curFile); | 747 | // MimeType mt( curFile); |
726 | } | 748 | } |
727 | } | 749 | } |
728 | 750 | ||
729 | void AdvancedFm::runText() { | 751 | void AdvancedFm::runText() { |
730 | if (TabWidget->currentPageIndex() == 0) { | 752 | if (TabWidget->currentPageIndex() == 0) { |
731 | QString curFile = Local_View->currentItem()->text(0); | 753 | QString curFile = Local_View->currentItem()->text(0); |
732 | if(curFile != "../") { | 754 | if(curFile != "../") { |
733 | curFile = currentDir.canonicalPath()+"/"+curFile; | 755 | curFile = currentDir.canonicalPath()+"/"+curFile; |
734 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 756 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
735 | e << curFile; | 757 | e << curFile; |
736 | } | 758 | } |
737 | } else { | 759 | } else { |
738 | QString curFile = Remote_View->currentItem()->text(0); | 760 | QString curFile = Remote_View->currentItem()->text(0); |
739 | if(curFile != "../") { | 761 | if(curFile != "../") { |
740 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 762 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
741 | DocLnk nf(curFile); | 763 | DocLnk nf(curFile); |
742 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 764 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
743 | e << curFile; | 765 | e << curFile; |
744 | } | 766 | } |
745 | } | 767 | } |
746 | } | 768 | } |
747 | 769 | ||
748 | void AdvancedFm::localMakDir() | 770 | void AdvancedFm::localMakDir() |
749 | { | 771 | { |
750 | InputDialog *fileDlg; | 772 | InputDialog *fileDlg; |
751 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 773 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
752 | fileDlg->exec(); | 774 | fileDlg->exec(); |
753 | if( fileDlg->result() == 1 ) { | 775 | if( fileDlg->result() == 1 ) { |
754 | QString filename = fileDlg->LineEdit1->text(); | 776 | QString filename = fileDlg->LineEdit1->text(); |
755 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 777 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
756 | } | 778 | } |
757 | populateLocalView(); | 779 | populateLocalView(); |
758 | } | 780 | } |
759 | 781 | ||
760 | void AdvancedFm::remoteMakDir() | 782 | void AdvancedFm::remoteMakDir() |
761 | { | 783 | { |
762 | InputDialog *fileDlg; | 784 | InputDialog *fileDlg; |
763 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 785 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
764 | fileDlg->exec(); | 786 | fileDlg->exec(); |
765 | if( fileDlg->result() == 1 ) { | 787 | if( fileDlg->result() == 1 ) { |
766 | QString filename = fileDlg->LineEdit1->text(); | 788 | QString filename = fileDlg->LineEdit1->text(); |
767 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 789 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
768 | } | 790 | } |
769 | populateRemoteView(); | 791 | populateRemoteView(); |
770 | } | 792 | } |
771 | 793 | ||
772 | void AdvancedFm::localDelete() | 794 | void AdvancedFm::localDelete() |
773 | { | 795 | { |
774 | QStringList curFileList = getPath(); | 796 | QStringList curFileList = getPath(); |
775 | if(curFileList.count() > 0) { | 797 | if(curFileList.count() > 0) { |
776 | QString myFile; | 798 | QString myFile; |
777 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 799 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
778 | myFile = (*it); | 800 | myFile = (*it); |
779 | if( myFile.find(" -> ",0,TRUE) != -1) | 801 | if( myFile.find(" -> ",0,TRUE) != -1) |
780 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 802 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
781 | 803 | ||
782 | QString f = currentDir.canonicalPath(); | 804 | QString f = currentDir.canonicalPath(); |
783 | if(f.right(1).find("/",0,TRUE) == -1) | 805 | if(f.right(1).find("/",0,TRUE) == -1) |
784 | f+="/"; | 806 | f+="/"; |
785 | f+=myFile; | 807 | f+=myFile; |
786 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 808 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
787 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 809 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
788 | "\nand all it's contents ?" | 810 | "\nand all it's contents ?" |
789 | ,tr("Yes"),tr("No"),0,0,1) ) { | 811 | ,tr("Yes"),tr("No"),0,0,1) ) { |
790 | case 0: { | 812 | case 0: { |
791 | f=f.left(f.length()-1); | 813 | f=f.left(f.length()-1); |
792 | QString cmd="rm -rf "+f; | 814 | QString cmd="rm -rf "+f; |
793 | system( cmd.latin1()); | 815 | system( cmd.latin1()); |
794 | populateLocalView(); | 816 | populateLocalView(); |
795 | } | 817 | } |
796 | break; | 818 | break; |
797 | case 1: | 819 | case 1: |
798 | // exit | 820 | // exit |
799 | break; | 821 | break; |
800 | }; | 822 | }; |
801 | 823 | ||
802 | } else { | 824 | } else { |
803 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 825 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
804 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 826 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
805 | case 0: { | 827 | case 0: { |
806 | QString cmd="rm "+f; | 828 | QString cmd="rm "+f; |
807 | QFile file(f); | 829 | QFile file(f); |
808 | file.remove(); | 830 | file.remove(); |
809 | // system( cmd.latin1()); | 831 | // system( cmd.latin1()); |
810 | populateLocalView(); | 832 | populateLocalView(); |
811 | } | 833 | } |
812 | break; | 834 | break; |
813 | case 1: | 835 | case 1: |
814 | // exit | 836 | // exit |
815 | break; | 837 | break; |
816 | }; | 838 | }; |
817 | } | 839 | } |
818 | } | 840 | } |
819 | } | 841 | } |
820 | } | 842 | } |
821 | 843 | ||
822 | void AdvancedFm::remoteDelete() | 844 | void AdvancedFm::remoteDelete() |
823 | { | 845 | { |
824 | QStringList curFileList = getPath(); | 846 | QStringList curFileList = getPath(); |
825 | if( curFileList.count() > 0) { | 847 | if( curFileList.count() > 0) { |
826 | QString myFile; | 848 | QString myFile; |
827 | 849 | ||
828 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 850 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
829 | myFile = (*it); | 851 | myFile = (*it); |
830 | if(myFile.find(" -> ",0,TRUE) != -1) | 852 | if(myFile.find(" -> ",0,TRUE) != -1) |
831 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 853 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
832 | QString f = currentRemoteDir.canonicalPath(); | 854 | QString f = currentRemoteDir.canonicalPath(); |
833 | if(f.right(1).find("/",0,TRUE) == -1) | 855 | if(f.right(1).find("/",0,TRUE) == -1) |
834 | f+="/"; | 856 | f+="/"; |
835 | f+=myFile; | 857 | f+=myFile; |
836 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 858 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
837 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 859 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
838 | "\nand all it's contents ?", | 860 | "\nand all it's contents ?", |
839 | tr("Yes"),tr("No"),0,0,1) ) { | 861 | tr("Yes"),tr("No"),0,0,1) ) { |
840 | case 0: { | 862 | case 0: { |
841 | f=f.left(f.length()-1); | 863 | f=f.left(f.length()-1); |
842 | QString cmd="rm -rf "+f; | 864 | QString cmd="rm -rf "+f; |
843 | system( cmd.latin1()); | 865 | system( cmd.latin1()); |
844 | populateRemoteView(); | 866 | populateRemoteView(); |
845 | } | 867 | } |
846 | break; | 868 | break; |
847 | case 1: | 869 | case 1: |
848 | // exit | 870 | // exit |
849 | break; | 871 | break; |
850 | }; | 872 | }; |
851 | 873 | ||
852 | } else { | 874 | } else { |
853 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 875 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
854 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 876 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
855 | case 0: { | 877 | case 0: { |
856 | QString cmd="rm "+f; | 878 | QString cmd="rm "+f; |
857 | QFile file(f); | 879 | QFile file(f); |
858 | file.remove(); | 880 | file.remove(); |
859 | // system( cmd.latin1()); | 881 | // system( cmd.latin1()); |
@@ -1272,482 +1294,489 @@ void AdvancedFm::move() { | |||
1272 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1294 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1273 | QString destFile = currentRemoteDir.canonicalPath(); | 1295 | QString destFile = currentRemoteDir.canonicalPath(); |
1274 | if(destFile.right(1).find("/",0,TRUE) == -1) | 1296 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1275 | destFile+="/"; | 1297 | destFile+="/"; |
1276 | destFile +=(*it); | 1298 | destFile +=(*it); |
1277 | qDebug("Destination file is "+destFile); | 1299 | qDebug("Destination file is "+destFile); |
1278 | curFile = currentDir.canonicalPath(); | 1300 | curFile = currentDir.canonicalPath(); |
1279 | if(curFile.right(1).find("/",0,TRUE) == -1) | 1301 | if(curFile.right(1).find("/",0,TRUE) == -1) |
1280 | curFile +="/"; | 1302 | curFile +="/"; |
1281 | curFile+=(*it); | 1303 | curFile+=(*it); |
1282 | 1304 | ||
1283 | QFile f(destFile); | 1305 | QFile f(destFile); |
1284 | if( f.exists()) | 1306 | if( f.exists()) |
1285 | f.remove(); | 1307 | f.remove(); |
1286 | if(!copyFile(destFile, curFile) ) { | 1308 | if(!copyFile(destFile, curFile) ) { |
1287 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1309 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); |
1288 | return; | 1310 | return; |
1289 | } | 1311 | } |
1290 | QFile::remove(curFile); | 1312 | QFile::remove(curFile); |
1291 | TabWidget->setCurrentPage(0); | 1313 | TabWidget->setCurrentPage(0); |
1292 | } | 1314 | } |
1293 | } | 1315 | } |
1294 | populateRemoteView(); | 1316 | populateRemoteView(); |
1295 | populateLocalView(); | 1317 | populateLocalView(); |
1296 | } | 1318 | } |
1297 | } | 1319 | } |
1298 | 1320 | ||
1299 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) | 1321 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) |
1300 | { | 1322 | { |
1301 | char bf[ 50000 ]; | 1323 | char bf[ 50000 ]; |
1302 | int bytesRead; | 1324 | int bytesRead; |
1303 | bool success = TRUE; | 1325 | bool success = TRUE; |
1304 | struct stat status; | 1326 | struct stat status; |
1305 | 1327 | ||
1306 | QFile s( src ); | 1328 | QFile s( src ); |
1307 | QFile d( dest ); | 1329 | QFile d( dest ); |
1308 | 1330 | ||
1309 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 1331 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
1310 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 1332 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
1311 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 1333 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
1312 | success = FALSE; | 1334 | success = FALSE; |
1313 | break; | 1335 | break; |
1314 | } | 1336 | } |
1315 | } | 1337 | } |
1316 | if( success && (bytesRead > 0) ){ | 1338 | if( success && (bytesRead > 0) ){ |
1317 | d.writeBlock( bf, bytesRead ); | 1339 | d.writeBlock( bf, bytesRead ); |
1318 | } | 1340 | } |
1319 | } else { | 1341 | } else { |
1320 | success = FALSE; | 1342 | success = FALSE; |
1321 | } | 1343 | } |
1322 | 1344 | ||
1323 | // Set file permissions | 1345 | // Set file permissions |
1324 | if( stat( (const char *) src, &status ) == 0 ){ | 1346 | if( stat( (const char *) src, &status ) == 0 ){ |
1325 | chmod( (const char *) dest, status.st_mode ); | 1347 | chmod( (const char *) dest, status.st_mode ); |
1326 | } | 1348 | } |
1327 | 1349 | ||
1328 | return success; | 1350 | return success; |
1329 | } | 1351 | } |
1330 | 1352 | ||
1331 | void AdvancedFm::runCommand() { | 1353 | void AdvancedFm::runCommand() { |
1332 | QString curFile; | 1354 | QString curFile; |
1333 | if (TabWidget->currentPageIndex() == 0) { | 1355 | if (TabWidget->currentPageIndex() == 0) { |
1334 | if( Local_View->currentItem()) | 1356 | if( Local_View->currentItem()) |
1335 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 1357 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
1336 | } else { | 1358 | } else { |
1337 | if(Remote_View->currentItem()) | 1359 | if(Remote_View->currentItem()) |
1338 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); | 1360 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); |
1339 | } | 1361 | } |
1340 | 1362 | ||
1341 | InputDialog *fileDlg; | 1363 | InputDialog *fileDlg; |
1342 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1364 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1343 | fileDlg->setInputText(curFile); | 1365 | fileDlg->setInputText(curFile); |
1344 | fileDlg->exec(); | 1366 | fileDlg->exec(); |
1345 | QString command; | 1367 | QString command; |
1346 | if( fileDlg->result() == 1 ) { | 1368 | if( fileDlg->result() == 1 ) { |
1347 | command = fileDlg->LineEdit1->text(); | 1369 | command = fileDlg->LineEdit1->text(); |
1348 | 1370 | ||
1349 | // int err=0; | 1371 | // int err=0; |
1350 | Output *outDlg; | 1372 | Output *outDlg; |
1351 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1373 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1352 | outDlg->showMaximized(); | 1374 | outDlg->showMaximized(); |
1353 | outDlg->show(); | 1375 | outDlg->show(); |
1354 | qApp->processEvents(); | 1376 | qApp->processEvents(); |
1355 | FILE *fp; | 1377 | FILE *fp; |
1356 | char line[130]; | 1378 | char line[130]; |
1357 | sleep(1); | 1379 | sleep(1); |
1358 | // if(command.find("2>",0,TRUE) != -1) | 1380 | // if(command.find("2>",0,TRUE) != -1) |
1359 | command +=" 2>&1"; | 1381 | command +=" 2>&1"; |
1360 | fp = popen( (const char *) command, "r"); | 1382 | fp = popen( (const char *) command, "r"); |
1361 | if ( !fp ) { | 1383 | if ( !fp ) { |
1362 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1384 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1363 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1385 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1364 | pclose(fp); | 1386 | pclose(fp); |
1365 | return; | 1387 | return; |
1366 | } else { | 1388 | } else { |
1367 | while ( fgets( line, sizeof line, fp)) { | 1389 | while ( fgets( line, sizeof line, fp)) { |
1368 | QString lineStr = line; | 1390 | QString lineStr = line; |
1369 | lineStr=lineStr.left(lineStr.length()-1); | 1391 | lineStr=lineStr.left(lineStr.length()-1); |
1370 | outDlg->OutputEdit->append(lineStr); | 1392 | outDlg->OutputEdit->append(lineStr); |
1371 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1393 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1372 | } | 1394 | } |
1373 | } | 1395 | } |
1374 | } | 1396 | } |
1375 | } | 1397 | } |
1376 | 1398 | ||
1377 | void AdvancedFm::runCommandStd() { | 1399 | void AdvancedFm::runCommandStd() { |
1378 | QString curFile; | 1400 | QString curFile; |
1379 | if (TabWidget->currentPageIndex() == 0) { | 1401 | if (TabWidget->currentPageIndex() == 0) { |
1380 | if( Local_View->currentItem()) | 1402 | if( Local_View->currentItem()) |
1381 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 1403 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
1382 | } else { | 1404 | } else { |
1383 | if(Remote_View->currentItem()) | 1405 | if(Remote_View->currentItem()) |
1384 | curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); | 1406 | curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); |
1385 | } | 1407 | } |
1386 | 1408 | ||
1387 | InputDialog *fileDlg; | 1409 | InputDialog *fileDlg; |
1388 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1410 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1389 | fileDlg->setInputText(curFile); | 1411 | fileDlg->setInputText(curFile); |
1390 | fileDlg->exec(); | 1412 | fileDlg->exec(); |
1391 | QString command; | 1413 | QString command; |
1392 | if( fileDlg->result() == 1 ) { | 1414 | if( fileDlg->result() == 1 ) { |
1393 | qApp->processEvents(); | 1415 | qApp->processEvents(); |
1394 | command = fileDlg->LineEdit1->text() + " &"; | 1416 | command = fileDlg->LineEdit1->text() + " &"; |
1395 | system(command.latin1()); | 1417 | system(command.latin1()); |
1396 | } | 1418 | } |
1397 | } | 1419 | } |
1398 | 1420 | ||
1399 | void AdvancedFm::fileStatus() { | 1421 | void AdvancedFm::fileStatus() { |
1400 | QString curFile; | 1422 | QString curFile; |
1401 | if (TabWidget->currentPageIndex() == 0) { | 1423 | if (TabWidget->currentPageIndex() == 0) { |
1402 | curFile = Local_View->currentItem()->text(0); | 1424 | curFile = Local_View->currentItem()->text(0); |
1403 | } else { | 1425 | } else { |
1404 | curFile = Remote_View->currentItem()->text(0); | 1426 | curFile = Remote_View->currentItem()->text(0); |
1405 | } | 1427 | } |
1406 | QString command = " stat -l "+ curFile +" 2>&1"; | 1428 | QString command = " stat -l "+ curFile +" 2>&1"; |
1407 | // int err=0; | 1429 | // int err=0; |
1408 | Output *outDlg; | 1430 | Output *outDlg; |
1409 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1431 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1410 | outDlg->showMaximized(); | 1432 | outDlg->showMaximized(); |
1411 | outDlg->show(); | 1433 | outDlg->show(); |
1412 | qApp->processEvents(); | 1434 | qApp->processEvents(); |
1413 | FILE *fp; | 1435 | FILE *fp; |
1414 | char line[130]; | 1436 | char line[130]; |
1415 | sleep(1); | 1437 | sleep(1); |
1416 | fp = popen( (const char *) command, "r"); | 1438 | fp = popen( (const char *) command, "r"); |
1417 | if ( !fp ) { | 1439 | if ( !fp ) { |
1418 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1440 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1419 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1441 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1420 | pclose(fp); | 1442 | pclose(fp); |
1421 | return; | 1443 | return; |
1422 | } else { | 1444 | } else { |
1423 | while ( fgets( line, sizeof line, fp)) { | 1445 | while ( fgets( line, sizeof line, fp)) { |
1424 | outDlg->OutputEdit->append(line); | 1446 | outDlg->OutputEdit->append(line); |
1425 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1447 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1426 | 1448 | ||
1427 | } | 1449 | } |
1428 | 1450 | ||
1429 | } | 1451 | } |
1430 | } | 1452 | } |
1431 | 1453 | ||
1432 | void AdvancedFm::mkDir() { | 1454 | void AdvancedFm::mkDir() { |
1433 | if (TabWidget->currentPageIndex() == 0) | 1455 | if (TabWidget->currentPageIndex() == 0) |
1434 | localMakDir(); | 1456 | localMakDir(); |
1435 | else | 1457 | else |
1436 | remoteMakDir(); | 1458 | remoteMakDir(); |
1437 | 1459 | ||
1438 | } | 1460 | } |
1439 | 1461 | ||
1440 | void AdvancedFm::rn() { | 1462 | void AdvancedFm::rn() { |
1441 | if (TabWidget->currentPageIndex() == 0) | 1463 | if (TabWidget->currentPageIndex() == 0) |
1442 | localRename(); | 1464 | localRename(); |
1443 | else | 1465 | else |
1444 | remoteRename(); | 1466 | remoteRename(); |
1445 | 1467 | ||
1446 | } | 1468 | } |
1447 | 1469 | ||
1448 | void AdvancedFm::del() { | 1470 | void AdvancedFm::del() { |
1449 | if (TabWidget->currentPageIndex() == 0) | 1471 | if (TabWidget->currentPageIndex() == 0) |
1450 | localDelete(); | 1472 | localDelete(); |
1451 | else | 1473 | else |
1452 | remoteDelete(); | 1474 | remoteDelete(); |
1453 | } | 1475 | } |
1454 | 1476 | ||
1455 | void AdvancedFm::doAbout() { | 1477 | void AdvancedFm::doAbout() { |
1456 | QMessageBox::message("AdvancedFm","Advanced FileManager\n" | 1478 | QMessageBox::message("AdvancedFm","Advanced FileManager\n" |
1457 | "is copyright 2002 by\n" | 1479 | "is copyright 2002 by\n" |
1458 | "L.J.Potter<llornkcor@handhelds.org>\n" | 1480 | "L.J.Potter<llornkcor@handhelds.org>\n" |
1459 | "and is licensed by the GPL"); | 1481 | "and is licensed by the GPL"); |
1460 | } | 1482 | } |
1461 | 1483 | ||
1462 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | 1484 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) |
1463 | { | 1485 | { |
1486 | if( TabWidget->hasFocus()) | ||
1464 | switch ( e->key() ) { | 1487 | switch ( e->key() ) { |
1465 | case Key_Delete: | 1488 | case Key_Delete: |
1466 | del(); | 1489 | del(); |
1467 | break; | 1490 | break; |
1468 | case Key_H: | 1491 | case Key_H: |
1469 | showHidden(); | 1492 | showHidden(); |
1470 | break; | 1493 | break; |
1471 | case Key_E: | 1494 | case Key_E: |
1472 | runThis(); | 1495 | runThis(); |
1473 | break; | 1496 | break; |
1474 | case Key_C: | 1497 | case Key_C: |
1475 | copy(); | 1498 | copy(); |
1476 | break; | 1499 | break; |
1477 | case Key_A: | 1500 | case Key_A: |
1478 | copyAs(); | 1501 | copyAs(); |
1479 | break; | 1502 | break; |
1480 | case Key_M: | 1503 | case Key_M: |
1481 | move(); | 1504 | move(); |
1482 | break; | 1505 | break; |
1483 | case Key_R: | 1506 | case Key_R: |
1484 | rn(); | 1507 | rn(); |
1485 | break; | 1508 | break; |
1486 | case Key_I: | 1509 | case Key_I: |
1487 | fileStatus(); | 1510 | fileStatus(); |
1488 | break; | 1511 | break; |
1489 | case Key_U: | 1512 | case Key_U: |
1490 | upDir(); | 1513 | upDir(); |
1491 | break; | 1514 | break; |
1492 | case Key_P: | 1515 | case Key_P: |
1493 | filePerms(); | 1516 | filePerms(); |
1494 | break; | 1517 | break; |
1495 | case Key_N: | 1518 | case Key_N: |
1496 | mkDir(); | 1519 | mkDir(); |
1497 | break; | 1520 | break; |
1498 | case Key_1: | 1521 | case Key_1: |
1499 | switchToLocalTab(); | 1522 | switchToLocalTab(); |
1500 | break; | 1523 | break; |
1501 | case Key_2: | 1524 | case Key_2: |
1502 | switchToRemoteTab(); | 1525 | switchToRemoteTab(); |
1503 | break; | 1526 | break; |
1504 | case Key_3: | 1527 | case Key_3: |
1505 | CFButtonPushed(); | 1528 | CFButtonPushed(); |
1506 | break; | 1529 | break; |
1507 | case Key_4: | 1530 | case Key_4: |
1508 | SDButtonPushed(); | 1531 | SDButtonPushed(); |
1509 | break; | 1532 | break; |
1510 | case Key_5: | 1533 | case Key_5: |
1511 | homeButtonPushed(); | 1534 | homeButtonPushed(); |
1512 | break; | 1535 | break; |
1513 | case Key_6: | 1536 | case Key_6: |
1514 | docButtonPushed(); | 1537 | docButtonPushed(); |
1515 | break; | 1538 | break; |
1516 | case Key_7: | 1539 | case Key_7: |
1517 | break; | 1540 | break; |
1518 | case Key_8: | 1541 | case Key_8: |
1519 | break; | 1542 | break; |
1520 | case Key_9: | 1543 | case Key_9: |
1521 | break; | 1544 | break; |
1522 | case Key_0: | 1545 | case Key_0: |
1523 | break; | 1546 | break; |
1524 | } | 1547 | } |
1525 | } | 1548 | } |
1526 | 1549 | ||
1527 | void AdvancedFm::mkSym() { | 1550 | void AdvancedFm::mkSym() { |
1528 | QString cmd; | 1551 | QString cmd; |
1529 | QStringList curFileList = getPath(); | 1552 | QStringList curFileList = getPath(); |
1530 | if( curFileList.count() > 0) { | 1553 | if( curFileList.count() > 0) { |
1531 | 1554 | ||
1532 | if (TabWidget->currentPageIndex() == 0) { | 1555 | if (TabWidget->currentPageIndex() == 0) { |
1533 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1556 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1534 | 1557 | ||
1535 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); | 1558 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); |
1536 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 1559 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
1537 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 1560 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
1538 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1561 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1539 | cmd = "ln -s "+curFile+" "+destName; | 1562 | cmd = "ln -s "+curFile+" "+destName; |
1540 | qDebug(cmd); | 1563 | qDebug(cmd); |
1541 | system(cmd.latin1() ); | 1564 | system(cmd.latin1() ); |
1542 | } | 1565 | } |
1543 | populateRemoteView(); | 1566 | populateRemoteView(); |
1544 | TabWidget->setCurrentPage(1); | 1567 | TabWidget->setCurrentPage(1); |
1545 | } else { | 1568 | } else { |
1546 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1569 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1547 | 1570 | ||
1548 | QString destName = currentDir.canonicalPath()+"/"+(*it); | 1571 | QString destName = currentDir.canonicalPath()+"/"+(*it); |
1549 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 1572 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
1550 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1573 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1551 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1574 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1552 | 1575 | ||
1553 | cmd = "ln -s "+curFile+" "+destName; | 1576 | cmd = "ln -s "+curFile+" "+destName; |
1554 | qDebug(cmd); | 1577 | qDebug(cmd); |
1555 | system(cmd.latin1() ); | 1578 | system(cmd.latin1() ); |
1556 | } | 1579 | } |
1557 | populateLocalView(); | 1580 | populateLocalView(); |
1558 | TabWidget->setCurrentPage(0); | 1581 | TabWidget->setCurrentPage(0); |
1559 | } | 1582 | } |
1560 | } | 1583 | } |
1561 | } | 1584 | } |
1562 | 1585 | ||
1563 | void AdvancedFm::QPEButtonPushed() { | 1586 | void AdvancedFm::QPEButtonPushed() { |
1564 | QString current = QPEApplication::qpeDir(); | 1587 | QString current = QPEApplication::qpeDir(); |
1565 | chdir( current.latin1() ); | 1588 | chdir( current.latin1() ); |
1566 | if (TabWidget->currentPageIndex() == 0) { | 1589 | if (TabWidget->currentPageIndex() == 0) { |
1567 | currentDir.cd( current, TRUE); | 1590 | currentDir.cd( current, TRUE); |
1568 | populateLocalView(); | 1591 | populateLocalView(); |
1569 | } else { | 1592 | } else { |
1570 | currentRemoteDir.cd( current, TRUE); | 1593 | currentRemoteDir.cd( current, TRUE); |
1571 | populateRemoteView(); | 1594 | populateRemoteView(); |
1572 | } | 1595 | } |
1573 | update(); | 1596 | update(); |
1574 | } | 1597 | } |
1575 | 1598 | ||
1576 | void AdvancedFm::parsetab(const QString &fileName) { | 1599 | void AdvancedFm::parsetab(const QString &fileName) { |
1577 | 1600 | ||
1578 | fileSystemTypeList.clear(); | 1601 | fileSystemTypeList.clear(); |
1579 | fsList.clear(); | 1602 | fsList.clear(); |
1580 | struct mntent *me; | 1603 | struct mntent *me; |
1581 | // if(fileName == "/etc/mtab") { | 1604 | // if(fileName == "/etc/mtab") { |
1582 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 1605 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
1583 | if ( mntfp ) { | 1606 | if ( mntfp ) { |
1584 | while ( (me = getmntent( mntfp )) != 0 ) { | 1607 | while ( (me = getmntent( mntfp )) != 0 ) { |
1585 | QString deviceName = me->mnt_fsname; | 1608 | QString deviceName = me->mnt_fsname; |
1586 | QString filesystemType = me->mnt_type; | 1609 | QString filesystemType = me->mnt_type; |
1587 | QString mountDir = me->mnt_dir; | 1610 | QString mountDir = me->mnt_dir; |
1588 | if(deviceName != "none") { | 1611 | if(deviceName != "none") { |
1589 | if( fsList.contains(filesystemType) == 0 | 1612 | if( fsList.contains(filesystemType) == 0 |
1590 | & filesystemType.find("proc",0,TRUE) == -1 | 1613 | & filesystemType.find("proc",0,TRUE) == -1 |
1591 | & filesystemType.find("cramfs",0,TRUE) == -1 | 1614 | & filesystemType.find("cramfs",0,TRUE) == -1 |
1592 | & filesystemType.find("auto",0,TRUE) == -1) | 1615 | & filesystemType.find("auto",0,TRUE) == -1) |
1593 | fsList << filesystemType; | 1616 | fsList << filesystemType; |
1594 | // deviceList << deviceName; | 1617 | // deviceList << deviceName; |
1595 | // qDebug(mountDir+"::"+filesystemType); | 1618 | // qDebug(mountDir+"::"+filesystemType); |
1596 | fileSystemTypeList << mountDir+"::"+filesystemType; | 1619 | fileSystemTypeList << mountDir+"::"+filesystemType; |
1597 | } | 1620 | } |
1598 | } | 1621 | } |
1599 | } | 1622 | } |
1600 | endmntent( mntfp ); | 1623 | endmntent( mntfp ); |
1601 | } | 1624 | } |
1602 | 1625 | ||
1603 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { | 1626 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { |
1604 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 1627 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
1605 | QString current = currentText;//.right( currentText.length()-1); | 1628 | QString current = currentText;//.right( currentText.length()-1); |
1606 | QString baseFs; | 1629 | QString baseFs; |
1607 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 1630 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
1608 | QString temp = (*it); | 1631 | QString temp = (*it); |
1609 | QString path = temp.left(temp.find("::",0,TRUE) ); | 1632 | QString path = temp.left(temp.find("::",0,TRUE) ); |
1610 | path = path.right( path.length()-1); | 1633 | path = path.right( path.length()-1); |
1611 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 1634 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
1612 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { | 1635 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { |
1613 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 1636 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
1614 | } | 1637 | } |
1615 | } | 1638 | } |
1616 | return baseFs; | 1639 | return baseFs; |
1617 | } | 1640 | } |
1618 | 1641 | ||
1619 | 1642 | ||
1620 | void AdvancedFm::doBeam() { | 1643 | void AdvancedFm::doBeam() { |
1621 | Ir ir; | 1644 | Ir ir; |
1622 | if(!ir.supported()){ | 1645 | if(!ir.supported()){ |
1623 | } else { | 1646 | } else { |
1624 | 1647 | ||
1625 | QStringList curFileList = getPath(); | 1648 | QStringList curFileList = getPath(); |
1626 | if( curFileList.count() > 0) { | 1649 | if( curFileList.count() > 0) { |
1627 | 1650 | ||
1628 | if (TabWidget->currentPageIndex() == 0) { | 1651 | if (TabWidget->currentPageIndex() == 0) { |
1629 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1652 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1630 | 1653 | ||
1631 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 1654 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
1632 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1655 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1633 | Ir *file = new Ir(this, "IR"); | 1656 | Ir *file = new Ir(this, "IR"); |
1634 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 1657 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
1635 | file->send( curFile, curFile ); | 1658 | file->send( curFile, curFile ); |
1636 | } | 1659 | } |
1637 | 1660 | ||
1638 | } else { | 1661 | } else { |
1639 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1662 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1640 | 1663 | ||
1641 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1664 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1642 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1665 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1643 | Ir *file = new Ir(this, "IR"); | 1666 | Ir *file = new Ir(this, "IR"); |
1644 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 1667 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
1645 | file->send( curFile, curFile ); | 1668 | file->send( curFile, curFile ); |
1646 | 1669 | ||
1647 | } | 1670 | } |
1648 | } | 1671 | } |
1649 | } | 1672 | } |
1650 | } | 1673 | } |
1651 | 1674 | ||
1652 | } | 1675 | } |
1653 | 1676 | ||
1654 | void AdvancedFm::fileBeamFinished( Ir *ir) { | 1677 | void AdvancedFm::fileBeamFinished( Ir *ir) { |
1655 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 1678 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
1656 | 1679 | ||
1657 | } | 1680 | } |
1658 | 1681 | ||
1659 | 1682 | ||
1660 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 1683 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
1661 | // QListViewItemIterator it( Local_View ); | 1684 | // QListViewItemIterator it( Local_View ); |
1662 | // for ( ; it.current(); ++it ) { | 1685 | // for ( ; it.current(); ++it ) { |
1663 | // if ( it.current()->isSelected() ) { | 1686 | // if ( it.current()->isSelected() ) { |
1664 | // QString strItem = it.current()->text(0); | 1687 | // QString strItem = it.current()->text(0); |
1665 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 1688 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
1666 | // QFileInfo fi(localFile); | 1689 | // QFileInfo fi(localFile); |
1667 | // } | 1690 | // } |
1668 | // } | 1691 | // } |
1669 | 1692 | ||
1670 | void AdvancedFm::showFileMenu() { | 1693 | void AdvancedFm::showFileMenu() { |
1694 | |||
1671 | QString curApp; | 1695 | QString curApp; |
1672 | bool isLocalView = false; | 1696 | bool isLocalView = false; |
1673 | if (TabWidget->currentPageIndex() == 0) { | 1697 | if (TabWidget->currentPageIndex() == 0) { |
1674 | isLocalView = TRUE; | 1698 | isLocalView = TRUE; |
1675 | curApp = Local_View->currentItem()->text(0); | 1699 | curApp = Local_View->currentItem()->text(0); |
1676 | } else { | 1700 | } else { |
1677 | curApp = Remote_View->currentItem()->text(0); | 1701 | curApp = Remote_View->currentItem()->text(0); |
1678 | } | 1702 | } |
1679 | 1703 | ||
1680 | MimeType mt( curApp ); | 1704 | MimeType mt( curApp ); |
1681 | const AppLnk* app = mt.application(); | 1705 | const AppLnk* app = mt.application(); |
1682 | QFile fi(curApp); | 1706 | QFile fi(curApp); |
1683 | 1707 | ||
1684 | QPopupMenu m; | 1708 | // QPopupMenu m; |
1685 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 1709 | QPopupMenu *m = new QPopupMenu(0); |
1686 | m.insertSeparator(); | 1710 | |
1711 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | ||
1712 | m->insertSeparator(); | ||
1687 | if ( QFileInfo(fi).isDir() ) { | 1713 | if ( QFileInfo(fi).isDir() ) { |
1688 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 1714 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
1689 | } else { | 1715 | } else { |
1690 | 1716 | ||
1691 | if ( app ) | 1717 | if ( app ) |
1692 | m.insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); | 1718 | m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); |
1693 | else if( QFileInfo(fi).isExecutable() ) | 1719 | else if( QFileInfo(fi).isExecutable() ) |
1694 | m.insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); | 1720 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); |
1695 | 1721 | ||
1696 | m.insertItem( /*Resource::loadPixmap( "txt" ),*/ tr( "Open as text" ),this, SLOT( runText() ) ); | 1722 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); |
1697 | } | 1723 | } |
1698 | m.insertSeparator(); | 1724 | m->insertSeparator(); |
1699 | 1725 | ||
1700 | 1726 | ||
1701 | if(isLocalView) | 1727 | if(isLocalView) |
1702 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 1728 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
1703 | else | 1729 | else |
1704 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 1730 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
1705 | 1731 | ||
1706 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 1732 | m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
1707 | m.insertSeparator(); | 1733 | m->insertSeparator(); |
1708 | 1734 | ||
1709 | if(isLocalView) | 1735 | if(isLocalView) |
1710 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 1736 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
1711 | else | 1737 | else |
1712 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 1738 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
1713 | 1739 | ||
1714 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 1740 | m->insertItem( tr( "Copy" ), this, SLOT( copy() )); |
1715 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 1741 | m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
1716 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 1742 | m->insertItem( tr( "Move" ), this, SLOT( move() )); |
1717 | m.insertSeparator(); | 1743 | m->insertSeparator(); |
1718 | 1744 | ||
1719 | if(isLocalView) | 1745 | if(isLocalView) |
1720 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); | 1746 | m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); |
1721 | else | 1747 | else |
1722 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | 1748 | m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); |
1723 | 1749 | ||
1724 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 1750 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
1725 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 1751 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
1726 | m.insertSeparator(); | 1752 | m->insertSeparator(); |
1727 | 1753 | ||
1728 | if(isLocalView) | 1754 | if(isLocalView) |
1729 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 1755 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
1730 | else | 1756 | else |
1731 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 1757 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
1732 | 1758 | ||
1733 | m.insertSeparator(); | 1759 | m->insertSeparator(); |
1734 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 1760 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
1735 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | 1761 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings |
1736 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 1762 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
1737 | m.setCheckable(TRUE); | 1763 | m->setCheckable(TRUE); |
1738 | if (!b) | 1764 | if (!b) |
1739 | m.setItemChecked(m.idAt(0),TRUE); | 1765 | m->setItemChecked(m->idAt(0),TRUE); |
1740 | else | 1766 | else |
1741 | m.setItemChecked(m.idAt(0),FALSE); | 1767 | m->setItemChecked(m->idAt(0),FALSE); |
1742 | if(Ir::supported()) | 1768 | if(Ir::supported()) |
1743 | m.insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | 1769 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); |
1744 | m.exec( QCursor::pos() ); | 1770 | m->setFocus(); |
1771 | m->exec( QCursor::pos() ); | ||
1772 | if(m) delete m; | ||
1745 | } | 1773 | } |
1746 | 1774 | ||
1747 | 1775 | ||
1748 | void AdvancedFm::cancelMenuTimer() | 1776 | void AdvancedFm::cancelMenuTimer() |
1749 | { | 1777 | { |
1750 | qDebug("cancel menu timer"); | 1778 | |
1779 | qDebug("selectionChanged: cancel menu timer"); | ||
1751 | if( menuTimer.isActive() ) | 1780 | if( menuTimer.isActive() ) |
1752 | menuTimer.stop(); | 1781 | menuTimer.stop(); |
1753 | } | 1782 | } |
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index 25fb782..299f870 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS = advancedfm.h inputDialog.h filePermissions.h output.h | 3 | HEADERS = advancedfm.h inputDialog.h filePermissions.h output.h |
4 | SOURCES = advancedfm.cpp inputDialog.cpp filePermissions.cpp output.cpp main.cpp | 4 | SOURCES = advancedfm.cpp inputDialog.cpp filePermissions.cpp output.cpp main.cpp |
5 | TARGET = advancedfm | 5 | TARGET = advancedfm |
6 | REQUIRES=medium-config | 6 | REQUIRES=medium-config |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | DESTDIR = $(OPIEDIR)/bin | 9 | DESTDIR = $(OPIEDIR)/bin |
10 | LIBS += -lqpe | 10 | LIBS += -lqpe -lopie |
11 | 11 | ||