You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(98) |
Sep
(138) |
Oct
(100) |
Nov
(49) |
Dec
(131) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(94) |
Feb
(65) |
Mar
(100) |
Apr
(83) |
May
(72) |
Jun
(29) |
Jul
(167) |
Aug
(127) |
Sep
(131) |
Oct
(269) |
Nov
(122) |
Dec
(100) |
2005 |
Jan
(228) |
Feb
(266) |
Mar
(63) |
Apr
(135) |
May
(157) |
Jun
(52) |
Jul
(25) |
Aug
(49) |
Sep
(184) |
Oct
(159) |
Nov
(75) |
Dec
(37) |
2006 |
Jan
(60) |
Feb
(129) |
Mar
(110) |
Apr
(34) |
May
(31) |
Jun
(42) |
Jul
(72) |
Aug
(90) |
Sep
(57) |
Oct
(66) |
Nov
(42) |
Dec
(90) |
2007 |
Jan
(106) |
Feb
(54) |
Mar
(93) |
Apr
(27) |
May
(21) |
Jun
(17) |
Jul
(19) |
Aug
(22) |
Sep
(25) |
Oct
(2) |
Nov
(1) |
Dec
(1) |
2008 |
Jan
(65) |
Feb
(70) |
Mar
(29) |
Apr
(45) |
May
(91) |
Jun
(20) |
Jul
(11) |
Aug
(24) |
Sep
(23) |
Oct
(13) |
Nov
(23) |
Dec
(39) |
2009 |
Jan
(23) |
Feb
(39) |
Mar
(15) |
Apr
(56) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Shie E. <er...@us...> - 2004-07-24 23:26:23
|
Update of /cvsroot/krusader/krusader_kde3/krusader/Panel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11108/krusader/Panel Modified Files: panelpopup.cpp Log Message: disabled closing the tree Index: panelpopup.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/panelpopup.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** panelpopup.cpp 23 Jul 2004 23:40:39 -0000 1.1 --- panelpopup.cpp 24 Jul 2004 23:26:13 -0000 1.2 *************** *** 106,109 **** void PanelPopup::treeSelection(QListViewItem*) { emit selection(tree->currentURL()); ! emit hideMe(); } --- 106,109 ---- void PanelPopup::treeSelection(QListViewItem*) { emit selection(tree->currentURL()); ! //emit hideMe(); } |
From: Shie E. <er...@us...> - 2004-07-24 23:25:10
|
Update of /cvsroot/krusader/krusader_kde3/krusader/Panel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10901/krusader/Panel Modified Files: listpanel.cpp Log Message: moved popup-panel's button to the left Index: listpanel.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/listpanel.cpp,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** listpanel.cpp 23 Jul 2004 23:40:39 -0000 1.69 --- listpanel.cpp 24 Jul 2004 23:25:01 -0000 1.70 *************** *** 143,147 **** "how many did you select and the bytes math" ) ); connect( totals, SIGNAL( clicked() ), this, SLOT( slotFocusOnMe() ) ); - totalsLayout->addWidget(totals); // a quick button to open the popup panel --- 143,146 ---- *************** *** 152,155 **** --- 151,155 ---- QToolTip::add( popupBtn, i18n( "Open the popup panel" ) ); totalsLayout->addWidget(popupBtn); + totalsLayout->addWidget(totals); quickSearch = new KrQuickSearch( this ); *************** *** 223,226 **** --- 223,233 ---- // add a popup popup = new PanelPopup(splt); + #if 0 + // set initial size to be 1/3 of the panel's height + QValueList<int> sizes; + sizes.append(height()/2); sizes.append(height()/2); + kdWarning()<<sizes[0]<<"--"<<sizes[1]<<"--"<<this->height()<<endl; + splt->setSizes(sizes); + #endif connect(popup, SIGNAL(selection(const KURL&)), SLOTS, SLOT(refresh(const KURL&))); connect(popup, SIGNAL(hideMe()), this, SLOT(togglePanelPopup())); |
From: Shie E. <er...@us...> - 2004-07-24 23:24:38
|
Update of /cvsroot/krusader/krusader_kde3/krusader/Panel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10868/krusader/Panel Modified Files: panelfunc.cpp Log Message: support for new refresh mode Index: panelfunc.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/panelfunc.cpp,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** panelfunc.cpp 17 Jun 2004 14:33:04 -0000 1.67 --- panelfunc.cpp 24 Jul 2004 23:24:30 -0000 1.68 *************** *** 129,132 **** --- 129,140 ---- urlStack.push( files()->vfs_getOrigin() ); } + // connect to the vfs's dirwatch signals + connect(files(), SIGNAL(addedVfile(const vfile* )), + dynamic_cast<KrDetailedView*>(panel->view), SLOT(addedVfile(const vfile* ))); + connect(files(), SIGNAL(updatedVfile(const vfile* )), + dynamic_cast<KrDetailedView*>(panel->view), SLOT(updatedVfile(const vfile* ))); + connect(files(), SIGNAL(deletedVfile(const QString& )), + dynamic_cast<KrDetailedView*>(panel->view), SLOT(deletedVfile(const QString&))); + // on local file system change the working directory if( files()->vfs_getType() == vfs::NORMAL ) |
From: Shie E. <er...@us...> - 2004-07-24 23:23:58
|
Update of /cvsroot/krusader/krusader_kde3/krusader/Panel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10747/krusader/Panel Modified Files: krdetailedview.cpp Log Message: support for new refresh mode Index: krdetailedview.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/krdetailedview.cpp,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** krdetailedview.cpp 24 Jul 2004 20:15:34 -0000 1.85 --- krdetailedview.cpp 24 Jul 2004 23:23:49 -0000 1.86 *************** *** 1052,1053 **** --- 1052,1065 ---- KListView::event( e ); } + + void KrDetailedView::addedVfile( const vfile *vf ) { + kdWarning() << "added: " << vf->name() << endl; + } + + void KrDetailedView::updatedVfile( const vfile *vf ) { + kdWarning() << "updated: " << vf->name() << endl; + } + + void KrDetailedView::deletedVfile( const QString &name ) { + kdWarning() << "deleted: " << name << endl; + } |
From: Shie E. <er...@us...> - 2004-07-24 23:23:39
|
Update of /cvsroot/krusader/krusader_kde3/krusader/Panel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10723/krusader/Panel Modified Files: krdetailedview.h Log Message: support for new refresh mode Index: krdetailedview.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/krdetailedview.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** krdetailedview.h 24 Jul 2004 20:15:35 -0000 1.29 --- krdetailedview.h 24 Jul 2004 23:23:30 -0000 1.30 *************** *** 1,22 **** /*************************************************************************** ! krdetailedview.h ! ------------------- ! copyright : (C) 2000-2002 by Shie Erlich & Rafi Yanai ! e-mail : kru...@us... ! web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- ! Description *************************************************************************** ! A ! db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b. ! 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D ! 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY' ! 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b ! 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88. ! YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD ! H e a d e r F i l e *************************************************************************** --- 1,22 ---- /*************************************************************************** ! krdetailedview.h ! ------------------- ! copyright : (C) 2000-2002 by Shie Erlich & Rafi Yanai ! e-mail : kru...@us... ! web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- ! Description *************************************************************************** ! A ! db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b. ! 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D ! 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY' ! 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b ! 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88. ! YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD ! H e a d e r F i l e *************************************************************************** *************** *** 51,149 **** */ class KrDetailedView : public KListView, public KrView { ! Q_OBJECT #define MAX_COLUMNS 9 ! friend class KrDetailedViewItem; ! public: ! enum ColumnType { Name = 0x0, Extention = 0x1, Mime = 0x2, Size = 0x3, DateTime = 0x4, ! Permissions = 0x5, KrPermissions = 0x6, Owner = 0x7, Group = 0x8, Unused = 0x9 }; ! KrDetailedView( QWidget *parent, ListPanel *panel, bool &left, KConfig *cfg = krConfig, const char *name = 0 ); ! virtual ~KrDetailedView(); ! virtual int column( ColumnType type ); ! virtual KrViewItem *getFirst() { return dynamic_cast<KrViewItem*>( firstChild() ); } ! virtual KrViewItem *getLast() { return dynamic_cast<KrViewItem*>( lastChild() ); } ! virtual KrViewItem *getNext( KrViewItem *current ) { return dynamic_cast<KrViewItem*>( dynamic_cast<KListViewItem*>( current ) ->itemBelow() ); } ! virtual KrViewItem *getPrev( KrViewItem *current ) { return dynamic_cast<KrViewItem*>( dynamic_cast<KListViewItem*>( current ) ->itemAbove() ); } ! virtual KrViewItem *getCurrentKrViewItem() { return dynamic_cast<KrViewItem*>( currentItem() ); } ! virtual KrViewItem *getKrViewItemAt( const QPoint &vp ); ! virtual KrViewItem *findItemByName(const QString &name) { return dynamic_cast<KrViewItem*>( findItem(name, 0) ); } ! virtual void addItems( vfs *v, bool addUpDir = true ); ! virtual QString getCurrentItem() const; ! virtual void makeItemVisible( const KrViewItem *item ) { ensureItemVisible( dynamic_cast<const QListViewItem*>( item ) ); } ! virtual void setCurrentItem( const QString& name ); ! virtual void updateView() { triggerUpdate(); emit selectionChanged(); } ! virtual void clear(); ! virtual void sort() { KListView::sort(); } ! virtual void setSortMode( SortSpec mode ); ! virtual void prepareForActive(); ! virtual void prepareForPassive(); ! virtual void saveSettings() { KListView::saveLayout( _config, nameInKConfig() ); } ! virtual void restoreSettings() { KListView::restoreLayout( _config, nameInKConfig() ); } ! virtual QString nameInKConfig() { return _nameInKConfig; } ! virtual QString itemToFilename( QListViewItem *it ) { return dynamic_cast<KrViewItem*>( it ) ->name(); } //remove ! signals: ! void executed( QString &name ); ! void itemDescription( QString &desc ); ! void needFocus(); ! void contextMenu( const QPoint &point ); ! void letsDrag( QStringList items, QPixmap icon ); ! void gotDrop( QDropEvent *e ); ! void renameItem( const QString &oldName, const QString &newName ); ! void middleButtonClicked(QListViewItem *item); ! protected: ! void newColumn( ColumnType type ); ! virtual void keyPressEvent( QKeyEvent *e ); ! virtual void contentsMousePressEvent( QMouseEvent *e ); ! virtual void contentsMouseMoveEvent ( QMouseEvent * e ); ! virtual void contentsWheelEvent( QWheelEvent *e ); ! virtual bool acceptDrag( QDropEvent* e ) const; ! virtual void contentsDropEvent( QDropEvent *e ); ! virtual void contentsDragMoveEvent( QDragMoveEvent *e ); ! virtual void startDrag(); ! virtual bool event( QEvent *e ); ! //virtual void focusOutEvent( QFocusEvent * ); ! protected slots: ! void rename(QListViewItem *item, int c); ! void slotClicked( QListViewItem *item ); ! void slotDoubleClicked( QListViewItem *item ); ! void slotItemDescription( QListViewItem *item ); ! void slotCurrentChanged( QListViewItem *item ); ! void handleContextMenu( QListViewItem*, const QPoint&, int ); ! virtual void renameCurrentItem(); ! void inplaceRenameFinished( QListViewItem *it, int col ); ! void quickSearch(const QString &, int = 0); ! void stopQuickSearch(QKeyEvent*); ! void handleQuickSearchEvent(QKeyEvent*); ! void setNameToMakeCurrent(QListViewItem *it); ! ! /** ! * used internally to produce the signal middleButtonClicked() ! */ ! void slotMouseClicked( int button, QListViewItem * item, const QPoint & pos, int c ); ! inline void slotExecuted(QListViewItem* i) { ! QString tmp = dynamic_cast<KrViewItem*>( i ) ->name(); ! emit executed(tmp); ! } ! ! public slots: ! void refreshColors(); ! private: ! ColumnType _columns[ MAX_COLUMNS ]; ! static QString ColumnName[ MAX_COLUMNS ]; ! bool _withIcons, _focused; ! KrViewItem *_currDragItem; ! QString _nameInKConfig; ! bool &_left; ! bool singleClicked; ! bool modifierPressed; ! QTime clickTime; ! QListViewItem *clickedItem; ! QTimer renameTimer; }; --- 51,153 ---- */ class KrDetailedView : public KListView, public KrView { ! Q_OBJECT #define MAX_COLUMNS 9 ! friend class KrDetailedViewItem; ! public: ! enum ColumnType { Name = 0x0, Extention = 0x1, Mime = 0x2, Size = 0x3, DateTime = 0x4, ! Permissions = 0x5, KrPermissions = 0x6, Owner = 0x7, Group = 0x8, Unused = 0x9 }; ! KrDetailedView( QWidget *parent, ListPanel *panel, bool &left, KConfig *cfg = krConfig, const char *name = 0 ); ! virtual ~KrDetailedView(); ! virtual int column( ColumnType type ); ! virtual KrViewItem *getFirst() { return dynamic_cast<KrViewItem*>( firstChild() ); } ! virtual KrViewItem *getLast() { return dynamic_cast<KrViewItem*>( lastChild() ); } ! virtual KrViewItem *getNext( KrViewItem *current ) { return dynamic_cast<KrViewItem*>( dynamic_cast<KListViewItem*>( current ) ->itemBelow() ); } ! virtual KrViewItem *getPrev( KrViewItem *current ) { return dynamic_cast<KrViewItem*>( dynamic_cast<KListViewItem*>( current ) ->itemAbove() ); } ! virtual KrViewItem *getCurrentKrViewItem() { return dynamic_cast<KrViewItem*>( currentItem() ); } ! virtual KrViewItem *getKrViewItemAt( const QPoint &vp ); ! virtual KrViewItem *findItemByName( const QString &name ) { return dynamic_cast<KrViewItem*>( findItem( name, 0 ) ); } ! virtual void addItems( vfs *v, bool addUpDir = true ); ! virtual QString getCurrentItem() const; ! virtual void makeItemVisible( const KrViewItem *item ) { ensureItemVisible( dynamic_cast<const QListViewItem*>( item ) ); } ! virtual void setCurrentItem( const QString& name ); ! virtual void updateView() { triggerUpdate(); emit selectionChanged(); } ! virtual void clear(); ! virtual void sort() { KListView::sort(); } ! virtual void setSortMode( SortSpec mode ); ! virtual void prepareForActive(); ! virtual void prepareForPassive(); ! virtual void saveSettings() { KListView::saveLayout( _config, nameInKConfig() ); } ! virtual void restoreSettings() { KListView::restoreLayout( _config, nameInKConfig() ); } ! virtual QString nameInKConfig() { return _nameInKConfig; } ! virtual QString itemToFilename( QListViewItem *it ) { return dynamic_cast<KrViewItem*>( it ) ->name(); } //remove ! signals: ! void executed( QString &name ); ! void itemDescription( QString &desc ); ! void needFocus(); ! void contextMenu( const QPoint &point ); ! void letsDrag( QStringList items, QPixmap icon ); ! void gotDrop( QDropEvent *e ); ! void renameItem( const QString &oldName, const QString &newName ); ! void middleButtonClicked( QListViewItem *item ); ! protected: ! void newColumn( ColumnType type ); ! virtual void keyPressEvent( QKeyEvent *e ); ! virtual void contentsMousePressEvent( QMouseEvent *e ); ! virtual void contentsMouseMoveEvent ( QMouseEvent * e ); ! virtual void contentsWheelEvent( QWheelEvent *e ); ! virtual bool acceptDrag( QDropEvent* e ) const; ! virtual void contentsDropEvent( QDropEvent *e ); ! virtual void contentsDragMoveEvent( QDragMoveEvent *e ); ! virtual void startDrag(); ! virtual bool event( QEvent *e ); ! //virtual void focusOutEvent( QFocusEvent * ); ! protected slots: ! void rename( QListViewItem *item, int c ); ! void slotClicked( QListViewItem *item ); ! void slotDoubleClicked( QListViewItem *item ); ! void slotItemDescription( QListViewItem *item ); ! void slotCurrentChanged( QListViewItem *item ); ! void handleContextMenu( QListViewItem*, const QPoint&, int ); ! virtual void renameCurrentItem(); ! void inplaceRenameFinished( QListViewItem *it, int col ); ! void quickSearch( const QString &, int = 0 ); ! void stopQuickSearch( QKeyEvent* ); ! void handleQuickSearchEvent( QKeyEvent* ); ! void setNameToMakeCurrent( QListViewItem *it ); ! /** ! * used internally to produce the signal middleButtonClicked() ! */ ! void slotMouseClicked( int button, QListViewItem * item, const QPoint & pos, int c ); ! inline void slotExecuted( QListViewItem* i ) { ! QString tmp = dynamic_cast<KrViewItem*>( i ) ->name(); ! emit executed( tmp ); ! } ! public slots: ! void addedVfile( const vfile *vf ); ! void updatedVfile( const vfile *vf ); ! void deletedVfile( const QString &name ); ! ! void refreshColors(); ! ! private: ! ColumnType _columns[ MAX_COLUMNS ]; ! static QString ColumnName[ MAX_COLUMNS ]; ! bool _withIcons, _focused; ! KrViewItem *_currDragItem; ! QString _nameInKConfig; ! bool &_left; ! ! bool singleClicked; ! bool modifierPressed; ! QTime clickTime; ! QListViewItem *clickedItem; ! QTimer renameTimer; }; |
From: Shie E. <er...@us...> - 2004-07-24 23:23:23
|
Update of /cvsroot/krusader/krusader_kde3/krusader/Panel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10711/krusader/Panel Modified Files: krview.h Log Message: support for new refresh mode Index: krview.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/krview.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** krview.h 15 Mar 2004 14:40:29 -0000 1.12 --- krview.h 24 Jul 2004 23:23:14 -0000 1.13 *************** *** 100,103 **** --- 100,109 ---- virtual void renameCurrentItem() = 0; // Rename current item. returns immediatly // also, the following must be implemented (but must be remarked here) + // + // public slots: + // void addedVfile(const vfile *); + // void updatedVfile(const vfile *); + // void deleteVfile(const QString &); + // // signals: // void letsDrag(QStringList items, QPixmap icon); |
From: Karai C. <ck...@us...> - 2004-07-24 20:15:43
|
Update of /cvsroot/krusader/krusader_kde3/krusader/Panel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18405/krusader_kde3/krusader/Panel Modified Files: krdetailedview.cpp krdetailedview.h Log Message: ADDED: two subsequent single click rename (Total Commander rename) Index: krdetailedview.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/krdetailedview.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** krdetailedview.h 23 Jul 2004 23:40:39 -0000 1.28 --- krdetailedview.h 24 Jul 2004 20:15:35 -0000 1.29 *************** *** 36,39 **** --- 36,40 ---- #include <qwidget.h> #include <qtimer.h> + #include <qdatetime.h> #include "krview.h" *************** *** 82,86 **** virtual QString nameInKConfig() { return _nameInKConfig; } virtual QString itemToFilename( QListViewItem *it ) { return dynamic_cast<KrViewItem*>( it ) ->name(); } //remove - virtual void renameCurrentItem(); signals: --- 83,86 ---- *************** *** 98,101 **** --- 98,102 ---- virtual void keyPressEvent( QKeyEvent *e ); virtual void contentsMousePressEvent( QMouseEvent *e ); + virtual void contentsMouseMoveEvent ( QMouseEvent * e ); virtual void contentsWheelEvent( QWheelEvent *e ); virtual bool acceptDrag( QDropEvent* e ) const; *************** *** 103,114 **** --- 104,118 ---- virtual void contentsDragMoveEvent( QDragMoveEvent *e ); virtual void startDrag(); + virtual bool event( QEvent *e ); //virtual void focusOutEvent( QFocusEvent * ); protected slots: void rename(QListViewItem *item, int c); + void slotClicked( QListViewItem *item ); void slotDoubleClicked( QListViewItem *item ); void slotItemDescription( QListViewItem *item ); void slotCurrentChanged( QListViewItem *item ); void handleContextMenu( QListViewItem*, const QPoint&, int ); + virtual void renameCurrentItem(); void inplaceRenameFinished( QListViewItem *it, int col ); void quickSearch(const QString &, int = 0); *************** *** 136,139 **** --- 140,149 ---- QString _nameInKConfig; bool &_left; + + bool singleClicked; + bool modifierPressed; + QTime clickTime; + QListViewItem *clickedItem; + QTimer renameTimer; }; Index: krdetailedview.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/krdetailedview.cpp,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** krdetailedview.cpp 23 Jul 2004 23:40:39 -0000 1.84 --- krdetailedview.cpp 24 Jul 2004 20:15:34 -0000 1.85 *************** *** 77,80 **** --- 77,82 ---- ////////////////////////////////////////////////////////////////////////// + #define CANCEL_TWO_CLICK_RENAME {singleClicked = false;renameTimer.stop();} + QString KrDetailedView::ColumnName[ MAX_COLUMNS ]; *************** *** 116,125 **** connect( this, SIGNAL(executed(QListViewItem*)), this, SLOT(slotExecuted(QListViewItem*))); } else { connect( this, SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( slotDoubleClicked( QListViewItem* ) ) ); } ! #if 0 ! connect( this, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( slotClicked( QListViewItem* ) ) ); ! ! #endif // a change in the selection needs to update totals connect( this, SIGNAL( onItem( QListViewItem* ) ), this, SLOT( slotItemDescription( QListViewItem* ) ) ); --- 118,125 ---- connect( this, SIGNAL(executed(QListViewItem*)), this, SLOT(slotExecuted(QListViewItem*))); } else { + connect( this, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( slotClicked( QListViewItem* ) ) ); connect( this, SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( slotDoubleClicked( QListViewItem* ) ) ); } ! // a change in the selection needs to update totals connect( this, SIGNAL( onItem( QListViewItem* ) ), this, SLOT( slotItemDescription( QListViewItem* ) ) ); *************** *** 212,220 **** connect( panel->quickSearch, SIGNAL( process( QKeyEvent* ) ), this, SLOT( handleQuickSearchEvent( QKeyEvent* ) ) ); ! setFocusPolicy( StrongFocus ); restoreSettings(); refreshColors(); } --- 212,223 ---- connect( panel->quickSearch, SIGNAL( process( QKeyEvent* ) ), this, SLOT( handleQuickSearchEvent( QKeyEvent* ) ) ); ! connect( &renameTimer, SIGNAL( timeout() ), this, SLOT( renameCurrentItem() ) ); ! setFocusPolicy( StrongFocus ); restoreSettings(); refreshColors(); + + CANCEL_TWO_CLICK_RENAME; } *************** *** 400,404 **** --- 403,436 ---- } + void KrDetailedView::slotClicked( QListViewItem *item ) { + if ( !item ) return ; + + if( !modifierPressed ) + { + if( singleClicked && !renameTimer.isActive() ) + { + KConfig *config = KGlobal::config(); + config->setGroup("KDE"); + int doubleClickInterval = config->readNumEntry("DoubleClickInterval", 400); + + int msecsFromLastClick = clickTime.msecsTo( QTime::currentTime() ); + + if( msecsFromLastClick > doubleClickInterval && msecsFromLastClick < 5*doubleClickInterval ) + { + singleClicked = false; + renameTimer.start( doubleClickInterval, true ); + return; + } + } + + CANCEL_TWO_CLICK_RENAME; + singleClicked = true; + clickTime = QTime::currentTime(); + clickedItem = item; + } + } + void KrDetailedView::slotDoubleClicked( QListViewItem *item ) { + CANCEL_TWO_CLICK_RENAME; if ( !item ) return ; *************** *** 413,416 **** --- 445,449 ---- void KrDetailedView::prepareForPassive() { + CANCEL_TWO_CLICK_RENAME; if (renameLineEdit()->isVisible()) renameLineEdit()->clearFocus(); *************** *** 458,461 **** --- 491,495 ---- void KrDetailedView::slotCurrentChanged( QListViewItem * item ) { + CANCEL_TWO_CLICK_RENAME; if ( !item ) return ; *************** *** 464,467 **** --- 498,509 ---- void KrDetailedView::contentsMousePressEvent( QMouseEvent * e ) { + + modifierPressed = false; + if (e->state() & ShiftButton || e->state() & ControlButton || e->state() & AltButton) + { + CANCEL_TWO_CLICK_RENAME; + modifierPressed = true; + } + // stop quick search in case a mouse click occured KConfigGroupSaver grpSvr( _config, "Look&Feel" ); *************** *** 536,539 **** --- 578,588 ---- } + void KrDetailedView::contentsMouseMoveEvent ( QMouseEvent * e ) + { + if( (singleClicked || renameTimer.isActive()) && itemAt( contentsToViewport( e->pos() ) ) != clickedItem ) + CANCEL_TWO_CLICK_RENAME; + KListView::contentsMouseMoveEvent( e ); + } + void KrDetailedView::contentsWheelEvent( QWheelEvent * e ) { if ( !_focused ) *************** *** 707,711 **** if ( e->state() & ControlButton ) // let the panel handle it e->ignore(); ! else { KrViewItem * i = getCurrentKrViewItem(); QString tmp = i->name(); --- 756,760 ---- if ( e->state() & ControlButton ) // let the panel handle it e->ignore(); ! else { KrViewItem * i = getCurrentKrViewItem(); QString tmp = i->name(); *************** *** 986,987 **** --- 1035,1053 ---- } } + + bool KrDetailedView::event( QEvent *e ) + { + modifierPressed = false; + + switch( e->type() ) + { + case QEvent::Timer: + case QEvent::MouseMove: + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + break; + default: + CANCEL_TWO_CLICK_RENAME; + } + KListView::event( e ); + } |
From: Karai C. <ck...@us...> - 2004-07-24 20:15:43
|
Update of /cvsroot/krusader/krusader_kde3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18405/krusader_kde3 Modified Files: ChangeLog Log Message: ADDED: two subsequent single click rename (Total Commander rename) Index: ChangeLog =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/ChangeLog,v retrieving revision 1.258 retrieving revision 1.259 diff -C2 -d -r1.258 -r1.259 *** ChangeLog 23 Jul 2004 23:41:18 -0000 1.258 --- ChangeLog 24 Jul 2004 20:15:34 -0000 1.259 *************** *** 1,3 **** --- 1,4 ---- ====================== + ADDED: Two single click rename (Total Commander rename) ADDED: The 3rd hand of krusader. click the litle arrow below the panel's scrollbar to see.. ADDED: showing suid, sgid and sticky bits in the permissions column |
From: Rafi Y. <ya...@us...> - 2004-07-24 19:09:22
|
Update of /cvsroot/krusader/krusader_kde3/krusader/VFS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9686/krusader/VFS Modified Files: normal_vfs.cpp normal_vfs.h vfs.h Log Message: Partial updates signals instead of full refresh Index: normal_vfs.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/normal_vfs.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** normal_vfs.cpp 23 Jul 2004 17:28:36 -0000 1.26 --- normal_vfs.cpp 24 Jul 2004 19:09:13 -0000 1.27 *************** *** 61,75 **** vfs_type=NORMAL; ! // connect the watcher to vfs_slotDirty ! connect(&watcher,SIGNAL(dirty(const QString&)),this,SLOT(vfs_slotDirty())); // when FAM is active, these two solve a bug where creation/deletion of files isn't reflected ! connect(&watcher,SIGNAL(created(const QString&)),this, SLOT(vfs_slotDirty())); ! connect(&watcher,SIGNAL(deleted(const QString&)),this, SLOT(vfs_slotDirty())); } bool normal_vfs::vfs_refresh(const KURL& origin){ QString path = origin.path(-1); ! // check that the new origin exists if ( !QDir(path).exists() ) return false; --- 61,75 ---- vfs_type=NORMAL; ! // connect the watcher to vfs_slotDirty ! connect(&watcher,SIGNAL(dirty(const QString&)),this,SLOT(vfs_slotDirty(const QString&))); // when FAM is active, these two solve a bug where creation/deletion of files isn't reflected ! connect(&watcher,SIGNAL(created(const QString&)),this, SLOT(vfs_slotCreated(const QString&))); ! connect(&watcher,SIGNAL(deleted(const QString&)),this, SLOT(vfs_slotDeleted(const QString&))); } bool normal_vfs::vfs_refresh(const KURL& origin){ QString path = origin.path(-1); ! // check that the new origin exists if ( !QDir(path).exists() ) return false; *************** *** 79,87 **** watcher.stopScan(); //stop watching the old dir ! if( !origin.equals(vfs_getOrigin()) ){ ! // and remove it from the list ! if( !vfs_getOrigin().isEmpty() ) watcher.removeDir(vfs_getOrigin().path(-1)); ! watcher.addDir(origin.path(-1)); //start watching the new dir ! } // set the writable attribute to true, if that's not the case - the KIO job --- 79,85 ---- watcher.stopScan(); //stop watching the old dir ! // and remove it from the list ! if( !vfs_getOrigin().isEmpty() ) watcher.removeDir(vfs_getOrigin().path(-1)); ! watcher.addDir(origin.path(-1),true); //start watching the new dir // set the writable attribute to true, if that's not the case - the KIO job *************** *** 154,158 **** if (!quietMode) emit startUpdate(); ! watcher.startScan(); return true; --- 152,156 ---- if (!quietMode) emit startUpdate(); ! watcher.startScan(true); return true; *************** *** 267,269 **** --- 265,336 ---- } + vfile* normal_vfs::vfileFromPath(const QString& name){ + QString path = vfs_workingDir().local8Bit()+"/"+name.local8Bit(); + + KDE_struct_stat stat_p; + KDE_lstat(path.local8Bit(),&stat_p); + KIO::filesize_t size = stat_p.st_size; + QString perm = KRpermHandler::mode2QString(stat_p.st_mode); + bool symLink= S_ISLNK(stat_p.st_mode); + if( S_ISDIR(stat_p.st_mode) ) perm[0] = 'd'; + + KURL mimeUrl = fromPathOrURL(path); + QString mime=KMimeType::findByURL( mimeUrl,stat_p.st_mode,true,false)->name(); + + char symDest[256]; + bzero(symDest,256); + if( S_ISLNK(stat_p.st_mode) ){ // who the link is pointing to ? + int endOfName=0; + endOfName=readlink(path.local8Bit(),symDest,256); + if ( endOfName != -1 ){ + if ( QDir(symDest).exists() || mime.contains("directory") ) perm[0] = 'd'; + if ( !QDir(vfs_workingDir()).exists(symDest) ) mime = "Broken Link !"; + } + else kdWarning() << "Failed to read link: "<< path<<endl; + } + + // create a new virtual file object + vfile* temp=new vfile(name,size,perm,stat_p.st_mtime,symLink,stat_p.st_uid, + stat_p.st_gid,mime,symDest,stat_p.st_mode); + return temp; + } + + void normal_vfs::vfs_slotDirty(const QString& path){ + KURL url = fromPathOrURL(path); + if( url.equals(vfs_getOrigin()) ){ + // the directory itself is dirty - full refresh is needed + vfs_refresh(vfs_getOrigin()); + return; + } + + QString name = url.fileName(); + + // do we have it already ? + if( !vfs_search(name ) ) return vfs_slotCreated(path); + + // we have an updated file.. + removeFromList(name); + vfile* vf = vfileFromPath(name); + addToList(vf); + emit updatedVfile(vf); + } + + void normal_vfs::vfs_slotCreated(const QString& path){ + KURL url = fromPathOrURL(path); + QString name = url.fileName(); + vfile* vf = vfileFromPath(name); + addToList(vf); + emit addedVfile(vf); + } + + void normal_vfs::vfs_slotDeleted(const QString& path){ + KURL url = fromPathOrURL(path); + QString name = url.fileName(); + + if( vfs_search(name) ){ + emit deletedVfile(name); + removeFromList(name); + } + } + #include "normal_vfs.moc" Index: normal_vfs.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/normal_vfs.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** normal_vfs.h 23 Jul 2004 17:28:36 -0000 1.12 --- normal_vfs.h 24 Jul 2004 19:09:13 -0000 1.13 *************** *** 73,82 **** /// Re-reads files and stats and fills the vfile list virtual bool vfs_refresh(const KURL& origin); ! /// used by to refresh the VFS with a short delay. ! void vfs_slotDirty(){ QTimer::singleShot(100,this,SLOT(vfs_refresh())); } protected: QDict<vfile> vfs_files; //< List of pointers to vfile KDirWatch watcher; //< The internal dir watcher - use to detect changes in directories }; --- 73,85 ---- /// Re-reads files and stats and fills the vfile list virtual bool vfs_refresh(const KURL& origin); ! ! void vfs_slotDirty(const QString& path); ! void vfs_slotCreated(const QString& path); ! void vfs_slotDeleted(const QString& path); protected: QDict<vfile> vfs_files; //< List of pointers to vfile KDirWatch watcher; //< The internal dir watcher - use to detect changes in directories + vfile* vfileFromPath(const QString& path); }; Index: vfs.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/vfs.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** vfs.h 23 Jul 2004 17:28:36 -0000 1.12 --- vfs.h 24 Jul 2004 19:09:13 -0000 1.13 *************** *** 104,112 **** /// or display a error message if the job fails virtual bool vfs_refresh(KIO::Job* job); - //virtual bool vfs_refresh(KIO::Job* job); virtual bool vfs_refresh(){ return vfs_refresh(vfs_getOrigin()); } signals: void startUpdate(); //< emitted when the VFS starts to refresh its list of vfiles. protected: --- 104,114 ---- /// or display a error message if the job fails virtual bool vfs_refresh(KIO::Job* job); virtual bool vfs_refresh(){ return vfs_refresh(vfs_getOrigin()); } signals: void startUpdate(); //< emitted when the VFS starts to refresh its list of vfiles. + void addedVfile(const vfile* vf); + void deletedVfile(const QString& name); + void updatedVfile(const vfile* vf); protected: *************** *** 118,122 **** inline void addToList(vfile *data){ vfs_filesP->insert(data->vfile_getName(),data); } /// Deletes a vfile from the list. ! inline void removeFromList(vfile *data){ vfs_filesP->remove(data->vfile_getName()); } VFS_TYPE vfs_type; //< the vfs type. --- 120,124 ---- inline void addToList(vfile *data){ vfs_filesP->insert(data->vfile_getName(),data); } /// Deletes a vfile from the list. ! inline void removeFromList(QString name){ vfs_filesP->remove(name); } VFS_TYPE vfs_type; //< the vfs type. |
From: Shie E. <er...@us...> - 2004-07-23 23:41:28
|
Update of /cvsroot/krusader/krusader_kde3/krusader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21055/krusader Modified Files: krslots.cpp krslots.h Log Message: 3rd hand of krusader Index: krslots.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/krslots.cpp,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** krslots.cpp 18 Jul 2004 10:04:25 -0000 1.54 --- krslots.cpp 23 Jul 2004 23:41:18 -0000 1.55 *************** *** 73,76 **** --- 73,77 ---- #include "Splitter/combiner.h" #include "UserMenu/usermenu.h" + #include "Panel/panelpopup.h" #include "Synchronizer/synchronizergui.h" #include "krservices.h" *************** *** 746,748 **** --- 747,766 ---- } + void KRslots::updatePopupPanel(QListViewItem *it) { + // which panel to display on? + ListPanel *lp; + if (ACTIVE_PANEL->popup->isHidden() && + ACTIVE_PANEL->otherPanel->popup->isHidden()) return; + if (ACTIVE_PANEL->popup->isShown()) + lp = ACTIVE_PANEL; + else if (ACTIVE_PANEL->otherPanel->popup->isShown()) + lp = ACTIVE_PANEL->otherPanel; + + KrViewItem *item = dynamic_cast<KrViewItem*>(it); + KURL url; + if (item->name()!="..") // updir + url = ACTIVE_FUNC->files()->vfs_getFile(item->name()); + lp->popup->update(url); + } + #include "krslots.moc" Index: krslots.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/krslots.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** krslots.h 18 Apr 2004 19:25:54 -0000 1.23 --- krslots.h 23 Jul 2004 23:41:18 -0000 1.24 *************** *** 117,121 **** void userMenu(); void slotSynchronizeDirs(); ! // F2 void terminal(); --- 117,121 ---- void userMenu(); void slotSynchronizeDirs(); ! void updatePopupPanel(QListViewItem*); // F2 void terminal(); |
From: Shie E. <er...@us...> - 2004-07-23 23:41:28
|
Update of /cvsroot/krusader/krusader_kde3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21055 Modified Files: Krusader.kdevelop ChangeLog Log Message: 3rd hand of krusader Index: Krusader.kdevelop =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/Krusader.kdevelop,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Krusader.kdevelop 20 Mar 2004 09:27:23 -0000 1.20 --- Krusader.kdevelop 23 Jul 2004 23:41:18 -0000 1.21 *************** *** 143,147 **** <includeTypes>true</includeTypes> <includeEnums>true</includeEnums> ! <includeTypedefs>false</includeTypedefs> <automaticCodeCompletion>true</automaticCodeCompletion> <automaticArgumentsHint>true</automaticArgumentsHint> --- 143,147 ---- <includeTypes>true</includeTypes> <includeEnums>true</includeEnums> ! <includeTypedefs>true</includeTypedefs> <automaticCodeCompletion>true</automaticCodeCompletion> <automaticArgumentsHint>true</automaticArgumentsHint> Index: ChangeLog =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/ChangeLog,v retrieving revision 1.257 retrieving revision 1.258 diff -C2 -d -r1.257 -r1.258 *** ChangeLog 23 Jul 2004 20:44:54 -0000 1.257 --- ChangeLog 23 Jul 2004 23:41:18 -0000 1.258 *************** *** 1,3 **** --- 1,4 ---- ====================== + ADDED: The 3rd hand of krusader. click the litle arrow below the panel's scrollbar to see.. ADDED: showing suid, sgid and sticky bits in the permissions column REACTIVATED: usermenu (now using the new useraction-system) |
Update of /cvsroot/krusader/krusader_kde3/krusader/Panel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20883/krusader/Panel Modified Files: Makefile.am krdetailedview.cpp krdetailedview.h listpanel.cpp listpanel.h Added Files: panelpopup.cpp panelpopup.h Log Message: add: 3rd hand of krusader --- NEW FILE: panelpopup.cpp --- #include "panelpopup.h" #include "listpanel.h" #include <kdebug.h> #include <kfiletreeview.h> #include <klocale.h> #include <qlayout.h> #include <qlabel.h> #include <qheader.h> #include <krview.h> #include <krviewitem.h> #include <qwidgetstack.h> #include <kmultitabbar.h> #include "../kicons.h" PanelPopup::PanelPopup( QWidget *parent ) : QWidget( parent ), stack( 0 ), viewer( 0 ), pjob( 0 ) { QVBoxLayout * layout = new QVBoxLayout( this ); // create the button bar tabbar = new KMultiTabBar( KMultiTabBar::Horizontal, this ); tabbar->appendTab( krLoader->loadIcon( "view_tree", KIcon::Panel ), Tree, "Tree" ); connect( tabbar->tab( Tree ), SIGNAL( clicked( int ) ), this, SLOT( tabSelected( int ) ) ); tabbar->appendTab( krLoader->loadIcon( "folder_image", KIcon::Panel ), Preview, "Preview" ); connect( tabbar->tab( Preview ), SIGNAL( clicked( int ) ), this, SLOT( tabSelected( int ) ) ); // create a widget stack on which to put the parts stack = new QWidgetStack( this ); // create the tree part ---------- tree = new KFileTreeView( stack ); stack->addWidget( tree, Tree ); tree->addColumn( "" ); tree->addBranch( "/", i18n( "Root Folder" ) ); tree->setDirOnlyMode( tree->branch( i18n( "Root Folder" ) ), true ); tree->branch( i18n( "Root Folder" ) ) ->setChildRecurse(false); tree->branch( i18n( "Root Folder" ) ) ->setOpen( true ); tree->header() ->setHidden( true ); connect(tree, SIGNAL(executed(QListViewItem*)), this, SLOT(treeSelection(QListViewItem*))); // start listing the tree tree->branch( i18n( "Root Folder" ) ) ->root(); // create the quickview part ------ viewer = new QLabel( i18n( "No preview available" ), stack ); stack->addWidget( viewer, Preview ); layout->addWidget( tabbar ); layout->addWidget( stack ); // raise the tree part tabbar->setTab( Tree, true ); stack->raiseWidget( Tree ); } PanelPopup::~PanelPopup() {} void PanelPopup::tabSelected( int id ) { // unraise all tabs except selected one and raise the widget for ( int i = Tree; i < Last; ++i ) tabbar->setTab( i, ( i == id ) ); stack->raiseWidget( id ); } // decide which part to update, if at all void PanelPopup::update( KURL url ) { if ( isHidden() ) return ; // failsafe KFileItem *kfi; KFileItemList lst; switch ( stack->id( stack->visibleWidget() ) ) { case Preview: if ( url.isEmpty() ) { dynamic_cast<QLabel*>( stack->widget( Preview ) ) ->setText( i18n( "No preview available" ) ); return ; // in case of a bad url } kfi = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, url ); lst.append( kfi ); if ( pjob ) // stop running jobs delete pjob; pjob = new KIO::PreviewJob( lst, stack->width(), stack->height(), stack->width(), 1, true, true, 0 ); connect( pjob, SIGNAL( gotPreview( const KFileItem*, const QPixmap& ) ), this, SLOT( view( const KFileItem*, const QPixmap& ) ) ); connect( pjob, SIGNAL( failed( const KFileItem* ) ), this, SLOT( failedToView( const KFileItem* ) ) ); break; case Tree: // nothing to do break; } } // called when the preview job got something for us void PanelPopup::view( const KFileItem* kfi, const QPixmap& pix ) { dynamic_cast<QLabel*>( stack->widget( Preview ) ) ->setPixmap( pix ); } // preview job failed here... void PanelPopup::failedToView( const KFileItem* kfi ) { dynamic_cast<QLabel*>( stack->widget( Preview ) ) ->setText( i18n( "No preview available" ) ); } void PanelPopup::treeSelection(QListViewItem*) { emit selection(tree->currentURL()); emit hideMe(); } Index: Makefile.am =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile.am 24 Mar 2004 06:33:54 -0000 1.7 --- Makefile.am 23 Jul 2004 23:40:39 -0000 1.8 *************** *** 6,10 **** libPanel_a_METASOURCES = AUTO ! libPanel_a_SOURCES = krcolorcache.cpp krcalcspacedialog.cpp krpopupmenu.cpp krpreviewpopup.cpp krview.cpp krdetailedviewitem.cpp krdetailedview.cpp panelfunc.cpp listpanel.cpp --- 6,10 ---- libPanel_a_METASOURCES = AUTO ! libPanel_a_SOURCES = krcolorcache.cpp krcalcspacedialog.cpp krpopupmenu.cpp krpreviewpopup.cpp krview.cpp krdetailedviewitem.cpp krdetailedview.cpp panelfunc.cpp listpanel.cpp panelpopup.cpp *************** *** 12,13 **** --- 12,14 ---- ####### kdevelop will overwrite this part!!! (end)############ + noinst_HEADERS = panelpopup.h Index: krdetailedview.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/krdetailedview.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** krdetailedview.h 17 Jun 2004 14:46:20 -0000 1.27 --- krdetailedview.h 23 Jul 2004 23:40:39 -0000 1.28 *************** *** 40,43 **** --- 40,44 ---- class QDragMoveEvent; class KrRenameTimerObject; + class ListPanel; /** *************** *** 57,61 **** Permissions = 0x5, KrPermissions = 0x6, Owner = 0x7, Group = 0x8, Unused = 0x9 }; ! KrDetailedView( QWidget *parent, bool &left, KConfig *cfg = krConfig, const char *name = 0 ); virtual ~KrDetailedView(); virtual int column( ColumnType type ); --- 58,62 ---- Permissions = 0x5, KrPermissions = 0x6, Owner = 0x7, Group = 0x8, Unused = 0x9 }; ! KrDetailedView( QWidget *parent, ListPanel *panel, bool &left, KConfig *cfg = krConfig, const char *name = 0 ); virtual ~KrDetailedView(); virtual int column( ColumnType type ); --- NEW FILE: panelpopup.h --- #ifndef _PANELPOPUP_H #define _PANELPOPUP_H #include <qwidget.h> #include <qpixmap.h> #include <kfileitem.h> #include <qguardedptr.h> #include <kio/previewjob.h> class QLabel; class QWidgetStack; class QListViewItem; class KMultiTabBar; class KFileTreeView; class PanelPopup: public QWidget { Q_OBJECT enum Parts { Tree, Preview, Last=0xFF }; public: PanelPopup( QWidget *parent ); ~PanelPopup(); public slots: void update(KURL url); signals: void selection(const KURL &url); void hideMe(); protected slots: void view( const KFileItem* kfi, const QPixmap& pix ); void failedToView(const KFileItem* kfi); void tabSelected(int id); void treeSelection(QListViewItem*); protected: QWidgetStack *stack; QLabel *viewer; QGuardedPtr<KIO::PreviewJob> pjob; KMultiTabBar *tabbar; KFileTreeView *tree; }; #endif // _PANELPOPUP_H Index: krdetailedview.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/krdetailedview.cpp,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** krdetailedview.cpp 17 Jun 2004 14:46:45 -0000 1.83 --- krdetailedview.cpp 23 Jul 2004 23:40:39 -0000 1.84 *************** *** 79,83 **** QString KrDetailedView::ColumnName[ MAX_COLUMNS ]; ! KrDetailedView::KrDetailedView( QWidget *parent, bool &left, KConfig *cfg, const char *name ) : KListView( parent, name ), KrView( cfg ), _focused( false ), _currDragItem( 0L ), _nameInKConfig( QString( "KrDetailedView" ) + QString( ( left ? "Left" : "Right" ) ) ), _left( left ) { --- 79,83 ---- QString KrDetailedView::ColumnName[ MAX_COLUMNS ]; ! KrDetailedView::KrDetailedView( QWidget *parent, ListPanel *panel, bool &left, KConfig *cfg, const char *name ) : KListView( parent, name ), KrView( cfg ), _focused( false ), _currDragItem( 0L ), _nameInKConfig( QString( "KrDetailedView" ) + QString( ( left ? "Left" : "Right" ) ) ), _left( left ) { *************** *** 202,214 **** this, SLOT( inplaceRenameFinished( QListViewItem*, int ) ) ); connect( this, SIGNAL( renameItem( const QString &, const QString & ) ), ! dynamic_cast<ListPanel*>( parent ) ->func, SLOT( rename( const QString &, const QString & ) ) ); // connect quicksearch ! connect( dynamic_cast<ListPanel*>( parent ) ->quickSearch, SIGNAL( textChanged( const QString& ) ), this, SLOT( quickSearch( const QString& ) ) ); ! connect( dynamic_cast<ListPanel*>( parent ) ->quickSearch, SIGNAL( otherMatching( const QString&, int ) ), this, SLOT( quickSearch( const QString& , int ) ) ); ! connect( dynamic_cast<ListPanel*>( parent ) ->quickSearch, SIGNAL( stop( QKeyEvent* ) ), this, SLOT( stopQuickSearch( QKeyEvent* ) ) ); ! connect( dynamic_cast<ListPanel*>( parent ) ->quickSearch, SIGNAL( process( QKeyEvent* ) ), this, SLOT( handleQuickSearchEvent( QKeyEvent* ) ) ); --- 202,214 ---- this, SLOT( inplaceRenameFinished( QListViewItem*, int ) ) ); connect( this, SIGNAL( renameItem( const QString &, const QString & ) ), ! panel->func, SLOT( rename( const QString &, const QString & ) ) ); // connect quicksearch ! connect( panel->quickSearch, SIGNAL( textChanged( const QString& ) ), this, SLOT( quickSearch( const QString& ) ) ); ! connect( panel->quickSearch, SIGNAL( otherMatching( const QString&, int ) ), this, SLOT( quickSearch( const QString& , int ) ) ); ! connect( panel->quickSearch, SIGNAL( stop( QKeyEvent* ) ), this, SLOT( stopQuickSearch( QKeyEvent* ) ) ); ! connect( panel->quickSearch, SIGNAL( process( QKeyEvent* ) ), this, SLOT( handleQuickSearchEvent( QKeyEvent* ) ) ); Index: listpanel.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/listpanel.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** listpanel.h 22 Jul 2004 09:08:18 -0000 1.19 --- listpanel.h 23 Jul 2004 23:40:39 -0000 1.20 *************** *** 66,69 **** --- 66,70 ---- class DirHistoryButton; class DirHistoryQueue; + class PanelPopup; class ListPanel : public QWidget { *************** *** 114,117 **** --- 115,119 ---- void handleDropOnView( QDropEvent * ); // handles drops on the view only void startDragging( QStringList, QPixmap ); + void togglePanelPopup(); signals: *************** *** 143,147 **** QToolButton *cdUpButton; QToolButton *cdOtherButton; ! BookmarksButton *bookmarksButton; DirHistoryQueue* dirHistoryQueue; --- 145,150 ---- QToolButton *cdUpButton; QToolButton *cdOtherButton; ! QToolButton *popupBtn; ! PanelPopup *popup; BookmarksButton *bookmarksButton; DirHistoryQueue* dirHistoryQueue; Index: listpanel.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Panel/listpanel.cpp,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** listpanel.cpp 22 Jul 2004 13:08:17 -0000 1.68 --- listpanel.cpp 23 Jul 2004 23:40:39 -0000 1.69 *************** *** 38,41 **** --- 38,42 ---- #include <qtimer.h> #include <qregexp.h> + #include <qsplitter.h> // KDE includes #include <kpopupmenu.h> *************** *** 85,88 **** --- 86,90 ---- #include "../GUI/dirhistoryqueue.h" #include "../krservices.h" + #include "panelpopup.h" typedef QValueList<KServiceOffer> OfferList; *************** *** 93,97 **** ListPanel::ListPanel( QWidget *parent, bool &left, const char *name ) : QWidget( parent, name ), colorMask( 255 ), compareMode( false ), currDragItem( 0 ), statsAgent( 0 ), _left( left ), quickSearch( 0 ), ! cdRootButton( 0 ), cdUpButton( 0 ) { func = new ListPanelFunc( this ); --- 95,99 ---- ListPanel::ListPanel( QWidget *parent, bool &left, const char *name ) : QWidget( parent, name ), colorMask( 255 ), compareMode( false ), currDragItem( 0 ), statsAgent( 0 ), _left( left ), quickSearch( 0 ), ! cdRootButton( 0 ), cdUpButton( 0 ), popup(0), popupBtn(0) { func = new ListPanelFunc( this ); *************** *** 129,133 **** "or add subfolder to the list." ) ); ! totals = new KrSqueezedTextLabel( this ); krConfig->setGroup( "Look&Feel" ); totals->setFont( krConfig->readFontEntry( "Filelist Font", _FilelistFont ) ); --- 131,136 ---- "or add subfolder to the list." ) ); ! QHBoxLayout *totalsLayout = new QHBoxLayout(this); ! totals = new KrSqueezedTextLabel( this ); krConfig->setGroup( "Look&Feel" ); totals->setFont( krConfig->readFontEntry( "Filelist Font", _FilelistFont ) ); *************** *** 140,144 **** "how many did you select and the bytes math" ) ); connect( totals, SIGNAL( clicked() ), this, SLOT( slotFocusOnMe() ) ); ! quickSearch = new KrQuickSearch( this ); krConfig->setGroup( "Look&Feel" ); --- 143,156 ---- "how many did you select and the bytes math" ) ); connect( totals, SIGNAL( clicked() ), this, SLOT( slotFocusOnMe() ) ); ! totalsLayout->addWidget(totals); ! ! // a quick button to open the popup panel ! popupBtn = new QToolButton( this, "popupbtn" ); ! popupBtn->setFixedSize( 20, totals ->height() ); ! popupBtn->setPixmap(krLoader->loadIcon("up", KIcon::Panel)); ! connect(popupBtn, SIGNAL(clicked()), this, SLOT(togglePanelPopup())); ! QToolTip::add( popupBtn, i18n( "Open the popup panel" ) ); ! totalsLayout->addWidget(popupBtn); ! quickSearch = new KrQuickSearch( this ); krConfig->setGroup( "Look&Feel" ); *************** *** 190,194 **** setPanelToolbar(); ! view = new KrDetailedView( this, _left, krConfig ); connect( dynamic_cast<KrDetailedView*>( view ), SIGNAL( executed( QString& ) ), func, SLOT( execute( QString& ) ) ); connect( dynamic_cast<KrDetailedView*>( view ), SIGNAL( needFocus() ), this, SLOT( slotFocusOnMe() ) ); --- 202,210 ---- setPanelToolbar(); ! // create a splitter to hold the view and the popup ! QSplitter *splt = new QSplitter(this); ! splt->setOrientation(QObject::Vertical); ! ! view = new KrDetailedView( splt, this, _left, krConfig ); connect( dynamic_cast<KrDetailedView*>( view ), SIGNAL( executed( QString& ) ), func, SLOT( execute( QString& ) ) ); connect( dynamic_cast<KrDetailedView*>( view ), SIGNAL( needFocus() ), this, SLOT( slotFocusOnMe() ) ); *************** *** 199,207 **** connect( dynamic_cast<KrDetailedView*>( view ), SIGNAL( gotDrop( QDropEvent * ) ), this, SLOT( handleDropOnView( QDropEvent * ) ) ); connect( dynamic_cast<KrDetailedView*>( view ), SIGNAL( middleButtonClicked( QListViewItem * ) ), SLOTS, SLOT( newTab( QListViewItem * ) ) ); ! ////////////////////////////// to do connections /////////////////////////////////////////////// // make sure that a focus/path change reflects in the command line and activePanel connect( this, SIGNAL( cmdLineUpdate( QString ) ), SLOTS, SLOT( slotCurrentChanged( QString ) ) ); connect( this, SIGNAL( activePanelChanged( ListPanel * ) ), SLOTS, SLOT( slotSetActivePanel( ListPanel * ) ) ); // finish the layout layout->addMultiCellWidget( hbox, 0, 0, 0, 2 ); --- 215,230 ---- connect( dynamic_cast<KrDetailedView*>( view ), SIGNAL( gotDrop( QDropEvent * ) ), this, SLOT( handleDropOnView( QDropEvent * ) ) ); connect( dynamic_cast<KrDetailedView*>( view ), SIGNAL( middleButtonClicked( QListViewItem * ) ), SLOTS, SLOT( newTab( QListViewItem * ) ) ); ! connect( dynamic_cast<KrDetailedView*>( view ), SIGNAL( currentChanged( QListViewItem* ) ), ! SLOTS, SLOT( updatePopupPanel( QListViewItem* ) ) ); // make sure that a focus/path change reflects in the command line and activePanel connect( this, SIGNAL( cmdLineUpdate( QString ) ), SLOTS, SLOT( slotCurrentChanged( QString ) ) ); connect( this, SIGNAL( activePanelChanged( ListPanel * ) ), SLOTS, SLOT( slotSetActivePanel( ListPanel * ) ) ); + // add a popup + popup = new PanelPopup(splt); + connect(popup, SIGNAL(selection(const KURL&)), SLOTS, SLOT(refresh(const KURL&))); + connect(popup, SIGNAL(hideMe()), this, SLOT(togglePanelPopup())); + popup->hide(); + // finish the layout layout->addMultiCellWidget( hbox, 0, 0, 0, 2 ); *************** *** 209,217 **** layout->addWidget( historyButton, 1, 1 ); layout->addWidget( bookmarksButton, 1, 2 ); ! layout->addMultiCellWidget( dynamic_cast<KrDetailedView*>( view ) ->widget(), 2, 2, 0, 2 ); layout->addMultiCellWidget( quickSearch, 3, 3, 0, 2 ); quickSearch->hide(); ! layout->addMultiCellWidget( totals, 4, 4, 0, 2 ); ! //filter = ALL; } --- 232,240 ---- layout->addWidget( historyButton, 1, 1 ); layout->addWidget( bookmarksButton, 1, 2 ); ! layout->addMultiCellWidget( splt, 2, 2, 0, 2 ); layout->addMultiCellWidget( quickSearch, 3, 3, 0, 2 ); quickSearch->hide(); ! layout->addMultiCellLayout( totalsLayout, 4, 4, 0, 2 ); ! //filter = ALL; } *************** *** 232,235 **** --- 255,268 ---- } + void ListPanel::togglePanelPopup() { + if (popup->isHidden()) { + popup->show(); + popupBtn->setPixmap(krLoader->loadIcon("down", KIcon::Panel)); + } else { + popup->hide(); + popupBtn->setPixmap(krLoader->loadIcon("up", KIcon::Panel)); + } + } + void ListPanel::setPanelToolbar() { krConfig->setGroup( "Look&Feel" ); |
From: Karai C. <ck...@us...> - 2004-07-23 20:45:03
|
Update of /cvsroot/krusader/krusader_kde3/krusader/VFS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19351/krusader_kde3/krusader/VFS Modified Files: krpermhandler.cpp Log Message: ADDED: showing suid, sgid and sticky bits in the permissions column Index: krpermhandler.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/krpermhandler.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** krpermhandler.cpp 18 Jul 2004 08:42:16 -0000 1.12 --- krpermhandler.cpp 23 Jul 2004 20:44:54 -0000 1.13 *************** *** 127,145 **** QString perm ="----------"; ! if( S_ISLNK(m) ) perm[0]='l'; // check for symLink ! if( S_ISDIR(m) ) perm[0]='d'; // check for directory ! ! //ReadUser = 0400, WriteUser = 0200, ExeUser = 0100 ! if(m&0400) perm[1]='r'; ! if(m&0200) perm[2]='w'; ! if(m&0100) perm[3]='x'; ! //ReadGroup = 0040, WriteGroup = 0020, ExeGroup = 0010 ! if(m&0040) perm[4]='r'; ! if(m&0020) perm[5]='w'; ! if(m&0010) perm[6]='x'; ! //ReadOther = 0004, WriteOther = 0002, ExeOther = 0001 ! if(m&0004) perm[7]='r'; ! if(m&0002) perm[8]='w'; ! if(m&0001) perm[9]='x'; return perm; --- 127,148 ---- QString perm ="----------"; ! if( S_ISLNK(m) ) perm[0]='l'; // check for symLink ! if( S_ISDIR(m) ) perm[0]='d'; // check for directory ! ! //ReadUser = 0400, WriteUser = 0200, ExeUser = 0100, Suid = 04000 ! if(m&0400) perm[1]='r'; ! if(m&0200) perm[2]='w'; ! if(m&0100) perm[3]='x'; ! if(m&04000) perm[3]='s'; ! //ReadGroup = 0040, WriteGroup = 0020, ExeGroup = 0010, Gid = 02000 ! if(m&0040) perm[4]='r'; ! if(m&0020) perm[5]='w'; ! if(m&0010) perm[6]='x'; ! if(m&02000) perm[6]='s'; ! //ReadOther = 0004, WriteOther = 0002, ExeOther = 0001, Sticky = 01000 ! if(m&0004) perm[7]='r'; ! if(m&0002) perm[8]='w'; ! if(m&0001) perm[9]='x'; ! if(m&01000) perm[9]='t'; return perm; |
From: Karai C. <ck...@us...> - 2004-07-23 20:45:03
|
Update of /cvsroot/krusader/krusader_kde3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19351/krusader_kde3 Modified Files: ChangeLog Log Message: ADDED: showing suid, sgid and sticky bits in the permissions column Index: ChangeLog =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/ChangeLog,v retrieving revision 1.256 retrieving revision 1.257 diff -C2 -d -r1.256 -r1.257 *** ChangeLog 23 Jul 2004 13:30:35 -0000 1.256 --- ChangeLog 23 Jul 2004 20:44:54 -0000 1.257 *************** *** 1,3 **** --- 1,4 ---- ====================== + ADDED: showing suid, sgid and sticky bits in the permissions column REACTIVATED: usermenu (now using the new useraction-system) ADDED: New useraction-system (partly based on Shies usermenu-prototype) |
From: Rafi Y. <ya...@us...> - 2004-07-23 17:28:46
|
Update of /cvsroot/krusader/krusader_kde3/krusader/VFS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17552/krusader/VFS Modified Files: ftp_vfs.cpp ftp_vfs.h normal_vfs.cpp normal_vfs.h temp_vfs.cpp vfs.cpp vfs.h Log Message: Use QDict instead of QList to hold vfiles. Index: normal_vfs.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/normal_vfs.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** normal_vfs.h 25 Dec 2003 23:56:54 -0000 1.11 --- normal_vfs.h 23 Jul 2004 17:28:36 -0000 1.12 *************** *** 77,81 **** protected: ! QList<vfile> vfs_files; //< List of pointers to vfile KDirWatch watcher; //< The internal dir watcher - use to detect changes in directories }; --- 77,81 ---- protected: ! QDict<vfile> vfs_files; //< List of pointers to vfile KDirWatch watcher; //< The internal dir watcher - use to detect changes in directories }; Index: vfs.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/vfs.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** vfs.h 27 Dec 2003 16:50:17 -0000 1.11 --- vfs.h 23 Jul 2004 17:28:36 -0000 1.12 *************** *** 35,38 **** --- 35,39 ---- #include <qptrlist.h> #include <qobject.h> + #include <qdict.h> // KDE includes #include <kurl.h> *************** *** 79,83 **** virtual bool vfs_isWritable() { return isWritable; } /// Return vfile* or 0 if not found ! vfile* vfs_search(const QString& name); /// The total size of all the files in the VFS, --- 80,84 ---- virtual bool vfs_isWritable() { return isWritable; } /// Return vfile* or 0 if not found ! inline vfile* vfs_search(const QString& name){ return (*vfs_filesP)[name]; } /// The total size of all the files in the VFS, *************** *** 89,98 **** // Return the VFS type. inline VFS_TYPE vfs_getType() { return vfs_type; } - /// Return true if an internal error occurs. - inline bool vfs_error() { return error; } /// Return the first file in the VFS and set the internal iterator to the beginning of the list. ! inline vfile* vfs_getFirstFile(){ return (vfs_filesP->isEmpty()) ? 0 : vfs_filesP->first(); } /// Return the the next file in the list and advance the iterator. ! inline vfile* vfs_getNextFile() { return (vfs_filesP->next()); } // KDE FTP proxy bug correction static KURL fromPathOrURL( const QString &originIn ); --- 90,97 ---- // Return the VFS type. inline VFS_TYPE vfs_getType() { return vfs_type; } /// Return the first file in the VFS and set the internal iterator to the beginning of the list. ! inline vfile* vfs_getFirstFile(){ return (vfileIterator ? vfileIterator->toFirst() : 0); } /// Return the the next file in the list and advance the iterator. ! inline vfile* vfs_getNextFile() { return (vfileIterator ? ++(*vfileIterator) : 0); } // KDE FTP proxy bug correction static KURL fromPathOrURL( const QString &originIn ); *************** *** 112,126 **** protected: /// Add a new vfile to the list. ! inline void addToList(vfile *data){ vfs_filesP->append(data); } /// Deletes a vfile from the list. ! inline void removeFromList(vfile *data){ vfs_filesP->remove(data); } VFS_TYPE vfs_type; //< the vfs type. KURL vfs_origin; //< the path or file the VFS originates from. - QList<vfile>* vfs_filesP; //< Point to a lists of virtual files (vfile). - bool error; //< true if the VFS failed to refresh. bool quietMode; //< if true the vfs won't display error messages or emit signals bool isWritable; //< true if it's writable }; --- 111,131 ---- protected: + /// Set the vfile list pointer + void setVfsFilesP(QDict<vfile>* dict); + /// clear and delete all current vfiles + inline void clear(){ vfs_filesP->clear(); } /// Add a new vfile to the list. ! inline void addToList(vfile *data){ vfs_filesP->insert(data->vfile_getName(),data); } /// Deletes a vfile from the list. ! inline void removeFromList(vfile *data){ vfs_filesP->remove(data->vfile_getName()); } VFS_TYPE vfs_type; //< the vfs type. KURL vfs_origin; //< the path or file the VFS originates from. bool quietMode; //< if true the vfs won't display error messages or emit signals bool isWritable; //< true if it's writable + + private: + QDict<vfile>* vfs_filesP; //< Point to a lists of virtual files (vfile). + QDictIterator<vfile>* vfileIterator; //< Point to a dictionary of virtual files (vfile). }; Index: normal_vfs.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/normal_vfs.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** normal_vfs.cpp 16 May 2004 16:01:13 -0000 1.25 --- normal_vfs.cpp 23 Jul 2004 17:28:36 -0000 1.26 *************** *** 57,61 **** normal_vfs::normal_vfs(QObject* panel):vfs(panel){ ! vfs_filesP = &vfs_files; vfs_files.setAutoDelete(true); --- 57,61 ---- normal_vfs::normal_vfs(QObject* panel):vfs(panel){ ! setVfsFilesP(&vfs_files); vfs_files.setAutoDelete(true); *************** *** 99,103 **** vfs_origin.cleanPath(); // clear the the list ! vfs_files.clear(); DIR* dir = opendir(path.local8Bit()); --- 99,103 ---- vfs_origin.cleanPath(); // clear the the list ! clear(); DIR* dir = opendir(path.local8Bit()); Index: ftp_vfs.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/ftp_vfs.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ftp_vfs.cpp 17 Jun 2004 14:33:05 -0000 1.32 --- ftp_vfs.cpp 23 Jul 2004 17:28:36 -0000 1.33 *************** *** 57,61 **** isWritable = true; ! vfs_filesP = &vfs_files; vfs_files.setAutoDelete(true); --- 57,61 ---- isWritable = true; ! setVfsFilesP(&vfs_files); vfs_files.setAutoDelete(true); *************** *** 121,131 **** if( job && job->error()){ // we failed to refresh // display error message if ( !quietMode ) job->showErrorDialog(krApp); - error = true; } else { // if we got so far - so good - error = false; // tell the panel to refresh if (!quietMode) { --- 121,130 ---- if( job && job->error()){ // we failed to refresh + listError = false; // display error message if ( !quietMode ) job->showErrorDialog(krApp); } else { // if we got so far - so good // tell the panel to refresh if (!quietMode) { *************** *** 158,163 **** bool ftp_vfs::vfs_refresh(const KURL& origin) { - error = false; - QString errorMsg = QString::null; if ( !origin.isValid() ) --- 157,160 ---- *************** *** 168,172 **** if( !errorMsg.isEmpty() ){ if (!quietMode) KMessageBox::sorry(krApp, errorMsg); - error = true; return false; } --- 165,168 ---- *************** *** 175,182 **** // clear the the list and back up out current situation ! vfs_files.clear(); vfs_origin = origin; //QTimer::singleShot( 0,this,SLOT(startLister()) ); startLister(); --- 171,179 ---- // clear the the list and back up out current situation ! clear(); vfs_origin = origin; //QTimer::singleShot( 0,this,SLOT(startLister()) ); + listError = false; startLister(); *************** *** 186,190 **** } ! if( error ) return false; return true; --- 183,187 ---- } ! if( listError ) return false; return true; Index: ftp_vfs.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/ftp_vfs.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ftp_vfs.h 30 May 2004 14:43:20 -0000 1.10 --- ftp_vfs.h 23 Jul 2004 17:28:36 -0000 1.11 *************** *** 78,85 **** protected: ! QList<vfile> vfs_files; //< List of pointers to vfile. KURL origin_backup; //< used to backup the old URL when refreshing to a new one, bool busy; }; --- 78,86 ---- protected: ! QDict<vfile> vfs_files; //< List of pointers to vfile. KURL origin_backup; //< used to backup the old URL when refreshing to a new one, bool busy; + bool listError; }; Index: vfs.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/vfs.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** vfs.cpp 30 Jun 2004 19:11:34 -0000 1.10 --- vfs.cpp 23 Jul 2004 17:28:36 -0000 1.11 *************** *** 37,41 **** #include "../krusader.h" ! vfs::vfs(QObject* panel, bool quiet): error(false),quietMode(quiet){ if ( panel ){ connect(this,SIGNAL(startUpdate()),panel,SLOT(slotStartUpdate())); --- 37,41 ---- #include "../krusader.h" ! vfs::vfs(QObject* panel, bool quiet): quietMode(quiet),vfileIterator(0){ if ( panel ){ connect(this,SIGNAL(startUpdate()),panel,SLOT(slotStartUpdate())); *************** *** 57,70 **** } - vfile* vfs::vfs_search(const QString& name){ - vfile* temp = vfs_getFirstFile(); - - while (temp!=0){ - if (temp->vfile_getName()==name) return temp; - temp=vfs_getNextFile(); - } - return 0; - } - bool vfs::vfs_refresh(KIO::Job* job){ if(job && job->error()){ --- 57,60 ---- *************** *** 112,153 **** } ! #if 0 ! QString vfs::round(int i){ ! QString t; ! t.sprintf("%d",i); ! if(i<10) t=("0"+t); ! return t; ! } ! ! QString vfs::month2Qstring(QString month){ ! if(month.lower() == "jan" ) return QString("01"); ! if(month.lower() == "feb" ) return QString("02"); ! if(month.lower() == "mar" ) return QString("03"); ! if(month.lower() == "apr" ) return QString("04"); ! if(month.lower() == "may" ) return QString("05"); ! if(month.lower() == "jun" ) return QString("06"); ! if(month.lower() == "jul" ) return QString("07"); ! if(month.lower() == "aug" ) return QString("08"); ! if(month.lower() == "sep" ) return QString("09"); ! if(month.lower() == "oct" ) return QString("10"); ! if(month.lower() == "nov" ) return QString("11"); ! if(month.lower() == "dec" ) return QString("12"); ! return QString("00"); ! } ! ! // create a easy to read date-time format ! QString vfs::dateTime2QString(const QDateTime& datetime){ ! QString dateTime; ! QDate date = datetime.date(); ! QTime time = datetime.time(); ! ! // construct the string ! dateTime=round(date.day())+"/"+round(date.month())+ ! "/"+round(date.year()%100)+ ! +" "+round(time.hour())+":"+round(time.minute()); ! return dateTime; } - #endif - #include "vfs.moc" --- 102,110 ---- } ! void vfs::setVfsFilesP(QDict<vfile>* dict){ ! vfs_filesP=dict; ! if( vfileIterator ) delete vfileIterator; ! vfileIterator = new QDictIterator<vfile>(*dict); } #include "vfs.moc" Index: temp_vfs.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/temp_vfs.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** temp_vfs.cpp 7 Feb 2004 12:56:09 -0000 1.7 --- temp_vfs.cpp 23 Jul 2004 17:28:36 -0000 1.8 *************** *** 44,61 **** normal_vfs(panel){ vfs_type=TEMP; ! // first we need to create a temp diretory ! tmpDir = krApp->getTempDir(); ! if( tmpDir.isEmpty() ){ ! error = true; ! return; ! } ! ! // then we must get the files from the origin to the tmp dir if( type == "-arj" || type == "-ace" ) handleAceArj(origin,type); else if( type == "-rpm" ) handleRpm(origin); ! else if( type == "-iso" ) handleIso(origin); ! else{ ! if (!quietMode) KMessageBox::error(krApp,"Unknown temp_vfs type."); ! error = true; return; } --- 44,55 ---- normal_vfs(panel){ vfs_type=TEMP; ! // first we need to create a temp diretory ! tmpDir = krApp->getTempDir(); ! // then we must get the files from the origin to the tmp dir if( type == "-arj" || type == "-ace" ) handleAceArj(origin,type); else if( type == "-rpm" ) handleRpm(origin); ! else if( type == "-iso" ) handleIso(origin); ! else{ ! if (!quietMode) KMessageBox::error(krApp,"Unknown temp_vfs type."); return; } *************** *** 102,110 **** if( !KRarcHandler::arcHandled(type) ){ if (!quietMode) KMessageBox::error(krApp,"This archive type is NOT supported"); - error = true; return; } else if( !KRarcHandler::unpack(origin,type,tmpDir) ){ - error = true; return; } --- 96,102 ---- |
From: Jonas B. <jb...@us...> - 2004-07-23 13:30:45
|
Update of /cvsroot/krusader/krusader_kde3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9266 Modified Files: ChangeLog Log Message: REACTIVATED: usermenu (now using the new useraction-system) Index: ChangeLog =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/ChangeLog,v retrieving revision 1.255 retrieving revision 1.256 diff -C2 -d -r1.255 -r1.256 *** ChangeLog 23 Jul 2004 00:34:42 -0000 1.255 --- ChangeLog 23 Jul 2004 13:30:35 -0000 1.256 *************** *** 1,3 **** --- 1,4 ---- ====================== + REACTIVATED: usermenu (now using the new useraction-system) ADDED: New useraction-system (partly based on Shies usermenu-prototype) FIXED: [ 946567 ] krusader minimizes to tray on desktop change |
From: Jonas B. <jb...@us...> - 2004-07-23 13:30:44
|
Update of /cvsroot/krusader/krusader_kde3/krusader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9266/krusader Modified Files: krusader.cpp Log Message: REACTIVATED: usermenu (now using the new useraction-system) Index: krusader.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/krusader.cpp,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** krusader.cpp 23 Jul 2004 00:03:17 -0000 1.74 --- krusader.cpp 23 Jul 2004 13:30:35 -0000 1.75 *************** *** 489,493 **** actUserMenu = new KAction( i18n( "User Menu" ), ALT + Key_QuoteLeft, SLOTS, SLOT( userMenu() ), actionCollection(), "user menu" ); ! actUserMenu->setEnabled(false); // and at last we can set the tool-tips actSelect->setToolTip( i18n( "Highlight files by using a filter" ) ); --- 489,493 ---- actUserMenu = new KAction( i18n( "User Menu" ), ALT + Key_QuoteLeft, SLOTS, SLOT( userMenu() ), actionCollection(), "user menu" ); ! // and at last we can set the tool-tips actSelect->setToolTip( i18n( "Highlight files by using a filter" ) ); |
From: Jonas B. <jb...@us...> - 2004-07-23 00:34:53
|
Update of /cvsroot/krusader/krusader_kde3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2000 Modified Files: ChangeLog Log Message: ADDED: New useraction-system (partly based on Shies usermenu-prototype) Index: ChangeLog =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/ChangeLog,v retrieving revision 1.254 retrieving revision 1.255 diff -C2 -d -r1.254 -r1.255 *** ChangeLog 22 Jul 2004 15:58:38 -0000 1.254 --- ChangeLog 23 Jul 2004 00:34:42 -0000 1.255 *************** *** 1,3 **** --- 1,4 ---- ====================== + ADDED: New useraction-system (partly based on Shies usermenu-prototype) FIXED: [ 946567 ] krusader minimizes to tray on desktop change FIXED: mountman changes... read the email ;-) |
Update of /cvsroot/krusader/krusader_kde3/krusader/UserMenu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29725/krusader/UserMenu Modified Files: Makefile.am usermenu.cpp usermenu.h Added Files: usermenuadd.cpp usermenuadd.h Removed Files: usermenuadd.ui usermenuaddimpl.cpp usermenuaddimpl.h Log Message: initial import of the new useraction-system Index: Makefile.am =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/UserMenu/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 26 Dec 2003 13:28:14 -0000 1.2 --- Makefile.am 23 Jul 2004 00:03:19 -0000 1.3 *************** *** 6,13 **** libUserMenu_a_METASOURCES = AUTO ! libUserMenu_a_SOURCES = usermenuaddimpl.cpp usermenuadd.ui usermenu.cpp ! EXTRA_DIST = usermenu.cpp usermenu.h usermenuadd.ui usermenuaddimpl.cpp usermenuaddimpl.h ####### kdevelop will overwrite this part!!! (end)############ --- 6,13 ---- libUserMenu_a_METASOURCES = AUTO ! libUserMenu_a_SOURCES = usermenuadd.cpp usermenu.cpp ! #EXTRA_DIST = usermenu.cpp usermenu.h ####### kdevelop will overwrite this part!!! (end)############ --- usermenuaddimpl.h DELETED --- --- usermenuadd.ui DELETED --- --- NEW FILE: usermenuadd.h --- (This appears to be a binary file; contents omitted.) Index: usermenu.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/UserMenu/usermenu.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** usermenu.cpp 7 Feb 2004 12:43:29 -0000 1.16 --- usermenu.cpp 23 Jul 2004 00:03:19 -0000 1.17 *************** *** 16,215 **** ***************************************************************************/ - #include "usermenu.h" - #include "usermenuaddimpl.h" - #include "../krusaderview.h" - #include "../krusader.h" - #include "../defaults.h" - #include "../Panel/listpanel.h" - #include "../Panel/panelfunc.h" #include <kdebug.h> - #include <kstandarddirs.h> #include <klocale.h> - #include <qvbox.h> - #include <kurl.h> - - /** - - Command: %xYYY% - x - can be either 'a' for active panel, or 'o' for other panel - YYY - the specific command - - For example: - %ap% - active panel path - %op% - other panel path - - In the following commands, we'll use '_' instead of 'a'/'o'. Please substitute as needed. - - %_p% - panel path - %_anf% - number of files - %_and% - number of folders - %_an% - number of files and folders - %_fm% - filter mask (for example: *, *.cpp, *.h etc.) - %_c% - current file (or folder). Note: current != selected - %_s% - selected files and folders - %_afd% - all files and folders - %_af% - all files (not including folders) - %_ad% - all folders (not including files) - - */ - UMCmd UserMenu::expressions[ UserMenu::numOfExps ] = { - {"%_p%", i18n("panel's path"), exp_p}, - {"%_anf%", i18n("no. of files"), exp_anf}, - {"%_and%", i18n("no. of folders"), exp_and}, - {"%_an%", i18n("no. of files and folders"), exp_an}, - {"%_fm%", i18n("filter mask (*.h, *.cpp ...)"), exp_fm}, - {"%_c%", i18n("current file (!= selected file)"), exp_c}, - {"%_s%", i18n("selected files and folders"), exp_s}, - {"%_afd%", i18n("all files and folders"), exp_afd}, - {"%_af%", i18n("all files (not folders)"), exp_af}, - {"%_ad%", i18n("all folders (not files)"), exp_ad} - }; - - #define ACTIVE krApp->mainView->activePanel - #define OTHER krApp->mainView->activePanel->otherPanel - #define GETPANEL (str.lower()[1]=='a' ? ACTIVE : OTHER) ! ///////// expander functions ////////////////////////////////////////////////////////// ! QString UserMenu::exp_p( const QString& str, const bool& useUrl ) { ! if (useUrl) return GETPANEL->func->files()->vfs_getOrigin().url(); ! else return GETPANEL->func->files()->vfs_getOrigin().path(); ! } ! ! QString UserMenu::exp_anf( const QString& str, const bool& ) { ! return QString("%1").arg(GETPANEL->view->numFiles()); ! } ! ! QString UserMenu::exp_and( const QString& str, const bool& ) { ! return QString("%1").arg(GETPANEL->view->numDirs()); ! } ! ! QString UserMenu::exp_an( const QString& str, const bool& ) { ! return QString("%1").arg(GETPANEL->view->numDirs()+GETPANEL->view->numFiles()); ! } ! ! QString UserMenu::exp_fm( const QString& str, const bool& ) { ! return GETPANEL->view->filterMask(); ! } ! ! QString UserMenu::exp_c( const QString& str, const bool& useUrl ) { ! KURL url = GETPANEL->func->files()->vfs_getFile(GETPANEL->view->getCurrentItem()); ! if (useUrl) return url.url(); ! else return url.path(); ! } ! ! // items are separated by ';' ! QString UserMenu::exp_s( const QString& str, const bool& useUrl ) { ! // get selected items from view ! QStringList items; ! GETPANEL->view->getSelectedItems(&items); ! // translate to urls using vfs ! KURL::List* list = GETPANEL->func->files()->vfs_getFiles(&items); ! // parse everything to a single qstring ! QString result; ! for (KURL::List::Iterator it = list->begin(); it != list->end(); it++) ! result += ((useUrl ? (*it).url() : (*it).path()) + ';'); ! ! return result; ! } ! ! // items are separated by ';' ! QString UserMenu::exp_afd( const QString& str, const bool& useUrl ) { ! // get all items ! QStringList items; ! GETPANEL->view->getItemsByMask("*", &items); ! // translate to urls using vfs ! KURL::List* list = GETPANEL->func->files()->vfs_getFiles(&items); ! // parse everything to a single qstring ! QString result; ! for (KURL::List::Iterator it = list->begin(); it != list->end(); it++) ! result += ((useUrl ? (*it).url() : (*it).path()) + ';'); ! ! return result; ! } ! ! // items are separated by ';' ! QString UserMenu::exp_af( const QString& str, const bool& useUrl ) { ! // get all items ! QStringList items; ! GETPANEL->view->getItemsByMask("*", &items, false, true); ! // translate to urls using vfs ! KURL::List* list = GETPANEL->func->files()->vfs_getFiles(&items); ! // parse everything to a single qstring ! QString result; ! for (KURL::List::Iterator it = list->begin(); it != list->end(); it++) ! result += ((useUrl ? (*it).url() : (*it).path()) + ';'); ! ! return result; ! } ! ! // items are separated by ';' ! QString UserMenu::exp_ad( const QString& str, const bool& useUrl ) { ! // get all items ! QStringList items; ! GETPANEL->view->getItemsByMask("*", &items, true, false); ! // translate to urls using vfs ! KURL::List* list = GETPANEL->func->files()->vfs_getFiles(&items); ! // parse everything to a single qstring ! QString result; ! for (KURL::List::Iterator it = list->begin(); it != list->end(); it++) ! result += ((useUrl ? (*it).url() : (*it).path()) + ';'); ! ! return result; ! } - ////////// end of expander functions ///////////////////////////////////////////////// void UserMenu::exec() { ! // execute menu and wait for selection ! UserMenuEntry cmd = _popup->run(); ! ! // replace %% and prepare string ! cmd.cmdline = expand( cmd.cmdline, cmd.acceptURLs ); ! //kdWarning() << cmd << endl; ! ! // ............... run the cmd from the shell ............. ! //QString save = getcwd( 0, 0 ); ! //===> chdir( panelPath.local8Bit() ); // run the command in the panel's path ! ! // run in terminal ! //proc.setUseShell(true); ! //proc << "konsole" << "--noclose" << "-e" << cmd; ! //proc.start( KProcess::DontCare ); ! ! UserMenuProc *proc = new UserMenuProc( cmd.execType, cmd.separateStderr); ! proc->start( cmd.cmdline ); ! //===> chdir( save.local8Bit() ); // chdir back ! } ! ! QString UserMenu::expand( QString str, bool useUrl ) { ! QString result = QString::null, exp = QString::null; ! int beg, end, i; ! unsigned int idx = 0; ! while ( idx < str.length() ) { ! if ( ( beg = str.find( '%', idx ) ) == -1 ) break; ! if ( ( end = str.find( '%', beg + 1 ) ) == -1 ) { ! kdWarning() << "Error: unterminated % in UserMenu::expand" << endl; ! return QString::null; ! } ! result += str.mid( idx, beg - idx ); // copy until the start of %exp% ! ! // get the expression, and expand it using the correct expander function ! // ... replace first char with _ to ease the checking ! exp = str.mid( beg, end - beg + 1 ); ! for ( i = 0; i < numOfExps; ++i ) ! if ( str.mid( beg, end - beg + 1 ).replace( 1, 1, '_' ) == expressions[ i ].expression ) { ! result += ( expressions[ i ].expFunc ) ( exp, useUrl ); ! break; ! } ! if ( i == numOfExps ) { // didn't find an expander ! kdWarning() << "Error: unrecognized " << exp << " in UserMenu::expand" << endl; ! return QString::null; ! } ! idx = end + 1; ! } ! // copy the rest of the string ! result += str.mid( idx ); ! ! return result; } --- 16,32 ---- ***************************************************************************/ #include <kdebug.h> #include <klocale.h> ! #include "../krusader.h" ! #include "../UserAction/kraction.h" ! #include "../UserAction/useraction.h" ! #include "../UserAction/useractionxml.h" ! #include "usermenu.h" ! #include "usermenuadd.h" void UserMenu::exec() { ! _popup->run(); } *************** *** 218,256 **** } ! ////////////////////////////////////////////////////////////////////////////////////////////////////// ! ////////////////////////////////////////////////////////////////////////////////////////////////////// ! ////////////////////////////////////////////////////////////////////////////////////////////////////// ! ! UserMenuEntry::UserMenuEntry(QString data) { ! // the data should look like: ! // {name,cmdline,execType,separateStderr,acceptURLs,showEverywhere,showIn} ! // name ! int sidx = data.find('{') + 1; ! int eidx = data.find(',', sidx); ! name = data.mid(sidx, eidx-sidx); ! // cmdline ! sidx = eidx+1; ! eidx = data.find(',', sidx); ! cmdline = data.mid(sidx, eidx-sidx); ! // execType ! sidx = eidx+1; ! eidx = data.find(',', sidx); ! execType = (UserMenuProc::ExecType)data.mid(sidx, eidx-sidx).toInt(); ! // separateStderr ! sidx = eidx+1; ! eidx = data.find(',', sidx); ! separateStderr = data.mid(sidx, eidx-sidx).toInt(); ! // acceptUrls ! sidx = eidx+1; ! eidx = data.find(',', sidx); ! acceptURLs = data.mid(sidx, eidx-sidx).toInt(); ! // showEverywhere ! sidx = eidx+1; ! eidx = data.find(',', sidx); ! showEverywhere = data.mid(sidx, eidx-sidx).toInt(); ! // showIn ! sidx = eidx+1; ! eidx = data.find('}', sidx); ! showIn = QStringList::split(";", data.mid(sidx, eidx-sidx)); } --- 35,40 ---- } ! void UserMenu::update() { ! _popup->createMenu(); } *************** *** 263,274 **** // create the 'add entry' gui ! _addgui = new UserMenuAddImpl(menu, this); ! connect(_addgui, SIGNAL(newEntry(QString, QString, UserMenuProc::ExecType, bool, bool, bool, QStringList )), ! this, SLOT(addEntry(QString, QString, UserMenuProc::ExecType, bool, bool, bool, QStringList ))); } void UserMenuGui::createMenu() { clear(); ! insertTitle( "User Menu" ); // read entries from config file. --- 47,58 ---- // create the 'add entry' gui ! _addgui = new UserMenuAdd(this); ! connect( _addgui, SIGNAL( newEntry( UserActionProperties* ) ), this, SLOT( addEntry( UserActionProperties* ) ) ); } void UserMenuGui::createMenu() { + // kdDebug() << "UserMenuGui::createMenu called" << endl; clear(); ! insertTitle( i18n("User Menu") ); // read entries from config file. *************** *** 277,281 **** // add the "add new entry" command insertSeparator(); ! insertItem( "Add new entry", 0 ); } --- 61,65 ---- // add the "add new entry" command insertSeparator(); ! insertItem( i18n("Add new entry"), 0 ); } *************** *** 283,450 **** // Note: entries are marked 1..n, so that entry 0 is always // available. It is used by the "add new entry" command. - QString filename = locateLocal( "data", "krusader/krusermenu.dat" ); - _entries.clear(); int idx = 1; ! QFile file( filename ); ! if ( file.open( IO_ReadOnly ) ) { ! QTextStream stream( &file ); ! QString line; - while ( !stream.atEnd() ) { - line = stream.readLine(); - if (!line.simplifyWhiteSpace().isEmpty()) - _entries.append(UserMenuEntry(line)); - insertItem( _entries.last().name, idx++ ); - } - file.close(); - } } ! UserMenuEntry UserMenuGui::run() { ! // disable the entries that should not appear in this folder ! for (uint i=1; i<count(); ++i) { ! if (_entries[i-1].showEverywhere) ! setItemVisible(i, true); // enable the item, it is displayed everywhere ! else { // see if the current path is in the listpanel ! bool showHere = false; ! QString currentPath = ACTIVE->func->files()->vfs_getOrigin().path(); ! for ( QStringList::Iterator it = _entries[i-1].showIn.begin(); ! it != _entries[i-1].showIn.end(); ! ++it ) { ! // is the folder == current path? (don't forget to remove trailing /s ! if (currentPath == ((*it).right(1)=="/" ? (*it).left((*it).length()-1) : (*it))) { ! showHere = true; ! break; ! } ! } ! setItemVisible(i, showHere); ! } ! } ! int idx = exec(); ! if ( idx == -1 ) return QString::null; // nothing was selected if ( idx == 0 ) { _addgui->exec(); ! return QString::null; } - - // don't forget: index 0 is reserved for the 'add entry' command. that's why - // the entries is 0..n-1 and actual menu is 1..n - return _entries[idx-1]; } ! void UserMenuGui::addEntry(QString name, QString cmdline, UserMenuProc::ExecType execType, bool separateStderr, ! bool acceptURLs, bool showEverywhere, QStringList showIn) { ! // save a new entry in the following form: ! // {"name","cmdline",execType,separateStderr,acceptURLs,showEverywhere,showIn} ! QString filename = locateLocal( "data", "krusader/krusermenu.dat" ); ! QFile file( filename ); ! if ( file.open( IO_WriteOnly | IO_Append ) ) { ! QTextStream stream( &file ); ! QString line = QString("{%1,%2,%3,%4,%5,%6,%7}").arg(name) ! .arg(cmdline) ! .arg(execType) ! .arg(separateStderr) ! .arg(acceptURLs) ! .arg(showEverywhere) ! .arg(showIn.join(";")); ! stream << line << endl; ! file.close(); ! } // update the menu, by re-reading the entries createMenu(); } - ////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////////////////////////////////// - - UserMenuProcDlg::UserMenuProcDlg( QString caption, bool enableStderr, QWidget *parent ) : - KDialogBase( parent, 0, false, caption, KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Cancel ) { - - setButtonOKText( "Close", i18n( "Close this window" ) ); - enableButtonOK( false ); // disable the close button, until the process finishes - - setButtonCancelText( "Kill", i18n( "Kill the running process" ) ); - - QVBox *page = makeVBoxMainWidget(); - // do we need to separate stderr and stdout? - if ( enableStderr ) { - // create stdout - new QLabel( i18n( "Standard Output (stdout)" ), page ); - _stdout = new QTextEdit( page ); - _stdout->setReadOnly( true ); - _stdout->setMinimumWidth( fontMetrics().maxWidth() * 40 ); - // create stderr - new QLabel( i18n( "Standard Error (stderr)" ), page ); - _stderr = new QTextEdit( page ); - _stderr->setReadOnly( true ); - _stderr->setMinimumWidth( fontMetrics().maxWidth() * 40 ); - } else { - // create stdout - new QLabel( i18n( "Output" ), page ); - _stdout = new QTextEdit( page ); - _stdout->setReadOnly( true ); - _stdout->setMinimumWidth( fontMetrics().maxWidth() * 40 ); - } - } - - void UserMenuProcDlg::addStderr( KProcess *proc, char *buffer, int buflen ) { - _stderr->append( QString::fromLatin1( buffer, buflen ) ); - } - - void UserMenuProcDlg::addStdout( KProcess *proc, char *buffer, int buflen ) { - _stdout->append( QString::fromLatin1( buffer, buflen ) ); - } - - ////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////////////////////////////////// - - - UserMenuProc::UserMenuProc( ExecType execType, bool enableStderr ) : QObject(), _execType( execType ), - _enableStderr( enableStderr ), _proc( new KProcess() ), _output( 0 ) { - _proc->setUseShell( true ); - - connect( _proc, SIGNAL( processExited( KProcess* ) ), - this, SLOT( processExited( KProcess* ) ) ) ; - } - - - UserMenuProc::~UserMenuProc() { - delete _proc; - } - - bool UserMenuProc::start( QString cmdLine ) { - _proc->clearArguments(); - - // run in terminal or in custom-window - if ( _execType == Terminal ) { - ( *_proc ) << "konsole" << "--noclose" << "-e" << cmdLine; - } else if ( _execType == OutputOnly ) { // output only - collect output - ( *_proc ) << cmdLine; - _output = new UserMenuProcDlg( cmdLine, _enableStderr ); - // connect the output to the dialog - connect( _proc, SIGNAL( receivedStderr( KProcess*, char*, int ) ), - _output, SLOT( addStderr( KProcess*, char *, int ) ) ); - connect( _proc, SIGNAL( receivedStdout( KProcess*, char*, int ) ), - _output, SLOT( addStdout( KProcess*, char *, int ) ) ); - connect( _output, SIGNAL( cancelClicked() ), this, SLOT( kill() ) ); - _output->show(); - } else { // no terminal, no output collection - ( *_proc ) << cmdLine; - } - return _proc->start( KProcess::NotifyOnExit, ( KProcess::Communication ) ( KProcess::Stdout | KProcess::Stderr ) ); - } - - void UserMenuProc::processExited( KProcess *proc ) { - // enable the 'close' button on the dialog (if active), disable 'kill' button - if ( _output ) { - _output->enableButtonOK( true ); - _output->enableButtonCancel( false); - } - delete this; // banzai!! - } --- 67,102 ---- // Note: entries are marked 1..n, so that entry 0 is always // available. It is used by the "add new entry" command. int idx = 1; ! //FIXME: don't plug ALL useractions into the usermenu. TODO: read the usermenu-strukture from an other file (krusaderrc ?) ! for ( UserAction::KrActionList::iterator it = krUserAction->actionList()->begin(); it != krUserAction->actionList()->end(); ++it ) ! ( *it )->plug( this, idx++ ); } ! void UserMenuGui::run() { ! //disable unwanted actions: ! krApp->userAction->setAvailability(); int idx = exec(); ! if ( idx == -1 ) // nothing was selected ! return; if ( idx == 0 ) { _addgui->exec(); ! return; } } ! void UserMenuGui::addEntry( UserActionProperties *properties ) { ! //kdDebug() << "UserMenuGui::addEntry called" << endl; ! // add the new action to the xml ! krUserAction->xml()->addActionToDom( properties ); ! krUserAction->xml()->writeActionDom(); ! krUserAction->addKrAction( properties ); ! // update the menu, by re-reading the entries createMenu(); + //kdDebug() << "UserMenuGui::addEntry finished" << endl; } Index: usermenu.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/UserMenu/usermenu.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** usermenu.h 10 Jan 2004 16:33:57 -0000 1.13 --- usermenu.h 23 Jul 2004 00:03:19 -0000 1.14 *************** *** 19,73 **** #define USERMENU_H - #include <qwidget.h> #include <kpopupmenu.h> - #include <qstringlist.h> - #include <kaction.h> - #include <kprocess.h> - #include <kdialogbase.h> - #include <qtextedit.h> - #include <qvaluelist.h> ! class KDialogBase; ! class UserMenuAddImpl; class UserMenu; - class UserMenuEntry; - - class UserMenuProcDlg: public KDialogBase { - Q_OBJECT - public: - UserMenuProcDlg( QString caption, bool enableStderr = false, QWidget *parent = 0 ); - - protected slots: - void addStderr( KProcess *proc, char *buffer, int buflen ); - void addStdout( KProcess *proc, char *buffer, int buflen ); - - private: - QTextEdit *_stdout, *_stderr; - }; - - class UserMenuProc: public QObject { - Q_OBJECT - public: - - enum ExecType { Terminal, OutputOnly, None }; - - UserMenuProc( ExecType execType = Terminal, bool enableStderr = false ); - ~UserMenuProc(); - bool start( QString cmdLine ); - - protected slots: - void kill() { _proc->kill( SIGINT ); } - void processExited( KProcess *proc ); - - private: - ExecType _execType; - bool _enableStderr; - KProcess *_proc; - QString _stdout; - QString _stderr; - UserMenuProcDlg *_output; - }; - - /////////////////////////////////////////////////////////////////////////////// class UserMenuGui: public KPopupMenu { --- 19,28 ---- #define USERMENU_H #include <kpopupmenu.h> ! class UserActionProperties; ! class QWidget; ! class UserMenuAdd; class UserMenu; class UserMenuGui: public KPopupMenu { *************** *** 75,79 **** public: UserMenuGui( UserMenu* menu, QWidget *parent = 0 ); ! UserMenuEntry run(); protected: --- 30,34 ---- public: UserMenuGui( UserMenu* menu, QWidget *parent = 0 ); ! void run(); protected: *************** *** 81,153 **** protected slots: ! void addEntry( QString name, QString cmdline, UserMenuProc::ExecType execType, bool separateStderr, ! bool acceptURLs, bool showEverywhere, QStringList showIn = 0 ); void createMenu(); private: ! QValueList<UserMenuEntry> _entries; ! UserMenuAddImpl *_addgui; ! }; ! ! //////////////////////////////////////////////////////////////////////////////// ! ! // an expander is a function that receives a QString input, expands ! // it and returns a new QString output containing the expanded expression ! typedef QString ( *EXPANDER ) ( const QString&, const bool& ); ! ! // a UMCmd is an entry containing the expression and its expanding function ! typedef struct UserMenuCmd { ! QString expression; ! QString description; ! EXPANDER expFunc; ! } UMCmd; ! ! class UserMenuEntry { ! public: ! QString name; ! QString cmdline; ! UserMenuProc::ExecType execType; ! bool separateStderr; ! bool acceptURLs; ! bool showEverywhere; ! QStringList showIn; ! ! UserMenuEntry(QString data); ! UserMenuEntry(): name(0), cmdline(0) {} }; class UserMenu : public QWidget { - Q_OBJECT public: - /** - * Executes the menu, does the work and returns a QString - * containing a command to run. Run that command from a shell and that's it. - */ - void exec(); - - /** - * cycle through the input line, replacing every %% expression with valid - * data from krusader. return the expanded string - */ - static QString expand( QString str, bool useUrl ); - UserMenu( QWidget *parent = 0, const char *name = 0 ); ! ! ! static const int numOfExps = 10; ! static UMCmd expressions[ numOfExps ]; ! ! protected: ! static QString exp_p( const QString& str, const bool& ); ! static QString exp_anf( const QString& str, const bool& ); ! static QString exp_and( const QString& str, const bool& ); ! static QString exp_an( const QString& str, const bool& ); ! static QString exp_fm( const QString& str, const bool& ); ! static QString exp_c( const QString& str, const bool& ); ! static QString exp_s( const QString& str, const bool& ); ! static QString exp_afd( const QString& str, const bool& ); ! static QString exp_af( const QString& str, const bool& ); ! static QString exp_ad( const QString& str, const bool& ); ! private: UserMenuGui* _popup; --- 36,53 ---- protected slots: ! void addEntry( UserActionProperties *properties ); ! public slots: void createMenu(); private: ! UserMenuAdd *_addgui; }; class UserMenu : public QWidget { public: UserMenu( QWidget *parent = 0, const char *name = 0 ); ! void exec(); ! void update(); ! private: UserMenuGui* _popup; --- usermenuaddimpl.cpp DELETED --- --- NEW FILE: usermenuadd.cpp --- // // C++ Implementation: usermenuadd // // Description: // // // Author: Shie Erlich and Rafi Yanai <>, (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #include <klocale.h> #include "usermenuadd.h" #include "../GUI/actionproperty.h" #include <qvariant.h> #include <kpushbutton.h> #include <qlayout.h> #include <kdebug.h> UserMenuAdd::UserMenuAdd( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "UserMenuAdd" ); setCaption( i18n( "Add an useraction" ) ); QGridLayout *UserMenuAddLayout = new QGridLayout( this, 1, 1, 11, 6, "UserMenuAddLayout"); actionProperties = new ActionProperty(this); UserMenuAddLayout->addWidget( actionProperties, 0, 0 ); QHBoxLayout *hboxButtons = new QHBoxLayout( this, 0, 6, "hboxButtons"); QSpacerItem* spacer = new QSpacerItem( 350, 30, QSizePolicy::Expanding, QSizePolicy::Minimum ); hboxButtons->addItem( spacer ); okButton = new KPushButton( this, "okButton" ); okButton->setText( i18n( "Ok" ) ); okButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, okButton->sizePolicy().hasHeightForWidth() ) ); hboxButtons->addWidget( okButton ); cancelButton = new KPushButton( this, "cancelButton" ); cancelButton->setText( i18n( "Cancel" ) ); cancelButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, cancelButton->sizePolicy().hasHeightForWidth() ) ); hboxButtons->addWidget( cancelButton ); UserMenuAddLayout->addLayout( hboxButtons, 1, 0 ); resize( QSize(450,500).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); // signals and slots connections connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( okButton, SIGNAL( clicked() ), this, SLOT( check() ) ); } UserMenuAdd::~UserMenuAdd() {} void UserMenuAdd::check() { // check that we have a command line and a name if ( ! actionProperties->checkProperties() ) return; //kdDebug() << "UserMenuAdd::check() emit newEntry; actionname: " << actionProperties->properties->name << endl; emit newEntry( actionProperties->properties() ); UserMenuAdd::accept(); } #include "usermenuadd.moc" |
Update of /cvsroot/krusader/krusader_kde3/krusader/GUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29725/krusader/GUI Modified Files: Makefile.am Added Files: actionproperty.cpp actionproperty.h actionpropertybase.ui addplaceholderpopup.cpp addplaceholderpopup.h Log Message: initial import of the new useraction-system --- NEW FILE: actionproperty.cpp --- // // C++ Implementation: actionproperty // // Description: // // // Author: Jonas Bähr (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #include "actionproperty.h" #include "addplaceholderpopup.h" #include "../UserAction/useraction.h" #include "../UserAction/useractionxml.h" #include "../UserAction/useractionproperties.h" #include "../krusader.h" #include <klocale.h> #include <kfiledialog.h> #include <klineedit.h> #include <kdebug.h> #include <kmessagebox.h> #include <kinputdialog.h> #include <kkeybutton.h> ActionProperty::ActionProperty( QWidget *parent, const char *name, UserActionProperties *prop ) : ActionPropertyBase( parent, name ) { if (!prop) _properties = new UserActionProperties; else _properties = prop; updateGUI( _properties ); // fill with all existing categories cbCategory->insertStringList( krUserAction->xml()->getActionCategories() ); // create the 'add' popup menu _popup = new AddPlaceholderPopup( this ); connect( ButtonAddPlaceholder, SIGNAL( clicked() ), this, SLOT( addPlaceholder() ) ); connect( ButtonAddStartpath, SIGNAL( clicked() ), this, SLOT( addStartpath() ) ); connect( ButtonNewProtocol, SIGNAL( clicked() ), this, SLOT( newProtocol() ) ); connect( ButtonEditProtocol, SIGNAL( clicked() ), this, SLOT( editProtocol() ) ); connect( ButtonRemoveProtocol, SIGNAL( clicked() ), this, SLOT( removeProtocol() ) ); connect( ButtonAddPath, SIGNAL( clicked() ), this, SLOT( addPath() ) ); connect( ButtonEditPath, SIGNAL( clicked() ), this, SLOT( editPath() ) ); connect( ButtonRemovePath, SIGNAL( clicked() ), this, SLOT( removePath() ) ); connect( ButtonAddMime, SIGNAL( clicked() ), this, SLOT( addMime() ) ); connect( ButtonEditMime, SIGNAL( clicked() ), this, SLOT( editMime() ) ); connect( ButtonRemoveMime, SIGNAL( clicked() ), this, SLOT( removeMime() ) ); connect( ButtonNewFile, SIGNAL( clicked() ), this, SLOT( newFile() ) ); connect( ButtonEditFile, SIGNAL( clicked() ), this, SLOT( editFile() ) ); connect( ButtonRemoveFile, SIGNAL( clicked() ), this, SLOT( removeFile() ) ); connect( ButtonProposeName, SIGNAL( clicked() ), this, SLOT( proposeName() ) ); //these are used to keep the properties-structure up to date connect( leDistinctName, SIGNAL( textChanged(const QString&) ), this, SLOT( changedName() ) ); connect( cbCategory, SIGNAL( textChanged(const QString&) ), this, SLOT( changedCategory() ) ); connect( ButtonIcon, SIGNAL( iconChanged(QString) ), this, SLOT( changedIcon() ) ); connect( leTitle, SIGNAL( textChanged(const QString&) ), this, SLOT( changedTitle() ) ); connect( leTooltip, SIGNAL( textChanged(const QString&) ), this, SLOT( changedTooltip() ) ); connect( textDescription, SIGNAL( textChanged() ), this, SLOT( changedDescription() ) ); connect( chkUseTooltip, SIGNAL( toggled(bool) ), this, SLOT( changedChkUseTooltip() ) ); connect( leCommandline, SIGNAL( textChanged(const QString&) ), this, SLOT( changedCommand() ) ); connect( leStartpath, SIGNAL( textChanged(const QString&) ), this, SLOT( changedStartpath() ) ); connect( bgExecType, SIGNAL( clicked(int) ), this, SLOT( changedExecType() ) ); connect( bgAccept, SIGNAL( clicked(int) ), this, SLOT( changedAccept() ) ); connect( bgMultiselect, SIGNAL( clicked(int) ), this, SLOT( changedCallEach() ) ); connect( chkConfirmExecution, SIGNAL( toggled(bool) ), this, SLOT( changedConfirmExecution() ) ); connect( KeyButtonShortcut, SIGNAL( capturedShortcut(const KShortcut&) ), this, SLOT( changedShortcut(const KShortcut&) ) ); } ActionProperty::~ActionProperty() { delete _properties; } UserActionProperties* ActionProperty::properties() { return _properties; } void ActionProperty::updateGUI( UserActionProperties *properties ) { if (!properties) return; leDistinctName->setText( *properties->name() ); cbCategory->setCurrentText( *properties->category() ); leTitle->setText( *properties->title() ); leTooltip->setText( *properties->tooltip() ); if ( properties->descriptionUseTooltip() ) { textDescription->setText( *properties->tooltip() ); chkUseTooltip->setChecked(true); } else { textDescription->setText( *properties->description() ); chkUseTooltip->setChecked(false); } leCommandline->setText( *properties->command() ); leStartpath->setText( *properties->startpath() ); lbShowonlyProtocol->clear(); lbShowonlyProtocol->insertStringList( *properties->showonlyProtocol() ); lbShowonlyPath->clear(); lbShowonlyPath->insertStringList( *properties->showonlyPath() ); lbShowonlyMime->clear(); lbShowonlyMime->insertStringList( *properties->showonlyMime() ); lbShowonlyFile->clear(); lbShowonlyFile->insertStringList( *properties->showonlyFile() ); chkSeparateStdError->setChecked( properties->separateStderr() ); if ( properties->execType() == UserActionProperties::Normal ) radioNormal->setChecked(true); else if ( properties->execType() == UserActionProperties::Terminal ) radioTerminal->setChecked(true); else if ( properties->execType() == UserActionProperties::CollectOutput ) radioCollectOutput->setChecked(true); if ( properties->acceptURLs() ) radioUrl->setChecked(true); else radioLocal->setChecked(true); chkSeparateCall->setChecked( properties->callEach() ); chkConfirmExecution->setChecked( properties->confirmExecution() ); if ( ! properties->icon()->isEmpty() ) ButtonIcon->setIcon( *properties->icon() ); else ButtonIcon->resetIcon(); // these functions are updating the internal _properties changedName(); changedCategory(); changedIcon(); changedTitle(); changedTooltip(); changedDescription(); changedChkUseTooltip(); changedCommand(); changedStartpath(); changedExecType(); changedAccept(); changedCallEach(); changedConfirmExecution(); changedShowonlyProtocol(); changedShowonlyPath(); changedShowonlyMime(); changedShowonlyFile(); changedShortcut( *properties->defaultShortcut() ); //kdDebug() << "Default Shortcut: " << properties->defaultShortcut.toString() << endl; } bool ActionProperty::checkName( const QString& name ) { //check if name is unique (no existing action with same name = true) if ( krUserAction->xml()->nameExists( name ) ) return false; else return true; } void ActionProperty::proposeName() { if ( ! leDistinctName->text().simplifyWhiteSpace().isEmpty() ) { //check if given name is unique if ( ! checkName( leDistinctName->text() ) ) { KMessageBox::error( this, i18n("There already is an action with this name") ); leDistinctName->setFocus(); return; } else { KMessageBox::information( this, i18n("The name is unique") ); return; } } //TODO: propose unique name KMessageBox::sorry( this, "BOFH Excuse #93:\nFeature not yet implemented" ); } void ActionProperty::addPlaceholder() { QString exp = _popup->getPlaceholder( mapToGlobal( QPoint( ButtonAddPlaceholder->pos().x() + ButtonAddPlaceholder->width() * 3 / 2, ButtonAddPlaceholder->pos().y() + ButtonAddPlaceholder->height() / 2 ) ) ); leCommandline->insert( exp ); } void ActionProperty::addStartpath() { QString folder = KFileDialog::getExistingDirectory(QString::null, this); if (folder != QString::null) leStartpath->setText( folder ); } void ActionProperty::newProtocol() { bool ok; QString text = KInputDialog::getText( i18n( "New protocol" ), i18n( "Set a protocol:" ), lbShowonlyProtocol->currentText(), &ok, this ); if ( ok && !text.isEmpty() ) { lbShowonlyProtocol->insertStringList( QStringList::split( ";", text ) ); changedShowonlyProtocol(); } } void ActionProperty::editProtocol() { if (lbShowonlyProtocol->currentItem() == -1) return; bool ok; QString text = KInputDialog::getText( i18n( "Edit protocol" ), i18n( "Set an other protocol:" ), lbShowonlyProtocol->currentText(), &ok, this ); if ( ok && !text.isEmpty() ) { lbShowonlyProtocol->changeItem( text, lbShowonlyProtocol->currentItem() ); changedShowonlyProtocol(); } } void ActionProperty::removeProtocol() { if (lbShowonlyProtocol->currentItem() != -1) { lbShowonlyProtocol->removeItem( lbShowonlyProtocol->currentItem() ); changedShowonlyProtocol(); } } void ActionProperty::addPath() { QString folder = KFileDialog::getExistingDirectory(QString::null, this); if (folder != QString::null) { lbShowonlyPath->insertItem( folder ); changedShowonlyPath(); } } void ActionProperty::editPath() { if (lbShowonlyPath->currentItem() == -1) return; bool ok; QString text = KInputDialog::getText( i18n( "Edit path" ), i18n( "Set an other path:" ), lbShowonlyPath->currentText(), &ok, this ); if ( ok && !text.isEmpty() ) { lbShowonlyPath->changeItem( text, lbShowonlyPath->currentItem() ); changedShowonlyPath(); } } void ActionProperty::removePath() { if (lbShowonlyPath->currentItem() != -1) { lbShowonlyPath->removeItem( lbShowonlyPath->currentItem() ); changedShowonlyPath(); } } void ActionProperty::addMime() { //TODO read from an textfile with each mime-type in a seperate line KMessageBox::sorry( this, "sorry, not implemnted yet...\nTODO: Popup-menu with 'text', 'image', 'video', etc...\nand submenus with 'text/*', 'text/plain', 'text/html', etc... " ); } void ActionProperty::editMime() { if (lbShowonlyMime->currentItem() == -1) return; bool ok; QString text = KInputDialog::getText( i18n( "Edit mime-type" ), i18n( "Set an other mime-type:" ), lbShowonlyMime->currentText(), &ok, this ); if ( ok && !text.isEmpty() ) { lbShowonlyMime->changeItem( text, lbShowonlyMime->currentItem() ); changedShowonlyMime(); } } void ActionProperty::removeMime() { if (lbShowonlyMime->currentItem() != -1) { lbShowonlyMime->removeItem( lbShowonlyMime->currentItem() ); changedShowonlyMime(); } } void ActionProperty::newFile() { bool ok; QString text = KInputDialog::getText( i18n( "New filename" ), i18n( "Set a filename:" ), lbShowonlyFile->currentText(), &ok, this ); if ( ok && !text.isEmpty() ) { lbShowonlyFile->insertStringList( QStringList::split( ";", text ) ); changedShowonlyFile(); } } void ActionProperty::editFile() { if (lbShowonlyFile->currentItem() == -1) return; bool ok; QString text = KInputDialog::getText( i18n( "Edit filename" ), i18n( "Set an other filename:" ), lbShowonlyFile->currentText(), &ok, this ); if ( ok && !text.isEmpty() ) { lbShowonlyFile->changeItem( text, lbShowonlyFile->currentItem() ); changedShowonlyFile(); } } void ActionProperty::removeFile() { if (lbShowonlyFile->currentItem() != -1) { lbShowonlyFile->removeItem( lbShowonlyFile->currentItem() ); changedShowonlyFile(); } } bool ActionProperty::checkProperties() { if ( leDistinctName->text().simplifyWhiteSpace().isEmpty() ) { KMessageBox::error( this, i18n("Please set a unique name for the useraction") ); leDistinctName->setFocus(); return false; } if ( leTitle->text().simplifyWhiteSpace().isEmpty() ) { KMessageBox::error( this, i18n("Please set a title for the menu entry") ); leTitle->setFocus(); return false; } if ( leCommandline->text().simplifyWhiteSpace().isEmpty() ) { KMessageBox::error( this, i18n("Command line is empty") ); leCommandline->setFocus(); return false; } if ( leDistinctName->isEnabled() ) if ( !checkName( leDistinctName->text() ) ) { KMessageBox::error( this, i18n("There already is an action with this name") ); leDistinctName->setFocus(); return false; } return true; } void ActionProperty::changedName() { _properties->setName( leDistinctName->text().stripWhiteSpace() ); if ( leDistinctName->text() != "" ) { ButtonProposeName->setText( i18n("Check") ); } else { ButtonProposeName->setText( i18n("Propose") ); } } void ActionProperty::changedCategory() { _properties->setCategory( cbCategory->currentText().stripWhiteSpace() ); } void ActionProperty::changedIcon() { _properties->setIcon( ButtonIcon->icon() ); } void ActionProperty::changedTitle() { _properties->setTitle( leTitle->text().stripWhiteSpace() ); } void ActionProperty::changedTooltip() { _properties->setTooltip( leTooltip->text().stripWhiteSpace() ); if ( _properties->descriptionUseTooltip() ) textDescription->setText( leTooltip->text().stripWhiteSpace() ); } void ActionProperty::changedDescription() { _properties->setDescription( textDescription->text().stripWhiteSpace() ); } void ActionProperty::changedChkUseTooltip() { _properties->setDescriptionUseTooltip( chkUseTooltip->isChecked() ); if ( _properties->descriptionUseTooltip() ) textDescription->setText( leTooltip->text().stripWhiteSpace() ); } void ActionProperty::changedCommand() { _properties->setCommand( leCommandline->text().stripWhiteSpace() ); } void ActionProperty::changedStartpath() { _properties->setStartpath( leStartpath->text().stripWhiteSpace() ); } void ActionProperty::changedExecType() { _properties->setSeparateStderr( chkSeparateStdError->isChecked() ); if ( radioNormal->isChecked() ) _properties->setExecType( UserActionProperties::Normal ); else if ( radioTerminal->isChecked() ) _properties->setExecType( UserActionProperties::Terminal ); else if ( radioCollectOutput->isChecked() ) _properties->setExecType( UserActionProperties::CollectOutput ); } void ActionProperty::changedAccept() { if ( radioUrl->isChecked() ) _properties->setAcceptURLs( true ); else _properties->setAcceptURLs( false ); } void ActionProperty::changedCallEach() { _properties->setCallEach( chkSeparateCall->isChecked() ); } void ActionProperty::changedConfirmExecution() { _properties->setConfirmExecution( chkConfirmExecution->isChecked() ); } void ActionProperty::changedShowonlyProtocol() { _properties->showonlyProtocol()->clear(); uint count = lbShowonlyProtocol->count(); for (uint i = 0; i < count; ++i) if ( _properties->showonlyProtocol()->find( lbShowonlyProtocol->text(i) ) == _properties->showonlyProtocol()->end() ) _properties->showonlyProtocol()->append( lbShowonlyProtocol->text(i) ); } void ActionProperty::changedShowonlyPath() { _properties->showonlyPath()->clear(); uint count = lbShowonlyPath->count(); for (uint i = 0; i < count; ++i) if ( _properties->showonlyPath()->find( lbShowonlyPath->text(i) ) == _properties->showonlyPath()->end() ) _properties->showonlyPath()->append( lbShowonlyPath->text(i) ); } void ActionProperty::changedShowonlyMime() { _properties->showonlyMime()->clear(); uint count = lbShowonlyMime->count(); for (uint i = 0; i < count; ++i) if ( _properties->showonlyMime()->find( lbShowonlyMime->text(i) ) == _properties->showonlyMime()->end() ) _properties->showonlyMime()->append( lbShowonlyMime->text(i) ); } void ActionProperty::changedShowonlyFile() { _properties->showonlyFile()->clear(); uint count = lbShowonlyFile->count(); for (uint i = 0; i < count; ++i) if ( _properties->showonlyFile()->find( lbShowonlyFile->text(i) ) == _properties->showonlyFile()->end() ) _properties->showonlyFile()->append( lbShowonlyFile->text(i) ); } void ActionProperty::changedShortcut( const KShortcut& shortcut ) { KeyButtonShortcut->setShortcut( shortcut, false ); _properties->setDefaultShortcut( shortcut ); } Index: Makefile.am =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/GUI/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.am 10 Jan 2004 00:02:07 -0000 1.4 --- Makefile.am 23 Jul 2004 00:03:17 -0000 1.5 *************** *** 6,10 **** libGUI_a_METASOURCES = AUTO ! libGUI_a_SOURCES = dirhistoryqueue.cpp dirhistorybutton.cpp krusaderstatus.cpp kfnkeys.cpp kcmdline.cpp --- 6,12 ---- libGUI_a_METASOURCES = AUTO ! libGUI_a_SOURCES = dirhistoryqueue.cpp dirhistorybutton.cpp krusaderstatus.cpp \ ! kfnkeys.cpp kcmdline.cpp actionproperty.cpp actionpropertybase.ui \ ! addplaceholderpopup.cpp --- NEW FILE: addplaceholderpopup.cpp --- // // C++ Implementation: addplaceholderpopup // // Description: // // // Author: Shie Erlich and Rafi Yanai <>, (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #include "addplaceholderpopup.h" #include "../UserAction/expander.h" #include <klocale.h> #include <kfiledialog.h> #include <kmessagebox.h> // for ParameterDialog #include "../krusader.h" // for konfig-access #include "../BookMan/bookmarksbutton.h" #include <qlayout.h> #include <qhbox.h> #include <qlabel.h> #include <qtoolbutton.h> #include <klineedit.h> #include <qcheckbox.h> #include <kiconloader.h> #include <kcombobox.h> #include <kurlcompletion.h> #include <kdebug.h> #define ACTIVE_MASK 0x0100 #define OTHER_MASK 0x0200 #define LEFT_MASK 0x0400 #define RIGHT_MASK 0x0800 #define INDEPENDENT_MASK 0x1000 #define EXECUTABLE_ID 0xFFFF AddPlaceholderPopup::AddPlaceholderPopup( QWidget *parent ) : KPopupMenu( parent ) { _activeSub = new KPopupMenu( this ); _otherSub = new KPopupMenu( this ); _leftSub = new KPopupMenu( this ); _rightSub = new KPopupMenu( this ); _independentSub = new KPopupMenu( this ); insertItem( i18n( "Active panel" ), _activeSub ); insertItem( i18n( "Other panel" ), _otherSub ); insertItem( i18n( "Left panel" ), _leftSub ); insertItem( i18n( "Right panel" ), _rightSub ); insertItem( i18n( "Panel independent" ), _independentSub ); _independentSub->insertItem( i18n( "Executable" ), EXECUTABLE_ID ); _independentSub->insertSeparator(); // read the expressions array from the user menu and populate menus for ( int i = 0; i < Expander::numOfPlaceholder; ++i ) { if ( Expander::placeholder[ i ].expression.isEmpty() ) { if ( Expander::placeholder[ i ].needPanel ) { _activeSub->insertSeparator(); _otherSub->insertSeparator(); _leftSub->insertSeparator(); _rightSub->insertSeparator(); } else _independentSub->insertSeparator(); } else { if ( Expander::placeholder[ i ].needPanel ) { _activeSub->insertItem( Expander::placeholder[ i ].description, ( i | ACTIVE_MASK ) ); _otherSub->insertItem( Expander::placeholder[ i ].description, ( i | OTHER_MASK ) ); _leftSub->insertItem( Expander::placeholder[ i ].description, ( i | LEFT_MASK ) ); _rightSub->insertItem( Expander::placeholder[ i ].description, ( i | RIGHT_MASK ) ); } else _independentSub->insertItem( Expander::placeholder[ i ].description, ( i | INDEPENDENT_MASK ) ); } } } QString AddPlaceholderPopup::getPlaceholder( const QPoint& pos ) { int res = exec( pos ); if ( res == -1 ) return QString::null; // add the selected flag to the command line if ( res == EXECUTABLE_ID ) { // did the user need an executable ? // select an executable QString filename = KFileDialog::getOpenFileName(QString::null, QString::null, this); if (filename != QString::null) return filename + " "; // with extra space } else { // user selected something from the menus Expander::Placeholder* currentPlaceholder = &Expander::placeholder[ res & ~( ACTIVE_MASK | OTHER_MASK | LEFT_MASK | RIGHT_MASK | INDEPENDENT_MASK ) ]; if ( currentPlaceholder->expFunc == 0 ) { KMessageBox::sorry( this, "BOFH Excuse #93:\nFeature not yet implemented" ); return QString::null; } ParameterDialog* parameterDialog = new ParameterDialog( currentPlaceholder, this ); QString panel, parameter = parameterDialog->getParameter(); delete parameterDialog; // indicate the panel with 'a' 'o', 'l', 'r' or '_'. if ( res & ACTIVE_MASK ) panel = "a"; else if ( res & OTHER_MASK ) panel = "o"; else if ( res & LEFT_MASK ) panel = "l"; else if ( res & RIGHT_MASK ) panel = "r"; else if ( res & INDEPENDENT_MASK ) panel = "_"; return "%" + panel + currentPlaceholder->expression + parameter + "% "; // with extra space } } //////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////// ParameterDialog //////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// ParameterDialog::ParameterDialog( Expander::Placeholder* currentPlaceholder, QWidget *parent ) : KDialogBase( Plain, i18n("User Action Parameter Dialog"), Default | Ok, Ok, parent ) { _parameter.clear(); _parameterCount = currentPlaceholder->parameterCount; QVBoxLayout* layout = new QVBoxLayout( plainPage() ); layout->setAutoAdd( true ); layout->setSpacing( 11 ); new QLabel( i18n("This placeholder allows some parameter:"), plainPage(), "intro" ); for (int i = 0; i < _parameterCount; ++i ) { if ( currentPlaceholder->parameter[ i ].preset == "__placeholder" ) _parameter.append( new ParameterPlaceholder( ¤tPlaceholder->parameter[ i ], plainPage() ) ); else if ( currentPlaceholder->parameter[ i ].preset == "__yes" ) _parameter.append( new ParameterYes( ¤tPlaceholder->parameter[ i ], plainPage() ) ); else if ( currentPlaceholder->parameter[ i ].preset == "__no" ) _parameter.append( new ParameterNo( ¤tPlaceholder->parameter[ i ], plainPage() ) ); else if ( currentPlaceholder->parameter[ i ].preset == "__file" ) _parameter.append( new ParameterFile( ¤tPlaceholder->parameter[ i ], plainPage() ) ); else if ( currentPlaceholder->parameter[ i ].preset.find( "__choose" ) != -1 ) _parameter.append( new ParameterChoose( ¤tPlaceholder->parameter[ i ], plainPage() ) ); else if ( currentPlaceholder->parameter[ i ].preset == "__select" ) _parameter.append( new ParameterSelect( ¤tPlaceholder->parameter[ i ], plainPage() ) ); else if ( currentPlaceholder->parameter[ i ].preset == "__bookmark" ) _parameter.append( new ParameterBookmark( ¤tPlaceholder->parameter[ i ], plainPage() ) ); else _parameter.append( new ParameterText( ¤tPlaceholder->parameter[ i ], plainPage() ) ); } QFrame * line = new QFrame( plainPage() ); line->setFrameShape( QFrame::HLine ); line->setFrameShadow( QFrame::Sunken ); connect( this, SIGNAL(defaultClicked()), this, SLOT(reset()) ); } QString ParameterDialog::getParameter() { if ( _parameterCount == 0 ) // meaning no parameters return QString::null; if ( exec() == -1 ) return QString::null; int lastParameter = _parameterCount; while ( --lastParameter > -1 ) { if ( _parameter[ lastParameter ]->text() != _parameter[ lastParameter ]->preset() || _parameter[ lastParameter ]->nessesary() ) break; } if ( lastParameter < 0) // all parameters have default-values return QString::null; QString parameter = "("; for ( int i = 0; i <= lastParameter; ++i ) { if ( i > 0 ) parameter += ", "; parameter += "\"" + _parameter[ i ]->text().replace( "\"", "\\\"" ) + "\""; } parameter += ")"; return parameter; } void ParameterDialog::reset() { for ( int i = 0; i < _parameterCount; ++i ) _parameter[ i ]->reset(); } void ParameterDialog::slotOk() { bool valid = true; for (int i = 0; i < _parameterCount; ++i ) { if ( _parameter[ i ]->nessesary() && ! _parameter[ i ]->valid() ) valid = false; } if ( valid ) accept(); } ///////////// ParameterText ParameterText::ParameterText( Expander::Parameter* parameter, QWidget* parent ) : ParameterBase( parameter, parent ) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setAutoAdd( true ); layout->setSpacing( 6 ); new QLabel( parameter->description, this ); _lineEdit = new KLineEdit( parameter->preset, this ); _preset = parameter->preset; } QString ParameterText::text() { return _lineEdit->text(); } QString ParameterText::preset() { return _preset; } void ParameterText::reset() { _lineEdit->setText( _preset ); } bool ParameterText::valid() { if ( _lineEdit->text().isEmpty() ) return false; else return true; } ///////////// ParameterPlaceholder ParameterPlaceholder::ParameterPlaceholder( Expander::Parameter* parameter, QWidget* parent ) : ParameterBase( parameter, parent ) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setAutoAdd( true ); layout->setSpacing( 6 ); new QLabel( parameter->description, this ); QHBox * hbox = new QHBox( this ); hbox->setSpacing( 6 ); _lineEdit = new KLineEdit( hbox ); _button = new QToolButton( hbox); _button->setText( i18n("add") ); connect( _button, SIGNAL(clicked()), this, SLOT(addPlaceholder()) ); } QString ParameterPlaceholder::text() { return _lineEdit->text(); } QString ParameterPlaceholder::preset() { return QString::null; } void ParameterPlaceholder::reset() { _lineEdit->setText( QString::null ); } bool ParameterPlaceholder::valid() { if ( _lineEdit->text().isEmpty() ) return false; else return true; } void ParameterPlaceholder::addPlaceholder() { AddPlaceholderPopup* popup = new AddPlaceholderPopup( this ); QString exp = popup->getPlaceholder( mapToGlobal( QPoint( _button->pos().x() + _button->width() * 3 / 2, _button->pos().y() + _button->height() / 2 ) ) ); _lineEdit->insert( exp ); delete popup; } ///////////// ParameterYes ParameterYes::ParameterYes( Expander::Parameter* parameter, QWidget* parent ) : ParameterBase( parameter, parent ) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setAutoAdd( true ); layout->setSpacing( 6 ); _checkBox = new QCheckBox( parameter->description, this ); _checkBox->setChecked( true ); } QString ParameterYes::text() { if ( _checkBox->isChecked() ) return QString::null; else return "No"; } QString ParameterYes::preset() { return QString::null; } void ParameterYes::reset() { _checkBox->setChecked( true ); } bool ParameterYes::valid() { return true; } ///////////// ParameterNo ParameterNo::ParameterNo( Expander::Parameter* parameter, QWidget* parent ) : ParameterBase( parameter, parent ) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setAutoAdd( true ); layout->setSpacing( 6 ); _checkBox = new QCheckBox( parameter->description, this ); _checkBox->setChecked( false ); } QString ParameterNo::text() { if ( _checkBox->isChecked() ) return "Yes"; else return QString::null; } QString ParameterNo::preset() { return QString::null; } void ParameterNo::reset() { _checkBox->setChecked( false ); } bool ParameterNo::valid() { return true; } ///////////// ParameterFile ParameterFile::ParameterFile( Expander::Parameter* parameter, QWidget* parent ) : ParameterBase( parameter, parent ) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setAutoAdd( true ); layout->setSpacing( 6 ); new QLabel( parameter->description, this ); QHBox * hbox = new QHBox( this ); hbox->setSpacing( 6 ); _lineEdit = new KLineEdit( hbox ); _button = new QToolButton( hbox); KIconLoader *iconLoader = new KIconLoader(); _button->setPixmap( iconLoader->loadIcon( "fileopen", KIcon::Toolbar, 16 ) ); connect( _button, SIGNAL(clicked()), this, SLOT(addFile()) ); } QString ParameterFile::text() { return _lineEdit->text(); } QString ParameterFile::preset() { return QString::null; } void ParameterFile::reset() { _lineEdit->setText( QString::null ); } bool ParameterFile::valid() { if ( _lineEdit->text().isEmpty() ) return false; else return true; } void ParameterFile::addFile() { QString filename = KFileDialog::getOpenFileName(QString::null, QString::null, this); _lineEdit->insert( filename ); } ///////////// ParameterChoose ParameterChoose::ParameterChoose( Expander::Parameter* parameter, QWidget* parent ) : ParameterBase( parameter, parent ) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setAutoAdd( true ); layout->setSpacing( 6 ); new QLabel( parameter->description, this ); _combobox = new KComboBox( this ); _combobox->insertStringList( QStringList::split( ";", parameter->preset.section(":", 1) ) ); } QString ParameterChoose::text() { return _combobox->currentText(); } QString ParameterChoose::preset() { return _combobox->text( 0 ); } void ParameterChoose::reset() { _combobox->setCurrentItem( 0 ); } bool ParameterChoose::valid() { return true; } ///////////// ParameterSelect ParameterSelect::ParameterSelect( Expander::Parameter* parameter, QWidget* parent ) : ParameterBase( parameter, parent ) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setAutoAdd( true ); layout->setSpacing( 6 ); new QLabel( parameter->description, this ); _combobox = new KComboBox( this ); _combobox->setEditable( true ); krConfig->setGroup( "Private" ); QStrList lst; int i = krConfig->readListEntry( "Predefined Selections", lst ); if ( i > 0 ) _combobox->insertStrList( lst ); _combobox->setCurrentText( "*" ); } QString ParameterSelect::text() { return _combobox->currentText(); } QString ParameterSelect::preset() { return "*"; } void ParameterSelect::reset() { _combobox->setCurrentText( "*" ); } bool ParameterSelect::valid() { return true; } ///////////// ParameterBookmark ParameterBookmark::ParameterBookmark( Expander::Parameter* parameter, QWidget* parent ) : ParameterBase( parameter, parent ) { QVBoxLayout* layout = new QVBoxLayout( this ); layout->setAutoAdd( true ); layout->setSpacing( 6 ); new QLabel( parameter->description, this ); QHBox * hbox = new QHBox( this ); hbox->setSpacing( 6 ); _lineEdit = new KLineEdit( hbox ); _lineEdit->setCompletionObject( new KURLCompletion( KURLCompletion::DirCompletion ) ); _dirButton = new QToolButton( hbox ); KIconLoader *iconLoader = new KIconLoader(); _dirButton->setPixmap( iconLoader->loadIcon( "fileopen", KIcon::Toolbar, 16 ) ); connect( _dirButton, SIGNAL(clicked()), this, SLOT(setDir()) ); _bookmarkButton = new BookmarksButton( hbox ); connect( _bookmarkButton, SIGNAL(openUrl(const KURL &)), this, SLOT(setBookmark(const KURL &)) ); } QString ParameterBookmark::text() { return _lineEdit->text(); } QString ParameterBookmark::preset() { return QString::null; } void ParameterBookmark::reset() { _lineEdit->setText( QString::null ); } bool ParameterBookmark::valid() { if ( _lineEdit->text().isEmpty() ) return false; else return true; } void ParameterBookmark::setDir() { QString folder = KFileDialog::getExistingDirectory(QString::null, this); _lineEdit->setText( folder ); } void ParameterBookmark::setBookmark( const KURL& url ) { _lineEdit->setText( url.url() ); } --- NEW FILE: addplaceholderpopup.h --- // // C++ Interface: addplaceholderpopup // // Description: // // // Author: Shie Erlich and Rafi Yanai <>, (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifndef ADDPLACEHOLDERPOPUP_H #define ADDPLACEHOLDERPOPUP_H #include <kpopupmenu.h> #include <kdialogbase.h> #include "../UserAction/expander.h" class QString; class KLineEdit; class QToolButton; class QCheckBox; class KComboBox; class BookmarksButton; class KURL; /** * This reads Expander::placeholder[] and fills a popup for easy access to the UserAction Placeholder * @author Jonas Bähr (http://www.jonas-baehr.de), Shie Erlich */ class AddPlaceholderPopup : public KPopupMenu { public: AddPlaceholderPopup( QWidget *parent ); /** * Use this to exec the popup. * @param pos Position where the popup should appear * @return the expression which can be placed in the UserAction commandline */ QString getPlaceholder( const QPoint& pos ); protected: /** * This is calles when a Placeholder got parameter. * @param currentPlaceholder A pointer to the Placeholder the user has choosen * @return a parameter-string */ QString getParameter( Expander::Placeholder* currentPlaceholder ); private: KPopupMenu *_activeSub, *_otherSub, *_leftSub, *_rightSub, *_independentSub; }; //////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////// Parameter Widgets /////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// /** * abstract baseclass for all Parameter widgets * @author Jonas Bähr (http://www.jonas-baehr.de) */ class ParameterBase : public QWidget { public: inline ParameterBase( Expander::Parameter* parameter, QWidget* parent ) : QWidget( parent ) { _nessesary = parameter->nessesary; } /** * @return the text for the parameter */ virtual QString text() = 0; /** * @return the default of the parameter */ virtual QString preset() = 0; /** * re-init the parameter with the default */ virtual void reset() = 0; /** * @return true if the Parameter as a valid value */ virtual bool valid() = 0; /** * @return true if the Placeholder realy needs this parameter */ inline bool nessesary() { return _nessesary; } private: bool _nessesary; }; /** * The simples Parameter widgets: a line-edit with the description above * used by default */ class ParameterText : public ParameterBase { public: ParameterText( Expander::Parameter* parameter, QWidget* parent ); QString text(); QString preset(); void reset(); bool valid(); private: KLineEdit * _lineEdit; QString _preset; }; /** * A line-edit with the "addPlaceholder"-button * used with default = "__placeholder" */ class ParameterPlaceholder : public ParameterBase { Q_OBJECT public: ParameterPlaceholder( Expander::Parameter* parameter, QWidget* parent ); QString text(); QString preset(); void reset(); bool valid(); private: KLineEdit * _lineEdit; QToolButton* _button; private slots: void addPlaceholder(); }; /** * A Checkbox, default: checked; retuns "No" if unchecked * used with default = "__yes" */ class ParameterYes : public ParameterBase { public: ParameterYes( Expander::Parameter* parameter, QWidget* parent ); QString text(); QString preset(); void reset(); bool valid(); private: QCheckBox* _checkBox; }; /** * A Checkbox, default: unchecked; retuns "Yes" if checked * used with default = "__no" */ class ParameterNo : public ParameterBase { public: ParameterNo( Expander::Parameter* parameter, QWidget* parent ); QString text(); QString preset(); void reset(); bool valid(); private: QCheckBox* _checkBox; }; /** * A line-edit with the "file open"-button * used with default = "__file" */ class ParameterFile : public ParameterBase { Q_OBJECT public: ParameterFile( Expander::Parameter* parameter, QWidget* parent ); QString text(); QString preset(); void reset(); bool valid(); private: KLineEdit * _lineEdit; QToolButton* _button; private slots: void addFile(); }; /** * A ComboBox with the description above * used with default = "__choose:item1;item2;..." */ class ParameterChoose : public ParameterBase { public: ParameterChoose( Expander::Parameter* parameter, QWidget* parent ); QString text(); QString preset(); void reset(); bool valid(); private: KComboBox * _combobox; }; /** * An editable ComboBox with the predifined selections * used with default = "__select" */ class ParameterSelect : public ParameterBase { public: ParameterSelect( Expander::Parameter* parameter, QWidget* parent ); QString text(); QString preset(); void reset(); bool valid(); private: KComboBox * _combobox; }; /** * A line-edit with a "choose dir"- and a bookmark-button * used with default = "__bookmark" */ class ParameterBookmark : public ParameterBase { Q_OBJECT public: ParameterBookmark( Expander::Parameter* parameter, QWidget* parent ); QString text(); QString preset(); void reset(); bool valid(); private: KLineEdit * _lineEdit; QToolButton* _dirButton; BookmarksButton* _bookmarkButton; private slots: void setDir(); void setBookmark( const KURL & ); }; //////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////// ParameterDialog //////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// /** * Opens a dialog for the parameter. Depending on the default (preset) a differend widget is used. * See Parameter-Classes for details */ class ParameterDialog : public KDialogBase { Q_OBJECT public: ParameterDialog( Expander::Placeholder* currentPlaceholder, QWidget *parent ); /** * Use this to execute the dialog. * @return a QString with all paremeters; ommiting the optional ones if they have the default-value. */ QString getParameter(); private: typedef QValueList<ParameterBase*> ParameterList; ParameterList _parameter; int _parameterCount; private slots: void reset(); void slotOk(); }; #endif // ADDPLACEHOLDERPOPUP_H --- NEW FILE: actionproperty.h --- // // C++ Interface: actionproperty // // Description: // // // Author: Jonas Bähr (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifndef ACTIONPROPERTY_H #define ACTIONPROPERTY_H #include "actionpropertybase.h" class UserActionProperties; class AddPlaceholderPopup; /** * Use this widget where ever you need to manipulate a UserAction * @author Jonas Bähr (http://www.jonas-baehr.de) */ class ActionProperty : public ActionPropertyBase { Q_OBJECT public: ActionProperty( QWidget *parent=0, const char *name=0, UserActionProperties *prop=0 ); ~ActionProperty(); /** * @return the current state of all properties editable within this widget */ UserActionProperties* properties(); /** * Use this to init the widget with some properties * @param properties the properties which will be displayd */ void updateGUI( UserActionProperties *properties ); /** * @return true if all properties got valid values */ bool checkProperties(); /** * This checks is the name of the action is unique * @param name the name which should be checked * @return true if the name is valid */ bool checkName( const QString& name ); protected slots: /** * this generates a name for an action or checks if the current name is valid (==unique) */ void proposeName(); /** * executes the AddPlaceholderPopup */ void addPlaceholder(); /** * asks for an existing path */ void addStartpath(); /** * (availability) asks for a new protocol */ void newProtocol(); /** * (availability) changes a protocol of the list */ void editProtocol(); /** * (availability) removes a protocol from the list */ void removeProtocol(); /** * (availability) asks for a new path */ void addPath(); /** * (availability) edits a path of the list */ void editPath(); /** * (availability) removes a path from the list */ void removePath(); /** * (availability) asks for a new mime-type */ void addMime(); /** * (availability) changes a mime-type of the list */ void editMime(); /** * (availability) removes a mime-type from the list */ void removeMime(); /** * (availability) asks for a new file-filter */ void newFile(); /** * (availability) edits a file-filter of the list */ void editFile(); /** * (availability) removes a file-filter from the lsit */ void removeFile(); private: AddPlaceholderPopup *_popup; UserActionProperties *_properties; private slots: /** * keeps the name in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedName(); /** * keeps the category in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedCategory(); /** * keeps the icon in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedIcon(); /** * keeps the title in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedTitle(); /** * keeps the tooltip in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedTooltip(); /** * keeps the description in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedDescription(); /** * keeps useTooltip in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedChkUseTooltip(); /** * keeps the commandline in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedCommand(); /** * keeps the startpath in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedStartpath(); /** * keeps the execution-type in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedExecType(); /** * keeps useUrl in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedAccept(); /** * keeps callEach in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedCallEach(); /** * keeps confirmExecution in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedConfirmExecution(); /** * keeps the protocol-list in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedShowonlyProtocol(); /** * keeps the path-list in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedShowonlyPath(); /** * keeps the mime-type list in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedShowonlyMime(); /** * keeps the file-filter list in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! */ void changedShowonlyFile(); /** * keeps the default shortcut in the internal _properties up to date. * !! don't forget to call them also at the end of updateGUI !! * @param shortcut the new shortcut */ void changedShortcut(const KShortcut& shortcut); }; #endif --- NEW FILE: actionpropertybase.ui --- <!DOCTYPE UI><UI version="3.3" stdsetdef="1"> <class>ActionPropertyBase</class> <widget class="QWidget"> <property name="name"> <cstring>ActionPropertyBase</cstring> </property> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>405</width> <height>424</height> </rect> </property> <property name="caption"> <string>Action Property</string> </property> <grid> <property name="name"> [...1132 lines suppressed...] <include location="global" impldecl="in declaration">kkeybutton.h</include> </includes> <layoutdefaults spacing="6" margin="11"/> <includehints> <includehint>klineedit.h</includehint> <includehint>klineedit.h</includehint> <includehint>kcombobox.h</includehint> <includehint>klineedit.h</includehint> <includehint>kicondialog.h</includehint> <includehint>klineedit.h</includehint> <includehint>klineedit.h</includehint> <includehint>klineedit.h</includehint> <includehint>ktextedit.h</includehint> <includehint>klistbox.h</includehint> <includehint>klistbox.h</includehint> <includehint>klistbox.h</includehint> <includehint>klistbox.h</includehint> <includehint>kkeybutton.h</includehint> </includehints> </UI> |
From: Jonas B. <jb...@us...> - 2004-07-23 00:03:30
|
Update of /cvsroot/krusader/krusader_kde3/krusader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29725/krusader Modified Files: Makefile.am krusader.cpp krusader.h Log Message: initial import of the new useraction-system Index: krusader.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/krusader.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** krusader.h 18 Apr 2004 19:25:55 -0000 1.21 --- krusader.h 23 Jul 2004 00:03:17 -0000 1.22 *************** *** 56,59 **** --- 56,60 ---- class KSystemTray; class UserMenu; + class UserAction; class Krusader : public KParts::MainWindow { *************** *** 121,124 **** --- 122,126 ---- KAccel *accels; // global accelerators static UserMenu *userMenu; + static UserAction *userAction; signals: *************** *** 179,182 **** --- 181,185 ---- #define krCombine Krusader::App->actCombine #define krUserMenu Krusader::App->actUserMenu + #define krUserAction Krusader::App->userAction #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Makefile.am,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Makefile.am 16 Jun 2004 08:30:45 -0000 1.17 --- Makefile.am 23 Jul 2004 00:03:17 -0000 1.18 *************** *** 5,11 **** krusader_SOURCES = paneltabbar.cpp panelmanager.cpp krservices.cpp main.cpp krusaderview.cpp krusader.cpp krslots.cpp kicons.cpp ! krusader_LDADD = ./BookMan/libBookMan.a ./Dialogs/libDialogs.a ./GUI/libGUI.a ./Konfigurator/libKonfigurator.a ./KViewer/libKViewer.a ./MountMan/libMountMan.a ./Panel/libPanel.a ./RemoteMan/libRemoteMan.a ./VFS/libVFS.a ./Search/libSearch.a ./Splitter/libSplitter.a ./Synchronizer/libSynchronizer.a ./UserMenu/libUserMenu.a ./Locate/libLocate.a UserMenu/libUserMenu.a VFS/libVFS.a KViewer/libKViewer.a Dialogs/libDialogs.a BookMan/libBookMan.a GUI/libGUI.a $(LIB_KPARTS) $(LIB_KFILE) $(LIB_KHTML) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) $(LIBSOCKET) ! SUBDIRS = BookMan Dialogs GUI Konfigurator KViewer MountMan Panel RemoteMan VFS Search Splitter Synchronizer UserMenu Locate EXTRA_DIST = krusader.desktop defaults.h kicons.cpp kicons.h krslots.cpp krslots.h krusader.cpp krusader.h krusaderui.rc krusaderview.cpp krusaderview.h main.cpp resources.h krservices.cpp krservices.h panelmanager.cpp panelmanager.h paneltabbar.cpp paneltabbar.h 16-blue-krusader.png 22-blue-krusader.png 32-blue-krusader.png 48-blue-krusader.png 64-blue-krusader.png 16-red-krusader.png 22-red-krusader.png 32-red-krusader.png 48-red-krusader.png 64-red-krusader.png --- 5,12 ---- krusader_SOURCES = paneltabbar.cpp panelmanager.cpp krservices.cpp main.cpp krusaderview.cpp krusader.cpp krslots.cpp kicons.cpp ! krusader_LDADD = ./BookMan/libBookMan.a ./Dialogs/libDialogs.a ./GUI/libGUI.a ./Konfigurator/libKonfigurator.a ./KViewer/libKViewer.a ./MountMan/libMountMan.a ./Panel/libPanel.a ./RemoteMan/libRemoteMan.a ./VFS/libVFS.a ./Search/libSearch.a ./Splitter/libSplitter.a ./Synchronizer/libSynchronizer.a ./UserMenu/libUserMenu.a ./Locate/libLocate.a UserAction/libUserAction.a VFS/libVFS.a KViewer/libKViewer.a Dialogs/libDialogs.a BookMan/libBookMan.a GUI/libGUI.a $(LIB_KPARTS) $(LIB_KFILE) $(LIB_KHTML) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) $(LIBSOCKET) ! SUBDIRS = BookMan Dialogs GUI Konfigurator KViewer MountMan Panel RemoteMan VFS \ ! Search Splitter Synchronizer Locate UserAction UserMenu EXTRA_DIST = krusader.desktop defaults.h kicons.cpp kicons.h krslots.cpp krslots.h krusader.cpp krusader.h krusaderui.rc krusaderview.cpp krusaderview.h main.cpp resources.h krservices.cpp krservices.h panelmanager.cpp panelmanager.h paneltabbar.cpp paneltabbar.h 16-blue-krusader.png 22-blue-krusader.png 32-blue-krusader.png 48-blue-krusader.png 64-blue-krusader.png 16-red-krusader.png 22-red-krusader.png 32-red-krusader.png 48-red-krusader.png 64-red-krusader.png Index: krusader.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/krusader.cpp,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** krusader.cpp 22 Jul 2004 15:58:38 -0000 1.73 --- krusader.cpp 23 Jul 2004 00:03:17 -0000 1.74 *************** *** 75,78 **** --- 75,79 ---- #include "krslots.h" #include "krservices.h" + #include "UserAction/useraction.h" #include "UserMenu/usermenu.h" *************** *** 123,126 **** --- 124,128 ---- KAction *Krusader::actSyncDirs = 0; KToggleAction *Krusader::actToggleTerminal = 0; + UserAction *Krusader::userAction = 0; UserMenu *Krusader::userMenu = 0; *************** *** 496,500 **** actRoot->setToolTip( i18n( "ROOT (/)" ) ); actFind->setToolTip( i18n( "Search for files" ) ); ! } /////////////////////////////////////////////////////////////////////////// --- 498,505 ---- actRoot->setToolTip( i18n( "ROOT (/)" ) ); actFind->setToolTip( i18n( "Search for files" ) ); ! ! // setup all UserActions ! userAction = new UserAction(); ! } /////////////////////////////////////////////////////////////////////////// |
From: Jonas B. <jb...@us...> - 2004-07-23 00:03:29
|
Update of /cvsroot/krusader/krusader_kde3/krusader/UserAction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29725/krusader/UserAction Added Files: Makefile.am expander.cpp expander.h kraction.cpp kraction.h useraction.cpp useraction.h useractionproperties.cpp useractionproperties.h useractionxml.cpp useractionxml.h Log Message: initial import of the new useraction-system --- NEW FILE: useractionproperties.cpp --- // // C++ Implementation: useraction // // Description: This manages all useractions // // // Author: Shie Erlich and Rafi Yanai <>, (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #include "useractionproperties.h" UserActionProperties::UserActionProperties() { //fill with defaults _execType = Normal; _descriptionUseTooltip = false; _separateStderr = false; _acceptURLs = false; _callEach = false; _confirmExecution = false; } void UserActionProperties::copyFrom( UserActionProperties* from ) { _name = *from->name(); _title = *from->title(); _category = *from->category(); _icon = *from->icon(); _tooltip = *from->tooltip(); _description = *from->description(); _command = *from->command(); _startpath = *from->startpath(); _showonlyProtocol = *from->showonlyProtocol(); _showonlyPath = *from->showonlyPath(); _showonlyMime = *from->showonlyMime(); _showonlyFile = *from->showonlyFile(); _execType = from->execType(); _descriptionUseTooltip = from->descriptionUseTooltip(); _separateStderr = from->separateStderr(); _acceptURLs = from->acceptURLs(); _callEach = from->callEach(); _confirmExecution = from->confirmExecution(); _defaultShortcut = *from->defaultShortcut(); } ////////////////////////// access functions ////////////////////////// QString* UserActionProperties::name() { return &_name; } void UserActionProperties::setName(const QString& name) { _name = name; } QString* UserActionProperties::title() { return &_title; } void UserActionProperties::setTitle(const QString& title) { _title = title;} QString* UserActionProperties::category() { return &_category; } void UserActionProperties::setCategory(const QString& category) { _category = category;} QString* UserActionProperties::icon() { return &_icon; } void UserActionProperties::setIcon(const QString& icon) { _icon = icon;} QString* UserActionProperties::tooltip() { return &_tooltip; } void UserActionProperties::setTooltip(const QString& tooltip) { _tooltip = tooltip;} QString* UserActionProperties::description() { return &_description; } void UserActionProperties::setDescription(const QString& description) { _description = description;} QString* UserActionProperties::command() { return &_command; } void UserActionProperties::setCommand(const QString& command) { _command = command;} QString* UserActionProperties::startpath() { return &_startpath; } void UserActionProperties::setStartpath(const QString& startpath) { _startpath = startpath;} QStringList* UserActionProperties::showonlyProtocol() { return &_showonlyProtocol; } void UserActionProperties::setShowonlyProtocol(const QStringList& showonlyProtocol) { _showonlyProtocol = showonlyProtocol;} QStringList* UserActionProperties::showonlyPath() { return &_showonlyPath; } void UserActionProperties::setShowonlyPath(const QStringList& showonlyPath) { _showonlyPath = showonlyPath;} QStringList* UserActionProperties::showonlyMime() { return &_showonlyMime; } void UserActionProperties::setShowonlyMime(const QStringList& showonlyMime) { _showonlyMime = showonlyMime;} QStringList* UserActionProperties::showonlyFile() { return &_showonlyFile; } void UserActionProperties::setShowonlyFile(const QStringList& showonlyFile) { _showonlyFile = showonlyFile;} UserActionProperties::ExecType UserActionProperties::execType() { return _execType; } void UserActionProperties::setExecType(const ExecType& execType) { _execType = execType;} bool UserActionProperties::descriptionUseTooltip() { return _descriptionUseTooltip; } void UserActionProperties::setDescriptionUseTooltip(const bool& descriptionUseTooltip) { _descriptionUseTooltip = descriptionUseTooltip;} bool UserActionProperties::separateStderr() { return _separateStderr; } void UserActionProperties::setSeparateStderr(const bool& separateStderr) { _separateStderr = separateStderr;} bool UserActionProperties::acceptURLs() { return _acceptURLs; } void UserActionProperties::setAcceptURLs(const bool& acceptURLs) { _acceptURLs = acceptURLs;} bool UserActionProperties::callEach() { return _callEach; } void UserActionProperties::setCallEach(const bool& callEach) { _callEach = callEach;} bool UserActionProperties::confirmExecution() { return _confirmExecution; } void UserActionProperties::setConfirmExecution(const bool& confirmExecution) { _confirmExecution = confirmExecution;} KShortcut* UserActionProperties::defaultShortcut() { return &_defaultShortcut; } void UserActionProperties::setDefaultShortcut(const KShortcut& defaultShortcut) { _defaultShortcut = defaultShortcut;} --- NEW FILE: kraction.cpp --- // // C++ Implementation: kraction // // Description: // // // Author: Shie Erlich and Rafi Yanai <>, (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #include <kdialogbase.h> #include <kdebug.h> #include <klocale.h> #include <kinputdialog.h> #include <qtextedit.h> #include <qvbox.h> #include <qlabel.h> #include <kaction.h> #include <kurl.h> #include "kraction.h" #include "expander.h" #include "useractionproperties.h" ////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////// KrActionProcDlg ///////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// KrActionProcDlg::KrActionProcDlg( QString caption, bool enableStderr, QWidget *parent ) : KDialogBase( parent, 0, false, caption, KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Cancel ) { setButtonOKText( "Close", i18n( "Close this window" ) ); enableButtonOK( false ); // disable the close button, until the process finishes setButtonCancelText( "Kill", i18n( "Kill the running process" ) ); QVBox *page = makeVBoxMainWidget(); // do we need to separate stderr and stdout? if ( enableStderr ) { // create stdout new QLabel( i18n( "Standard Output (stdout)" ), page ); _stdout = new QTextEdit( page ); _stdout->setReadOnly( true ); _stdout->setMinimumWidth( fontMetrics().maxWidth() * 40 ); // create stderr new QLabel( i18n( "Standard Error (stderr)" ), page ); _stderr = new QTextEdit( page ); _stderr->setReadOnly( true ); _stderr->setMinimumWidth( fontMetrics().maxWidth() * 40 ); } else { // create stdout new QLabel( i18n( "Output" ), page ); _stdout = new QTextEdit( page ); _stdout->setReadOnly( true ); _stdout->setMinimumWidth( fontMetrics().maxWidth() * 40 ); } } void KrActionProcDlg::addStderr( KProcess *proc, char *buffer, int buflen ) { _stderr->append( QString::fromLatin1( buffer, buflen ) ); } void KrActionProcDlg::addStdout( KProcess *proc, char *buffer, int buflen ) { _stdout->append( QString::fromLatin1( buffer, buflen ) ); } ////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////// KrActionProc //////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// KrActionProc::KrActionProc( UserActionProperties* prop ) : QObject(), _properties( prop ), _proc( new KProcess() ), _output( 0 ) { _proc->setUseShell( true ); connect( _proc, SIGNAL( processExited( KProcess* ) ), this, SLOT( processExited( KProcess* ) ) ) ; } KrActionProc::~KrActionProc() { delete _proc; } bool KrActionProc::start( QString cmdLine ) { QStringList list = cmdLine; start( list ); } #include <kmessagebox.h> bool KrActionProc::start( QStringList cmdLineList ) { _proc->clearArguments(); bool result = true; if ( cmdLineList.count() > 1 ) KMessageBox::sorry( 0, "Support for more then one command is currently broken! I'll try to execute these commands anyway:\n" + cmdLineList.join("\n") ); if ( _properties->execType() != UserActionProperties::CollectOutput ) { for ( QStringList::Iterator it = cmdLineList.begin(); it != cmdLineList.end(); ++it) { _proc->clearArguments(); // run in terminal if ( _properties->execType() == UserActionProperties::Terminal ) { ( *_proc ) << "konsole" << "--noclose" << "-e" << *it; // FIXME read terminal-setting from config } else { // no terminal, no output collection ( *_proc ) << *it; } result = ( result && _proc->start( KProcess::NotifyOnExit, ( KProcess::Communication ) ( KProcess::Stdout | KProcess::Stderr ) ) ); // while ( _proc->isRunning() ); // FIXME: replace this with a nice proc-queue } //for } else { // collect output _output = new KrActionProcDlg( *_properties->title(), _properties->separateStderr() ); // connect the output to the dialog connect( _proc, SIGNAL( receivedStderr( KProcess*, char*, int ) ), _output, SLOT( addStderr( KProcess*, char *, int ) ) ); connect( _proc, SIGNAL( receivedStdout( KProcess*, char*, int ) ), _output, SLOT( addStdout( KProcess*, char *, int ) ) ); connect( _output, SIGNAL( cancelClicked() ), this, SLOT( kill() ) ); _output->show(); for ( QStringList::Iterator it = cmdLineList.begin(); it != cmdLineList.end(); ++it) { //TODO: read header fom config and place it on top of each command _proc->clearArguments(); ( *_proc ) << *it; result = ( result && _proc->start( KProcess::NotifyOnExit, ( KProcess::Communication ) ( KProcess::Stdout | KProcess::Stderr ) ) ); // while ( _proc->isRunning() ); // FIXME: replace this with a nice proc-queue } //for } return result; } void KrActionProc::processExited( KProcess *proc ) { // enable the 'close' button on the dialog (if active), disable 'kill' button if ( _output ) { _output->enableButtonOK( true ); _output->enableButtonCancel( false); } delete this; // banzai!! } ////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////// KrAction /////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// //KrAction::KrAction( UserActionProperties* prop, KActionCollection *parent ) : KAction( Title, Shortcut, QObject, SLOT(), parent, name ) { KrAction::KrAction( UserActionProperties* prop, KActionCollection *parent ) : KAction( *prop->title(), 0, 0, 0, parent, prop->name()->latin1() ) { _properties = 0; setProperties( prop ); connect(this, SIGNAL(activated()), this, SLOT(exec()) ); } KrAction::~KrAction() { unplugAll(); delete _properties; } void KrAction::setProperties( UserActionProperties* prop ) { if ( ! prop->icon()->isEmpty() ) setIcon( *prop->icon() ); if ( ! prop->tooltip()->isEmpty() ) { setToolTip( *prop->tooltip() ); if ( prop->descriptionUseTooltip() ) setWhatsThis( *prop->tooltip() ); } if ( ! prop->description()->isEmpty() && whatsThis().isEmpty() ) setWhatsThis( *prop->description() ); if ( ! prop->defaultShortcut()->isNull() ) setShortcut( *prop->defaultShortcut() ); //setGroup( prop->category() ); //FIXME: what is KAction.setGroup(QString) for ??? if ( _properties == 0 ) _properties = prop; else _properties->copyFrom( prop ); //copy the values, not the pointer } UserActionProperties* KrAction::properties() { return _properties; } void KrAction::exec() { KrActionProc *proc; // replace %% and prepare string QStringList commandList = Expander::expand( *_properties->command(), _properties->acceptURLs(), _properties->callEach() ); if ( _properties->confirmExecution() ) { for ( QStringList::iterator it = commandList.begin(); it != commandList.end(); ++it ) { bool exec = true; *it = KInputDialog::getText( i18n( "Confirm execution" ), i18n( "Command beeing executed:" ), *it, &exec, 0 ); if ( exec ) { proc = new KrActionProc( _properties ); proc->start( *it ); } } //for } // if ( _properties->confirmExecution() ) else { proc = new KrActionProc( _properties ); proc->start( commandList ); } } bool KrAction::isAvailable( const KURL& currentURL ) { bool available = true; //show per default (FIXME: make the default an attribute of <availability>) //check protocol if ( ! _properties->showonlyProtocol()->empty() ) { available = false; for ( QStringList::Iterator it = _properties->showonlyProtocol()->begin(); it != _properties->showonlyProtocol()->end(); ++it ) { //kdDebug() << "KrAction::isAvailable currendProtocol: " << currentURL.protocol() << " =?= " << *it << endl; if ( currentURL.protocol() == *it ) { // FIXME remove trailing slashes at the xml-parsing (faster because done only once) available = true; break; } } } //check protocol: done //check the Path-list: if ( ! _properties->showonlyPath()->empty() ) { available = false; for ( QStringList::Iterator it = _properties->showonlyPath()->begin(); it != _properties->showonlyPath()->end(); ++it ) { if ( (*it).right(1) == "*" ){ if ( currentURL.path().find( (*it).left( (*it).length() - 1 ) ) == 0 ) { available = true; break; } } else if ( currentURL.directory() == *it ) { // FIXME remove trailing slashes at the xml-parsing (faster because done only once) available = true; break; } } } //check the Path-list: done //TODO: check mime-type //TODO: check filename return available; } --- NEW FILE: useractionxml.cpp --- // // C++ Implementation: useraction // // Description: This handles the useraction.xml // // // Author: Jonas Bähr (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #include <kstandarddirs.h> #include <kdebug.h> #include <klocale.h> #include <qfile.h> #include <qstring.h> // for the xml-parsing #include <qdom.h> #include "useractionxml.h" #include "useractionproperties.h" #define ACTION_XML "krusader/useractions.xml" #define ACTION_DOCTYPE "KrusaderUserActions" // in well formed XML the root-element has to have the same name then the doctype: #define ACTION_ROOT ACTION_DOCTYPE // #define ACTION_ROOT "actions" UserActionXML::UserActionXML() { _filename = locateLocal( "data", ACTION_XML ); getActionDom(); // kdDebug() << "UserActionXML: _dom = " << _doc << endl; } UserActionXML::UserActionXML( QString filename ) { _filename = filename; getActionDom(); } void UserActionXML::getActionDom() { _doc = new QDomDocument( ACTION_DOCTYPE ); QFile file( _filename ); if( file.open( IO_ReadOnly ) ) { //kdDebug() << "UserAction::getActionDom: " << _filename << "could be opened" << endl; if( !_doc->setContent( &file ) ) { //kdDebug() << "UserAction::getActionDom: content set - failed" << endl; // if the file doesn't exist till now, the content CAN be set but is empty. // if the content can't be set, the file exists and is NOT an xml-file. file.close(); delete _doc; _doc = 0; } file.close(); QDomElement root = _doc->documentElement(); // check if the file got the right root-element (ACTION_ROOT) - this finds out if the xml-file read to the DOM is realy an krusader useraction-file if( root.tagName() != ACTION_ROOT ) { kdWarning() << "UserActions: the actionfile's root-element isn't called "ACTION_ROOT", using " << _filename << endl; delete _doc; _doc = 0; } } else _doc->appendChild( _doc->createElement( ACTION_ROOT ) ); // create new actionfile by adding a root-element ACTION_ROOT } void UserActionXML::writeActionDom() { writeActionDom( _filename ); } void UserActionXML::writeActionDom( QString filename ) { QFile file( filename ); if( !file.open( IO_WriteOnly ) ) { //TODO: create warning return; } QTextStream ts( &file ); //ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << doc->toString().utf8(); ts << _doc->toString(); file.close(); } QDomElement UserActionXML::makeActionElement( UserActionProperties *prop ) { QDomElement property; QDomAttr attribute; //create child - the action itself QDomElement action = _doc->createElement( "action" ); if ( ! prop->name()->simplifyWhiteSpace().isEmpty() ) { attribute = _doc->createAttribute( "name" ); attribute.setValue( *prop->name() ); action.setAttributeNode( attribute ); } //property: <title> property = _doc->createElement( "title" ); property.appendChild( _doc->createTextNode( *prop->title() ) ); action.appendChild( property ); //property: <tooltip> if ( ! prop->tooltip()->simplifyWhiteSpace().isEmpty() ) { property = _doc->createElement( "tooltip" ); property.appendChild( _doc->createTextNode( *prop->tooltip() ) ); action.appendChild( property ); } //property: <icon> if ( ! prop->icon()->simplifyWhiteSpace().isEmpty() ) { property = _doc->createElement( "icon" ); property.appendChild( _doc->createTextNode( *prop->icon() ) ); action.appendChild( property ); } //property: <category> if ( ! prop->category()->simplifyWhiteSpace().isEmpty() ) { property = _doc->createElement( "category" ); property.appendChild( _doc->createTextNode( *prop->category() ) ); action.appendChild( property ); } //property: <descriptopn> if ( prop->descriptionUseTooltip() || ! prop->description()->simplifyWhiteSpace().isEmpty() ) { property = _doc->createElement( "description" ); if ( prop->descriptionUseTooltip() ) { attribute = _doc->createAttribute( "same_as" ); attribute.setValue( "tooltip" ); property.setAttributeNode( attribute ); } else if ( ! prop->description()->simplifyWhiteSpace().isEmpty() ) { property.appendChild( _doc->createTextNode( *prop->description() ) ); } action.appendChild( property ); } // </description> //property: <command> property = _doc->createElement( "command" ); if (prop->execType() == UserActionProperties::Terminal ) { attribute = _doc->createAttribute( "executionmode" ); attribute.setValue( "terminal" ); property.setAttributeNode( attribute ); } else if (prop->execType() == UserActionProperties::CollectOutput) { attribute = _doc->createAttribute( "executionmode" ); if ( prop->separateStderr() ) attribute.setValue( "collect_output_separate_stderr" ); else attribute.setValue( "collect_output" ); property.setAttributeNode( attribute ); } if ( prop->acceptURLs() ) { attribute = _doc->createAttribute( "accept" ); attribute.setValue( "url" ); property.setAttributeNode( attribute ); } if ( prop->callEach() ) { attribute = _doc->createAttribute( "onmultiplefiles" ); attribute.setValue( "call_each" ); property.setAttributeNode( attribute ); } if ( prop->confirmExecution() ) { attribute = _doc->createAttribute( "confirmexecution" ); attribute.setValue( "true" ); property.setAttributeNode( attribute ); } property.appendChild( _doc->createTextNode( *prop->command() ) ); action.appendChild( property ); // </command> //property: <startpath> if ( ! prop->startpath()->simplifyWhiteSpace().isEmpty() ) { property = _doc->createElement( "startpath" ); property.appendChild( _doc->createTextNode( *prop->startpath() ) ); action.appendChild( property ); } //property: <availability> if ( !prop->showonlyProtocol()->empty() || !prop->showonlyPath()->empty() || !prop->showonlyMime()->empty() || !prop->showonlyFile()->empty() ) { property = _doc->createElement( "availability" ); QDomElement subproperty, subsubproperty; // <protocol> if ( !prop->showonlyProtocol()->empty() ) { subproperty = _doc->createElement( "protocol" ); for ( QStringList::iterator it = prop->showonlyProtocol()->begin(); it != prop->showonlyProtocol()->end(); ++it ) { subsubproperty = _doc->createElement( "show" ); subsubproperty.appendChild( _doc->createTextNode( *it ) ); subproperty.appendChild( subsubproperty ); } property.appendChild( subproperty ); } // </protocol> // <path> if ( !prop->showonlyPath()->empty() ) { subproperty = _doc->createElement( "path" ); for ( QStringList::iterator it = prop->showonlyPath()->begin(); it != prop->showonlyPath()->end(); ++it ) { subsubproperty = _doc->createElement( "show" ); subsubproperty.appendChild( _doc->createTextNode( *it ) ); subproperty.appendChild( subsubproperty ); } property.appendChild( subproperty ); } // </path> // <mimetype> if ( !prop->showonlyMime()->empty() ) { subproperty = _doc->createElement( "mimetype" ); for ( QStringList::iterator it = prop->showonlyMime()->begin(); it != prop->showonlyMime()->end(); ++it ) { subsubproperty = _doc->createElement( "show" ); subsubproperty.appendChild( _doc->createTextNode( *it ) ); subproperty.appendChild( subsubproperty ); } property.appendChild( subproperty ); } // </mimetype> // <filename> if ( !prop->showonlyFile()->empty() ) { subproperty = _doc->createElement( "filename" ); for ( QStringList::iterator it = prop->showonlyFile()->begin(); it != prop->showonlyFile()->end(); ++it ) { subsubproperty = _doc->createElement( "show" ); subsubproperty.appendChild( _doc->createTextNode( *it ) ); subproperty.appendChild( subsubproperty ); } property.appendChild( subproperty ); } // </filename> action.appendChild( property ); } // </availability> //property: <defaultshortcut> if ( ! prop->defaultShortcut()->isNull() ) { property = _doc->createElement( "defaultshortcut" ); property.appendChild( _doc->createTextNode( prop->defaultShortcut()->toStringInternal() ) ); //.toString() would return a localised string which can't be read again action.appendChild( property ); } return action; } QDomElement* UserActionXML::findActionByName( QString name ) { QDomElement root = _doc->documentElement(); for (QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling() ) { QDomElement element = node.toElement(); if( !element.isNull() ) { if( element.tagName() == "action" ) { if ( name == element.attribute( "name", "" ) ) { QDomElement *tmp = new QDomElement; *tmp = element; return tmp; } // if ( name == element.attribute( "name", "" ) ) } } } // for (QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling() ) return 0; } void UserActionXML::addActionToDom( UserActionProperties *prop ) { QDomElement root = _doc->documentElement(); root.appendChild( makeActionElement( prop) ); } void UserActionXML::removeAction( QString name ) { QDomElement *oldAction = findActionByName( name ); if ( oldAction ) { removeAction( oldAction ); delete oldAction; } } void UserActionXML::removeAction( QDomElement *action ) { if (action == 0) return; QDomElement root = _doc->documentElement(); root.removeChild( *action ); } bool UserActionXML::updateAction( UserActionProperties *prop ) { return updateAction( *prop->name(), prop ); } bool UserActionXML::updateAction( QString name, UserActionProperties *prop ) { QDomElement *oldAction = findActionByName( name ); if ( oldAction ) { updateAction( oldAction, prop ); delete oldAction; return true; } else return false; } void UserActionXML::updateAction( QDomElement *action, UserActionProperties *prop ) { if (action == 0) return; QDomElement root = _doc->documentElement(); root.replaceChild( makeActionElement( prop ), *action ); } UserActionProperties* UserActionXML::readAction( QDomElement *action ) { if (action == 0) return 0; UserActionProperties *prop = new UserActionProperties; QString attr; prop->setName( action->attribute( "name", "" ) ); for ( QDomNode node = action->firstChild(); !node.isNull(); node = node.nextSibling() ) { QDomElement e = node.toElement(); // <title> if ( e.tagName() == "title" ) { //kdDebug() << "UserAction: title found: " << e.text() << endl; prop->setTitle( e.text() ); } else // <tooltip> if ( e.tagName() == "tooltip" ) { //kdDebug() << "UserAction: tooltip found: " << e.text() << endl; prop->setTooltip( e.text() ); } else // <icon> if ( e.tagName() == "icon" ) { //kdDebug() << "UserAction: icon found: " << e.text() << endl; prop->setIcon( e.text() ); } else // <category> if ( e.tagName() == "category" ) { //kdDebug() << "UserAction: category found: " << e.text() << endl; prop->setCategory( e.text() ); } else // <description> if ( e.tagName() == "description" ) { //kdDebug() << "UserAction: description found: " << e.text() << endl; attr = e.attribute( "same_as", "" ); // default: not set if ( attr == "" ) { prop->setDescription( e.text() ); prop->setDescriptionUseTooltip( false ); } else if ( attr == "tooltip") { prop->setDescription( *prop->tooltip() ); prop->setDescriptionUseTooltip( true ); } else kdWarning() << "unrecognized attribute value in "ACTION_XML" found <action name=\"" << prop->name() << "\"><command accept=\"" << attr << "\""<< endl; } // </description> else // <command> if (e.tagName() == "command") { //kdDebug() << "UserAction: command found: " << e.text() << endl; prop->setCommand( e.text() ); attr = e.attribute( "executionmode", "normal" ); // default: "normal" prop->setSeparateStderr( false ); if ( attr == "terminal" ) prop->setExecType( UserActionProperties::Terminal ); else if ( attr == "normal") prop->setExecType( UserActionProperties::Normal ); else if ( attr == "collect_output") prop->setExecType( UserActionProperties::CollectOutput ); else if ( attr == "collect_output_separate_stderr") { prop->setExecType( UserActionProperties::CollectOutput ); prop->setSeparateStderr( true ); } else kdWarning() << "unrecognized attribute value in "ACTION_XML" <action name=\"" << prop->name() << "\"><command executionmode=\"" << attr << "\""<< endl; attr = e.attribute( "accept", "local" ); // default: "local" if ( attr == "local" ) prop->setAcceptURLs( false ); else if ( attr == "url") prop->setAcceptURLs( true ); else kdWarning() << "unrecognized attribute value in "ACTION_XML" found <action name=\"" << prop->name() << "\"><command accept=\"" << attr << "\""<< endl; attr = e.attribute( "onmultiplefiles", "call_once" ); // default: "call_once" if ( attr == "call_once" ) prop->setCallEach( false ); else if ( attr == "call_each") prop->setCallEach( true ); else kdWarning() << "unrecognized attribute value in "ACTION_XML" found <action name=\"" << prop->name() << "\"><command onmultiplefiles=\"" << attr << "\""<< endl; attr = e.attribute( "confirmexecution", "false" ); // default: "false" if ( attr == "false" ) prop->setConfirmExecution( false ); else prop->setConfirmExecution( true ); } // </command> else // <startpath> if ( e.tagName() == "startpath" ) { //kdDebug() << "UserAction: startpath found: " << e.text() << endl; prop->setStartpath( e.text() ); } else // <availability> if (e.tagName() == "availability") { //kdDebug() << "UserAction: availability found: " << e.text() << endl; for ( QDomNode availabilitynode = e.firstChild(); !availabilitynode.isNull(); availabilitynode = availabilitynode.nextSibling() ) { QDomElement availabilityelement = availabilitynode.toElement(); // <protocol> if ( availabilityelement.tagName() == "protocol" ) { //kdDebug() << "UserAction: availability->protocol found: " << availabilityelement.text() << endl; for ( QDomNode subnode = availabilityelement.firstChild(); !subnode.isNull(); subnode = subnode.nextSibling() ) { QDomElement subelement = subnode.toElement(); if ( subelement.tagName() == "show" ) { //kdDebug() << "UserAction: availability->protocol->show found: " << subelement.text() << endl; prop->showonlyProtocol()->append( subelement.text() ); } } } // </protocol> else // <path> if ( availabilityelement.tagName() == "path" ) { //kdDebug() << "UserAction: availability->path found: " << availabilityelement.text() << endl; for ( QDomNode subnode = availabilityelement.firstChild(); !subnode.isNull(); subnode = subnode.nextSibling() ) { QDomElement subelement = subnode.toElement(); if ( subelement.tagName() == "show" ) { //kdDebug() << "UserAction: availability->path->show found: " << subelement.text() << endl; prop->showonlyPath()->append( subelement.text() ); } } } // </path> else // <mimetype> if ( availabilityelement.tagName() == "mimetype" ) { //kdDebug() << "UserAction: availability->mimetype found: " << availabilityelement.text() << endl; for ( QDomNode subnode = availabilityelement.firstChild(); !subnode.isNull(); subnode = subnode.nextSibling() ) { QDomElement subelement = subnode.toElement(); if ( subelement.tagName() == "show" ) { //kdDebug() << "UserAction: availability->mimetype->show found: " << subelement.text() << endl; prop->showonlyMime()->append( subelement.text() ); } } } // </mimetype> else // <filename> if ( availabilityelement.tagName() == "filename" ) { //kdDebug() << "UserAction: availability->filename found: " << availabilityelement.text() << endl; for ( QDomNode subnode = availabilityelement.firstChild(); !subnode.isNull(); subnode = subnode.nextSibling() ) { QDomElement subelement = subnode.toElement(); if ( subelement.tagName() == "show" ) { //kdDebug() << "UserAction: availability->filename->show found: " << subelement.text() << endl; prop->showonlyFile()->append( subelement.text() ); } } } // </filename> } } // </availability> else // <defaultshortcut> if ( e.tagName() == "defaultshortcut" ) { //kdDebug() << "UserAction: defaultshortcut found: " << e.text() << endl; prop->defaultShortcut()->init( e.text() ); //kdDebug() << "UserAction: defaultshortcut verify: " << prop->defaultShortcut.toString() << endl; } else // unknown but not empty (comments, <!-- -->, are empty) if (e.tagName() != "") { kdWarning() << "unrecognized tag in "ACTION_XML" found: <action name=\"" << prop->name() << "\"><" << e.tagName() << ">" << endl; } } // for ( QDomNode node = action->firstChild(); !node.isNull(); node = node.nextSibling() ) //kdDebug() << "UserAction: New action; distnct name: \"" << prop->name << "\"\n"; return prop; } UserActionProperties* UserActionXML::readAction( QString name ) { QDomElement *action = findActionByName( name ); if ( action ) { UserActionProperties* prop = readAction( action ); delete action; return prop; } else return 0; } QStringList UserActionXML::getActionNames() { if (_doc == 0) return 0; QStringList actionNames = QStringList(); QDomElement root = _doc->documentElement(); for (QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling() ) { QDomElement element = node.toElement(); if( !element.isNull() ) { actionNames.append( element.attribute( "name", "" ) ); } } // for (QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling() ) return actionNames; } QStringList UserActionXML::getActionCategories() { if (_doc == 0) return 0; QStringList actionCategories = QStringList(); QDomElement root = _doc->documentElement(); for (QDomNode rootnode = root.firstChild(); !rootnode.isNull(); rootnode = rootnode.nextSibling() ) { QDomElement element = rootnode.toElement(); if( !element.isNull() ) { for ( QDomNode actionnode = element.firstChild(); !actionnode.isNull(); actionnode = actionnode.nextSibling() ) { QDomElement e = actionnode.toElement(); // <category> if ( e.tagName() == "category" ) { // add only if not already in list if ( actionCategories.find(e.text()) == actionCategories.end() ) actionCategories.append( e.text() ); break; } } // for ( QDomNode actionnode = element.firstChild(); !actionnode.isNull(); actionnode = actionnode.nextSibling() ) } } // for (QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling() ) return actionCategories; } bool UserActionXML::nameExists( QString name ) { if ( findActionByName( name ) ) return true; else return false; } --- NEW FILE: useraction.h --- // // C++ Interface: useraction // // Description: This manages all useractions // // // Author: Jonas Bähr (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifndef USERACTION_H #define USERACTION_H #include <qvaluelist.h> class UserActionProperties; class UserActionXML; class QString; class QStringList; class KrAction; class KURL; /** * Useractions are Krusaders backend for user-defined actions on current/selected files in its panels and for krusader's internal actions which need some parameter. @n * There are several komponents: * - The xml-file (read by UserActionXML) * - The interface to KDE's action-system (the KrAction) * - The Expander, which parses the commandline for placeholders and calls the internal actions * - A widget to manipulate the UserActionProperties via GUI (ActionProperty) * . * @author Jonas Bähr (http://www.jonas-baehr.de) */ class UserAction { public: typedef QValueList<KrAction*> KrActionList; /** * The constructor reands all useractions out of an xml-file in the users home-dir. * @todo: read also from global data for actions for all users */ UserAction(); ~UserAction(); /** * Call this to register a new KrAction * @param prop Init the new KrAction with these values */ void addKrAction(UserActionProperties* prop); /** * Searches in all regirsterd KrActions the one with name == name * @param name the name of the searched KrAction * @return a pointer to a KrAction */ KrAction* action(const QString& name); /** * Use this to access the whole list of registerd KrActions. * currently only used to fill the usermenu with all available actions. This should change... * @return A pointer to the internal KrActionList */ KrActionList* actionList(); /** * updates only the KrAction with name=name with prop (not from the xml) * @param name Name of the KrAction to update * @param prop Update with this values */ void updateKrAction(const QString& name, UserActionProperties *prop); /** * same as above * @internal */ void updateKrAction(KrAction* action, UserActionProperties* prop); /** * removes a KrAction * @param name Name of the KrAction which should be removed */ void removeKrAction(const QString& name); /** * check for each KrAction if it is available for the currend location / file and disables it if not */ void setAvailability(); /** * same as above but check for a specitic file * @param currentURL Check for this file */ void setAvailability(const KURL& currentURL); /** * @return A pointer to the useraction-xml-handler */ UserActionXML* xml(); private: KrActionList _actions; UserActionXML* _xml; }; #endif // ifndef USERACTION_H --- NEW FILE: useractionproperties.h --- // // C++ Interface: useraction // // Description: This manages all useractions // // // Author: Shie Erlich and Rafi Yanai <>, (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifndef USERACTIONPROPERTIES_H #define USERACTIONPROPERTIES_H #include <kshortcut.h> #include <qstring.h> #include <qstringlist.h> /** * This holds all properties of a UserAction. * @author Jonas Bähr (http://www.jonas-baehr.de) */ class UserActionProperties { public: enum ExecType { Terminal, CollectOutput, Normal }; /** * This initiate every propertywith it's default */ UserActionProperties(); /** * Use this to dublicate properties. * @param from properties which should be copied */ void copyFrom(UserActionProperties* from); /** * The name(id) has to be unique and is used to identify the action * @return The name */ QString* name(); void setName(const QString& name); /** * This title is displayd in menus and popups * @return The title */ QString* title(); void setTitle(const QString& title); /** * For an better overview all actions are grouped by thier category * @return The category */ QString* category(); void setCategory(const QString& category); /** * The icon of the action * @return The icon */ QString* icon(); void setIcon(const QString& icon); /** * The tooltip of the action * @return The tooltip */ QString* tooltip(); void setTooltip(const QString& tooltip); /** * A description of the action (used also as instant-help(waht's this; shift-F1)) * @return The description */ QString* description(); void setDescription(const QString& description); /** * The command beenig executed (with Placeholder) * @return The command */ QString* command(); void setCommand(const QString& command); /** * A path where the action should be executed * @return The startpath */ QString* startpath(); void setStartpath(const QString& startpath); /** * A list of protocols for which the action should be available * @return The protocol-list */ QStringList* showonlyProtocol(); void setShowonlyProtocol(const QStringList& showonlyProtocol); /** * A list of paths for which the action should be available * @return The path-list */ QStringList* showonlyPath(); void setShowonlyPath(const QStringList& showonlyPath); /** * A list of mime-types for which the action should be available * @return The mime-list */ QStringList* showonlyMime(); void setShowonlyMime(const QStringList& showonlyMime); /** * A list of file-filters for which the action should be available * @return file-list */ QStringList* showonlyFile(); void setShowonlyFile(const QStringList& showonlyFile); /** * How the action should be executed * @return The exec-type */ ExecType execType(); void setExecType(const ExecType& execType); /** * @return true if the tooltip should be used as desctiption */ bool descriptionUseTooltip(); void setDescriptionUseTooltip(const bool& descriptionUseTooltip); /** * @return true if the output-collection should separate std. out from std. error */ bool separateStderr(); void setSeparateStderr(const bool& separateStderr); /** * @return true if the Placeholder should return local paths or URL's */ bool acceptURLs(); void setAcceptURLs(const bool& acceptURLs); /** * @return true if the command should be executed for each selected file (%_Current% will be used) */ bool callEach(); void setCallEach(const bool& callEach); /** * @return true if true the user has to confirm the execution. Here he also can edit the already expanded command */ bool confirmExecution(); void setConfirmExecution(const bool& confirmExecution); /** * ///< Default shortcut for the action. * @return The shortcut */ KShortcut* defaultShortcut(); void setDefaultShortcut(const KShortcut& defaultShortcut); private: QString _name; QString _title; QString _category; QString _icon; QString _tooltip; QString _description; QString _command; QString _startpath; QStringList _showonlyProtocol; QStringList _showonlyPath; QStringList _showonlyMime; QStringList _showonlyFile; ExecType _execType; bool _descriptionUseTooltip; bool _separateStderr; bool _acceptURLs; bool _callEach; bool _confirmExecution; KShortcut _defaultShortcut; }; #endif // ifndef USERACTIONPROPERTIES_H --- NEW FILE: useraction.cpp --- // // C++ Implementation: useraction // // Description: This manages all useractions // // // Author: Jonas Bähr (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #include <kdebug.h> #include <kurl.h> #include <qstring.h> #include <qdom.h> #include "useraction.h" #include "useractionxml.h" #include "useractionproperties.h" #include "kraction.h" #include "../krusader.h" #include "../krusaderview.h" #include "../Panel/listpanel.h" #include "../Panel/panelfunc.h" UserAction::UserAction() { kdDebug() << "Initialisising useractions..." << endl; _xml = new UserActionXML; QStringList actionNames = _xml->getActionNames(); for ( QStringList::Iterator it = actionNames.begin(); it != actionNames.end(); ++it ) addKrAction( _xml->readAction(*it) ); kdDebug() << _actions.count() << " useractions read." << endl; } void UserAction::addKrAction( UserActionProperties* prop ) { _actions.append( new KrAction( prop, krApp->actionCollection() ) ); } UserAction::~UserAction() { for ( KrActionList::iterator it = _actions.begin(); it != _actions.end(); ++it ) delete *it; } KrAction* UserAction::action( const QString& name ) { for ( KrActionList::iterator it = _actions.begin(); it != _actions.end(); ++it ) { if ( name == *(*it)->properties()->name() ) return *it; } return 0; } void UserAction::updateKrAction( const QString& name, UserActionProperties* prop ) { updateKrAction( action( name ), prop ); } void UserAction::updateKrAction( KrAction* action, UserActionProperties* prop ) { action->setProperties( prop ); } void UserAction::removeKrAction( const QString& name ) { for ( KrActionList::iterator it = _actions.begin(); it != _actions.end(); ++it ) { if ( *(*it)->properties()->name() == name ) { delete *it; _actions.remove( it ); return; } } } void UserAction::setAvailability() { setAvailability( krApp->mainView->activePanel->func->files()->vfs_getFile( krApp->mainView->activePanel->view->getCurrentItem() ) ); } void UserAction::setAvailability( const KURL& currentURL ) { //kdDebug() << "UserAction::setAvailability currendFile: " << currentURL.url() << endl; // disable the entries that should not appear in this folder for ( KrActionList::iterator it = _actions.begin(); it != _actions.end(); ++it ) (*it)->setEnabled( (*it)->isAvailable( currentURL ) ); } UserActionXML* UserAction::xml() { return _xml; } UserAction::KrActionList* UserAction::actionList() { // kdDebug() << "UserAction::actionList() provide " << _actions.count() << " useractions" << endl; return &_actions; } --- NEW FILE: expander.h --- // // C++ Interface: expander // // Description: // // // Author: Jonas Bähr (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifndef EXPANDER_H #define EXPANDER_H // class QString; #include <qstring.h> class QStringList; // #include <qstringlist.h> class ListPanel; /** * The Expander expands the command of an UserAction by replacing all placeholders by thier current values.@n * Each placeholder begins with a '%'-sign, followed by one char indicating the panel, followed by a command which may have some paramenter enclosed in brackets and also ends with a '%'-sign. * Examples are %aPath% or %rBookmark("/home/jonas/src/krusader_kde3", "yes")%.@n * The panel-indicator has to be either 'a' for the active, 'o' for the other, 'r' for the right, 'l' for the left or '_' for panel-independence. * * Currently sopported are these commands can be ordered in three groups (childs are the parameter in the right order): * - Placeholders for Krusaders panel-data (panel-indicator has to be 'a', 'o', 'r' or 'l') * - @em Path is replaced by the panel's path * - @em Count is replaced by a nomber of * -# Either "All", "Files", "Dirs", "Selected" * . * - @em Filter is preplaced by the panels filter-mask (ex: "*.cpp *.h") * - @em Current is replaced by the current item or, in case of onmultiple="call_each", by each selected item. * -# If "yes", only the filename (without path) is returned * . * - @em List isreplaced by a list of * -# Either "All", "Files", "Dirs", "Selected" * -# A seperator between the items (default: " " [one space]) * -# If "yes", only the filename (without path) is returned * -# (for all but "Selected") a filter-mask (default: "*") * . * . * - Access to panel-dependent, krusader-internal, parameter-needed functions (panel-indicator has to be 'a', 'o', 'r' or 'l') * - @em Select manipulates the selection of the panel * -# A filter-mask (nessesary) * -# Either "Add", "Remove", "Set" (default) * . * - @em Bookmark manipulates the selection of the panel * -# A path or URL (nessesary) * -# If "yes", the location is opend in a new tab * . * . * - Access to panel-independent, krusader-internal, parameter-needed functions (panel-indicator doesn't matter but should be set to '_') * - @em Ask displays a lineedit and is replaced by its return * -# The question (nessesary) * -# A default answer * -# A cation for the popup * . * - @em Clipboard manipulates the system-wide clipboard * -# The string copied to clip (ex: "%aCurrent%") (nessesary) * -# A separator. If set, parameter1 is append with this to the current clipboard content * . * . * . * Since all placeholders are expanded in the order they appear in the command, little one-line-scripts are possible * * @author Jonas Bähr (http://www.jonas-baehr.de), Shie Erlich */ class Expander { public: /** an expander is a function that receives a QString input, expands * it and returns a new QString output containing the expanded expression. */ typedef QString ( *EXPANDER ) ( const ListPanel*, const QStringList&, const bool&, const int& ); /** * This holds informations about each parameter */ typedef struct Parameter { QString description; ///< A description of the parameter QString preset; ///< the default of the parameter bool nessesary; ///< false if the parameter is optional }; /** * a Placeholder is an entry containing the expression, its expanding function and Parameter */ typedef struct Placeholder { QString expression; ///< The placeholder (without '%' or panel-prefix) QString description; ///< A description of the placeholder EXPANDER expFunc; ///< The function used to expand it Parameter parameter[4]; ///< All Parameter of this placeholder (WARNING: max 4; if needed more, change it in the header) int parameterCount; ///< How many parameter are realy defined bool needPanel; ///< true if the placeholder needs a panel to operate on }; /** * This expands a whole commandline by calling (if callEach is true) expandCurrent for each selected item (else only once) * * @param stringToExpand the commandline with the placeholder * @param useUrl true if the path's should be expanded to an URL instead of an local path * @param callEach true if %_Current% should be expanded once for every selected item * @return a list of all commands (one if callEach is false or one for every selectet item if true) */ static QStringList expand( const QString& stringToExpand, bool useUrl, bool callEach ); static const int numOfPlaceholder = 11; ///< How many Placeholder are realy defined /** * A List of all Placeholder and thier Parameter. This is used to generate the AddPlaceholderPopup as well as by the expand function */ static Placeholder placeholder[ numOfPlaceholder ]; protected: /** * expands %_Path% ('_' is replaced by 'a', 'o', 'r' or 'l' to indicate the active, other, right or left panel) with the path of the specified panel */ static QString exp_Path( const ListPanel* panel, const QStringList& parameter, const bool& useUrl, const int& currentItem ); /** * expands %_Count% ('_' is replaced by 'a', 'o', 'r' or 'l' to indicate the active, other, right or left panel) with the number of items, which type is specified by the first Parameter */ static QString exp_Count( const ListPanel* panel, const QStringList& parameter, const bool& useUrl, const int& currentItem ); /** * expands %_Filter% ('_' is replaced by 'a', 'o', 'r' or 'l' to indicate the active, other, right or left panel) with the correspondend filter (ie: "*.cpp") */ static QString exp_Filter( const ListPanel* panel, const QStringList& parameter, const bool& useUrl, const int& currentItem ); /** * expands %_Current% ('_' is replaced by 'a', 'o', 'r' or 'l' to indicate the active, other, right or left panel) with the current item ( != the selected onec) */ static QString exp_Current( const ListPanel* panel, const QStringList& parameter, const bool& useUrl, const int& currentItem ); /** * expands %_List% ('_' is replaced by 'a', 'o', 'r' or 'l' to indicate the active, other, right or left panel) with a list of items, which type is specified by the first Parameter */ static QString exp_List( const ListPanel* panel, const QStringList& parameter, const bool& useUrl, const int& currentItem ); /** * expands %_Ask% ('_' is nessesary because there is no panel needed) with the return of an input-dialog */ static QString exp_Ask( const ListPanel* panel, const QStringList& parameter, const bool& useUrl, const int& currentItem ); /** * This copies it's first Parameter to the clipboard */ static QString exp_Clipboard( const ListPanel* panel, const QStringList& parameter, const bool& useUrl, const int& currentItem ); /** * This selects all items by the mask given with the first Parameter */ static QString exp_Select( const ListPanel* panel, const QStringList& parameter, const bool& useUrl, const int& currentItem ); /** * This changes the panel'spath to the value given with the first Parameter. */ static QString exp_Bookmark( const ListPanel* panel, const QStringList& parameter, const bool& useUrl, const int& currentItem ); /** * This expands a whole commandline by calling for each Placeholder the correspondend expander * * @param stringToExpand the commandline with the placeholder * @param useUrl true if the path's should be expanded to an URL instead of an local path * @param currentItem the number of the current item (to expand once with every selectet item) or -1. * @return the expanded commanline for the current item */ static QString expandCurrent( const QString& stringToExpand, bool useUrl, int currentItem ); /** * @param panelIndicator either '_' for panel-independent placeholders, 'a', 'o', 'r', or 'l' for the active, other (inactive), right or left panel * @return a pointer to the right panel or NULL if no panel is needed. */ static ListPanel* getPanel( const char& panelIndicator ); /** * This splits the parameter-string into separate parameter and expands each * @param exp the string holding all parameter * @param useUrl true if the path's should be expanded to an URL instead of an local path * @return a list of all parameter */ static QStringList separateParameter( QString* exp, bool useUrl ); /** * This finds the end of a placeholder, taking care of the parameter * @return the position where the placeholder ends */ static int findEnd( const QString& str, int start ); }; #endif // ifndef EXPANDER_H --- NEW FILE: Makefile.am --- ####### kdevelop will overwrite this part!!! (begin)########## noinst_LIBRARIES = libUserAction.a INCLUDES = $(all_includes) libUserAction_a_METASOURCES = AUTO libUserAction_a_SOURCES = useraction.cpp kraction.cpp expander.cpp useractionxml.cpp useractionproperties.cpp ####### kdevelop will overwrite this part!!! (end)############ noinst_HEADERS = kraction.h --- NEW FILE: useractionxml.h --- // // C++ Interface: useraction // // Description: This handles the useraction.xml // // // Author: Jonas Bähr (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #ifndef USERACTIONXML_H #define USERACTIONXML_H class UserActionProperties; class QDomDocument; class QDomElement; class QString; class QStringList; /** * This class provides all functions needed for the storing and manipulating stored UserAction. * * <b>structur of the xml-file</b> * * The !DOCTYPE has do be "KrusaderUserActions" as well as the name of the root-element! @n * - @em KrusaderUserActions (root-element) * - @em action Each of this elements represents an useraction. @n * attribute @em name Name (id) of the action. (needed) * - @em title The displayed title of the action (needed) * - @em tooltip A tooltip for the action * - @em icon An icon for the action * - @em category A category for the action. * - @em description A description of the action. Also used as instant-help (Shift-F1, "Waht's This")@n * attribute @em same_as Only valid value: "tooltip". If set, the tooltip is used as description * - @em command The commandline which should be executed. It may contain some placeholder, interpreted by the Expander (needed) @n * attribute @em executionmode Valid values: "ternimal", "collect_output", "collect_output_separate_stderr" @n * attribute @em accept Only valid value: "url" @n * attribute @em onmultiplefiles Only valid value: "call_each" @n * attribute @em confirmexecution Only valid value: "true" * - @em startpath Execute the action at this location * - @em availability * - @em protocol If set, the action is only available there (if not, it's allways available) * - @em show Each of this are protocols where the action should be available * . * - @em path If set, the action is only available there (if not, it's allways available) * - @em show Each of this is a path where the action should be available * . * - @em mimetype If set, the action is only available there (if not, it's allways available) * - @em show Each of this are mime-types for which the action should be available * . * - @em filename If set, the action is only available there (if not, it's allways available) * - @em show Each of this are filenames for which the action should be available * . * . * - @em defaultshortcut A default keyboard-shortcut for the action. * . * . * . * * @bug Krusader chrashes if the action-file hasn't got the right doctype/root-element * @author Jonas Bähr (http://www.jonas-baehr.de) */ class UserActionXML { public: /** * This constructor reads the action-file in KDE's local data */ UserActionXML(); /** * This reads an actionfile from an given filename * @param filename Action-file to parese */ UserActionXML( QString filename ); /** * Write the actionfile to the original filename (given in the constructor) */ void writeActionDom(); /** * This writes the actionfile to a specific file. * @param filename File to write to. */ void writeActionDom( QString filename ); /** * Check if there already is an action with this name * @param name Name to check * @return true is the name exists */ bool nameExists( QString name ); /** * Add a new action to the DOM * @param prop Properties of the new action */ void addActionToDom( UserActionProperties *prop ); /** * Remove the action with this name from the DOM */ void removeAction( QString name ); /** * Updates an action with new properties. The name have to remain the same! * @param prop New properties * @return */ bool updateAction( UserActionProperties *prop ); /** * Updates a specific action with new properties * @param name Name of the old action * @param prop New Properties * @return */ bool updateAction( QString name, UserActionProperties *prop ); /** * Read the properties of a specific action * @param name Name of the action which should be read * @return compleate properties of the action */ UserActionProperties* readAction( QString name ); /** * @return A list with the names of all existing actions. */ QStringList getActionNames(); /** * @return A list with all existing categories */ QStringList getActionCategories(); protected: void getActionDom(); QDomElement* findActionByName( QString name ); QDomElement makeActionElement( UserActionProperties *prop ); void removeAction( QDomElement *action ); void updateAction( QDomElement *action, UserActionProperties *prop ); UserActionProperties* readAction( QDomElement *action ); private: QDomDocument *_doc; QString _filename; }; #endif // ifndef USERACTIONXML_H --- NEW FILE: expander.cpp --- // // C++ Implementation: expander // // Description: // // // Author: Jonas Bähr (C) 2004 // // Copyright: See COPYING file that comes with this distribution // // #include <expander.h> #include "../krusader.h" #include "../krusaderview.h" #include "../panelmanager.h" #include "../Panel/listpanel.h" #include "../Panel/panelfunc.h" #include <kdebug.h> #include <kinputdialog.h> #include <qstringlist.h> #include <qclipboard.h> #define ACTIVE krApp->mainView->activePanel #define OTHER krApp->mainView->activePanel->otherPanel // #define GETPANEL (str.lower()[1]=='a' ? ACTIVE : OTHER) ListPanel* Expander::getPanel( const char& panelIndicator ) { switch ( panelIndicator ) { case 'a': return krApp->mainView->activePanel; case 'o': return krApp->mainView->activePanel->otherPanel; case 'l': return krApp->mainView->left; case 'r': return krApp->mainView->right; case '_': return 0; default: kdWarning() << "Expander: unknown Panel " << panelIndicator << endl; return 0; } } Expander::Placeholder Expander::placeholder[ Expander::numOfPlaceholder ] = { // { "expression", "description", expander_func, {parameter}, no. of parameters, need a panel } // if "expression" == "" => instertSeparator() // parameter: { "description", "default", nessesary }, ... (max 5, see .h) {"Path", i18n("panel's path"), exp_Path, { }, 0, true}, {"Count", i18n("number of ..."), exp_Count, { {i18n("count all:"), "__choose:All;Files;Dirs;Selected", false} }, 1, true}, {"Filter", i18n("filter mask (*.h, *.cpp ...)"), exp_Filte... [truncated message content] |
From: Jonas B. <jb...@us...> - 2004-07-23 00:03:29
|
Update of /cvsroot/krusader/krusader_kde3/krusader/Konfigurator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29725/krusader/Konfigurator Modified Files: Makefile.am konfigurator.cpp Added Files: kguseractions.cpp kguseractions.h Log Message: initial import of the new useraction-system --- NEW FILE: kguseractions.h --- (This appears to be a binary file; contents omitted.) Index: Makefile.am =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Konfigurator/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.am 19 Mar 2004 22:57:57 -0000 1.4 --- Makefile.am 23 Jul 2004 00:03:18 -0000 1.5 *************** *** 6,10 **** libKonfigurator_a_METASOURCES = AUTO ! libKonfigurator_a_SOURCES = kgcolors.cpp kgdependencies.cpp konfiguratorpage.cpp konfiguratoritems.cpp konfigurator.cpp kgwelcome.cpp kgstartup.cpp kglookfeel.cpp kggeneral.cpp kgarchives.cpp kgadvanced.cpp --- 6,12 ---- libKonfigurator_a_METASOURCES = AUTO ! libKonfigurator_a_SOURCES = kgcolors.cpp kgdependencies.cpp \ ! konfiguratorpage.cpp konfiguratoritems.cpp konfigurator.cpp kgwelcome.cpp kgstartup.cpp \ ! kglookfeel.cpp kggeneral.cpp kgarchives.cpp kgadvanced.cpp kguseractions.cpp --- NEW FILE: kguseractions.cpp --- (This appears to be a binary file; contents omitted.) Index: konfigurator.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/Konfigurator/konfigurator.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** konfigurator.cpp 21 Mar 2004 07:26:17 -0000 1.11 --- konfigurator.cpp 23 Jul 2004 00:03:18 -0000 1.12 *************** *** 53,56 **** --- 53,57 ---- #include "kgdependencies.h" #include "kgcolors.h" + #include "kguseractions.h" Konfigurator::Konfigurator(bool f) : KDialogBase(0,0,true,"Konfigurator", *************** *** 108,111 **** --- 109,115 ---- newContent(new KgDependencies(firstTime, widget->addPage(i18n("Dependencies"),i18n("Set the full path of the external applications"), QPixmap(krLoader->loadIcon("kr_dependencies",KIcon::Desktop,32))))); + // useractions + newContent(new KgUserActions(firstTime, widget->addPage(i18n("User Actions"),i18n("Configure you personal actions"), + QPixmap(krLoader->loadIcon("kr_useractions",KIcon::Desktop,32))))); widget->showPage( widget->pageIndex( firstPage ) ); |
From: Jonas B. <jb...@us...> - 2004-07-22 23:47:15
|
Update of /cvsroot/krusader/krusader_kde3/krusader/UserAction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27554/krusader/UserAction Log Message: Directory /cvsroot/krusader/krusader_kde3/krusader/UserAction added to the repository |
From: Karai C. <ck...@us...> - 2004-07-22 15:58:47
|
Update of /cvsroot/krusader/krusader_kde3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2926/krusader_kde3 Modified Files: ChangeLog Log Message: FIXED: [ 946567 ] krusader minimizes to tray on desktop change Index: ChangeLog =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/ChangeLog,v retrieving revision 1.253 retrieving revision 1.254 diff -C2 -d -r1.253 -r1.254 *** ChangeLog 22 Jul 2004 09:11:27 -0000 1.253 --- ChangeLog 22 Jul 2004 15:58:38 -0000 1.254 *************** *** 1,16 **** ====================== ! FIX: mountman changes... read the email ;-) 1.40 ====================== ! ADDED: when searching in files (grep), push the string we're searching for into the clipboard when pressing F3 or F4. this saves an extra copy when searching inside the file ADDED: Catalan translation ! DISABLED usermenu for 1.40 ! FIXED: [ 962340 ] Alt-T broken to call Tools menu ! FIXED: [ 980252 ] Compare by Content: right/left position swapped ! FIXED: [ 990141 ] F3/F4 in root mode trouble with permissions ! FIXED: [ 959916 ] Krusader window too large on startup FIXED: username and group information are wrong for ftp_vfs FIXED: UMR (uninitialized memory read) in vfs::fromPathOrURL --- 1,17 ---- ====================== ! FIXED: [ 946567 ] krusader minimizes to tray on desktop change ! FIXED: mountman changes... read the email ;-) 1.40 ====================== ! ADDED: when searching in files (grep), push the string we're searching for into the clipboard when pressing F3 or F4. this saves an extra copy when searching inside the file ADDED: Catalan translation ! DISABLED usermenu for 1.40 ! FIXED: [ 962340 ] Alt-T broken to call Tools menu ! FIXED: [ 980252 ] Compare by Content: right/left position swapped ! FIXED: [ 990141 ] F3/F4 in root mode trouble with permissions ! FIXED: [ 959916 ] Krusader window too large on startup FIXED: username and group information are wrong for ftp_vfs FIXED: UMR (uninitialized memory read) in vfs::fromPathOrURL *************** *** 126,130 **** FIXED: ftp port limit changed from 999 to 65535 ! UPDATED: new package description - Thanks to Jonas Bähr UPDATED: Krusader Handbook (read ./doc/ChangeLog for more info) UPDATED: Japanese translation --- 127,131 ---- FIXED: ftp port limit changed from 999 to 65535 ! UPDATED: new package description - Thanks to Jonas B�r UPDATED: Krusader Handbook (read ./doc/ChangeLog for more info) UPDATED: Japanese translation *************** *** 224,228 **** ====================== ADDED: Finally, the new bookmark system is here! courtasy of Jan Halasa ! ADDED: new Hungarian translation, thanks to Kukk Zoltán FIXED: mountMan bug - didn't allow to umount/mount filesystem with trailing / FIXED: width of modified column for i18n (thanks to heiner) --- 225,229 ---- ====================== ADDED: Finally, the new bookmark system is here! courtasy of Jan Halasa ! ADDED: new Hungarian translation, thanks to Kukk Zolt� FIXED: mountMan bug - didn't allow to umount/mount filesystem with trailing / FIXED: width of modified column for i18n (thanks to heiner) |