From d2c2dd7d80cfd5359db07952385bca575f1eeeae Mon Sep 17 00:00:00 2001 From: llornkcor Date: Fri, 19 Apr 2002 23:54:20 +0000 Subject: switched date and size columns, added about, and fixed a bug with move --- diff --git a/noncore/apps/advancedfm/Makefile b/noncore/apps/advancedfm/Makefile index 4622c6e..8799b03 100644 --- a/noncore/apps/advancedfm/Makefile +++ b/noncore/apps/advancedfm/Makefile @@ -1,25 +1,124 @@ ############################################################################# -# Makefile for building $(OPIEDIR)/bin/advancedfm -# Generated by tmake at 18:31, 2002/04/15 -# Project: advancedfm -# Template: app +# Automatically generated from noncore/advancedfm/Makefile.in +# Build options from ############################################################################# -####### Compiler, tools and options +# Compiling +INTERFACE_DECL_PATH = . +SYSCONF_CXX = g++ +SYSCONF_CC = gcc +DASHCROSS = + +# Compiling with support libraries +SYSCONF_CXXFLAGS_X11 = +SYSCONF_CXXFLAGS_QT = -I$(QTDIR)/include +SYSCONF_CXXFLAGS_OPENGL = -I/usr/X11R6/include + +# Compiling YACC output +SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses + +# Linking with support libraries +SYSCONF_RPATH_X11 = +SYSCONF_RPATH_QT = -Wl,-rpath,$(QTDIR)/lib +SYSCONF_RPATH_OPENGL = -Wl,-rpath,/usr/X11R6/lib + +# Linking with support libraries +# X11 +SYSCONF_LFLAGS_X11 = +SYSCONF_LIBS_X11 = +# Qt, Qt+OpenGL +SYSCONF_LFLAGS_QT = -L$(QTDIR)/lib +SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX) +SYSCONF_LIBS_QT_OPENGL = +# OpenGL +SYSCONF_LFLAGS_OPENGL = -L/usr/X11R6/lib +SYSCONF_LIBS_OPENGL = +# Yacc +SYSCONF_LIBS_YACC = + +# Linking applications +SYSCONF_LINK = gcc +SYSCONF_LFLAGS = +SYSCONF_LIBS = + +# Link flags for shared objects +SYSCONF_LFLAGS_SHOBJ = -shared + +# Flags for threading +SYSCONF_CFLAGS_THREAD = -D_REENTRANT +SYSCONF_CXXFLAGS_THREAD = -D_REENTRANT +SYSCONF_LFLAGS_THREAD = +SYSCONF_LIBS_THREAD = -lpthread + +# Meta-object compiler +SYSCONF_MOC = $(QTDIR)/bin/moc + +# UI compiler +SYSCONF_UIC = $(QTDIR)/bin/uic + +# Linking shared libraries +# - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2 +# - Place target in $(DESTDIR) - which has a trailing / +# - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH) +# +SYSCONF_LINK_SHLIB = gcc +SYSCONF_LINK_TARGET_SHARED = lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH) +SYSCONF_LINK_LIB_SHARED = $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \ + $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \ + $(OBJECTS) $(OBJMOC) $(LIBS) && \ + mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \ + cd $(DESTDIR) && \ + rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \ + ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \ + ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \ + ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN) + +# Linking static libraries +# - Build the $(TARGET) library, eg. lib$(TARGET).a +# - Place target in $(DESTDIR) - which has a trailing / +# +SYSCONF_AR = ar cqs +SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a +SYSCONF_LINK_LIB_STATIC = rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \ + $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC) +# Compiling application source +SYSCONF_CXXFLAGS = -pipe -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W +SYSCONF_CFLAGS = -pipe -O2 -Wall -W +# Default link type (static linking is still be used where required) +SYSCONF_LINK_LIB = $(SYSCONF_LINK_LIB_SHARED) +SYSCONF_LINK_TARGET = $(SYSCONF_LINK_TARGET_SHARED) +# Compiling library source +SYSCONF_CXXFLAGS_LIB = -fPIC +SYSCONF_CFLAGS_LIB = -fPIC +# Compiling shared-object source +SYSCONF_CXXFLAGS_SHOBJ = -fPIC +SYSCONF_CFLAGS_SHOBJ = -fPIC +# Linking Qt +SYSCONF_LIBS_QTLIB = $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) +# Linking Qt applications +SYSCONF_LIBS_QTAPP = +############################################################################# -CC = gcc -CXX = g++ -CFLAGS = -pipe -Wall -W -O2 -fno-default-inline -DNO_DEBUG -CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fno-default-inline -DNO_DEBUG -INCPATH = -I$(OPIEDIR)/include -I$(QTDIR)/include -LINK = g++ -LFLAGS = -LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqpe -lqte -MOC = $(QTDIR)/bin/moc -UIC = $(QTDIR)/bin/uic +####### Compiler, tools and options -TAR = tar -cf -GZIP = gzip -9f +CXX = $(SYSCONF_CXX) $(QT_CXX_MT) +CXXFLAGS= $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) +CC = $(SYSCONF_CC) $(QT_C_MT) +CFLAGS = $(SYSCONF_CFLAGS) +INCPATH = -I$(OPIEDIR)/include +LFLAGS = $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) +LIBS = $(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) +MOC = $(SYSCONF_MOC) +UIC = $(SYSCONF_UIC) + +####### Target + +DESTDIR = $(OPIEDIR)/bin/ +VER_MAJ = 1 +VER_MIN = 0 +VER_PATCH = 0 +TARGET = advancedfm +TARGET1 = lib$(TARGET).so.$(VER_MAJ) ####### Files @@ -37,9 +136,9 @@ OBJECTS = advancedfm.o \ filePermissions.o \ output.o \ main.o -INTERFACES = -UICDECLS = -UICIMPLS = +INTERFACES = +UICDECLS = +UICIMPLS = SRCMOC = moc_advancedfm.cpp \ moc_inputDialog.cpp \ moc_filePermissions.cpp \ @@ -48,9 +147,7 @@ OBJMOC = moc_advancedfm.o \ moc_inputDialog.o \ moc_filePermissions.o \ moc_output.o -DIST = -TARGET = $(OPIEDIR)/bin/advancedfm -INTERFACE_DECL_PATH = . + ####### Implicit rules @@ -74,25 +171,37 @@ INTERFACE_DECL_PATH = . ####### Build rules -all: $(TARGET) +all: $(DESTDIR)$(TARGET) -$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) - $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) +$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) + $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) moc: $(SRCMOC) -tmake: Makefile - -Makefile: advancedfm.pro - tmake advancedfm.pro -o Makefile - -dist: - $(TAR) advancedfm.tar advancedfm.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) - $(GZIP) advancedfm.tar +tmake: + tmake advancedfm.pro clean: - -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) + -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) -rm -f *~ core + -rm -f allmoc.cpp + +####### Extension Modules + +listpromodules: + @echo + +listallmodules: + @echo + +listaddonpromodules: + @echo + +listaddonentmodules: + @echo + + +REQUIRES=medium-config ####### Sub-libraries @@ -100,6 +209,7 @@ clean: ###### Combined headers + ####### Compile advancedfm.o: advancedfm.cpp \ @@ -107,16 +217,16 @@ advancedfm.o: advancedfm.cpp \ inputDialog.h \ filePermissions.h \ output.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/lnkproperties.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/filemanager.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/qcopenvelope_qws.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/qpemenubar.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/qpetoolbar.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/qpeapplication.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/resource.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/config.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/mimetype.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/applnk.h + $(OPIEDIR)/include/qpe/lnkproperties.h \ + $(OPIEDIR)/include/qpe/filemanager.h \ + $(OPIEDIR)/include/qpe/qcopenvelope_qws.h \ + $(OPIEDIR)/include/qpe/qpemenubar.h \ + $(OPIEDIR)/include/qpe/qpetoolbar.h \ + $(OPIEDIR)/include/qpe/qpeapplication.h \ + $(OPIEDIR)/include/qpe/resource.h \ + $(OPIEDIR)/include/qpe/config.h \ + $(OPIEDIR)/include/qpe/mimetype.h \ + $(OPIEDIR)/include/qpe/applnk.h inputDialog.o: inputDialog.cpp \ inputDialog.h @@ -128,9 +238,9 @@ output.o: output.cpp \ output.h main.o: main.cpp \ - /usr/src/oldsrc/Opie/opie/include/qpe/qpeapplication.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/qcopenvelope_qws.h \ - /usr/src/oldsrc/Opie/opie/include/qpe/config.h \ + $(OPIEDIR)/include/qpe/qpeapplication.h \ + $(OPIEDIR)/include/qpe/qcopenvelope_qws.h \ + $(OPIEDIR)/include/qpe/config.h \ advancedfm.h moc_advancedfm.o: moc_advancedfm.cpp \ @@ -157,3 +267,11 @@ moc_filePermissions.cpp: filePermissions.h moc_output.cpp: output.h $(MOC) output.h -o moc_output.cpp + + +lupdate: + lupdate advancedfm.pro + +lrelease: + lrelease advancedfm.pro + diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index a4ec714..8a1eeec 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -129,6 +129,8 @@ AdvancedFm::AdvancedFm( ) viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); + viewMenu->insertSeparator(); + viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); viewMenu->setCheckable(TRUE); TabWidget = new QTabWidget( this, "TabWidget" ); @@ -142,9 +144,9 @@ AdvancedFm::AdvancedFm( ) Local_View = new QListView( tab, "Local_View" ); // Local_View->setResizePolicy( QListView::AutoOneFit ); Local_View->addColumn( tr("File"),140); - Local_View->addColumn( tr("Size"),-1); - Local_View->setColumnAlignment(1,QListView::AlignRight); Local_View->addColumn( tr("Date"),-1); + Local_View->setColumnAlignment(1,QListView::AlignRight); + Local_View->addColumn( tr("Size"),-1); Local_View->setColumnAlignment(2,QListView::AlignRight); Local_View->setAllColumnsShowFocus(TRUE); // Local_View->setMultiSelection( TRUE ); @@ -167,9 +169,9 @@ AdvancedFm::AdvancedFm( ) Remote_View = new QListView( tab_2, "Remote_View" ); Remote_View->addColumn( tr("File"),140); - Remote_View->addColumn( tr("Size"),-1); - Remote_View->setColumnAlignment(1,QListView::AlignRight); Remote_View->addColumn( tr("Date"),-1); + Remote_View->setColumnAlignment(1,QListView::AlignRight); + Remote_View->addColumn( tr("Size"),-1); Remote_View->setColumnAlignment(2,QListView::AlignRight); Remote_View->setAllColumnsShowFocus(TRUE); // Remote_View->setMultiSelection( TRUE ); @@ -299,7 +301,7 @@ void AdvancedFm::populateLocalView() } } if(fileL !="./" && fi->exists()) { - item= new QListViewItem( Local_View, fileL, fileS , fileDate); + item= new QListViewItem( Local_View, fileL , fileDate, fileS); if(isDir || fileL.find("/",0,TRUE) != -1) { if( !QDir( fi->filePath() ).isReadable()) @@ -352,7 +354,7 @@ void AdvancedFm::populateLocalView() // fileS.sprintf("%d,%d", devT, devT); fileDate.sprintf("%s", ctime( &buf.st_mtime)); if( fileL.find(".") == -1 ){ - item= new QListViewItem( Local_View, fileL, fileS, fileDate); + item= new QListViewItem( Local_View, fileL, fileDate, fileS); pm = Resource::loadPixmap( "UnknownDocument-14" ); item->setPixmap( 0,pm); } @@ -406,7 +408,7 @@ void AdvancedFm::populateRemoteView() } } if(fileL !="./" && fi->exists()) { - item= new QListViewItem( Remote_View,fileL,fileS , fileDate); + item= new QListViewItem( Remote_View, fileL, fileDate, fileS); QPixmap pm; if(isDir || fileL.find("/",0,TRUE) != -1) { @@ -457,7 +459,7 @@ void AdvancedFm::populateRemoteView() fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); fileDate.sprintf("%s", ctime( &buf.st_mtime)); if( fileL.find(".") == -1 ){ - item= new QListViewItem( Remote_View, fileL, fileS, fileDate); + item= new QListViewItem( Remote_View, fileL, fileDate, fileS); pm = Resource::loadPixmap( "UnknownDocument-14" ); item->setPixmap( 0,pm); } @@ -1097,8 +1099,8 @@ void AdvancedFm::move() { // qDebug(curFile); QString destFile; if (TabWidget->currentPageIndex() == 0) { - QString destFile = currentRemoteDir.canonicalPath()+Local_View->currentItem()->text(0); -// qDebug(destFile); + QString destFile = currentRemoteDir.canonicalPath() + "/" + Local_View->currentItem()->text(0); + qDebug("Destination file is "+destFile); QFile f(destFile); if( f.exists()) @@ -1110,8 +1112,8 @@ void AdvancedFm::move() { QFile::remove(curFile); TabWidget->setCurrentPage(1); } else { - QString destFile = currentDir.canonicalPath()+destFile + Remote_View->currentItem()->text(0); -// qDebug(destFile); + QString destFile = currentDir.canonicalPath() + "/" + Remote_View->currentItem()->text(0); + qDebug("Destination file is "+destFile); QFile f(destFile); if( f.exists()) @@ -1196,15 +1198,13 @@ void AdvancedFm::runCommand() { return; } else { while ( fgets( line, sizeof line, fp)) { - outDlg->OutputEdit->append(line); + QString lineStr = line; + lineStr=lineStr.left(lineStr.length()-1); + outDlg->OutputEdit->append(lineStr); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); - } - } - } - } void AdvancedFm::runCommandStd() { @@ -1261,3 +1261,10 @@ void AdvancedFm::fileStatus() { } } + +void AdvancedFm::doAbout() { + QMessageBox::message("AdvancedFm","Advanced FileManager\n" + "is copyright 2002 by\n" + "L.J.Potter\n" + "and is licensed by the GPL"); +} diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 2ca45b1..30ff28c 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h @@ -113,6 +113,7 @@ protected slots: bool copyFile( const QString & , const QString & ); void move(); void fileStatus(); + void doAbout(); }; #endif // ADVANCEDFM_H diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp index 6970f58..82e78a7 100644 --- a/noncore/apps/advancedfm/output.cpp +++ b/noncore/apps/advancedfm/output.cpp @@ -4,13 +4,117 @@ ** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter ****************************************************************************/ #include "output.h" +#include "inputDialog.h" +#include +#include +#include + +#include + +#include #include #include #include #include -#include -#include + +/* XPM */ +static char * filesave_xpm[] = { +"16 16 78 1", +" c None", +". c #343434", +"+ c #A0A0A0", +"@ c #565656", +"# c #9E9E9E", +"$ c #525252", +"% c #929292", +"& c #676767", +"* c #848484", +"= c #666666", +"- c #D8D8D8", +"; c #FFFFFF", +"> c #DBDBDB", +", c #636363", +"' c #989898", +") c #2D2D2D", +"! c #909090", +"~ c #AEAEAE", +"{ c #EAEAEA", +"] c #575757", +"^ c #585858", +"/ c #8A8A8A", +"( c #828282", +"_ c #6F6F6F", +": c #C9C9C9", +"< c #050505", +"[ c #292929", +"} c #777777", +"| c #616161", +"1 c #3A3A3A", +"2 c #BEBEBE", +"3 c #2C2C2C", +"4 c #7C7C7C", +"5 c #F6F6F6", +"6 c #FCFCFC", +"7 c #6B6B6B", +"8 c #959595", +"9 c #4F4F4F", +"0 c #808080", +"a c #767676", +"b c #818181", +"c c #B8B8B8", +"d c #FBFBFB", +"e c #F9F9F9", +"f c #CCCCCC", +"g c #030303", +"h c #737373", +"i c #7A7A7A", +"j c #7E7E7E", +"k c #6A6A6A", +"l c #FAFAFA", +"m c #505050", +"n c #9D9D9D", +"o c #333333", +"p c #7B7B7B", +"q c #787878", +"r c #696969", +"s c #494949", +"t c #555555", +"u c #949494", +"v c #E6E6E6", +"w c #424242", +"x c #515151", +"y c #535353", +"z c #3E3E3E", +"A c #D4D4D4", +"B c #0C0C0C", +"C c #353535", +"D c #474747", +"E c #ECECEC", +"F c #919191", +"G c #7D7D7D", +"H c #000000", +"I c #404040", +"J c #858585", +"K c #323232", +"L c #D0D0D0", +"M c #1C1C1C", +" ...+ ", +" @#$%&..+ ", +" .*=-;;>,..+ ", +" ')!~;;;;;;{]..", +" ^/(-;;;;;;;_:<", +" [}|;;;;;;;{12$", +" #34-55;;;;678$+", +" 90ab=c;dd;e1fg ", +" [ahij((kbl0mn$ ", +" op^q^^7r&]s/$+ ", +"@btu;vbwxy]zAB ", +"CzDEvEv;;DssF$ ", +"G.H{E{E{IxsJ$+ ", +" +...vEKxzLM ", +" +...z]n$ ", +" +... "}; Output::Output( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) @@ -23,9 +127,18 @@ Output::Output( QWidget* parent, const char* name, bool modal, WFlags fl ) OutputLayout->setSpacing( 6 ); OutputLayout->setMargin( 11 ); + QPushButton *docButton; + docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); + docButton->setFixedSize( QSize( 20, 20 ) ); + connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() )); +// docButton->setFlat(TRUE); + OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 ); + + OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); + OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 ); + - OutputLayout->addWidget( OutputEdit, 0, 0 ); } /* @@ -36,3 +149,32 @@ Output::~Output() // no need to delete child widgets, Qt does it all for us } +void Output::saveOutput() { + + InputDialog *fileDlg; + fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); + fileDlg->exec(); + 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); + + 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"); + } + } else + qWarning("Could not write file"); + f.close(); + + } +} diff --git a/noncore/apps/advancedfm/output.h b/noncore/apps/advancedfm/output.h index 84adccd..c1e48da 100644 --- a/noncore/apps/advancedfm/output.h +++ b/noncore/apps/advancedfm/output.h @@ -28,6 +28,8 @@ public: protected: QGridLayout* OutputLayout; +protected slots: + void saveOutput(); }; #endif // OUTPUT_H -- cgit v0.9.0.2