SHARP Zaurus
ザウルスサポートステーション
slfileselector.h
メインページ   クラス階層   アルファベット順リスト   データ構造リスト   ファイルリスト   データ構造メンバ  
slfileselector.h

00001 /*
00002  * Copyright (C) 2002 SHARP CORPORATION All rights reserved.
00003  */
00004 #ifndef _SLFILESELECTOR_H_INCLUDED
00005 #define _SLFILESELECTOR_H_INCLUDED
00006 
00007 #include <qhbox.h>
00008 #include <qvbox.h>
00009 #include <qlistview.h>
00010 #include <qiconview.h>
00011 #include <qtoolbutton.h>
00012 #include <qfileinfo.h>
00013 #include <qtableview.h>
00014 #include <qwidgetstack.h>
00015 #include <qvaluelist.h>
00016 
00017 #include "applnk.h"
00018 #include <mimetype.h>
00019 #include "slmisc.h"
00020 
00021 class QComboBox;
00022 class SlFileItemType;
00023 class QCopChannel;
00024 
00025 struct SlFileListItemPrivate;
00026 class SlFileListItem
00027 {
00028 public:
00029     SlFileListItem(const QFileInfo&,const MimeType&);
00030     ~SlFileListItem();
00031     const QFileInfo &file() const;
00032     const MimeType &mimeType() const;
00033     const QString getItemIconFilePath() const;
00034     const QString name() const;
00035     void setName(const QString&);
00036     const QString sortKey() const;
00037     void setSortKey(const QString&);
00038     QPixmap pixmap() const;
00039     QPixmap bigPixmap() const;
00040     const QString dateString() const;
00041     const QString typeString() const;
00042     const QString bytesString() const;
00043     void setDevice();
00044     bool isDevice() const;
00045     enum ColumnItem {
00046         Name = 1,
00047         Type,
00048         Date,
00049         Bytes,
00050         Custom = 100
00051     };
00052 private:
00053     SlFileListItemPrivate *p;
00054     SlFileListItem(const SlFileListItem&);
00055 };
00056 
00057 typedef QValueList<SlFileListItem*> SlFileList;
00058 typedef QValueList<SlFileListItem::ColumnItem> SlFileListColumnConf;
00059 
00060 class SlFileListViewItem;
00061 
00062 struct SlFileListViewPrivate;
00063 class SlFileListView : public QListView
00064 {
00065     Q_OBJECT
00066 
00067 public:
00068     SlFileListView(QWidget*, const char*);
00069     ~SlFileListView();
00070     void createFileList(SlFileList&);
00071     int fileCount() const;
00072     void updateItem(SlFileListViewItem*);
00073     void createItem(SlFileListItem*);
00074     void deleteItem(const QString&);
00075     void deleteItem(SlFileListViewItem*);
00076     SlFileListViewItem* searchItem(const QString&);
00077     SlFileListColumnConf columnConf();
00078     void setColumnConf(SlFileListColumnConf&);
00079     void updateColumn();
00080     static const QString columnItemName(SlFileListItem::ColumnItem);
00081     static const SlFileListColumnConf columnItemList();
00082 
00083     virtual void takeItem( SlFileListViewItem * );
00084     
00085     SlMisc::SlListColumnInfos columnWidthInfos();
00086     
00087 protected:
00088     void keyPressEvent( QKeyEvent *e );
00089 
00090 signals:
00091     void keyPressed(QKeyEvent *e,bool &isAccepted);
00092 
00093 protected slots:
00094 
00095 private:
00096     friend class SlFileSelector;
00097     SlFileListViewPrivate *p;
00098     SlFileListView(const SlFileListView&);
00099 };
00100 
00101 class SlFileIconViewItem;
00102 
00103 struct SlFileIconViewPrivate;
00104 class SlFileIconView : public QIconView
00105 {
00106     Q_OBJECT
00107 
00108 public:
00109     SlFileIconView(QWidget*, const char*);
00110     ~SlFileIconView();
00111     void createFileList(SlFileList&);
00112     int fileCount() const;
00113     void updateItem(SlFileIconViewItem*);
00114     void createItem(SlFileListItem*);
00115     void deleteItem(const QString&);
00116     void deleteItem(SlFileIconViewItem*);
00117     SlFileIconViewItem* searchItem(const QString&);
00118     void setSorting(int column,bool ascending);
00119     int sortColumn() const;
00120     void repaintItemsForce();
00121     SlFileListColumnConf columnConf();
00122     void setColumnConf(SlFileListColumnConf&);
00123 
00124     virtual void takeItem( SlFileIconViewItem * );
00125 
00126 protected:
00127     void keyPressEvent( QKeyEvent *e );
00128 
00129 protected slots:
00130 
00131 signals:
00132     void keyPressed(QKeyEvent *e,bool &isAccepted);
00133 
00134 private:
00135     friend class SlFileSelector;
00136     SlFileIconViewPrivate *p;
00137     SlFileIconView(const SlFileIconView&);
00138 };
00139 
00140 class SlFileSelectorFilter : public QObject
00141 {
00142 public:
00143     SlFileSelectorFilter(QWidget *parent,const char *name=0);
00144     ~SlFileSelectorFilter();
00145 
00146     virtual bool isAddToList(QFileInfo&) const = 0;
00147 private:
00148     SlFileSelectorFilter(const SlFileSelectorFilter&);
00149 };
00150 
00151 typedef QList<MimeType> SlFileMimeTypeList;
00152 
00153 struct SlFileSelectorPrivate;
00154 class SlFileSelector : public QVBox
00155 {
00156     Q_OBJECT
00157 
00158 public:
00159     
00160 
00161     enum SlFileSelectorViewType {
00162         
00163         ListView = 1,
00164         
00165         IconView
00166     };
00167     
00168 
00169     enum SlFileOverwirteMode {
00170         
00171         Overwrite = 1,
00172         
00173         NewName,
00174         
00175         Error
00176     };
00177     SlFileSelector(const QString &dirPath,
00178                    const QString &mimefilter,
00179                    QWidget *parent,
00180                    const char *name);
00181     SlFileSelector(const QString &currentFileName,
00182                    SlFileSelectorViewType type,
00183                    const QString &mimeFilter,
00184                    SlFileListColumnConf &items,
00185                    int sortColumn,bool sortAscending,
00186                    SlFileSelectorFilter *filter=NULL,
00187                    bool isRecursive=FALSE,
00188                    QWidget *parent=NULL,
00189                    const char *name=NULL,
00190                    WFlags f=0);
00191     SlFileSelector(QWidget *parent=NULL,const char *name=NULL,WFlags f=0);
00192     virtual ~SlFileSelector();
00193     void createFileList();
00194     void createFileList(QDir&);
00195     int fileCount() const;
00196     const QFileInfo* selected();
00197     void modifyItem(QFileInfo*,bool);
00198     void createItem(QString&);
00199     void deleteItem(const QString&);
00200     void deleteItem();
00201     void updateItem(const QString&);
00202     SlFileListItem* searchItem(const QString&);
00203     void setSelected();
00204     void setSelected(const QString&);
00205     void ensureItemVisible();
00206     SlFileListItem* selectedItem();
00207     bool setSelectedNext(bool);
00208     bool setSelectedPrev(bool);
00209     const QString currentDir();
00210     void setSorting(int,bool);
00211     int sortColumn() const;
00212     bool ascending() const;
00213     SlFileSelectorViewType viewType();
00214     void setColumnItem(SlFileListColumnConf&);
00215     void setViewType(SlFileSelectorViewType);
00216     void setListView();
00217     void setIconView();
00218     int columnWidth(int);
00219     void setColumnWidth(int,int);
00220     static const QString columnItemName(SlFileListItem::ColumnItem);
00221     static const SlFileListColumnConf columnItemList();
00222     
00223     int columns() const;
00224 
00225     bool upDir();
00226     bool isTopDir();
00227 
00228     void setCurrentFile(const QString&);
00229     const QString currentFile(bool isReal=FALSE);
00230     static bool copyFile(const QString&,const QString&,
00231                          SlFileOverwirteMode m=Error,
00232                          QString *resultName=NULL);
00233     
00234     static bool copyFileCreateDir(const QString &srcName,
00235                                   const QString &dstName,
00236                                   SlFileOverwirteMode m=Error, 
00237                                   QString *resultName=NULL);
00238     static bool moveFile(const QString&,const QString&,
00239                          SlFileOverwirteMode m=Error,
00240                          QString *resultName=NULL);
00241     static QString getCopyFileName(const QString&);
00242 
00243     const QStringList& recent() const;
00244     void setRecent(const QStringList&);
00245     
00246     
00247     void setRecent(const QStringList&,bool isReplace);
00248     void setRecentEnabled(bool);
00249 
00250     const QStringList& history() const;
00251     void setHistory(const QStringList&);
00252     
00253     
00254     void setHistory(const QStringList&,bool isReplace);
00255     bool isHistoryBackAvailable() const;
00256     bool isHistoryForwardAvailable() const;
00257     bool historyBack();
00258     bool historyForward();
00259     QPopupMenu *backHistoryPopupMenu() const;
00260     QPopupMenu *forwardHistoryPopupMenu() const;
00261     void setColumnConf(SlFileListColumnConf&);
00262 
00263     void sendFileUpdateMessage(const QString&);
00264     void updateView();
00265     void recreateIcon();
00266     void focusToNext();
00267     void focusToPrev();
00268     bool rename();
00269     bool newfolder();
00270     bool del();
00271     bool duplicate();
00272     bool cut();
00273     bool copy();
00274     bool paste();
00275     void setMimeFilter(const QString &);
00276     void clearTmpFolder();
00277     
00278     void setRecursive(bool,bool);
00279     bool recursive() const;
00280     void setFilter(SlFileSelectorFilter *);
00281     SlFileSelectorFilter *filter();
00282     bool isEnablePaste();
00283 
00284     static bool deleteFile(const QString&);
00285     static bool deleteDir(const QDir&);
00286     static bool copyDir(const QString &srcName,const QString &dstName,
00287                         SlFileOverwirteMode m=Error);
00288     static bool moveDir(const QString&,const QString&,
00289                         SlFileOverwirteMode m=Error);
00290     static QString getCopyDirName(const QString &);
00291     static bool makeDir(const QString &path);  
00292 
00293     static uint size(const QString &fName);
00294     static uint fileFree(const QString &fName);
00295 
00296     
00297 
00298     enum DesktopMode {
00299         
00300         HideDesktop = 1,
00301         
00302         ShowAll,
00303         
00304         FileTab
00305     };
00306     void setDesktopMode(DesktopMode mode);
00307     void setEnabledSystemChannel(bool);
00308     void showUpDirBtn(bool);
00309     void showWritableFile(bool);
00310 
00311     
00312     void setEnableSD(bool);
00313     void setEnableCF(bool);
00314     bool getEnableSD();
00315     bool getEnableCF();
00316 
00317     
00318 
00319     
00320     void sendKeyPressEvent( QKeyEvent *e );
00321     
00322     void setScale(int scale);
00323     int scale() const;
00324     
00325     SlMisc::SlListColumnInfos columnWidthInfos();
00326 
00327     
00328 
00329     enum FocusMode {
00330         
00331         Auto = 1,
00332         
00333         ByTab,
00334         
00335         ByCommand
00336     };
00337     void setFocusMode(FocusMode mode);
00338     
00339     void adjustContentsSize();
00340     
00341     static void updateFile(const QString &filename);
00342     
00343     bool delFile(const QString &mymsg);
00344     
00345     bool isIncludedFile(const QString &filename);
00346 
00347 signals:
00348     
00349 
00350     void selectionChanged(const QFileInfo &file,bool isDevice);
00351     
00352 
00353     void fileSelected(const QFileInfo &file);
00354     
00355 
00356     void dirOpened(const QDir &dir);
00357     
00358 
00359     void enabledPaste(bool);
00360     
00361 
00362     void columnWidthChanged(int column,int oldSize,int newSize);
00363     
00364 
00365     void itemRightPressed(const QFileInfo &file,const QPoint &pos);
00366     
00367 
00368     void selectionLost();
00369     
00370 
00371     void keyPressed(QKeyEvent *e,bool &isAccepted);
00372 
00373 private slots:
00374     void fileClicked(QListViewItem *);
00375     void fileClicked(QIconViewItem *);
00376     void selectionChanged(QListViewItem *);
00377     void selectionChanged(QIconViewItem *);
00378     void dMenuChanged(int);
00379     void changeDirectory(int,bool isImmediate=TRUE);
00380     void hMenuSelected(int);
00381     void cardMessage( const QCString &, const QByteArray &);
00382     void systemMessage( const QCString &, const QByteArray &);  
00383     void headerClicked(int);
00384     void asyncHMenuSelected();
00385     void asyncDMenuChanged();
00386     void rightPressed(QIconViewItem *,const QPoint&);
00387     void rightPressed(QListViewItem *,const QPoint&,int);
00388     void upDirClicked();
00389     void slotKeyPressed(QKeyEvent *e,bool &isAccepted);
00390 
00391 protected:
00392     void focusInEvent(QFocusEvent*);
00393     void show();
00394     void keyPressEvent( QKeyEvent *e );
00395 
00396 private:
00397     void openDirInside(QDir&);
00398     void createMyPda();
00399     void init();
00400     SlFileSelectorPrivate *p;
00401     SlFileSelector(const SlFileSelector&);
00402     ulong focusWidgets() const;
00403     QWidget* nextFocus(QWidget *,bool) const;
00404     bool focusToTheWidget(QWidget *);
00405 };
00406 
00407 #endif 
00408 
00409 
00410 
00411 
00412 
 
▲このページのトップへ
関連サイト   修理/ご相談窓口   利用上のご注意
COPYRIGHT