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 | |||
@@ -39,328 +39,340 @@ | |||
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
43 | #include <qpopupmenu.h> | 43 | #include <qpopupmenu.h> |
44 | #include <qlistview.h> | 44 | #include <qlistview.h> |
45 | #include <qmainwindow.h> | 45 | #include <qmainwindow.h> |
46 | #include <qlabel.h> | 46 | #include <qlabel.h> |
47 | #include <qprogressbar.h> | 47 | #include <qprogressbar.h> |
48 | #include <qspinbox.h> | 48 | #include <qspinbox.h> |
49 | #include <qtabwidget.h> | 49 | #include <qtabwidget.h> |
50 | #include <qwidget.h> | 50 | #include <qwidget.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qimage.h> | 52 | #include <qimage.h> |
53 | #include <qpixmap.h> | 53 | #include <qpixmap.h> |
54 | #include <qmessagebox.h> | 54 | #include <qmessagebox.h> |
55 | #include <qlineedit.h> | 55 | #include <qlineedit.h> |
56 | #include <qregexp.h> | 56 | #include <qregexp.h> |
57 | 57 | ||
58 | #include <unistd.h> | 58 | #include <unistd.h> |
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | #include <sys/stat.h> | 60 | #include <sys/stat.h> |
61 | #include <dirent.h> | 61 | #include <dirent.h> |
62 | #include <stdio.h> | 62 | #include <stdio.h> |
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)), |
163 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 169 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
164 | 170 | ||
165 | TabWidget->insertTab( tab, tr("1")); | 171 | TabWidget->insertTab( tab, tr("1")); |
166 | 172 | ||
167 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 173 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
168 | tabLayout_2 = new QGridLayout( tab_2 ); | 174 | tabLayout_2 = new QGridLayout( tab_2 ); |
169 | tabLayout_2->setSpacing( 2); | 175 | tabLayout_2->setSpacing( 2); |
170 | tabLayout_2->setMargin( 2); | 176 | tabLayout_2->setMargin( 2); |
171 | 177 | ||
172 | Remote_View = new QListView( tab_2, "Remote_View" ); | 178 | Remote_View = new QListView( tab_2, "Remote_View" ); |
173 | Remote_View->addColumn( tr("File"),130); | 179 | Remote_View->addColumn( tr("File"),130); |
174 | Remote_View->addColumn( tr("Size"),-1); | 180 | Remote_View->addColumn( tr("Size"),-1); |
175 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 181 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
176 | Remote_View->addColumn( tr("Date"),-1); | 182 | Remote_View->addColumn( tr("Date"),-1); |
177 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 183 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
178 | Remote_View->setAllColumnsShowFocus(TRUE); | 184 | Remote_View->setAllColumnsShowFocus(TRUE); |
179 | Remote_View->setMultiSelection( TRUE ); | 185 | Remote_View->setMultiSelection( TRUE ); |
180 | Remote_View->setSelectionMode(QListView::Extended); | 186 | Remote_View->setSelectionMode(QListView::Extended); |
181 | 187 | ||
182 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 188 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
183 | 189 | ||
184 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 190 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
185 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 191 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
186 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 192 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
187 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 193 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
188 | 194 | ||
189 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 195 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
190 | 196 | ||
191 | TabWidget->insertTab( tab_2, tr( "2")); | 197 | TabWidget->insertTab( tab_2, tr( "2")); |
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) |
252 | { | 258 | { |
253 | if (TabWidget->currentPageIndex() == 0) { | 259 | if (TabWidget->currentPageIndex() == 0) { |
254 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 260 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
255 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 261 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
256 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 262 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
257 | } | 263 | } |
258 | if (TabWidget->currentPageIndex() == 1) { | 264 | if (TabWidget->currentPageIndex() == 1) { |
259 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 265 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
260 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 266 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
261 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 267 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
262 | } | 268 | } |
263 | } | 269 | } |
264 | 270 | ||
265 | 271 | ||
266 | void AdvancedFm::populateLocalView() | 272 | void AdvancedFm::populateLocalView() |
267 | { | 273 | { |
268 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 274 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
269 | // QListViewItemIterator it( Local_View ); | 275 | // QListViewItemIterator it( Local_View ); |
270 | // for ( ; it.current(); ++it ) { | 276 | // for ( ; it.current(); ++it ) { |
271 | // if ( it.current()->isSelected() ) { | 277 | // if ( it.current()->isSelected() ) { |
272 | // QString strItem = it.current()->text(0); | 278 | // QString strItem = it.current()->text(0); |
273 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 279 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
274 | // QFileInfo fi(localFile); | 280 | // QFileInfo fi(localFile); |
275 | // } | 281 | // } |
276 | // } | 282 | // } |
277 | QPixmap pm; | 283 | QPixmap pm; |
278 | Local_View->clear(); | 284 | Local_View->clear(); |
279 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 285 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
280 | currentDir.setMatchAllDirs(TRUE); | 286 | currentDir.setMatchAllDirs(TRUE); |
281 | currentDir.setNameFilter(filterStr); | 287 | currentDir.setNameFilter(filterStr); |
282 | QString fileL, fileS, fileDate; | 288 | QString fileL, fileS, fileDate; |
283 | // qDebug(currentDir.canonicalPath()); | 289 | // qDebug(currentDir.canonicalPath()); |
284 | 290 | ||
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; |
343 | dev_t devT; | 355 | dev_t devT; |
344 | mode_t mode; | 356 | mode_t mode; |
345 | DIR *dir; | 357 | DIR *dir; |
346 | int fd = 0; | 358 | int fd = 0; |
347 | struct dirent *mydirent; | 359 | struct dirent *mydirent; |
348 | int i = 1; | 360 | int i = 1; |
349 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 361 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
350 | while ((mydirent = readdir(dir)) != NULL) { | 362 | while ((mydirent = readdir(dir)) != NULL) { |
351 | lstat( mydirent->d_name, &buf); | 363 | lstat( mydirent->d_name, &buf); |
352 | qDebug(mydirent->d_name); | 364 | qDebug(mydirent->d_name); |
353 | // mode = buf.st_mode; | 365 | // mode = buf.st_mode; |
354 | fileL.sprintf("%s", mydirent->d_name); | 366 | fileL.sprintf("%s", mydirent->d_name); |
355 | // fileS.sprintf("%d, %d", ); //this isn't correct | 367 | // fileS.sprintf("%d, %d", ); //this isn't correct |
356 | devT = buf.st_dev; | 368 | devT = buf.st_dev; |
357 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 369 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
358 | // fileS.sprintf("%d,%d", devT, devT); | 370 | // fileS.sprintf("%d,%d", devT, devT); |
359 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 371 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
360 | if( fileL.find(".") == -1 ){ | 372 | if( fileL.find(".") == -1 ){ |
361 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 373 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); |
362 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 374 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
363 | item->setPixmap( 0,pm); | 375 | item->setPixmap( 0,pm); |
364 | } | 376 | } |
365 | } | 377 | } |
366 | 378 | ||
@@ -378,99 +390,104 @@ void AdvancedFm::populateRemoteView() | |||
378 | // QListViewItemIterator it( Remote_View ); | 390 | // QListViewItemIterator it( Remote_View ); |
379 | // for ( ; it.current(); ++it ) { | 391 | // for ( ; it.current(); ++it ) { |
380 | // if ( it.current()->isSelected() ) { | 392 | // if ( it.current()->isSelected() ) { |
381 | // QString strItem = it.current()->text(0); | 393 | // QString strItem = it.current()->text(0); |
382 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; | 394 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; |
383 | // QFileInfo fi(localFile); | 395 | // QFileInfo fi(localFile); |
384 | // } | 396 | // } |
385 | // } | 397 | // } |
386 | QPixmap pm; | 398 | QPixmap pm; |
387 | Remote_View->clear(); | 399 | Remote_View->clear(); |
388 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 400 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
389 | currentRemoteDir.setMatchAllDirs(TRUE); | 401 | currentRemoteDir.setMatchAllDirs(TRUE); |
390 | currentRemoteDir.setNameFilter(filterStr); | 402 | currentRemoteDir.setNameFilter(filterStr); |
391 | QString fileL, fileS, fileDate; | 403 | QString fileL, fileS, fileDate; |
392 | bool isDir=FALSE; | 404 | bool isDir=FALSE; |
393 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 405 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
394 | QFileInfoListIterator it(*list); | 406 | QFileInfoListIterator it(*list); |
395 | QFileInfo *fi; | 407 | QFileInfo *fi; |
396 | while ( (fi=it.current()) ) { | 408 | while ( (fi=it.current()) ) { |
397 | if (fi->isSymLink() ){ | 409 | if (fi->isSymLink() ){ |
398 | QString symLink=fi->readLink(); | 410 | QString symLink=fi->readLink(); |
399 | // qDebug("Symlink detected "+symLink); | 411 | // qDebug("Symlink detected "+symLink); |
400 | QFileInfo sym( symLink); | 412 | QFileInfo sym( symLink); |
401 | fileS.sprintf( "%10li", sym.size() ); | 413 | fileS.sprintf( "%10li", sym.size() ); |
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; |
453 | DIR *dir; | 470 | DIR *dir; |
454 | int fd = 0; | 471 | int fd = 0; |
455 | struct dirent *mydirent; | 472 | struct dirent *mydirent; |
456 | int i = 1; | 473 | int i = 1; |
457 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 474 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
458 | while ((mydirent = readdir(dir)) != NULL) { | 475 | while ((mydirent = readdir(dir)) != NULL) { |
459 | lstat( mydirent->d_name, &buf); | 476 | lstat( mydirent->d_name, &buf); |
460 | qDebug(mydirent->d_name); | 477 | qDebug(mydirent->d_name); |
461 | // mode = buf.st_mode; | 478 | // mode = buf.st_mode; |
462 | fileL.sprintf("%s", mydirent->d_name); | 479 | fileL.sprintf("%s", mydirent->d_name); |
463 | // fileS.sprintf("%d, %d", ); //this isn't correct | 480 | // fileS.sprintf("%d, %d", ); //this isn't correct |
464 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 481 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
465 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 482 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
466 | if( fileL.find(".") == -1 ){ | 483 | if( fileL.find(".") == -1 ){ |
467 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 484 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
468 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 485 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
469 | item->setPixmap( 0,pm); | 486 | item->setPixmap( 0,pm); |
470 | } | 487 | } |
471 | } | 488 | } |
472 | 489 | ||
473 | closedir(dir); | 490 | closedir(dir); |
474 | } | 491 | } |
475 | 492 | ||
476 | Remote_View->setSorting( 3,FALSE); | 493 | Remote_View->setSorting( 3,FALSE); |
@@ -653,114 +670,126 @@ void AdvancedFm::showLocalMenu(QListViewItem * item) | |||
653 | m.setCheckable(TRUE); | 670 | m.setCheckable(TRUE); |
654 | if (!b) | 671 | if (!b) |
655 | m.setItemChecked(m.idAt(0),TRUE); | 672 | m.setItemChecked(m.idAt(0),TRUE); |
656 | else | 673 | else |
657 | m.setItemChecked(m.idAt(0),FALSE); | 674 | m.setItemChecked(m.idAt(0),FALSE); |
658 | m.exec( QCursor::pos() ); | 675 | m.exec( QCursor::pos() ); |
659 | } | 676 | } |
660 | } | 677 | } |
661 | 678 | ||
662 | void AdvancedFm::showRemoteMenu(QListViewItem * item) | 679 | void AdvancedFm::showRemoteMenu(QListViewItem * item) |
663 | { | 680 | { |
664 | if(item) { | 681 | if(item) { |
665 | QPopupMenu m; | 682 | QPopupMenu m; |
666 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | 683 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); |
667 | m.insertSeparator(); | 684 | m.insertSeparator(); |
668 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 685 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
669 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 686 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
670 | else | 687 | else |
671 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 688 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
672 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 689 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
673 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 690 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
674 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 691 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
675 | m.insertSeparator(); | 692 | m.insertSeparator(); |
676 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 693 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
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); |
743 | fileDlg->exec(); | 772 | fileDlg->exec(); |
744 | if( fileDlg->result() == 1 ) { | 773 | if( fileDlg->result() == 1 ) { |
745 | QString filename = fileDlg->LineEdit1->text(); | 774 | QString filename = fileDlg->LineEdit1->text(); |
746 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 775 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
747 | } | 776 | } |
748 | populateLocalView(); | 777 | populateLocalView(); |
749 | } | 778 | } |
750 | 779 | ||
751 | void AdvancedFm::remoteMakDir() | 780 | void AdvancedFm::remoteMakDir() |
752 | { | 781 | { |
753 | InputDialog *fileDlg; | 782 | InputDialog *fileDlg; |
754 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 783 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
755 | fileDlg->exec(); | 784 | fileDlg->exec(); |
756 | if( fileDlg->result() == 1 ) { | 785 | if( fileDlg->result() == 1 ) { |
757 | QString filename = fileDlg->LineEdit1->text(); | 786 | QString filename = fileDlg->LineEdit1->text(); |
758 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 787 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
759 | } | 788 | } |
760 | populateRemoteView(); | 789 | populateRemoteView(); |
761 | } | 790 | } |
762 | 791 | ||
763 | void AdvancedFm::localDelete() | 792 | void AdvancedFm::localDelete() |
764 | { | 793 | { |
765 | QStringList curFileList = getPath(); | 794 | QStringList curFileList = getPath(); |
766 | QString myFile; | 795 | QString myFile; |
@@ -1433,48 +1462,62 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | |||
1433 | break; | 1462 | break; |
1434 | case Key_3: | 1463 | case Key_3: |
1435 | CFButtonPushed(); | 1464 | CFButtonPushed(); |
1436 | break; | 1465 | break; |
1437 | case Key_4: | 1466 | case Key_4: |
1438 | SDButtonPushed(); | 1467 | SDButtonPushed(); |
1439 | break; | 1468 | break; |
1440 | case Key_5: | 1469 | case Key_5: |
1441 | homeButtonPushed(); | 1470 | homeButtonPushed(); |
1442 | break; | 1471 | break; |
1443 | case Key_6: | 1472 | case Key_6: |
1444 | docButtonPushed(); | 1473 | docButtonPushed(); |
1445 | break; | 1474 | break; |
1446 | case Key_7: | 1475 | case Key_7: |
1447 | break; | 1476 | break; |
1448 | case Key_8: | 1477 | case Key_8: |
1449 | break; | 1478 | break; |
1450 | case Key_9: | 1479 | case Key_9: |
1451 | break; | 1480 | break; |
1452 | case Key_0: | 1481 | case Key_0: |
1453 | break; | 1482 | break; |
1454 | 1483 | ||
1455 | 1484 | ||
1456 | 1485 | ||
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 | |||
@@ -7,117 +7,118 @@ | |||
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 | #ifndef ADVANCEDFM_H | 12 | #ifndef ADVANCEDFM_H |
13 | #define ADVANCEDFM_H | 13 | #define ADVANCEDFM_H |
14 | 14 | ||
15 | #include <qvariant.h> | 15 | #include <qvariant.h> |
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | #include <qmainwindow.h> | 17 | #include <qmainwindow.h> |
18 | #include <qdir.h> | 18 | #include <qdir.h> |
19 | #include <qstring.h> | 19 | #include <qstring.h> |
20 | #include <qpoint.h> | 20 | #include <qpoint.h> |
21 | #include <qstringlist.h> | 21 | #include <qstringlist.h> |
22 | 22 | ||
23 | class QVBoxLayout; | 23 | class QVBoxLayout; |
24 | class QHBoxLayout; | 24 | class QHBoxLayout; |
25 | class QGridLayout; | 25 | class QGridLayout; |
26 | class QComboBox; | 26 | class QComboBox; |
27 | class QListView; | 27 | class QListView; |
28 | class QListviewItem; | 28 | class QListviewItem; |
29 | class QLabel; | 29 | class QLabel; |
30 | class QProgressBar; | 30 | 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); |
80 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); | 80 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); |
81 | void localMakDir(); | 81 | void localMakDir(); |
82 | void localDelete(); | 82 | void localDelete(); |
83 | void remoteMakDir(); | 83 | void remoteMakDir(); |
84 | void remoteDelete(); | 84 | void remoteDelete(); |
85 | /* bool remoteDirList(const QString &); */ | 85 | /* bool remoteDirList(const QString &); */ |
86 | /* bool remoteChDir(const QString &); */ | 86 | /* bool remoteChDir(const QString &); */ |
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 |