KDEUI
kcodecaction.h
Go to the documentation of this file.
00001 /* 00002 kcodecaction.h 00003 00004 Copyright (c) 2003 Jason Keirstead <jason@keirstead.org> 00005 Copyright (c) 2003-2006 Michel Hermier <michel.hermier@gmail.com> 00006 Copyright (c) 2007 Nick Shaforostoff <shafff@ukr.net> 00007 00008 ******************************************************************** 00009 * * 00010 * This library is free software; you can redistribute it and/or * 00011 * modify it under the terms of the GNU Lesser General Public * 00012 * License as published by the Free Software Foundation; either * 00013 * version 2 of the License, or (at your option) any later version. * 00014 * * 00015 * This library is distributed in the hope that it will be useful, * 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00018 * GNU Lesser General Public License for more details. * 00019 * * 00020 * You should have received a copy of the GNU Lesser General Public * 00021 * License along with this library; if not, write to the * 00022 * Free Software Foundation, Inc., 51 Franklin Street, * 00023 * Fifth Floor, Boston, MA 02110-1301 USA * 00024 * * 00025 ******************************************************************** 00026 */ 00027 #ifndef KCODECACTION_H 00028 #define KCODECACTION_H 00029 00030 #include <kencodingdetector.h> 00031 #include <kselectaction.h> 00032 00038 class KDEUI_EXPORT KCodecAction 00039 : public KSelectAction 00040 { 00041 Q_OBJECT 00042 00043 Q_PROPERTY(QString codecName READ currentCodecName WRITE setCurrentCodec) 00044 Q_PROPERTY(int codecMib READ currentCodecMib) 00045 00046 public: 00047 explicit KCodecAction(QObject *parent,bool showAutoOptions=false); 00048 00049 KCodecAction(const QString &text, QObject *parent,bool showAutoOptions=false); 00050 00051 KCodecAction(const KIcon &icon, const QString &text, QObject *parent,bool showAutoOptions=false); 00052 00053 virtual ~KCodecAction(); 00054 00055 public: 00056 int mibForName(const QString &codecName, bool *ok = 0) const; 00057 QTextCodec *codecForMib(int mib) const; 00058 00059 QTextCodec *currentCodec() const; 00060 bool setCurrentCodec(QTextCodec *codec); 00061 00062 QString currentCodecName() const; 00063 bool setCurrentCodec(const QString &codecName); 00064 00065 int currentCodecMib() const; 00066 bool setCurrentCodec(int mib); 00067 00073 KEncodingDetector::AutoDetectScript currentAutoDetectScript() const; 00079 bool setCurrentAutoDetectScript(KEncodingDetector::AutoDetectScript); 00080 00081 00082 Q_SIGNALS: 00088 void triggered(QTextCodec *codec); 00089 00096 void triggered(KEncodingDetector::AutoDetectScript); 00097 00101 void defaultItemTriggered(); 00102 00103 00104 protected Q_SLOTS: 00105 virtual void actionTriggered(QAction*); 00106 00107 protected: 00108 using KSelectAction::triggered; 00109 00110 private: 00111 class Private; 00112 Private* const d; 00113 00114 Q_PRIVATE_SLOT( d, void _k_subActionTriggered(QAction*) ) 00115 }; 00116 00117 #endif
KDE 4.6 API Reference