-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 38 | ||||
-rw-r--r-- | noncore/apps/advancedfm/output.cpp | 2 |
2 files changed, 23 insertions, 17 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 23244a2..92804b2 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -26,149 +26,153 @@ #include <qpe/mimetype.h> #include <qpe/applnk.h> #include <qpe/ir.h> #include <qpe/resource.h> #include <qtabwidget.h> #include <qtextstream.h> #include <qpushbutton.h> #include <qdatetime.h> #include <qdir.h> #include <qfile.h> #include <qstring.h> #include <qcombobox.h> #include <qpopupmenu.h> #include <qlistview.h> #include <qmainwindow.h> #include <qlabel.h> #include <qprogressbar.h> #include <qspinbox.h> #include <qwidget.h> #include <qlayout.h> #include <qimage.h> #include <qpixmap.h> #include <qmessagebox.h> #include <qlineedit.h> #include <qregexp.h> #include <unistd.h> #include <stdlib.h> #include <sys/stat.h> #include <dirent.h> #include <stdio.h> #include <time.h> #include <fcntl.h> #include <mntent.h> #include <string.h> #include <errno.h> #include <sys/vfs.h> #include <mntent.h> #include <sys/utsname.h> AdvancedFm::AdvancedFm( ) : QMainWindow( ) { init(); initConnections(); populateLocalView(); populateRemoteView(); currentPathCombo->setFocus(); } AdvancedFm::~AdvancedFm() { } void AdvancedFm::cleanUp() { QString sfile=QDir::homeDirPath(); if(sfile.right(1) != "/") sfile+="/._temp"; else sfile+="._temp"; QFile file( sfile); if(file.exists()) file.remove(); } -void AdvancedFm::tabChanged(QWidget *) { - if (TabWidget->getCurrentTab() == 0) { +void AdvancedFm::tabChanged(QWidget *w) { + qDebug("tab changed %d",TabWidget->getCurrentTab()); + + if ( w == tab) { +// if (TabWidget->getCurrentTab() == 0) { // if (TabWidget->currentPageIndex() == 0) { - currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); - viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); - viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); - QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); - setCaption("AdvancedFm :: "+fs+" :: " - +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); + currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); + viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); + viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); + QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); + setCaption("AdvancedFm :: "+fs+" :: " + +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); - } - if (TabWidget->getCurrentTab() == 1) { + } + if ( w == tab_2) { +// if (TabWidget->getCurrentTab() == 1) { // if (TabWidget->currentPageIndex() == 1) { - currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); - viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); - viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); - QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); - setCaption("AdvancedFm :: "+fs+" :: " - +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); - } + currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); + viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); + viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); + QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); + setCaption("AdvancedFm :: "+fs+" :: " + +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); + } } void AdvancedFm::populateLocalView() { QPixmap pm; Local_View->clear(); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentDir.setMatchAllDirs(TRUE); currentDir.setNameFilter(filterStr); QString fileL, fileS, fileDate; QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); setCaption("AdvancedFm :: "+fs+" :: " +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); bool isDir=FALSE; const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); QFileInfoListIterator it(*list); QFileInfo *fi; while ( (fi=it.current()) ) { if (fi->isSymLink() ) { QString symLink=fi->readLink(); QFileInfo sym( symLink); fileS.sprintf( "%10i", sym.size() ); fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); fileDate = sym.lastModified().toString(); } else { fileS.sprintf( "%10i", fi->size() ); fileL.sprintf( "%s",fi->fileName().data() ); fileDate= fi->lastModified().toString(); if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { fileL+="/"; isDir=TRUE; } } QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); if(fileL !="./" && fi->exists()) { item= new QListViewItem( Local_View, fileL, fileS , fileDate); if(isDir || fileL.find("/",0,TRUE) != -1) { if( !QDir( fi->filePath() ).isReadable()) //is directory pm = Resource::loadPixmap( "lockedfolder" ); else pm= Resource::loadPixmap( "folder" ); } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { pm = Resource::loadPixmap( "exec"); } else if( (fileInfo.permission( QFileInfo::ExeUser) | fileInfo.permission( QFileInfo::ExeGroup) | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { pm = Resource::loadPixmap( "exec"); } else if( !fi->isReadable() ) { pm = Resource::loadPixmap( "locked" ); } else { //everything else goes by mimetype MimeType mt(fi->filePath()); pm=mt.pixmap(); //sets the correct pixmap for mimetype if(pm.isNull()) pm = Resource::loadPixmap( "UnknownDocument-14" ); } item->setPixmap( 0,pm); if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { // overlay link image pm= Resource::loadPixmap( "folder" ); QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); QPainter painter( &pm ); painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp index 946d038..a60cea6 100644 --- a/noncore/apps/advancedfm/output.cpp +++ b/noncore/apps/advancedfm/output.cpp @@ -204,79 +204,81 @@ void Output::saveOutput() { if(!lnk.writeLink()) { qDebug("Writing doclink did not work"); } } else qWarning("Could not write file"); f.close(); } } void Output::commandStdout(OProcess*, char *buffer, int buflen) { qWarning("received stdout %d bytes", buflen); // QByteArray data(buflen); // data.fill(*buffer, buflen); // for (uint i = 0; i < data.count(); i++ ) { // printf("%c", buffer[i] ); // } // printf("\n"); QString lineStr = buffer; lineStr=lineStr.left(lineStr.length()-1); OutputEdit->append(lineStr); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); } void Output::commandStdin( const QByteArray &data) { qWarning("received stdin %d bytes", data.size()); // 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); QString lineStr = buffer; // lineStr=lineStr.left(lineStr.length()-1); OutputEdit->append(lineStr); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); } void Output::processFinished() { delete proc; OutputEdit->append( "\nFinished\n"); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); // close(); // disconnect( layer(), SIGNAL(received(const QByteArray &)), // this, SLOT(commandStdin(const QByteArray &))); } //============================== InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "InputDialog" ); resize( 234, 50 ); setMaximumSize( QSize( 240, 50 ) ); setCaption( tr(name ) ); LineEdit1 = new QLineEdit( this, "LineEdit1" ); LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); + LineEdit1->setFocus(); + LineEdit1->setFocus(); connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() )); } InputDialog::~InputDialog() { inputText = LineEdit1->text(); } void InputDialog::setInputText(const QString &string) { LineEdit1->setText( string); } void InputDialog::returned() { inputText = LineEdit1->text(); this->accept(); } |