-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 44 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.pro | 20 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 55 | ||||
-rw-r--r-- | noncore/apps/advancedfm/filePermissions.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/output.cpp | 23 |
6 files changed, 73 insertions, 83 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index a60d6ce..a47edd8 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -68,13 +68,13 @@ void AdvancedFm::cleanUp() { QFile file( sfile); if(file.exists()) file.remove(); } void AdvancedFm::tabChanged(QWidget *) { -// qWarning("tab changed"); +// owarn << "tab changed" << oendl; QString path = CurrentDir()->canonicalPath(); currentPathCombo->lineEdit()->setText( path ); if(whichTab == 1) { viewMenu->setItemChecked(viewMenu->idAt(0), true); viewMenu->setItemChecked(viewMenu->idAt(1), false); @@ -90,19 +90,19 @@ void AdvancedFm::tabChanged(QWidget *) { chdir( path.latin1()); } void AdvancedFm::populateView() { -// qWarning("PopulateView"); +// owarn << "PopulateView" << oendl; QPixmap pm; QListView *thisView = CurrentView(); QDir *thisDir = CurrentDir(); QString path = thisDir->canonicalPath(); -//qWarning("path is "+path); +//owarn << "path is "+path << oendl; thisView->clear(); thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); thisDir->setMatchAllDirs(TRUE); thisDir->setNameFilter(filterStr); QString fileL, fileS, fileDate; QString fs= getFileSystemType((const QString &) path); @@ -157,13 +157,13 @@ void AdvancedFm::populateView() { pm=mt.pixmap(); //sets the correct pixmap for mimetype if(pm.isNull()) { pm = unknownXpm; } } if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { - // qDebug(" overlay link image"); + // odebug << " overlay link image" << oendl; pm= Resource::loadPixmap( "advancedfm/symlink" ); // pm= Resource::loadPixmap( "folder" ); // QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); // QPainter painter( &pm ); // painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); // pm.setMask( pm.createHeuristicMask( FALSE ) ); @@ -181,13 +181,13 @@ void AdvancedFm::populateView() { DIR *dir; struct dirent *mydirent; if((dir = opendir( path.latin1())) != NULL) while ((mydirent = readdir(dir)) != NULL) { lstat( mydirent->d_name, &buf); -// qDebug(mydirent->d_name); +// odebug << mydirent->d_name << oendl; fileL.sprintf("%s", mydirent->d_name); devT = buf.st_dev; fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); fileDate.sprintf("%s", ctime( &buf.st_mtime)); if( fileL.find(".") == -1 ) { item= new QListViewItem( thisView, fileL, fileS, fileDate); @@ -206,26 +206,26 @@ void AdvancedFm::populateView() { void AdvancedFm::rePopulate() { populateView(); setOtherTabCurrent(); populateView(); // int tmpTab = whichTab; -// // qDebug("%d", tmpTab); +// // odebug << "" << tmpTab << "" << oendl; // for(int i =1; i < 3; i++) { // TabWidget->setCurrentWidget(i - 1); // populateView(); // } // TabWidget->setCurrentWidget( tmpTab - 1); } void AdvancedFm::ListClicked(QListViewItem *selectedItem) { -//qWarning("listclicked"); +//owarn << "listclicked" << oendl; if(selectedItem) { QString strItem=selectedItem->text(0); -// qWarning(strItem); +// owarn << strItem << oendl; QString strSize=selectedItem->text(1); strSize=strSize.stripWhiteSpace(); bool isDirectory = false; QString strItem2; if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink @@ -264,19 +264,19 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in break; }; } void AdvancedFm::switchToLocalTab() { -//qWarning("switch to local view"); +//owarn << "switch to local view" << oendl; TabWidget->setCurrentWidget(0); Local_View->setFocus(); } void AdvancedFm::switchToRemoteTab() { -//qWarning("switch to local view"); +//owarn << "switch to local view" << oendl; TabWidget->setCurrentWidget(1); Remote_View->setFocus(); } void AdvancedFm::readConfig() { Config cfg("AdvancedFm"); @@ -326,13 +326,13 @@ QStringList AdvancedFm::getPath() { QListView *thisView=CurrentView(); QList<QListViewItem> * getSelectedItems( QListView * thisView ); QListViewItemIterator it( thisView ); for ( ; it.current(); ++it ) { if ( it.current()->isSelected() ) { strList << it.current()->text(0); -// qDebug(it.current()->text(0)); +// odebug << it.current()->text(0) << oendl; } } return strList; } void AdvancedFm::homeButtonPushed() { @@ -377,13 +377,13 @@ void AdvancedFm::doAbout() { "is copyright 2002-2003 by\n" "L.J.Potter<llornkcor@handhelds.org>\n" "and is licensed by the GPL")); } void AdvancedFm::keyPressEvent( QKeyEvent *e) { -// qWarning("key %d", e->key()); +// owarn << "key " << e->key() << "" << oendl; // if( CurrentView()->hasFocus() ) { switch ( e->key() ) { case Key_Left: upDir(); break; @@ -635,13 +635,13 @@ void AdvancedFm::addToDocs() { QDir *thisDir = CurrentDir(); if( strListPaths.count() > 0) { QString curFile; for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { curFile = thisDir->canonicalPath()+"/"+(*it); -// qDebug(curFile); +// odebug << curFile << oendl; QFileInfo fi(curFile); DocLnk f; // curFile.replace(QRegExp("\\..*"),""); f.setName(fi.baseName() ); f.setFile( curFile); f.writeLink(); @@ -708,13 +708,13 @@ void AdvancedFm::addCustomDir() { cfg.writeEntry("CustomDir", list, ','); cfg.write(); } void AdvancedFm::removeCustomDir() { -// qDebug("remove custom dir"); +// odebug << "remove custom dir" << oendl; Config cfg("AdvancedFm"); cfg.setGroup("Menu"); QString dir; QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); QStringList list2; dir = CurrentDir()->canonicalPath(); @@ -743,13 +743,13 @@ void AdvancedFm::removeCustomDir() { } // customDirsToMenu(); } void AdvancedFm::gotoCustomDir(const QString &dir) { -// qDebug("gotoCustomDir(const QString &dir) " +dir ); +// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; // QString curDir = dir; // QDir *thisDir = CurrentDir(); // if( curDir.isEmpty()) { // } if( dir == s_addBookmark) { addCustomDir(); @@ -784,56 +784,56 @@ QDir *AdvancedFm::OtherDir() { return ¤tDir; } } QListView * AdvancedFm::CurrentView() { if ( whichTab == 1) { -// qWarning("CurrentView Tab 1"); +// owarn << "CurrentView Tab 1" << oendl; return Local_View; } else { -// qWarning("CurrentView Tab 2"); +// owarn << "CurrentView Tab 2" << oendl; return Remote_View; } } QListView * AdvancedFm::OtherView() { if ( whichTab == 1) return Remote_View; else return Local_View; } void AdvancedFm::setOtherTabCurrent() { -// qWarning("setOtherTabCurrent() %d", whichTab); +// owarn << "setOtherTabCurrent() " << whichTab << "" << oendl; if ( whichTab == 1) { TabWidget->setCurrentWidget(1); } else { TabWidget->setCurrentWidget(0); } OtherView()->setFocus(); OtherView()->setSelected( CurrentView()->firstChild(), true); } void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { -// qDebug("qcop message "+msg ); +// odebug << "qcop message "+msg << oendl; QDataStream stream ( data, IO_ReadOnly ); if ( msg == "openDirectory(QString)" ) { -// qDebug("received"); +// odebug << "received" << oendl; QString file; stream >> file; gotoDirectory( (const QString &) file); } } void AdvancedFm::setDocument(const QString &file) { gotoDirectory( file); } void AdvancedFm::gotoDirectory(const QString &file) { -// qWarning("goto dir "+file); +// owarn << "goto dir "+file << oendl; QString curDir = file; QDir *thisDir = CurrentDir(); if(QDir( curDir).exists() ) { thisDir->setPath( curDir ); chdir( curDir.latin1() ); thisDir->cd( curDir, TRUE); @@ -863,13 +863,13 @@ void AdvancedFm::findFile(const QString &fileName) { thisView->ensureItemVisible(it.current()); } } } void AdvancedFm::slotSwitchMenu(int ) { -// qDebug("Switch %d", item); +// odebug << "Switch " << item << "" << oendl; // viewMenu->setItemChecked(item, true); } void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) { tabChanged( w); if( w == Local_View) { diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index 716343d..f1c518e 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro @@ -1,35 +1,15 @@ TEMPLATE = app CONFIG += qt warn_on quick-app -# CONFIG += qt warn_on HEADERS = advancedfm.h filePermissions.h output.h SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp TARGET = advancedfm INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -lopieui2 -TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ - ../../../i18n/nl/advancedfm.ts \ - ../../../i18n/da/advancedfm.ts \ - ../../../i18n/xx/advancedfm.ts \ - ../../../i18n/en/advancedfm.ts \ - ../../../i18n/es/advancedfm.ts \ - ../../../i18n/fr/advancedfm.ts \ - ../../../i18n/hu/advancedfm.ts \ - ../../../i18n/ja/advancedfm.ts \ - ../../../i18n/ko/advancedfm.ts \ - ../../../i18n/no/advancedfm.ts \ - ../../../i18n/pl/advancedfm.ts \ - ../../../i18n/pt/advancedfm.ts \ - ../../../i18n/pt_BR/advancedfm.ts \ - ../../../i18n/sl/advancedfm.ts \ - ../../../i18n/zh_CN/advancedfm.ts \ - ../../../i18n/zh_TW/advancedfm.ts - - !contains(CONFIG,quick-app) { DESTDIR = $(OPIEDIR)/bin DEFINES += NOQUICKLAUNCH } include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 2997c55..29335f8 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp @@ -8,29 +8,33 @@ * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #include "advancedfm.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/storage.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/menubutton.h> +using namespace Opie::Core; +using namespace Opie::Ui; +/* QT */ #include <qlayout.h> #include <qhbox.h> #include <qmenubar.h> #include <qcombobox.h> #include <qtoolbutton.h> #include <qlineedit.h> #include <qlistview.h> +/* STD */ #include <sys/utsname.h> - -using namespace Opie::Ui; void AdvancedFm::init() { b = false; setCaption( tr( "AdvancedFm" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); layout->setSpacing( 2); @@ -216,17 +220,17 @@ void AdvancedFm::init() { zaurusDevice=TRUE; else zaurusDevice=FALSE; if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { - qDebug("not have sd"); + odebug << "not have sd" << oendl; sdButton->hide(); } if( !StorageInfo::hasCf() ) { - qDebug("not have cf"); + odebug << "not have cf" << oendl; cfButton->hide(); } currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); currentDir.setPath( QDir::currentDirPath()); currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 81a4318..d34f330 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -6,45 +6,48 @@ email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
+ #include "advancedfm.h"
#include "output.h"
#include "filePermissions.h"
+/* OPIE */ +#include <opie2/odebug.h> #include <qpe/lnkproperties.h>
#include <qpe/qpeapplication.h>
#include <qpe/applnk.h>
+using namespace Opie::Core; -#include <qmessagebox.h>
-
+/* QT*/ +#include <qmessagebox.h> #include <qpopupmenu.h>
#include <qlistview.h>
+/* STD */ + #include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#include <sys/sendfile.h>
#include <fcntl.h>
-
-using namespace Opie::Core;
-using namespace Opie::Core;
void AdvancedFm::doDirChange() {
QString pathItem = CurrentView()->currentItem()->text(0);
if( pathItem == "../") {
ListClicked( CurrentView()->currentItem());
} else {
if( pathItem.find(" -> ",0,TRUE) != -1)
pathItem = dealWithSymName((const QString&)pathItem)+"/";
-// qWarning(pathItem);
+// owarn << pathItem << oendl; gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
}
}
void AdvancedFm::showMenuHidden() {
if (b) {
@@ -89,25 +92,25 @@ void AdvancedFm::runThis() { curFile = dealWithSymName((const QString&)curFile);
if(curFile != "../") {
fs = getFileSystemType((const QString &) path);
QFileInfo fileInfo( path + "/" + curFile);
-// qDebug( fileInfo.owner());
+// odebug << fileInfo.owner() << oendl; if( (fileInfo.permission( QFileInfo::ExeUser)
| fileInfo.permission( QFileInfo::ExeGroup)
| fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
| fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
QCopEnvelope e("QPE/System", "execute(QString)" );
e << curFile;
} else {
curFile = path + "/" + curFile;
DocLnk nf(curFile);
QString execStr = nf.exec();
-// qDebug( execStr);
+// odebug << execStr << oendl; if( execStr.isEmpty() ) {
} else {
nf.execute();
}
}
}
@@ -199,18 +202,18 @@ void AdvancedFm::doDelete() { }
QString cmd="rm "+f;
QFile file(f);
QFileInfo fi(myFile);
if( fi.fileName().find("../",0,TRUE)==-1) {
-// qDebug("remove link files "+myFile);
+// odebug << "remove link files "+myFile << oendl; // DocLnk lnk(f);
DocLnk *lnk;
lnk = new DocLnk(f);
-// qDebug("Deleting doclnk " + lnk->linkFile());
+// odebug << "Deleting doclnk " + lnk->linkFile() << oendl; if(lnk->isValid())
lnk->removeLinkFile();
// delete lnk;
file.remove();
}
}
@@ -240,16 +243,16 @@ void AdvancedFm::doProperties() { QStringList curFileList = getPath();
QString filePath;
filePath = CurrentDir()->canonicalPath()+"/";
-// qDebug("%d",curFileList.count());
+// odebug << "" << curFileList.count() << "" << oendl; for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
-// qDebug((filePath+*it));
+// odebug << (filePath+*it) << oendl; DocLnk lnk( (filePath+*it));
LnkProperties prop( &lnk );
QPEApplication::execDialog( &prop );
}
#endif
@@ -299,14 +302,14 @@ void AdvancedFm::copy() { if(item.find("->",0,TRUE)) //symlink
item = item.left(item.find("->",0,TRUE));
curFile = thisDir->canonicalPath()+"/"+ item;
destFile = thatDir->canonicalPath()+"/"+ item;
-// qDebug("Destination file is "+destFile);
-// qDebug("CurrentFile file is " + curFile);
+// odebug << "Destination file is "+destFile << oendl; +// odebug << "CurrentFile file is " + curFile << oendl; QFile f(destFile);
if( f.exists()) {
if(doMsg) {
switch ( QMessageBox::warning(this,tr("File Exists!"),
tr("%1 exists. Ok to overwrite?").arg( item ),
@@ -417,13 +420,13 @@ void AdvancedFm::copySameDir() { if(!copyFile( curFile,destFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
-// qDebug("copy "+curFile+" as "+destFile);
+// odebug << "copy "+curFile+" as "+destFile << oendl; }
delete fileDlg;
}
rePopulate();
}
@@ -440,19 +443,19 @@ void AdvancedFm::move() { item=(*it);
QString destFile = thatDir->canonicalPath();
if(destFile.right(1).find("/",0,TRUE) == -1)
destFile+="/";
destFile += item;
-// qDebug("Destination file is "+destFile);
+// odebug << "Destination file is "+destFile << oendl; curFile = thisDir->canonicalPath();
if(curFile.right(1).find("/",0,TRUE) == -1)
curFile +="/";
curFile+= item;
-// qDebug("CurrentFile file is " + curFile);
+// odebug << "CurrentFile file is " + curFile << oendl; if(QFileInfo(curFile).isDir()) {
moveDirectory( curFile, destFile );
rePopulate();
return;
}
@@ -486,13 +489,13 @@ bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { return true;
}
bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) {
QString cmd = "/bin/cp -fpR " + src + " " + dest;
- qWarning(cmd);
+ owarn << cmd << oendl; int err = system( (const char *) cmd );
if ( err != 0 ) {
QMessageBox::message("AdvancedFm",
tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) );
return false;
}
@@ -522,20 +525,20 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { int err=0;
int read_fd=0;
int write_fd=0;
struct stat stat_buf;
off_t offset = 0;
if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
-// qWarning("open failed");
+// owarn << "open failed" << oendl; return success = false;
}
read_fd = srcFile.handle();
if(read_fd != -1) {
fstat (read_fd, &stat_buf);
if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
-// qWarning("destfile open failed");
+// owarn << "destfile open failed" << oendl; return success = false;
}
write_fd = destFile.handle();
if(write_fd != -1) {
err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
if( err == -1) {
@@ -544,13 +547,13 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. ";
case EINVAL: msg = "Descriptor is not valid or locked. ";
case ENOMEM: msg = "Insufficient memory to read from in_fd.";
case EIO: msg = "Unspecified error while reading from in_fd.";
};
success = false;
-// qWarning(msg);
+// owarn << msg << oendl; }
} else {
success = false;
}
} else {
success = false;
@@ -576,13 +579,13 @@ void AdvancedFm::runCommand() { fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
fileDlg->setInputText(curFile);
fileDlg->exec();
//QString command;
if( fileDlg->result() == 1 ) {
-// qDebug(fileDlg->LineEdit1->text());
+// odebug << fileDlg->LineEdit1->text() << oendl; QStringList command;
command << "/bin/sh";
command << "-c";
command << fileDlg->LineEdit1->text();
Output *outDlg;
@@ -659,13 +662,13 @@ void AdvancedFm::mkSym() { if( curFile.right(1) == "/") {
curFile = curFile.left( curFile.length() -1);
}
cmd = "ln -s "+curFile+" "+destName;
-// qDebug(cmd);
+// odebug << cmd << oendl; startProcess( (const QString)cmd );
}
rePopulate();
setOtherTabCurrent();
}
}
@@ -712,21 +715,21 @@ void AdvancedFm::startProcess(const QString & cmd) { command << "/bin/sh";
command << "-c";
command << cmd.latin1();
*process << command;
if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
- qDebug("could not start process");
+ odebug << "could not start process" << oendl; }
void AdvancedFm::processEnded(OProcess *) {
rePopulate();
}
void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
-// qWarning("received stderrt %d bytes", buflen);
+// owarn << "received stderrt " << buflen << " bytes" << oendl; QString lineStr = buffer;
QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
}
bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
@@ -762,13 +765,13 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { return QWidget::eventFilter( o, e );
}
void AdvancedFm::cancelRename() {
-// qDebug("cancel rename");
+// odebug << "cancel rename" << oendl; QListView * view;
view = CurrentView();
bool resetFocus = view->viewport()->focusProxy() == renameBox;
delete renameBox;
renameBox = 0;
diff --git a/noncore/apps/advancedfm/filePermissions.cpp b/noncore/apps/advancedfm/filePermissions.cpp index 9698de7..b7d48e8 100644 --- a/noncore/apps/advancedfm/filePermissions.cpp +++ b/noncore/apps/advancedfm/filePermissions.cpp @@ -29,13 +29,13 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( tr("filePermissions") ); -// qDebug("FilePermissions "+fileName); +// odebug << "FilePermissions "+fileName << oendl; /* resize( 236, 210 ); setMaximumSize( QSize( 236, 210 ) ); */ setCaption( tr( "Set File Permissions" ) ); TextLabel1 = new QLabel( this, "TextLabel1" ); TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp index 6906298..8c585f4 100644 --- a/noncore/apps/advancedfm/output.cpp +++ b/noncore/apps/advancedfm/output.cpp @@ -2,25 +2,28 @@ ** outputEdit.cpp ** ** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> ****************************************************************************/ #include "output.h" +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> #include <qpe/applnk.h> +using namespace Opie::Core; +/* QT */ #include <qfile.h> #include <qmultilineedit.h> #include <qpushbutton.h> #include <qlayout.h> +/* STD */ #include <errno.h> /* XPM */ -using namespace Opie::Core; -using namespace Opie::Core; static char * filesave_xpm[] = { "16 16 78 1", " c None", ". c #343434", "+ c #A0A0A0", "@ c #565656", @@ -118,13 +121,13 @@ static char * filesave_xpm[] = { Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog( parent, name, modal, fl ) { QStringList cmmds; // cmmds=QStringList::split( " ", commands, false); cmmds=commands; -// qDebug("count %d", cmmds.count()); +// odebug << "count " << cmmds.count() << "" << oendl; if ( !name ) setName( tr("Output")); resize( 196, 269 ); setCaption( name ); OutputLayout = new QGridLayout( this ); @@ -154,13 +157,13 @@ Output::Output( const QStringList commands, QWidget* parent, const char* name, // connect( , SIGNAL(received(const QByteArray&)), // this, SLOT(commandStdin(const QByteArray&))); // * proc << commands.latin1(); for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) { - qDebug( "%s", (*it).latin1() ); + odebug << "" << (*it).latin1() << "" << oendl; * proc << (*it).latin1(); } if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { OutputEdit->append(tr("Process could not start") ); @@ -183,32 +186,32 @@ void Output::saveOutput() { if( fileDlg->result() == 1 ) { QString filename = QPEApplication::documentDir(); if(filename.right(1).find('/') == -1) filename+="/"; QString name = fileDlg->LineEdit1->text(); filename+="text/plain/"+name; - qDebug(filename); + odebug << filename << oendl; QFile f(filename); f.open( IO_WriteOnly); if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { DocLnk lnk; lnk.setName(name); //sets file name lnk.setFile(filename); //sets File property lnk.setType("text/plain"); if(!lnk.writeLink()) { - qDebug("Writing doclink did not work"); + odebug << "Writing doclink did not work" << oendl; } } else - qWarning("Could not write file"); + owarn << "Could not write file" << oendl; f.close(); } } void Output::commandStdout(OProcess*, char *buffer, int buflen) { - qWarning("received stdout %d bytes", buflen); + owarn << "received stdout " << buflen << " bytes" << oendl; // QByteArray data(buflen); // data.fill(*buffer, buflen); // for (uint i = 0; i < data.count(); i++ ) { // printf("%c", buffer[i] ); // } @@ -219,19 +222,19 @@ void Output::commandStdout(OProcess*, char *buffer, int buflen) { OutputEdit->append(lineStr); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); } void Output::commandStdin( const QByteArray &data) { - qWarning("received stdin %d bytes", data.size()); + owarn << "received stdin " << data.size() << " bytes" << oendl; // recieved data from the io layer goes to sz proc->writeStdin(data.data(), data.size()); } void Output::commandStderr(OProcess*, char *buffer, int buflen) { - qWarning("received stderrt %d bytes", buflen); + owarn << "received stderrt " << buflen << " bytes" << oendl; QString lineStr = buffer; // lineStr=lineStr.left(lineStr.length()-1); OutputEdit->append(lineStr); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); } |