author | llornkcor <llornkcor> | 2002-04-28 13:20:23 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-28 13:20:23 (UTC) |
commit | 495103fd36f52dad3a564b924326519c9f52ccaf (patch) (unidiff) | |
tree | 22a26ab944ee236c5df7cc2fe8f394fee7b91236 | |
parent | ee6fdf8783f7a2fa91792e2f0ce0f8350f8cac0d (diff) | |
download | opie-495103fd36f52dad3a564b924326519c9f52ccaf.zip opie-495103fd36f52dad3a564b924326519c9f52ccaf.tar.gz opie-495103fd36f52dad3a564b924326519c9f52ccaf.tar.bz2 |
added qpeDir icon, added ability to execute with 'open'
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 91 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 3 |
2 files changed, 69 insertions, 25 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index bb932c5..ab31c91 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -63,100 +63,106 @@ | |||
63 | #include <time.h> | 63 | #include <time.h> |
64 | #include <fcntl.h> | 64 | #include <fcntl.h> |
65 | 65 | ||
66 | AdvancedFm::AdvancedFm( ) | 66 | AdvancedFm::AdvancedFm( ) |
67 | : QMainWindow( ) | 67 | : QMainWindow( ) |
68 | { | 68 | { |
69 | setCaption( tr( "AdvancedFm" ) ); | 69 | setCaption( tr( "AdvancedFm" ) ); |
70 | 70 | ||
71 | QGridLayout *layout = new QGridLayout( this ); | 71 | QGridLayout *layout = new QGridLayout( this ); |
72 | layout->setSpacing( 2); | 72 | layout->setSpacing( 2); |
73 | layout->setMargin( 2); | 73 | layout->setMargin( 2); |
74 | 74 | ||
75 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 75 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
76 | 76 | ||
77 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 77 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
78 | // fileMenu = new QPopupMenu( this ); | 78 | // fileMenu = new QPopupMenu( this ); |
79 | fileMenu = new QPopupMenu( this ); | 79 | fileMenu = new QPopupMenu( this ); |
80 | viewMenu = new QPopupMenu( this ); | 80 | viewMenu = new QPopupMenu( this ); |
81 | 81 | ||
82 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 82 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
83 | 83 | ||
84 | menuBar->insertItem( tr( "File" ), fileMenu); | 84 | menuBar->insertItem( tr( "File" ), fileMenu); |
85 | menuBar->insertItem( tr( "View" ), viewMenu); | 85 | menuBar->insertItem( tr( "View" ), viewMenu); |
86 | 86 | ||
87 | qpeDirButton= new QPushButton(Resource::loadIconSet("go"),"",this,"QPEButton"); | ||
88 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | ||
89 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | ||
90 | qpeDirButton->setFlat(TRUE); | ||
91 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | ||
92 | |||
87 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); | 93 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); |
88 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 94 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
89 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 95 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
90 | cfButton->setFlat(TRUE); | 96 | cfButton->setFlat(TRUE); |
91 | layout->addMultiCellWidget( cfButton , 0, 0, 2, 2); | 97 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); |
92 | 98 | ||
93 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); | 99 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); |
94 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 100 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
95 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 101 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
96 | sdButton->setFlat(TRUE); | 102 | sdButton->setFlat(TRUE); |
97 | layout->addMultiCellWidget( sdButton , 0, 0, 3, 3); | 103 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); |
98 | 104 | ||
99 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | 105 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); |
100 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 106 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
101 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 107 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
102 | cdUpButton ->setFlat(TRUE); | 108 | cdUpButton ->setFlat(TRUE); |
103 | layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4); | 109 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); |
104 | 110 | ||
105 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 111 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
106 | docButton->setFixedSize( QSize( 20, 20 ) ); | 112 | docButton->setFixedSize( QSize( 20, 20 ) ); |
107 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 113 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
108 | docButton->setFlat(TRUE); | 114 | docButton->setFlat(TRUE); |
109 | layout->addMultiCellWidget( docButton, 0, 0, 5, 5); | 115 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); |
110 | 116 | ||
111 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 117 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); |
112 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 118 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
113 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 119 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
114 | homeButton->setFlat(TRUE); | 120 | homeButton->setFlat(TRUE); |
115 | layout->addMultiCellWidget( homeButton, 0, 0, 6, 6); | 121 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); |
116 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 122 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
117 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 123 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
118 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 124 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
119 | 125 | ||
120 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 126 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
121 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 127 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
122 | fileMenu->insertSeparator(); | 128 | fileMenu->insertSeparator(); |
123 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 129 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
124 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 130 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
125 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 131 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
126 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 132 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
127 | fileMenu->insertSeparator(); | 133 | fileMenu->insertSeparator(); |
128 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 134 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
129 | fileMenu->setCheckable(TRUE); | 135 | fileMenu->setCheckable(TRUE); |
130 | 136 | ||
131 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 137 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
132 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 138 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
133 | viewMenu->insertSeparator(); | 139 | viewMenu->insertSeparator(); |
134 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 140 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
135 | viewMenu->setCheckable(TRUE); | 141 | viewMenu->setCheckable(TRUE); |
136 | 142 | ||
137 | TabWidget = new QTabWidget( this, "TabWidget" ); | 143 | TabWidget = new QTabWidget( this, "TabWidget" ); |
138 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6); | 144 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 7); |
139 | 145 | ||
140 | tab = new QWidget( TabWidget, "tab" ); | 146 | tab = new QWidget( TabWidget, "tab" ); |
141 | tabLayout = new QGridLayout( tab ); | 147 | tabLayout = new QGridLayout( tab ); |
142 | tabLayout->setSpacing( 2); | 148 | tabLayout->setSpacing( 2); |
143 | tabLayout->setMargin( 2); | 149 | tabLayout->setMargin( 2); |
144 | 150 | ||
145 | Local_View = new QListView( tab, "Local_View" ); | 151 | Local_View = new QListView( tab, "Local_View" ); |
146 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 152 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
147 | Local_View->addColumn( tr("File"),130); | 153 | Local_View->addColumn( tr("File"),130); |
148 | Local_View->addColumn( tr("Size"),-1); | 154 | Local_View->addColumn( tr("Size"),-1); |
149 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 155 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
150 | Local_View->addColumn( tr("Date"),-1); | 156 | Local_View->addColumn( tr("Date"),-1); |
151 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 157 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
152 | Local_View->setAllColumnsShowFocus(TRUE); | 158 | Local_View->setAllColumnsShowFocus(TRUE); |
153 | Local_View->setMultiSelection( TRUE ); | 159 | Local_View->setMultiSelection( TRUE ); |
154 | Local_View->setSelectionMode(QListView::Extended); | 160 | Local_View->setSelectionMode(QListView::Extended); |
155 | 161 | ||
156 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 162 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
157 | 163 | ||
158 | tabLayout->addWidget( Local_View, 0, 0 ); | 164 | tabLayout->addWidget( Local_View, 0, 0 ); |
159 | 165 | ||
160 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 166 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
161 | this,SLOT( localListClicked(QListViewItem *)) ); | 167 | this,SLOT( localListClicked(QListViewItem *)) ); |
162 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 168 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
@@ -192,60 +198,60 @@ AdvancedFm::AdvancedFm( ) | |||
192 | 198 | ||
193 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 199 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
194 | this,SLOT(tabChanged(QWidget*))); | 200 | this,SLOT(tabChanged(QWidget*))); |
195 | 201 | ||
196 | // tab_3 = new QWidget( TabWidget, "tab_3" ); | 202 | // tab_3 = new QWidget( TabWidget, "tab_3" ); |
197 | // tabLayout_3 = new QGridLayout( tab_3 ); | 203 | // tabLayout_3 = new QGridLayout( tab_3 ); |
198 | // tabLayout_3->setSpacing( 2); | 204 | // tabLayout_3->setSpacing( 2); |
199 | // tabLayout_3->setMargin( 2); | 205 | // tabLayout_3->setMargin( 2); |
200 | 206 | ||
201 | // OFileSelector *fileSelector; | 207 | // OFileSelector *fileSelector; |
202 | // fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); | 208 | // fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); |
203 | // tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); | 209 | // tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); |
204 | 210 | ||
205 | // TabWidget->insertTab( tab_3, tr( "Files" ) ); | 211 | // TabWidget->insertTab( tab_3, tr( "Files" ) ); |
206 | 212 | ||
207 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 213 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
208 | currentDir.setPath( QDir::currentDirPath()); | 214 | currentDir.setPath( QDir::currentDirPath()); |
209 | 215 | ||
210 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 216 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
211 | currentRemoteDir.setPath( QDir::currentDirPath()); | 217 | currentRemoteDir.setPath( QDir::currentDirPath()); |
212 | 218 | ||
213 | b = TRUE; | 219 | b = TRUE; |
214 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 220 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
215 | currentPathCombo->setEditable(TRUE); | 221 | currentPathCombo->setEditable(TRUE); |
216 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); | 222 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); |
217 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 223 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
218 | 224 | ||
219 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 225 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
220 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 226 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
221 | 227 | ||
222 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 228 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
223 | this,SLOT(currentPathComboChanged())); | 229 | this,SLOT(currentPathComboChanged())); |
224 | 230 | ||
225 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 231 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
226 | 232 | ||
227 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); | 233 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); |
228 | 234 | ||
229 | filterStr="*"; | 235 | filterStr="*"; |
230 | b=FALSE; | 236 | b=FALSE; |
231 | populateLocalView(); | 237 | populateLocalView(); |
232 | populateRemoteView(); | 238 | populateRemoteView(); |
233 | } | 239 | } |
234 | 240 | ||
235 | AdvancedFm::~AdvancedFm() | 241 | AdvancedFm::~AdvancedFm() |
236 | { | 242 | { |
237 | } | 243 | } |
238 | 244 | ||
239 | void AdvancedFm::cleanUp() | 245 | void AdvancedFm::cleanUp() |
240 | { | 246 | { |
241 | QString sfile=QDir::homeDirPath(); | 247 | QString sfile=QDir::homeDirPath(); |
242 | if(sfile.right(1) != "/") | 248 | if(sfile.right(1) != "/") |
243 | sfile+="/._temp"; | 249 | sfile+="/._temp"; |
244 | else | 250 | else |
245 | sfile+="._temp"; | 251 | sfile+="._temp"; |
246 | QFile file( sfile); | 252 | QFile file( sfile); |
247 | if(file.exists()) | 253 | if(file.exists()) |
248 | file.remove(); | 254 | file.remove(); |
249 | } | 255 | } |
250 | 256 | ||
251 | void AdvancedFm::tabChanged(QWidget *w) | 257 | void AdvancedFm::tabChanged(QWidget *w) |
@@ -285,58 +291,64 @@ void AdvancedFm::populateLocalView() | |||
285 | bool isDir=FALSE; | 291 | bool isDir=FALSE; |
286 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 292 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
287 | QFileInfoListIterator it(*list); | 293 | QFileInfoListIterator it(*list); |
288 | QFileInfo *fi; | 294 | QFileInfo *fi; |
289 | while ( (fi=it.current()) ) { | 295 | while ( (fi=it.current()) ) { |
290 | if (fi->isSymLink() ) { | 296 | if (fi->isSymLink() ) { |
291 | QString symLink=fi->readLink(); | 297 | QString symLink=fi->readLink(); |
292 | // qDebug("Symlink detected "+symLink); | 298 | // qDebug("Symlink detected "+symLink); |
293 | QFileInfo sym( symLink); | 299 | QFileInfo sym( symLink); |
294 | fileS.sprintf( "%10li", sym.size() ); | 300 | fileS.sprintf( "%10li", sym.size() ); |
295 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 301 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
296 | fileDate = sym.lastModified().toString(); | 302 | fileDate = sym.lastModified().toString(); |
297 | } else { | 303 | } else { |
298 | fileS.sprintf( "%10li", fi->size() ); | 304 | fileS.sprintf( "%10li", fi->size() ); |
299 | fileL.sprintf( "%s",fi->fileName().data() ); | 305 | fileL.sprintf( "%s",fi->fileName().data() ); |
300 | fileDate= fi->lastModified().toString(); | 306 | fileDate= fi->lastModified().toString(); |
301 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 307 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
302 | fileL+="/"; | 308 | fileL+="/"; |
303 | isDir=TRUE; | 309 | isDir=TRUE; |
304 | // qDebug( fileL); | 310 | // qDebug( fileL); |
305 | } | 311 | } |
306 | } | 312 | } |
307 | if(fileL !="./" && fi->exists()) { | 313 | if(fileL !="./" && fi->exists()) { |
308 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 314 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
309 | |||
310 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 315 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
311 | if( !QDir( fi->filePath() ).isReadable()) | 316 | if( !QDir( fi->filePath() ).isReadable()) |
312 | pm = Resource::loadPixmap( "lockedfolder" ); | 317 | pm = Resource::loadPixmap( "lockedfolder" ); |
313 | else | 318 | else |
314 | pm= Resource::loadPixmap( "folder" ); | 319 | pm= Resource::loadPixmap( "folder" ); |
315 | item->setPixmap( 0,pm ); | 320 | item->setPixmap( 0,pm ); |
316 | } else { | 321 | } else { |
317 | if( !fi->isReadable() ) | 322 | if(fi->isExecutable()) { |
323 | pm = Resource::loadPixmap( "exec"); | ||
324 | item->setPixmap( 0,pm); | ||
325 | } | ||
326 | else if( !fi->isReadable() ) { | ||
318 | pm = Resource::loadPixmap( "locked" ); | 327 | pm = Resource::loadPixmap( "locked" ); |
328 | item->setPixmap( 0,pm); | ||
329 | |||
330 | } | ||
319 | else { | 331 | else { |
320 | MimeType mt(fi->filePath()); | 332 | MimeType mt(fi->filePath()); |
321 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 333 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
322 | if(pm.isNull()) | 334 | if(pm.isNull()) |
323 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 335 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
324 | item->setPixmap( 0,pm); | 336 | item->setPixmap( 0,pm); |
325 | } | 337 | } |
326 | } | 338 | } |
327 | if( fileL.find("->",0,TRUE) != -1) { | 339 | if( fileL.find("->",0,TRUE) != -1) { |
328 | // overlay link image | 340 | // overlay link image |
329 | pm= Resource::loadPixmap( "folder" ); | 341 | pm= Resource::loadPixmap( "folder" ); |
330 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 342 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
331 | QPainter painter( &pm ); | 343 | QPainter painter( &pm ); |
332 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 344 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
333 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 345 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
334 | item->setPixmap( 0, pm); | 346 | item->setPixmap( 0, pm); |
335 | } | 347 | } |
336 | } isDir=FALSE; | 348 | } isDir=FALSE; |
337 | ++it; | 349 | ++it; |
338 | } | 350 | } |
339 | 351 | ||
340 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 352 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
341 | struct stat buf; | 353 | struct stat buf; |
342 | struct stat st; | 354 | struct stat st; |
@@ -402,51 +414,56 @@ void AdvancedFm::populateRemoteView() | |||
402 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 414 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
403 | fileDate = sym.lastModified().toString(); | 415 | fileDate = sym.lastModified().toString(); |
404 | } else { | 416 | } else { |
405 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 417 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
406 | fileS.sprintf( "%10li", fi->size() ); | 418 | fileS.sprintf( "%10li", fi->size() ); |
407 | fileL.sprintf( "%s",fi->fileName().data() ); | 419 | fileL.sprintf( "%s",fi->fileName().data() ); |
408 | fileDate= fi->lastModified().toString(); | 420 | fileDate= fi->lastModified().toString(); |
409 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 421 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
410 | fileL+="/"; | 422 | fileL+="/"; |
411 | isDir=TRUE; | 423 | isDir=TRUE; |
412 | // qDebug( fileL); | 424 | // qDebug( fileL); |
413 | } | 425 | } |
414 | } | 426 | } |
415 | if(fileL !="./" && fi->exists()) { | 427 | if(fileL !="./" && fi->exists()) { |
416 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 428 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
417 | QPixmap pm; | 429 | QPixmap pm; |
418 | 430 | ||
419 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 431 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
420 | if( !QDir( fi->filePath() ).isReadable()) | 432 | if( !QDir( fi->filePath() ).isReadable()) |
421 | pm = Resource::loadPixmap( "lockedfolder" ); | 433 | pm = Resource::loadPixmap( "lockedfolder" ); |
422 | else | 434 | else |
423 | pm= Resource::loadPixmap( "folder" ); | 435 | pm= Resource::loadPixmap( "folder" ); |
424 | item->setPixmap( 0,pm ); | 436 | item->setPixmap( 0,pm ); |
425 | } else { | 437 | } else { |
426 | if( !fi->isReadable() ) | 438 | if(fi->isExecutable()) { |
439 | pm = Resource::loadPixmap( "exec"); | ||
440 | item->setPixmap( 0,pm); | ||
441 | } | ||
442 | else if( !fi->isReadable() ) { | ||
427 | pm = Resource::loadPixmap( "locked" ); | 443 | pm = Resource::loadPixmap( "locked" ); |
428 | else { | 444 | item->setPixmap( 0,pm); |
445 | } else { | ||
429 | MimeType mt(fi->filePath()); | 446 | MimeType mt(fi->filePath()); |
430 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 447 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
431 | if(pm.isNull()) | 448 | if(pm.isNull()) |
432 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 449 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
433 | item->setPixmap( 0,pm); | 450 | item->setPixmap( 0,pm); |
434 | } | 451 | } |
435 | } | 452 | } |
436 | if( fileL.find("->",0,TRUE) != -1) { | 453 | if( fileL.find("->",0,TRUE) != -1) { |
437 | // overlay link image | 454 | // overlay link image |
438 | pm= Resource::loadPixmap( "folder" ); | 455 | pm= Resource::loadPixmap( "folder" ); |
439 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 456 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
440 | QPainter painter( &pm ); | 457 | QPainter painter( &pm ); |
441 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 458 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
442 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 459 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
443 | item->setPixmap( 0, pm); | 460 | item->setPixmap( 0, pm); |
444 | } | 461 | } |
445 | } isDir=FALSE; | 462 | } isDir=FALSE; |
446 | ++it; | 463 | ++it; |
447 | } | 464 | } |
448 | 465 | ||
449 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 466 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
450 | struct stat buf; | 467 | struct stat buf; |
451 | struct stat st; | 468 | struct stat st; |
452 | mode_t mode; | 469 | mode_t mode; |
@@ -677,66 +694,78 @@ void AdvancedFm::showRemoteMenu(QListViewItem * item) | |||
677 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 694 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
678 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 695 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
679 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 696 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
680 | m.insertSeparator(); | 697 | m.insertSeparator(); |
681 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 698 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
682 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 699 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
683 | m.insertSeparator(); | 700 | m.insertSeparator(); |
684 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 701 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
685 | m.insertSeparator(); | 702 | m.insertSeparator(); |
686 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 703 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
687 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 704 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
688 | m.setCheckable(TRUE); | 705 | m.setCheckable(TRUE); |
689 | if (!b) | 706 | if (!b) |
690 | m.setItemChecked(m.idAt(0),TRUE); | 707 | m.setItemChecked(m.idAt(0),TRUE); |
691 | else | 708 | else |
692 | m.setItemChecked(m.idAt(0),FALSE); | 709 | m.setItemChecked(m.idAt(0),FALSE); |
693 | m.exec( QCursor::pos() ); | 710 | m.exec( QCursor::pos() ); |
694 | } | 711 | } |
695 | } | 712 | } |
696 | 713 | ||
697 | void AdvancedFm::runThis() { | 714 | void AdvancedFm::runThis() { |
698 | // QFileInfo *fi; | 715 | // QFileInfo *fi; |
699 | if (TabWidget->currentPageIndex() == 0) { | 716 | if (TabWidget->currentPageIndex() == 0) { |
700 | QString curFile = Local_View->currentItem()->text(0); | 717 | QString curFile = Local_View->currentItem()->text(0); |
701 | curFile = currentDir.canonicalPath()+"/"+curFile; | 718 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
702 | DocLnk nf(curFile); | 719 | if(fileInfo.isExecutable()) { |
703 | QString execStr = nf.exec(); | 720 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
704 | qDebug( execStr); | 721 | e << curFile; |
705 | if( execStr.isEmpty() ) { | ||
706 | } else { | 722 | } else { |
707 | nf.execute(); | 723 | curFile = currentDir.canonicalPath()+"/"+curFile; |
724 | DocLnk nf(curFile); | ||
725 | QString execStr = nf.exec(); | ||
726 | qDebug( execStr); | ||
727 | if( execStr.isEmpty() ) { | ||
728 | } else { | ||
729 | nf.execute(); | ||
730 | } | ||
708 | } | 731 | } |
709 | // MimeType mt( curFile); | 732 | // MimeType mt( curFile); |
710 | } else { | 733 | } else { |
711 | QString curFile = Remote_View->currentItem()->text(0); | 734 | QString curFile = Remote_View->currentItem()->text(0); |
712 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 735 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
713 | DocLnk nf(curFile); | 736 | if(fileInfo.isExecutable()) { |
714 | QString execStr = nf.exec(); | 737 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
715 | qDebug(execStr); | 738 | e << curFile; |
716 | if( execStr.isEmpty() ) { | ||
717 | } else { | 739 | } else { |
718 | nf.execute(); | 740 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
741 | DocLnk nf(curFile); | ||
742 | QString execStr = nf.exec(); | ||
743 | qDebug(execStr); | ||
744 | if( execStr.isEmpty() ) { | ||
745 | } else { | ||
746 | nf.execute(); | ||
747 | } | ||
719 | } | 748 | } |
720 | // MimeType mt( curFile); | 749 | // MimeType mt( curFile); |
721 | } | 750 | } |
722 | } | 751 | } |
723 | 752 | ||
724 | void AdvancedFm::runText() { | 753 | void AdvancedFm::runText() { |
725 | if (TabWidget->currentPageIndex() == 0) { | 754 | if (TabWidget->currentPageIndex() == 0) { |
726 | QString curFile = Local_View->currentItem()->text(0); | 755 | QString curFile = Local_View->currentItem()->text(0); |
727 | curFile = currentDir.canonicalPath()+"/"+curFile; | 756 | curFile = currentDir.canonicalPath()+"/"+curFile; |
728 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 757 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
729 | e << curFile; | 758 | e << curFile; |
730 | } else { | 759 | } else { |
731 | QString curFile = Remote_View->currentItem()->text(0); | 760 | QString curFile = Remote_View->currentItem()->text(0); |
732 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 761 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
733 | DocLnk nf(curFile); | 762 | DocLnk nf(curFile); |
734 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 763 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
735 | e << curFile; | 764 | e << curFile; |
736 | } | 765 | } |
737 | } | 766 | } |
738 | 767 | ||
739 | void AdvancedFm::localMakDir() | 768 | void AdvancedFm::localMakDir() |
740 | { | 769 | { |
741 | InputDialog *fileDlg; | 770 | InputDialog *fileDlg; |
742 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 771 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
@@ -1457,24 +1486,38 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | |||
1457 | } | 1486 | } |
1458 | 1487 | ||
1459 | } | 1488 | } |
1460 | 1489 | ||
1461 | void AdvancedFm::mkSym() { | 1490 | void AdvancedFm::mkSym() { |
1462 | QString cmd; | 1491 | QString cmd; |
1463 | if (TabWidget->currentPageIndex() == 0) { | 1492 | if (TabWidget->currentPageIndex() == 0) { |
1464 | QString curFile = Local_View->currentItem()->text(0); | 1493 | QString curFile = Local_View->currentItem()->text(0); |
1465 | if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); | 1494 | if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); |
1466 | QString destName = currentRemoteDir.canonicalPath()+"/"+curFile; | 1495 | QString destName = currentRemoteDir.canonicalPath()+"/"+curFile; |
1467 | curFile = currentDir.canonicalPath()+"/"+curFile; | 1496 | curFile = currentDir.canonicalPath()+"/"+curFile; |
1468 | cmd = "ln -s "+curFile+" "+destName; | 1497 | cmd = "ln -s "+curFile+" "+destName; |
1469 | system(cmd.latin1() ); | 1498 | system(cmd.latin1() ); |
1470 | populateRemoteView(); | 1499 | populateRemoteView(); |
1471 | } else { | 1500 | } else { |
1472 | QString curFile = Remote_View->currentItem()->text(0); | 1501 | QString curFile = Remote_View->currentItem()->text(0); |
1473 | if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); | 1502 | if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); |
1474 | QString destName = currentDir.canonicalPath()+"/"+curFile; | 1503 | QString destName = currentDir.canonicalPath()+"/"+curFile; |
1475 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 1504 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
1476 | cmd = "ln -s "+curFile+" "+destName; | 1505 | cmd = "ln -s "+curFile+" "+destName; |
1477 | system(cmd.latin1() ); | 1506 | system(cmd.latin1() ); |
1478 | populateLocalView(); | 1507 | populateLocalView(); |
1479 | } | 1508 | } |
1480 | } | 1509 | } |
1510 | |||
1511 | void AdvancedFm::QPEButtonPushed() { | ||
1512 | QString current = QPEApplication::qpeDir(); | ||
1513 | chdir( current.latin1() ); | ||
1514 | if (TabWidget->currentPageIndex() == 0) { | ||
1515 | currentDir.cd( current, TRUE); | ||
1516 | populateLocalView(); | ||
1517 | } else { | ||
1518 | currentRemoteDir.cd( current, TRUE); | ||
1519 | populateRemoteView(); | ||
1520 | } | ||
1521 | update(); | ||
1522 | |||
1523 | } | ||
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index c00713f..5c2719e 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -31,49 +31,49 @@ class QProgressBar; | |||
31 | class QSpinBox; | 31 | class QSpinBox; |
32 | class QTabWidget; | 32 | class QTabWidget; |
33 | class QWidget; | 33 | class QWidget; |
34 | class QPEToolBar; | 34 | class QPEToolBar; |
35 | class QPEMenuBar; | 35 | class QPEMenuBar; |
36 | class QPopupMenu; | 36 | class QPopupMenu; |
37 | class QFile; | 37 | class QFile; |
38 | class QListViewItem; | 38 | class QListViewItem; |
39 | class QLineEdit; | 39 | class QLineEdit; |
40 | class QPushButton; | 40 | class QPushButton; |
41 | 41 | ||
42 | class AdvancedFm : public QMainWindow | 42 | class AdvancedFm : public QMainWindow |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | AdvancedFm(); | 46 | AdvancedFm(); |
47 | ~AdvancedFm(); | 47 | ~AdvancedFm(); |
48 | 48 | ||
49 | QTabWidget *TabWidget; | 49 | QTabWidget *TabWidget; |
50 | QWidget *tab, *tab_2, *tab_3; | 50 | QWidget *tab, *tab_2, *tab_3; |
51 | QListView *Local_View, *Remote_View; | 51 | QListView *Local_View, *Remote_View; |
52 | 52 | ||
53 | QLineEdit *currentPathEdit; | 53 | QLineEdit *currentPathEdit; |
54 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; | 54 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; |
55 | QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton; | 55 | QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
56 | QDir currentDir, currentRemoteDir; | 56 | QDir currentDir, currentRemoteDir; |
57 | QComboBox *currentPathCombo; | 57 | QComboBox *currentPathCombo; |
58 | QString filterStr; | 58 | QString filterStr; |
59 | QListViewItem * item; | 59 | QListViewItem * item; |
60 | bool b; | 60 | bool b; |
61 | int currentServerConfig; | 61 | int currentServerConfig; |
62 | protected slots: | 62 | protected slots: |
63 | void showLocalMenu( QListViewItem *); | 63 | void showLocalMenu( QListViewItem *); |
64 | void showRemoteMenu( QListViewItem *); | 64 | void showRemoteMenu( QListViewItem *); |
65 | void doLocalCd(); | 65 | void doLocalCd(); |
66 | void doRemoteCd(); | 66 | void doRemoteCd(); |
67 | // void copy(); | 67 | // void copy(); |
68 | void mkDir(); | 68 | void mkDir(); |
69 | void del(); | 69 | void del(); |
70 | void rn(); | 70 | void rn(); |
71 | void populateLocalView(); | 71 | void populateLocalView(); |
72 | void populateRemoteView(); | 72 | void populateRemoteView(); |
73 | void showHidden(); | 73 | void showHidden(); |
74 | void showRemoteHidden(); | 74 | void showRemoteHidden(); |
75 | void writeConfig(); | 75 | void writeConfig(); |
76 | void readConfig(); | 76 | void readConfig(); |
77 | void localListClicked(QListViewItem *); | 77 | void localListClicked(QListViewItem *); |
78 | void remoteListClicked(QListViewItem *); | 78 | void remoteListClicked(QListViewItem *); |
79 | void localListPressed( int, QListViewItem *, const QPoint&, int); | 79 | void localListPressed( int, QListViewItem *, const QPoint&, int); |
@@ -87,37 +87,38 @@ protected slots: | |||
87 | void tabChanged(QWidget*); | 87 | void tabChanged(QWidget*); |
88 | void cleanUp(); | 88 | void cleanUp(); |
89 | void remoteRename(); | 89 | void remoteRename(); |
90 | void localRename(); | 90 | void localRename(); |
91 | void runThis(); | 91 | void runThis(); |
92 | void runText(); | 92 | void runText(); |
93 | void filePerms(); | 93 | void filePerms(); |
94 | void doProperties(); | 94 | void doProperties(); |
95 | void runCommand(); | 95 | void runCommand(); |
96 | void runCommandStd(); | 96 | void runCommandStd(); |
97 | QStringList getPath(); | 97 | QStringList getPath(); |
98 | void mkSym(); | 98 | void mkSym(); |
99 | void switchToLocalTab(); | 99 | void switchToLocalTab(); |
100 | void switchToRemoteTab(); | 100 | void switchToRemoteTab(); |
101 | 101 | ||
102 | protected: | 102 | protected: |
103 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 103 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
104 | QStringList remoteDirPathStringList, localDirPathStringList; | 104 | QStringList remoteDirPathStringList, localDirPathStringList; |
105 | void keyReleaseEvent( QKeyEvent *); | 105 | void keyReleaseEvent( QKeyEvent *); |
106 | protected slots: | 106 | protected slots: |
107 | void homeButtonPushed(); | 107 | void homeButtonPushed(); |
108 | void docButtonPushed(); | 108 | void docButtonPushed(); |
109 | void SDButtonPushed(); | 109 | void SDButtonPushed(); |
110 | void CFButtonPushed(); | 110 | void CFButtonPushed(); |
111 | void QPEButtonPushed(); | ||
111 | void upDir(); | 112 | void upDir(); |
112 | void currentPathComboChanged(); | 113 | void currentPathComboChanged(); |
113 | void copy(); | 114 | void copy(); |
114 | void copyAs(); | 115 | void copyAs(); |
115 | void currentPathComboActivated(const QString &); | 116 | void currentPathComboActivated(const QString &); |
116 | void fillCombo(const QString &); | 117 | void fillCombo(const QString &); |
117 | bool copyFile( const QString & , const QString & ); | 118 | bool copyFile( const QString & , const QString & ); |
118 | void move(); | 119 | void move(); |
119 | void fileStatus(); | 120 | void fileStatus(); |
120 | void doAbout(); | 121 | void doAbout(); |
121 | }; | 122 | }; |
122 | 123 | ||
123 | #endif // ADVANCEDFM_H | 124 | #endif // ADVANCEDFM_H |