author | llornkcor <llornkcor> | 2002-04-19 23:54:20 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-19 23:54:20 (UTC) |
commit | d2c2dd7d80cfd5359db07952385bca575f1eeeae (patch) (side-by-side diff) | |
tree | 280bb492460de8af699caccea5a5183fd8d1bda0 | |
parent | 609a534bc1f5efda3242be2d1dc5dbc4a13715cb (diff) | |
download | opie-d2c2dd7d80cfd5359db07952385bca575f1eeeae.zip opie-d2c2dd7d80cfd5359db07952385bca575f1eeeae.tar.gz opie-d2c2dd7d80cfd5359db07952385bca575f1eeeae.tar.bz2 |
switched date and size columns, added about, and fixed a bug with move
-rw-r--r-- | noncore/apps/advancedfm/Makefile | 214 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 41 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/output.cpp | 148 | ||||
-rw-r--r-- | noncore/apps/advancedfm/output.h | 2 |
5 files changed, 338 insertions, 68 deletions
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,30 +1,129 @@ ############################################################################# -# 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 HEADERS = advancedfm.h \ inputDialog.h \ filePermissions.h \ output.h SOURCES = advancedfm.cpp \ @@ -32,30 +131,28 @@ SOURCES = advancedfm.cpp \ filePermissions.cpp \ output.cpp \ main.cpp OBJECTS = advancedfm.o \ inputDialog.o \ filePermissions.o \ output.o \ main.o -INTERFACES = -UICDECLS = -UICIMPLS = +INTERFACES = +UICDECLS = +UICIMPLS = SRCMOC = moc_advancedfm.cpp \ moc_inputDialog.cpp \ moc_filePermissions.cpp \ moc_output.cpp OBJMOC = moc_advancedfm.o \ moc_inputDialog.o \ moc_filePermissions.o \ moc_output.o -DIST = -TARGET = $(OPIEDIR)/bin/advancedfm -INTERFACE_DECL_PATH = . + ####### Implicit rules .SUFFIXES: .cpp .cxx .cc .C .c .cpp.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< @@ -69,73 +166,86 @@ INTERFACE_DECL_PATH = . $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .c.o: $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< ####### 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 ###### Combined headers + ####### Compile advancedfm.o: advancedfm.cpp \ advancedfm.h \ 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 filePermissions.o: filePermissions.cpp \ filePermissions.h 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 \ advancedfm.h moc_inputDialog.o: moc_inputDialog.cpp \ inputDialog.h @@ -152,8 +262,16 @@ moc_inputDialog.cpp: inputDialog.h $(MOC) inputDialog.h -o moc_inputDialog.cpp moc_filePermissions.cpp: filePermissions.h $(MOC) filePermissions.h -o moc_filePermissions.cpp 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 @@ -124,32 +124,34 @@ AdvancedFm::AdvancedFm( ) fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); fileMenu->insertSeparator(); fileMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); fileMenu->setCheckable(TRUE); 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" ); layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6); tab = new QWidget( TabWidget, "tab" ); tabLayout = new QGridLayout( tab ); tabLayout->setSpacing( 2); tabLayout->setMargin( 2); 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 ); // Local_View->setSelectionMode(QListView::Extended); QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); tabLayout->addWidget( Local_View, 0, 0 ); @@ -162,19 +164,19 @@ AdvancedFm::AdvancedFm( ) tab_2 = new QWidget( TabWidget, "tab_2" ); tabLayout_2 = new QGridLayout( tab_2 ); tabLayout_2->setSpacing( 2); tabLayout_2->setMargin( 2); 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 ); // Remote_View->setSelectionMode(QListView::Extended); QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); connect( Remote_View, SIGNAL( clicked( QListViewItem*)), this,SLOT( remoteListClicked(QListViewItem *)) ); @@ -294,17 +296,17 @@ void AdvancedFm::populateLocalView() fileDate= fi->lastModified().toString(); if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { fileL+="/"; isDir=TRUE; // qDebug( fileL); } } 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()) pm = Resource::loadPixmap( "lockedfolder" ); else pm= Resource::loadPixmap( "folder" ); item->setPixmap( 0,pm ); } else { @@ -347,17 +349,17 @@ void AdvancedFm::populateLocalView() // mode = buf.st_mode; fileL.sprintf("%s", mydirent->d_name); // fileS.sprintf("%d, %d", ); //this isn't correct devT = buf.st_dev; fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); // 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); } } closedir(dir); } @@ -401,17 +403,17 @@ void AdvancedFm::populateRemoteView() fileDate= fi->lastModified().toString(); if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { fileL+="/"; isDir=TRUE; // qDebug( fileL); } } 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) { if( !QDir( fi->filePath() ).isReadable()) pm = Resource::loadPixmap( "lockedfolder" ); else pm= Resource::loadPixmap( "folder" ); item->setPixmap( 0,pm ); @@ -452,17 +454,17 @@ void AdvancedFm::populateRemoteView() lstat( mydirent->d_name, &buf); qDebug(mydirent->d_name); // mode = buf.st_mode; fileL.sprintf("%s", mydirent->d_name); // fileS.sprintf("%d, %d", ); //this isn't correct 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); } } closedir(dir); } @@ -1092,31 +1094,31 @@ void AdvancedFm::copyAs() } } void AdvancedFm::move() { QString curFile = getPath(); // 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()) f.remove(); if(!copyFile( destFile, curFile) ) { QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); return; } 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()) f.remove(); if(!copyFile(destFile, curFile) ) { QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); return; } @@ -1191,25 +1193,23 @@ void AdvancedFm::runCommand() { fp = popen( (const char *) command, "r"); if ( !fp ) { qDebug("Could not execute '" + command + "'! err=%d", fp); QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); pclose(fp); 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() { QString curFile; if (TabWidget->currentPageIndex() == 0) { if( Local_View->currentItem()) curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); } else { @@ -1256,8 +1256,15 @@ void AdvancedFm::fileStatus() { while ( fgets( line, sizeof line, fp)) { outDlg->OutputEdit->append(line); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); } } } + +void AdvancedFm::doAbout() { + QMessageBox::message("AdvancedFm","Advanced FileManager\n" + "is copyright 2002 by\n" + "L.J.Potter<llornkcor@handhelds.org>\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 @@ -108,11 +108,12 @@ protected slots: void currentPathComboChanged(); void copy(); void copyAs(); void currentPathComboActivated(const QString &); void fillCombo(const QString &); 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 @@ -1,38 +1,180 @@ /**************************************************************************** ** outputEdit.cpp ** ** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> ****************************************************************************/ #include "output.h" +#include "inputDialog.h" +#include <qpe/filemanager.h> +#include <qpe/qpeapplication.h> +#include <qpe/applnk.h> + +#include <qfile.h> + +#include <qlineedit.h> #include <qmultilineedit.h> #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.h> + +/* 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 ) { if ( !name ) setName( "Output" ); resize( 196, 269 ); setCaption( name ); OutputLayout = new QGridLayout( this ); 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 ); } /* * Destroys the object and frees any allocated resources */ 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 @@ -23,11 +23,13 @@ class Output : public QDialog public: Output( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~Output(); QMultiLineEdit* OutputEdit; protected: QGridLayout* OutputLayout; +protected slots: + void saveOutput(); }; #endif // OUTPUT_H |