-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 28 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/advancedfm/output.cpp | 18 |
4 files changed, 30 insertions, 30 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index c44d387..2ba3dca 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,149 +1,149 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #define DEVELOPERS_VERSION | 12 | #define DEVELOPERS_VERSION |
13 | #include "advancedfm.h" | 13 | #include "advancedfm.h" |
14 | 14 | ||
15 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
16 | #include <qpe/config.h> | 16 | #include <qpe/config.h> |
17 | #include <qpe/mimetype.h> | 17 | #include <qpe/mimetype.h> |
18 | #include <qpe/applnk.h> | 18 | #include <qpe/applnk.h> |
19 | #include <qpe/resource.h> | 19 | #include <qpe/resource.h> |
20 | #include <qpe/menubutton.h> | 20 | #include <qpe/menubutton.h> |
21 | 21 | ||
22 | #include <qcombobox.h> | 22 | #include <qcombobox.h> |
23 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
24 | #include <qlistview.h> | 24 | #include <qlistview.h> |
25 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
26 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
27 | 27 | ||
28 | 28 | ||
29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
30 | #include <time.h> | 30 | #include <time.h> |
31 | #include <dirent.h> | 31 | #include <dirent.h> |
32 | #include <fcntl.h> | 32 | #include <fcntl.h> |
33 | #include <sys/vfs.h> | 33 | #include <sys/vfs.h> |
34 | #include <mntent.h> | 34 | #include <mntent.h> |
35 | 35 | ||
36 | #ifdef NOQUICKLAUNCH | 36 | #ifdef NOQUICKLAUNCH |
37 | AdvancedFm::AdvancedFm( ) | 37 | AdvancedFm::AdvancedFm( ) |
38 | #else | 38 | #else |
39 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) | 39 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) |
40 | #endif | 40 | #endif |
41 | : QMainWindow( ) { | 41 | : QMainWindow( ) { |
42 | init(); | 42 | init(); |
43 | renameBox = 0; | 43 | renameBox = 0; |
44 | 44 | ||
45 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 45 | unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
46 | 46 | ||
47 | initConnections(); | 47 | initConnections(); |
48 | whichTab=1; | 48 | whichTab=1; |
49 | rePopulate(); | 49 | rePopulate(); |
50 | currentPathCombo->setFocus(); | 50 | currentPathCombo->setFocus(); |
51 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); | 51 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); |
52 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 52 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
53 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); | 53 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); |
54 | } | 54 | } |
55 | 55 | ||
56 | AdvancedFm::~AdvancedFm() { | 56 | AdvancedFm::~AdvancedFm() { |
57 | } | 57 | } |
58 | 58 | ||
59 | 59 | ||
60 | void AdvancedFm::cleanUp() { | 60 | void AdvancedFm::cleanUp() { |
61 | QString sfile=QDir::homeDirPath(); | 61 | QString sfile=QDir::homeDirPath(); |
62 | if(sfile.right(1) != "/") | 62 | if(sfile.right(1) != "/") |
63 | sfile+="/._temp"; | 63 | sfile+="/._temp"; |
64 | else | 64 | else |
65 | sfile+="._temp"; | 65 | sfile+="._temp"; |
66 | QFile file( sfile); | 66 | QFile file( sfile); |
67 | if(file.exists()) | 67 | if(file.exists()) |
68 | file.remove(); | 68 | file.remove(); |
69 | } | 69 | } |
70 | 70 | ||
71 | void AdvancedFm::tabChanged(QWidget *) { | 71 | void AdvancedFm::tabChanged(QWidget *) { |
72 | // qWarning("tab changed"); | 72 | // qWarning("tab changed"); |
73 | QString path = CurrentDir()->canonicalPath(); | 73 | QString path = CurrentDir()->canonicalPath(); |
74 | currentPathCombo->lineEdit()->setText( path ); | 74 | currentPathCombo->lineEdit()->setText( path ); |
75 | 75 | ||
76 | if(whichTab == 1) { | 76 | if(whichTab == 1) { |
77 | viewMenu->setItemChecked(viewMenu->idAt(0), true); | 77 | viewMenu->setItemChecked(viewMenu->idAt(0), true); |
78 | viewMenu->setItemChecked(viewMenu->idAt(1), false); | 78 | viewMenu->setItemChecked(viewMenu->idAt(1), false); |
79 | } else { | 79 | } else { |
80 | viewMenu->setItemChecked(viewMenu->idAt(0), false); | 80 | viewMenu->setItemChecked(viewMenu->idAt(0), false); |
81 | viewMenu->setItemChecked(viewMenu->idAt(1), true); | 81 | viewMenu->setItemChecked(viewMenu->idAt(1), true); |
82 | } | 82 | } |
83 | 83 | ||
84 | QString fs= getFileSystemType( (const QString &) path); | 84 | QString fs= getFileSystemType( (const QString &) path); |
85 | 85 | ||
86 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 86 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
87 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); | 87 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); |
88 | chdir( path.latin1()); | 88 | chdir( path.latin1()); |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | void AdvancedFm::populateView() { | 92 | void AdvancedFm::populateView() { |
93 | 93 | ||
94 | // qWarning("PopulateView"); | 94 | // qWarning("PopulateView"); |
95 | QPixmap pm; | 95 | QPixmap pm; |
96 | QListView *thisView = CurrentView(); | 96 | QListView *thisView = CurrentView(); |
97 | QDir *thisDir = CurrentDir(); | 97 | QDir *thisDir = CurrentDir(); |
98 | QString path = thisDir->canonicalPath(); | 98 | QString path = thisDir->canonicalPath(); |
99 | 99 | ||
100 | //qWarning("path is "+path); | 100 | //qWarning("path is "+path); |
101 | thisView->clear(); | 101 | thisView->clear(); |
102 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 102 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
103 | thisDir->setMatchAllDirs(TRUE); | 103 | thisDir->setMatchAllDirs(TRUE); |
104 | thisDir->setNameFilter(filterStr); | 104 | thisDir->setNameFilter(filterStr); |
105 | QString fileL, fileS, fileDate; | 105 | QString fileL, fileS, fileDate; |
106 | QString fs= getFileSystemType((const QString &) path); | 106 | QString fs= getFileSystemType((const QString &) path); |
107 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 107 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
108 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); | 108 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); |
109 | bool isDir=FALSE; | 109 | bool isDir=FALSE; |
110 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 110 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
111 | QFileInfoListIterator it(*list); | 111 | QFileInfoListIterator it(*list); |
112 | QFileInfo *fi; | 112 | QFileInfo *fi; |
113 | while ( (fi=it.current()) ) { | 113 | while ( (fi=it.current()) ) { |
114 | if (fi->isSymLink() ) { | 114 | if (fi->isSymLink() ) { |
115 | QString symLink=fi->readLink(); | 115 | QString symLink=fi->readLink(); |
116 | QFileInfo sym( symLink); | 116 | QFileInfo sym( symLink); |
117 | fileS.sprintf( "%10i", sym.size() ); | 117 | fileS.sprintf( "%10i", sym.size() ); |
118 | fileL = fi->fileName() +" -> " + sym.filePath().data(); | 118 | fileL = fi->fileName() +" -> " + sym.filePath().data(); |
119 | fileDate = sym.lastModified().toString(); | 119 | fileDate = sym.lastModified().toString(); |
120 | } else { | 120 | } else { |
121 | fileS.sprintf( "%10i", fi->size() ); | 121 | fileS.sprintf( "%10i", fi->size() ); |
122 | fileL = fi->fileName(); | 122 | fileL = fi->fileName(); |
123 | fileDate= fi->lastModified().toString(); | 123 | fileDate= fi->lastModified().toString(); |
124 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 124 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
125 | // if(fileL == "..") | 125 | // if(fileL == "..") |
126 | fileL += "/"; | 126 | fileL += "/"; |
127 | isDir=TRUE; | 127 | isDir=TRUE; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | QFileInfo fileInfo( path + "/" + fileL); | 130 | QFileInfo fileInfo( path + "/" + fileL); |
131 | 131 | ||
132 | if(fileL !="./" && fi->exists()) { | 132 | if(fileL !="./" && fi->exists()) { |
133 | item = new QListViewItem( thisView, fileL, fileS , fileDate); | 133 | item = new QListViewItem( thisView, fileL, fileS , fileDate); |
134 | 134 | ||
135 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 135 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
136 | 136 | ||
137 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 137 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
138 | pm = Resource::loadPixmap( "lockedfolder" ); | 138 | pm = Resource::loadPixmap( "lockedfolder" ); |
139 | else | 139 | else |
140 | pm= Resource::loadPixmap( "folder" ); | 140 | pm= Resource::loadPixmap( "folder" ); |
141 | } | 141 | } |
142 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 142 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
143 | pm = Resource::loadPixmap( "exec"); | 143 | pm = Resource::loadPixmap( "exec"); |
144 | } | 144 | } |
145 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 145 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
146 | | fileInfo.permission( QFileInfo::ExeGroup) | 146 | | fileInfo.permission( QFileInfo::ExeGroup) |
147 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 147 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
148 | pm = Resource::loadPixmap( "exec"); | 148 | pm = Resource::loadPixmap( "exec"); |
149 | } | 149 | } |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 763ae34..f791c77 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -160,127 +160,127 @@ void AdvancedFm::init() { | |||
160 | // TabWidget->insertTab( tab, tr("1")); | 160 | // TabWidget->insertTab( tab, tr("1")); |
161 | 161 | ||
162 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 162 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
163 | tabLayout_2 = new QGridLayout( tab_2 ); | 163 | tabLayout_2 = new QGridLayout( tab_2 ); |
164 | tabLayout_2->setSpacing( 2); | 164 | tabLayout_2->setSpacing( 2); |
165 | tabLayout_2->setMargin( 2); | 165 | tabLayout_2->setMargin( 2); |
166 | 166 | ||
167 | Remote_View = new QListView( tab_2, "Remote_View" ); | 167 | Remote_View = new QListView( tab_2, "Remote_View" ); |
168 | Remote_View->addColumn( tr("File"),130); | 168 | Remote_View->addColumn( tr("File"),130); |
169 | Remote_View->addColumn( tr("Size"),-1); | 169 | Remote_View->addColumn( tr("Size"),-1); |
170 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 170 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
171 | Remote_View->addColumn( tr("Date"),-1); | 171 | Remote_View->addColumn( tr("Date"),-1); |
172 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 172 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
173 | Remote_View->setAllColumnsShowFocus(TRUE); | 173 | Remote_View->setAllColumnsShowFocus(TRUE); |
174 | Remote_View->setMultiSelection( TRUE ); | 174 | Remote_View->setMultiSelection( TRUE ); |
175 | Remote_View->setSelectionMode(QListView::Extended); | 175 | Remote_View->setSelectionMode(QListView::Extended); |
176 | Remote_View->setFocusPolicy(StrongFocus); | 176 | Remote_View->setFocusPolicy(StrongFocus); |
177 | Remote_View->installEventFilter( this ); | 177 | Remote_View->installEventFilter( this ); |
178 | 178 | ||
179 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 179 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
180 | 180 | ||
181 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 181 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
182 | 182 | ||
183 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | 183 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); |
184 | TabWidget->setSizeChange( 370 ); | 184 | TabWidget->setSizeChange( 370 ); |
185 | // TabWidget->insertTab( tab_2, tr( "2")); | 185 | // TabWidget->insertTab( tab_2, tr( "2")); |
186 | 186 | ||
187 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 187 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
188 | tabLayout_3 = new QGridLayout( tab_3 ); | 188 | tabLayout_3 = new QGridLayout( tab_3 ); |
189 | tabLayout_3->setSpacing( 2); | 189 | tabLayout_3->setSpacing( 2); |
190 | tabLayout_3->setMargin( 2); | 190 | tabLayout_3->setMargin( 2); |
191 | 191 | ||
192 | 192 | ||
193 | // OFileDialog fileDialog; | 193 | // OFileDialog fileDialog; |
194 | // fileDialog; | 194 | // fileDialog; |
195 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 195 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
196 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 196 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
197 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 197 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
198 | 198 | ||
199 | QListView *fileTree; | 199 | QListView *fileTree; |
200 | fileTree = new QListView( tab_3, "tree" ); | 200 | fileTree = new QListView( tab_3, "tree" ); |
201 | 201 | ||
202 | 202 | ||
203 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 203 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
204 | 204 | ||
205 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 205 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
206 | */ | 206 | */ |
207 | 207 | ||
208 | /////////////// | 208 | /////////////// |
209 | 209 | ||
210 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 210 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
211 | zaurusDevice=TRUE; | 211 | zaurusDevice=TRUE; |
212 | else | 212 | else |
213 | zaurusDevice=FALSE; | 213 | zaurusDevice=FALSE; |
214 | 214 | ||
215 | 215 | ||
216 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { | 216 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { |
217 | qDebug("not have sd"); | 217 | qDebug("not have sd"); |
218 | sdButton->hide(); | 218 | sdButton->hide(); |
219 | } | 219 | } |
220 | if( !StorageInfo::hasCf() ) { | 220 | if( !StorageInfo::hasCf() ) { |
221 | qDebug("not have cf"); | 221 | qDebug("not have cf"); |
222 | cfButton->hide(); | 222 | cfButton->hide(); |
223 | } | 223 | } |
224 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 224 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
225 | currentDir.setPath( QDir::currentDirPath()); | 225 | currentDir.setPath( QDir::currentDirPath()); |
226 | 226 | ||
227 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 227 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
228 | currentRemoteDir.setPath( QDir::currentDirPath()); | 228 | currentRemoteDir.setPath( QDir::currentDirPath()); |
229 | 229 | ||
230 | // b = TRUE; | 230 | // b = TRUE; |
231 | 231 | ||
232 | filterStr="*"; | 232 | filterStr="*"; |
233 | b=FALSE; | 233 | b=FALSE; |
234 | showMenuHidden(); | 234 | showMenuHidden(); |
235 | TabWidget->setCurrentWidget(0); | 235 | TabWidget->setCurrentWidget(0); |
236 | 236 | ||
237 | } | 237 | } |
238 | 238 | ||
239 | void AdvancedFm::initConnections() | 239 | void AdvancedFm::initConnections() |
240 | { | 240 | { |
241 | 241 | ||
242 | connect( qApp,SIGNAL( aboutToQuit()), | 242 | connect( qApp,SIGNAL( aboutToQuit()), |
243 | this, SLOT( cleanUp()) ); | 243 | this, SLOT( cleanUp()) ); |
244 | connect( qpeDirButton ,SIGNAL(released()), | 244 | connect( qpeDirButton ,SIGNAL(released()), |
245 | this,SLOT( QPEButtonPushed()) ); | 245 | this,SLOT( QPEButtonPushed()) ); |
246 | connect( cfButton ,SIGNAL(released()), | 246 | connect( cfButton ,SIGNAL(released()), |
247 | this,SLOT( CFButtonPushed()) ); | 247 | this,SLOT( CFButtonPushed()) ); |
248 | connect( sdButton ,SIGNAL(released()), | 248 | connect( sdButton ,SIGNAL(released()), |
249 | this,SLOT( SDButtonPushed()) ); | 249 | this,SLOT( SDButtonPushed()) ); |
250 | connect( cdUpButton ,SIGNAL(released()), | 250 | connect( cdUpButton ,SIGNAL(released()), |
251 | this,SLOT( upDir()) ); | 251 | this,SLOT( upDir()) ); |
252 | connect( docButton,SIGNAL(released()), | 252 | connect( docButton,SIGNAL(released()), |
253 | this,SLOT( docButtonPushed()) ); | 253 | this,SLOT( docButtonPushed()) ); |
254 | connect( homeButton,SIGNAL(released()), | 254 | connect( homeButton,SIGNAL(released()), |
255 | this,SLOT( homeButtonPushed()) ); | 255 | this,SLOT( homeButtonPushed()) ); |
256 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 256 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), |
257 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 257 | this, SLOT( currentPathComboActivated(const QString&) ) ); |
258 | 258 | ||
259 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 259 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
260 | this,SLOT(currentPathComboChanged())); | 260 | this,SLOT(currentPathComboChanged())); |
261 | 261 | ||
262 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 262 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), |
263 | this,SLOT( ListClicked(QListViewItem *)) ); | 263 | this,SLOT( ListClicked(QListViewItem*)) ); |
264 | 264 | ||
265 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 265 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
266 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 266 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
267 | 267 | ||
268 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 268 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
269 | 269 | ||
270 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 270 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), |
271 | this,SLOT( ListClicked(QListViewItem *)) ); | 271 | this,SLOT( ListClicked(QListViewItem*)) ); |
272 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 272 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
273 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 273 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
274 | 274 | ||
275 | connect( TabWidget,SIGNAL(currentChanged(QWidget *)), | 275 | connect( TabWidget,SIGNAL(currentChanged(QWidget*)), |
276 | this,SLOT(tabChanged(QWidget*))); | 276 | this,SLOT(tabChanged(QWidget*))); |
277 | 277 | ||
278 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 278 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); |
279 | 279 | ||
280 | connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); | 280 | connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&))); |
281 | // connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); | 281 | // connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int))); |
282 | connect( viewMenu, SIGNAL( activated(int )), this, SLOT(slotSwitchMenu(int ))); | 282 | connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int))); |
283 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); | 283 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); |
284 | 284 | ||
285 | } | 285 | } |
286 | 286 | ||
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 9ad1146..9e740d0 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -588,218 +588,218 @@ void AdvancedFm::runCommand() { | |||
588 | QPEApplication::execDialog( outDlg ); | 588 | QPEApplication::execDialog( outDlg ); |
589 | qApp->processEvents(); | 589 | qApp->processEvents(); |
590 | 590 | ||
591 | } | 591 | } |
592 | } | 592 | } |
593 | 593 | ||
594 | void AdvancedFm::runCommandStd() { | 594 | void AdvancedFm::runCommandStd() { |
595 | if( !CurrentView()->currentItem()) return; | 595 | if( !CurrentView()->currentItem()) return; |
596 | QString curFile; | 596 | QString curFile; |
597 | QDir *thisDir = CurrentDir(); | 597 | QDir *thisDir = CurrentDir(); |
598 | QListView *thisView = CurrentView(); | 598 | QListView *thisView = CurrentView(); |
599 | if( thisView->currentItem()) | 599 | if( thisView->currentItem()) |
600 | curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); | 600 | curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); |
601 | 601 | ||
602 | InputDialog *fileDlg; | 602 | InputDialog *fileDlg; |
603 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 603 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
604 | fileDlg->setInputText(curFile); | 604 | fileDlg->setInputText(curFile); |
605 | fileDlg->exec(); | 605 | fileDlg->exec(); |
606 | 606 | ||
607 | if( fileDlg->result() == 1 ) { | 607 | if( fileDlg->result() == 1 ) { |
608 | qApp->processEvents(); | 608 | qApp->processEvents(); |
609 | startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); | 609 | startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); |
610 | } | 610 | } |
611 | } | 611 | } |
612 | 612 | ||
613 | void AdvancedFm::fileStatus() { | 613 | void AdvancedFm::fileStatus() { |
614 | if( !CurrentView()->currentItem()) return; | 614 | if( !CurrentView()->currentItem()) return; |
615 | QString curFile; | 615 | QString curFile; |
616 | curFile = CurrentView()->currentItem()->text(0); | 616 | curFile = CurrentView()->currentItem()->text(0); |
617 | 617 | ||
618 | QStringList command; | 618 | QStringList command; |
619 | command << "/bin/sh"; | 619 | command << "/bin/sh"; |
620 | command << "-c"; | 620 | command << "-c"; |
621 | command << "stat -l "+ curFile; | 621 | command << "stat -l "+ curFile; |
622 | 622 | ||
623 | Output *outDlg; | 623 | Output *outDlg; |
624 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); | 624 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); |
625 | QPEApplication::execDialog( outDlg ); | 625 | QPEApplication::execDialog( outDlg ); |
626 | qApp->processEvents(); | 626 | qApp->processEvents(); |
627 | } | 627 | } |
628 | 628 | ||
629 | 629 | ||
630 | void AdvancedFm::mkDir() { | 630 | void AdvancedFm::mkDir() { |
631 | makeDir(); | 631 | makeDir(); |
632 | } | 632 | } |
633 | 633 | ||
634 | void AdvancedFm::rn() { | 634 | void AdvancedFm::rn() { |
635 | renameIt(); | 635 | renameIt(); |
636 | } | 636 | } |
637 | 637 | ||
638 | void AdvancedFm::del() { | 638 | void AdvancedFm::del() { |
639 | doDelete(); | 639 | doDelete(); |
640 | } | 640 | } |
641 | 641 | ||
642 | void AdvancedFm::mkSym() { | 642 | void AdvancedFm::mkSym() { |
643 | QString cmd; | 643 | QString cmd; |
644 | QStringList curFileList = getPath(); | 644 | QStringList curFileList = getPath(); |
645 | if( curFileList.count() > 0) { | 645 | if( curFileList.count() > 0) { |
646 | QDir *thisDir = CurrentDir(); | 646 | QDir *thisDir = CurrentDir(); |
647 | QDir * thatDir = OtherDir(); | 647 | QDir * thatDir = OtherDir(); |
648 | 648 | ||
649 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 649 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
650 | 650 | ||
651 | QString destName = thatDir->canonicalPath()+"/"+(*it); | 651 | QString destName = thatDir->canonicalPath()+"/"+(*it); |
652 | if(destName.right(1) == "/") { | 652 | if(destName.right(1) == "/") { |
653 | destName = destName.left( destName.length() -1); | 653 | destName = destName.left( destName.length() -1); |
654 | } | 654 | } |
655 | 655 | ||
656 | QString curFile = thisDir->canonicalPath()+"/"+(*it); | 656 | QString curFile = thisDir->canonicalPath()+"/"+(*it); |
657 | 657 | ||
658 | if( curFile.right(1) == "/") { | 658 | if( curFile.right(1) == "/") { |
659 | curFile = curFile.left( curFile.length() -1); | 659 | curFile = curFile.left( curFile.length() -1); |
660 | } | 660 | } |
661 | 661 | ||
662 | cmd = "ln -s "+curFile+" "+destName; | 662 | cmd = "ln -s "+curFile+" "+destName; |
663 | // qDebug(cmd); | 663 | // qDebug(cmd); |
664 | startProcess( (const QString)cmd ); | 664 | startProcess( (const QString)cmd ); |
665 | } | 665 | } |
666 | rePopulate(); | 666 | rePopulate(); |
667 | setOtherTabCurrent(); | 667 | setOtherTabCurrent(); |
668 | } | 668 | } |
669 | } | 669 | } |
670 | 670 | ||
671 | void AdvancedFm::doBeam() { | 671 | void AdvancedFm::doBeam() { |
672 | Ir ir; | 672 | Ir ir; |
673 | if(!ir.supported()) { | 673 | if(!ir.supported()) { |
674 | } else { | 674 | } else { |
675 | QStringList curFileList = getPath(); | 675 | QStringList curFileList = getPath(); |
676 | if( curFileList.count() > 0) { | 676 | if( curFileList.count() > 0) { |
677 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 677 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
678 | QString curFile = (*it); | 678 | QString curFile = (*it); |
679 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; | 679 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; |
680 | if( curFilePath.right(1) == "/") { | 680 | if( curFilePath.right(1) == "/") { |
681 | curFilePath = curFilePath.left( curFilePath.length() -1); | 681 | curFilePath = curFilePath.left( curFilePath.length() -1); |
682 | } | 682 | } |
683 | Ir *file = new Ir(this, "IR"); | 683 | Ir *file = new Ir(this, "IR"); |
684 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 684 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); |
685 | file->send( curFilePath, curFile ); | 685 | file->send( curFilePath, curFile ); |
686 | } | 686 | } |
687 | } | 687 | } |
688 | } | 688 | } |
689 | } | 689 | } |
690 | 690 | ||
691 | void AdvancedFm::fileBeamFinished( Ir *) { | 691 | void AdvancedFm::fileBeamFinished( Ir *) { |
692 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 692 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
693 | } | 693 | } |
694 | 694 | ||
695 | void AdvancedFm::selectAll() { | 695 | void AdvancedFm::selectAll() { |
696 | QListView *thisView = CurrentView(); | 696 | QListView *thisView = CurrentView(); |
697 | thisView->selectAll(true); | 697 | thisView->selectAll(true); |
698 | thisView->setSelected( thisView->firstChild(),false); | 698 | thisView->setSelected( thisView->firstChild(),false); |
699 | } | 699 | } |
700 | 700 | ||
701 | void AdvancedFm::startProcess(const QString & cmd) { | 701 | void AdvancedFm::startProcess(const QString & cmd) { |
702 | QStringList command; | 702 | QStringList command; |
703 | OProcess *process; | 703 | OProcess *process; |
704 | process = new OProcess(); | 704 | process = new OProcess(); |
705 | connect(process, SIGNAL(processExited(OProcess *)), | 705 | connect(process, SIGNAL(processExited(OProcess*)), |
706 | this, SLOT( processEnded(OProcess *))); | 706 | this, SLOT( processEnded(OProcess*))); |
707 | 707 | ||
708 | connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), | 708 | connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)), |
709 | this, SLOT( oprocessStderr(OProcess *, char *, int))); | 709 | this, SLOT( oprocessStderr(OProcess*,char*,int))); |
710 | 710 | ||
711 | command << "/bin/sh"; | 711 | command << "/bin/sh"; |
712 | command << "-c"; | 712 | command << "-c"; |
713 | command << cmd.latin1(); | 713 | command << cmd.latin1(); |
714 | *process << command; | 714 | *process << command; |
715 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) | 715 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) |
716 | qDebug("could not start process"); | 716 | qDebug("could not start process"); |
717 | } | 717 | } |
718 | 718 | ||
719 | void AdvancedFm::processEnded(OProcess *) { | 719 | void AdvancedFm::processEnded(OProcess *) { |
720 | rePopulate(); | 720 | rePopulate(); |
721 | } | 721 | } |
722 | 722 | ||
723 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { | 723 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { |
724 | // qWarning("received stderrt %d bytes", buflen); | 724 | // qWarning("received stderrt %d bytes", buflen); |
725 | 725 | ||
726 | QString lineStr = buffer; | 726 | QString lineStr = buffer; |
727 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); | 727 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); |
728 | } | 728 | } |
729 | 729 | ||
730 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | 730 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { |
731 | if ( o->inherits( "QLineEdit" ) ) { | 731 | if ( o->inherits( "QLineEdit" ) ) { |
732 | if ( e->type() == QEvent::KeyPress ) { | 732 | if ( e->type() == QEvent::KeyPress ) { |
733 | QKeyEvent *ke = (QKeyEvent*)e; | 733 | QKeyEvent *ke = (QKeyEvent*)e; |
734 | if ( ke->key() == Key_Return || | 734 | if ( ke->key() == Key_Return || |
735 | ke->key() == Key_Enter ) { | 735 | ke->key() == Key_Enter ) { |
736 | okRename(); | 736 | okRename(); |
737 | return true; | 737 | return true; |
738 | } | 738 | } |
739 | else if ( ke->key() == Key_Escape ) { | 739 | else if ( ke->key() == Key_Escape ) { |
740 | cancelRename(); | 740 | cancelRename(); |
741 | return true; | 741 | return true; |
742 | } | 742 | } |
743 | } | 743 | } |
744 | else if ( e->type() == QEvent::FocusOut ) { | 744 | else if ( e->type() == QEvent::FocusOut ) { |
745 | cancelRename(); | 745 | cancelRename(); |
746 | return true; | 746 | return true; |
747 | } | 747 | } |
748 | } | 748 | } |
749 | if ( o->inherits( "QListView" ) ) { | 749 | if ( o->inherits( "QListView" ) ) { |
750 | if ( e->type() == QEvent::FocusIn ) { | 750 | if ( e->type() == QEvent::FocusIn ) { |
751 | if( o == Local_View) { //keep track of which view | 751 | if( o == Local_View) { //keep track of which view |
752 | whichTab=1; | 752 | whichTab=1; |
753 | } | 753 | } |
754 | else { | 754 | else { |
755 | whichTab=2; | 755 | whichTab=2; |
756 | } | 756 | } |
757 | } | 757 | } |
758 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection | 758 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection |
759 | } | 759 | } |
760 | 760 | ||
761 | return QWidget::eventFilter( o, e ); | 761 | return QWidget::eventFilter( o, e ); |
762 | } | 762 | } |
763 | 763 | ||
764 | 764 | ||
765 | void AdvancedFm::cancelRename() { | 765 | void AdvancedFm::cancelRename() { |
766 | // qDebug("cancel rename"); | 766 | // qDebug("cancel rename"); |
767 | QListView * view; | 767 | QListView * view; |
768 | view = CurrentView(); | 768 | view = CurrentView(); |
769 | 769 | ||
770 | bool resetFocus = view->viewport()->focusProxy() == renameBox; | 770 | bool resetFocus = view->viewport()->focusProxy() == renameBox; |
771 | delete renameBox; | 771 | delete renameBox; |
772 | renameBox = 0; | 772 | renameBox = 0; |
773 | if ( resetFocus ) { | 773 | if ( resetFocus ) { |
774 | view->viewport()->setFocusProxy( view); | 774 | view->viewport()->setFocusProxy( view); |
775 | view->setFocus(); | 775 | view->setFocus(); |
776 | } | 776 | } |
777 | } | 777 | } |
778 | 778 | ||
779 | void AdvancedFm::doRename(QListView * view) { | 779 | void AdvancedFm::doRename(QListView * view) { |
780 | if( !CurrentView()->currentItem()) return; | 780 | if( !CurrentView()->currentItem()) return; |
781 | 781 | ||
782 | QRect r = view->itemRect( view->currentItem( )); | 782 | QRect r = view->itemRect( view->currentItem( )); |
783 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); | 783 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); |
784 | r.setX( view->contentsX() ); | 784 | r.setX( view->contentsX() ); |
785 | 785 | ||
786 | if ( r.width() > view->visibleWidth() ) | 786 | if ( r.width() > view->visibleWidth() ) |
787 | r.setWidth( view->visibleWidth() ); | 787 | r.setWidth( view->visibleWidth() ); |
788 | 788 | ||
789 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); | 789 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); |
790 | renameBox->setFrame(true); | 790 | renameBox->setFrame(true); |
791 | 791 | ||
792 | renameBox->setText( view->currentItem()->text(0) ); | 792 | renameBox->setText( view->currentItem()->text(0) ); |
793 | 793 | ||
794 | renameBox->selectAll(); | 794 | renameBox->selectAll(); |
795 | renameBox->installEventFilter( this ); | 795 | renameBox->installEventFilter( this ); |
796 | 796 | ||
797 | view->addChild( renameBox, r.x(), r.y() ); | 797 | view->addChild( renameBox, r.x(), r.y() ); |
798 | 798 | ||
799 | renameBox->resize( r.size() ); | 799 | renameBox->resize( r.size() ); |
800 | 800 | ||
801 | view->viewport()->setFocusProxy( renameBox ); | 801 | view->viewport()->setFocusProxy( renameBox ); |
802 | 802 | ||
803 | renameBox->setFocus(); | 803 | renameBox->setFocus(); |
804 | renameBox->show(); | 804 | renameBox->show(); |
805 | } | 805 | } |
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp index 7dc2416..0bba1d8 100644 --- a/noncore/apps/advancedfm/output.cpp +++ b/noncore/apps/advancedfm/output.cpp | |||
@@ -48,229 +48,229 @@ static char * filesave_xpm[] = { | |||
48 | "} c #777777", | 48 | "} c #777777", |
49 | "| c #616161", | 49 | "| c #616161", |
50 | "1 c #3A3A3A", | 50 | "1 c #3A3A3A", |
51 | "2 c #BEBEBE", | 51 | "2 c #BEBEBE", |
52 | "3 c #2C2C2C", | 52 | "3 c #2C2C2C", |
53 | "4 c #7C7C7C", | 53 | "4 c #7C7C7C", |
54 | "5 c #F6F6F6", | 54 | "5 c #F6F6F6", |
55 | "6 c #FCFCFC", | 55 | "6 c #FCFCFC", |
56 | "7 c #6B6B6B", | 56 | "7 c #6B6B6B", |
57 | "8 c #959595", | 57 | "8 c #959595", |
58 | "9 c #4F4F4F", | 58 | "9 c #4F4F4F", |
59 | "0 c #808080", | 59 | "0 c #808080", |
60 | "a c #767676", | 60 | "a c #767676", |
61 | "b c #818181", | 61 | "b c #818181", |
62 | "c c #B8B8B8", | 62 | "c c #B8B8B8", |
63 | "d c #FBFBFB", | 63 | "d c #FBFBFB", |
64 | "e c #F9F9F9", | 64 | "e c #F9F9F9", |
65 | "f c #CCCCCC", | 65 | "f c #CCCCCC", |
66 | "g c #030303", | 66 | "g c #030303", |
67 | "h c #737373", | 67 | "h c #737373", |
68 | "i c #7A7A7A", | 68 | "i c #7A7A7A", |
69 | "j c #7E7E7E", | 69 | "j c #7E7E7E", |
70 | "k c #6A6A6A", | 70 | "k c #6A6A6A", |
71 | "l c #FAFAFA", | 71 | "l c #FAFAFA", |
72 | "m c #505050", | 72 | "m c #505050", |
73 | "n c #9D9D9D", | 73 | "n c #9D9D9D", |
74 | "o c #333333", | 74 | "o c #333333", |
75 | "p c #7B7B7B", | 75 | "p c #7B7B7B", |
76 | "q c #787878", | 76 | "q c #787878", |
77 | "r c #696969", | 77 | "r c #696969", |
78 | "s c #494949", | 78 | "s c #494949", |
79 | "t c #555555", | 79 | "t c #555555", |
80 | "u c #949494", | 80 | "u c #949494", |
81 | "v c #E6E6E6", | 81 | "v c #E6E6E6", |
82 | "w c #424242", | 82 | "w c #424242", |
83 | "x c #515151", | 83 | "x c #515151", |
84 | "y c #535353", | 84 | "y c #535353", |
85 | "z c #3E3E3E", | 85 | "z c #3E3E3E", |
86 | "A c #D4D4D4", | 86 | "A c #D4D4D4", |
87 | "B c #0C0C0C", | 87 | "B c #0C0C0C", |
88 | "C c #353535", | 88 | "C c #353535", |
89 | "D c #474747", | 89 | "D c #474747", |
90 | "E c #ECECEC", | 90 | "E c #ECECEC", |
91 | "F c #919191", | 91 | "F c #919191", |
92 | "G c #7D7D7D", | 92 | "G c #7D7D7D", |
93 | "H c #000000", | 93 | "H c #000000", |
94 | "I c #404040", | 94 | "I c #404040", |
95 | "J c #858585", | 95 | "J c #858585", |
96 | "K c #323232", | 96 | "K c #323232", |
97 | "L c #D0D0D0", | 97 | "L c #D0D0D0", |
98 | "M c #1C1C1C", | 98 | "M c #1C1C1C", |
99 | " ...+ ", | 99 | " ...+ ", |
100 | " @#$%&..+ ", | 100 | " @#$%&..+ ", |
101 | " .*=-;;>,..+ ", | 101 | " .*=-;;>,..+ ", |
102 | " ')!~;;;;;;{]..", | 102 | " ')!~;;;;;;{]..", |
103 | " ^/(-;;;;;;;_:<", | 103 | " ^/(-;;;;;;;_:<", |
104 | " [}|;;;;;;;{12$", | 104 | " [}|;;;;;;;{12$", |
105 | " #34-55;;;;678$+", | 105 | " #34-55;;;;678$+", |
106 | " 90ab=c;dd;e1fg ", | 106 | " 90ab=c;dd;e1fg ", |
107 | " [ahij((kbl0mn$ ", | 107 | " [ahij((kbl0mn$ ", |
108 | " op^q^^7r&]s/$+ ", | 108 | " op^q^^7r&]s/$+ ", |
109 | "@btu;vbwxy]zAB ", | 109 | "@btu;vbwxy]zAB ", |
110 | "CzDEvEv;;DssF$ ", | 110 | "CzDEvEv;;DssF$ ", |
111 | "G.H{E{E{IxsJ$+ ", | 111 | "G.H{E{E{IxsJ$+ ", |
112 | " +...vEKxzLM ", | 112 | " +...vEKxzLM ", |
113 | " +...z]n$ ", | 113 | " +...z]n$ ", |
114 | " +... "}; | 114 | " +... "}; |
115 | 115 | ||
116 | Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl) | 116 | Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl) |
117 | : QDialog( parent, name, modal, fl ) | 117 | : QDialog( parent, name, modal, fl ) |
118 | { | 118 | { |
119 | QStringList cmmds; | 119 | QStringList cmmds; |
120 | // cmmds=QStringList::split( " ", commands, false); | 120 | // cmmds=QStringList::split( " ", commands, false); |
121 | cmmds=commands; | 121 | cmmds=commands; |
122 | // qDebug("count %d", cmmds.count()); | 122 | // qDebug("count %d", cmmds.count()); |
123 | if ( !name ) | 123 | if ( !name ) |
124 | setName( tr("Output")); | 124 | setName( tr("Output")); |
125 | resize( 196, 269 ); | 125 | resize( 196, 269 ); |
126 | setCaption( name ); | 126 | setCaption( name ); |
127 | 127 | ||
128 | OutputLayout = new QGridLayout( this ); | 128 | OutputLayout = new QGridLayout( this ); |
129 | OutputLayout->setSpacing( 2); | 129 | OutputLayout->setSpacing( 2); |
130 | OutputLayout->setMargin( 2); | 130 | OutputLayout->setMargin( 2); |
131 | 131 | ||
132 | QPushButton *docButton; | 132 | QPushButton *docButton; |
133 | docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); | 133 | docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); |
134 | docButton->setFixedSize( QSize( 20, 20 ) ); | 134 | docButton->setFixedSize( QSize( 20, 20 ) ); |
135 | connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() )); | 135 | connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() )); |
136 | // docButton->setFlat(TRUE); | 136 | // docButton->setFlat(TRUE); |
137 | OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 ); | 137 | OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 ); |
138 | 138 | ||
139 | OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); | 139 | OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); |
140 | OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 ); | 140 | OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 ); |
141 | 141 | ||
142 | proc = new OProcess(); | 142 | proc = new OProcess(); |
143 | 143 | ||
144 | connect(proc, SIGNAL(processExited(OProcess *)), | 144 | connect(proc, SIGNAL(processExited(OProcess*)), |
145 | this, SLOT( processFinished())); | 145 | this, SLOT( processFinished())); |
146 | 146 | ||
147 | connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), | 147 | connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)), |
148 | this, SLOT(commandStdout(OProcess *, char *, int))); | 148 | this, SLOT(commandStdout(OProcess*,char*,int))); |
149 | 149 | ||
150 | connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), | 150 | connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)), |
151 | this, SLOT(commandStderr(OProcess *, char *, int))); | 151 | this, SLOT(commandStderr(OProcess*,char*,int))); |
152 | 152 | ||
153 | // connect( , SIGNAL(received(const QByteArray &)), | 153 | // connect( , SIGNAL(received(const QByteArray&)), |
154 | // this, SLOT(commandStdin(const QByteArray &))); | 154 | // this, SLOT(commandStdin(const QByteArray&))); |
155 | 155 | ||
156 | // * proc << commands.latin1(); | 156 | // * proc << commands.latin1(); |
157 | for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) { | 157 | for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) { |
158 | qDebug( "%s", (*it).latin1() ); | 158 | qDebug( "%s", (*it).latin1() ); |
159 | * proc << (*it).latin1(); | 159 | * proc << (*it).latin1(); |
160 | } | 160 | } |
161 | 161 | ||
162 | if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { | 162 | if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { |
163 | 163 | ||
164 | OutputEdit->append(tr("Process could not start") ); | 164 | OutputEdit->append(tr("Process could not start") ); |
165 | OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); | 165 | OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); |
166 | perror("Error: "); | 166 | perror("Error: "); |
167 | QString errorMsg=tr("Error\n")+(QString)strerror(errno); | 167 | QString errorMsg=tr("Error\n")+(QString)strerror(errno); |
168 | OutputEdit->append( errorMsg); | 168 | OutputEdit->append( errorMsg); |
169 | OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); | 169 | OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | Output::~Output() { | 173 | Output::~Output() { |
174 | } | 174 | } |
175 | 175 | ||
176 | void Output::saveOutput() { | 176 | void Output::saveOutput() { |
177 | 177 | ||
178 | InputDialog *fileDlg; | 178 | InputDialog *fileDlg; |
179 | fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); | 179 | fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); |
180 | fileDlg->exec(); | 180 | fileDlg->exec(); |
181 | if( fileDlg->result() == 1 ) { | 181 | if( fileDlg->result() == 1 ) { |
182 | QString filename = QPEApplication::documentDir(); | 182 | QString filename = QPEApplication::documentDir(); |
183 | if(filename.right(1).find('/') == -1) | 183 | if(filename.right(1).find('/') == -1) |
184 | filename+="/"; | 184 | filename+="/"; |
185 | QString name = fileDlg->LineEdit1->text(); | 185 | QString name = fileDlg->LineEdit1->text(); |
186 | filename+="text/plain/"+name; | 186 | filename+="text/plain/"+name; |
187 | qDebug(filename); | 187 | qDebug(filename); |
188 | 188 | ||
189 | QFile f(filename); | 189 | QFile f(filename); |
190 | f.open( IO_WriteOnly); | 190 | f.open( IO_WriteOnly); |
191 | if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { | 191 | if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { |
192 | DocLnk lnk; | 192 | DocLnk lnk; |
193 | lnk.setName(name); //sets file name | 193 | lnk.setName(name); //sets file name |
194 | lnk.setFile(filename); //sets File property | 194 | lnk.setFile(filename); //sets File property |
195 | lnk.setType("text/plain"); | 195 | lnk.setType("text/plain"); |
196 | if(!lnk.writeLink()) { | 196 | if(!lnk.writeLink()) { |
197 | qDebug("Writing doclink did not work"); | 197 | qDebug("Writing doclink did not work"); |
198 | } | 198 | } |
199 | } else | 199 | } else |
200 | qWarning("Could not write file"); | 200 | qWarning("Could not write file"); |
201 | f.close(); | 201 | f.close(); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | void Output::commandStdout(OProcess*, char *buffer, int buflen) { | 205 | void Output::commandStdout(OProcess*, char *buffer, int buflen) { |
206 | qWarning("received stdout %d bytes", buflen); | 206 | qWarning("received stdout %d bytes", buflen); |
207 | 207 | ||
208 | // QByteArray data(buflen); | 208 | // QByteArray data(buflen); |
209 | // data.fill(*buffer, buflen); | 209 | // data.fill(*buffer, buflen); |
210 | // for (uint i = 0; i < data.count(); i++ ) { | 210 | // for (uint i = 0; i < data.count(); i++ ) { |
211 | // printf("%c", buffer[i] ); | 211 | // printf("%c", buffer[i] ); |
212 | // } | 212 | // } |
213 | // printf("\n"); | 213 | // printf("\n"); |
214 | 214 | ||
215 | QString lineStr = buffer; | 215 | QString lineStr = buffer; |
216 | lineStr=lineStr.left(lineStr.length()-1); | 216 | lineStr=lineStr.left(lineStr.length()-1); |
217 | OutputEdit->append(lineStr); | 217 | OutputEdit->append(lineStr); |
218 | OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); | 218 | OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); |
219 | } | 219 | } |
220 | 220 | ||
221 | 221 | ||
222 | void Output::commandStdin( const QByteArray &data) { | 222 | void Output::commandStdin( const QByteArray &data) { |
223 | qWarning("received stdin %d bytes", data.size()); | 223 | qWarning("received stdin %d bytes", data.size()); |
224 | // recieved data from the io layer goes to sz | 224 | // recieved data from the io layer goes to sz |
225 | proc->writeStdin(data.data(), data.size()); | 225 | proc->writeStdin(data.data(), data.size()); |
226 | } | 226 | } |
227 | 227 | ||
228 | void Output::commandStderr(OProcess*, char *buffer, int buflen) { | 228 | void Output::commandStderr(OProcess*, char *buffer, int buflen) { |
229 | qWarning("received stderrt %d bytes", buflen); | 229 | qWarning("received stderrt %d bytes", buflen); |
230 | 230 | ||
231 | QString lineStr = buffer; | 231 | QString lineStr = buffer; |
232 | // lineStr=lineStr.left(lineStr.length()-1); | 232 | // lineStr=lineStr.left(lineStr.length()-1); |
233 | OutputEdit->append(lineStr); | 233 | OutputEdit->append(lineStr); |
234 | OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); | 234 | OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); |
235 | } | 235 | } |
236 | 236 | ||
237 | void Output::processFinished() { | 237 | void Output::processFinished() { |
238 | 238 | ||
239 | delete proc; | 239 | delete proc; |
240 | OutputEdit->append( tr("\nFinished\n") ); | 240 | OutputEdit->append( tr("\nFinished\n") ); |
241 | OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); | 241 | OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); |
242 | // close(); | 242 | // close(); |
243 | // disconnect( layer(), SIGNAL(received(const QByteArray &)), | 243 | // disconnect( layer(), SIGNAL(received(const QByteArray&)), |
244 | // this, SLOT(commandStdin(const QByteArray &))); | 244 | // this, SLOT(commandStdin(const QByteArray&))); |
245 | } | 245 | } |
246 | 246 | ||
247 | //============================== | 247 | //============================== |
248 | 248 | ||
249 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 249 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
250 | : QDialog( parent, name, modal, fl ) | 250 | : QDialog( parent, name, modal, fl ) |
251 | { | 251 | { |
252 | if ( !name ) | 252 | if ( !name ) |
253 | setName( "InputDialog" ); | 253 | setName( "InputDialog" ); |
254 | resize( 234, 50 ); | 254 | resize( 234, 50 ); |
255 | setMaximumSize( QSize( 240, 50 ) ); | 255 | setMaximumSize( QSize( 240, 50 ) ); |
256 | setCaption( tr(name ) ); | 256 | setCaption( tr(name ) ); |
257 | 257 | ||
258 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 258 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
259 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); | 259 | LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); |
260 | LineEdit1->setFocus(); | 260 | LineEdit1->setFocus(); |
261 | LineEdit1->setFocus(); | 261 | LineEdit1->setFocus(); |
262 | connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() )); | 262 | connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() )); |
263 | } | 263 | } |
264 | 264 | ||
265 | InputDialog::~InputDialog() { | 265 | InputDialog::~InputDialog() { |
266 | inputText = LineEdit1->text(); | 266 | inputText = LineEdit1->text(); |
267 | } | 267 | } |
268 | 268 | ||
269 | void InputDialog::setInputText(const QString &string) { | 269 | void InputDialog::setInputText(const QString &string) { |
270 | LineEdit1->setText( string); | 270 | LineEdit1->setText( string); |
271 | } | 271 | } |
272 | 272 | ||
273 | void InputDialog::returned() { | 273 | void InputDialog::returned() { |
274 | inputText = LineEdit1->text(); | 274 | inputText = LineEdit1->text(); |
275 | this->accept(); | 275 | this->accept(); |
276 | } | 276 | } |