Diffstat (limited to 'libopie2/opieui/fileselector/ofileselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 71d765c..600daff 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -811,6 +811,35 @@ void OFileViewFileSystem::activate( const QString& str) | |||
811 | } | 811 | } |
812 | 812 | ||
813 | /* Selector */ | 813 | /* Selector */ |
814 | /** | ||
815 | * @short new and complete c'tor | ||
816 | * | ||
817 | * Create a OFileSelector to let the user select a file. It can | ||
818 | * either be used to open a file, select a save name in a dir or | ||
819 | * as a dropin for the FileSelector. | ||
820 | * | ||
821 | * <pre> | ||
822 | * QMap<QString, QStringList> mimeTypes; | ||
823 | * QStringList types; | ||
824 | * types << "text@slash* "; | ||
825 | * types << "audio@slash*"; | ||
826 | * mimeTypes.insert( tr("Audio and Text"), types ); | ||
827 | * mimeTypes.insert( tr("All"), "*@slash*); | ||
828 | * | ||
829 | * now you could create your fileselector | ||
830 | * </pre> | ||
831 | * | ||
832 | * | ||
833 | * @param parent the parent of this widget | ||
834 | * @param mode The mode from the enum Mode (Open,Save,FILESELECTOR) | ||
835 | * @param sel The selector to be used | ||
836 | * @param dirName The name of the dir to start int | ||
837 | * @param fileName The fileName placed in the fileselector lineedit | ||
838 | * @param mimetypes The MimeType map of used mimetypes | ||
839 | * @param showNew Show a New Button. Most likely to be used in the FileSelector view. | ||
840 | * @param showClose Show a Close Button. Most likely to be used in FileSelector view. | ||
841 | * | ||
842 | */ | ||
814 | OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | 843 | OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, |
815 | const QString& dirName, const QString& fileName, | 844 | const QString& dirName, const QString& fileName, |
816 | const MimeTypes& mimetypes, | 845 | const MimeTypes& mimetypes, |
@@ -852,6 +881,10 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | |||
852 | 881 | ||
853 | } | 882 | } |
854 | 883 | ||
884 | |||
885 | /** | ||
886 | * This a convience c'tor to just substitute the use of FileSelector | ||
887 | */ | ||
855 | OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, | 888 | OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, |
856 | bool showNew, bool showClose ) | 889 | bool showNew, bool showClose ) |
857 | : QWidget( parent, name ) | 890 | : QWidget( parent, name ) |
@@ -958,41 +991,73 @@ void OFileSelector::initViews() | |||
958 | m_views.insert( QObject::tr("All Files"), in ); | 991 | m_views.insert( QObject::tr("All Files"), in ); |
959 | } | 992 | } |
960 | 993 | ||
994 | /** | ||
995 | * d'tor | ||
996 | */ | ||
961 | OFileSelector::~OFileSelector() | 997 | OFileSelector::~OFileSelector() |
962 | { | 998 | { |
963 | } | 999 | } |
964 | 1000 | ||
1001 | |||
1002 | |||
1003 | /** | ||
1004 | * Convience function for the fileselector | ||
1005 | * make sure to delete the DocLnk | ||
1006 | * | ||
1007 | * @see DocLnk | ||
1008 | * @todo remove in ODP | ||
1009 | */ | ||
965 | const DocLnk* OFileSelector::selected() | 1010 | const DocLnk* OFileSelector::selected() |
966 | { | 1011 | { |
967 | DocLnk* lnk = new DocLnk( currentView()->selectedDocument() ); | 1012 | DocLnk* lnk = new DocLnk( currentView()->selectedDocument() ); |
968 | return lnk; | 1013 | return lnk; |
969 | } | 1014 | } |
970 | 1015 | ||
1016 | /** | ||
1017 | * | ||
1018 | * @return the name of the selected file | ||
1019 | */ | ||
971 | QString OFileSelector::selectedName()const | 1020 | QString OFileSelector::selectedName()const |
972 | { | 1021 | { |
973 | return currentView()->selectedName(); | 1022 | return currentView()->selectedName(); |
974 | } | 1023 | } |
975 | 1024 | ||
1025 | |||
1026 | /** | ||
1027 | * @return the selected path | ||
1028 | */ | ||
976 | QString OFileSelector::selectedPath()const | 1029 | QString OFileSelector::selectedPath()const |
977 | { | 1030 | { |
978 | return currentView()->selectedPath(); | 1031 | return currentView()->selectedPath(); |
979 | } | 1032 | } |
980 | 1033 | ||
1034 | /** | ||
1035 | * @return the directory name | ||
1036 | */ | ||
981 | QString OFileSelector::directory()const | 1037 | QString OFileSelector::directory()const |
982 | { | 1038 | { |
983 | return currentView()->directory(); | 1039 | return currentView()->directory(); |
984 | } | 1040 | } |
985 | 1041 | ||
1042 | /** | ||
1043 | * @return a DocLnk for the selected document | ||
1044 | */ | ||
986 | DocLnk OFileSelector::selectedDocument()const | 1045 | DocLnk OFileSelector::selectedDocument()const |
987 | { | 1046 | { |
988 | return currentView()->selectedDocument(); | 1047 | return currentView()->selectedDocument(); |
989 | } | 1048 | } |
990 | 1049 | ||
1050 | /** | ||
1051 | * @return the number of items for the current view | ||
1052 | */ | ||
991 | int OFileSelector::fileCount()const | 1053 | int OFileSelector::fileCount()const |
992 | { | 1054 | { |
993 | return currentView()->fileCount(); | 1055 | return currentView()->fileCount(); |
994 | } | 1056 | } |
995 | 1057 | ||
1058 | /** | ||
1059 | * @return reparse the file content | ||
1060 | */ | ||
996 | void OFileSelector::reread() | 1061 | void OFileSelector::reread() |
997 | { | 1062 | { |
998 | return currentView()->reread(); | 1063 | return currentView()->reread(); |
@@ -1018,11 +1083,18 @@ MimeTypes OFileSelector::mimeTypes()const | |||
1018 | return m_mimeType; | 1083 | return m_mimeType; |
1019 | } | 1084 | } |
1020 | 1085 | ||
1086 | /** | ||
1087 | * @return the Mode of the OFileSelector | ||
1088 | */ | ||
1021 | int OFileSelector::mode()const | 1089 | int OFileSelector::mode()const |
1022 | { | 1090 | { |
1023 | return m_mode; | 1091 | return m_mode; |
1024 | } | 1092 | } |
1025 | 1093 | ||
1094 | |||
1095 | /** | ||
1096 | * @return the Selector of the OFileSelector | ||
1097 | */ | ||
1026 | int OFileSelector::selector()const | 1098 | int OFileSelector::selector()const |
1027 | { | 1099 | { |
1028 | return m_selector; | 1100 | return m_selector; |