author | llornkcor <llornkcor> | 2002-06-21 00:55:02 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-21 00:55:02 (UTC) |
commit | 2a7407325b1607c9ee40ed3558c8549672a36ad4 (patch) (unidiff) | |
tree | 4e00e892bd2e9ced90bc7f78b43f995e13f4d636 | |
parent | b5951d300371cbe78fa94163aa882419e3d08d4b (diff) | |
download | opie-2a7407325b1607c9ee40ed3558c8549672a36ad4.zip opie-2a7407325b1607c9ee40ed3558c8549672a36ad4.tar.gz opie-2a7407325b1607c9ee40ed3558c8549672a36ad4.tar.bz2 |
ipkg-build needs Package: , please consult maintainer before making changes. Various changes in cpp
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/advancedfm/opie-advancedfm.control | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index ebd7fc3..1287c57 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,1782 +1,1787 @@ | |||
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> | 20 | #include <opie/ofileselector.h> |
21 | #include <opie/ofiledialog.h> | 21 | #include <opie/ofiledialog.h> |
22 | 22 | ||
23 | 23 | ||
24 | #include <qpe/lnkproperties.h> | 24 | #include <qpe/lnkproperties.h> |
25 | #include <qpe/filemanager.h> | 25 | #include <qpe/filemanager.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/qpemenubar.h> | 27 | #include <qpe/qpemenubar.h> |
28 | #include <qpe/qpetoolbar.h> | 28 | #include <qpe/qpetoolbar.h> |
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
31 | #include <qpe/qcopenvelope_qws.h> | 31 | #include <qpe/qcopenvelope_qws.h> |
32 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
33 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
34 | #include <qpe/applnk.h> | 34 | #include <qpe/applnk.h> |
35 | #include <qpe/ir.h> | 35 | #include <qpe/ir.h> |
36 | 36 | ||
37 | //#include <opie/ofileselector.h> | 37 | //#include <opie/ofileselector.h> |
38 | #include <qmultilineedit.h> | 38 | #include <qmultilineedit.h> |
39 | 39 | ||
40 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qtoolbutton.h> | 42 | #include <qtoolbutton.h> |
43 | #include <qdatetime.h> | 43 | #include <qdatetime.h> |
44 | #include <qdir.h> | 44 | #include <qdir.h> |
45 | #include <qfile.h> | 45 | #include <qfile.h> |
46 | #include <qstring.h> | 46 | #include <qstring.h> |
47 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
48 | #include <qpopupmenu.h> | 48 | #include <qpopupmenu.h> |
49 | #include <qlistview.h> | 49 | #include <qlistview.h> |
50 | #include <qmainwindow.h> | 50 | #include <qmainwindow.h> |
51 | #include <qlabel.h> | 51 | #include <qlabel.h> |
52 | #include <qprogressbar.h> | 52 | #include <qprogressbar.h> |
53 | #include <qspinbox.h> | 53 | #include <qspinbox.h> |
54 | #include <qtabwidget.h> | 54 | #include <qtabwidget.h> |
55 | #include <qwidget.h> | 55 | #include <qwidget.h> |
56 | #include <qlayout.h> | 56 | #include <qlayout.h> |
57 | #include <qimage.h> | 57 | #include <qimage.h> |
58 | #include <qpixmap.h> | 58 | #include <qpixmap.h> |
59 | #include <qmessagebox.h> | 59 | #include <qmessagebox.h> |
60 | #include <qlineedit.h> | 60 | #include <qlineedit.h> |
61 | #include <qregexp.h> | 61 | #include <qregexp.h> |
62 | 62 | ||
63 | #include <unistd.h> | 63 | #include <unistd.h> |
64 | #include <stdlib.h> | 64 | #include <stdlib.h> |
65 | #include <sys/stat.h> | 65 | #include <sys/stat.h> |
66 | #include <dirent.h> | 66 | #include <dirent.h> |
67 | #include <stdio.h> | 67 | #include <stdio.h> |
68 | #include <time.h> | 68 | #include <time.h> |
69 | #include <fcntl.h> | 69 | #include <fcntl.h> |
70 | #include <mntent.h> | 70 | #include <mntent.h> |
71 | #include <string.h> | 71 | #include <string.h> |
72 | #include <errno.h> | 72 | #include <errno.h> |
73 | 73 | ||
74 | AdvancedFm::AdvancedFm( ) | 74 | AdvancedFm::AdvancedFm( ) |
75 | : QMainWindow( ) | 75 | : QMainWindow( ) |
76 | { | 76 | { |
77 | setCaption( tr( "AdvancedFm" ) ); | 77 | setCaption( tr( "AdvancedFm" ) ); |
78 | // menuTimer( this ); | 78 | // menuTimer( this ); |
79 | 79 | ||
80 | QGridLayout *layout = new QGridLayout( this ); | 80 | QGridLayout *layout = new QGridLayout( this ); |
81 | layout->setSpacing( 2); | 81 | layout->setSpacing( 2); |
82 | layout->setMargin( 2); | 82 | layout->setMargin( 2); |
83 | 83 | ||
84 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 84 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
85 | 85 | ||
86 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 86 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
87 | // fileMenu = new QPopupMenu( this ); | 87 | // fileMenu = new QPopupMenu( this ); |
88 | fileMenu = new QPopupMenu( this ); | 88 | fileMenu = new QPopupMenu( this ); |
89 | viewMenu = new QPopupMenu( this ); | 89 | viewMenu = new QPopupMenu( this ); |
90 | 90 | ||
91 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 91 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
92 | 92 | ||
93 | menuBar->insertItem( tr( "File" ), fileMenu); | 93 | menuBar->insertItem( tr( "File" ), fileMenu); |
94 | menuBar->insertItem( tr( "View" ), viewMenu); | 94 | menuBar->insertItem( tr( "View" ), viewMenu); |
95 | 95 | ||
96 | qpeDirButton= new QPushButton(Resource::loadIconSet("launcher/opielogo16x16"),"",this,"QPEButton"); | 96 | qpeDirButton= new QPushButton(Resource::loadIconSet("launcher/opielogo16x16"),"",this,"QPEButton"); |
97 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 97 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
98 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 98 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
99 | qpeDirButton->setFlat(TRUE); | 99 | qpeDirButton->setFlat(TRUE); |
100 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 100 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); |
101 | 101 | ||
102 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); | 102 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); |
103 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 103 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
104 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 104 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
105 | cfButton->setFlat(TRUE); | 105 | cfButton->setFlat(TRUE); |
106 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 106 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
107 | 107 | ||
108 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); | 108 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); |
109 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 109 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
110 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 110 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
111 | sdButton->setFlat(TRUE); | 111 | sdButton->setFlat(TRUE); |
112 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 112 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
113 | 113 | ||
114 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | 114 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); |
115 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 115 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
116 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 116 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
117 | cdUpButton ->setFlat(TRUE); | 117 | cdUpButton ->setFlat(TRUE); |
118 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | 118 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
119 | 119 | ||
120 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 120 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
121 | docButton->setFixedSize( QSize( 20, 20 ) ); | 121 | docButton->setFixedSize( QSize( 20, 20 ) ); |
122 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 122 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
123 | docButton->setFlat(TRUE); | 123 | docButton->setFlat(TRUE); |
124 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 124 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
125 | 125 | ||
126 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 126 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); |
127 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 127 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
128 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 128 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
129 | homeButton->setFlat(TRUE); | 129 | homeButton->setFlat(TRUE); |
130 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 130 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
131 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 131 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
132 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 132 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
133 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 133 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
134 | 134 | ||
135 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 135 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
136 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 136 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
137 | fileMenu->insertSeparator(); | 137 | fileMenu->insertSeparator(); |
138 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 138 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
139 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 139 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
140 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 140 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
141 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 141 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
142 | fileMenu->insertSeparator(); | 142 | fileMenu->insertSeparator(); |
143 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 143 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
144 | fileMenu->setCheckable(TRUE); | 144 | fileMenu->setCheckable(TRUE); |
145 | 145 | ||
146 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 146 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
147 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 147 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
148 | viewMenu->insertSeparator(); | 148 | viewMenu->insertSeparator(); |
149 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 149 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
150 | viewMenu->setCheckable(TRUE); | 150 | viewMenu->setCheckable(TRUE); |
151 | 151 | ||
152 | 152 | ||
153 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 153 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
154 | currentPathCombo->setEditable(TRUE); | 154 | currentPathCombo->setEditable(TRUE); |
155 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 155 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
156 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 156 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
157 | 157 | ||
158 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 158 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
159 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 159 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
160 | 160 | ||
161 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 161 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
162 | this,SLOT(currentPathComboChanged())); | 162 | this,SLOT(currentPathComboChanged())); |
163 | 163 | ||
164 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 164 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
165 | 165 | ||
166 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 166 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); |
167 | 167 | ||
168 | 168 | ||
169 | TabWidget = new QTabWidget( this, "TabWidget" ); | 169 | TabWidget = new QTabWidget( this, "TabWidget" ); |
170 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); | 170 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); |
171 | 171 | ||
172 | tab = new QWidget( TabWidget, "tab" ); | 172 | tab = new QWidget( TabWidget, "tab" ); |
173 | tabLayout = new QGridLayout( tab ); | 173 | tabLayout = new QGridLayout( tab ); |
174 | tabLayout->setSpacing( 2); | 174 | tabLayout->setSpacing( 2); |
175 | tabLayout->setMargin( 2); | 175 | tabLayout->setMargin( 2); |
176 | 176 | ||
177 | Local_View = new QListView( tab, "Local_View" ); | 177 | Local_View = new QListView( tab, "Local_View" ); |
178 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 178 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
179 | Local_View->addColumn( tr("File"),130); | 179 | Local_View->addColumn( tr("File"),130); |
180 | Local_View->addColumn( tr("Size"),-1); | 180 | Local_View->addColumn( tr("Size"),-1); |
181 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 181 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
182 | Local_View->addColumn( tr("Date"),-1); | 182 | Local_View->addColumn( tr("Date"),-1); |
183 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 183 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
184 | Local_View->setAllColumnsShowFocus(TRUE); | 184 | Local_View->setAllColumnsShowFocus(TRUE); |
185 | Local_View->setMultiSelection( TRUE ); | 185 | Local_View->setMultiSelection( TRUE ); |
186 | Local_View->setSelectionMode(QListView::Extended); | 186 | Local_View->setSelectionMode(QListView::Extended); |
187 | 187 | ||
188 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 188 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
189 | 189 | ||
190 | 190 | ||
191 | 191 | ||
192 | tabLayout->addWidget( Local_View, 0, 0 ); | 192 | tabLayout->addWidget( Local_View, 0, 0 ); |
193 | 193 | ||
194 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 194 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
195 | this,SLOT( localListClicked(QListViewItem *)) ); | 195 | this,SLOT( localListClicked(QListViewItem *)) ); |
196 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 196 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
197 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 197 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
198 | 198 | ||
199 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 199 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
200 | 200 | ||
201 | TabWidget->insertTab( tab, tr("1")); | 201 | TabWidget->insertTab( tab, tr("1")); |
202 | 202 | ||
203 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 203 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
204 | tabLayout_2 = new QGridLayout( tab_2 ); | 204 | tabLayout_2 = new QGridLayout( tab_2 ); |
205 | tabLayout_2->setSpacing( 2); | 205 | tabLayout_2->setSpacing( 2); |
206 | tabLayout_2->setMargin( 2); | 206 | tabLayout_2->setMargin( 2); |
207 | 207 | ||
208 | Remote_View = new QListView( tab_2, "Remote_View" ); | 208 | Remote_View = new QListView( tab_2, "Remote_View" ); |
209 | Remote_View->addColumn( tr("File"),130); | 209 | Remote_View->addColumn( tr("File"),130); |
210 | Remote_View->addColumn( tr("Size"),-1); | 210 | Remote_View->addColumn( tr("Size"),-1); |
211 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 211 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
212 | Remote_View->addColumn( tr("Date"),-1); | 212 | Remote_View->addColumn( tr("Date"),-1); |
213 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 213 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
214 | Remote_View->setAllColumnsShowFocus(TRUE); | 214 | Remote_View->setAllColumnsShowFocus(TRUE); |
215 | Remote_View->setMultiSelection( TRUE ); | 215 | Remote_View->setMultiSelection( TRUE ); |
216 | Remote_View->setSelectionMode(QListView::Extended); | 216 | Remote_View->setSelectionMode(QListView::Extended); |
217 | 217 | ||
218 | |||
218 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 219 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
219 | 220 | ||
220 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 221 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
221 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 222 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
222 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 223 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
223 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 224 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
224 | // connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 225 | // connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
225 | 226 | ||
226 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 227 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
227 | 228 | ||
229 | |||
228 | TabWidget->insertTab( tab_2, tr( "2")); | 230 | TabWidget->insertTab( tab_2, tr( "2")); |
229 | 231 | ||
230 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 232 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
231 | this,SLOT(tabChanged(QWidget*))); | 233 | this,SLOT(tabChanged(QWidget*))); |
232 | 234 | ||
233 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 235 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
234 | tabLayout_3 = new QGridLayout( tab_3 ); | 236 | tabLayout_3 = new QGridLayout( tab_3 ); |
235 | tabLayout_3->setSpacing( 2); | 237 | tabLayout_3->setSpacing( 2); |
236 | tabLayout_3->setMargin( 2); | 238 | tabLayout_3->setMargin( 2); |
237 | 239 | ||
238 | 240 | ||
239 | // OFileDialog fileDialog; | 241 | // OFileDialog fileDialog; |
240 | // fileDialog; | 242 | // fileDialog; |
241 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 243 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
242 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 244 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
243 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 245 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
244 | 246 | ||
245 | QListView *fileTree; | 247 | QListView *fileTree; |
246 | fileTree = new QListView( tab_3, "tree" ); | 248 | fileTree = new QListView( tab_3, "tree" ); |
247 | 249 | ||
248 | 250 | ||
249 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 251 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
250 | 252 | ||
251 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 253 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
254 | */ | ||
255 | |||
252 | /////////////// | 256 | /////////////// |
253 | 257 | ||
254 | //////////////////// | 258 | //////////////////// |
255 | 259 | ||
256 | 260 | ||
257 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 261 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
258 | currentDir.setPath( QDir::currentDirPath()); | 262 | currentDir.setPath( QDir::currentDirPath()); |
259 | 263 | ||
260 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 264 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
261 | currentRemoteDir.setPath( QDir::currentDirPath()); | 265 | currentRemoteDir.setPath( QDir::currentDirPath()); |
262 | 266 | ||
263 | b = TRUE; | 267 | b = TRUE; |
264 | 268 | ||
265 | filterStr="*"; | 269 | filterStr="*"; |
266 | b=FALSE; | 270 | b=FALSE; |
267 | 271 | ||
268 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 272 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); |
269 | 273 | ||
270 | populateLocalView(); | 274 | populateLocalView(); |
271 | populateRemoteView(); | 275 | populateRemoteView(); |
272 | currentPathCombo->setFocus(); | 276 | currentPathCombo->setFocus(); |
273 | } | 277 | } |
274 | 278 | ||
275 | AdvancedFm::~AdvancedFm() | 279 | AdvancedFm::~AdvancedFm() |
276 | { | 280 | { |
277 | } | 281 | } |
278 | 282 | ||
279 | void AdvancedFm::cleanUp() | 283 | void AdvancedFm::cleanUp() |
280 | { | 284 | { |
281 | QString sfile=QDir::homeDirPath(); | 285 | QString sfile=QDir::homeDirPath(); |
282 | if(sfile.right(1) != "/") | 286 | if(sfile.right(1) != "/") |
283 | sfile+="/._temp"; | 287 | sfile+="/._temp"; |
284 | else | 288 | else |
285 | sfile+="._temp"; | 289 | sfile+="._temp"; |
286 | QFile file( sfile); | 290 | QFile file( sfile); |
287 | if(file.exists()) | 291 | if(file.exists()) |
288 | file.remove(); | 292 | file.remove(); |
289 | } | 293 | } |
290 | 294 | ||
291 | void AdvancedFm::tabChanged(QWidget *w) | 295 | void AdvancedFm::tabChanged(QWidget *w) |
292 | { | 296 | { |
293 | if (TabWidget->currentPageIndex() == 0) { | 297 | if (TabWidget->currentPageIndex() == 0) { |
294 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 298 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
295 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 299 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
296 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 300 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
297 | } | 301 | } |
298 | if (TabWidget->currentPageIndex() == 1) { | 302 | if (TabWidget->currentPageIndex() == 1) { |
299 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 303 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
300 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 304 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
301 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 305 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
302 | } | 306 | } |
303 | } | 307 | } |
304 | 308 | ||
305 | 309 | ||
306 | void AdvancedFm::populateLocalView() | 310 | void AdvancedFm::populateLocalView() |
307 | { | 311 | { |
308 | QPixmap pm; | 312 | QPixmap pm; |
309 | Local_View->clear(); | 313 | Local_View->clear(); |
310 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 314 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
311 | currentDir.setMatchAllDirs(TRUE); | 315 | currentDir.setMatchAllDirs(TRUE); |
312 | currentDir.setNameFilter(filterStr); | 316 | currentDir.setNameFilter(filterStr); |
313 | QString fileL, fileS, fileDate; | 317 | QString fileL, fileS, fileDate; |
314 | // qDebug(currentDir.canonicalPath()); | 318 | // qDebug(currentDir.canonicalPath()); |
315 | // struct stat buf; | 319 | // struct stat buf; |
316 | // mode_t mode; | 320 | // mode_t mode; |
317 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 321 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
318 | setCaption("AdvancedFm :: "+fs); | 322 | setCaption("AdvancedFm :: "+fs); |
319 | bool isDir=FALSE; | 323 | bool isDir=FALSE; |
320 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 324 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
321 | QFileInfoListIterator it(*list); | 325 | QFileInfoListIterator it(*list); |
322 | QFileInfo *fi; | 326 | QFileInfo *fi; |
323 | while ( (fi=it.current()) ) { | 327 | while ( (fi=it.current()) ) { |
324 | if (fi->isSymLink() ) { | 328 | if (fi->isSymLink() ) { |
325 | QString symLink=fi->readLink(); | 329 | QString symLink=fi->readLink(); |
326 | // qDebug("Symlink detected "+symLink); | 330 | // qDebug("Symlink detected "+symLink); |
327 | QFileInfo sym( symLink); | 331 | QFileInfo sym( symLink); |
328 | fileS.sprintf( "%10li", sym.size() ); | 332 | fileS.sprintf( "%10li", sym.size() ); |
329 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 333 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
330 | fileDate = sym.lastModified().toString(); | 334 | fileDate = sym.lastModified().toString(); |
331 | } else { | 335 | } else { |
332 | fileS.sprintf( "%10li", fi->size() ); | 336 | fileS.sprintf( "%10li", fi->size() ); |
333 | fileL.sprintf( "%s",fi->fileName().data() ); | 337 | fileL.sprintf( "%s",fi->fileName().data() ); |
334 | fileDate= fi->lastModified().toString(); | 338 | fileDate= fi->lastModified().toString(); |
335 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 339 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
336 | fileL+="/"; | 340 | fileL+="/"; |
337 | isDir=TRUE; | 341 | isDir=TRUE; |
338 | // qDebug( fileL); | 342 | // qDebug( fileL); |
339 | } | 343 | } |
340 | } | 344 | } |
341 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 345 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
342 | if(fileL !="./" && fi->exists()) { | 346 | if(fileL !="./" && fi->exists()) { |
343 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 347 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
344 | 348 | ||
345 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 349 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
346 | 350 | ||
347 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 351 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
348 | pm = Resource::loadPixmap( "lockedfolder" ); | 352 | pm = Resource::loadPixmap( "lockedfolder" ); |
349 | else | 353 | else |
350 | pm= Resource::loadPixmap( "folder" ); | 354 | pm= Resource::loadPixmap( "folder" ); |
351 | // item->setPixmap( 0,pm ); | 355 | // item->setPixmap( 0,pm ); |
352 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 356 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
353 | pm = Resource::loadPixmap( "exec"); | 357 | pm = Resource::loadPixmap( "exec"); |
354 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 358 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
355 | | fileInfo.permission( QFileInfo::ExeGroup) | 359 | | fileInfo.permission( QFileInfo::ExeGroup) |
356 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 360 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
357 | pm = Resource::loadPixmap( "exec"); | 361 | pm = Resource::loadPixmap( "exec"); |
358 | // else { //is exec | 362 | // else { //is exec |
359 | // pm = Resource::loadPixmap( "exec"); | 363 | // pm = Resource::loadPixmap( "exec"); |
360 | // } | 364 | // } |
361 | // // item->setPixmap( 0,pm); | 365 | // // item->setPixmap( 0,pm); |
362 | } else if( !fi->isReadable() ) { | 366 | } else if( !fi->isReadable() ) { |
363 | pm = Resource::loadPixmap( "locked" ); | 367 | pm = Resource::loadPixmap( "locked" ); |
364 | // item->setPixmap( 0,pm); | 368 | // item->setPixmap( 0,pm); |
365 | } else { //everything else goes by mimetype | 369 | } else { //everything else goes by mimetype |
366 | MimeType mt(fi->filePath()); | 370 | MimeType mt(fi->filePath()); |
367 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 371 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
368 | if(pm.isNull()) | 372 | if(pm.isNull()) |
369 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 373 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
370 | // item->setPixmap( 0,pm); | 374 | // item->setPixmap( 0,pm); |
371 | } | 375 | } |
372 | item->setPixmap( 0,pm); | 376 | item->setPixmap( 0,pm); |
373 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 377 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
374 | // overlay link image | 378 | // overlay link image |
375 | pm= Resource::loadPixmap( "folder" ); | 379 | pm= Resource::loadPixmap( "folder" ); |
376 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 380 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
377 | QPainter painter( &pm ); | 381 | QPainter painter( &pm ); |
378 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 382 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
379 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 383 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
380 | item->setPixmap( 0, pm); | 384 | item->setPixmap( 0, pm); |
381 | } | 385 | } |
382 | } | 386 | } |
383 | isDir=FALSE; | 387 | isDir=FALSE; |
384 | ++it; | 388 | ++it; |
385 | } | 389 | } |
386 | 390 | ||
387 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 391 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
388 | struct stat buf; | 392 | struct stat buf; |
389 | // struct stat st; | 393 | // struct stat st; |
390 | dev_t devT; | 394 | dev_t devT; |
391 | // mode_t mode; | 395 | // mode_t mode; |
392 | DIR *dir; | 396 | DIR *dir; |
393 | // int fd = 0; | 397 | // int fd = 0; |
394 | struct dirent *mydirent; | 398 | struct dirent *mydirent; |
395 | // int i = 1; | 399 | // int i = 1; |
396 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 400 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
397 | while ((mydirent = readdir(dir)) != NULL) { | 401 | while ((mydirent = readdir(dir)) != NULL) { |
398 | lstat( mydirent->d_name, &buf); | 402 | lstat( mydirent->d_name, &buf); |
399 | qDebug(mydirent->d_name); | 403 | qDebug(mydirent->d_name); |
400 | // mode = buf.st_mode; | 404 | // mode = buf.st_mode; |
401 | fileL.sprintf("%s", mydirent->d_name); | 405 | fileL.sprintf("%s", mydirent->d_name); |
402 | // fileS.sprintf("%d, %d", ); //this isn't correct | 406 | // fileS.sprintf("%d, %d", ); //this isn't correct |
403 | devT = buf.st_dev; | 407 | devT = buf.st_dev; |
404 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 408 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
405 | // fileS.sprintf("%d,%d", devT, devT); | 409 | // fileS.sprintf("%d,%d", devT, devT); |
406 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 410 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
407 | if( fileL.find(".") == -1 ){ | 411 | if( fileL.find(".") == -1 ){ |
408 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 412 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); |
409 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 413 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
410 | item->setPixmap( 0,pm); | 414 | item->setPixmap( 0,pm); |
411 | } | 415 | } |
412 | } | 416 | } |
413 | 417 | ||
414 | closedir(dir); | 418 | closedir(dir); |
415 | } | 419 | } |
416 | 420 | ||
417 | Local_View->setSorting( 3,FALSE); | 421 | Local_View->setSorting( 3,FALSE); |
418 | fillCombo( (const QString &) currentDir.canonicalPath()); | 422 | fillCombo( (const QString &) currentDir.canonicalPath()); |
419 | } | 423 | } |
420 | 424 | ||
421 | 425 | ||
422 | void AdvancedFm::populateRemoteView() | 426 | void AdvancedFm::populateRemoteView() |
423 | { | 427 | { |
424 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 428 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
425 | // QListViewItemIterator it( Remote_View ); | 429 | // QListViewItemIterator it( Remote_View ); |
426 | // for ( ; it.current(); ++it ) { | 430 | // for ( ; it.current(); ++it ) { |
427 | // if ( it.current()->isSelected() ) { | 431 | // if ( it.current()->isSelected() ) { |
428 | // QString strItem = it.current()->text(0); | 432 | // QString strItem = it.current()->text(0); |
429 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; | 433 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; |
430 | // QFileInfo fi(localFile); | 434 | // QFileInfo fi(localFile); |
431 | // } | 435 | // } |
432 | // } | 436 | // } |
433 | QPixmap pm; | 437 | QPixmap pm; |
434 | Remote_View->clear(); | 438 | Remote_View->clear(); |
435 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 439 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
436 | currentRemoteDir.setMatchAllDirs(TRUE); | 440 | currentRemoteDir.setMatchAllDirs(TRUE); |
437 | currentRemoteDir.setNameFilter(filterStr); | 441 | currentRemoteDir.setNameFilter(filterStr); |
438 | QString fileL, fileS, fileDate; | 442 | QString fileL, fileS, fileDate; |
439 | 443 | ||
440 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 444 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
441 | setCaption("AdvancedFm :: "+fs); | 445 | setCaption("AdvancedFm :: "+fs); |
442 | bool isDir=FALSE; | 446 | bool isDir=FALSE; |
443 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 447 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
444 | QFileInfoListIterator it(*list); | 448 | QFileInfoListIterator it(*list); |
445 | QFileInfo *fi; | 449 | QFileInfo *fi; |
446 | while ( (fi=it.current()) ) { | 450 | while ( (fi=it.current()) ) { |
447 | if (fi->isSymLink() ){ | 451 | if (fi->isSymLink() ){ |
448 | QString symLink=fi->readLink(); | 452 | QString symLink=fi->readLink(); |
449 | // qDebug("Symlink detected "+symLink); | 453 | // qDebug("Symlink detected "+symLink); |
450 | QFileInfo sym( symLink); | 454 | QFileInfo sym( symLink); |
451 | fileS.sprintf( "%10li", sym.size() ); | 455 | fileS.sprintf( "%10li", sym.size() ); |
452 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 456 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
453 | fileDate = sym.lastModified().toString(); | 457 | fileDate = sym.lastModified().toString(); |
454 | } else { | 458 | } else { |
455 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 459 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
456 | fileS.sprintf( "%10li", fi->size() ); | 460 | fileS.sprintf( "%10li", fi->size() ); |
457 | fileL.sprintf( "%s",fi->fileName().data() ); | 461 | fileL.sprintf( "%s",fi->fileName().data() ); |
458 | fileDate= fi->lastModified().toString(); | 462 | fileDate= fi->lastModified().toString(); |
459 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 463 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
460 | fileL+="/"; | 464 | fileL+="/"; |
461 | isDir=TRUE; | 465 | isDir=TRUE; |
462 | // qDebug( fileL); | 466 | // qDebug( fileL); |
463 | } | 467 | } |
464 | } | 468 | } |
465 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); | 469 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); |
466 | if(fileL !="./" && fi->exists()) { | 470 | if(fileL !="./" && fi->exists()) { |
467 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 471 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
468 | QPixmap pm; | 472 | QPixmap pm; |
469 | 473 | ||
470 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 474 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
471 | if( !QDir( fi->filePath() ).isReadable()) | 475 | if( !QDir( fi->filePath() ).isReadable()) |
472 | pm = Resource::loadPixmap( "lockedfolder" ); | 476 | pm = Resource::loadPixmap( "lockedfolder" ); |
473 | else | 477 | else |
474 | pm= Resource::loadPixmap( "folder" ); | 478 | pm= Resource::loadPixmap( "folder" ); |
475 | // item->setPixmap( 0,pm ); | 479 | // item->setPixmap( 0,pm ); |
476 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 480 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
477 | pm = Resource::loadPixmap( "exec"); | 481 | pm = Resource::loadPixmap( "exec"); |
478 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 482 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
479 | | fileInfo.permission( QFileInfo::ExeGroup) | 483 | | fileInfo.permission( QFileInfo::ExeGroup) |
480 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 484 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
481 | pm = Resource::loadPixmap( "exec"); | 485 | pm = Resource::loadPixmap( "exec"); |
482 | // item->setPixmap( 0,pm); | 486 | // item->setPixmap( 0,pm); |
483 | } else if( !fi->isReadable() ) { | 487 | } else if( !fi->isReadable() ) { |
484 | pm = Resource::loadPixmap( "locked" ); | 488 | pm = Resource::loadPixmap( "locked" ); |
485 | // item->setPixmap( 0,pm); | 489 | // item->setPixmap( 0,pm); |
486 | } else { | 490 | } else { |
487 | MimeType mt(fi->filePath()); | 491 | MimeType mt(fi->filePath()); |
488 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 492 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
489 | if(pm.isNull()) | 493 | if(pm.isNull()) |
490 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 494 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
491 | // item->setPixmap( 0,pm); | 495 | // item->setPixmap( 0,pm); |
492 | } | 496 | } |
493 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 497 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
494 | // overlay link image | 498 | // overlay link image |
495 | pm= Resource::loadPixmap( "folder" ); | 499 | pm= Resource::loadPixmap( "folder" ); |
496 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 500 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
497 | QPainter painter( &pm ); | 501 | QPainter painter( &pm ); |
498 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 502 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
499 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 503 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
500 | // item->setPixmap( 0, pm); | 504 | // item->setPixmap( 0, pm); |
501 | } | 505 | } |
502 | item->setPixmap( 0, pm); | 506 | item->setPixmap( 0, pm); |
503 | } | 507 | } |
504 | isDir=FALSE; | 508 | isDir=FALSE; |
505 | ++it; | 509 | ++it; |
506 | } | 510 | } |
507 | 511 | ||
508 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 512 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
509 | struct stat buf; | 513 | struct stat buf; |
510 | // struct stat st; | 514 | // struct stat st; |
511 | // mode_t mode; | 515 | // mode_t mode; |
512 | DIR *dir; | 516 | DIR *dir; |
513 | // int fd = 0; | 517 | // int fd = 0; |
514 | struct dirent *mydirent; | 518 | struct dirent *mydirent; |
515 | // int i = 1; | 519 | // int i = 1; |
516 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 520 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
517 | while ((mydirent = readdir(dir)) != NULL) { | 521 | while ((mydirent = readdir(dir)) != NULL) { |
518 | lstat( mydirent->d_name, &buf); | 522 | lstat( mydirent->d_name, &buf); |
519 | qDebug(mydirent->d_name); | 523 | qDebug(mydirent->d_name); |
520 | // mode = buf.st_mode; | 524 | // mode = buf.st_mode; |
521 | fileL.sprintf("%s", mydirent->d_name); | 525 | fileL.sprintf("%s", mydirent->d_name); |
522 | // fileS.sprintf("%d, %d", ); //this isn't correct | 526 | // fileS.sprintf("%d, %d", ); //this isn't correct |
523 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 527 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
524 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 528 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
525 | if( fileL.find(".") == -1 ){ | 529 | if( fileL.find(".") == -1 ){ |
526 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 530 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
527 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 531 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
528 | item->setPixmap( 0,pm); | 532 | item->setPixmap( 0,pm); |
529 | } | 533 | } |
530 | } | 534 | } |
531 | 535 | ||
532 | closedir(dir); | 536 | closedir(dir); |
533 | } | 537 | } |
534 | 538 | ||
535 | Remote_View->setSorting( 3,FALSE); | 539 | Remote_View->setSorting( 3,FALSE); |
536 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 540 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
537 | } | 541 | } |
538 | 542 | ||
539 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) | 543 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) |
540 | { | 544 | { |
541 | if(selectedItem) { | 545 | if(selectedItem) { |
542 | QString strItem=selectedItem->text(0); | 546 | QString strItem=selectedItem->text(0); |
543 | QString strSize=selectedItem->text(1); | 547 | QString strSize=selectedItem->text(1); |
544 | strSize=strSize.stripWhiteSpace(); | 548 | strSize=strSize.stripWhiteSpace(); |
545 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 549 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
546 | // is symlink | 550 | // is symlink |
547 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 551 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
548 | if(QDir(strItem2).exists() ) { | 552 | if(QDir(strItem2).exists() ) { |
549 | currentDir.cd(strItem2, TRUE); | 553 | currentDir.cd(strItem2, TRUE); |
550 | populateLocalView(); | 554 | populateLocalView(); |
551 | } | 555 | } |
552 | } else { // not a symlink | 556 | } else { // not a symlink |
553 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 557 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
554 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 558 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
555 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 559 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
556 | currentDir.cd(strItem,FALSE); | 560 | currentDir.cd(strItem,FALSE); |
557 | populateLocalView(); | 561 | populateLocalView(); |
558 | } else { | 562 | } else { |
559 | currentDir.cdUp(); | 563 | currentDir.cdUp(); |
560 | populateLocalView(); | 564 | populateLocalView(); |
561 | } | 565 | } |
562 | if(QDir(strItem).exists()){ | 566 | if(QDir(strItem).exists()){ |
563 | currentDir.cd(strItem, TRUE); | 567 | currentDir.cd(strItem, TRUE); |
564 | populateLocalView(); | 568 | populateLocalView(); |
565 | } | 569 | } |
566 | } else { | 570 | } else { |
567 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 571 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
568 | if( QFile::exists(strItem ) ) { | 572 | if( QFile::exists(strItem ) ) { |
569 | // qDebug("clicked item "+strItem); | 573 | // qDebug("clicked item "+strItem); |
570 | // DocLnk doc( strItem, FALSE ); | 574 | // DocLnk doc( strItem, FALSE ); |
571 | // doc.execute(); | 575 | // doc.execute(); |
572 | // Local_View->clearSelection(); | 576 | // Local_View->clearSelection(); |
573 | } | 577 | } |
574 | } //end not symlink | 578 | } //end not symlink |
575 | chdir(strItem.latin1()); | 579 | chdir(strItem.latin1()); |
576 | } | 580 | } |
577 | } | 581 | } |
578 | } | 582 | } |
579 | 583 | ||
580 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) | 584 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) |
581 | { | 585 | { |
582 | if(selectedItem) { | 586 | if(selectedItem) { |
583 | QString strItem=selectedItem->text(0); | 587 | QString strItem=selectedItem->text(0); |
584 | QString strSize=selectedItem->text(1); | 588 | QString strSize=selectedItem->text(1); |
585 | strSize=strSize.stripWhiteSpace(); | 589 | strSize=strSize.stripWhiteSpace(); |
586 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 590 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
587 | // is symlink | 591 | // is symlink |
588 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 592 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
589 | if(QDir(strItem2).exists() ) { | 593 | if(QDir(strItem2).exists() ) { |
590 | currentRemoteDir.cd(strItem2, TRUE); | 594 | currentRemoteDir.cd(strItem2, TRUE); |
591 | populateRemoteView(); | 595 | populateRemoteView(); |
592 | } | 596 | } |
593 | } else { // not a symlink | 597 | } else { // not a symlink |
594 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 598 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
595 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 599 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
596 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 600 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
597 | currentRemoteDir.cd(strItem,FALSE); | 601 | currentRemoteDir.cd(strItem,FALSE); |
598 | populateRemoteView(); | 602 | populateRemoteView(); |
599 | } else { | 603 | } else { |
600 | currentRemoteDir.cdUp(); | 604 | currentRemoteDir.cdUp(); |
601 | populateRemoteView(); | 605 | populateRemoteView(); |
602 | } | 606 | } |
603 | if(QDir(strItem).exists()){ | 607 | if(QDir(strItem).exists()){ |
604 | currentRemoteDir.cd(strItem, TRUE); | 608 | currentRemoteDir.cd(strItem, TRUE); |
605 | populateRemoteView(); | 609 | populateRemoteView(); |
606 | } | 610 | } |
607 | } else { | 611 | } else { |
608 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 612 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
609 | if( QFile::exists(strItem ) ) { | 613 | if( QFile::exists(strItem ) ) { |
610 | // qDebug("clicked item "+strItem); | 614 | // qDebug("clicked item "+strItem); |
611 | // DocLnk doc( strItem, FALSE ); | 615 | // DocLnk doc( strItem, FALSE ); |
612 | // doc.execute(); | 616 | // doc.execute(); |
613 | // Remote_View->clearSelection(); | 617 | // Remote_View->clearSelection(); |
614 | } | 618 | } |
615 | } //end not symlink | 619 | } //end not symlink |
616 | chdir(strItem.latin1()); | 620 | chdir(strItem.latin1()); |
617 | } | 621 | } |
618 | } | 622 | } |
619 | } | 623 | } |
620 | 624 | ||
621 | void AdvancedFm::doLocalCd() | 625 | void AdvancedFm::doLocalCd() |
622 | { | 626 | { |
623 | localListClicked( Local_View->currentItem()); | 627 | localListClicked( Local_View->currentItem()); |
624 | } | 628 | } |
625 | 629 | ||
626 | void AdvancedFm::doRemoteCd() | 630 | void AdvancedFm::doRemoteCd() |
627 | { | 631 | { |
628 | localListClicked( Remote_View->currentItem()); | 632 | localListClicked( Remote_View->currentItem()); |
629 | } | 633 | } |
630 | 634 | ||
631 | void AdvancedFm::showHidden() | 635 | void AdvancedFm::showHidden() |
632 | { | 636 | { |
633 | if (b) { | 637 | if (b) { |
634 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 638 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
635 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 639 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
636 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 640 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
637 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 641 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
638 | b=FALSE; | 642 | b=FALSE; |
639 | 643 | ||
640 | } else { | 644 | } else { |
641 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 645 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
642 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 646 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
643 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 647 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
644 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 648 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
645 | b=TRUE; | 649 | b=TRUE; |
646 | } | 650 | } |
647 | populateLocalView(); | 651 | populateLocalView(); |
648 | 652 | ||
649 | } | 653 | } |
650 | 654 | ||
651 | void AdvancedFm::showRemoteHidden() | 655 | void AdvancedFm::showRemoteHidden() |
652 | { | 656 | { |
653 | if (b) { | 657 | if (b) { |
654 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 658 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
655 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); | 659 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); |
656 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 660 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
657 | b=TRUE; | 661 | b=TRUE; |
658 | 662 | ||
659 | } else { | 663 | } else { |
660 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 664 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
661 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 665 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
662 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 666 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
663 | b=FALSE; | 667 | b=FALSE; |
664 | } | 668 | } |
665 | populateRemoteView(); | 669 | populateRemoteView(); |
666 | } | 670 | } |
667 | 671 | ||
668 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 672 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
669 | { | 673 | { |
670 | qDebug("list pressed"); | 674 | qDebug("list pressed"); |
671 | switch (mouse) { | 675 | switch (mouse) { |
672 | case 1: | 676 | case 1: |
673 | break; | 677 | break; |
674 | case 2: | 678 | case 2: |
675 | menuTimer.start( 750, TRUE ); | 679 | menuTimer.start( 750, TRUE ); |
676 | qDebug("Start menu timer\n"); | 680 | qDebug("Start menu timer\n"); |
677 | break; | 681 | break; |
678 | }; | 682 | }; |
679 | } | 683 | } |
680 | 684 | ||
681 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 685 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
682 | { | 686 | { |
683 | 687 | ||
684 | switch (mouse) { | 688 | switch (mouse) { |
685 | case 1: | 689 | case 1: |
686 | break; | 690 | break; |
687 | case 2: | 691 | case 2: |
688 | menuTimer.start( 750, TRUE ); | 692 | menuTimer.start( 750, TRUE ); |
689 | qDebug("Start menu timer"); | 693 | qDebug("Start menu timer"); |
690 | break; | 694 | break; |
691 | }; | 695 | }; |
692 | } | 696 | } |
693 | 697 | ||
694 | void AdvancedFm::runThis() { | 698 | void AdvancedFm::runThis() { |
695 | // QFileInfo *fi; | 699 | // QFileInfo *fi; |
696 | QString fs; | 700 | QString fs; |
697 | if (TabWidget->currentPageIndex() == 0) { | 701 | if (TabWidget->currentPageIndex() == 0) { |
698 | QString curFile = Local_View->currentItem()->text(0); | 702 | QString curFile = Local_View->currentItem()->text(0); |
699 | if(curFile != "../") { | 703 | if(curFile != "../") { |
700 | 704 | ||
701 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 705 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
702 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 706 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
703 | qDebug( fileInfo.owner()); | 707 | qDebug( fileInfo.owner()); |
704 | if( (fileInfo.permission( QFileInfo::ExeUser) | 708 | if( (fileInfo.permission( QFileInfo::ExeUser) |
705 | | fileInfo.permission( QFileInfo::ExeGroup) | 709 | | fileInfo.permission( QFileInfo::ExeGroup) |
706 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 710 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
707 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 711 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
708 | // if( fileInfo.isExecutable() | | 712 | // if( fileInfo.isExecutable() | |
709 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 713 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
710 | e << curFile; | 714 | e << curFile; |
711 | } else { | 715 | } else { |
712 | curFile = currentDir.canonicalPath()+"/"+curFile; | 716 | curFile = currentDir.canonicalPath()+"/"+curFile; |
713 | DocLnk nf(curFile); | 717 | DocLnk nf(curFile); |
714 | QString execStr = nf.exec(); | 718 | QString execStr = nf.exec(); |
715 | qDebug( execStr); | 719 | qDebug( execStr); |
716 | if( execStr.isEmpty() ) { | 720 | if( execStr.isEmpty() ) { |
717 | } else { | 721 | } else { |
718 | nf.execute(); | 722 | nf.execute(); |
719 | } | 723 | } |
720 | } | 724 | } |
721 | } | 725 | } |
722 | // MimeType mt( curFile); | 726 | // MimeType mt( curFile); |
723 | } else { | 727 | } else { |
724 | QString curFile = Remote_View->currentItem()->text(0); | 728 | QString curFile = Remote_View->currentItem()->text(0); |
725 | if(curFile != "../") { | 729 | if(curFile != "../") { |
726 | 730 | ||
727 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 731 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
728 | qDebug("Filesystemtype is "+fs); | 732 | qDebug("Filesystemtype is "+fs); |
729 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 733 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
730 | if( (fileInfo.permission( QFileInfo::ExeUser) | 734 | if( (fileInfo.permission( QFileInfo::ExeUser) |
731 | | fileInfo.permission( QFileInfo::ExeGroup) | 735 | | fileInfo.permission( QFileInfo::ExeGroup) |
732 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 736 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
733 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 737 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
734 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 738 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
735 | e << curFile; | 739 | e << curFile; |
736 | } else { | 740 | } else { |
737 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 741 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
738 | DocLnk nf(curFile); | 742 | DocLnk nf(curFile); |
739 | QString execStr = nf.exec(); | 743 | QString execStr = nf.exec(); |
740 | qDebug(execStr); | 744 | qDebug(execStr); |
741 | if( execStr.isEmpty() ) { | 745 | if( execStr.isEmpty() ) { |
742 | } else { | 746 | } else { |
743 | nf.execute(); | 747 | nf.execute(); |
744 | } | 748 | } |
745 | } | 749 | } |
746 | } | 750 | } |
747 | // MimeType mt( curFile); | 751 | // MimeType mt( curFile); |
748 | } | 752 | } |
749 | } | 753 | } |
750 | 754 | ||
751 | void AdvancedFm::runText() { | 755 | void AdvancedFm::runText() { |
752 | if (TabWidget->currentPageIndex() == 0) { | 756 | if (TabWidget->currentPageIndex() == 0) { |
753 | QString curFile = Local_View->currentItem()->text(0); | 757 | QString curFile = Local_View->currentItem()->text(0); |
754 | if(curFile != "../") { | 758 | if(curFile != "../") { |
755 | curFile = currentDir.canonicalPath()+"/"+curFile; | 759 | curFile = currentDir.canonicalPath()+"/"+curFile; |
756 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 760 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
757 | e << curFile; | 761 | e << curFile; |
758 | } | 762 | } |
759 | } else { | 763 | } else { |
760 | QString curFile = Remote_View->currentItem()->text(0); | 764 | QString curFile = Remote_View->currentItem()->text(0); |
761 | if(curFile != "../") { | 765 | if(curFile != "../") { |
762 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 766 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
763 | DocLnk nf(curFile); | 767 | DocLnk nf(curFile); |
764 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 768 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
765 | e << curFile; | 769 | e << curFile; |
766 | } | 770 | } |
767 | } | 771 | } |
768 | } | 772 | } |
769 | 773 | ||
770 | void AdvancedFm::localMakDir() | 774 | void AdvancedFm::localMakDir() |
771 | { | 775 | { |
772 | InputDialog *fileDlg; | 776 | InputDialog *fileDlg; |
773 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 777 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
774 | fileDlg->exec(); | 778 | fileDlg->exec(); |
775 | if( fileDlg->result() == 1 ) { | 779 | if( fileDlg->result() == 1 ) { |
776 | QString filename = fileDlg->LineEdit1->text(); | 780 | QString filename = fileDlg->LineEdit1->text(); |
777 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 781 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
778 | } | 782 | } |
779 | populateLocalView(); | 783 | populateLocalView(); |
780 | } | 784 | } |
781 | 785 | ||
782 | void AdvancedFm::remoteMakDir() | 786 | void AdvancedFm::remoteMakDir() |
783 | { | 787 | { |
784 | InputDialog *fileDlg; | 788 | InputDialog *fileDlg; |
785 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 789 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
786 | fileDlg->exec(); | 790 | fileDlg->exec(); |
787 | if( fileDlg->result() == 1 ) { | 791 | if( fileDlg->result() == 1 ) { |
788 | QString filename = fileDlg->LineEdit1->text(); | 792 | QString filename = fileDlg->LineEdit1->text(); |
789 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 793 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
790 | } | 794 | } |
791 | populateRemoteView(); | 795 | populateRemoteView(); |
792 | } | 796 | } |
793 | 797 | ||
794 | void AdvancedFm::localDelete() | 798 | void AdvancedFm::localDelete() |
795 | { | 799 | { |
796 | QStringList curFileList = getPath(); | 800 | QStringList curFileList = getPath(); |
797 | if(curFileList.count() > 0) { | 801 | if(curFileList.count() > 0) { |
798 | QString myFile; | 802 | QString myFile; |
799 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 803 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
800 | myFile = (*it); | 804 | myFile = (*it); |
801 | if( myFile.find(" -> ",0,TRUE) != -1) | 805 | if( myFile.find(" -> ",0,TRUE) != -1) |
802 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 806 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
803 | 807 | ||
804 | QString f = currentDir.canonicalPath(); | 808 | QString f = currentDir.canonicalPath(); |
805 | if(f.right(1).find("/",0,TRUE) == -1) | 809 | if(f.right(1).find("/",0,TRUE) == -1) |
806 | f+="/"; | 810 | f+="/"; |
807 | f+=myFile; | 811 | f+=myFile; |
808 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 812 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
809 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 813 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
810 | "\nand all it's contents ?" | 814 | "\nand all it's contents ?" |
811 | ,tr("Yes"),tr("No"),0,0,1) ) { | 815 | ,tr("Yes"),tr("No"),0,0,1) ) { |
812 | case 0: { | 816 | case 0: { |
813 | f=f.left(f.length()-1); | 817 | f=f.left(f.length()-1); |
814 | QString cmd="rm -rf "+f; | 818 | QString cmd="rm -rf "+f; |
815 | system( cmd.latin1()); | 819 | system( cmd.latin1()); |
816 | populateLocalView(); | 820 | populateLocalView(); |
817 | } | 821 | } |
818 | break; | 822 | break; |
819 | case 1: | 823 | case 1: |
820 | // exit | 824 | // exit |
821 | break; | 825 | break; |
822 | }; | 826 | }; |
823 | 827 | ||
824 | } else { | 828 | } else { |
825 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 829 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
826 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 830 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
827 | case 0: { | 831 | case 0: { |
828 | QString cmd="rm "+f; | 832 | QString cmd="rm "+f; |
829 | QFile file(f); | 833 | QFile file(f); |
830 | file.remove(); | 834 | file.remove(); |
831 | // system( cmd.latin1()); | 835 | // system( cmd.latin1()); |
832 | populateLocalView(); | 836 | populateLocalView(); |
833 | } | 837 | } |
834 | break; | 838 | break; |
835 | case 1: | 839 | case 1: |
836 | // exit | 840 | // exit |
837 | break; | 841 | break; |
838 | }; | 842 | }; |
839 | } | 843 | } |
840 | } | 844 | } |
841 | } | 845 | } |
842 | } | 846 | } |
843 | 847 | ||
844 | void AdvancedFm::remoteDelete() | 848 | void AdvancedFm::remoteDelete() |
845 | { | 849 | { |
846 | QStringList curFileList = getPath(); | 850 | QStringList curFileList = getPath(); |
847 | if( curFileList.count() > 0) { | 851 | if( curFileList.count() > 0) { |
848 | QString myFile; | 852 | QString myFile; |
849 | 853 | ||
850 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 854 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
851 | myFile = (*it); | 855 | myFile = (*it); |
852 | if(myFile.find(" -> ",0,TRUE) != -1) | 856 | if(myFile.find(" -> ",0,TRUE) != -1) |
853 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 857 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
854 | QString f = currentRemoteDir.canonicalPath(); | 858 | QString f = currentRemoteDir.canonicalPath(); |
855 | if(f.right(1).find("/",0,TRUE) == -1) | 859 | if(f.right(1).find("/",0,TRUE) == -1) |
856 | f+="/"; | 860 | f+="/"; |
857 | f+=myFile; | 861 | f+=myFile; |
858 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 862 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
859 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 863 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
860 | "\nand all it's contents ?", | 864 | "\nand all it's contents ?", |
861 | tr("Yes"),tr("No"),0,0,1) ) { | 865 | tr("Yes"),tr("No"),0,0,1) ) { |
862 | case 0: { | 866 | case 0: { |
863 | f=f.left(f.length()-1); | 867 | f=f.left(f.length()-1); |
864 | QString cmd="rm -rf "+f; | 868 | QString cmd="rm -rf "+f; |
865 | system( cmd.latin1()); | 869 | system( cmd.latin1()); |
866 | populateRemoteView(); | 870 | populateRemoteView(); |
867 | } | 871 | } |
868 | break; | 872 | break; |
869 | case 1: | 873 | case 1: |
870 | // exit | 874 | // exit |
871 | break; | 875 | break; |
872 | }; | 876 | }; |
873 | 877 | ||
874 | } else { | 878 | } else { |
875 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 879 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
876 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 880 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
877 | case 0: { | 881 | case 0: { |
878 | QString cmd="rm "+f; | 882 | QString cmd="rm "+f; |
879 | QFile file(f); | 883 | QFile file(f); |
880 | file.remove(); | 884 | file.remove(); |
881 | // system( cmd.latin1()); | 885 | // system( cmd.latin1()); |
882 | populateRemoteView(); | 886 | populateRemoteView(); |
883 | } | 887 | } |
884 | break; | 888 | break; |
885 | case 1: | 889 | case 1: |
886 | // exit | 890 | // exit |
887 | break; | 891 | break; |
888 | }; | 892 | }; |
889 | } | 893 | } |
890 | } | 894 | } |
891 | } | 895 | } |
892 | } | 896 | } |
893 | 897 | ||
894 | void AdvancedFm::localRename() | 898 | void AdvancedFm::localRename() |
895 | { | 899 | { |
896 | QString curFile = Local_View->currentItem()->text(0); | 900 | QString curFile = Local_View->currentItem()->text(0); |
897 | qDebug("currentItem "+curFile); | 901 | qDebug("currentItem "+curFile); |
898 | if( curFile !="../") { | 902 | if( curFile !="../") { |
899 | InputDialog *fileDlg; | 903 | InputDialog *fileDlg; |
900 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 904 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
901 | fileDlg->setInputText((const QString &)curFile); | 905 | fileDlg->setInputText((const QString &)curFile); |
902 | fileDlg->exec(); | 906 | fileDlg->exec(); |
903 | if( fileDlg->result() == 1 ) { | 907 | if( fileDlg->result() == 1 ) { |
904 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 908 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
905 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 909 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
906 | if( rename(oldname.latin1(), newName.latin1())== -1) | 910 | if( rename(oldname.latin1(), newName.latin1())== -1) |
907 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 911 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
908 | } | 912 | } |
909 | populateLocalView(); | 913 | populateLocalView(); |
910 | } | 914 | } |
911 | } | 915 | } |
912 | 916 | ||
913 | void AdvancedFm::remoteRename() | 917 | void AdvancedFm::remoteRename() |
914 | { | 918 | { |
915 | QString curFile = Remote_View->currentItem()->text(0); | 919 | QString curFile = Remote_View->currentItem()->text(0); |
916 | if( curFile !="../") { | 920 | if( curFile !="../") { |
917 | InputDialog *fileDlg; | 921 | InputDialog *fileDlg; |
918 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 922 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
919 | fileDlg->setInputText((const QString &)curFile); | 923 | fileDlg->setInputText((const QString &)curFile); |
920 | fileDlg->exec(); | 924 | fileDlg->exec(); |
921 | if( fileDlg->result() == 1 ) { | 925 | if( fileDlg->result() == 1 ) { |
922 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 926 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
923 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 927 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
924 | if( rename(oldname.latin1(), newName.latin1())== -1) | 928 | if( rename(oldname.latin1(), newName.latin1())== -1) |
925 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 929 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
926 | } | 930 | } |
927 | populateRemoteView(); | 931 | populateRemoteView(); |
928 | } | 932 | } |
929 | } | 933 | } |
930 | 934 | ||
931 | void AdvancedFm::switchToLocalTab() | 935 | void AdvancedFm::switchToLocalTab() |
932 | { | 936 | { |
933 | TabWidget->setCurrentPage(0); | 937 | TabWidget->setCurrentPage(0); |
934 | Local_View->setFocus(); | 938 | Local_View->setFocus(); |
935 | } | 939 | } |
936 | 940 | ||
937 | void AdvancedFm::switchToRemoteTab() | 941 | void AdvancedFm::switchToRemoteTab() |
938 | { | 942 | { |
939 | TabWidget->setCurrentPage(1); | 943 | TabWidget->setCurrentPage(1); |
940 | Remote_View->setFocus(); | 944 | Remote_View->setFocus(); |
941 | } | 945 | } |
942 | 946 | ||
943 | void AdvancedFm::readConfig() | 947 | void AdvancedFm::readConfig() |
944 | { | 948 | { |
945 | Config cfg("AdvancedFm"); | 949 | Config cfg("AdvancedFm"); |
946 | } | 950 | } |
947 | 951 | ||
948 | void AdvancedFm::writeConfig() | 952 | void AdvancedFm::writeConfig() |
949 | { | 953 | { |
950 | Config cfg("AdvancedFm"); | 954 | Config cfg("AdvancedFm"); |
951 | } | 955 | } |
952 | 956 | ||
953 | void AdvancedFm::currentPathComboChanged() | 957 | void AdvancedFm::currentPathComboChanged() |
954 | { | 958 | { |
955 | if (TabWidget->currentPageIndex() == 0) { | 959 | if (TabWidget->currentPageIndex() == 0) { |
956 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 960 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
957 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 961 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
958 | populateLocalView(); | 962 | populateLocalView(); |
959 | } else { | 963 | } else { |
960 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 964 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
961 | } | 965 | } |
962 | } | 966 | } |
963 | if (TabWidget->currentPageIndex() == 0) { | 967 | if (TabWidget->currentPageIndex() == 0) { |
964 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 968 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
965 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 969 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
966 | populateRemoteView(); | 970 | populateRemoteView(); |
967 | } else { | 971 | } else { |
968 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 972 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
969 | } | 973 | } |
970 | } | 974 | } |
971 | } | 975 | } |
972 | 976 | ||
973 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 977 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
974 | 978 | ||
975 | if (TabWidget->currentPageIndex() == 0) { | 979 | if (TabWidget->currentPageIndex() == 0) { |
976 | currentPathCombo->lineEdit()->setText( currentPath); | 980 | currentPathCombo->lineEdit()->setText( currentPath); |
977 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 981 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
978 | currentPathCombo->clear(); | 982 | currentPathCombo->clear(); |
979 | localDirPathStringList.prepend( currentPath ); | 983 | localDirPathStringList.prepend( currentPath ); |
980 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 984 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
981 | } | 985 | } |
982 | } else { | 986 | } else { |
983 | currentPathCombo->lineEdit()->setText( currentPath); | 987 | currentPathCombo->lineEdit()->setText( currentPath); |
984 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 988 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
985 | currentPathCombo->clear(); | 989 | currentPathCombo->clear(); |
986 | remoteDirPathStringList.prepend( currentPath ); | 990 | remoteDirPathStringList.prepend( currentPath ); |
987 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 991 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
988 | } | 992 | } |
989 | } | 993 | } |
990 | } | 994 | } |
991 | 995 | ||
992 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 996 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
993 | if (TabWidget->currentPageIndex() == 0) { | 997 | if (TabWidget->currentPageIndex() == 0) { |
994 | chdir( currentPath.latin1() ); | 998 | chdir( currentPath.latin1() ); |
995 | currentDir.cd( currentPath, TRUE); | 999 | currentDir.cd( currentPath, TRUE); |
996 | populateLocalView(); | 1000 | populateLocalView(); |
997 | update(); | 1001 | update(); |
998 | } else { | 1002 | } else { |
999 | chdir( currentPath.latin1() ); | 1003 | chdir( currentPath.latin1() ); |
1000 | currentRemoteDir.cd( currentPath, TRUE); | 1004 | currentRemoteDir.cd( currentPath, TRUE); |
1001 | populateRemoteView(); | 1005 | populateRemoteView(); |
1002 | update(); | 1006 | update(); |
1003 | } | 1007 | } |
1004 | } | 1008 | } |
1005 | 1009 | ||
1006 | void AdvancedFm::filePerms() { | 1010 | void AdvancedFm::filePerms() { |
1007 | 1011 | ||
1008 | QStringList curFileList = getPath(); | 1012 | QStringList curFileList = getPath(); |
1009 | QString filePath; | 1013 | QString filePath; |
1010 | 1014 | ||
1011 | if (TabWidget->currentPageIndex() == 0) { | 1015 | if (TabWidget->currentPageIndex() == 0) { |
1012 | filePath = currentDir.canonicalPath()+"/"; | 1016 | filePath = currentDir.canonicalPath()+"/"; |
1013 | } else { | 1017 | } else { |
1014 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1018 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1015 | } | 1019 | } |
1016 | 1020 | ||
1017 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1021 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1018 | filePermissions *filePerm; | 1022 | filePermissions *filePerm; |
1019 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 1023 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
1020 | filePerm->showMaximized(); | 1024 | filePerm->showMaximized(); |
1021 | filePerm->exec(); | 1025 | filePerm->exec(); |
1022 | if( filePerm) | 1026 | if( filePerm) |
1023 | delete filePerm; | 1027 | delete filePerm; |
1024 | } | 1028 | } |
1025 | if (TabWidget->currentPageIndex() == 0) { | 1029 | if (TabWidget->currentPageIndex() == 0) { |
1026 | populateLocalView(); | 1030 | populateLocalView(); |
1027 | } else { | 1031 | } else { |
1028 | populateRemoteView(); | 1032 | populateRemoteView(); |
1029 | } | 1033 | } |
1030 | } | 1034 | } |
1031 | 1035 | ||
1032 | void AdvancedFm::doProperties() { | 1036 | void AdvancedFm::doProperties() { |
1033 | QStringList curFileList = getPath(); | 1037 | QStringList curFileList = getPath(); |
1034 | QString filePath; | 1038 | QString filePath; |
1035 | if (TabWidget->currentPageIndex() == 0) { | 1039 | if (TabWidget->currentPageIndex() == 0) { |
1036 | filePath = currentDir.canonicalPath()+"/"; | 1040 | filePath = currentDir.canonicalPath()+"/"; |
1037 | } else { | 1041 | } else { |
1038 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1042 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1039 | } | 1043 | } |
1040 | // qDebug("%d",curFileList.count()); | 1044 | // qDebug("%d",curFileList.count()); |
1041 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1045 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1042 | qDebug((filePath+*it)); | 1046 | qDebug((filePath+*it)); |
1043 | DocLnk lnk( (filePath+*it)); | 1047 | DocLnk lnk( (filePath+*it)); |
1044 | LnkProperties prop( &lnk ); | 1048 | LnkProperties prop( &lnk ); |
1045 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 1049 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
1046 | prop.showMaximized(); | 1050 | prop.showMaximized(); |
1047 | prop.exec(); | 1051 | prop.exec(); |
1048 | } | 1052 | } |
1049 | } | 1053 | } |
1050 | 1054 | ||
1051 | QStringList AdvancedFm::getPath() { | 1055 | QStringList AdvancedFm::getPath() { |
1052 | QStringList strList; | 1056 | QStringList strList; |
1053 | if (TabWidget->currentPageIndex() == 0) { | 1057 | if (TabWidget->currentPageIndex() == 0) { |
1054 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 1058 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
1055 | QListViewItemIterator it( Local_View ); | 1059 | QListViewItemIterator it( Local_View ); |
1056 | for ( ; it.current(); ++it ) { | 1060 | for ( ; it.current(); ++it ) { |
1057 | if ( it.current()->isSelected() ) { | 1061 | if ( it.current()->isSelected() ) { |
1058 | strList << it.current()->text(0); | 1062 | strList << it.current()->text(0); |
1059 | } | 1063 | } |
1060 | } | 1064 | } |
1061 | return strList; | 1065 | return strList; |
1062 | } else { | 1066 | } else { |
1063 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 1067 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
1064 | QListViewItemIterator it( Remote_View ); | 1068 | QListViewItemIterator it( Remote_View ); |
1065 | for ( ; it.current(); ++it ) { | 1069 | for ( ; it.current(); ++it ) { |
1066 | if ( it.current()->isSelected() ) { | 1070 | if ( it.current()->isSelected() ) { |
1067 | strList << it.current()->text(0); | 1071 | strList << it.current()->text(0); |
1068 | } | 1072 | } |
1069 | } | 1073 | } |
1070 | return strList; | 1074 | return strList; |
1071 | } | 1075 | } |
1072 | return ""; | 1076 | return ""; |
1073 | } | 1077 | } |
1074 | 1078 | ||
1075 | void AdvancedFm::homeButtonPushed() { | 1079 | void AdvancedFm::homeButtonPushed() { |
1076 | QString current = QDir::homeDirPath(); | 1080 | QString current = QDir::homeDirPath(); |
1077 | chdir( current.latin1() ); | 1081 | chdir( current.latin1() ); |
1078 | if (TabWidget->currentPageIndex() == 0) { | 1082 | if (TabWidget->currentPageIndex() == 0) { |
1079 | currentDir.cd( current, TRUE); | 1083 | currentDir.cd( current, TRUE); |
1080 | populateLocalView(); | 1084 | populateLocalView(); |
1081 | } else { | 1085 | } else { |
1082 | currentRemoteDir.cd( current, TRUE); | 1086 | currentRemoteDir.cd( current, TRUE); |
1083 | populateRemoteView(); | 1087 | populateRemoteView(); |
1084 | } | 1088 | } |
1085 | update(); | 1089 | update(); |
1086 | } | 1090 | } |
1087 | 1091 | ||
1088 | void AdvancedFm::docButtonPushed() { | 1092 | void AdvancedFm::docButtonPushed() { |
1089 | QString current = QPEApplication::documentDir(); | 1093 | QString current = QPEApplication::documentDir(); |
1090 | chdir( current.latin1() ); | 1094 | chdir( current.latin1() ); |
1091 | if (TabWidget->currentPageIndex() == 0) { | 1095 | if (TabWidget->currentPageIndex() == 0) { |
1092 | currentDir.cd( current, TRUE); | 1096 | currentDir.cd( current, TRUE); |
1093 | populateLocalView(); | 1097 | populateLocalView(); |
1094 | } else { | 1098 | } else { |
1095 | currentRemoteDir.cd( current, TRUE); | 1099 | currentRemoteDir.cd( current, TRUE); |
1096 | populateRemoteView(); | 1100 | populateRemoteView(); |
1097 | } | 1101 | } |
1098 | update(); | 1102 | update(); |
1099 | } | 1103 | } |
1100 | 1104 | ||
1101 | void AdvancedFm::SDButtonPushed() { | 1105 | void AdvancedFm::SDButtonPushed() { |
1102 | QString current = "/mnt/card"; | 1106 | QString current = "/mnt/card"; |
1103 | chdir( current.latin1() ); | 1107 | chdir( current.latin1() ); |
1104 | if (TabWidget->currentPageIndex() == 0) { | 1108 | if (TabWidget->currentPageIndex() == 0) { |
1105 | currentDir.cd( current, TRUE); | 1109 | currentDir.cd( current, TRUE); |
1106 | populateLocalView(); | 1110 | populateLocalView(); |
1107 | } else { | 1111 | } else { |
1108 | currentRemoteDir.cd( current, TRUE); | 1112 | currentRemoteDir.cd( current, TRUE); |
1109 | populateRemoteView(); | 1113 | populateRemoteView(); |
1110 | } | 1114 | } |
1111 | update(); | 1115 | update(); |
1112 | 1116 | ||
1113 | } | 1117 | } |
1114 | 1118 | ||
1115 | void AdvancedFm::CFButtonPushed() { | 1119 | void AdvancedFm::CFButtonPushed() { |
1116 | QString current = "/mnt/cf"; | 1120 | QString current = "/mnt/cf"; |
1117 | chdir( current.latin1() ); | 1121 | chdir( current.latin1() ); |
1118 | if (TabWidget->currentPageIndex() == 0) { | 1122 | if (TabWidget->currentPageIndex() == 0) { |
1119 | currentDir.cd( current, TRUE); | 1123 | currentDir.cd( current, TRUE); |
1120 | populateLocalView(); | 1124 | populateLocalView(); |
1121 | } else { | 1125 | } else { |
1122 | currentRemoteDir.cd( current, TRUE); | 1126 | currentRemoteDir.cd( current, TRUE); |
1123 | populateRemoteView(); | 1127 | populateRemoteView(); |
1124 | } | 1128 | } |
1125 | update(); | 1129 | update(); |
1126 | 1130 | ||
1127 | } | 1131 | } |
1128 | 1132 | ||
1129 | 1133 | ||
1130 | void AdvancedFm::upDir() | 1134 | void AdvancedFm::upDir() |
1131 | { | 1135 | { |
1132 | if (TabWidget->currentPageIndex() == 0) { | 1136 | if (TabWidget->currentPageIndex() == 0) { |
1133 | QString current = currentDir.canonicalPath(); | 1137 | QString current = currentDir.canonicalPath(); |
1134 | QDir dir(current); | 1138 | QDir dir(current); |
1135 | dir.cdUp(); | 1139 | dir.cdUp(); |
1136 | current = dir.canonicalPath(); | 1140 | current = dir.canonicalPath(); |
1137 | chdir( current.latin1() ); | 1141 | chdir( current.latin1() ); |
1138 | currentDir.cd( current, TRUE); | 1142 | currentDir.cd( current, TRUE); |
1139 | populateLocalView(); | 1143 | populateLocalView(); |
1140 | update(); | 1144 | update(); |
1141 | } else { | 1145 | } else { |
1142 | QString current = currentRemoteDir.canonicalPath(); | 1146 | QString current = currentRemoteDir.canonicalPath(); |
1143 | QDir dir(current); | 1147 | QDir dir(current); |
1144 | dir.cdUp(); | 1148 | dir.cdUp(); |
1145 | current = dir.canonicalPath(); | 1149 | current = dir.canonicalPath(); |
1146 | chdir( current.latin1() ); | 1150 | chdir( current.latin1() ); |
1147 | currentRemoteDir.cd( current, TRUE); | 1151 | currentRemoteDir.cd( current, TRUE); |
1148 | populateRemoteView(); | 1152 | populateRemoteView(); |
1149 | update(); | 1153 | update(); |
1150 | } | 1154 | } |
1151 | } | 1155 | } |
1152 | 1156 | ||
1153 | void AdvancedFm::copy() | 1157 | void AdvancedFm::copy() |
1154 | { | 1158 | { |
1155 | QStringList curFileList = getPath(); | 1159 | QStringList curFileList = getPath(); |
1156 | if( curFileList.count() > 0) { | 1160 | if( curFileList.count() > 0) { |
1157 | QString curFile; | 1161 | QString curFile; |
1158 | if (TabWidget->currentPageIndex() == 0) { | 1162 | if (TabWidget->currentPageIndex() == 0) { |
1159 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1163 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1160 | 1164 | ||
1161 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1165 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1162 | // if(destFile.right(1).find("/",0,TRUE) == -1) | 1166 | // if(destFile.right(1).find("/",0,TRUE) == -1) |
1163 | // destFile+="/"; | 1167 | // destFile+="/"; |
1164 | // destFile +=(*it); | 1168 | // destFile +=(*it); |
1165 | 1169 | ||
1166 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1170 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1167 | // if(curFile.right(1).find("/",0,TRUE) == -1) | 1171 | // if(curFile.right(1).find("/",0,TRUE) == -1) |
1168 | // curFile +="/"; | 1172 | // curFile +="/"; |
1169 | // curFile +=(*it); | 1173 | // curFile +=(*it); |
1170 | 1174 | ||
1171 | QFile f(destFile); | 1175 | QFile f(destFile); |
1172 | if( f.exists()) | 1176 | if( f.exists()) |
1173 | f.remove(); | 1177 | f.remove(); |
1174 | if(!copyFile(destFile, curFile) ) { | 1178 | if(!copyFile(destFile, curFile) ) { |
1175 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 1179 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1176 | qWarning("nothin doing"); | 1180 | qWarning("nothin doing"); |
1177 | } | 1181 | } |
1178 | } | 1182 | } |
1179 | populateRemoteView(); | 1183 | populateRemoteView(); |
1180 | TabWidget->setCurrentPage(1); | 1184 | TabWidget->setCurrentPage(1); |
1181 | 1185 | ||
1182 | } else { | 1186 | } else { |
1183 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1187 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1184 | 1188 | ||
1185 | QString destFile = currentDir.canonicalPath()+"/"+(*it); | 1189 | QString destFile = currentDir.canonicalPath()+"/"+(*it); |
1186 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1190 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1187 | 1191 | ||
1188 | QFile f(destFile); | 1192 | QFile f(destFile); |
1189 | if( f.exists()) | 1193 | if( f.exists()) |
1190 | f.remove(); | 1194 | f.remove(); |
1191 | if(!copyFile(destFile, curFile) ) { | 1195 | if(!copyFile(destFile, curFile) ) { |
1192 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 1196 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1193 | 1197 | ||
1194 | qWarning("nothin doing"); | 1198 | qWarning("nothin doing"); |
1195 | } | 1199 | } |
1196 | } | 1200 | } |
1197 | populateLocalView(); | 1201 | populateLocalView(); |
1198 | TabWidget->setCurrentPage(0); | 1202 | TabWidget->setCurrentPage(0); |
1199 | } | 1203 | } |
1200 | } | 1204 | } |
1201 | } | 1205 | } |
1202 | 1206 | ||
1203 | void AdvancedFm::copyAs() | 1207 | void AdvancedFm::copyAs() |
1204 | { | 1208 | { |
1205 | QStringList curFileList = getPath(); | 1209 | QStringList curFileList = getPath(); |
1206 | if( curFileList.count() > 0) { | 1210 | if( curFileList.count() > 0) { |
1207 | QString curFile; | 1211 | QString curFile; |
1208 | InputDialog *fileDlg; | 1212 | InputDialog *fileDlg; |
1209 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1213 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1210 | 1214 | ||
1211 | if (TabWidget->currentPageIndex() == 0) { | 1215 | if (TabWidget->currentPageIndex() == 0) { |
1212 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1216 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1213 | QString destFile; | 1217 | QString destFile; |
1214 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1218 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1215 | // InputDialog *fileDlg; | 1219 | // InputDialog *fileDlg; |
1216 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1220 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1217 | fileDlg->setInputText((const QString &) destFile ); | 1221 | fileDlg->setInputText((const QString &) destFile ); |
1218 | fileDlg->exec(); | 1222 | fileDlg->exec(); |
1219 | if( fileDlg->result() == 1 ) { | 1223 | if( fileDlg->result() == 1 ) { |
1220 | QString filename = fileDlg->LineEdit1->text(); | 1224 | QString filename = fileDlg->LineEdit1->text(); |
1221 | destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1225 | destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1222 | 1226 | ||
1223 | QFile f(destFile); | 1227 | QFile f(destFile); |
1224 | if( f.exists()) | 1228 | if( f.exists()) |
1225 | f.remove(); | 1229 | f.remove(); |
1226 | if(!copyFile(destFile, curFile) ) { | 1230 | if(!copyFile(destFile, curFile) ) { |
1227 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 1231 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1228 | qWarning("nothin doing"); | 1232 | qWarning("nothin doing"); |
1229 | } | 1233 | } |
1230 | } | 1234 | } |
1231 | } | 1235 | } |
1232 | 1236 | ||
1233 | populateRemoteView(); | 1237 | populateRemoteView(); |
1234 | TabWidget->setCurrentPage(1); | 1238 | TabWidget->setCurrentPage(1); |
1235 | } else { | 1239 | } else { |
1236 | if (TabWidget->currentPageIndex() == 0) { | 1240 | if (TabWidget->currentPageIndex() == 0) { |
1237 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1241 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1238 | 1242 | ||
1239 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1243 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1240 | QString destFile; | 1244 | QString destFile; |
1241 | fileDlg->setInputText((const QString &) destFile); | 1245 | fileDlg->setInputText((const QString &) destFile); |
1242 | fileDlg->exec(); | 1246 | fileDlg->exec(); |
1243 | if( fileDlg->result() == 1 ) { | 1247 | if( fileDlg->result() == 1 ) { |
1244 | QString filename = fileDlg->LineEdit1->text(); | 1248 | QString filename = fileDlg->LineEdit1->text(); |
1245 | destFile = currentDir.canonicalPath()+"/"+(*it); | 1249 | destFile = currentDir.canonicalPath()+"/"+(*it); |
1246 | 1250 | ||
1247 | QFile f(destFile); | 1251 | QFile f(destFile); |
1248 | if( f.exists()) | 1252 | if( f.exists()) |
1249 | f.remove(); | 1253 | f.remove(); |
1250 | if(!copyFile(destFile, curFile) ) { | 1254 | if(!copyFile(destFile, curFile) ) { |
1251 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 1255 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1252 | qWarning("nothin doing"); | 1256 | qWarning("nothin doing"); |
1253 | } | 1257 | } |
1254 | } | 1258 | } |
1255 | } | 1259 | } |
1256 | populateLocalView(); | 1260 | populateLocalView(); |
1257 | TabWidget->setCurrentPage(0); | 1261 | TabWidget->setCurrentPage(0); |
1258 | } | 1262 | } |
1259 | } | 1263 | } |
1260 | } | 1264 | } |
1261 | } | 1265 | } |
1262 | 1266 | ||
1263 | void AdvancedFm::move() { | 1267 | void AdvancedFm::move() { |
1264 | 1268 | ||
1265 | QStringList curFileList = getPath(); | 1269 | QStringList curFileList = getPath(); |
1266 | if( curFileList.count() > 0) { | 1270 | if( curFileList.count() > 0) { |
1267 | QString curFile; | 1271 | QString curFile; |
1268 | // qDebug(curFile); | 1272 | // qDebug(curFile); |
1269 | QString destFile; | 1273 | QString destFile; |
1270 | 1274 | ||
1271 | if (TabWidget->currentPageIndex() == 0) { | 1275 | if (TabWidget->currentPageIndex() == 0) { |
1272 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1276 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1273 | QString destFile = currentRemoteDir.canonicalPath(); | 1277 | QString destFile = currentRemoteDir.canonicalPath(); |
1274 | if(destFile.right(1).find("/",0,TRUE) == -1) | 1278 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1275 | destFile+="/"; | 1279 | destFile+="/"; |
1276 | destFile +=(*it); | 1280 | destFile +=(*it); |
1277 | curFile = currentDir.canonicalPath(); | 1281 | curFile = currentDir.canonicalPath(); |
1278 | qDebug("Destination file is "+destFile); | 1282 | qDebug("Destination file is "+destFile); |
1279 | if(curFile.right(1).find("/",0,TRUE) == -1) | 1283 | if(curFile.right(1).find("/",0,TRUE) == -1) |
1280 | curFile +="/"; | 1284 | curFile +="/"; |
1281 | curFile+=(*it); | 1285 | curFile+=(*it); |
1282 | 1286 | ||
1283 | QFile f(destFile); | 1287 | QFile f(destFile); |
1284 | if( f.exists()) | 1288 | if( f.exists()) |
1285 | f.remove(); | 1289 | f.remove(); |
1286 | if(!copyFile( destFile, curFile) ) { | 1290 | if(!copyFile( destFile, curFile) ) { |
1287 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1291 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); |
1288 | return; | 1292 | return; |
1289 | } | 1293 | } |
1290 | QFile::remove(curFile); | 1294 | QFile::remove(curFile); |
1291 | } | 1295 | } |
1292 | TabWidget->setCurrentPage(1); | 1296 | TabWidget->setCurrentPage(1); |
1293 | } else { | 1297 | } else { |
1294 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1298 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1295 | QString destFile = currentRemoteDir.canonicalPath(); | 1299 | QString destFile = currentRemoteDir.canonicalPath(); |
1296 | if(destFile.right(1).find("/",0,TRUE) == -1) | 1300 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1297 | destFile+="/"; | 1301 | destFile+="/"; |
1298 | destFile +=(*it); | 1302 | destFile +=(*it); |
1299 | qDebug("Destination file is "+destFile); | 1303 | qDebug("Destination file is "+destFile); |
1300 | curFile = currentDir.canonicalPath(); | 1304 | curFile = currentDir.canonicalPath(); |
1301 | if(curFile.right(1).find("/",0,TRUE) == -1) | 1305 | if(curFile.right(1).find("/",0,TRUE) == -1) |
1302 | curFile +="/"; | 1306 | curFile +="/"; |
1303 | curFile+=(*it); | 1307 | curFile+=(*it); |
1304 | 1308 | ||
1305 | QFile f(destFile); | 1309 | QFile f(destFile); |
1306 | if( f.exists()) | 1310 | if( f.exists()) |
1307 | f.remove(); | 1311 | f.remove(); |
1308 | if(!copyFile(destFile, curFile) ) { | 1312 | if(!copyFile(destFile, curFile) ) { |
1309 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1313 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); |
1310 | return; | 1314 | return; |
1311 | } | 1315 | } |
1312 | QFile::remove(curFile); | 1316 | QFile::remove(curFile); |
1313 | TabWidget->setCurrentPage(0); | 1317 | TabWidget->setCurrentPage(0); |
1314 | } | 1318 | } |
1315 | } | 1319 | } |
1316 | populateRemoteView(); | 1320 | populateRemoteView(); |
1317 | populateLocalView(); | 1321 | populateLocalView(); |
1318 | } | 1322 | } |
1319 | } | 1323 | } |
1320 | 1324 | ||
1321 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) | 1325 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) |
1322 | { | 1326 | { |
1323 | char bf[ 50000 ]; | 1327 | char bf[ 50000 ]; |
1324 | int bytesRead; | 1328 | int bytesRead; |
1325 | bool success = TRUE; | 1329 | bool success = TRUE; |
1326 | struct stat status; | 1330 | struct stat status; |
1327 | 1331 | ||
1328 | QFile s( src ); | 1332 | QFile s( src ); |
1329 | QFile d( dest ); | 1333 | QFile d( dest ); |
1330 | 1334 | ||
1331 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 1335 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
1332 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 1336 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
1333 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 1337 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
1334 | success = FALSE; | 1338 | success = FALSE; |
1335 | break; | 1339 | break; |
1336 | } | 1340 | } |
1337 | } | 1341 | } |
1338 | if( success && (bytesRead > 0) ){ | 1342 | if( success && (bytesRead > 0) ){ |
1339 | d.writeBlock( bf, bytesRead ); | 1343 | d.writeBlock( bf, bytesRead ); |
1340 | } | 1344 | } |
1341 | } else { | 1345 | } else { |
1342 | success = FALSE; | 1346 | success = FALSE; |
1343 | } | 1347 | } |
1344 | 1348 | ||
1345 | // Set file permissions | 1349 | // Set file permissions |
1346 | if( stat( (const char *) src, &status ) == 0 ){ | 1350 | if( stat( (const char *) src, &status ) == 0 ){ |
1347 | chmod( (const char *) dest, status.st_mode ); | 1351 | chmod( (const char *) dest, status.st_mode ); |
1348 | } | 1352 | } |
1349 | 1353 | ||
1350 | return success; | 1354 | return success; |
1351 | } | 1355 | } |
1352 | 1356 | ||
1353 | void AdvancedFm::runCommand() { | 1357 | void AdvancedFm::runCommand() { |
1354 | QString curFile; | 1358 | QString curFile; |
1355 | if (TabWidget->currentPageIndex() == 0) { | 1359 | if (TabWidget->currentPageIndex() == 0) { |
1356 | if( Local_View->currentItem()) | 1360 | if( Local_View->currentItem()) |
1357 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 1361 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
1358 | } else { | 1362 | } else { |
1359 | if(Remote_View->currentItem()) | 1363 | if(Remote_View->currentItem()) |
1360 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); | 1364 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); |
1361 | } | 1365 | } |
1362 | 1366 | ||
1363 | InputDialog *fileDlg; | 1367 | InputDialog *fileDlg; |
1364 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1368 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1365 | fileDlg->setInputText(curFile); | 1369 | fileDlg->setInputText(curFile); |
1366 | fileDlg->exec(); | 1370 | fileDlg->exec(); |
1367 | QString command; | 1371 | QString command; |
1368 | if( fileDlg->result() == 1 ) { | 1372 | if( fileDlg->result() == 1 ) { |
1369 | command = fileDlg->LineEdit1->text(); | 1373 | command = fileDlg->LineEdit1->text(); |
1370 | 1374 | ||
1371 | // int err=0; | 1375 | // int err=0; |
1372 | Output *outDlg; | 1376 | Output *outDlg; |
1373 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1377 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1374 | outDlg->showMaximized(); | 1378 | outDlg->showMaximized(); |
1375 | outDlg->show(); | 1379 | outDlg->show(); |
1376 | qApp->processEvents(); | 1380 | qApp->processEvents(); |
1377 | FILE *fp; | 1381 | FILE *fp; |
1378 | char line[130]; | 1382 | char line[130]; |
1379 | sleep(1); | 1383 | sleep(1); |
1380 | // if(command.find("2>",0,TRUE) != -1) | 1384 | // if(command.find("2>",0,TRUE) != -1) |
1381 | command +=" 2>&1"; | 1385 | command +=" 2>&1"; |
1382 | fp = popen( (const char *) command, "r"); | 1386 | fp = popen( (const char *) command, "r"); |
1383 | if ( !fp ) { | 1387 | if ( !fp ) { |
1384 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1388 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1385 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1389 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1386 | pclose(fp); | 1390 | pclose(fp); |
1387 | return; | 1391 | return; |
1388 | } else { | 1392 | } else { |
1389 | while ( fgets( line, sizeof line, fp)) { | 1393 | while ( fgets( line, sizeof line, fp)) { |
1390 | QString lineStr = line; | 1394 | QString lineStr = line; |
1391 | lineStr=lineStr.left(lineStr.length()-1); | 1395 | lineStr=lineStr.left(lineStr.length()-1); |
1392 | outDlg->OutputEdit->append(lineStr); | 1396 | outDlg->OutputEdit->append(lineStr); |
1393 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1397 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1394 | } | 1398 | } |
1395 | } | 1399 | } |
1396 | } | 1400 | } |
1397 | } | 1401 | } |
1398 | 1402 | ||
1399 | void AdvancedFm::runCommandStd() { | 1403 | void AdvancedFm::runCommandStd() { |
1400 | QString curFile; | 1404 | QString curFile; |
1401 | if (TabWidget->currentPageIndex() == 0) { | 1405 | if (TabWidget->currentPageIndex() == 0) { |
1402 | if( Local_View->currentItem()) | 1406 | if( Local_View->currentItem()) |
1403 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 1407 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
1404 | } else { | 1408 | } else { |
1405 | if(Remote_View->currentItem()) | 1409 | if(Remote_View->currentItem()) |
1406 | curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); | 1410 | curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); |
1407 | } | 1411 | } |
1408 | 1412 | ||
1409 | InputDialog *fileDlg; | 1413 | InputDialog *fileDlg; |
1410 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1414 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1411 | fileDlg->setInputText(curFile); | 1415 | fileDlg->setInputText(curFile); |
1412 | fileDlg->exec(); | 1416 | fileDlg->exec(); |
1413 | QString command; | 1417 | QString command; |
1414 | if( fileDlg->result() == 1 ) { | 1418 | if( fileDlg->result() == 1 ) { |
1415 | qApp->processEvents(); | 1419 | qApp->processEvents(); |
1416 | command = fileDlg->LineEdit1->text() + " &"; | 1420 | command = fileDlg->LineEdit1->text() + " &"; |
1417 | system(command.latin1()); | 1421 | system(command.latin1()); |
1418 | } | 1422 | } |
1419 | } | 1423 | } |
1420 | 1424 | ||
1421 | void AdvancedFm::fileStatus() { | 1425 | void AdvancedFm::fileStatus() { |
1422 | QString curFile; | 1426 | QString curFile; |
1423 | if (TabWidget->currentPageIndex() == 0) { | 1427 | if (TabWidget->currentPageIndex() == 0) { |
1424 | curFile = Local_View->currentItem()->text(0); | 1428 | curFile = Local_View->currentItem()->text(0); |
1425 | } else { | 1429 | } else { |
1426 | curFile = Remote_View->currentItem()->text(0); | 1430 | curFile = Remote_View->currentItem()->text(0); |
1427 | } | 1431 | } |
1428 | QString command = " stat -l "+ curFile +" 2>&1"; | 1432 | QString command = " stat -l "+ curFile +" 2>&1"; |
1429 | // int err=0; | 1433 | // int err=0; |
1430 | Output *outDlg; | 1434 | Output *outDlg; |
1431 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1435 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1432 | outDlg->showMaximized(); | 1436 | outDlg->showMaximized(); |
1433 | outDlg->show(); | 1437 | outDlg->show(); |
1434 | qApp->processEvents(); | 1438 | qApp->processEvents(); |
1435 | FILE *fp; | 1439 | FILE *fp; |
1436 | char line[130]; | 1440 | char line[130]; |
1437 | sleep(1); | 1441 | sleep(1); |
1438 | fp = popen( (const char *) command, "r"); | 1442 | fp = popen( (const char *) command, "r"); |
1439 | if ( !fp ) { | 1443 | if ( !fp ) { |
1440 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1444 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1441 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1445 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1442 | pclose(fp); | 1446 | pclose(fp); |
1443 | return; | 1447 | return; |
1444 | } else { | 1448 | } else { |
1445 | while ( fgets( line, sizeof line, fp)) { | 1449 | while ( fgets( line, sizeof line, fp)) { |
1446 | outDlg->OutputEdit->append(line); | 1450 | outDlg->OutputEdit->append(line); |
1447 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1451 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1448 | 1452 | ||
1449 | } | 1453 | } |
1450 | 1454 | ||
1451 | } | 1455 | } |
1452 | } | 1456 | } |
1453 | 1457 | ||
1454 | void AdvancedFm::mkDir() { | 1458 | void AdvancedFm::mkDir() { |
1455 | if (TabWidget->currentPageIndex() == 0) | 1459 | if (TabWidget->currentPageIndex() == 0) |
1456 | localMakDir(); | 1460 | localMakDir(); |
1457 | else | 1461 | else |
1458 | remoteMakDir(); | 1462 | remoteMakDir(); |
1459 | 1463 | ||
1460 | } | 1464 | } |
1461 | 1465 | ||
1462 | void AdvancedFm::rn() { | 1466 | void AdvancedFm::rn() { |
1463 | if (TabWidget->currentPageIndex() == 0) | 1467 | if (TabWidget->currentPageIndex() == 0) |
1464 | localRename(); | 1468 | localRename(); |
1465 | else | 1469 | else |
1466 | remoteRename(); | 1470 | remoteRename(); |
1467 | 1471 | ||
1468 | } | 1472 | } |
1469 | 1473 | ||
1470 | void AdvancedFm::del() { | 1474 | void AdvancedFm::del() { |
1471 | if (TabWidget->currentPageIndex() == 0) | 1475 | if (TabWidget->currentPageIndex() == 0) |
1472 | localDelete(); | 1476 | localDelete(); |
1473 | else | 1477 | else |
1474 | remoteDelete(); | 1478 | remoteDelete(); |
1475 | } | 1479 | } |
1476 | 1480 | ||
1477 | void AdvancedFm::doAbout() { | 1481 | void AdvancedFm::doAbout() { |
1478 | QMessageBox::message("AdvancedFm","Advanced FileManager\n" | 1482 | QMessageBox::message("AdvancedFm","Advanced FileManager\n" |
1479 | "is copyright 2002 by\n" | 1483 | "is copyright 2002 by\n" |
1480 | "L.J.Potter<llornkcor@handhelds.org>\n" | 1484 | "L.J.Potter<llornkcor@handhelds.org>\n" |
1481 | "and is licensed by the GPL"); | 1485 | "and is licensed by the GPL"); |
1482 | } | 1486 | } |
1483 | 1487 | ||
1484 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | 1488 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) |
1485 | { | 1489 | { |
1486 | if( TabWidget->hasFocus()) | 1490 | if( TabWidget->hasFocus()) |
1487 | switch ( e->key() ) { | 1491 | switch ( e->key() ) { |
1488 | case Key_Delete: | 1492 | case Key_Delete: |
1489 | del(); | 1493 | del(); |
1490 | break; | 1494 | break; |
1491 | case Key_H: | 1495 | case Key_H: |
1492 | showHidden(); | 1496 | showHidden(); |
1493 | break; | 1497 | break; |
1494 | case Key_E: | 1498 | case Key_E: |
1495 | runThis(); | 1499 | runThis(); |
1496 | break; | 1500 | break; |
1497 | case Key_C: | 1501 | case Key_C: |
1498 | copy(); | 1502 | copy(); |
1499 | break; | 1503 | break; |
1500 | case Key_A: | 1504 | case Key_A: |
1501 | copyAs(); | 1505 | copyAs(); |
1502 | break; | 1506 | break; |
1503 | case Key_M: | 1507 | case Key_M: |
1504 | move(); | 1508 | move(); |
1505 | break; | 1509 | break; |
1506 | case Key_R: | 1510 | case Key_R: |
1507 | rn(); | 1511 | rn(); |
1508 | break; | 1512 | break; |
1509 | case Key_I: | 1513 | case Key_I: |
1510 | fileStatus(); | 1514 | fileStatus(); |
1511 | break; | 1515 | break; |
1512 | case Key_U: | 1516 | case Key_U: |
1513 | upDir(); | 1517 | upDir(); |
1514 | break; | 1518 | break; |
1515 | case Key_P: | 1519 | case Key_P: |
1516 | filePerms(); | 1520 | filePerms(); |
1517 | break; | 1521 | break; |
1518 | case Key_N: | 1522 | case Key_N: |
1519 | mkDir(); | 1523 | mkDir(); |
1520 | break; | 1524 | break; |
1521 | case Key_1: | 1525 | case Key_1: |
1522 | switchToLocalTab(); | 1526 | switchToLocalTab(); |
1523 | break; | 1527 | break; |
1524 | case Key_2: | 1528 | case Key_2: |
1525 | switchToRemoteTab(); | 1529 | switchToRemoteTab(); |
1526 | break; | 1530 | break; |
1527 | case Key_3: | 1531 | case Key_3: |
1528 | CFButtonPushed(); | 1532 | CFButtonPushed(); |
1529 | break; | 1533 | break; |
1530 | case Key_4: | 1534 | case Key_4: |
1531 | SDButtonPushed(); | 1535 | SDButtonPushed(); |
1532 | break; | 1536 | break; |
1533 | case Key_5: | 1537 | case Key_5: |
1534 | homeButtonPushed(); | 1538 | homeButtonPushed(); |
1535 | break; | 1539 | break; |
1536 | case Key_6: | 1540 | case Key_6: |
1537 | docButtonPushed(); | 1541 | docButtonPushed(); |
1538 | break; | 1542 | break; |
1539 | case Key_7: | 1543 | case Key_7: |
1540 | break; | 1544 | break; |
1541 | case Key_8: | 1545 | case Key_8: |
1542 | break; | 1546 | break; |
1543 | case Key_9: | 1547 | case Key_9: |
1544 | break; | 1548 | break; |
1545 | case Key_0: | 1549 | case Key_0: |
1546 | break; | 1550 | break; |
1547 | } | 1551 | } |
1548 | } | 1552 | } |
1549 | 1553 | ||
1550 | void AdvancedFm::mkSym() { | 1554 | void AdvancedFm::mkSym() { |
1551 | QString cmd; | 1555 | QString cmd; |
1552 | QStringList curFileList = getPath(); | 1556 | QStringList curFileList = getPath(); |
1553 | if( curFileList.count() > 0) { | 1557 | if( curFileList.count() > 0) { |
1554 | 1558 | ||
1555 | if (TabWidget->currentPageIndex() == 0) { | 1559 | if (TabWidget->currentPageIndex() == 0) { |
1556 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1560 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1557 | 1561 | ||
1558 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); | 1562 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); |
1559 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 1563 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
1560 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 1564 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
1561 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1565 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1562 | cmd = "ln -s "+curFile+" "+destName; | 1566 | cmd = "ln -s "+curFile+" "+destName; |
1563 | qDebug(cmd); | 1567 | qDebug(cmd); |
1564 | system(cmd.latin1() ); | 1568 | system(cmd.latin1() ); |
1565 | } | 1569 | } |
1566 | populateRemoteView(); | 1570 | populateRemoteView(); |
1567 | TabWidget->setCurrentPage(1); | 1571 | TabWidget->setCurrentPage(1); |
1568 | } else { | 1572 | } else { |
1569 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1573 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1570 | 1574 | ||
1571 | QString destName = currentDir.canonicalPath()+"/"+(*it); | 1575 | QString destName = currentDir.canonicalPath()+"/"+(*it); |
1572 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 1576 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
1573 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1577 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1574 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1578 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1575 | 1579 | ||
1576 | cmd = "ln -s "+curFile+" "+destName; | 1580 | cmd = "ln -s "+curFile+" "+destName; |
1577 | qDebug(cmd); | 1581 | qDebug(cmd); |
1578 | system(cmd.latin1() ); | 1582 | system(cmd.latin1() ); |
1579 | } | 1583 | } |
1580 | populateLocalView(); | 1584 | populateLocalView(); |
1581 | TabWidget->setCurrentPage(0); | 1585 | TabWidget->setCurrentPage(0); |
1582 | } | 1586 | } |
1583 | } | 1587 | } |
1584 | } | 1588 | } |
1585 | 1589 | ||
1586 | void AdvancedFm::QPEButtonPushed() { | 1590 | void AdvancedFm::QPEButtonPushed() { |
1587 | QString current = QPEApplication::qpeDir(); | 1591 | QString current = QPEApplication::qpeDir(); |
1588 | chdir( current.latin1() ); | 1592 | chdir( current.latin1() ); |
1589 | if (TabWidget->currentPageIndex() == 0) { | 1593 | if (TabWidget->currentPageIndex() == 0) { |
1590 | currentDir.cd( current, TRUE); | 1594 | currentDir.cd( current, TRUE); |
1591 | populateLocalView(); | 1595 | populateLocalView(); |
1592 | } else { | 1596 | } else { |
1593 | currentRemoteDir.cd( current, TRUE); | 1597 | currentRemoteDir.cd( current, TRUE); |
1594 | populateRemoteView(); | 1598 | populateRemoteView(); |
1595 | } | 1599 | } |
1596 | update(); | 1600 | update(); |
1597 | } | 1601 | } |
1598 | 1602 | ||
1599 | void AdvancedFm::parsetab(const QString &fileName) { | 1603 | void AdvancedFm::parsetab(const QString &fileName) { |
1600 | 1604 | ||
1601 | fileSystemTypeList.clear(); | 1605 | fileSystemTypeList.clear(); |
1602 | fsList.clear(); | 1606 | fsList.clear(); |
1603 | struct mntent *me; | 1607 | struct mntent *me; |
1604 | // if(fileName == "/etc/mtab") { | 1608 | // if(fileName == "/etc/mtab") { |
1605 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 1609 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
1606 | if ( mntfp ) { | 1610 | if ( mntfp ) { |
1607 | while ( (me = getmntent( mntfp )) != 0 ) { | 1611 | while ( (me = getmntent( mntfp )) != 0 ) { |
1608 | QString deviceName = me->mnt_fsname; | 1612 | QString deviceName = me->mnt_fsname; |
1609 | QString filesystemType = me->mnt_type; | 1613 | QString filesystemType = me->mnt_type; |
1610 | QString mountDir = me->mnt_dir; | 1614 | QString mountDir = me->mnt_dir; |
1611 | if(deviceName != "none") { | 1615 | if(deviceName != "none") { |
1612 | if( fsList.contains(filesystemType) == 0 | 1616 | if( fsList.contains(filesystemType) == 0 |
1613 | & filesystemType.find("proc",0,TRUE) == -1 | 1617 | & filesystemType.find("proc",0,TRUE) == -1 |
1614 | & filesystemType.find("cramfs",0,TRUE) == -1 | 1618 | & filesystemType.find("cramfs",0,TRUE) == -1 |
1615 | & filesystemType.find("auto",0,TRUE) == -1) | 1619 | & filesystemType.find("auto",0,TRUE) == -1) |
1616 | fsList << filesystemType; | 1620 | fsList << filesystemType; |
1617 | // deviceList << deviceName; | 1621 | // deviceList << deviceName; |
1618 | // qDebug(mountDir+"::"+filesystemType); | 1622 | // qDebug(mountDir+"::"+filesystemType); |
1619 | fileSystemTypeList << mountDir+"::"+filesystemType; | 1623 | fileSystemTypeList << mountDir+"::"+filesystemType; |
1620 | } | 1624 | } |
1621 | } | 1625 | } |
1622 | } | 1626 | } |
1623 | endmntent( mntfp ); | 1627 | endmntent( mntfp ); |
1624 | } | 1628 | } |
1625 | 1629 | ||
1626 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { | 1630 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { |
1627 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 1631 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
1628 | QString current = currentText;//.right( currentText.length()-1); | 1632 | QString current = currentText;//.right( currentText.length()-1); |
1629 | QString baseFs; | 1633 | QString baseFs; |
1630 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 1634 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
1631 | QString temp = (*it); | 1635 | QString temp = (*it); |
1632 | QString path = temp.left(temp.find("::",0,TRUE) ); | 1636 | QString path = temp.left(temp.find("::",0,TRUE) ); |
1633 | path = path.right( path.length()-1); | 1637 | path = path.right( path.length()-1); |
1634 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 1638 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
1635 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { | 1639 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { |
1636 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 1640 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
1637 | } | 1641 | } |
1638 | } | 1642 | } |
1639 | return baseFs; | 1643 | return baseFs; |
1640 | } | 1644 | } |
1641 | 1645 | ||
1642 | 1646 | ||
1643 | void AdvancedFm::doBeam() { | 1647 | void AdvancedFm::doBeam() { |
1644 | Ir ir; | 1648 | Ir ir; |
1645 | if(!ir.supported()){ | 1649 | if(!ir.supported()){ |
1646 | } else { | 1650 | } else { |
1647 | 1651 | ||
1648 | QStringList curFileList = getPath(); | 1652 | QStringList curFileList = getPath(); |
1649 | if( curFileList.count() > 0) { | 1653 | if( curFileList.count() > 0) { |
1650 | 1654 | ||
1651 | if (TabWidget->currentPageIndex() == 0) { | 1655 | if (TabWidget->currentPageIndex() == 0) { |
1652 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1656 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1653 | 1657 | ||
1654 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 1658 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
1655 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1659 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1656 | Ir *file = new Ir(this, "IR"); | 1660 | Ir *file = new Ir(this, "IR"); |
1657 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 1661 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
1658 | file->send( curFile, curFile ); | 1662 | file->send( curFile, curFile ); |
1659 | } | 1663 | } |
1660 | 1664 | ||
1661 | } else { | 1665 | } else { |
1662 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1666 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1663 | 1667 | ||
1664 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1668 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1665 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1669 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1666 | Ir *file = new Ir(this, "IR"); | 1670 | Ir *file = new Ir(this, "IR"); |
1667 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 1671 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); |
1668 | file->send( curFile, curFile ); | 1672 | file->send( curFile, curFile ); |
1669 | 1673 | ||
1670 | } | 1674 | } |
1671 | } | 1675 | } |
1672 | } | 1676 | } |
1673 | } | 1677 | } |
1674 | 1678 | ||
1675 | } | 1679 | } |
1676 | 1680 | ||
1677 | void AdvancedFm::fileBeamFinished( Ir *ir) { | 1681 | void AdvancedFm::fileBeamFinished( Ir *ir) { |
1678 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 1682 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
1679 | 1683 | ||
1680 | } | 1684 | } |
1681 | 1685 | ||
1682 | 1686 | ||
1683 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 1687 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
1684 | // QListViewItemIterator it( Local_View ); | 1688 | // QListViewItemIterator it( Local_View ); |
1685 | // for ( ; it.current(); ++it ) { | 1689 | // for ( ; it.current(); ++it ) { |
1686 | // if ( it.current()->isSelected() ) { | 1690 | // if ( it.current()->isSelected() ) { |
1687 | // QString strItem = it.current()->text(0); | 1691 | // QString strItem = it.current()->text(0); |
1688 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 1692 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
1689 | // QFileInfo fi(localFile); | 1693 | // QFileInfo fi(localFile); |
1690 | // } | 1694 | // } |
1691 | // } | 1695 | // } |
1692 | 1696 | ||
1693 | void AdvancedFm::showFileMenu() { | 1697 | void AdvancedFm::showFileMenu() { |
1694 | 1698 | ||
1695 | QString curApp; | 1699 | QString curApp; |
1696 | bool isLocalView = false; | 1700 | bool isLocalView = false; |
1697 | if (TabWidget->currentPageIndex() == 0) { | 1701 | if (TabWidget->currentPageIndex() == 0) { |
1698 | isLocalView = TRUE; | 1702 | isLocalView = TRUE; |
1699 | curApp = Local_View->currentItem()->text(0); | 1703 | curApp = Local_View->currentItem()->text(0); |
1700 | } else { | 1704 | } else { |
1701 | curApp = Remote_View->currentItem()->text(0); | 1705 | curApp = Remote_View->currentItem()->text(0); |
1702 | } | 1706 | } |
1703 | 1707 | ||
1704 | MimeType mt( curApp ); | 1708 | MimeType mt( curApp ); |
1705 | const AppLnk* app = mt.application(); | 1709 | const AppLnk* app = mt.application(); |
1706 | QFile fi(curApp); | 1710 | QFile fi(curApp); |
1707 | 1711 | ||
1708 | // QPopupMenu m; | 1712 | // QPopupMenu m; |
1709 | QPopupMenu *m = new QPopupMenu(0); | 1713 | QPopupMenu *m = new QPopupMenu(0); |
1710 | 1714 | ||
1711 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 1715 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
1712 | m->insertSeparator(); | 1716 | m->insertSeparator(); |
1713 | if ( QFileInfo(fi).isDir() ) { | 1717 | if ( QFileInfo(fi).isDir() ) { |
1714 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 1718 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
1715 | } else { | 1719 | } else { |
1716 | 1720 | ||
1717 | if ( app ) | 1721 | if ( app ) |
1718 | m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); | 1722 | m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); |
1719 | else if( QFileInfo(fi).isExecutable() ) | 1723 | else if( QFileInfo(fi).isExecutable() ) |
1720 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); | 1724 | m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); |
1721 | 1725 | ||
1722 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | 1726 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); |
1723 | } | 1727 | } |
1724 | m->insertSeparator(); | 1728 | m->insertSeparator(); |
1725 | 1729 | ||
1726 | 1730 | ||
1727 | if(isLocalView) | 1731 | if(isLocalView) |
1728 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 1732 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
1729 | else | 1733 | else |
1730 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 1734 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
1731 | 1735 | ||
1732 | m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 1736 | m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
1733 | m->insertSeparator(); | 1737 | m->insertSeparator(); |
1734 | 1738 | ||
1735 | if(isLocalView) | 1739 | if(isLocalView) |
1736 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 1740 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
1737 | else | 1741 | else |
1738 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 1742 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
1739 | 1743 | ||
1740 | m->insertItem( tr( "Copy" ), this, SLOT( copy() )); | 1744 | m->insertItem( tr( "Copy" ), this, SLOT( copy() )); |
1741 | m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 1745 | m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
1742 | m->insertItem( tr( "Move" ), this, SLOT( move() )); | 1746 | m->insertItem( tr( "Move" ), this, SLOT( move() )); |
1743 | m->insertSeparator(); | 1747 | m->insertSeparator(); |
1744 | 1748 | ||
1745 | if(isLocalView) | 1749 | if(isLocalView) |
1746 | m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); | 1750 | m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); |
1747 | else | 1751 | else |
1748 | m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | 1752 | m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); |
1749 | 1753 | ||
1750 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 1754 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
1751 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 1755 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
1752 | m->insertSeparator(); | 1756 | m->insertSeparator(); |
1753 | 1757 | ||
1754 | if(isLocalView) | 1758 | if(isLocalView) |
1755 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 1759 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
1756 | else | 1760 | else |
1757 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 1761 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
1758 | 1762 | ||
1759 | m->insertSeparator(); | 1763 | m->insertSeparator(); |
1760 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 1764 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
1761 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | 1765 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings |
1762 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 1766 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
1763 | m->setCheckable(TRUE); | 1767 | m->setCheckable(TRUE); |
1764 | if (!b) | 1768 | if (!b) |
1765 | m->setItemChecked(m->idAt(0),TRUE); | 1769 | m->setItemChecked(m->idAt(0),TRUE); |
1766 | else | 1770 | else |
1767 | m->setItemChecked(m->idAt(0),FALSE); | 1771 | m->setItemChecked(m->idAt(0),FALSE); |
1768 | if(Ir::supported()) | 1772 | if(Ir::supported()) |
1769 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | 1773 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); |
1770 | m->setFocus(); | 1774 | m->setFocus(); |
1771 | m->exec( QCursor::pos() ); | 1775 | m->exec( QCursor::pos() ); |
1776 | sleep(1); | ||
1772 | if(m) delete m; | 1777 | if(m) delete m; |
1773 | } | 1778 | } |
1774 | 1779 | ||
1775 | 1780 | ||
1776 | void AdvancedFm::cancelMenuTimer() | 1781 | void AdvancedFm::cancelMenuTimer() |
1777 | { | 1782 | { |
1778 | 1783 | ||
1779 | qDebug("selectionChanged: cancel menu timer"); | 1784 | qDebug("selectionChanged: cancel menu timer"); |
1780 | if( menuTimer.isActive() ) | 1785 | if( menuTimer.isActive() ) |
1781 | menuTimer.stop(); | 1786 | menuTimer.stop(); |
1782 | } | 1787 | } |
diff --git a/noncore/apps/advancedfm/opie-advancedfm.control b/noncore/apps/advancedfm/opie-advancedfm.control index bda8543..957a584 100644 --- a/noncore/apps/advancedfm/opie-advancedfm.control +++ b/noncore/apps/advancedfm/opie-advancedfm.control | |||
@@ -1,9 +1,10 @@ | |||
1 | Files: bin/advancedfm apps/Applications/advancedfm.desktop | 1 | Files: bin/advancedfm apps/Applications/advancedfm.desktop |
2 | Priority: optional | 2 | Priority: optional |
3 | Package: opie-advancedfm | ||
3 | Section: opie/applications | 4 | Section: opie/applications |
4 | Maintainer: L.J. Potter <ljp@llornkcor.com> | 5 | Maintainer: L.J. Potter <ljp@llornkcor.com> |
5 | Architecture: arm | 6 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 7 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 8 | Depends: opie-base ($QPE_VERSION) |
8 | Description: Advanced File Manager | 9 | Description: Advanced File Manager |
9 | The advanced file manager for the Opie environment. | 10 | The advanced file manager for the Opie environment. |