svnno****@sourc*****
svnno****@sourc*****
2010年 2月 10日 (水) 19:04:00 JST
Revision: 2559 http://sourceforge.jp/projects/kita/svn/view?view=rev&revision=2559 Author: nogu Date: 2010-02-10 19:04:00 +0900 (Wed, 10 Feb 2010) Log Message: ----------- Merge KITA-KDE4 Modified Paths: -------------- kita/trunk/Doxyfile kita/trunk/INSTALL kita/trunk/README kita/trunk/README.2ch kita/trunk/README.machibbs kita/trunk/TODO kita/trunk/kita/doc/en/index.docbook kita/trunk/kita/po/ja.po kita/trunk/kita/po/kita.pot kita/trunk/kita/src/bbstabwidget.cpp kita/trunk/kita/src/bbstabwidget.h kita/trunk/kita/src/bbsview.cpp kita/trunk/kita/src/bbsview.h kita/trunk/kita/src/boardtabwidget.cpp kita/trunk/kita/src/boardtabwidget.h kita/trunk/kita/src/boardview.cpp kita/trunk/kita/src/boardview.h kita/trunk/kita/src/const.h kita/trunk/kita/src/domtree.cpp kita/trunk/kita/src/domtree.h kita/trunk/kita/src/favoritelistview.cpp kita/trunk/kita/src/favoritelistview.h kita/trunk/kita/src/htmlpart.cpp kita/trunk/kita/src/htmlpart.h kita/trunk/kita/src/kita.desktop kita/trunk/kita/src/kitaui/htmlview.cpp kita/trunk/kita/src/kitaui/htmlview.h kita/trunk/kita/src/kitaui/listviewitem.cpp kita/trunk/kita/src/kitaui/listviewitem.h kita/trunk/kita/src/kitaui/tabwidgetbase.cpp kita/trunk/kita/src/kitaui/tabwidgetbase.h kita/trunk/kita/src/libkita/abone.kcfg kita/trunk/kita/src/libkita/abone.kcfgc kita/trunk/kita/src/libkita/access.cpp kita/trunk/kita/src/libkita/access.h kita/trunk/kita/src/libkita/account.cpp kita/trunk/kita/src/libkita/account.h kita/trunk/kita/src/libkita/asciiart.kcfg kita/trunk/kita/src/libkita/asciiart.kcfgc kita/trunk/kita/src/libkita/boardmanager.cpp kita/trunk/kita/src/libkita/boardmanager.h kita/trunk/kita/src/libkita/cache.cpp kita/trunk/kita/src/libkita/cache.h kita/trunk/kita/src/libkita/datinfo.cpp kita/trunk/kita/src/libkita/datinfo.h kita/trunk/kita/src/libkita/datmanager.cpp kita/trunk/kita/src/libkita/datmanager.h kita/trunk/kita/src/libkita/downloadmanager.h kita/trunk/kita/src/libkita/event.h kita/trunk/kita/src/libkita/favoriteboards.cpp kita/trunk/kita/src/libkita/favoriteboards.h kita/trunk/kita/src/libkita/favoritethreads.cpp kita/trunk/kita/src/libkita/favoritethreads.h kita/trunk/kita/src/libkita/flashcgi.cpp kita/trunk/kita/src/libkita/flashcgi.h kita/trunk/kita/src/libkita/jbbs.cpp kita/trunk/kita/src/libkita/jbbs.h kita/trunk/kita/src/libkita/k2ch.cpp kita/trunk/kita/src/libkita/k2ch.h kita/trunk/kita/src/libkita/kita-utf16.h kita/trunk/kita/src/libkita/kita-utf8.h kita/trunk/kita/src/libkita/kita_misc.cpp kita/trunk/kita/src/libkita/kita_misc.h kita/trunk/kita/src/libkita/machibbs.cpp kita/trunk/kita/src/libkita/machibbs.h kita/trunk/kita/src/libkita/thread.cpp kita/trunk/kita/src/libkita/thread.h kita/trunk/kita/src/libkita/threadindex.cpp kita/trunk/kita/src/libkita/threadindex.h kita/trunk/kita/src/libkita/threadinfo.cpp kita/trunk/kita/src/libkita/threadinfo.h kita/trunk/kita/src/main.cpp kita/trunk/kita/src/mainwindow.cpp kita/trunk/kita/src/mainwindow.h kita/trunk/kita/src/prefs/aboneprefbase.ui kita/trunk/kita/src/prefs/aboneprefpage.cpp kita/trunk/kita/src/prefs/aboneprefpage.h kita/trunk/kita/src/prefs/asciiartprefbase.ui kita/trunk/kita/src/prefs/faceprefbase.ui kita/trunk/kita/src/prefs/uiprefbase.ui kita/trunk/kita/src/respopup.cpp kita/trunk/kita/src/respopup.h kita/trunk/kita/src/threadlistview.cpp kita/trunk/kita/src/threadlistview.h kita/trunk/kita/src/threadlistviewbase.ui kita/trunk/kita/src/threadlistviewitem.cpp kita/trunk/kita/src/threadlistviewitem.h kita/trunk/kita/src/threadproperty.ui kita/trunk/kita/src/threadtabwidget.cpp kita/trunk/kita/src/threadtabwidget.h kita/trunk/kita/src/threadview.cpp kita/trunk/kita/src/threadview.h kita/trunk/kita/src/viewmediator.cpp kita/trunk/kita/src/viewmediator.h kita/trunk/kita/src/writedialogbase.ui kita/trunk/kita/src/writetabwidget.cpp kita/trunk/kita/src/writetabwidget.h kita/trunk/kita/src/writeview.cpp kita/trunk/kita/src/writeview.h Added Paths: ----------- kita/trunk/CMakeLists.txt kita/trunk/config.h.cmake kita/trunk/kita/CMakeLists.txt kita/trunk/kita/doc/CMakeLists.txt kita/trunk/kita/doc/en/CMakeLists.txt kita/trunk/kita/po/CMakeLists.txt kita/trunk/kita/po/Messages.sh kita/trunk/kita/po/extract-messages.sh kita/trunk/kita/src/CMakeLists.txt kita/trunk/kita/src/boardtabwidgetui.rc kita/trunk/kita/src/kitaui/CMakeLists.txt kita/trunk/kita/src/kitaui.rc kita/trunk/kita/src/libkita/CMakeLists.txt kita/trunk/kita/src/libkita/accountconfig.kcfg kita/trunk/kita/src/libkita/accountconfig.kcfgc kita/trunk/kita/src/libkita/bbs.cpp kita/trunk/kita/src/libkita/bbs.h kita/trunk/kita/src/libkita/colorconfig.kcfg kita/trunk/kita/src/libkita/colorconfig.kcfgc kita/trunk/kita/src/libkita/globalconfig.kcfg kita/trunk/kita/src/libkita/globalconfig.kcfgc kita/trunk/kita/src/libkita/parser.cpp kita/trunk/kita/src/libkita/parser.h kita/trunk/kita/src/libkita/postdata.cpp kita/trunk/kita/src/libkita/postdata.h kita/trunk/kita/src/libkita/writeconfig.kcfg kita/trunk/kita/src/libkita/writeconfig.kcfgc kita/trunk/kita/src/prefs/CMakeLists.txt kita/trunk/kita/src/prefs/abstractprefpage.cpp kita/trunk/kita/src/prefs/abstractprefpage.h kita/trunk/kita/src/prefs/asciiartprefpage.cpp kita/trunk/kita/src/prefs/asciiartprefpage.h kita/trunk/kita/src/prefs/faceprefpage.cpp kita/trunk/kita/src/prefs/faceprefpage.h kita/trunk/kita/src/prefs/loginprefbase.ui kita/trunk/kita/src/prefs/loginprefpage.cpp kita/trunk/kita/src/prefs/loginprefpage.h kita/trunk/kita/src/prefs/preferences.cpp kita/trunk/kita/src/prefs/preferences.h kita/trunk/kita/src/prefs/uiprefpage.cpp kita/trunk/kita/src/prefs/uiprefpage.h kita/trunk/kita/src/prefs/writeprefbase.ui kita/trunk/kita/src/prefs/writeprefpage.cpp kita/trunk/kita/src/prefs/writeprefpage.h kita/trunk/kita/src/threadlistheaderview.cpp kita/trunk/kita/src/threadlistheaderview.h kita/trunk/kita/src/threadtabwidgetui.rc kita/trunk/kita/src/writetabwidgetui.rc kita/trunk/kita.spec.cmake Removed Paths: ------------- kita/trunk/.cvsignore kita/trunk/Makefile.am kita/trunk/Makefile.cvs kita/trunk/admin/ kita/trunk/configure.in.in kita/trunk/kita/.cvsignore kita/trunk/kita/Makefile.am kita/trunk/kita/doc/.cvsignore kita/trunk/kita/doc/Makefile.am kita/trunk/kita/doc/en/.cvsignore kita/trunk/kita/doc/en/Makefile.am kita/trunk/kita/po/.cvsignore kita/trunk/kita/po/Makefile.am kita/trunk/kita/src/.cvsignore kita/trunk/kita/src/Makefile.am kita/trunk/kita/src/boardtabwidgetui.rc kita/trunk/kita/src/kita.lsm kita/trunk/kita/src/kitaui/.cvsignore kita/trunk/kita/src/kitaui/Makefile.am kita/trunk/kita/src/kitaui.rc kita/trunk/kita/src/libkita/.cvsignore kita/trunk/kita/src/libkita/Makefile.am kita/trunk/kita/src/libkita/config_xt.kcfg kita/trunk/kita/src/libkita/config_xt.kcfgc kita/trunk/kita/src/libkita/parsemisc.h kita/trunk/kita/src/libkita/qcp932codec.cpp kita/trunk/kita/src/libkita/qcp932codec.h kita/trunk/kita/src/prefs/.cvsignore kita/trunk/kita/src/prefs/Makefile.am kita/trunk/kita/src/prefs/login_page.ui kita/trunk/kita/src/prefs/prefs.cpp kita/trunk/kita/src/prefs/prefs.h kita/trunk/kita/src/prefs/write_page.ui kita/trunk/kita/src/prefs/write_page.ui.h kita/trunk/kita/src/threadtabwidgetui.rc kita/trunk/kita/src/writedialogbase.ui.h kita/trunk/kita/src/writetabwidgetui.rc kita/trunk/kita.spec Property Changed: ---------------- kita/trunk/ kita/trunk/kita/ kita/trunk/kita/doc/ kita/trunk/kita/doc/en/ kita/trunk/kita/po/ kita/trunk/kita/src/ kita/trunk/kita/src/kitaui/ kita/trunk/kita/src/libkita/ kita/trunk/kita/src/prefs/ Property changes on: kita/trunk ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in acinclude.m4 aclocal.m4 autom4te.cache config.h config.h.in config.log config.status configure configure.files configure.in libtool stamp-h.in stamp-h1 subdirs kita.kdevelop.pcs kita.kdevses html latex xml kita.tag + CMakeCache.txt CMakeFiles CMakeTmp CTestTestfile.cmake cmake_install.cmake cmake_uninstall.cmake html kita.tag lib Makefile Added: svn:mergeinfo + /kita/branches/KITA-KDE4:2257-2558 Deleted: kita/trunk/.cvsignore =================================================================== --- kita/trunk/.cvsignore 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/.cvsignore 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,22 +0,0 @@ -Makefile -Makefile.in -acinclude.m4 -aclocal.m4 -autom4te.cache -config.h -config.h.in -config.log -config.status -configure -configure.files -configure.in -libtool -stamp-h.in -stamp-h1 -subdirs -kita.kdevelop.pcs -kita.kdevses -html -latex -xml -kita.tag Copied: kita/trunk/CMakeLists.txt (from rev 2558, kita/branches/KITA-KDE4/CMakeLists.txt) =================================================================== --- kita/trunk/CMakeLists.txt (rev 0) +++ kita/trunk/CMakeLists.txt 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,16 @@ +project(kita) +set(VERSION 0.200.0) + +find_package(KDE4 REQUIRED) + +add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) + +include(KDE4Defaults) + +include(MacroLibrary) + +configure_file(kita.spec.cmake ${CMAKE_CURRENT_BINARY_DIR}/kita.spec) +configure_file(config.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/kita/src/libkita/config.h) + +add_subdirectory(kita) Modified: kita/trunk/Doxyfile =================================================================== --- kita/trunk/Doxyfile 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/Doxyfile 2010-02-10 10:04:00 UTC (rev 2559) @@ -25,7 +25,7 @@ ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = YES -STRIP_FROM_PATH = /home/ikemo/ +STRIP_FROM_PATH = kita/src STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO @@ -80,7 +80,7 @@ #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = /home/ikemo/make/kita +INPUT = kita/src FILE_PATTERNS = *.c \ *.cc \ *.cxx \ Modified: kita/trunk/INSTALL =================================================================== --- kita/trunk/INSTALL 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/INSTALL 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,167 +1,3 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes a while. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Type `make install' to install the programs and any data files and - documentation. - - 4. You can remove the program binaries and object files from the - source code directory by typing `make clean'. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. - +$ cmake . +$ make +# make install Deleted: kita/trunk/Makefile.am =================================================================== --- kita/trunk/Makefile.am 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/Makefile.am 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,22 +0,0 @@ -SUBDIRS = $(TOPSUBDIRS) - -$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs - cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; - -$(top_srcdir)/subdirs: - cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs - -$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in - @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 - -MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files - -package-messages: - $(MAKE) -f admin/Makefile.common package-messages - $(MAKE) -C kita/po merge - -EXTRA_DIST = admin COPYING configure.in.in - -dist-hook: - cd $(top_distdir) && perl admin/am_edit -padmin - cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs Deleted: kita/trunk/Makefile.cvs =================================================================== --- kita/trunk/Makefile.cvs 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/Makefile.cvs 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,10 +0,0 @@ -all: - @echo "This Makefile is only for the CVS repository" - @echo "This will be deleted before making the distribution" - @echo "" - $(MAKE) -f admin/Makefile.common cvs - -dist: - $(MAKE) -f admin/Makefile.common dist - -.SILENT: Modified: kita/trunk/README =================================================================== --- kita/trunk/README 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/README 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,79 +1,33 @@ Kita - 2ch client for KDE -KDE用2ちゃんねるブラウザです。 +KDEç¨2ã¡ãããããã©ã¦ã¶ã§ãã -ライセンスはGPL version 2またはそれ以降です。 -(qcp932codec.{cpp,h}のみBSDライセンスとして扱ってください。) +ã©ã¤ã»ã³ã¹ã¯GPL version 2ã¾ãã¯ãã以éã§ãã -* 前提条件 +* åææ¡ä»¶ -Qt 3.2以降、KDE 3.2以降なら問題無く動くはずです。 +KDE 4.2以éãªãåé¡ç¡ãåãã¯ãã§ãã -* インストール +* ã¤ã³ã¹ãã¼ã« -tar xvfz kita-x.y.z.tar.gz -cd kita-x.y.z -./configure -make -make install +$ tar xvfj kita-x.y.z.tar.bz2 +$ cd kita-x.y.z +$ cmake . +$ make +# make install -CVSからとって来た場合には、 -make -f Makefile.cvs -./configure -make -make install +Subversionããã¨ã£ã¦æ¥ãå ´åã«ã¯ã +$ cmake . +$ make +# make install -* コンパイル時の注意 +* ã³ã³ãã¤ã«æã®æ³¨æ -configureでエラーが出る場合はおそらくライブラリが足りません。 -kdelibs-devel -kdebase-devel -arts-devel -libart_lgpl-devel -あたりをインストールしてください。 -コンパイル時にエラーが出る場合もライブラリの存在をチェックしてください。 +CMakeã§ã¨ã©ã¼ãåºãå ´åã¯ããããã©ã¤ãã©ãªã足ãã¾ããã +KDE4ã®éçºç¨ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãã¦ãã ããã +ã³ã³ãã¤ã«æã«ã¨ã©ã¼ãåºãå ´åãã©ã¤ãã©ãªã®åå¨ããã§ãã¯ãã¦ãã ããã -x86-64(AMD64, EM64T)の場合は、以下のオプションを指定してください。 ---enable-libsuffix=64 --with-qt-libraries=/usr/lib64/qt-3.3/lib -(--with-qt-librariesで指定するディレクトリはOSによって異なります) +* éçºç°å¢ -* 実行時の注意 - -KDEと異なるディレクトリにインストールした場合は、 -環境変数KDEDIRSを設定する必要があります。 -デフォルトでは /usr 以下にインストールされるため、 -SuSE Linuxのように、KDEが /usr 以下にインストールされてない場合は、 - -export KDEDIRS=/usr:$KDEDIR - -と設定してください。configureのオプションで--prefixを指定して、 -別のディレクトリにインストールした場合は、 -/usr の代わりにそのディレクトリをKDEDIRSで設定してください。 - -設定を忘れると、メニューなどの文字列が英語のままになります。 - -SuSE 9.3はダイアログの"OK"と"Cancel"ボタンの挙動が -逆になるというバグがあります。この問題を回避するために、 -以下のように環境変数QT_NO_KDE_INTEGRATIONを1にセットしてください。 - -export QT_NO_KDE_INTEGRATION=1 - -* 開発環境 - -SuSE 9.3 -+ Qt 3.3.4 -+ KDE 3.4.0 -+ KDevelop 3.2.0 - -Hideki Ikemoto <ikemo****@users*****> - -追伸: 一般ユーザ/root以外でインストールする場合 - -./configure --prefix=$HOME/.kde - -とすると幸せになれます。 -環境変数 $KDEHOME が設定されている場合は、 - -./configure --prefix=$KDEHOME - -へと書き換えてね。 +openSUSE 11.2 ++ KDE 4.2 Modified: kita/trunk/README.2ch =================================================================== --- kita/trunk/README.2ch 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/README.2ch 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,125 +1,125 @@ AA -キタ━━━(゚∀゚)━━━!!!! -キタ━━━(゜∀゜)━( ゜∀)━( ゜)━( )━( )━(゜ )━(∀゜ )━(゜∀゜)━━━!! -Σ(゚д゚lll)ガーン -( ゚д゚)ポカーン -_| ̄|○ -○| ̄|_ -(#゚Д゚) ゴルァ -。・゚・(ノД`)・゚・。ウエエェェン -(´・ω・`)ショボーン -(゚д゚)ウマー -(・∀・)イイ!! -(´-`).。oO( ) -(;´Д`) +ãã¿âââ(ãâã)âââ!!!! +ãã¿âââ(ãâã)â( ãâ)â( ã)â( )â( )â(ã )â(âã )â(ãâã)âââ!! +Σ(ãдãlll)ã¬ã¼ã³ +( ãдã)ãã«ã¼ã³ +_|â¾|â +â|â¾|_ +(#ãÐã) ã´ã«ã¡ +ãã»ãã»(ãÐ`)ã»ãã»ãã¦ã¨ã¨ã§ã§ã³ +(´ã»Ïã»`)ã·ã§ãã¼ã³ +(ãдã)ã¦ãã¼ +(ã»âã»)ã¤ã¤!! +(´-`).ãï½ï¼¯( ) +(;´Ðï½) ('A`) -(つД`) -( ´,_ゝ`)プッ -( ゚,_ゝ゚)バカジャネーノ -(´?`) -ん?(゚д゚≡゚д゚)ん? -(σ゚∀゚)σ gets!! -( ・ω・)? -( ゚д゚)ノ ハーイ -(つд⊂)ゴシゴシ -(・∀・)つ旦 -( ´∀`)ヨカターネ -“ヘ( ̄∇ ̄ )カモォーン♪ -(-∀-) -ウワァァァァァァヽ(`Д´)ノァァァァァァン! -(`・ω・´) シャキーン -( ´∀`)σ)Д`) -(TДT) +(ã¤Ðï½) +( ´,_ãï½)ãã +( ã,_ãã)ãã«ã¸ã£ãã¼ã +(´?ï½) +ãï¼(ãдãâ¡ãдã)ãï¼ +(Ïãâã)Ï gets!! +(ãã»Ïã»)ï¼ +( ãдãï¼ãããã¼ã¤ +(ã¤Ð´â)ã´ã·ã´ã· +(ã»âã»)ã¤æ¦ +( ´âï½)ã¨ã«ã¿ã¼ã +âã(â¾ââ¾ )ã«ã¢ã©ã¼ã³âª +(-â-) +ã¦ã¯ã¡ã¡ã¡ã¡ã¡ã¡ã½(`д)ãã¡ã¡ã¡ã¡ã¡ã¡ã³! +(ï½ã»Ïã»Â´) ã·ã£ãã¼ã³ +( ´âï½)Ï)Ðï½) +(ï¼´Ðï¼´) _, ._ -(;゚ Д゚) …?! -(・∀・)人(・∀・) -(´・∀・`) -(ノA`) +(ï¼ã Ðã) â¦ï¼! +(ã»âã»)人(ã»âã») +(´ã»âã»`) +(ãA`) -これは2chの仕様についてのメモです。 +ããã¯2chã®ä»æ§ã«ã¤ãã¦ã®ã¡ã¢ã§ãã -・板一覧の取得 +ã»æ¿ä¸è¦§ã®åå¾ http://www.ff.iij4u.or.jp/~ch2/bbsmenu.html -を取って来て解析している。 -このページはhttp://www.2ch.net/2ch.htmlの左にあるフレーム。 +ãåã£ã¦æ¥ã¦è§£æãã¦ããã +ãã®ãã¼ã¸ã¯http://www.2ch.net/2ch.htmlã®å·¦ã«ãããã¬ã¼ã ã -・書き込みエラーの解釈 -<!-- 2ch_X:error --> → エラー -<!-- 2ch_X:cookie --> → 書き込み確認(まだ未対応) -2ch_Xがない → 正常? -その他 → どうやったら出るの? +ã»æ¸ãè¾¼ã¿ã¨ã©ã¼ã®è§£é +<!-- 2ch_X:error --> â ã¨ã©ã¼ +<!-- 2ch_X:cookie --> â æ¸ãè¾¼ã¿ç¢ºèª(ã¾ã æªå¯¾å¿) +2ch_Xããªã â æ£å¸¸? +ãã®ä» â ã©ããã£ããåºãã®? -「二重カキコですか?」は確認済。 +ãäºéã«ãã³ã§ãã?ãã¯ç¢ºèªæ¸ã -・URLの間の関係 -板URL(例: http://pc.2ch.net/linux/)に./subject.txtを付けることで -スレ一覧が取れる。 -その中を解析してXXXXXX.datを取って来て、板URLに -./dat/XXXXXX.datを付けることでスレのdatが取れる。 +ã»URLã®éã®é¢ä¿ +æ¿URL(ä¾: http://pc.2ch.net/linux/)ã«./subject.txtãä»ãããã¨ã§ +ã¹ã¬ä¸è¦§ãåããã +ãã®ä¸ã解æãã¦XXXXXX.datãåã£ã¦æ¥ã¦ãæ¿URLã« +./dat/XXXXXX.datãä»ãããã¨ã§ã¹ã¬ã®datãåããã -スレのURLは板URLのID(linux)を取ってきてから、板URLに -/test/read.cgi/板ID/datから'.dat'をとった部分/ -を付ければ得られる。 +ã¹ã¬ã®URLã¯æ¿URLã®ID(linux)ãåã£ã¦ãã¦ãããæ¿URLã« +/test/read.cgi/æ¿ID/datãã'.dat'ãã¨ã£ãé¨å/ +ãä»ããã°å¾ãããã -逆に、スレのURLが与えられた場合、 -/test/read.cgiを除いて、最後に.datをつければ良い。 -(l50とか最後についている場合はそれを除く必要がある) +éã«ãã¹ã¬ã®URLãä¸ããããå ´åã +/test/read.cgiãé¤ãã¦ãæå¾ã«.datãã¤ããã°è¯ãã +(l50ã¨ãæå¾ã«ã¤ãã¦ããå ´åã¯ãããé¤ãå¿ è¦ããã) -すなわち、板URLとsubject.txtのURL、 -スレのURLとdatファイルのURLはそれぞれ一対一に対応する。 +ããªãã¡ãæ¿URLã¨subject.txtã®URLã +ã¹ã¬ã®URLã¨datãã¡ã¤ã«ã®URLã¯ããããä¸å¯¾ä¸ã«å¯¾å¿ããã -例: -板URL: http://pc.2ch.net/linux/ +ä¾: +æ¿URL: http://pc.2ch.net/linux/ dat: 1022744633.dat -の場合、 +ã®å ´åã datURL: http//pc.2ch.net/linux/dat/1022744633.dat threadURL: http://pc.2ch.net/test/read.cgi/linux/1022744633/ -・KDEのキャッシュの仕組み(HTTP) -キャッシュディレクトリ: ~/.kde/share/cache/http -サブディレクトリ: ホスト名を検索して、'w'以外のアルファベットが来たら -そのディレクトリになる。見付からないときは'0'になる。 +ã»KDEã®ãã£ãã·ã¥ã®ä»çµã¿(HTTP) +ãã£ãã·ã¥ãã£ã¬ã¯ããª: ~/.kde/share/cache/http +ãµããã£ã¬ã¯ããª: ãã¹ãåãæ¤ç´¢ãã¦ã'w'以å¤ã®ã¢ã«ãã¡ããããæ¥ãã +ãã®ãã£ã¬ã¯ããªã«ãªããè¦ä»ãããªãã¨ãã¯'0'ã«ãªãã -例: +ä¾: www.wakaba.jp -> 'a' www.2ch.net -> 'c' -ファイル名: <ホスト名> + <パス('/'を'_'に置換)> + '_' + <URLのhash> +ãã¡ã¤ã«å: <ãã¹ãå> + <ãã¹('/'ã'_'ã«ç½®æ)> + '_' + <URLã®hash> -ファイルフォーマット: +ãã¡ã¤ã«ãã©ã¼ããã: (HTTPProtocol:::createCacheEntry) -1行目: キャッシュフォーマットのバージョン "7" -2行目: URL -3行目: Creation Date -4行目: Expiration Date -5行目: ETag -6行目: Last-Modified -7行目: MimeType -8行目: Charset -9行目以降: 内容 +1è¡ç®: ãã£ãã·ã¥ãã©ã¼ãããã®ãã¼ã¸ã§ã³ "7" +2è¡ç®: URL +3è¡ç®: Creation Date +4è¡ç®: Expiration Date +5è¡ç®: ETag +6è¡ç®: Last-Modified +7è¡ç®: MimeType +8è¡ç®: Charset +9è¡ç®ä»¥é: å 容 ---- -2channel.brdの書式 +2channel.brdã®æ¸å¼ -エンコーディングはたぶんShift_JIS(CP932) -1行目: '2' +ã¨ã³ã³ã¼ãã£ã³ã°ã¯ãã¶ãShift_JIS(CP932) +1è¡ç®: '2' -それ以降: -・カテゴリ -板名<Tab>n -nは0 or 1で、0が閉じている、1が開いている +ãã以é: +ã»ã«ãã´ãª +æ¿å<Tab>n +nã¯0 or 1ã§ã0ãéãã¦ããã1ãéãã¦ãã -・板 -<Tab>ホスト名<Tab>板ID<Tab>板の説明 +ã»æ¿ +<Tab>ãã¹ãå<Tab>æ¿ID<Tab>æ¿ã®èª¬æ ---- Samba24 -↓のようなエラーが出る。 +âã®ãããªã¨ã©ã¼ãåºãã -- -<html><head><title>ERROR!</title><meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"></head> +<html><head><title>ERRORï¼</title><meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"></head> <body><!-- 2ch_X:error --> -ERROR - 593 120 sec たたないと書けません。(3回目、52 sec しかたってない) 3 +ERROR - 593 120 sec ãããªãã¨æ¸ãã¾ããã(3åç®ã52 sec ãããã£ã¦ãªã) 3 <br><hr>(Samba24-2.13)</body> </html> -- Modified: kita/trunk/README.machibbs =================================================================== --- kita/trunk/README.machibbs 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/README.machibbs 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,21 +1,21 @@ -まちBBSについて +ã¾ã¡BBSã«ã¤ã㦠-現在はα版程度です。読み込みは対応してますが、書き込みは対応していません。 +ç¾å¨ã¯Î±çç¨åº¦ã§ããèªã¿è¾¼ã¿ã¯å¯¾å¿ãã¦ã¾ãããæ¸ãè¾¼ã¿ã¯å¯¾å¿ãã¦ãã¾ããã -・DATファイルは直接取得できない -(DATのURLらしきものは403 Forbiddenになる) --> 識別子としてのDATのURLはそのままで、取得する際にURLを置き換えている。 -(キャッシュの関係上この方が楽、また、●対応もこれでいけそう) +ã»DATãã¡ã¤ã«ã¯ç´æ¥åå¾ã§ããªã +(DATã®URLããããã®ã¯403 Forbiddenã«ãªã) +-> èå¥åã¨ãã¦ã®DATã®URLã¯ãã®ã¾ã¾ã§ãåå¾ããéã«URLãç½®ãæãã¦ããã +(ãã£ãã·ã¥ã®é¢ä¿ä¸ãã®æ¹ã楽ãã¾ããâ対å¿ãããã§ãããã) -・HTMLを解析する必要がある。 -パターンはメールアドレスありなしで2つ確認済み。 -2行にわたるパターンもある。合計4種類? +ã»HTMLã解æããå¿ è¦ãããã +ãã¿ã¼ã³ã¯ã¡ã¼ã«ã¢ãã¬ã¹ãããªãã§2ã¤ç¢ºèªæ¸ã¿ã +2è¡ã«ããããã¿ã¼ã³ããããåè¨4種é¡? -・あぼーんはそのまま透明削除されるらしい。 -なのでレス番号は解析した物を使う必要がある。 +ã»ãã¼ã¼ãã¯ãã®ã¾ã¾éæåé¤ããããããã +ãªã®ã§ã¬ã¹çªå·ã¯è§£æããç©ã使ãå¿ è¦ãããã -バグ -・投稿の'秒'が表示されない -・透明でないあぼーんの対応がなされていない(↓など)。 +ãã° +ã»æ稿ã®'ç§'ã表示ãããªã +ã»éæã§ãªããã¼ã¼ãã®å¯¾å¿ããªããã¦ããªã(âãªã©)ã http://chugoku.machi.to/bbs/read.pl?BBS=cyugoku&KEY=1084952272 Modified: kita/trunk/TODO =================================================================== --- kita/trunk/TODO 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/TODO 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,133 +1,133 @@ -・1行のみ、名前なしの簡易投稿(実況用) -・したらばのKita掲示板のエラーが正しく出力されないのを修正 -(リンクURLを含む投稿を許可しない) -・最近見たスレッドの一覧 +ã»1è¡ã®ã¿ãååãªãã®ç°¡ææ稿ï¼å®æ³ç¨ï¼ +ã»ãããã°ã®Kitaæ²ç¤ºæ¿ã®ã¨ã©ã¼ãæ£ããåºåãããªãã®ãä¿®æ£ +ï¼ãªã³ã¯URLãå«ãæ稿ã許å¯ããªãï¼ +ã»æè¿è¦ãã¹ã¬ããã®ä¸è¦§ --- -ここから見直すこと +ããããè¦ç´ãã㨠-完了 -・クローズボタン -・ごみ箱のツールチップ -・●対応のうちプリファレンスとログイン -・お気に入りのデフォルトソートを板順に -・選択した単語をGoogleで検索 +å®äº +ã»ã¯ãã¼ãºãã¿ã³ +ã»ãã¿ç®±ã®ãã¼ã«ããã +ã»â対å¿ã®ãã¡ããªãã¡ã¬ã³ã¹ã¨ãã°ã¤ã³ +ã»ãæ°ã«å ¥ãã®ããã©ã«ãã½ã¼ããæ¿é ã« +ã»é¸æããåèªãGoogleã§æ¤ç´¢ -次のバージョンまでに実装したいもの -・ -・インデックスファイルの仕様確定 -・外部板対応 -・UIの見直し -・thread toolbarにクローズボタン +次ã®ãã¼ã¸ã§ã³ã¾ã§ã«å®è£ ããããã® +ã» +ã»ã¤ã³ããã¯ã¹ãã¡ã¤ã«ã®ä»æ§ç¢ºå® +ã»å¤é¨æ¿å¯¾å¿ +ã»UIã®è¦ç´ã +ã»thread toolbarã«ã¯ãã¼ãºãã¿ã³ -実装したい機能 -・複数選択してキャッシュの削除 -・Favoritesの任意並び替え -・左サイドバーにFavoritesタブ表示 -・スレあぼーん -・スレ巡回 -・タブが多くなったときの対策 -・まちBBS書き込み -・スレ一覧表示にショートカットとアイコンを割り当て -・あぼーんの即時反映。 -・未読がないのか板移動なのかはっきりしる。 --> codeが表示されるので問題ない? -・お気に入りのツリービュー -・お気に入りのカテゴリ分け -・スレ別コテハン -・スレ立て機能 -・メールのリンクを削除(難しい?) -・新着レスを色分け(日付とIDを赤字とか) -・スレを閉じるボタン(タブの右あたり、KDE3.2から入っているKTabWidgetを使う?) -・mail欄などの表示をカスタマイズ可能に(?) -・「キャッシュを先頭に表示」などを実装 -・ダイアログを出さずにスレをゲット -->一応実装してるっぽい -・カラムの順序を保存 -・popupが隠れないようにする。 -・色/フォントの設定(ポップアップとか) -・タブの状態を保存(?) -・キーボードショートカット(Ctrl+R: reload) -・navi2ch互換キー -・レスのツリー表示(メーラーにあるようなもの、UIが面倒?) -・ロゴだけ表示(A Boneにある機能) -・ボスが来た機能 -・お気に入りでの新着数チェック&表示(subject.txtのみ読み込み) -・$KDEDIRSを設定しないとライブラリの読み込みに失敗する。 -・Favoriteから直接登録解除 -・書き込みウィンドウのサイズを保存。 -・お気に入りをツリーに表示 +å®è£ ãããæ©è½ +ã»è¤æ°é¸æãã¦ãã£ãã·ã¥ã®åé¤ +ã»Favoritesã®ä»»æ並ã³æ¿ã +ã»å·¦ãµã¤ããã¼ã«Favoritesã¿ã表示 +ã»ã¹ã¬ãã¼ã¼ã +ã»ã¹ã¬å·¡å +ã»ã¿ããå¤ããªã£ãã¨ãã®å¯¾ç +ã»ã¾ã¡BBSæ¸ã込㿠+ã»ã¹ã¬ä¸è¦§è¡¨ç¤ºã«ã·ã§ã¼ãã«ããã¨ã¢ã¤ã³ã³ãå²ãå½ã¦ +ã»ãã¼ã¼ãã®å³æåæ ã +ã»æªèªããªãã®ãæ¿ç§»åãªã®ãã¯ã£ããããã +-> codeã表示ãããã®ã§åé¡ãªãï¼ +ã»ãæ°ã«å ¥ãã®ããªã¼ãã¥ã¼ +ã»ãæ°ã«å ¥ãã®ã«ãã´ãªåã +ã»ã¹ã¬å¥ã³ããã³ +ã»ã¹ã¬ç«ã¦æ©è½ +ã»ã¡ã¼ã«ã®ãªã³ã¯ãåé¤(é£ãã?) +ã»æ°çã¬ã¹ãè²åã(æ¥ä»ã¨IDã赤åã¨ã) +ã»ã¹ã¬ãéãããã¿ã³(ã¿ãã®å³ããããKDE3.2ããå ¥ã£ã¦ããKTabWidgetã使ã?) +ã»mailæ¬ãªã©ã®è¡¨ç¤ºãã«ã¹ã¿ãã¤ãºå¯è½ã«(?) +ã»ããã£ãã·ã¥ãå é ã«è¡¨ç¤ºããªã©ãå®è£ +ã»ãã¤ã¢ãã°ãåºããã«ã¹ã¬ãã²ãã +->ä¸å¿å®è£ ãã¦ãã£ã½ã +ã»ã«ã©ã ã®é åºãä¿å +ã»popupãé ããªãããã«ããã +ã»è²/ãã©ã³ãã®è¨å®(ãããã¢ããã¨ã) +ã»ã¿ãã®ç¶æ ãä¿å(?) +ã»ãã¼ãã¼ãã·ã§ã¼ãã«ãã(Ctrl+R: reload) +ã»navi2chäºæãã¼ +ã»ã¬ã¹ã®ããªã¼è¡¨ç¤º(ã¡ã¼ã©ã¼ã«ãããããªãã®ãUIãé¢å?) +ã»ãã´ã ã表示(A Boneã«ããæ©è½) +ã»ãã¹ãæ¥ãæ©è½ +ã»ãæ°ã«å ¥ãã§ã®æ°çæ°ãã§ãã¯ï¼è¡¨ç¤º(subject.txtã®ã¿èªã¿è¾¼ã¿) +ã»$KDEDIRSãè¨å®ããªãã¨ã©ã¤ãã©ãªã®èªã¿è¾¼ã¿ã«å¤±æããã +ã»Favoriteããç´æ¥ç»é²è§£é¤ +ã»æ¸ãè¾¼ã¿ã¦ã£ã³ãã¦ã®ãµã¤ãºãä¿åã +ã»ãæ°ã«å ¥ããããªã¼ã«è¡¨ç¤º -バグ -・スレを開いているときにスレ一覧のコンテキストメニューからスレをお気に入りに入れても、その開いているスレのボタンは変わらない。 -・shownumを設定してもすべて表示されてしまう(?) -・URLに"<",">"が入ってると< >になってしまう。 -・Samba24対応 -・すでにお気に入りに入っている板を右クリックしたときに出るメニューを -「お気に入りから削除」にする。 -・ごみ箱をクリックするとウィンドウが閉じられるが、タイトルが変わらない -・お気に入りをクリックしたときに情報が更新されるが、 -選択情報まで消えるのが気持ち悪い。 -・NetAccess::downloadとかがdeprecatedになってる。 -->KDE3.1.x対応がなくならないうちはダメ。 -・イメージビューアを表示させたまま終了するとsegfault -・タブ右クリックの「ウェブブラウザで開く」が使えない。 -・スレタイトルのラベルが縦に長くなることがある。 -・書き込みダイアログ表示中に別のタブを開いてから書き込むとそのタブの -情報が更新されてしまう。 -・スレが表示されていないときにF5を押すと落ちる -・poファイルの更新方法が不明 -・カキコウィンドウの名前欄でEnterを押すと送信してしまう。 -・httpのキャッシュと既読数の整合性が取れていない。 -・1レスだけ取得した後900レス未読があるとgzipせずに差分取得するので、 -全部取得するより遅くなるが、これをなんとかしたい -・書き込み確認のパネルが出ると(Cookie未設定)、log.txtに書かれるURLがおかしくなる。 -・書き込み時のエラー処理が甘い -・フォントによっては表示できない文字が出るはず。 -・AAをポップアップ表示するとずれる。 -・同じスレを別タブで開けてしまう。 -・エディタに波線を入力すると豆腐になる。 -->そのせいで書き込み出来ないっぽい。 -->直った? -・konquerorからk2ch://で板一覧を取得すると、同じ板が2つ表示される。 +ãã° +ã»ã¹ã¬ãéãã¦ããã¨ãã«ã¹ã¬ä¸è¦§ã®ã³ã³ããã¹ãã¡ãã¥ã¼ããã¹ã¬ããæ°ã«å ¥ãã«å ¥ãã¦ãããã®éãã¦ããã¹ã¬ã®ãã¿ã³ã¯å¤ãããªãã +ã»shownumãè¨å®ãã¦ããã¹ã¦è¡¨ç¤ºããã¦ãã¾ã(?) +ã»URLã«"<",">"ãå ¥ã£ã¦ãã¨< >ã«ãªã£ã¦ãã¾ãã +ã»Samba24å¯¾å¿ +ã»ãã§ã«ãæ°ã«å ¥ãã«å ¥ã£ã¦ããæ¿ãå³ã¯ãªãã¯ããã¨ãã«åºãã¡ãã¥ã¼ã +ããæ°ã«å ¥ãããåé¤ãã«ããã +ã»ãã¿ç®±ãã¯ãªãã¯ããã¨ã¦ã£ã³ãã¦ãéããããããã¿ã¤ãã«ãå¤ãããªã +ã»ãæ°ã«å ¥ããã¯ãªãã¯ããã¨ãã«æ å ±ãæ´æ°ããããã +é¸ææ å ±ã¾ã§æ¶ããã®ãæ°æã¡æªãã +ã»NetAccess::downloadã¨ããdeprecatedã«ãªã£ã¦ãã +->KDE3.1.x対å¿ããªããªããªããã¡ã¯ãã¡ã +ã»ã¤ã¡ã¼ã¸ãã¥ã¼ã¢ã表示ãããã¾ã¾çµäºããã¨segfault +ã»ã¿ãå³ã¯ãªãã¯ã®ãã¦ã§ããã©ã¦ã¶ã§éããã使ããªãã +ã»ã¹ã¬ã¿ã¤ãã«ã®ã©ãã«ã縦ã«é·ããªããã¨ãããã +ã»æ¸ãè¾¼ã¿ãã¤ã¢ãã°è¡¨ç¤ºä¸ã«å¥ã®ã¿ããéãã¦ããæ¸ãè¾¼ãã¨ãã®ã¿ãã® +æ å ±ãæ´æ°ããã¦ãã¾ãã +ã»ã¹ã¬ã表示ããã¦ããªãã¨ãã«F5ãæ¼ãã¨è½ã¡ã +ã»poãã¡ã¤ã«ã®æ´æ°æ¹æ³ãä¸æ +ã»ã«ãã³ã¦ã£ã³ãã¦ã®ååæ¬ã§Enterãæ¼ãã¨éä¿¡ãã¦ãã¾ãã +ã»httpã®ãã£ãã·ã¥ã¨æ¢èªæ°ã®æ´åæ§ãåãã¦ããªãã +ã»1ã¬ã¹ã ãåå¾ããå¾900ã¬ã¹æªèªãããã¨gzipããã«å·®ååå¾ããã®ã§ã +å ¨é¨åå¾ããããé ããªãããããããªãã¨ãããã +ã»æ¸ãè¾¼ã¿ç¢ºèªã®ããã«ãåºãã¨(Cookieæªè¨å®)ãlog.txtã«æ¸ãããURLããããããªãã +ã»æ¸ãè¾¼ã¿æã®ã¨ã©ã¼å¦çãçã +ã»ãã©ã³ãã«ãã£ã¦ã¯è¡¨ç¤ºã§ããªãæåãåºãã¯ãã +ã»AAããããã¢ãã表示ããã¨ãããã +ã»åãã¹ã¬ãå¥ã¿ãã§éãã¦ãã¾ãã +ã»ã¨ãã£ã¿ã«æ³¢ç·ãå ¥åããã¨è±è ã«ãªãã +->ãã®ããã§æ¸ãè¾¼ã¿åºæ¥ãªãã£ã½ãã +->ç´ã£ãï¼ +ã»konquerorããk2ch://ã§æ¿ä¸è¦§ãåå¾ããã¨ãåãæ¿ã2ã¤è¡¨ç¤ºãããã -実装したいもの -・フォント設定に「KDEデフォルト」を追加。 -・スレッドのボタンをツールバーと同様に移動可能に -・ライブラリが読み込めないとき(KDEDIRSを指定してないとき)にエラーを出す -・スレあぼーん -・発言検索などと連携 -・オフラインモードサポート -・巡回モードボタン -・注目キーワード指定 -・省スペースモード&フル機能モードの一発切り替え -・RSS解釈 -・既読数のクリア -・Bayesianコメントフィルタ -・エディタにCP932コード表を追加 +å®è£ ããããã® +ã»ãã©ã³ãè¨å®ã«ãKDEããã©ã«ããã追å ã +ã»ã¹ã¬ããã®ãã¿ã³ããã¼ã«ãã¼ã¨åæ§ã«ç§»åå¯è½ã« +ã»ã©ã¤ãã©ãªãèªã¿è¾¼ããªãã¨ã(KDEDIRSãæå®ãã¦ãªãã¨ã)ã«ã¨ã©ã¼ãåºã +ã»ã¹ã¬ãã¼ã¼ã +ã»çºè¨æ¤ç´¢ãªã©ã¨é£æº +ã»ãªãã©ã¤ã³ã¢ã¼ããµãã¼ã +ã»å·¡åã¢ã¼ããã¿ã³ +ã»æ³¨ç®ãã¼ã¯ã¼ãæå® +ã»çã¹ãã¼ã¹ã¢ã¼ãï¼ãã«æ©è½ã¢ã¼ãã®ä¸çºåãæ¿ã +ã»RSS解é +ã»æ¢èªæ°ã®ã¯ãªã¢ +ã»Bayesianã³ã¡ã³ããã£ã«ã¿ +ã»ã¨ãã£ã¿ã«CP932ã³ã¼ã表ã追å -開発メモ -バージョンが変わった時に変更する必要があるソース +éçºã¡ã¢ +ãã¼ã¸ã§ã³ãå¤ãã£ãæã«å¤æ´ããå¿ è¦ãããã½ã¼ã¹ configure.in.in -kita/src/kita.lsm 3つ +kita/src/kita.lsm 3㤠kita.spec -src.rpmもリリース前にチェックすること! +src.rpmããªãªã¼ã¹åã«ãã§ãã¯ãããã¨ï¼ -リリースするまでの流れ -1. バージョンを変更(上参照) -2. タグを打つ(KITA-x_y-RELEASE) -3. 別ディレクトリにcheckout -4. make -f Makefile.cvs; ./configure; make distで配布物を作成 -5. 配布するtar.gzを解凍、./configure --prefix=XXX; make; make install -でインストール -6. 動作確認 -・起動 -・スレ読み込み書き込み確認 -・こんからサイドバー確認 -・あと気まぐれにいろいろ -7. リリース、ニュースの投稿 +ãªãªã¼ã¹ããã¾ã§ã®æµã +1. ãã¼ã¸ã§ã³ãå¤æ´(ä¸åç §) +2. ã¿ã°ãæã¤(KITA-x_y-RELEASE) +3. å¥ãã£ã¬ã¯ããªã«checkout +4. make -f Makefile.cvs; ./configure; make distã§é å¸ç©ãä½æ +5. é å¸ããtar.gzã解åã./configure --prefix=XXX; make; make install +ã§ã¤ã³ã¹ãã¼ã« +6. åä½ç¢ºèª +ã»èµ·å +ã»ã¹ã¬èªã¿è¾¼ã¿æ¸ãè¾¼ã¿ç¢ºèª +ã»ãããããµã¤ããã¼ç¢ºèª +ã»ãã¨æ°ã¾ããã«ãããã +7. ãªãªã¼ã¹ããã¥ã¼ã¹ã®æ稿 --- -リファクタリングの進捗 +ãªãã¡ã¯ã¿ãªã³ã°ã®é²æ code doc KitaDomTree o x KitaPreviewPart o x Copied: kita/trunk/config.h.cmake (from rev 2558, kita/branches/KITA-KDE4/config.h.cmake) =================================================================== --- kita/trunk/config.h.cmake (rev 0) +++ kita/trunk/config.h.cmake 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,6 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#cmakedefine VERSION "@VERSION@" + +#endif Deleted: kita/trunk/configure.in.in =================================================================== --- kita/trunk/configure.in.in 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/configure.in.in 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,23 +0,0 @@ -#MIN_CONFIG - -AM_INIT_AUTOMAKE(kita, 0.200.0) -AC_C_BIGENDIAN -AC_CHECK_KDEMAXPATHLEN - -AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local}) - -AC_ARG_ENABLE( - xdg-menu, - [ --enable-xdg-menu enables freedeskop.org's menu spec], - [use_xdg_menu=$enableval], - [use_xdg_menu=no] -) - -AM_CONDITIONAL(KITA_USE_XDG_MENU, test "$use_xdg_menu" = yes) - -AC_CHECK_LIB(art_lgpl_2, libart_preinit, - [], - [AC_MSG_ERROR([libart_lgpl_2 was not found! -Please check whether you installed libart_lgpl(-devel) correctly.])] -) - Property changes on: kita/trunk/kita ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in kita.kdevses + CMakeFiles CTestTestfile.cmake cmake_install.cmake Makefile Deleted: kita/trunk/kita/.cvsignore =================================================================== --- kita/trunk/kita/.cvsignore 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/.cvsignore 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,3 +0,0 @@ -Makefile -Makefile.in -kita.kdevses Copied: kita/trunk/kita/CMakeLists.txt (from rev 2558, kita/branches/KITA-KDE4/kita/CMakeLists.txt) =================================================================== --- kita/trunk/kita/CMakeLists.txt (rev 0) +++ kita/trunk/kita/CMakeLists.txt 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,3 @@ +add_subdirectory(src) +add_subdirectory(po) +add_subdirectory(doc) Deleted: kita/trunk/kita/Makefile.am =================================================================== --- kita/trunk/kita/Makefile.am 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/Makefile.am 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,5 +0,0 @@ -SUBDIRS = src po doc - -package-messages: - $(MAKE) -f ../admin/Makefile.common package-messages - $(MAKE) -C po merge Property changes on: kita/trunk/kita/doc ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in + Makefile CMakeFiles CTestTestfile.cmake cmake_install.cmake Deleted: kita/trunk/kita/doc/.cvsignore =================================================================== --- kita/trunk/kita/doc/.cvsignore 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/doc/.cvsignore 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,2 +0,0 @@ -Makefile -Makefile.in Copied: kita/trunk/kita/doc/CMakeLists.txt (from rev 2558, kita/branches/KITA-KDE4/kita/doc/CMakeLists.txt) =================================================================== --- kita/trunk/kita/doc/CMakeLists.txt (rev 0) +++ kita/trunk/kita/doc/CMakeLists.txt 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1 @@ +add_subdirectory(en) Deleted: kita/trunk/kita/doc/Makefile.am =================================================================== --- kita/trunk/kita/doc/Makefile.am 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/doc/Makefile.am 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,6 +0,0 @@ -# the SUBDIRS is filled automatically by am_edit. If files are -# in this directory they are installed into the english dir - -KDE_LANG = en -KDE_DOCS = kita -SUBDIRS = $(AUTODIRS) Property changes on: kita/trunk/kita/doc/en ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in index.cache.bz2 + CMakeFiles CTestTestfile.cmake cmake_install.cmake index.cache.bz2 Makefile Deleted: kita/trunk/kita/doc/en/.cvsignore =================================================================== --- kita/trunk/kita/doc/en/.cvsignore 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/doc/en/.cvsignore 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,3 +0,0 @@ -Makefile -Makefile.in -index.cache.bz2 Copied: kita/trunk/kita/doc/en/CMakeLists.txt (from rev 2558, kita/branches/KITA-KDE4/kita/doc/en/CMakeLists.txt) =================================================================== --- kita/trunk/kita/doc/en/CMakeLists.txt (rev 0) +++ kita/trunk/kita/doc/en/CMakeLists.txt 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,2 @@ +########### install files ############### +kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kita) Deleted: kita/trunk/kita/doc/en/Makefile.am =================================================================== --- kita/trunk/kita/doc/en/Makefile.am 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/doc/en/Makefile.am 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,2 +0,0 @@ -KDE_DOCS = kita -KDE_LANG = en Modified: kita/trunk/kita/doc/en/index.docbook =================================================================== --- kita/trunk/kita/doc/en/index.docbook 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/doc/en/index.docbook 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,29 +1,27 @@ <?xml version="1.0" ?> -<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1-Based Variant V1.0//EN" "dtd/kdex.dtd" [ - <!ENTITY kappname "&Kita;"> +<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [ + <!ENTITY kita "<application>Kita</application>"> + <!ENTITY kappname "&kita;"> <!ENTITY % addindex "IGNORE"> <!ENTITY % English "INCLUDE" > <!-- change language only here --> ]> -<!-- Important note: please use template.docbook instead of this file. - This is only the conversion of app.sgml into DocBook SGML. - template.docbook gives you more information on what you can and - should do. Thanks. --> <book lang="&language;"> <bookinfo> - <title>The Kita Handbook</title> + <title>The &kita; Handbook</title> <authorgroup> <author> - <firstname></firstname> - <surname>Hideki Ikemoto</surname> - <affiliation><address><email>ikemo@wakaba.jp</email></address></affiliation> + <firstname>Hideki</firstname> + <surname>Ikemoto</surname> + <affiliation><address><email>ikemo@wakaba.jp</email></address></affiliation> </author> + <!-- TRANS:ROLES_OF_TRANSLATORS --> </authorgroup> <date>date</date> <releaseinfo>0.1</releaseinfo> <abstract> - <para>SHORT DESCRIPTION GOES HERE</para> + <para>&kita; is a 2ch client for KDE.</para> </abstract> <keywordset> <keyword>KDE</keyword> @@ -43,34 +41,32 @@ <chapter id="installation"> <title>Installation</title> - <sect1 id="how-to-obtain-Kita"> - <title>How to obtain Kita</title> + <sect1 id="how-to-obtain"> + <title>How to obtain &kita;</title> <para></para> </sect1> <sect1 id="requirements"> <title>Requirements</title> - <para></para> + <para>You need to install kdelibs version 4 to run &kita;.</para> </sect1> <sect1 id="compilation-and-installation"> <title>Compilation and Installation</title> - <para>Compiling Kita is very easy. The following should do - it: <screen> -<prompt>%</prompt> <userinput><command>./configure</command></userinput> + <para>To compile and install &kita;, run: + <screen> +<prompt>%</prompt> <userinput><command>cmake</command> .</userinput> <prompt>%</prompt> <userinput><command>make</command></userinput> <prompt>%</prompt> <userinput><command>make</command> install</userinput></screen> </para> - <para>That should do it! Should you run into any problems, - please report them to the <ulink - url="mailto:ikemo@wakaba.jp">author</ulink></para> + <para>If you run into any problems, please report them to the <ulink url="mailto:ikemo@wakaba.jp">author</ulink> or <ulink url="http://sourceforge.jp/ticket/newticket.php?group_id=483">submit a new ticket</ulink>.</para> </sect1> </chapter> - <chapter id="using-Kita"> - <title>Using Kita</title> + <chapter id="using"> + <title>Using &kita;</title> <para></para> </chapter> @@ -80,12 +76,12 @@ <qandaset id="faq"> <title>Frequently asked questions</title> <qandaentry> - <question> - <para>Question 1</para> - </question> - <answer> - <para>The answer</para> - </answer> + <question> + <para>Question 1</para> + </question> + <answer> + <para>The answer</para> + </answer> </qandaentry> </qandaset> Property changes on: kita/trunk/kita/po ___________________________________________________________________ Modified: svn:ignore - *.gmo Makefile Makefile.in + *.gmo CMakeFiles CTestTestfile.cmake cmake_install.cmake Makefile Deleted: kita/trunk/kita/po/.cvsignore =================================================================== --- kita/trunk/kita/po/.cvsignore 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/po/.cvsignore 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,3 +0,0 @@ -*.gmo -Makefile -Makefile.in Copied: kita/trunk/kita/po/CMakeLists.txt (from rev 2558, kita/branches/KITA-KDE4/kita/po/CMakeLists.txt) =================================================================== --- kita/trunk/kita/po/CMakeLists.txt (rev 0) +++ kita/trunk/kita/po/CMakeLists.txt 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,3 @@ +include(FindGettext) +file(GLOB pofiles ${CMAKE_CURRENT_SOURCE_DIR}/*.po) +gettext_create_translations("kita.pot" ALL ${pofiles}) Deleted: kita/trunk/kita/po/Makefile.am =================================================================== --- kita/trunk/kita/po/Makefile.am 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/po/Makefile.am 2010-02-10 10:04:00 UTC (rev 2559) @@ -1 +0,0 @@ -POFILES = AUTO Copied: kita/trunk/kita/po/Messages.sh (from rev 2558, kita/branches/KITA-KDE4/kita/po/Messages.sh) =================================================================== --- kita/trunk/kita/po/Messages.sh (rev 0) +++ kita/trunk/kita/po/Messages.sh 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,7 @@ +#! /usr/bin/env bash +subdirs="../src" +$EXTRACTRC `find $subdirs -name \*.rc` >> rc.cpp || exit 11 +$EXTRACTRC `find $subdirs -name \*.ui` >> rc.cpp || exit 12 +$EXTRACTRC `find $subdirs -name \*.kcfg` >> rc.cpp +$XGETTEXT -kaliasLocal `find $subdirs -name \*.cc -o -name \*.cpp -o -name \*.h` rc.cpp -o $podir/kita.pot +rm -f rc.cpp Copied: kita/trunk/kita/po/extract-messages.sh (from rev 2558, kita/branches/KITA-KDE4/kita/po/extract-messages.sh) =================================================================== --- kita/trunk/kita/po/extract-messages.sh (rev 0) +++ kita/trunk/kita/po/extract-messages.sh 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,52 @@ +#! /bin/bash + +podir=${podir:-$PWD/kita/po} +files=`find . -name Messages.sh` +dirs=`for i in $files; do echo \`dirname $i\`; done | sort -u` +tmpname="$PWD/messages.log" +EXTRACTRC=${EXTRACTRC:-extractrc} +EXTRACTATTR=${EXTRACTATTR:-extractattr} +PREPARETIPS=${PREPARETIPS:-preparetips} +REPACKPOT=${REPACKPOT:-repack-pot.pl} +export EXTRACTRC EXTRACTATTR PREPARETIPS REPACKPOT +IGNORE=${IGNORE:-.svn} + +for subdir in $dirs; do + # skip Messages.sh files of KDevelop's app templates + grep '{APPNAMELC}[^ ]*.pot' $subdir/Messages.sh 1>/dev/null && continue + + test -z "$VERBOSE" || echo "Making messages in $subdir" + (cd $subdir + ls -1 *.rc *.ui *.ui3 *.ui4 *.kcfg 2> /dev/null | xargs --no-run-if-empty $EXTRACTRC > rc.cpp + if find . -name \*.c\* -o -name \*.h\* | fgrep -v "$IGNORE" | xargs fgrep -s -q KAboutData ; then + echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> rc.cpp + echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> rc.cpp + fi + + # using xgettext 0.15 or later + ### TODO what --flags param should be used? + XGETTEXT_FLAGS_QT="--from-code=UTF-8 -C --qt -ktr:1,1t -ktr:1,2c,2t -kQT_TRANSLATE_NOOP:1c,2,2t -kQT_TR_NOOP:1,1t -ktranslate:1c,2,2t -ktranslate:2,3c,3t" + XGETTEXT_FLAGS="--from-code=UTF-8 -C --kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 -kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3" + export XGETTEXT_FLAGS + export XGETTEXT_FLAGS_QT + + if test -f Messages.sh; then + # Note: Messages.sh is supposed to get the translators' placeholder by rc.cpp + podir=$podir srcdir=. XGETTEXT_PROGRAM="${XGETTEXT:-xgettext}" XGETTEXT_QT="${XGETTEXT:-xgettext} $XGETTEXT_FLAGS_QT" XGETTEXT="${XGETTEXT:-xgettext} $XGETTEXT_FLAGS" bash Messages.sh + fi + exit_code=$? + if test "$exit_code" -ne 0; then + echo "Bash exit code: $exit_code" + else + rm -f rc.cpp + fi + ) >& $tmpname + test -s $tmpname && { echo $subdir ; cat "$tmpname"; } +done + +# # Repack extracted templates. +# for potfile in $podir/*.pot; do +# $REPACKPOT $potfile +# done + +rm -f $tmpname Modified: kita/trunk/kita/po/ja.po =================================================================== --- kita/trunk/kita/po/ja.po 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/po/ja.po 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,30 +1,3 @@ -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to -# translation of ja.po to # translation of ja.po to Japanese # Hideki Ikemoto <ikemo****@users*****>, 2003. # Hideki Ikemoto <ikemo****@wakab*****>, 2003, 2004, 2005. @@ -32,1292 +5,1609 @@ msgstr "" "Project-Id-Version: ja\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-05-05 12:03+0900\n" -"PO-Revision-Date: 2005-05-05 12:18+0900\n" -"Last-Translator: \n" -"Language-Team: <ja****@li*****>\n" +"POT-Creation-Date: 2009-08-09 20:26+0900\n" +"PO-Revision-Date: 2009-07-27 06:35+0900\n" +"Language-Team: æ¥æ¬èª <kde-i****@kde*****>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: KBabel 1.9\n" +"X-Generator: Lokalize 0.3\n" +"Plural-Forms: nplurals=1; plural=0;\n" -#: _translatorinfo.cpp:1 +#: ../src/bbsview.cpp:185 msgid "" -"_: NAME OF TRANSLATORS\n" -"Your names" -msgstr "Hideki Ikemoto" +"\n" +"Please create the backup of those caches.\n" +msgstr "" +"\n" +"ãããã®ãã£ãã·ã¥ã®ããã¯ã¢ãããä½æãã¦ãã ããã\n" -#: _translatorinfo.cpp:3 -msgid "" -"_: EMAIL OF TRANSLATORS\n" -"Your emails" -msgstr "ikemo****@users*****" +#. i18n: file: ../src/prefs/uiprefbase.ui:61 +#. i18n: ectx: property (suffix), widget (QSpinBox, kcfg_MarkTime) +#: rc.cpp:111 +msgid " hour" +msgstr "æé" -#: favoriteswindowbase.cpp:63 favoriteswindowbase.cpp:166 rc.cpp:24 -#: prefs/aboneprefbase.cpp:80 -#, no-c-format -msgid "Name" -msgstr "åå" +#. i18n: file: ../src/prefs/uiprefbase.ui:96 +#. i18n: ectx: property (suffix), widget (QSpinBox, kcfg_ShowNum) +#: rc.cpp:123 +msgid " res" +msgstr "ã¬ã¹" -#: favoriteswindowbase.cpp:160 rc.cpp:12 bbs/bbsview.cpp:454 -#, no-c-format -msgid "Favorites" -msgstr "ãæ°ã«å ¥ã" +#. i18n: file: ../src/threadproperty.ui:307 +#. i18n: ectx: property (text), widget (QLabel, label0_2) +#: rc.cpp:228 +msgid "\"cache\" file's info (obsolete)" +msgstr "ï¼å¤ãï¼\"cache\"ãã¡ã¤ã«ã®æ å ±" -#: favoriteswindowbase.cpp:161 rc.cpp:14 -#, no-c-format -msgid "move" -msgstr "" +#: ../src/main.cpp:33 +msgid "(C) 2003-2009 Kita Developers" +msgstr "(C) 2003-2009 Kita éçºãã¼ã " -#: favoriteswindowbase.cpp:162 favoriteswindowbase.cpp:163 -#: favoriteswindowbase.cpp:164 favoriteswindowbase.cpp:165 rc.cpp:16 rc.cpp:18 -#: rc.cpp:20 rc.cpp:22 -#, no-c-format -msgid "..." -msgstr "" +#: ../src/main.cpp:39 +msgid "421" +msgstr "421" -#: favoriteswindowbase.cpp:167 rc.cpp:28 -#, no-c-format -msgid "New" -msgstr "" +#: ../src/main.cpp:42 +msgid "75" +msgstr "75" -#: favoriteswindowbase.cpp:168 rc.cpp:30 -#, no-c-format -msgid "&New" -msgstr "" +#: ../src/prefs/preferences.cpp:58 ../src/libkita/datinfo.cpp:442 +#: ../src/libkita/datinfo.cpp:444 +msgid "Abone" +msgstr "ãã¼ã¼ã" -#: favoriteswindowbase.cpp:169 rc.cpp:32 -#, no-c-format -msgid "Ctrl+N" -msgstr "" +#. i18n: file: ../src/libkita/abone.kcfg:9 +#. i18n: ectx: label, entry (AboneIDList), group (Global) +#: rc.cpp:372 +msgid "Abone ID List." +msgstr "ãã¼ã¼ã ID ä¸è¦§ã" -#: favoriteswindowbase.cpp:172 rc.cpp:38 -#, no-c-format -msgid "Ctrl+O" -msgstr "" +#. i18n: file: ../src/libkita/abone.kcfg:12 +#. i18n: ectx: label, entry (AboneNameList), group (Global) +#: rc.cpp:375 +msgid "Abone Name List." +msgstr "ãã¼ã¼ãååä¸è¦§ã" -#: favoriteswindowbase.cpp:175 rc.cpp:44 -#, no-c-format -msgid "Ctrl+S" -msgstr "" +#. i18n: file: ../src/libkita/abone.kcfg:15 +#. i18n: ectx: label, entry (AboneWordList), group (Global) +#: rc.cpp:378 +msgid "Abone Word List." +msgstr "ãã¼ã¼ãåèªä¸è¦§ã" -#: favoriteswindowbase.cpp:177 rc.cpp:48 -#, no-c-format -msgid "Save &As..." -msgstr "" +#: ../src/kitaui/tabwidgetbase.cpp:147 +msgctxt "@action:inmenu" +msgid "Activate Next Tab" +msgstr "次ã®ã¿ããã¢ã¯ãã£ãã«ãã" -#: favoriteswindowbase.cpp:179 rc.cpp:51 -#, no-c-format -msgid "Exit" -msgstr "" +#: ../src/kitaui/tabwidgetbase.cpp:153 +msgctxt "@action:inmenu" +msgid "Activate Previous Tab" +msgstr "åã®ã¿ããã¢ã¯ãã£ãã«ãã" -#: favoriteswindowbase.cpp:184 rc.cpp:60 -#, no-c-format -msgid "Ctrl+Z" -msgstr "" +#: ../src/htmlpart.cpp:782 +#, kde-format +msgctxt "@action:inmenu" +msgid "Add '%1' to abone list" +msgstr "'%1'ããã¼ã¼ãä¸è¦§ã«è¿½å " -#: favoriteswindowbase.cpp:187 rc.cpp:66 -#, no-c-format -msgid "Ctrl+Y" -msgstr "" +#: ../src/htmlpart.cpp:1220 +msgctxt "@action:inmenu" +msgid "Add Id to Abone List" +msgstr "ID ããã¼ã¼ãä¸è¦§ã«è¿½å " -#: favoriteswindowbase.cpp:190 rc.cpp:72 -#, no-c-format -msgid "Ctrl+X" -msgstr "" +#: ../src/htmlpart.cpp:1130 +msgctxt "@action:inmenu" +msgid "Add Name to Abone List" +msgstr "ID ããã¼ã¼ãä¸è¦§ã«è¿½å " -#: favoriteswindowbase.cpp:192 rc.cpp:76 -#, no-c-format -msgid "C&opy" -msgstr "ã³ãã¼(&O)" +#: ../src/bbsview.cpp:95 ../src/threadlistview.cpp:204 +msgctxt "@action:inmenu" +msgid "Add to Favorites" +msgstr "ãæ°ã«å ¥ãã«è¿½å " -#: favoriteswindowbase.cpp:193 rc.cpp:78 -#, no-c-format -msgid "Ctrl+C" -msgstr "" +#: ../src/threadview.cpp:70 +msgctxt "@info:tooltip" +msgid "Add to bookmark" +msgstr "ããã¯ãã¼ã¯ã«è¿½å " -#: favoriteswindowbase.cpp:196 rc.cpp:84 -#, no-c-format -msgid "Ctrl+V" -msgstr "" +#. i18n: file: ../src/prefs/faceprefbase.ui:273 +#. i18n: ectx: attribute (title), widget (QWidget, tab) +#: rc.cpp:96 +msgctxt "Advanced options" +msgid "Advanced" +msgstr "荅括完(&V)" -#: favoriteswindowbase.cpp:197 rc.cpp:86 board/boardtabwidget.cpp:125 -#: thread/threadtabwidget.cpp:443 -#, no-c-format -msgid "Find" -msgstr "æ¤ç´¢" +#. i18n: file: ../src/libkita/asciiart.kcfg:9 +#. i18n: ectx: label, entry (AsciiArtList), group (Global) +#: rc.cpp:345 +msgid "Ascii Art." +msgstr "ã¢ã¹ãã¼ã¢ã¼ãã" -#: favoriteswindowbase.cpp:199 rc.cpp:90 -#, no-c-format -msgid "Ctrl+F" -msgstr "" +#: ../src/prefs/preferences.cpp:45 +msgid "AsciiArt" +msgstr "ã¢ã¹ãã¼ã¢ã¼ã" -#: favoriteswindowbase.cpp:201 rc.cpp:94 -#, no-c-format -msgid "&Contents..." -msgstr "" +#. i18n: file: ../src/libkita/accountconfig.kcfg:12 +#. i18n: ectx: label, entry (BeAuthCode), group (Account) +#: rc.cpp:276 +msgid "Auth code of be.2ch.net" +msgstr "be.2ch.net ã®èªè¨¼ã³ã¼ã" -#: favoriteswindowbase.cpp:203 rc.cpp:97 -#, fuzzy, no-c-format -msgid "Index" -msgstr "ã¤ã³ããã¯ã¹ã®ãã¹" +#: ../src/threadlistheaderview.cpp:61 +msgctxt "@action:inmenu" +msgid "Auto Resize" +msgstr "èªåãµã¤ãºå¤æ´" -#: favoriteswindowbase.cpp:204 rc.cpp:99 -#, no-c-format -msgid "&Index..." -msgstr "" +#: ../src/htmlpart.cpp:723 +msgctxt "@title:menu Go back to the responses" +msgid "Back" +msgstr "æ»ã" -#: favoriteswindowbase.cpp:209 favoriteswindowbase.cpp:210 rc.cpp:107 -#, no-c-format -msgid "New Directory" -msgstr "" +#. i18n: file: ../src/prefs/faceprefbase.ui:79 +#. i18n: ectx: property (text), widget (QLabel, listBackgroundColorLabel) +#: rc.cpp:63 +msgid "Background Color" +msgstr "èæ¯è²" -#: favoriteswindowbase.cpp:211 rc.cpp:26 -#, no-c-format -msgid "Tools" -msgstr "" +#. i18n: file: ../src/prefs/faceprefbase.ui:164 +#. i18n: ectx: property (text), widget (QLabel, threadBackgroundColorLabel) +#: rc.cpp:78 +msgctxt "Thread background color" +msgid "Background Color" +msgstr "èæ¯è²(&B)" -#: main.cpp:24 -msgid "Kita - 2ch client for KDE" -msgstr "" +#. i18n: file: ../src/prefs/faceprefbase.ui:233 +#. i18n: ectx: property (text), widget (QLabel, popupBackgroundColorLabel) +#: rc.cpp:93 +msgctxt "Popup background color" +msgid "Background Color" +msgstr "èæ¯è²(&K)" -#: main.cpp:30 -msgid "Document to open." -msgstr "" +#. i18n: file: ../src/prefs/faceprefbase.ui:21 +#. i18n: ectx: attribute (title), widget (QWidget, tab) +#: rc.cpp:48 +msgctxt "Basic options" +msgid "Basic" +msgstr "åºæ¬(&I)" -#: main.cpp:31 -msgid "board list's URL." -msgstr "æ¿ä¸è¦§ã®URL" +#. i18n: file: ../src/prefs/loginprefbase.ui:106 +#. i18n: ectx: property (text), widget (QLabel, BeAuthCodeLabel) +#: rc.cpp:171 +msgid "Be auth code" +msgstr "Be ã®èªè¨¼ã³ã¼ã(&T)" -#: main.cpp:37 -msgid "Kita" -msgstr "" +#. i18n: file: ../src/prefs/loginprefbase.ui:90 +#. i18n: ectx: property (text), widget (QLabel, BeMailAddressLabel) +#: rc.cpp:168 +msgid "Be mail address" +msgstr "&Be ã®ã¡ã¼ã«ã¢ãã¬ã¹" -#: main.cpp:39 -msgid "maintainer, initial code" -msgstr "ã¡ã¤ã³ãããåæã³ã¼ã" +#: ../src/threadlistheaderview.cpp:46 +msgctxt "@title:column" +msgid "Board" +msgstr "æ¿" -#: main.cpp:40 -msgid "konqueror plugin, KDE part" -msgstr "Konquerorãã©ã°ã¤ã³ãKDEãã¼ã" +#. i18n: file: ../src/boardtabwidgetui.rc:4 +#. i18n: ectx: Menu (board) +#. i18n: file: ../src/kitaui.rc:8 +#. i18n: ectx: Menu (board) +#: ../src/threadlistheaderview.cpp:46 rc.cpp:6 rc.cpp:12 +msgid "Board" +msgstr "æ¿(&B)" -#: main.cpp:41 -msgid "kitanavi, threadview's improvement" -msgstr "kitanavi, ã¹ã¬ãããã¥ã¼ã®æ¹è¯" +#: ../src/bbsview.cpp:77 +msgctxt "@title:column" +msgid "Board Name" +msgstr "æ¿å" -#: main.cpp:42 -msgid "improvements" -msgstr "ãã¾ãã¾ãªæ¹è¯" +#: ../src/bbstabwidget.cpp:22 +msgctxt "@title:tab" +msgid "Board Name" +msgstr "æ¿å" -#: main.cpp:43 -msgid "stylesheet support" -msgstr "ã¹ã¿ã¤ã«ã·ã¼ãã®ãµãã¼ã" +#. i18n: file: ../src/prefs/faceprefbase.ui:27 +#. i18n: ectx: property (title), widget (QGroupBox, listGroupBox) +#: rc.cpp:51 +msgid "Board/Subject List" +msgstr "æ¿/ã¹ã¬ä¸è¦§" -#: mainwindow.cpp:296 -msgid "Show board list" -msgstr "æ¿ä¸è¦§ã®è¡¨ç¤º" +#. i18n: file: ../src/writedialogbase.ui:32 +#. i18n: ectx: property (text), widget (QLabel, textLabel1) +#: rc.cpp:240 +msgid "Board:" +msgstr "æ¿:" -#: mainwindow.cpp:303 -msgid "Show subject list" -msgstr "ã¹ã¬ä¸è¦§ã®è¡¨ç¤º" +#: ../src/libkita/datinfo.cpp:448 ../src/libkita/datinfo.cpp:449 +msgid "Broken" +msgstr "å£ãã¦ãã¾ã" -#: mainwindow.cpp:310 -msgid "Show Image Viewer" -msgstr "ç»åãã¥ã¼ã¢ã表示" +#. i18n: file: ../src/threadproperty.ui:97 +#. i18n: ectx: property (text), widget (QLabel, cachePathLabel0) +#: rc.cpp:198 +msgid "Cache Path" +msgstr "ãã£ãã·ã¥ã®ãã¹" -#: mainwindow.cpp:317 -msgid "Show KitaNavi" -msgstr "KitaNaviã表示" +#. i18n: file: ../src/writedialogbase.ui:181 +#. i18n: ectx: property (text), widget (QPushButton, buttonCancel) +#: rc.cpp:270 +msgid "Cancel" +msgstr "ãã£ã³ã»ã«(&C)" -#: mainwindow.cpp:324 -msgid "Show Write Dock" -msgstr "æ¸ãè¾¼ã¿ããã¯ã表示" +#. i18n: file: ../src/libkita/globalconfig.kcfg:60 +#. i18n: ectx: label, entry (ListSortOrder), group (Global) +#: rc.cpp:333 +msgid "Choice order of board list." +msgstr "æ¿ä¸è¦§ã®é çªã®é¸æ" -#: mainwindow.cpp:334 -msgid "URL Line" -msgstr "" +#. i18n: file: ../src/threadlistviewbase.ui:114 +#. i18n: ectx: property (text), widget (QToolButton, closeButton) +#: rc.cpp:36 +msgid "Close" +msgstr "éãã" -#: mainwindow.cpp:351 -msgid "Load board list" -msgstr "æ¿ä¸è¦§ã®èªã¿è¾¼ã¿" +#: ../src/kitaui/tabwidgetbase.cpp:186 +msgctxt "@action:inmenu" +msgid "Close All Tabs" +msgstr "ãã¹ã¦ã®ã¿ããéãã" -#: mainwindow.cpp:358 -msgid "reset windows" -msgstr "ã¦ã£ã³ãã¦ããªã»ãã" +#: ../src/boardtabwidget.cpp:177 ../src/kitaui/tabwidgetbase.cpp:180 +msgctxt "@action:inmenu" +msgid "Close Left Tabs" +msgstr "å·¦ã®ã¿ããã¹ã¦ãéãã" -#: mainwindow.cpp:365 -msgid "default 1" -msgstr "ããã©ã«ã1" +#: ../src/boardtabwidget.cpp:173 ../src/kitaui/tabwidgetbase.cpp:166 +msgctxt "@action:inmenu" +msgid "Close Other Tabs" +msgstr "ä»ã®ã¿ããéãã" -#: mainwindow.cpp:372 -msgid "default 2" -msgstr "ããã©ã«ã2" +#: ../src/boardtabwidget.cpp:175 ../src/kitaui/tabwidgetbase.cpp:174 +msgctxt "@action:inmenu" +msgid "Close Right Tabs" +msgstr "å³ã®ã¿ããã¹ã¦ãéãã" -#: mainwindow.cpp:379 -msgid "default 3" -msgstr "ããã©ã«ã3" +#: ../src/boardtabwidget.cpp:171 ../src/kitaui/tabwidgetbase.cpp:158 +msgctxt "@action:inmenu" +msgid "Close This Tab" +msgstr "ãã®ã¿ããéãã(&C)" -#: mainwindow.cpp:387 -msgid "&Toggle subject view and thread view" -msgstr "ã¹ã¬ä¸è¦§ãã¥ã¼ã¨ã¹ã¬ãã表示ãã¥ã¼ãåæ¿ã(&T)" +#. i18n: file: ../src/threadlistviewbase.ui:111 +#. i18n: ectx: property (toolTip), widget (QToolButton, closeButton) +#: ../src/threadview.cpp:91 rc.cpp:33 +msgctxt "@info:tooltip" +msgid "Close tab" +msgstr "ã¿ããéãã" -#: mainwindow.cpp:394 prefs/prefs.cpp:69 -msgid "Login" -msgstr "ãã°ã¤ã³" +#: ../src/kitaui/tabwidgetbase.cpp:138 +msgctxt "@action:inmenu" +msgid "Configure Shortcuts..." +msgstr "ã·ã§ã¼ãã«ãããè¨å®(&H)..." -#: mainwindow.cpp:700 -msgid "subject" -msgstr "" +#: ../src/htmlpart.cpp:771 ../src/htmlpart.cpp:1113 +msgctxt "@action:inmenu" +msgid "Copy" +msgstr "ã³ãã¼" -#: mainwindow.cpp:705 -msgid "board" -msgstr "" +#: ../src/bbsview.cpp:195 +msgctxt "@action:button" +msgid "Copy" +msgstr "ã³ãã¼" -#: mainwindow.cpp:710 prefs/faceprefbase.cpp:191 prefs/uiprefbase.cpp:156 -msgid "Thread" -msgstr "ã¹ã¬ãã" +#: ../src/htmlpart.cpp:800 +msgctxt "@action:inmenu" +msgid "Copy Link Location" +msgstr "ãªã³ã¯ã®å ´æãã³ãã¼" -#: mainwindow.cpp:715 -msgid "KitaNavi" -msgstr "" +#: ../src/htmlpart.cpp:1110 ../src/boardtabwidget.cpp:183 +msgctxt "@action:inmenu" +msgid "Copy Title and URL" +msgstr "ã¿ã¤ãã«ã¨ URL ãã³ãã¼" -#: mainwindow.cpp:715 -msgid "Navi" -msgstr "" +#: ../src/htmlpart.cpp:1106 ../src/bbsview.cpp:89 ../src/threadlistview.cpp:72 +msgctxt "@action:inmenu" +msgid "Copy URL" +msgstr "URL ãã³ãã¼" -#: mainwindow.cpp:723 -msgid "Kita Image Viewer" -msgstr "Kitaç»åãã¥ã¼ã¢" +#: ../src/bbsview.cpp:91 ../src/threadlistview.cpp:74 +msgctxt "@action:inmenu" +msgid "Copy title and URL" +msgstr "ã¿ã¤ãã«ã¨ URL ãã³ãã¼" -#: mainwindow.cpp:723 -msgid "Image" -msgstr "ç»å" +#: ../src/threadlistheaderview.cpp:48 +msgctxt "@title:column" +msgid "Dat URL" +msgstr "DATãã¡ã¤ã«ã®URL" -#: mainwindow.cpp:728 prefs/prefs.cpp:72 -msgid "Write" -msgstr "æ¸ãè¾¼ã¿" +#. i18n: file: ../src/threadproperty.ui:37 +#. i18n: ectx: property (text), widget (QLabel, datURLLabel0) +#: rc.cpp:189 +msgid "Dat URL" +msgstr "DATãã¡ã¤ã«ã®URL" -#: mainwindow.cpp:798 -msgid "be.2ch.net is currently not supported." -msgstr "be.2ch.netã¯ç¾å¨ãµãã¼ãããã¦ãã¾ããã" +#. i18n: file: ../src/threadproperty.ui:67 +#. i18n: ectx: property (text), widget (QLabel, label0_3) +#: rc.cpp:192 +msgid "DatManager's information" +msgstr "ã¤ã³ããã¯ã¹ãã¡ã¤ã«ã®æ å ±" -#: mainwindow.cpp:848 thread/htmlpart.cpp:1374 -msgid "This is a BMP file. It might contain a Troy." -msgstr "ããã¯BMPãã¡ã¤ã«ã§ããããã¤ã®æ¨é¦¬ãå ¥ã£ã¦ãå¯è½æ§ãããã¾ãã" +#: ../src/threadlistheaderview.cpp:48 +msgid "DatURL" +msgstr "DAT ãã¡ã¤ã«ã® URL" -#: mainwindow.cpp:1210 -msgid "Login succeeded." -msgstr "ãã°ã¤ã³ã«æåãã¾ããã" +#. i18n: file: ../src/prefs/writeprefbase.ui:62 +#. i18n: ectx: property (text), widget (QLabel, DefaultMailLabel) +#: rc.cpp:180 +msgid "Default Mail" +msgstr "æ¨æºã®ã¡ã¼ã«ã¢ãã¬ã¹(&M)" -#: mainwindow.cpp:1212 -msgid "Login failed." -msgstr "ãã°ã¤ã³ã«å¤±æãã¾ããã" +#. i18n: file: ../src/prefs/writeprefbase.ui:19 +#. i18n: ectx: property (text), widget (QLabel, DefaultNameLabel) +#: rc.cpp:174 +msgid "Default Name" +msgstr "æ¨æºã®åå(&N)" -#: rc.cpp:4 -#, no-c-format -msgid "&Board" -msgstr "æ¿(&B)" +#. i18n: file: ../src/libkita/writeconfig.kcfg:16 +#. i18n: ectx: label, entry (DefaultMail), group (Write) +#: rc.cpp:354 +msgid "Default mail address." +msgstr "æ¨æºã®ã¡ã¼ã«ã¢ãã¬ã¹" -#: rc.cpp:6 -#, no-c-format -msgid "&Thread" -msgstr "ã¹ã¬ãã(&T)" +#. i18n: file: ../src/libkita/writeconfig.kcfg:9 +#. i18n: ectx: label, entry (DefaultName), group (Write) +#: rc.cpp:348 +msgid "Default name." +msgstr "æ¨æºã®åå" -#: rc.cpp:8 -#, no-c-format -msgid "F&avorites" -msgstr "ãæ°ã«å ¥ã(&A)" +#: ../src/threadtabwidget.cpp:252 +msgctxt "@action:button" +msgid "Delete" +msgstr "åé¤(&D)" -#: rc.cpp:10 -#, no-c-format -msgid "&Window" -msgstr "ã¦ã£ã³ãã¦(&W)" +#: ../src/threadview.cpp:84 +msgctxt "@info:tooltip" +msgid "Delete" +msgstr "åé¤" -#: bbs/bbstabwidget.cpp:24 bbs/bbsview.cpp:62 write/writedialogbase.cpp:126 -msgid "board name" -msgstr "æ¿å" +#: ../src/threadlistview.cpp:76 +msgctxt "@action:inmenu" +msgid "Delete Log" +msgstr "ãã°ãåé¤" -#: bbs/bbstabwidget.moc.cpp:34 bbs/bbstabwidget.moc.cpp:42 -msgid "KitaBBSTabWidget" -msgstr "" +#. i18n: file: ../src/prefs/uiprefbase.ui:99 +#. i18n: ectx: property (prefix), widget (QSpinBox, kcfg_ShowNum) +#: rc.cpp:126 +msgctxt "@label:spinbox Shown" +msgid "Display " +msgstr "表示 " -#: bbs/bbstabwidget.moc.cpp:128 bbs/bbstabwidget.moc.cpp:136 -#, fuzzy -msgid "KitaBBSDock" -msgstr "ã¹ã¬ãã" +#. i18n: file: ../src/prefs/uiprefbase.ui:93 +#. i18n: ectx: property (specialValueText), widget (QSpinBox, kcfg_ShowNum) +#: rc.cpp:120 +msgid "Display all res" +msgstr "ãã¹ã¦ã®ã¬ã¹ã表示" -#: bbs/bbsview.cpp:200 bbs/bbsview.cpp:227 bbs/bbsview.cpp:290 -msgid "" -"New boards:\n" -"\n" -msgstr "" -"æ°è¦æ¿:\n" -"\n" - -#: bbs/bbsview.cpp:209 bbs/bbsview.cpp:228 bbs/bbsview.cpp:291 -msgid "" -"These boards were moved:\n" -"\n" -msgstr "" -"以ä¸ã®æ¿ã移åãã¾ãã:\n" -"\n" - -#: bbs/bbsview.cpp:210 -msgid "" -"\n" -"Please create the backup of those caches.\n" -msgstr "" -"\n" -"ãããã®ãã£ãã·ã¥ã®ããã¯ã¢ãããä½æãã¦ãã ããã\n" - -#: bbs/bbsview.cpp:217 +#: ../src/bbsview.cpp:193 msgid "Do you really want to update board list?" -msgstr "æ¬å½ã«æ¿ãªã¹ããæ´æ°ãã¾ããï¼" +msgstr "æ¬å½ã«æ¿ä¸è¦§ãæ´æ°ãã¾ããï¼" -#: bbs/bbsview.cpp:236 -msgid "no new boards" -msgstr "æ°ããæ¿ã¯ããã¾ããã" +#: ../src/htmlpart.cpp:831 ../src/htmlpart.cpp:1186 ../src/htmlpart.cpp:1230 +#, kde-format +msgid "Do you want to add '%1' to abone list?" +msgstr "'%1'ããã¼ã¼ãä¸è¦§ã«è¿½å ãã¾ããï¼" -#: bbs/bbsview.cpp:367 -msgid "Kita Board" -msgstr "Kitaæ¿" +#: ../src/writetabwidget.cpp:62 +msgid "Do you want to clear the text?" +msgstr "ããã¹ããã¯ãªã¢ãã¾ããï¼" -#: bbs/bbsview.cpp:523 board/boardtabwidget.cpp:257 board/boardview.cpp:375 -#: board/favoritelistview.cpp:135 image/imagetabwidget.cpp:296 -#: image/imagetabwidget.cpp:637 thread/htmlpart.cpp:1161 -#: thread/htmlpart.cpp:1543 thread/htmlpart.cpp:1755 -#: thread/threadtabwidget.cpp:422 thread/threadtabwidget.cpp:704 -msgid "Open with Web Browser" -msgstr "ã¦ã§ããã©ã¦ã¶ã§éã" +#: ../src/threadview.cpp:555 ../src/boardview.cpp:316 +msgid "Do you want to delete Log?" +msgstr "ãã°ãåé¤ãã¾ããï¼" -#: bbs/bbsview.cpp:525 -msgid "Open with New Tab" -msgstr "æ°ããã¿ãã§éã" +#: ../src/main.cpp:45 +msgid "Document to open." +msgstr "éãææ¸" -#: bbs/bbsview.cpp:526 board/boardview.cpp:377 board/favoritelistview.cpp:137 -#: thread/threadtabwidget.cpp:705 -msgid "Copy URL" -msgstr "URLãã³ãã¼" +#. i18n: file: ../src/prefs/uiprefbase.ui:236 +#. i18n: ectx: property (text), widget (KUrlLabel, editFileAssociation) +#: rc.cpp:156 +msgid "Edit file association..." +msgstr "ãã¡ã¤ã«ã®é¢é£ä»ããç·¨é..." -#: bbs/bbsview.cpp:527 board/boardtabwidget.cpp:258 board/boardview.cpp:378 -#: board/favoritelistview.cpp:138 thread/htmlpart.cpp:1554 -#: thread/threadtabwidget.cpp:436 thread/threadtabwidget.cpp:706 -#: thread/threadview.cpp:405 -msgid "Copy title and URL" -msgstr "ã¿ã¤ãã«ã¨URLãã³ãã¼" +#. i18n: file: ../src/prefs/loginprefbase.ui:79 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_AutoLogin) +#: rc.cpp:165 +msgid "Enables auto login" +msgstr "èªåãã°ã¤ã³ãæå¹ã«ãã(&E)" -#: bbs/bbsview.cpp:529 board/boardview.cpp:380 board/favoritelistview.cpp:139 -#: thread/threadview.cpp:407 -msgid "Remove from Favorites" -msgstr "ãæ°ã«å ¥ãããåé¤" +#: ../src/htmlpart.cpp:760 ../src/threadtabwidget.cpp:233 +msgctxt "@action:inmenu" +msgid "End" +msgstr "æå¾(&E)" -#: bbs/bbsview.cpp:531 board/boardview.cpp:382 thread/threadview.cpp:407 -msgid "Add to Favorites" -msgstr "ãæ°ã«å ¥ãã«è¿½å " +#: ../src/htmlpart.cpp:1099 +msgctxt "@action:inmenu" +msgid "Extract by Name" +msgstr "ååã§æ½åº" -#: bbs/bbsview.moc.cpp:34 bbs/bbsview.moc.cpp:42 -#, fuzzy -msgid "KitaBBSView" -msgstr "Kitaç»åãã¥ã¼ã¢" +#: ../src/prefs/preferences.cpp:36 +msgid "Face" +msgstr "å¤è¦³" -#: bbs/bbsviewbase.cpp:57 board/threadproperty.cpp:132 -#: prefs/aboneprefbase.cpp:77 prefs/asciiartprefbase.cpp:55 -#: prefs/faceprefbase.cpp:183 prefs/loginprefbase.cpp:108 -#: prefs/uiprefbase.cpp:149 prefs/writeprefbase.cpp:85 -#: thread/threadviewbase.cpp:112 -msgid "Form1" -msgstr "" +#: ../src/boardtabwidget.cpp:38 +msgctxt "@title:tab Favorite boards" +msgid "Favorite" +msgstr "ãæ°ã«å ¥ã(&A)" -#: board/boardtabwidget.cpp:35 -msgid "Favorite" +#: ../src/bbsview.cpp:412 +msgctxt "@item:inlistbox" +msgid "Favorites" msgstr "ãæ°ã«å ¥ã" -#: board/boardtabwidget.cpp:141 write/writetabwidget.cpp:102 -msgid "New Thread" -msgstr "æ°è¦ã¹ã¬ãã" +#. i18n: file: ../src/kitaui.rc:4 +#. i18n: ectx: Menu (file) +#: rc.cpp:9 +msgid "File" +msgstr "ãã¡ã¤ã«(&F)" -#: board/boardtabwidget.cpp:148 board/boardtabwidget.cpp:256 -msgid "Show Old Logs" -msgstr "å¤ããã°ã表示" +#. i18n: file: ../src/threadlistviewbase.ui:44 +#. i18n: ectx: property (toolTip), widget (QToolButton, hideButton) +#: rc.cpp:18 +msgid "Filter thread" +msgstr "ã¹ã¬ããã£ã«ã¿" -#: board/boardtabwidget.cpp:155 board/boardtabwidget.cpp:259 -msgid "Show Title Image" -msgstr "ã¿ã¤ãã«ã®ç»åã表示" +#: ../src/boardtabwidget.cpp:122 +msgid "Find" +msgstr "æ¤ç´¢" -#: board/boardtabwidget.cpp:245 image/imagetabwidget.cpp:617 -#: kitaui/tabwidgetbase.cpp:310 kitaui/tabwidgetbase.cpp:547 -#: thread/threadtabwidget.cpp:692 -msgid "Close this tab" -msgstr "ãã®ã¿ããéãã" +#. i18n: file: ../src/prefs/faceprefbase.ui:33 +#. i18n: ectx: property (text), widget (QLabel, listFontLabel) +#: rc.cpp:54 +msgctxt "List font" +msgid "Font" +msgstr "ãã©ã³ã(&F)" -#: board/boardtabwidget.cpp:250 image/imagetabwidget.cpp:622 -#: kitaui/tabwidgetbase.cpp:317 kitaui/tabwidgetbase.cpp:552 -#: thread/threadtabwidget.cpp:697 -msgid "Close Other Tabs" -msgstr "ä»ã®ã¿ããéãã" +#. i18n: file: ../src/prefs/faceprefbase.ui:124 +#. i18n: ectx: property (text), widget (QLabel, threadFontLabel) +#: rc.cpp:69 +msgctxt "Thread font" +msgid "Font" +msgstr "ãã©ã³ã(&N)" -#: board/boardtabwidget.cpp:251 image/imagetabwidget.cpp:623 -#: kitaui/tabwidgetbase.cpp:324 kitaui/tabwidgetbase.cpp:553 -#: thread/threadtabwidget.cpp:698 -msgid "Close right tabs" -msgstr "å³ã®ã¿ãå ¨ã¦ãéãã" +#. i18n: file: ../src/prefs/faceprefbase.ui:193 +#. i18n: ectx: property (text), widget (QLabel, popupFontLabel) +#: rc.cpp:84 +msgctxt "Popup font" +msgid "Font" +msgstr "ãã©ã³ã" -#: board/boardtabwidget.cpp:252 image/imagetabwidget.cpp:624 -#: kitaui/tabwidgetbase.cpp:331 kitaui/tabwidgetbase.cpp:554 -#: thread/threadtabwidget.cpp:699 -msgid "Close left tabs" -msgstr "å·¦ã®ã¿ãå ¨ã¦ãéãã" +#: ../src/threadtabwidget.cpp:218 +msgctxt "@action:inmenu" +msgid "Go Back Anchor" +msgstr "ã¢ã³ã«ã¼å ã«æ»ã(&G)" -#: board/boardtabwidget.moc.cpp:34 board/boardtabwidget.moc.cpp:42 -msgid "KitaBoardTabWidget" -msgstr "" +#. i18n: file: ../src/threadlistviewbase.ui:47 +#. i18n: ectx: property (text), widget (QToolButton, hideButton) +#: rc.cpp:21 +msgid "Hide" +msgstr "é ã" -#: board/boardtabwidget.moc.cpp:153 board/boardtabwidget.moc.cpp:161 -msgid "SubjectTabBar" -msgstr "" +#: ../src/main.cpp:35 +msgid "Hideki Ikemoto" +msgstr "Hideki Ikemoto" -#: board/boardtabwidget.moc.cpp:226 board/boardtabwidget.moc.cpp:234 -msgid "KitaBoardDock" -msgstr "" +#: ../src/threadlistheaderview.cpp:28 +msgid "ID" +msgstr "ID" -#: board/boardview.cpp:376 board/favoritelistview.cpp:136 -#: thread/threadview.cpp:404 -msgid "Open with new tab" -msgstr "æ°ããã¿ãã§éã" +#. i18n: file: ../src/prefs/aboneprefbase.ui:19 +#. i18n: ectx: property (text), widget (QLabel, idLabel) +#: rc.cpp:39 +msgctxt "@label:textbox Abone ID" +msgid "ID" +msgstr "&ID" -#: board/boardview.cpp:387 -msgid "Delete Log" -msgstr "ãã°ãåé¤" +#: ../src/threadlistheaderview.cpp:52 +msgctxt "@title:column" +msgid "ID Order" +msgstr "IDã®é åº" -#: board/boardview.cpp:389 -msgid "Open by background" -msgstr "ããã¯ã°ã©ã¦ã³ãã§éã" +#: ../src/threadlistheaderview.cpp:52 +msgid "IDOrder" +msgstr "ID ã®é åº" -#: board/boardview.cpp:392 -msgid "Property" -msgstr "ããããã£" +#: ../src/threadlistheaderview.cpp:30 +msgid "Icon" +msgstr "ã¢ã¤ã³ã³" -#: board/boardview.cpp:453 thread/threadview.cpp:734 -msgid "Do you want to delete Log ?" -msgstr "ãã°ãåé¤ãã¾ããï¼" +#. i18n: file: ../src/prefs/uiprefbase.ui:217 +#. i18n: ectx: property (text), widget (QLabel, mimeListLabel) +#: rc.cpp:153 +msgid "If mime type include this list (comma separated list)" +msgstr "以ä¸ã®ä¸è¦§ã«å«ã¾ãã MIME ã¿ã¤ãã対象ï¼ã³ã³ãåºåãï¼(&I)" -#: board/boardview.moc.cpp:34 board/boardview.moc.cpp:42 -msgid "KitaBoardView" +#: ../src/writetabwidget.cpp:145 ../src/writeview.cpp:257 +msgid "" +"If you close this dialog, you will lose text.\n" +"Do you want to close?" msgstr "" +"ãã®ãã¤ã¢ãã°ãéããã¨ãããã¹ããç ´æ£ããã¾ãã\n" +"éãã¦ãããã§ããï¼" -#: board/favoritelistview.moc.cpp:34 board/favoritelistview.moc.cpp:42 -msgid "FavoriteListView" -msgstr "" +#. i18n: file: ../src/threadproperty.ui:117 +#. i18n: ectx: property (text), widget (QLabel, indexPathLabel0) +#: rc.cpp:201 +msgid "Index Path" +msgstr "ã¤ã³ããã¯ã¹ã®ãã¹" -#: board/threadlistview.cpp:34 board/threadlistview.cpp:36 -msgid " " -msgstr "" +#. i18n: file: ../src/threadproperty.ui:207 +#. i18n: ectx: property (text), widget (QLabel, label0) +#: rc.cpp:213 +msgid "Index file's information" +msgstr "ã¤ã³ããã¯ã¹ãã¡ã¤ã«ã®æ å ±" -#: board/threadlistview.cpp:34 thread/htmlpart.cpp:1103 -#: thread/htmlpart.cpp:1537 -msgid "Mark" -msgstr "ãã¼ã¯" +#: ../src/main.cpp:32 +msgid "Kita" +msgstr "Kita" -#: board/threadlistview.cpp:35 -msgid "No." -msgstr "No." +#: ../src/main.cpp:22 +msgid "Kita - 2ch client for KDE" +msgstr "Kita - KDE ç¨ã® 2ch ãã©ã¦ã¶" -#: board/threadlistview.cpp:35 prefs/aboneprefbase.cpp:78 -msgid "ID" -msgstr "ID" +#: ../src/bbsview.cpp:323 +msgctxt "@item:inlistbox" +msgid "Kita Board" +msgstr "Kita æ¿" -#: board/threadlistview.cpp:36 -msgid "Icon" -msgstr "ã¢ã¤ã³ã³" +#: ../src/htmlpart.cpp:754 +#, kde-format +msgctxt "@action:inmenu" +msgid "Kokomade Yonda (%1)" +msgstr "ããã¾ã§èªãã (%1)" -#: board/threadlistview.cpp:37 -msgid "Title" -msgstr "ã¿ã¤ãã«" +#. i18n: file: ../src/libkita/globalconfig.kcfg:9 +#. i18n: ectx: label, entry (Font), group (Global) +#: rc.cpp:288 +msgid "List font." +msgstr "ä¸è¦§ã®ãã©ã³ãã" -#: board/threadlistview.cpp:37 -msgid "Subject" -msgstr "ãµãã¸ã§ã¯ã" +#: ../src/mainwindow.cpp:322 +msgctxt "@action:inmenu" +msgid "Load Board List" +msgstr "æ¿ä¸è¦§ã®èªã¿è¾¼ã¿(&L)" -#: board/threadlistview.cpp:38 board/threadproperty.cpp:149 -#: board/threadproperty.cpp:153 -msgid "ResNum" -msgstr "ã¬ã¹" +#: ../src/mainwindow.cpp:309 +msgctxt "@action:intoolbar" +msgid "Location Bar" +msgstr "å ´æãã¼" -#: board/threadlistview.cpp:39 board/threadproperty.cpp:151 -#: board/threadproperty.cpp:155 -msgid "ReadNum" -msgstr "åå¾" +#: ../src/mainwindow.cpp:327 +msgctxt "@action:inmenu Login menu" +msgid "Login" +msgstr "ãã°ã¤ã³(&O)" -#: board/threadlistview.cpp:40 board/threadproperty.cpp:146 -msgid "ViewPos" -msgstr "ViewPos" +#: ../src/prefs/preferences.cpp:65 +msgid "Login" +msgstr "ãã°ã¤ã³" -#: board/threadlistview.cpp:41 -msgid "Unread" -msgstr "æªèª" +#: ../src/mainwindow.cpp:184 +msgctxt "@info:status" +msgid "Login failed." +msgstr "ãã°ã¤ã³ã«å¤±æãã¾ããã" -#: board/threadlistview.cpp:42 -msgid "Since" -msgstr "ã¹ã¬ç«ã¦æ¥æ" +#: ../src/mainwindow.cpp:182 +msgctxt "@info:status" +msgid "Login succeeded." +msgstr "ãã°ã¤ã³ã«æåãã¾ããã" -#: board/threadlistview.cpp:43 -msgid "Thread's speed" -msgstr "ã¹ã¬ããã®é度" +#. i18n: file: ../src/libkita/globalconfig.kcfg:68 +#. i18n: ectx: label, entry (PartMimeList), group (Global) +#: rc.cpp:336 +msgid "MIME list to use kpart." +msgstr "kpart ã使ã MIME ä¸è¦§ã" -#: board/threadlistview.cpp:43 -msgid "Speed" -msgstr "é度" +#. i18n: file: ../src/libkita/accountconfig.kcfg:9 +#. i18n: ectx: label, entry (BeMailAddress), group (Account) +#: rc.cpp:273 +msgid "Mail address of be.2ch.net" +msgstr "be.2ch.net ã®ã¡ã¼ã«ã¢ãã¬ã¹" -#: board/threadlistview.cpp:44 -msgid "Board" -msgstr "æ¿" +#: ../src/htmlpart.cpp:734 +msgctxt "@title:menu" +msgid "Mark" +msgstr "ãã¼ã¯" -#: board/threadlistview.cpp:45 board/threadproperty.cpp:139 -msgid "Dat URL" -msgstr "DATãã¡ã¤ã«ã®URL" +#: ../src/htmlpart.cpp:1075 +msgctxt "@action:inmenu" +msgid "Mark" +msgstr "ãã¼ã¯" -#: board/threadlistview.cpp:45 -msgid "DatURL" -msgstr "DATãã¡ã¤ã«ã®URL" +#: ../src/threadlistheaderview.cpp:26 +msgid "Mark" +msgstr "ãã¼ã¯" -#: board/threadlistview.cpp:46 +#: ../src/threadlistheaderview.cpp:50 +msgctxt "@title:column" msgid "Mark Order" msgstr "ãã¼ã¯ã®é åº" -#: board/threadlistview.cpp:46 +#. i18n: file: ../src/prefs/uiprefbase.ui:26 +#. i18n: ectx: property (text), widget (QLabel, MarkLabel) +#: rc.cpp:105 +msgid "Mark new thread to made:" +msgstr "次ã®æé以å ã«ä½æãããã¹ã¬ããã¼ã¯(&M):" + +#: ../src/threadlistheaderview.cpp:50 msgid "MarkOrder" msgstr "ãã¼ã¯ã®é åº" -#: board/threadlistview.cpp:47 -msgid "ID Order" -msgstr "IDã®é åº" +#. i18n: file: ../src/libkita/accountconfig.kcfg:22 +#. i18n: ectx: label, entry (Password), group (Account) +#: rc.cpp:285 +#, fuzzy +msgid "Maru password" +msgstr "ãã¹ã¯ã¼ã" -#: board/threadlistview.cpp:47 -msgid "IDOrder" -msgstr "IDã®é åº" - -#: board/threadlistviewbase.cpp:89 prefs/debugprefbase.cpp:83 -msgid "Form2" +#. i18n: file: ../src/libkita/accountconfig.kcfg:15 +#. i18n: ectx: label, entry (UserID), group (Account) +#: rc.cpp:279 +msgid "Maru user id" msgstr "" -#: board/threadlistviewbase.cpp:90 thread/threadviewbase.cpp:115 -msgid "Search" -msgstr "æ¤ç´¢" +#. i18n: file: ../src/prefs/aboneprefbase.ui:39 +#. i18n: ectx: property (text), widget (QLabel, wordLabel) +#: rc.cpp:42 +msgctxt "@label:textbox Abone NG word" +msgid "NG word" +msgstr "&NG ã¯ã¼ã" -#: board/threadlistviewbase.cpp:91 thread/threadviewbase.cpp:116 -msgid "search word" -msgstr "åèªãæ¤ç´¢" +#. i18n: file: ../src/prefs/aboneprefbase.ui:59 +#. i18n: ectx: property (text), widget (QLabel, nameLabel) +#: rc.cpp:45 +msgctxt "@label:textbox Abone name" +msgid "Name" +msgstr "åå(&M)" -#: board/threadlistviewbase.cpp:92 -msgid "Hide" -msgstr "é ã" +#. i18n: file: ../src/libkita/globalconfig.kcfg:78 +#. i18n: ectx: label, entry (NameCompletionList), group (Completion) +#: rc.cpp:342 +msgid "Name Completion list." +msgstr "ååè£å®ä¸è¦§ã" -#: board/threadlistviewbase.cpp:93 -msgid "filter thread" -msgstr "ã¹ã¬ããã£ã«ã¿" +#: ../src/bbsview.cpp:175 ../src/bbsview.cpp:199 ../src/bbsview.cpp:259 +msgid "" +"New boards:\n" +"\n" +msgstr "" +"æ°è¦æ¿:\n" +"\n" -#: board/threadlistviewbase.cpp:95 -msgid "reload board" -msgstr "æ¿ã®ãªãã¼ã" +#: ../src/threadlistheaderview.cpp:28 +msgctxt "@title:column" +msgid "No." +msgstr "No." -#: board/threadlistviewbase.cpp:96 -msgid "unread/read/new threads" -msgstr "æªèª/æ¢èª/æ°è¦ã¹ã¬ãã" +#: ../src/htmlpart.cpp:1490 +msgctxt "@label:textbox This is the first reply" +msgid "None" +msgstr "ãªã" -#: board/threadlistviewbase.cpp:98 thread/threadviewbase.cpp:129 -msgid "close tab" -msgstr "ã¿ããéãã" +#: ../src/htmlpart.cpp:1510 +msgctxt "@label:textbox There is no reply" +msgid "None" +msgstr "ãªã" -#: board/threadproperty.cpp:133 -msgid "Thread URL" -msgstr "ã¹ã¬ããã®URL" +#: ../src/threadview.cpp:521 +msgid "Not Found" +msgstr "è¦ã¤ããã¾ãã" -#: board/threadproperty.cpp:135 -msgid "Cache Path" -msgstr "ãã£ãã·ã¥ã®ãã¹" +#. i18n: file: ../src/libkita/globalconfig.kcfg:37 +#. i18n: ectx: label, entry (ShowNum), group (Global) +#: rc.cpp:315 +msgid "Number of responses displayed once." +msgstr "ä¸åº¦ã«è¡¨ç¤ºããã¬ã¹ã®æ°ã" -#: board/threadproperty.cpp:136 board/threadproperty.cpp:143 -msgid "Thread Name" -msgstr "ã¹ã¬ããå" +#. i18n: file: ../src/writedialogbase.ui:165 +#. i18n: ectx: property (text), widget (QPushButton, buttonOk) +#: rc.cpp:267 +msgid "OK" +msgstr "&OK" -#: board/threadproperty.cpp:141 -msgid "Index Path" -msgstr "ã¤ã³ããã¯ã¹ã®ãã¹" +#: ../src/htmlpart.cpp:795 ../src/htmlpart.cpp:1084 ../src/htmlpart.cpp:1260 +#: ../src/bbsview.cpp:88 ../src/boardtabwidget.cpp:181 +#: ../src/threadlistview.cpp:71 +msgctxt "@action:inmenu" +msgid "Open with Web Browser" +msgstr "ã¦ã§ããã©ã¦ã¶ã§éã" -#: board/threadproperty.cpp:147 -msgid "Index file's information" -msgstr "ã¤ã³ããã¯ã¹ãã¡ã¤ã«ã®æ å ±" +#. i18n: file: ../src/prefs/uiprefbase.ui:198 +#. i18n: ectx: property (title), widget (QGroupBox, partsGroupBox) +#: rc.cpp:147 +msgid "Parts" +msgstr "Parts" -#: board/threadproperty.cpp:148 -msgid "\"cache\" file's info (obsolete)" -msgstr "(å¤ã)\"cache\"ãã¡ã¤ã«ã®æ å ±" +#. i18n: file: ../src/prefs/loginprefbase.ui:46 +#. i18n: ectx: property (text), widget (QLabel, passwordLabel) +#: rc.cpp:162 +msgid "Password" +msgstr "ãã¹ã¯ã¼ã(&P)" -#: image/imagetabwidget.cpp:92 -msgid "can't start downloading. try again later." -msgstr "ãã¦ã³ãã¼ããã¹ã¿ã¼ãã§ãã¾ãããå¾ã§å度å®è¡ãã¦ãã ããã" +#. i18n: file: ../src/prefs/faceprefbase.ui:187 +#. i18n: ectx: property (title), widget (QGroupBox, popupGroupBox) +#: rc.cpp:81 +msgid "Popup" +msgstr "ãããã¢ãã" -#: image/imagetabwidget.cpp:247 image/imagetabwidget.cpp:631 -#: thread/htmlpart.cpp:1062 -msgid "Cancel mosaic" -msgstr "ã¢ã¶ã¤ã¯ãå¤ã" +#. i18n: file: ../src/libkita/colorconfig.kcfg:21 +#. i18n: ectx: label, entry (PopupBackground), group (Color) +#: rc.cpp:369 +msgid "Popup background color." +msgstr "ãããã¢ããã®èæ¯è²ã" -#: image/imagetabwidget.cpp:254 -msgid "Cancel All mosaics" -msgstr "å ¨ã¦ã®ã¢ã¶ã¤ã¯ãå¤ã" +#. i18n: file: ../src/libkita/globalconfig.kcfg:15 +#. i18n: ectx: label, entry (PopupFont), group (Global) +#: rc.cpp:294 +msgid "Popup font." +msgstr "ãããã¢ããã®ãã©ã³ãã" -#: image/imagetabwidget.cpp:261 image/imagetabwidget.cpp:633 -msgid "Fit Image to Window" -msgstr "ã¦ã£ã³ãã¦ã«ç»åãåããã" +#. i18n: file: ../src/libkita/colorconfig.kcfg:17 +#. i18n: ectx: label, entry (Popup), group (Color) +#: rc.cpp:366 +msgid "Popup foreground color." +msgstr "ãããã¢ããã®åæ¯è²ã" -#: image/imagetabwidget.cpp:268 image/imagetabwidget.cpp:634 -msgid "Original Size" -msgstr "å ã®ãµã¤ãºã«æ»ã" +#: ../src/threadlistview.cpp:78 +msgctxt "@action:inmenu" +msgid "Property" +msgstr "ããããã£" -#: image/imagetabwidget.cpp:275 -msgid "Zoom In" -msgstr "ãºã¼ã ã¤ã³" +#: ../src/htmlpart.cpp:1068 +msgctxt "@action:inmenu" +msgid "Quote This" +msgstr "å¼ç¨ãã¦æ¸ãè¾¼ã" -#: image/imagetabwidget.cpp:282 -msgid "Zoom Out" -msgstr "ãºã¼ã ã¢ã¦ã" +#: ../src/threadlistheaderview.cpp:36 +msgctxt "@title:column" +msgid "ReadNum" +msgstr "åå¾" -#: image/imagetabwidget.cpp:289 image/imagetabwidget.cpp:639 -#: thread/htmlpart.cpp:1553 thread/htmlpart.cpp:1754 -#: thread/threadtabwidget.cpp:429 -msgid "copy URL" -msgstr "URLãã³ãã¼" +#. i18n: file: ../src/threadproperty.ui:157 +#. i18n: ectx: property (text), widget (QLabel, readNumLabel0) +#. i18n: file: ../src/threadproperty.ui:257 +#. i18n: ectx: property (text), widget (QLabel, idx_readNumLabel0) +#. i18n: file: ../src/threadproperty.ui:337 +#. i18n: ectx: property (text), widget (QLabel, cache_readNumLabel0) +#: ../src/threadlistheaderview.cpp:36 rc.cpp:207 rc.cpp:222 rc.cpp:234 +msgid "ReadNum" +msgstr "åå¾" -#: image/imagetabwidget.cpp:317 -msgid "Close all error tabs" -msgstr "å ¨ã¦ã®ã¨ã©ã¼ã¿ããéãã" +#: ../src/threadtabwidget.cpp:240 +msgctxt "@action:button" +msgid "Reload" +msgstr "åèªã¿è¾¼ã¿(&R)" -#: image/imagetabwidget.cpp:331 image/imagetabwidget.cpp:638 -msgid "Open Thread" -msgstr "ã¹ã¬ãããéã" +#: ../src/boardtabwidget.cpp:128 +msgctxt "@action:button Reload the subject view" +msgid "Reload" +msgstr "åèªã¿è¾¼ã¿(&R)" -#: image/imagetabwidget.cpp:338 -msgid "Size" -msgstr "ãµã¤ãº" +#: ../src/threadview.cpp:75 +msgctxt "@info:tooltip" +msgid "Reload" +msgstr "åèªã¿è¾¼ã¿" -#: image/imagetabwidget.moc.cpp:34 image/imagetabwidget.moc.cpp:42 -msgid "KitaImgTabWidget" -msgstr "" +#. i18n: file: ../src/threadlistviewbase.ui:60 +#. i18n: ectx: property (text), widget (QToolButton, reloadButton) +#: rc.cpp:27 +msgctxt "@action:button Reload the board" +msgid "Reload" +msgstr "åèªã¿è¾¼ã¿" -#: image/imagetabwidget.moc.cpp:263 image/imagetabwidget.moc.cpp:271 -msgid "KitaImgTabBar" -msgstr "" +#. i18n: file: ../src/threadlistviewbase.ui:57 +#. i18n: ectx: property (toolTip), widget (QToolButton, reloadButton) +#: rc.cpp:24 +msgid "Reload board" +msgstr "æ¿ã®åèªã¿è¾¼ã¿" -#: image/imagetabwidget.moc.cpp:336 image/imagetabwidget.moc.cpp:344 -msgid "KitaImgDock" -msgstr "" +#: ../src/bbsview.cpp:93 ../src/threadlistview.cpp:203 +msgctxt "@action:inmenu" +msgid "Remove from Favorites" +msgstr "ãæ°ã«å ¥ãããåé¤" -#: image/imageview.moc.cpp:34 image/imageview.moc.cpp:42 -#, fuzzy -msgid "KitaImgView" -msgstr "Kitaç»åãã¥ã¼ã¢" +#: ../src/htmlpart.cpp:1091 +msgctxt "@action:inmenu" +msgid "Res Tree" +msgstr "ã¬ã¹ãããªã¼è¡¨ç¤º" -#: kitaui/htmlview.moc.cpp:34 kitaui/htmlview.moc.cpp:42 -msgid "KitaHTMLView" -msgstr "" +#: ../src/threadlistheaderview.cpp:34 +msgctxt "@title:column" +msgid "ResNum" +msgstr "ã¬ã¹æ°" -#: kitaui/tabwidgetbase.cpp:151 -msgid " Load Error" -msgstr " èªã¿è¾¼ã¿ã¨ã©ã¼" +#. i18n: file: ../src/threadproperty.ui:137 +#. i18n: ectx: property (text), widget (QLabel, resNumLabel0) +#. i18n: file: ../src/threadproperty.ui:237 +#. i18n: ectx: property (text), widget (QLabel, idx_resNumLabel0) +#. i18n: file: ../src/threadproperty.ui:317 +#. i18n: ectx: property (text), widget (QLabel, cache_resNumLabel0) +#: ../src/threadlistheaderview.cpp:34 rc.cpp:204 rc.cpp:219 rc.cpp:231 +msgid "ResNum" +msgstr "ã¬ã¹æ°" -#: kitaui/tabwidgetbase.cpp:152 -msgid "can't load %1." -msgstr "%1ãèªã¿è¾¼ãã¾ããã" +#: ../src/htmlpart.cpp:1095 +msgctxt "@action:inmenu" +msgid "Reverse Res Tree" +msgstr "ã¬ã¹å ãããªã¼è¡¨ç¤º" -#: kitaui/tabwidgetbase.cpp:280 -msgid "Configure S&hortcuts..." -msgstr "ã·ã§ã¼ãã«ãããè¨å®(&H)..." +#: ../src/htmlpart.cpp:1122 +msgctxt "@action:inmenu" +msgid "Set Kokomade Yonda" +msgstr "ãããã¾ã§èªãã ããã»ãã" -#: kitaui/tabwidgetbase.cpp:288 -msgid "Activate Next Tab" -msgstr "次ã®ã¿ãã«ç§»åãã" +#: ../src/boardtabwidget.cpp:133 +msgid "Show Old Logs" +msgstr "å¤ããã°ã表示(&S)" -#: kitaui/tabwidgetbase.cpp:299 -msgid "Activate Previous Tab" -msgstr "åã®ã¿ãã«ç§»åãã" +#: ../src/boardtabwidget.cpp:179 +msgctxt "@action:inmenu" +msgid "Show Old Logs" +msgstr "å¤ããã°ã表示(&S)" -#: kitaui/tabwidgetbase.cpp:338 -msgid "Close all tabs" -msgstr "å ¨ã¦ã®ã¿ããéãã" +#: ../src/mainwindow.cpp:297 +msgctxt "@action:inmenu" +msgid "Show Toolbar" +msgstr "ãã¼ã«ãã¼ã表示(&S)" -#: kitaui/tabwidgetbase.cpp:345 -msgid "Switch to Board" -msgstr "æ¿ä¸è¦§ã«åãæ¿ã" +#. i18n: file: ../src/prefs/uiprefbase.ui:156 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_ShowMailAddress) +#: rc.cpp:135 +msgid "Show mail address in the thread." +msgstr "ã¹ã¬ããã®ã¡ã¼ã«ã¢ãã¬ã¹æ¬ã表示(&S)" -#: kitaui/tabwidgetbase.cpp:352 -msgid "Switch to Subject" -msgstr "ã¹ã¬ä¸è¦§ã«åãæ¿ã" +#. i18n: file: ../src/prefs/uiprefbase.ui:185 +#. i18n: ectx: property (text), widget (QRadioButton, numOrderRadio) +#: rc.cpp:144 +msgid "Show thread in numerical order" +msgstr "çªå·é ã«ã¹ã¬ã表示(&T)" -#: kitaui/tabwidgetbase.cpp:359 -msgid "Switch to Thread" -msgstr "ã¹ã¬ã«åãæ¿ã" +#. i18n: file: ../src/prefs/uiprefbase.ui:172 +#. i18n: ectx: property (text), widget (QRadioButton, unreadFirstRadio) +#: rc.cpp:141 +msgid "Show unread thread first" +msgstr "æªèªã®ããã¹ã¬ãå ã«è¡¨ç¤º" -#: kitaui/tabwidgetbase.cpp:366 -msgid "Switch to KitaNavi" -msgstr "KitaNaviã«åãæ¿ã" +#: ../src/threadlistheaderview.cpp:42 +msgctxt "@title:column" +msgid "Since" +msgstr "ã¹ã¬ç«ã¦æ¥æ" -#: kitaui/tabwidgetbase.cpp:373 -msgid "Switch to Imgviewer" -msgstr "ç»åãã¥ã¼ã¢ã«åãæ¿ã" +#: ../src/threadlistheaderview.cpp:42 +msgid "Since" +msgstr "ã¹ã¬ç«ã¦æ¥æ" -#: kitaui/tabwidgetbase.cpp:380 -msgid "Switch to writedock" -msgstr "æ¸ãè¾¼ã¿ããã¯ã«åãæ¿ã" +#: ../src/threadlistheaderview.cpp:45 +msgid "Speed" +msgstr "é度" -#: kitaui/tabwidgetbase.moc.cpp:34 kitaui/tabwidgetbase.moc.cpp:42 -msgid "KitaTabWidgetBase" -msgstr "" +#: ../src/htmlpart.cpp:747 +msgctxt "@action:inmenu Go to the original post" +msgid "Start" +msgstr "æå(&S)" -#: kitaui/tabwidgetbase.moc.cpp:310 kitaui/tabwidgetbase.moc.cpp:318 -msgid "KitaTabBarBase" -msgstr "" +#: ../src/threadtabwidget.cpp:225 +msgctxt "@action:inmenu" +msgid "Start" +msgstr "æå(&S)" -#: kitaui/tabwidgetbase.moc.cpp:383 kitaui/tabwidgetbase.moc.cpp:391 -msgid "KitaDockWidgetBase" -msgstr "" +#: ../src/threadtabwidget.cpp:246 +msgctxt "@action:inmenu" +msgid "Stop" +msgstr "åæ¢(&T)" -#: libkita/datinfo.cpp:501 libkita/datinfo.cpp:503 prefs/prefs.cpp:66 -msgid "Abone" -msgstr "ãã¼ã¼ã" +#: ../src/threadlistheaderview.cpp:32 +msgid "Subject" +msgstr "ãµãã¸ã§ã¯ã" -#: libkita/datinfo.cpp:507 libkita/datinfo.cpp:508 -msgid "Broken" -msgstr "" +#. i18n: file: ../src/prefs/faceprefbase.ui:56 +#. i18n: ectx: property (text), widget (QLabel, listColorLabel) +#: rc.cpp:60 +msgid "Text Color" +msgstr "æåè²" -#: libkita/datinfo.moc.cpp:34 libkita/datinfo.moc.cpp:42 -msgid "Kita::DatInfo" -msgstr "" +#. i18n: file: ../src/prefs/faceprefbase.ui:144 +#. i18n: ectx: property (text), widget (QLabel, threadColorLabel) +#: rc.cpp:75 +msgctxt "Thread foreground color" +msgid "Text Color" +msgstr "æåè²(&T)" -#: libkita/downloadmanager.moc.cpp:34 libkita/downloadmanager.moc.cpp:42 -msgid "Kita::DownloadManager" -msgstr "" +#. i18n: file: ../src/prefs/faceprefbase.ui:213 +#. i18n: ectx: property (text), widget (QLabel, popupColorLabel) +#: rc.cpp:90 +msgctxt "Popup foreground color" +msgid "Text Color" +msgstr "æåè²(&X)" -#: libkita/downloadmanager.moc.cpp:119 libkita/downloadmanager.moc.cpp:127 -msgid "Kita::FileLoader" +#: ../src/bbsview.cpp:184 ../src/bbsview.cpp:200 ../src/bbsview.cpp:260 +msgid "" +"These boards were moved:\n" +"\n" msgstr "" +"以ä¸ã®æ¿ã移åãã¾ãã:\n" +"\n" -#: libkita/imgmanager.cpp:343 -msgid "Do you want to delete the image ?" -msgstr "ç»åãåé¤ãã¾ããï¼" +#: ../src/threadview.cpp:388 +msgctxt "@info:status" +msgid "This thread is broken." +msgstr "ãã®ã¹ã¬ããã¯å£ãã¦ãã¾ãã" -#: libkita/imgmanager.cpp:402 -msgid "Do you want to replace the file?" -msgstr "ãã¡ã¤ã«ãç½®ãæãã¾ããï¼" +#: ../src/threadtabwidget.cpp:41 ../src/threadtabwidget.cpp:191 +msgctxt "@title:tab" +msgid "Thread" +msgstr "ã¹ã¬ãã" -#: libkita/imgmanager.moc.cpp:34 libkita/imgmanager.moc.cpp:42 -#, fuzzy -msgid "Kita::ImgManager" -msgstr "Kitaç»åãã¥ã¼ã¢" +#. i18n: file: ../src/threadtabwidgetui.rc:4 +#. i18n: ectx: Menu (thread) +#. i18n: file: ../src/kitaui.rc:11 +#. i18n: ectx: Menu (thread) +#: rc.cpp:3 rc.cpp:15 +msgid "Thread" +msgstr "ã¹ã¬ãã(&T)" -#: prefs/aboneprefbase.cpp:79 -msgid "NG word" -msgstr "NGã¯ã¼ã" +#. i18n: file: ../src/prefs/faceprefbase.ui:118 +#. i18n: ectx: property (title), widget (QGroupBox, threadGroupBox) +#. i18n: file: ../src/prefs/uiprefbase.ui:82 +#. i18n: ectx: property (title), widget (QGroupBox, threadGroupBox) +#: rc.cpp:66 rc.cpp:117 +msgctxt "@label:textbox" +msgid "Thread" +msgstr "ã¹ã¬ãã" -#: prefs/asciiartprefbase.cpp:56 -msgid "show AA (for KDE 3.1.x)" -msgstr "ã¢ã¹ãã¼ã¢ã¼ãã表示(KDE 3.1.xç¨)" +#. i18n: file: ../src/threadproperty.ui:77 +#. i18n: ectx: property (text), widget (QLabel, threadNameLabel0) +#. i18n: file: ../src/threadproperty.ui:217 +#. i18n: ectx: property (text), widget (QLabel, idx_threadNameWithIndexLabel0) +#: rc.cpp:195 rc.cpp:216 +msgctxt "@label:textbox" +msgid "Thread Name" +msgstr "ã¹ã¬ããå" -#: prefs/debugprefbase.cpp:84 prefs/prefs.cpp:192 prefs/prefs.cpp:197 -#: prefs/prefs.cpp:205 prefs/prefs.cpp:206 -msgid "replace" -msgstr "ç½®æ" +#. i18n: file: ../src/threadproperty.ui:17 +#. i18n: ectx: property (text), widget (QLabel, threadURLLabel0) +#: rc.cpp:186 +msgid "Thread URL" +msgstr "ã¹ã¬ããã® URL" -#: prefs/debugprefbase.cpp:85 prefs/debugprefbase.cpp:86 -msgid "http://" -msgstr "http://" +#. i18n: file: ../src/libkita/colorconfig.kcfg:13 +#. i18n: ectx: label, entry (ThreadBackground), group (Color) +#: rc.cpp:363 +msgid "Thread backgroupd color." +msgstr "ã¹ã¬ããã®èæ¯è²ã" -#: prefs/debugprefbase.cpp:87 -msgid "to:" -msgstr "ç½®æå :" +#. i18n: file: ../src/libkita/globalconfig.kcfg:12 +#. i18n: ectx: label, entry (ThreadFont), group (Global) +#: rc.cpp:291 +msgid "Thread font." +msgstr "ã¹ã¬ããã®ãã©ã³ãã" -#: prefs/debugprefbase.cpp:88 -msgid "from:" -msgstr "ç½®æå :" +#. i18n: file: ../src/libkita/colorconfig.kcfg:9 +#. i18n: ectx: label, entry (Thread), group (Color) +#: rc.cpp:360 +msgid "Thread foreground color." +msgstr "ã¹ã¬ããã®åæ¯è²ã" -#: prefs/faceprefbase.cpp:184 -msgid "Board/Subject List" -msgstr "æ¿/ã¹ã¬ä¸è¦§ã®ãªã¹ã" +#: ../src/threadlistheaderview.cpp:44 +msgctxt "@title:column" +msgid "Thread's speed" +msgstr "ã¹ã¬ããã®é度" -#: prefs/faceprefbase.cpp:185 prefs/faceprefbase.cpp:196 -#: prefs/faceprefbase.cpp:199 -msgid "set font" -msgstr "ãã©ã³ãã®è¨å®" +#. i18n: file: ../src/writedialogbase.ui:57 +#. i18n: ectx: property (text), widget (QLabel, textLabel1_2) +#: rc.cpp:246 +msgid "Thread:" +msgstr "ã¹ã¬ãã:" -#: prefs/faceprefbase.cpp:187 prefs/faceprefbase.cpp:193 -#: prefs/faceprefbase.cpp:200 -msgid "text color" -msgstr "æåè²" +#. i18n: file: ../src/libkita/globalconfig.kcfg:45 +#. i18n: ectx: label, entry (MarkTime), group (Global) +#: rc.cpp:321 +msgid "Time marked as newly arrived thread. (0 == after last access.)" +msgstr "" -#: prefs/faceprefbase.cpp:188 prefs/faceprefbase.cpp:195 -#: prefs/faceprefbase.cpp:201 -msgid "background color" -msgstr "èæ¯è²" +#: ../src/threadlistheaderview.cpp:32 +msgctxt "@title:column" +msgid "Title" +msgstr "ã¿ã¤ãã«" -#: prefs/faceprefbase.cpp:190 prefs/faceprefbase.cpp:197 -#: prefs/faceprefbase.cpp:202 -msgid "font" -msgstr "ãã©ã³ã" +#: ../src/main.cpp:40 +msgid "Toshihiko Okada" +msgstr "Toshihiko Okada" -#: prefs/faceprefbase.cpp:198 -msgid "Popup" -msgstr "ãããã¢ãã" +#. i18n: file: ../src/libkita/globalconfig.kcfg:72 +#. i18n: ectx: label, entry (BoardListUrl), group (Global) +#: rc.cpp:339 +msgid "URL of board list" +msgstr "æ¿ä¸è¦§ã® URL" -#: prefs/faceprefbase.cpp:205 -msgid "Basic" -msgstr "åºæ¬" +#: ../src/threadlistheaderview.cpp:40 +msgctxt "@title:column" +msgid "Unread" +msgstr "æªèª" -#: prefs/faceprefbase.cpp:206 -msgid "use stylesheet ( the setup of color/font is overwritten )." -msgstr "ã¹ã¿ã¤ã«ã·ã¼ãã使ç¨ãã(è²/ãã©ã³ãã®è¨å®ãä¸æ¸ããã¾ã)" +#: ../src/threadlistheaderview.cpp:40 +msgid "Unread" +msgstr "æªèª" -#: prefs/faceprefbase.cpp:208 -msgid "Advanced" -msgstr "æ¡å¼µ" +#. i18n: file: ../src/prefs/writeprefbase.ui:35 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_DefaultNameUseAlways) +#: rc.cpp:177 +msgid "Use always" +msgstr "常ã«ä½¿ç¨(&U)" -#: prefs/loginprefbase.cpp:109 +#. i18n: file: ../src/prefs/uiprefbase.ui:17 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_AlwaysUseTab) +#: rc.cpp:102 +msgid "Use new tab when opening the thread (board)." +msgstr "ã¹ã¬ï¼æ¿ï¼ãéãéã«æ°è¦ã¿ãã使ã(&U)" + +#. i18n: file: ../src/prefs/uiprefbase.ui:204 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_UsePart) +#: rc.cpp:150 +msgid "Use other Part to open external link" +msgstr "å¤é¨ãªã³ã¯ãéãããã«åãè¾¼ã¿ãã¥ã¼ã¢ã使ç¨(&P)" + +#. i18n: file: ../src/prefs/faceprefbase.ui:279 +#. i18n: ectx: property (text), widget (QCheckBox, useStyleSheetCheckBox) +#: rc.cpp:99 +msgid "Use stylesheet (the setup of color/font is overwritten)" +msgstr "ã¹ã¿ã¤ã«ã·ã¼ãã使ç¨ããï¼è²/ãã©ã³ãã®è¨å®ãä¸æ¸ããã¾ãï¼(&U)" + +#. i18n: file: ../src/prefs/loginprefbase.ui:23 +#. i18n: ectx: property (text), widget (QLabel, userIDLabel) +#: rc.cpp:159 msgid "User ID" -msgstr "ã¦ã¼ã¶ID" +msgstr "ã¦ã¼ã¶ ID(&U)" -#: prefs/loginprefbase.cpp:110 -msgid "Password" -msgstr "ãã¹ã¯ã¼ã" +#: ../src/prefs/preferences.cpp:52 +msgid "User Interface" +msgstr "ã¦ã¼ã¶ã¤ã³ã¿ã¼ãã§ã¼ã¹" -#: prefs/loginprefbase.cpp:111 -msgid "enables &auto login" -msgstr "èªåãã°ã¤ã³ãæå¹ã«ãã(&A)" +#: ../src/threadlistheaderview.cpp:38 +msgctxt "@title:column" +msgid "ViewPos" +msgstr "ViewPos" -#: prefs/loginprefbase.cpp:112 -msgid "Be mail address" -msgstr "Beã®ã¡ã¼ã«ã¢ãã¬ã¹" +#. i18n: file: ../src/threadproperty.ui:177 +#. i18n: ectx: property (text), widget (QLabel, viewPosLabel0) +#. i18n: file: ../src/threadproperty.ui:277 +#. i18n: ectx: property (text), widget (QLabel, idx_viewPosLabel0) +#: ../src/threadlistheaderview.cpp:38 rc.cpp:210 rc.cpp:225 +msgid "ViewPos" +msgstr "ViewPos" -#: prefs/loginprefbase.cpp:113 -msgid "Be auth code" -msgstr "Beã®èªè¨¼ã³ã¼ã" +#. i18n: file: ../src/prefs/uiprefbase.ui:166 +#. i18n: ectx: property (title), widget (QGroupBox, kcfg_ListSortOrder) +#: rc.cpp:138 +msgid "When open the board" +msgstr "æ¿ãéãã¨ã" -#: prefs/prefs.cpp:45 -msgid "Kita Preferences" -msgstr "Kitaã®ããªãã¡ã¬ã³ã¹" +#. i18n: file: ../src/libkita/globalconfig.kcfg:49 +#. i18n: ectx: label, entry (AboneChain), group (Global) +#: rc.cpp:324 +msgid "Whether abone responses recursively (secret config)." +msgstr "" -#: prefs/prefs.cpp:54 -msgid "Face" -msgstr "å¤è¦³" +#. i18n: file: ../src/libkita/globalconfig.kcfg:53 +#. i18n: ectx: label, entry (CheckResponsed), group (Global) +#: rc.cpp:327 +msgid "Whether check responsed responses or not (secret config)." +msgstr "" -#: prefs/prefs.cpp:60 -msgid "AsciiArt" -msgstr "ã¢ã¹ãã¼ã¢ã¼ã" +#. i18n: file: ../src/libkita/globalconfig.kcfg:56 +#. i18n: ectx: label, entry (CopyOnClick), group (Global) +#: rc.cpp:330 +msgid "Whether copy URL on click or not (secret config)." +msgstr "ã¯ãªãã¯æã« URL ãã³ãã¼ãããã©ããï¼é ãè¨å®ï¼ã" -#: prefs/prefs.cpp:63 -msgid "User Interface" -msgstr "ã¦ã¼ã¶ã¼ã¤ã³ã¿ã¼ãã§ã¼ã¹" +#. i18n: file: ../src/libkita/accountconfig.kcfg:18 +#. i18n: ectx: label, entry (AutoLogin), group (Account) +#: rc.cpp:282 +msgid "Whether login automatically or not." +msgstr "èªåçã«ãã°ã¤ã³ãããã©ããã" -#: prefs/prefs.cpp:193 -msgid "'To' URL must not contain 'From' URL." -msgstr "ç½®æå URLã¯ç½®æå URLãå«ãã§ã¯ããã¾ããã" +#. i18n: file: ../src/libkita/globalconfig.kcfg:18 +#. i18n: ectx: label, entry (ShowMailAddress), group (Global) +#: rc.cpp:297 +msgid "Whether show mail address or not." +msgstr "ã¡ã¼ã«ã¢ãã¬ã¹æ¬ã表示ãããã©ããã" -#: prefs/prefs.cpp:198 -msgid "" -"This tool may possibly break thread's info.\n" -"Please create backups of '~/.kde/share/apps/kita/cache'\n" -"and '~/.kde/share/apps/kita/favorites.xml' before performing.\n" -"Are you ready?" -msgstr "" -"ãã®ãã¼ã«ã¯ã¹ã¬ããã®æ å ±ãå£ãããããã¾ããã\n" -"å®è¡ããåã« ~/.kde/share/apps/kita/cache ã¨\n" -"~/.kde/share/apps/kita/favorites.xml ã®ããã¯ã¢ãããåã£ã¦ãã ããã\n" -"æºåã¯ããã§ãã?" +#. i18n: file: ../src/libkita/writeconfig.kcfg:19 +#. i18n: ectx: label, entry (DefaultSage), group (Write) +#: rc.cpp:357 +msgid "Whether use 'sage' as default or not." +msgstr "æ¨æºã§ 'sage' ã使ããã©ããã" -#: prefs/prefs.cpp:205 -msgid "Complete." -msgstr "å®äºã" +#. i18n: file: ../src/libkita/globalconfig.kcfg:41 +#. i18n: ectx: label, entry (UseStyleSheet), group (Global) +#: rc.cpp:318 +msgid "Whether use custom stylesheet or not." +msgstr "ã«ã¹ã¿ã ã¹ã¿ã¤ã«ã·ã¼ãã使ããã©ããã" -#: prefs/prefs.cpp:206 -msgid "Failed.." -msgstr "失æãã¾ããã" +#. i18n: file: ../src/libkita/writeconfig.kcfg:12 +#. i18n: ectx: label, entry (DefaultNameUseAlways), group (Write) +#: rc.cpp:351 +msgid "Whether use default name or not." +msgstr "æ¨æºã®ååã使ããã©ããã" -#: prefs/prefs.moc.cpp:34 prefs/prefs.moc.cpp:42 -#, fuzzy -msgid "KitaPreferences" -msgstr "Kitaã®ããªãã¡ã¬ã³ã¹" +#. i18n: file: ../src/libkita/globalconfig.kcfg:22 +#. i18n: ectx: label, entry (UsePart), group (Global) +#: rc.cpp:300 +msgid "Whether use embedded part or not." +msgstr "åã込㿠part ã使ããã©ããã" -#: prefs/prefs.moc.cpp:156 prefs/prefs.moc.cpp:164 -msgid "DebugPrefPage" -msgstr "" +#. i18n: file: ../src/libkita/globalconfig.kcfg:28 +#. i18n: ectx: label, entry (UseImagePopup), group (Global) +#: rc.cpp:306 +msgid "Whether use image popup or not." +msgstr "ç»åãããã¢ããã使ããã©ããã" -#: prefs/prefs.moc.cpp:238 prefs/prefs.moc.cpp:246 -msgid "Kita::AsciiArtPrefPage" -msgstr "" +#. i18n: file: ../src/libkita/globalconfig.kcfg:25 +#. i18n: ectx: label, entry (UseImageViewer), group (Global) +#: rc.cpp:303 +msgid "Whether use image viewer or not." +msgstr "ç»åãã¥ã¼ã¢ã使ããã©ããã" -#: prefs/prefs.moc.cpp:341 prefs/prefs.moc.cpp:349 -msgid "Kita::UIPrefPage" -msgstr "" +#. i18n: file: ../src/libkita/globalconfig.kcfg:34 +#. i18n: ectx: label, entry (UseKitaNavi), group (Global) +#: rc.cpp:312 +msgid "Whether use kitanavi or not." +msgstr "kitanavi ã使ããã©ããã" -#: prefs/prefs.moc.cpp:438 prefs/prefs.moc.cpp:446 -msgid "Kita::FacePrefPage" -msgstr "" +#. i18n: file: ../src/libkita/globalconfig.kcfg:31 +#. i18n: ectx: label, entry (UseMosaic), group (Global) +#: rc.cpp:309 +msgid "Whether use mosaic or not." +msgstr "ã¢ã¶ã¤ã¯ã使ããã©ããã" -#: prefs/uiprefbase.cpp:150 -msgid "Use new tab when opening the thread(board)." -msgstr "ã¹ã¬(æ¿)ãéãéã«æ°è¦ã¿ãã使ã" +#: ../src/prefs/preferences.cpp:72 +msgid "Write" +msgstr "æ¸ãè¾¼ã¿" -#: prefs/uiprefbase.cpp:151 -msgid "Mark new thread to made:" -msgstr "次ã®æé以å ã«ä½æãããã¹ã¬ããã¼ã¯:" +#: ../src/htmlpart.cpp:1065 +msgctxt "@action:inmenu" +msgid "Write Response" +msgstr "ã¬ã¹ãæ¸ã" -#: prefs/uiprefbase.cpp:152 -msgid "within " -msgstr " " +#. i18n: file: ../src/writedialogbase.ui:16 +#. i18n: ectx: property (windowTitle), widget (QWidget, WriteDialogBase) +#: rc.cpp:237 +msgid "Write in thread" +msgstr "ã¹ã¬ã«æ¸ãè¾¼ã¿" -#: prefs/uiprefbase.cpp:153 -msgid " hour" -msgstr "æé" +#. i18n: file: ../src/writedialogbase.ui:155 +#. i18n: ectx: property (text), widget (QLabel, lengthLabel) +#: rc.cpp:264 +msgid "XX/XX | XXXX/XXXX" +msgstr "XX/XX | XXXX/XXXX" -#: prefs/uiprefbase.cpp:154 +#. i18n: file: ../src/prefs/uiprefbase.ui:58 +#. i18n: ectx: property (specialValueText), widget (QSpinBox, kcfg_MarkTime) +#: rc.cpp:108 msgid "after last access" msgstr "æå¾ã®ã¢ã¯ã»ã¹ãã" -#: prefs/uiprefbase.cpp:157 -msgid "this option affects from the next thread." -msgstr "ãã®ãªãã·ã§ã³ã¯æ¬¡ã®ã¹ã¬ããããæå¹ã«ãªãã¾ãã" +#. i18n: file: ../src/prefs/uiprefbase.ui:115 +#. i18n: ectx: property (text), widget (QLabel, textLabel3_2) +#: rc.cpp:129 +msgid "around the last read response." +msgstr "ãæå¾ã«èªãã ã¬ã¹ã®åå¾ã«è¡¨ç¤º(&L)" -#: prefs/uiprefbase.cpp:158 -msgid "Show mail address in the thread." -msgstr "ã¡ã¼ã«ã¢ãã¬ã¹æ¬ã表示" +#. i18n: file: ../src/writedialogbase.ui:116 +#. i18n: ectx: property (text), widget (QCheckBox, beBox) +#: rc.cpp:258 +msgid "be" +msgstr "be" -#: prefs/uiprefbase.cpp:159 -msgid "Display " -msgstr " " +#: ../src/main.cpp:46 +msgid "board list's URL." +msgstr "æ¿ä¸è¦§ã® URL" -#: prefs/uiprefbase.cpp:160 -msgid " res" -msgstr "ã¬ã¹" +#. i18n: file: ../src/writedialogbase.ui:50 +#. i18n: ectx: property (text), widget (KSqueezedTextLabel, boardNameLabel) +#: rc.cpp:243 +msgid "board name" +msgstr "æ¿å" -#: prefs/uiprefbase.cpp:161 -msgid "Display all res" -msgstr "å ¨ã¦ã®ã¬ã¹" +#. i18n: file: ../src/writedialogbase.ui:126 +#. i18n: ectx: attribute (title), widget (KTextEdit, bodyText) +#: rc.cpp:261 +msgid "body" +msgstr "æ¬æ" -#: prefs/uiprefbase.cpp:162 -msgid "around the last read response." -msgstr "ãæå¾ã«èªãã ã¬ã¹ã®åå¾ã«è¡¨ç¤º" +#: ../src/htmlpart.cpp:1256 +msgctxt "@action:inmenu" +msgid "copy URL" +msgstr "URL ãã³ãã¼" -#: prefs/uiprefbase.cpp:163 -msgid "When open the board" -msgstr "æ¿ãéãã¨ã" +#: ../src/main.cpp:40 +msgid "improvements" +msgstr "ãã¾ãã¾ãªæ¹è¯" -#: prefs/uiprefbase.cpp:164 -msgid "Show unread thread first" -msgstr "æªèªã®ããã¹ã¬ãå ã«è¡¨ç¤º" +#: ../src/threadview.cpp:521 +msgid "kita" +msgstr "kita" -#: prefs/uiprefbase.cpp:165 -msgid "Show thread in numerical order" -msgstr "çªå·é ã«ã¹ã¬ã表示" +#: ../src/main.cpp:39 +msgid "kitanavi, threadview's improvement" +msgstr "kitanaviãã¹ã¬ãããã¥ã¼ã®æ¹è¯" -#: prefs/uiprefbase.cpp:166 -#, fuzzy -msgid "Parts" -msgstr "æå" +#: ../src/main.cpp:37 +msgid "konqueror plugin no hito" +msgstr "Konqueror ãã©ã°ã¤ã³ã®ã²ã¨" -#: prefs/uiprefbase.cpp:167 -msgid "Use other Part to open external link" -msgstr "å¤é¨ãªã³ã¯ãéãããã«åãè¾¼ã¿ãã¥ã¼ã¢ã使ç¨" +#: ../src/main.cpp:38 +msgid "konqueror plugin, KDE part" +msgstr "Konqueror ãã©ã°ã¤ã³ãKDE part" -#: prefs/uiprefbase.cpp:168 -msgid "If mime type include this list ( comma separated list )" -msgstr "以ä¸ã®ãªã¹ãã«å«ã¾ããMIMEã¿ã¤ãã対象(ã«ã³ãåºåã)" +#. i18n: file: ../src/writedialogbase.ui:96 +#. i18n: ectx: property (text), widget (QLabel, mailLabel) +#: rc.cpp:252 +msgid "mail" +msgstr "ã¡ã¼ã«" -#: prefs/uiprefbase.cpp:170 -msgid "Edit file association..." -msgstr "ãã¡ã¤ã«ã®é¢é£ä»ããç·¨é..." +#: ../src/main.cpp:35 +msgid "maintainer, initial code" +msgstr "ã¡ã³ãããåæã³ã¼ã" -#: prefs/writeprefbase.cpp:86 -msgid "Default Name" -msgstr "ããã©ã«ãã®åå" +#. i18n: file: ../src/writedialogbase.ui:83 +#. i18n: ectx: property (text), widget (QLabel, nameLabel) +#: rc.cpp:249 +msgctxt "@label:textbox The name used when posting" +msgid "name" +msgstr "åå" -#: prefs/writeprefbase.cpp:87 -msgid "use always" -msgstr "常ã«ä½¿ç¨" +#: ../src/bbsview.cpp:207 +msgid "no new boards" +msgstr "æ°ããæ¿ã¯ããã¾ãã" -#: prefs/writeprefbase.cpp:88 -msgid "Default Mail" -msgstr "ããã©ã«ãã®ã¡ã¼ã«ã¢ãã¬ã¹" +#: ../src/writetabwidget.cpp:161 +msgid "quote clipboard" +msgstr "å¼ç¨ãã¦ã³ãã¼" -#: prefs/writeprefbase.cpp:89 +#. i18n: file: ../src/writedialogbase.ui:109 +#. i18n: ectx: property (text), widget (QCheckBox, sageBox) +#: rc.cpp:255 +msgid "sage" +msgstr "sage" + +#. i18n: file: ../src/prefs/writeprefbase.ui:78 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_DefaultSage) +#: rc.cpp:183 msgid "sage checked" -msgstr "'sage'ã使ç¨" +msgstr "'&sage'ã使ç¨" -#: thread/htmlpart.cpp:1064 -msgid "Open with Image viewer" -msgstr "ç»åãã¥ã¼ã¢ã§éã" +#. i18n: file: ../src/prefs/faceprefbase.ui:46 +#. i18n: ectx: property (text), widget (QPushButton, listFontButton) +#. i18n: file: ../src/prefs/faceprefbase.ui:137 +#. i18n: ectx: property (text), widget (QPushButton, threadFontButton) +#. i18n: file: ../src/prefs/faceprefbase.ui:206 +#. i18n: ectx: property (text), widget (QPushButton, popupFontButton) +#: rc.cpp:57 rc.cpp:72 rc.cpp:87 +msgid "set font" +msgstr "ãã©ã³ãã®è¨å®" -#: thread/htmlpart.cpp:1113 thread/threadtabwidget.cpp:469 -msgid "Start" -msgstr "æå" +#: ../src/main.cpp:42 +msgid "stylesheet support" +msgstr "ã¹ã¿ã¤ã«ã·ã¼ãã®ãµãã¼ã" -#: thread/htmlpart.cpp:1119 -#, fuzzy -msgid "template" -msgstr "ç½®æ" +#. i18n: file: ../src/prefs/uiprefbase.ui:146 +#. i18n: ectx: property (text), widget (QLabel, textLabel1) +#: rc.cpp:132 +msgid "this option affects from the next thread." +msgstr "ãã®ãªãã·ã§ã³ã¯æ¬¡ã®ã¹ã¬ããããæå¹ã«ãªãã¾ãã" -#: thread/htmlpart.cpp:1123 -msgid "Kokomade Yonda (%1)" -msgstr "ããã¾ã§èªãã (%1)" +#. i18n: file: ../src/threadlistviewbase.ui:76 +#. i18n: ectx: property (toolTip), widget (QLabel, kindLabel) +#: rc.cpp:30 +msgid "unread/read/new threads" +msgstr "æªèª/æ¢èª/æ°è¦ã¹ã¬ãã" -#: thread/htmlpart.cpp:1130 thread/threadtabwidget.cpp:477 -msgid "End" -msgstr "æå¾" +#. i18n: file: ../src/prefs/uiprefbase.ui:64 +#. i18n: ectx: property (prefix), widget (QSpinBox, kcfg_MarkTime) +#: rc.cpp:114 +msgid "within " +msgstr " " -#: thread/htmlpart.cpp:1149 -msgid "Extract by '%1'" -msgstr "'%1'ã§æ½åº" +#~ msgid " Load Error" +#~ msgstr " èªã¿è¾¼ã¿ã¨ã©ã¼" -#: thread/htmlpart.cpp:1150 -msgid "Add '%1' to abone list" -msgstr "'%1'ããã¼ã¼ããªã¹ãã«è¿½å " +#~ msgid "&Toggle subject view and thread view" +#~ msgstr "ã¹ã¬ä¸è¦§ãã¥ã¼ã¨ã¹ã¬ãã表示ãã¥ã¼ãåæ¿ã(&T)" -#: thread/htmlpart.cpp:1151 -msgid "Search '%1' by Google" -msgstr "'%1'ãGoogleã§æ¤ç´¢" +#~ msgid "&Window" +#~ msgstr "ã¦ã£ã³ãã¦(&W)" -#: thread/htmlpart.cpp:1163 -msgid "Copy Link Location" -msgstr "ãªã³ã¯ã®å ´æãã³ãã¼" +#~ msgid "'To' URL must not contain 'From' URL." +#~ msgstr "ç½®æå URLã¯ç½®æå URLãå«ãã§ã¯ããã¾ããã" -#: thread/htmlpart.cpp:1215 thread/htmlpart.cpp:1652 thread/htmlpart.cpp:1716 -msgid "Do you want to add '%1' to abone list ?" -msgstr "'%1'ããã¼ã¼ããªã¹ãã«è¿½å ãã¾ããï¼" +#~ msgid "Body text is too long." +#~ msgstr "æ¬æãé·ããã¾ãã" -#: thread/htmlpart.cpp:1392 -msgid "Do you want to stop loading ?" -msgstr "èªã¿è¾¼ã¿ãåæ¢ãã¾ãã?" +#~ msgid "Bookmark" +#~ msgstr "ããã¯ãã¼ã¯" -#: thread/htmlpart.cpp:1530 -msgid "write response" -msgstr "ã¬ã¹ãæ¸ã" +#~ msgid "Can't write to machi BBS in this version." +#~ msgstr "ãã®ãã¼ã¸ã§ã³ã§ã¯ã¾ã¡BBSã«æ¸ãè¾¼ãã¾ããã" -#: thread/htmlpart.cpp:1531 -msgid "quote this" -msgstr "å¼ç¨ãã¦æ¸ãè¾¼ã" +#~ msgid "Cancel All mosaics" +#~ msgstr "å ¨ã¦ã®ã¢ã¶ã¤ã¯ãå¤ã" -#: thread/htmlpart.cpp:1542 -msgid "Open with KitaNavi" -msgstr "KitaNaviã§éã" +#~ msgid "Close Left Tabs" +#~ msgstr "å·¦ã®ã¿ããã¹ã¦ãéãã" -#: thread/htmlpart.cpp:1547 -msgid "res tree" -msgstr "ã¬ã¹ãããªã¼è¡¨ç¤º" +#~ msgid "Close Other Tabs" +#~ msgstr "ä»ã®ã¿ããéãã" -#: thread/htmlpart.cpp:1548 -msgid "reverse res tree" -msgstr "ã¬ã¹å ãããªã¼è¡¨ç¤º" +#~ msgid "Close Right Tabs" +#~ msgstr "å³ã®ã¿ããã¹ã¦ãéãã" -#: thread/htmlpart.cpp:1549 -msgid "extract by name" -msgstr "ååã§æ½åº" +#~ msgid "Close This Tab" +#~ msgstr "ãã®ã¿ããéãã(&C)" -#: thread/htmlpart.cpp:1555 -msgid "copy" -msgstr "ã³ãã¼" +#~ msgid "Close all error tabs" +#~ msgstr "å ¨ã¦ã®ã¨ã©ã¼ã¿ããéãã" -#: thread/htmlpart.cpp:1560 -msgid "set Kokomade Yonda" -msgstr "ãããã¾ã§èªãã ããã»ãã" +#~ msgid "Complete." +#~ msgstr "å®äºã" -#: thread/htmlpart.cpp:1565 -msgid "add name to abone list" -msgstr "ååããã¼ã¼ããªã¹ãã«è¿½å " +#~ msgid "Do you want to delete the image ?" +#~ msgstr "ç»åãåé¤ãã¾ããï¼" -#: thread/htmlpart.cpp:1703 -msgid "extract by ID" -msgstr "IDã§æ½åº" +#~ msgid "Do you want to replace the file?" +#~ msgstr "ãã¡ã¤ã«ãç½®ãæãã¾ããï¼" -#: thread/htmlpart.cpp:1704 -msgid "add id to abone list" -msgstr "IDããã¼ã¼ããªã¹ãã«è¿½å " +#~ msgid "Do you want to stop loading ?" +#~ msgstr "èªã¿è¾¼ã¿ãåæ¢ãã¾ãã?" -#: thread/htmlpart.cpp:2038 thread/htmlpart.cpp:2053 +#~ msgctxt "@action:intoolbar" +#~ msgid "End" +#~ msgstr "æå¾(&E)" + +#~ msgid "Enter the thread name." +#~ msgstr "ã¹ã¬åãå ¥ãã¦ãã ããã" + +#~ msgid "Extract by '%1'" +#~ msgstr "'%1'ã§æ½åº" + +#~ msgid "F&avorites" +#~ msgstr "ãæ°ã«å ¥ã(&A)" + +#~ msgid "Fit Image to Window" +#~ msgstr "ã¦ã£ã³ãã¦ã«ç»åãåããã" + +#~ msgid "Image" +#~ msgstr "ç»å" + #, fuzzy -msgid "None" -msgstr "ãã¼ã¼ã" +#~ msgid "Index" +#~ msgstr "ã¤ã³ããã¯ã¹ã®ãã¹" -#: thread/htmlpart.moc.cpp:34 thread/htmlpart.moc.cpp:42 -msgid "KitaHTMLPart" -msgstr "" +#~ msgid "Kita Image Viewer" +#~ msgstr "Kitaç»åãã¥ã¼ã¢" -#: thread/htmlpart.moc.cpp:522 thread/htmlpart.moc.cpp:530 -msgid "Kita::ResPopup" -msgstr "" +#~ msgid "Kita Preferences" +#~ msgstr "Kitaã®ããªãã¡ã¬ã³ã¹" -#: thread/threadtabwidget.cpp:461 thread/threadviewbase.cpp:120 -msgid "go back anchor" -msgstr "æ»ã" +#, fuzzy +#~ msgid "Kita::ImgManager" +#~ msgstr "Kitaç»åãã¥ã¼ã¢" -#: thread/threadtabwidget.moc.cpp:34 thread/threadtabwidget.moc.cpp:42 -msgid "KitaThreadTabWidget" -msgstr "" +#, fuzzy +#~ msgid "KitaBBSDock" +#~ msgstr "ã¹ã¬ãã" -#: thread/threadtabwidget.moc.cpp:200 thread/threadtabwidget.moc.cpp:208 -msgid "KitaThreadTabBar" -msgstr "" +#, fuzzy +#~ msgid "KitaBBSView" +#~ msgstr "Kitaç»åãã¥ã¼ã¢" -#: thread/threadtabwidget.moc.cpp:273 thread/threadtabwidget.moc.cpp:281 #, fuzzy -msgid "KitaThreadDock" -msgstr "ã¹ã¬ãã" +#~ msgid "KitaImgView" +#~ msgstr "Kitaç»åãã¥ã¼ã¢" -#: thread/threadview.cpp:284 -msgid "goback anchor" -msgstr "åã®ã¢ã³ã«ã¼ã¸æ»ã" +#, fuzzy +#~ msgid "KitaPreferences" +#~ msgstr "Kitaã®ããªãã¡ã¬ã³ã¹" -#: thread/threadview.cpp:700 -msgid "kita" -msgstr "" +#, fuzzy +#~ msgid "KitaThreadDock" +#~ msgstr "ã¹ã¬ãã" -#: thread/threadview.cpp:700 -msgid "Not Found" -msgstr "è¦ã¤ããã¾ãã" +#, fuzzy +#~ msgid "KitaThreadView" +#~ msgstr "ã¹ã¬ãã" -#: thread/threadview.moc.cpp:34 thread/threadview.moc.cpp:42 #, fuzzy -msgid "KitaThreadView" -msgstr "ã¹ã¬ãã" +#~ msgid "KitaWriteView" +#~ msgstr "Kitaç»åãã¥ã¼ã¢" -#: thread/threadview.moc.cpp:627 thread/threadview.moc.cpp:635 -msgid "Kita::KitaSubjectLabel" -msgstr "" +#~ msgid "L&ogin" +#~ msgstr "ãã°ã¤ã³(&O)" -#: thread/threadviewbase.cpp:114 -msgid "write" -msgstr "æ¸ãè¾¼ã¿" +#~ msgid "New Thread" +#~ msgstr "æ°è¦ã¹ã¬ãã" -#: thread/threadviewbase.cpp:117 -msgid "HighLight" -msgstr "" +#~ msgid "Open Thread" +#~ msgstr "ã¹ã¬ãããéã" -#: thread/threadviewbase.cpp:118 -msgid "highlight search words" -msgstr "æ¤ç´¢åèªããã¤ã©ã¤ã" +#~ msgid "Open With Web Browser" +#~ msgstr "ã¦ã§ããã©ã¦ã¶ã§éã" -#: thread/threadviewbase.cpp:119 -msgid "Goback" -msgstr "" +#~ msgid "Open by background" +#~ msgstr "ããã¯ã°ã©ã¦ã³ãã§éã" -#: thread/threadviewbase.cpp:121 -msgid "Bookmark" -msgstr "ããã¯ãã¼ã¯" +#~ msgid "Open with Image viewer" +#~ msgstr "ç»åãã¥ã¼ã¢ã§éã" -#: thread/threadviewbase.cpp:123 -msgid "add to bookmark" -msgstr "ããã¯ãã¼ã¯ã«è¿½å " +#~ msgid "Open with KitaNavi" +#~ msgstr "KitaNaviã§éã" -#: thread/threadviewbase.cpp:125 -msgid "reload thread" -msgstr "ã¹ã¬ãåèªã¿è¾¼ã¿" +#~ msgid "Open with New Tab" +#~ msgstr "æ°ããã¿ãã§éã" -#: thread/threadviewbase.cpp:126 -msgid "Del" -msgstr "" +#~ msgid "Open with Web Browser" +#~ msgstr "ã¦ã§ããã©ã¦ã¶ã§éã" -#: thread/threadviewbase.cpp:127 -msgid "delete log" -msgstr "ãã°ã®åé¤" +#~ msgid "Open with new tab" +#~ msgstr "æ°ããã¿ãã§éã" -#: write/writedialogbase.cpp:124 -msgid "Write in thread" -msgstr "ã¹ã¬ã«æ¸ãè¾¼ã¿" +#~ msgid "Original Size" +#~ msgstr "å ã®ãµã¤ãºã«æ»ã" -#: write/writedialogbase.cpp:125 -msgid "Board:" -msgstr "æ¿:" +#, fuzzy +#~ msgctxt "Reload the board" +#~ msgid "Reload" +#~ msgstr "åå¾" -#: write/writedialogbase.cpp:127 -msgid "Thread:" -msgstr "ã¹ã¬ãã:" +#~ msgid "Search" +#~ msgstr "æ¤ç´¢" -#: write/writedialogbase.cpp:128 -msgid "name" -msgstr "åå" +#~ msgid "Search '%1' by Google" +#~ msgstr "'%1'ãGoogleã§æ¤ç´¢" -#: write/writedialogbase.cpp:129 -msgid "mail" -msgstr "ã¡ã¼ã«" +#~ msgid "Show Image Viewer" +#~ msgstr "ç»åãã¥ã¼ã¢ã表示" -#: write/writedialogbase.cpp:130 -msgid "&sage" -msgstr "&sage" +#~ msgid "Show KitaNavi" +#~ msgstr "KitaNaviã表示" -#: write/writedialogbase.cpp:131 -msgid "Alt+S" -msgstr "" +#~ msgid "Show Title Image" +#~ msgstr "ã¿ã¤ãã«ã®ç»åã表示" -#: write/writedialogbase.cpp:132 -msgid "&be" -msgstr "&be" +#~ msgid "Show Write Dock" +#~ msgstr "æ¸ãè¾¼ã¿ããã¯ã表示" -#: write/writedialogbase.cpp:133 -msgid "Alt+B" -msgstr "" +#~ msgid "Show subject list" +#~ msgstr "ã¹ã¬ä¸è¦§ã®è¡¨ç¤º" -#: write/writedialogbase.cpp:134 -msgid "body" -msgstr "æ¬æ" +#~ msgid "Size" +#~ msgstr "ãµã¤ãº" -#: write/writedialogbase.cpp:135 -msgid "XX/XX | XXXX/XXXX" -msgstr "" +#~ msgid "Switch to Board" +#~ msgstr "æ¿ä¸è¦§ã«åãæ¿ã" -#: write/writetabwidget.cpp:69 -msgid "Can't write to machi BBS in this version." -msgstr "ãã®ãã¼ã¸ã§ã³ã§ã¯ã¾ã¡BBSã«æ¸ãè¾¼ãã¾ããã" +#~ msgid "Switch to Imgviewer" +#~ msgstr "ç»åãã¥ã¼ã¢ã«åãæ¿ã" -#: write/writetabwidget.cpp:80 -msgid "Do you want to clear the text?" -msgstr "ããã¹ããåé¤ãã¾ããï¼" +#~ msgid "Switch to KitaNavi" +#~ msgstr "KitaNaviã«åãæ¿ã" -#: write/writetabwidget.cpp:203 write/writeview.cpp:320 -msgid "" -"If you close this dialog, you will lose text.\n" -"Do you want to close?" -msgstr "" -"ãã®ãã¤ã¢ãã°ãéããã¨ãããã¹ããç ´æ£ããã¾ãã\n" -"éãã¦ãããã§ããï¼" +#~ msgid "Switch to Subject" +#~ msgstr "ã¹ã¬ä¸è¦§ã«åãæ¿ã" -#: write/writetabwidget.cpp:224 -msgid "quote clipboard" -msgstr "å¼ç¨ãã¦ã³ãã¼" +#~ msgid "Switch to Thread" +#~ msgstr "ã¹ã¬ã«åãæ¿ã" -#: write/writetabwidget.moc.cpp:34 write/writetabwidget.moc.cpp:42 -msgid "KitaWriteTabWidget" -msgstr "" +#~ msgid "Switch to writedock" +#~ msgstr "æ¸ãè¾¼ã¿ããã¯ã«åãæ¿ã" -#: write/writetabwidget.moc.cpp:143 write/writetabwidget.moc.cpp:151 -msgid "KitaWriteTabBar" -msgstr "" +#~ msgid "This is a BMP file. It might contain a Troy." +#~ msgstr "ããã¯BMPãã¡ã¤ã«ã§ããããã¤ã®æ¨é¦¬ãå ¥ã£ã¦ãå¯è½æ§ãããã¾ãã" -#: write/writetabwidget.moc.cpp:216 write/writetabwidget.moc.cpp:224 -msgid "KitaWriteDock" -msgstr "" +#~ msgid "" +#~ "This tool may possibly break thread's info.\n" +#~ "Please create backups of '~/.kde/share/apps/kita/cache'\n" +#~ "and '~/.kde/share/apps/kita/favorites.xml' before performing.\n" +#~ "Are you ready?" +#~ msgstr "" +#~ "ãã®ãã¼ã«ã¯ã¹ã¬ããã®æ å ±ãå£ãããããã¾ããã\n" +#~ "å®è¡ããåã« ~/.kde/share/apps/kita/cache ã¨\n" +#~ "~/.kde/share/apps/kita/favorites.xml ã®ããã¯ã¢ãããåã£ã¦ãã ããã\n" +#~ "æºåã¯ããã§ãã?" -#: write/writeview.cpp:138 -msgid "preview" -msgstr "ãã¬ãã¥ã¼" +#~ msgid "Zoom In" +#~ msgstr "ãºã¼ã ã¤ã³" -#: write/writeview.cpp:257 -msgid "Enter the thread name." -msgstr "ã¹ã¬åãå ¥ãã¦ãã ããã" +#~ msgid "Zoom Out" +#~ msgstr "ãºã¼ã ã¢ã¦ã" -#: write/writeview.cpp:264 -msgid "fusianasan." -msgstr "" +#~ msgid "" +#~ "_: EMAIL OF TRANSLATORS\n" +#~ "Your emails" +#~ msgstr "ikemo****@users*****" -#: write/writeview.cpp:269 -msgid "Body text is too long." -msgstr "æ¬æãé·ããã¾ãã" +#~ msgid "" +#~ "_: NAME OF TRANSLATORS\n" +#~ "Your names" +#~ msgstr "Hideki Ikemoto" -#: write/writeview.moc.cpp:34 write/writeview.moc.cpp:42 +#~ msgctxt "@action:inmenu" +#~ msgid "add name to abone list" +#~ msgstr "ååããã¼ã¼ãä¸è¦§ã«è¿½å " + +#~ msgid "be.2ch.net is currently not supported." +#~ msgstr "be.2ch.netã¯ç¾å¨ãµãã¼ãããã¦ãã¾ããã" + +#~ msgid "can't load %1." +#~ msgstr "%1ãèªã¿è¾¼ãã¾ããã" + +#~ msgid "can't start downloading. try again later." +#~ msgstr "ãã¦ã³ãã¼ããã¹ã¿ã¼ãã§ãã¾ãããå¾ã§å度å®è¡ãã¦ãã ããã" + +#~ msgid "copy" +#~ msgstr "ã³ãã¼" + +#~ msgid "default 1" +#~ msgstr "ããã©ã«ã1" + +#~ msgid "default 2" +#~ msgstr "ããã©ã«ã2" + +#~ msgid "default 3" +#~ msgstr "ããã©ã«ã3" + +#~ msgid "delete log" +#~ msgstr "ãã°ã®åé¤" + +#~ msgid "extract by ID" +#~ msgstr "IDã§æ½åº" + +#~ msgid "from:" +#~ msgstr "ç½®æå :" + +#~ msgid "goback anchor" +#~ msgstr "åã®ã¢ã³ã«ã¼ã¸æ»ã" + +#~ msgid "highlight search words" +#~ msgstr "æ¤ç´¢åèªããã¤ã©ã¤ã" + +#~ msgid "http://" +#~ msgstr "http://" + +#~ msgid "preview" +#~ msgstr "ãã¬ãã¥ã¼" + +#~ msgid "reload thread" +#~ msgstr "ã¹ã¬ãåèªã¿è¾¼ã¿" + +#~ msgid "replace" +#~ msgstr "ç½®æ" + +#~ msgid "reset windows" +#~ msgstr "ã¦ã£ã³ãã¦ããªã»ãã" + +#~ msgid "search word" +#~ msgstr "åèªãæ¤ç´¢" + +#~ msgid "show AA (for KDE 3.1.x)" +#~ msgstr "ã¢ã¹ãã¼ã¢ã¼ãã表示(KDE 3.1.xç¨)" + #, fuzzy -msgid "KitaWriteView" -msgstr "Kitaç»åãã¥ã¼ã¢" +#~ msgid "template" +#~ msgstr "ç½®æ" +#~ msgid "thread" +#~ msgstr "ã¹ã¬ãã" + +#~ msgid "to:" +#~ msgstr "ç½®æå :" + +#~ msgid "write" +#~ msgstr "æ¸ãè¾¼ã¿" Modified: kita/trunk/kita/po/kita.pot =================================================================== --- kita/trunk/kita/po/kita.pot 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/po/kita.pot 2010-02-10 10:04:00 UTC (rev 2559) @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-05-05 12:03+0900\n" +"POT-Creation-Date: 2009-08-09 20:26+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL @ ADDRESS>\n" "Language-Team: LANGUAGE <LL****@li*****>\n" @@ -16,1259 +16,1295 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: _translatorinfo.cpp:1 -msgid "" -"_: NAME OF TRANSLATORS\n" -"Your names" +#: ../src/mainwindow.cpp:182 +msgctxt "@info:status" +msgid "Login succeeded." msgstr "" -#: _translatorinfo.cpp:3 -msgid "" -"_: EMAIL OF TRANSLATORS\n" -"Your emails" +#: ../src/mainwindow.cpp:184 +msgctxt "@info:status" +msgid "Login failed." msgstr "" -#: favoriteswindowbase.cpp:63 favoriteswindowbase.cpp:166 rc.cpp:24 -#: prefs/aboneprefbase.cpp:80 -#, no-c-format -msgid "Name" +#: ../src/mainwindow.cpp:297 +msgctxt "@action:inmenu" +msgid "Show Toolbar" msgstr "" -#: favoriteswindowbase.cpp:160 rc.cpp:12 bbs/bbsview.cpp:454 -#, no-c-format -msgid "Favorites" +#: ../src/mainwindow.cpp:309 +msgctxt "@action:intoolbar" +msgid "Location Bar" msgstr "" -#: favoriteswindowbase.cpp:161 rc.cpp:14 -#, no-c-format -msgid "move" +#: ../src/mainwindow.cpp:322 +msgctxt "@action:inmenu" +msgid "Load Board List" msgstr "" -#: favoriteswindowbase.cpp:162 favoriteswindowbase.cpp:163 -#: favoriteswindowbase.cpp:164 favoriteswindowbase.cpp:165 rc.cpp:16 rc.cpp:18 -#: rc.cpp:20 rc.cpp:22 -#, no-c-format -msgid "..." +#: ../src/mainwindow.cpp:327 +msgctxt "@action:inmenu Login menu" +msgid "Login" msgstr "" -#: favoriteswindowbase.cpp:167 rc.cpp:28 -#, no-c-format -msgid "New" +#: ../src/htmlpart.cpp:723 +msgctxt "@title:menu Go back to the responses" +msgid "Back" msgstr "" -#: favoriteswindowbase.cpp:168 rc.cpp:30 -#, no-c-format -msgid "&New" +#: ../src/htmlpart.cpp:734 +msgctxt "@title:menu" +msgid "Mark" msgstr "" -#: favoriteswindowbase.cpp:169 rc.cpp:32 -#, no-c-format -msgid "Ctrl+N" +#: ../src/htmlpart.cpp:747 +msgctxt "@action:inmenu Go to the original post" +msgid "Start" msgstr "" -#: favoriteswindowbase.cpp:172 rc.cpp:38 -#, no-c-format -msgid "Ctrl+O" +#: ../src/htmlpart.cpp:754 +#, kde-format +msgctxt "@action:inmenu" +msgid "Kokomade Yonda (%1)" msgstr "" -#: favoriteswindowbase.cpp:175 rc.cpp:44 -#, no-c-format -msgid "Ctrl+S" +#: ../src/htmlpart.cpp:760 ../src/threadtabwidget.cpp:233 +msgctxt "@action:inmenu" +msgid "End" msgstr "" -#: favoriteswindowbase.cpp:177 rc.cpp:48 -#, no-c-format -msgid "Save &As..." +#: ../src/htmlpart.cpp:771 ../src/htmlpart.cpp:1113 +msgctxt "@action:inmenu" +msgid "Copy" msgstr "" -#: favoriteswindowbase.cpp:179 rc.cpp:51 -#, no-c-format -msgid "Exit" +#: ../src/htmlpart.cpp:782 +#, kde-format +msgctxt "@action:inmenu" +msgid "Add '%1' to abone list" msgstr "" -#: favoriteswindowbase.cpp:184 rc.cpp:60 -#, no-c-format -msgid "Ctrl+Z" +#: ../src/htmlpart.cpp:795 ../src/htmlpart.cpp:1084 ../src/htmlpart.cpp:1260 +#: ../src/bbsview.cpp:88 ../src/boardtabwidget.cpp:181 +#: ../src/threadlistview.cpp:71 +msgctxt "@action:inmenu" +msgid "Open with Web Browser" msgstr "" -#: favoriteswindowbase.cpp:187 rc.cpp:66 -#, no-c-format -msgid "Ctrl+Y" +#: ../src/htmlpart.cpp:800 +msgctxt "@action:inmenu" +msgid "Copy Link Location" msgstr "" -#: favoriteswindowbase.cpp:190 rc.cpp:72 -#, no-c-format -msgid "Ctrl+X" +#: ../src/htmlpart.cpp:831 ../src/htmlpart.cpp:1186 ../src/htmlpart.cpp:1230 +#, kde-format +msgid "Do you want to add '%1' to abone list?" msgstr "" -#: favoriteswindowbase.cpp:192 rc.cpp:76 -#, no-c-format -msgid "C&opy" +#: ../src/htmlpart.cpp:1065 +msgctxt "@action:inmenu" +msgid "Write Response" msgstr "" -#: favoriteswindowbase.cpp:193 rc.cpp:78 -#, no-c-format -msgid "Ctrl+C" +#: ../src/htmlpart.cpp:1068 +msgctxt "@action:inmenu" +msgid "Quote This" msgstr "" -#: favoriteswindowbase.cpp:196 rc.cpp:84 -#, no-c-format -msgid "Ctrl+V" +#: ../src/htmlpart.cpp:1075 +msgctxt "@action:inmenu" +msgid "Mark" msgstr "" -#: favoriteswindowbase.cpp:197 rc.cpp:86 board/boardtabwidget.cpp:125 -#: thread/threadtabwidget.cpp:443 -#, no-c-format -msgid "Find" +#: ../src/htmlpart.cpp:1091 +msgctxt "@action:inmenu" +msgid "Res Tree" msgstr "" -#: favoriteswindowbase.cpp:199 rc.cpp:90 -#, no-c-format -msgid "Ctrl+F" +#: ../src/htmlpart.cpp:1095 +msgctxt "@action:inmenu" +msgid "Reverse Res Tree" msgstr "" -#: favoriteswindowbase.cpp:201 rc.cpp:94 -#, no-c-format -msgid "&Contents..." +#: ../src/htmlpart.cpp:1099 +msgctxt "@action:inmenu" +msgid "Extract by Name" msgstr "" -#: favoriteswindowbase.cpp:203 rc.cpp:97 -#, no-c-format -msgid "Index" +#: ../src/htmlpart.cpp:1106 ../src/bbsview.cpp:89 ../src/threadlistview.cpp:72 +msgctxt "@action:inmenu" +msgid "Copy URL" msgstr "" -#: favoriteswindowbase.cpp:204 rc.cpp:99 -#, no-c-format -msgid "&Index..." +#: ../src/htmlpart.cpp:1110 ../src/boardtabwidget.cpp:183 +msgctxt "@action:inmenu" +msgid "Copy Title and URL" msgstr "" -#: favoriteswindowbase.cpp:209 favoriteswindowbase.cpp:210 rc.cpp:107 -#, no-c-format -msgid "New Directory" +#: ../src/htmlpart.cpp:1122 +msgctxt "@action:inmenu" +msgid "Set Kokomade Yonda" msgstr "" -#: favoriteswindowbase.cpp:211 rc.cpp:26 -#, no-c-format -msgid "Tools" +#: ../src/htmlpart.cpp:1130 +msgctxt "@action:inmenu" +msgid "Add Name to Abone List" msgstr "" -#: main.cpp:24 -msgid "Kita - 2ch client for KDE" +#: ../src/htmlpart.cpp:1220 +msgctxt "@action:inmenu" +msgid "Add Id to Abone List" msgstr "" -#: main.cpp:30 -msgid "Document to open." +#: ../src/htmlpart.cpp:1256 +msgctxt "@action:inmenu" +msgid "copy URL" msgstr "" -#: main.cpp:31 -msgid "board list's URL." +#: ../src/htmlpart.cpp:1490 +msgctxt "@label:textbox This is the first reply" +msgid "None" msgstr "" -#: main.cpp:37 -msgid "Kita" +#: ../src/htmlpart.cpp:1510 +msgctxt "@label:textbox There is no reply" +msgid "None" msgstr "" -#: main.cpp:39 -msgid "maintainer, initial code" -msgstr "" - -#: main.cpp:40 -msgid "konqueror plugin, KDE part" -msgstr "" - -#: main.cpp:41 -msgid "kitanavi, threadview's improvement" -msgstr "" - -#: main.cpp:42 -msgid "improvements" -msgstr "" - -#: main.cpp:43 -msgid "stylesheet support" -msgstr "" - -#: mainwindow.cpp:296 -msgid "Show board list" -msgstr "" - -#: mainwindow.cpp:303 -msgid "Show subject list" -msgstr "" - -#: mainwindow.cpp:310 -msgid "Show Image Viewer" -msgstr "" - -#: mainwindow.cpp:317 -msgid "Show KitaNavi" -msgstr "" - -#: mainwindow.cpp:324 -msgid "Show Write Dock" -msgstr "" - -#: mainwindow.cpp:334 -msgid "URL Line" -msgstr "" - -#: mainwindow.cpp:351 -msgid "Load board list" -msgstr "" - -#: mainwindow.cpp:358 -msgid "reset windows" -msgstr "" - -#: mainwindow.cpp:365 -msgid "default 1" -msgstr "" - -#: mainwindow.cpp:372 -msgid "default 2" -msgstr "" - -#: mainwindow.cpp:379 -msgid "default 3" -msgstr "" - -#: mainwindow.cpp:387 -msgid "&Toggle subject view and thread view" -msgstr "" - -#: mainwindow.cpp:394 prefs/prefs.cpp:69 -msgid "Login" -msgstr "" - -#: mainwindow.cpp:700 -msgid "subject" -msgstr "" - -#: mainwindow.cpp:705 -msgid "board" -msgstr "" - -#: mainwindow.cpp:710 prefs/faceprefbase.cpp:191 prefs/uiprefbase.cpp:156 +#: ../src/threadtabwidget.cpp:41 ../src/threadtabwidget.cpp:191 +msgctxt "@title:tab" msgid "Thread" msgstr "" -#: mainwindow.cpp:715 -msgid "KitaNavi" +#: ../src/threadtabwidget.cpp:218 +msgctxt "@action:inmenu" +msgid "Go Back Anchor" msgstr "" -#: mainwindow.cpp:715 -msgid "Navi" +#: ../src/threadtabwidget.cpp:225 +msgctxt "@action:inmenu" +msgid "Start" msgstr "" -#: mainwindow.cpp:723 -msgid "Kita Image Viewer" +#: ../src/threadtabwidget.cpp:240 +msgctxt "@action:button" +msgid "Reload" msgstr "" -#: mainwindow.cpp:723 -msgid "Image" +#: ../src/threadtabwidget.cpp:246 +msgctxt "@action:inmenu" +msgid "Stop" msgstr "" -#: mainwindow.cpp:728 prefs/prefs.cpp:72 -msgid "Write" +#: ../src/threadtabwidget.cpp:252 +msgctxt "@action:button" +msgid "Delete" msgstr "" -#: mainwindow.cpp:798 -msgid "be.2ch.net is currently not supported." +#: ../src/writetabwidget.cpp:62 +msgid "Do you want to clear the text?" msgstr "" -#: mainwindow.cpp:848 thread/htmlpart.cpp:1374 -msgid "This is a BMP file. It might contain a Troy." +#: ../src/writetabwidget.cpp:145 ../src/writeview.cpp:257 +msgid "" +"If you close this dialog, you will lose text.\n" +"Do you want to close?" msgstr "" -#: mainwindow.cpp:1210 -msgid "Login succeeded." +#: ../src/writetabwidget.cpp:161 +msgid "quote clipboard" msgstr "" -#: mainwindow.cpp:1212 -msgid "Login failed." +#: ../src/bbsview.cpp:77 +msgctxt "@title:column" +msgid "Board Name" msgstr "" -#: rc.cpp:4 -#, no-c-format -msgid "&Board" +#: ../src/bbsview.cpp:91 ../src/threadlistview.cpp:74 +msgctxt "@action:inmenu" +msgid "Copy title and URL" msgstr "" -#: rc.cpp:6 -#, no-c-format -msgid "&Thread" +#: ../src/bbsview.cpp:93 ../src/threadlistview.cpp:203 +msgctxt "@action:inmenu" +msgid "Remove from Favorites" msgstr "" -#: rc.cpp:8 -#, no-c-format -msgid "F&avorites" +#: ../src/bbsview.cpp:95 ../src/threadlistview.cpp:204 +msgctxt "@action:inmenu" +msgid "Add to Favorites" msgstr "" -#: rc.cpp:10 -#, no-c-format -msgid "&Window" -msgstr "" - -#: bbs/bbstabwidget.cpp:24 bbs/bbsview.cpp:62 write/writedialogbase.cpp:126 -msgid "board name" -msgstr "" - -#: bbs/bbstabwidget.moc.cpp:34 bbs/bbstabwidget.moc.cpp:42 -msgid "KitaBBSTabWidget" -msgstr "" - -#: bbs/bbstabwidget.moc.cpp:128 bbs/bbstabwidget.moc.cpp:136 -msgid "KitaBBSDock" -msgstr "" - -#: bbs/bbsview.cpp:200 bbs/bbsview.cpp:227 bbs/bbsview.cpp:290 +#: ../src/bbsview.cpp:175 ../src/bbsview.cpp:199 ../src/bbsview.cpp:259 msgid "" "New boards:\n" "\n" msgstr "" -#: bbs/bbsview.cpp:209 bbs/bbsview.cpp:228 bbs/bbsview.cpp:291 +#: ../src/bbsview.cpp:184 ../src/bbsview.cpp:200 ../src/bbsview.cpp:260 msgid "" "These boards were moved:\n" "\n" msgstr "" -#: bbs/bbsview.cpp:210 +#: ../src/bbsview.cpp:185 msgid "" "\n" "Please create the backup of those caches.\n" msgstr "" -#: bbs/bbsview.cpp:217 +#: ../src/bbsview.cpp:193 msgid "Do you really want to update board list?" msgstr "" -#: bbs/bbsview.cpp:236 +#: ../src/bbsview.cpp:195 +msgctxt "@action:button" +msgid "Copy" +msgstr "" + +#: ../src/bbsview.cpp:207 msgid "no new boards" msgstr "" -#: bbs/bbsview.cpp:367 +#: ../src/bbsview.cpp:323 +msgctxt "@item:inlistbox" msgid "Kita Board" msgstr "" -#: bbs/bbsview.cpp:523 board/boardtabwidget.cpp:257 board/boardview.cpp:375 -#: board/favoritelistview.cpp:135 image/imagetabwidget.cpp:296 -#: image/imagetabwidget.cpp:637 thread/htmlpart.cpp:1161 -#: thread/htmlpart.cpp:1543 thread/htmlpart.cpp:1755 -#: thread/threadtabwidget.cpp:422 thread/threadtabwidget.cpp:704 -msgid "Open with Web Browser" +#: ../src/bbsview.cpp:412 +msgctxt "@item:inlistbox" +msgid "Favorites" msgstr "" -#: bbs/bbsview.cpp:525 -msgid "Open with New Tab" +#: ../src/boardtabwidget.cpp:38 +msgctxt "@title:tab Favorite boards" +msgid "Favorite" msgstr "" -#: bbs/bbsview.cpp:526 board/boardview.cpp:377 board/favoritelistview.cpp:137 -#: thread/threadtabwidget.cpp:705 -msgid "Copy URL" +#: ../src/boardtabwidget.cpp:122 +msgid "Find" msgstr "" -#: bbs/bbsview.cpp:527 board/boardtabwidget.cpp:258 board/boardview.cpp:378 -#: board/favoritelistview.cpp:138 thread/htmlpart.cpp:1554 -#: thread/threadtabwidget.cpp:436 thread/threadtabwidget.cpp:706 -#: thread/threadview.cpp:405 -msgid "Copy title and URL" +#: ../src/boardtabwidget.cpp:128 +msgctxt "@action:button Reload the subject view" +msgid "Reload" msgstr "" -#: bbs/bbsview.cpp:529 board/boardview.cpp:380 board/favoritelistview.cpp:139 -#: thread/threadview.cpp:407 -msgid "Remove from Favorites" +#: ../src/boardtabwidget.cpp:133 +msgid "Show Old Logs" msgstr "" -#: bbs/bbsview.cpp:531 board/boardview.cpp:382 thread/threadview.cpp:407 -msgid "Add to Favorites" +#: ../src/boardtabwidget.cpp:171 ../src/kitaui/tabwidgetbase.cpp:158 +msgctxt "@action:inmenu" +msgid "Close This Tab" msgstr "" -#: bbs/bbsview.moc.cpp:34 bbs/bbsview.moc.cpp:42 -msgid "KitaBBSView" +#: ../src/boardtabwidget.cpp:173 ../src/kitaui/tabwidgetbase.cpp:166 +msgctxt "@action:inmenu" +msgid "Close Other Tabs" msgstr "" -#: bbs/bbsviewbase.cpp:57 board/threadproperty.cpp:132 -#: prefs/aboneprefbase.cpp:77 prefs/asciiartprefbase.cpp:55 -#: prefs/faceprefbase.cpp:183 prefs/loginprefbase.cpp:108 -#: prefs/uiprefbase.cpp:149 prefs/writeprefbase.cpp:85 -#: thread/threadviewbase.cpp:112 -msgid "Form1" +#: ../src/boardtabwidget.cpp:175 ../src/kitaui/tabwidgetbase.cpp:174 +msgctxt "@action:inmenu" +msgid "Close Right Tabs" msgstr "" -#: board/boardtabwidget.cpp:35 -msgid "Favorite" +#: ../src/boardtabwidget.cpp:177 ../src/kitaui/tabwidgetbase.cpp:180 +msgctxt "@action:inmenu" +msgid "Close Left Tabs" msgstr "" -#: board/boardtabwidget.cpp:141 write/writetabwidget.cpp:102 -msgid "New Thread" +#: ../src/boardtabwidget.cpp:179 +msgctxt "@action:inmenu" +msgid "Show Old Logs" msgstr "" -#: board/boardtabwidget.cpp:148 board/boardtabwidget.cpp:256 -msgid "Show Old Logs" +#: ../src/prefs/preferences.cpp:36 +msgid "Face" msgstr "" -#: board/boardtabwidget.cpp:155 board/boardtabwidget.cpp:259 -msgid "Show Title Image" +#: ../src/prefs/preferences.cpp:45 +msgid "AsciiArt" msgstr "" -#: board/boardtabwidget.cpp:245 image/imagetabwidget.cpp:617 -#: kitaui/tabwidgetbase.cpp:310 kitaui/tabwidgetbase.cpp:547 -#: thread/threadtabwidget.cpp:692 -msgid "Close this tab" +#: ../src/prefs/preferences.cpp:52 +msgid "User Interface" msgstr "" -#: board/boardtabwidget.cpp:250 image/imagetabwidget.cpp:622 -#: kitaui/tabwidgetbase.cpp:317 kitaui/tabwidgetbase.cpp:552 -#: thread/threadtabwidget.cpp:697 -msgid "Close Other Tabs" +#: ../src/prefs/preferences.cpp:58 ../src/libkita/datinfo.cpp:442 +#: ../src/libkita/datinfo.cpp:444 +msgid "Abone" msgstr "" -#: board/boardtabwidget.cpp:251 image/imagetabwidget.cpp:623 -#: kitaui/tabwidgetbase.cpp:324 kitaui/tabwidgetbase.cpp:553 -#: thread/threadtabwidget.cpp:698 -msgid "Close right tabs" +#: ../src/prefs/preferences.cpp:65 +msgid "Login" msgstr "" -#: board/boardtabwidget.cpp:252 image/imagetabwidget.cpp:624 -#: kitaui/tabwidgetbase.cpp:331 kitaui/tabwidgetbase.cpp:554 -#: thread/threadtabwidget.cpp:699 -msgid "Close left tabs" +#: ../src/prefs/preferences.cpp:72 +msgid "Write" msgstr "" -#: board/boardtabwidget.moc.cpp:34 board/boardtabwidget.moc.cpp:42 -msgid "KitaBoardTabWidget" +#: ../src/threadview.cpp:70 +msgctxt "@info:tooltip" +msgid "Add to bookmark" msgstr "" -#: board/boardtabwidget.moc.cpp:153 board/boardtabwidget.moc.cpp:161 -msgid "SubjectTabBar" +#: ../src/threadview.cpp:75 +msgctxt "@info:tooltip" +msgid "Reload" msgstr "" -#: board/boardtabwidget.moc.cpp:226 board/boardtabwidget.moc.cpp:234 -msgid "KitaBoardDock" +#: ../src/threadview.cpp:84 +msgctxt "@info:tooltip" +msgid "Delete" msgstr "" -#: board/boardview.cpp:376 board/favoritelistview.cpp:136 -#: thread/threadview.cpp:404 -msgid "Open with new tab" +#. i18n: file: ../src/threadlistviewbase.ui:111 +#. i18n: ectx: property (toolTip), widget (QToolButton, closeButton) +#: ../src/threadview.cpp:91 rc.cpp:33 +msgctxt "@info:tooltip" +msgid "Close tab" msgstr "" -#: board/boardview.cpp:387 -msgid "Delete Log" +#: ../src/threadview.cpp:388 +msgctxt "@info:status" +msgid "This thread is broken." msgstr "" -#: board/boardview.cpp:389 -msgid "Open by background" +#: ../src/threadview.cpp:521 +msgid "Not Found" msgstr "" -#: board/boardview.cpp:392 -msgid "Property" +#: ../src/threadview.cpp:521 +msgid "kita" msgstr "" -#: board/boardview.cpp:453 thread/threadview.cpp:734 -msgid "Do you want to delete Log ?" +#: ../src/threadview.cpp:555 ../src/boardview.cpp:316 +msgid "Do you want to delete Log?" msgstr "" -#: board/boardview.moc.cpp:34 board/boardview.moc.cpp:42 -msgid "KitaBoardView" +#: ../src/kitaui/tabwidgetbase.cpp:138 +msgctxt "@action:inmenu" +msgid "Configure Shortcuts..." msgstr "" -#: board/favoritelistview.moc.cpp:34 board/favoritelistview.moc.cpp:42 -msgid "FavoriteListView" +#: ../src/kitaui/tabwidgetbase.cpp:147 +msgctxt "@action:inmenu" +msgid "Activate Next Tab" msgstr "" -#: board/threadlistview.cpp:34 board/threadlistview.cpp:36 -msgid " " +#: ../src/kitaui/tabwidgetbase.cpp:153 +msgctxt "@action:inmenu" +msgid "Activate Previous Tab" msgstr "" -#: board/threadlistview.cpp:34 thread/htmlpart.cpp:1103 -#: thread/htmlpart.cpp:1537 +#: ../src/kitaui/tabwidgetbase.cpp:186 +msgctxt "@action:inmenu" +msgid "Close All Tabs" +msgstr "" + +#: ../src/threadlistheaderview.cpp:26 msgid "Mark" msgstr "" -#: board/threadlistview.cpp:35 +#: ../src/threadlistheaderview.cpp:28 +msgctxt "@title:column" msgid "No." msgstr "" -#: board/threadlistview.cpp:35 prefs/aboneprefbase.cpp:78 +#: ../src/threadlistheaderview.cpp:28 msgid "ID" msgstr "" -#: board/threadlistview.cpp:36 +#: ../src/threadlistheaderview.cpp:30 msgid "Icon" msgstr "" -#: board/threadlistview.cpp:37 +#: ../src/threadlistheaderview.cpp:32 +msgctxt "@title:column" msgid "Title" msgstr "" -#: board/threadlistview.cpp:37 +#: ../src/threadlistheaderview.cpp:32 msgid "Subject" msgstr "" -#: board/threadlistview.cpp:38 board/threadproperty.cpp:149 -#: board/threadproperty.cpp:153 +#: ../src/threadlistheaderview.cpp:34 +msgctxt "@title:column" msgid "ResNum" msgstr "" -#: board/threadlistview.cpp:39 board/threadproperty.cpp:151 -#: board/threadproperty.cpp:155 +#. i18n: file: ../src/threadproperty.ui:137 +#. i18n: ectx: property (text), widget (QLabel, resNumLabel0) +#. i18n: file: ../src/threadproperty.ui:237 +#. i18n: ectx: property (text), widget (QLabel, idx_resNumLabel0) +#. i18n: file: ../src/threadproperty.ui:317 +#. i18n: ectx: property (text), widget (QLabel, cache_resNumLabel0) +#: ../src/threadlistheaderview.cpp:34 rc.cpp:204 rc.cpp:219 rc.cpp:231 +msgid "ResNum" +msgstr "" + +#: ../src/threadlistheaderview.cpp:36 +msgctxt "@title:column" msgid "ReadNum" msgstr "" -#: board/threadlistview.cpp:40 board/threadproperty.cpp:146 +#. i18n: file: ../src/threadproperty.ui:157 +#. i18n: ectx: property (text), widget (QLabel, readNumLabel0) +#. i18n: file: ../src/threadproperty.ui:257 +#. i18n: ectx: property (text), widget (QLabel, idx_readNumLabel0) +#. i18n: file: ../src/threadproperty.ui:337 +#. i18n: ectx: property (text), widget (QLabel, cache_readNumLabel0) +#: ../src/threadlistheaderview.cpp:36 rc.cpp:207 rc.cpp:222 rc.cpp:234 +msgid "ReadNum" +msgstr "" + +#: ../src/threadlistheaderview.cpp:38 +msgctxt "@title:column" msgid "ViewPos" msgstr "" -#: board/threadlistview.cpp:41 +#. i18n: file: ../src/threadproperty.ui:177 +#. i18n: ectx: property (text), widget (QLabel, viewPosLabel0) +#. i18n: file: ../src/threadproperty.ui:277 +#. i18n: ectx: property (text), widget (QLabel, idx_viewPosLabel0) +#: ../src/threadlistheaderview.cpp:38 rc.cpp:210 rc.cpp:225 +msgid "ViewPos" +msgstr "" + +#: ../src/threadlistheaderview.cpp:40 +msgctxt "@title:column" msgid "Unread" msgstr "" -#: board/threadlistview.cpp:42 +#: ../src/threadlistheaderview.cpp:40 +msgid "Unread" +msgstr "" + +#: ../src/threadlistheaderview.cpp:42 +msgctxt "@title:column" msgid "Since" msgstr "" -#: board/threadlistview.cpp:43 +#: ../src/threadlistheaderview.cpp:42 +msgid "Since" +msgstr "" + +#: ../src/threadlistheaderview.cpp:44 +msgctxt "@title:column" msgid "Thread's speed" msgstr "" -#: board/threadlistview.cpp:43 +#: ../src/threadlistheaderview.cpp:45 msgid "Speed" msgstr "" -#: board/threadlistview.cpp:44 +#: ../src/threadlistheaderview.cpp:46 +msgctxt "@title:column" msgid "Board" msgstr "" -#: board/threadlistview.cpp:45 board/threadproperty.cpp:139 +#. i18n: file: ../src/boardtabwidgetui.rc:4 +#. i18n: ectx: Menu (board) +#. i18n: file: ../src/kitaui.rc:8 +#. i18n: ectx: Menu (board) +#: ../src/threadlistheaderview.cpp:46 rc.cpp:6 rc.cpp:12 +msgid "Board" +msgstr "" + +#: ../src/threadlistheaderview.cpp:48 +msgctxt "@title:column" msgid "Dat URL" msgstr "" -#: board/threadlistview.cpp:45 +#: ../src/threadlistheaderview.cpp:48 msgid "DatURL" msgstr "" -#: board/threadlistview.cpp:46 +#: ../src/threadlistheaderview.cpp:50 +msgctxt "@title:column" msgid "Mark Order" msgstr "" -#: board/threadlistview.cpp:46 +#: ../src/threadlistheaderview.cpp:50 msgid "MarkOrder" msgstr "" -#: board/threadlistview.cpp:47 +#: ../src/threadlistheaderview.cpp:52 +msgctxt "@title:column" msgid "ID Order" msgstr "" -#: board/threadlistview.cpp:47 +#: ../src/threadlistheaderview.cpp:52 msgid "IDOrder" msgstr "" -#: board/threadlistviewbase.cpp:89 prefs/debugprefbase.cpp:83 -msgid "Form2" +#: ../src/threadlistheaderview.cpp:61 +msgctxt "@action:inmenu" +msgid "Auto Resize" msgstr "" -#: board/threadlistviewbase.cpp:90 thread/threadviewbase.cpp:115 -msgid "Search" +#: ../src/bbstabwidget.cpp:22 +msgctxt "@title:tab" +msgid "Board Name" msgstr "" -#: board/threadlistviewbase.cpp:91 thread/threadviewbase.cpp:116 -msgid "search word" +#: ../src/main.cpp:22 +msgid "Kita - 2ch client for KDE" msgstr "" -#: board/threadlistviewbase.cpp:92 -msgid "Hide" +#: ../src/main.cpp:32 +msgid "Kita" msgstr "" -#: board/threadlistviewbase.cpp:93 -msgid "filter thread" +#: ../src/main.cpp:33 +msgid "(C) 2003-2009 Kita Developers" msgstr "" -#: board/threadlistviewbase.cpp:95 -msgid "reload board" +#: ../src/main.cpp:35 +msgid "Hideki Ikemoto" msgstr "" -#: board/threadlistviewbase.cpp:96 -msgid "unread/read/new threads" +#: ../src/main.cpp:35 +msgid "maintainer, initial code" msgstr "" -#: board/threadlistviewbase.cpp:98 thread/threadviewbase.cpp:129 -msgid "close tab" +#: ../src/main.cpp:37 +msgid "konqueror plugin no hito" msgstr "" -#: board/threadproperty.cpp:133 -msgid "Thread URL" +#: ../src/main.cpp:38 +msgid "konqueror plugin, KDE part" msgstr "" -#: board/threadproperty.cpp:135 -msgid "Cache Path" +#: ../src/main.cpp:39 +msgid "421" msgstr "" -#: board/threadproperty.cpp:136 board/threadproperty.cpp:143 -msgid "Thread Name" +#: ../src/main.cpp:39 +msgid "kitanavi, threadview's improvement" msgstr "" -#: board/threadproperty.cpp:141 -msgid "Index Path" +#: ../src/main.cpp:40 +msgid "Toshihiko Okada" msgstr "" -#: board/threadproperty.cpp:147 -msgid "Index file's information" +#: ../src/main.cpp:40 +msgid "improvements" msgstr "" -#: board/threadproperty.cpp:148 -msgid "\"cache\" file's info (obsolete)" +#: ../src/main.cpp:42 +msgid "75" msgstr "" -#: image/imagetabwidget.cpp:92 -msgid "can't start downloading. try again later." +#: ../src/main.cpp:42 +msgid "stylesheet support" msgstr "" -#: image/imagetabwidget.cpp:247 image/imagetabwidget.cpp:631 -#: thread/htmlpart.cpp:1062 -msgid "Cancel mosaic" +#: ../src/main.cpp:45 +msgid "Document to open." msgstr "" -#: image/imagetabwidget.cpp:254 -msgid "Cancel All mosaics" +#: ../src/main.cpp:46 +msgid "board list's URL." msgstr "" -#: image/imagetabwidget.cpp:261 image/imagetabwidget.cpp:633 -msgid "Fit Image to Window" +#: ../src/libkita/datinfo.cpp:448 ../src/libkita/datinfo.cpp:449 +msgid "Broken" msgstr "" -#: image/imagetabwidget.cpp:268 image/imagetabwidget.cpp:634 -msgid "Original Size" +#: ../src/threadlistview.cpp:76 +msgctxt "@action:inmenu" +msgid "Delete Log" msgstr "" -#: image/imagetabwidget.cpp:275 -msgid "Zoom In" +#: ../src/threadlistview.cpp:78 +msgctxt "@action:inmenu" +msgid "Property" msgstr "" -#: image/imagetabwidget.cpp:282 -msgid "Zoom Out" +#. i18n: file: ../src/threadtabwidgetui.rc:4 +#. i18n: ectx: Menu (thread) +#. i18n: file: ../src/kitaui.rc:11 +#. i18n: ectx: Menu (thread) +#: rc.cpp:3 rc.cpp:15 +msgid "Thread" msgstr "" -#: image/imagetabwidget.cpp:289 image/imagetabwidget.cpp:639 -#: thread/htmlpart.cpp:1553 thread/htmlpart.cpp:1754 -#: thread/threadtabwidget.cpp:429 -msgid "copy URL" +#. i18n: file: ../src/kitaui.rc:4 +#. i18n: ectx: Menu (file) +#: rc.cpp:9 +msgid "File" msgstr "" -#: image/imagetabwidget.cpp:317 -msgid "Close all error tabs" +#. i18n: file: ../src/threadlistviewbase.ui:44 +#. i18n: ectx: property (toolTip), widget (QToolButton, hideButton) +#: rc.cpp:18 +msgid "Filter thread" msgstr "" -#: image/imagetabwidget.cpp:331 image/imagetabwidget.cpp:638 -msgid "Open Thread" +#. i18n: file: ../src/threadlistviewbase.ui:47 +#. i18n: ectx: property (text), widget (QToolButton, hideButton) +#: rc.cpp:21 +msgid "Hide" msgstr "" -#: image/imagetabwidget.cpp:338 -msgid "Size" +#. i18n: file: ../src/threadlistviewbase.ui:57 +#. i18n: ectx: property (toolTip), widget (QToolButton, reloadButton) +#: rc.cpp:24 +msgid "Reload board" msgstr "" -#: image/imagetabwidget.moc.cpp:34 image/imagetabwidget.moc.cpp:42 -msgid "KitaImgTabWidget" +#. i18n: file: ../src/threadlistviewbase.ui:60 +#. i18n: ectx: property (text), widget (QToolButton, reloadButton) +#: rc.cpp:27 +msgctxt "@action:button Reload the board" +msgid "Reload" msgstr "" -#: image/imagetabwidget.moc.cpp:263 image/imagetabwidget.moc.cpp:271 -msgid "KitaImgTabBar" +#. i18n: file: ../src/threadlistviewbase.ui:76 +#. i18n: ectx: property (toolTip), widget (QLabel, kindLabel) +#: rc.cpp:30 +msgid "unread/read/new threads" msgstr "" -#: image/imagetabwidget.moc.cpp:336 image/imagetabwidget.moc.cpp:344 -msgid "KitaImgDock" +#. i18n: file: ../src/threadlistviewbase.ui:114 +#. i18n: ectx: property (text), widget (QToolButton, closeButton) +#: rc.cpp:36 +msgid "Close" msgstr "" -#: image/imageview.moc.cpp:34 image/imageview.moc.cpp:42 -msgid "KitaImgView" +#. i18n: file: ../src/prefs/aboneprefbase.ui:19 +#. i18n: ectx: property (text), widget (QLabel, idLabel) +#: rc.cpp:39 +msgctxt "@label:textbox Abone ID" +msgid "ID" msgstr "" -#: kitaui/htmlview.moc.cpp:34 kitaui/htmlview.moc.cpp:42 -msgid "KitaHTMLView" -msgstr "" - -#: kitaui/tabwidgetbase.cpp:151 -msgid " Load Error" -msgstr "" - -#: kitaui/tabwidgetbase.cpp:152 -msgid "can't load %1." -msgstr "" - -#: kitaui/tabwidgetbase.cpp:280 -msgid "Configure S&hortcuts..." -msgstr "" - -#: kitaui/tabwidgetbase.cpp:288 -msgid "Activate Next Tab" -msgstr "" - -#: kitaui/tabwidgetbase.cpp:299 -msgid "Activate Previous Tab" -msgstr "" - -#: kitaui/tabwidgetbase.cpp:338 -msgid "Close all tabs" -msgstr "" - -#: kitaui/tabwidgetbase.cpp:345 -msgid "Switch to Board" -msgstr "" - -#: kitaui/tabwidgetbase.cpp:352 -msgid "Switch to Subject" -msgstr "" - -#: kitaui/tabwidgetbase.cpp:359 -msgid "Switch to Thread" -msgstr "" - -#: kitaui/tabwidgetbase.cpp:366 -msgid "Switch to KitaNavi" -msgstr "" - -#: kitaui/tabwidgetbase.cpp:373 -msgid "Switch to Imgviewer" -msgstr "" - -#: kitaui/tabwidgetbase.cpp:380 -msgid "Switch to writedock" -msgstr "" - -#: kitaui/tabwidgetbase.moc.cpp:34 kitaui/tabwidgetbase.moc.cpp:42 -msgid "KitaTabWidgetBase" -msgstr "" - -#: kitaui/tabwidgetbase.moc.cpp:310 kitaui/tabwidgetbase.moc.cpp:318 -msgid "KitaTabBarBase" -msgstr "" - -#: kitaui/tabwidgetbase.moc.cpp:383 kitaui/tabwidgetbase.moc.cpp:391 -msgid "KitaDockWidgetBase" -msgstr "" - -#: libkita/datinfo.cpp:501 libkita/datinfo.cpp:503 prefs/prefs.cpp:66 -msgid "Abone" -msgstr "" - -#: libkita/datinfo.cpp:507 libkita/datinfo.cpp:508 -msgid "Broken" -msgstr "" - -#: libkita/datinfo.moc.cpp:34 libkita/datinfo.moc.cpp:42 -msgid "Kita::DatInfo" -msgstr "" - -#: libkita/downloadmanager.moc.cpp:34 libkita/downloadmanager.moc.cpp:42 -msgid "Kita::DownloadManager" -msgstr "" - -#: libkita/downloadmanager.moc.cpp:119 libkita/downloadmanager.moc.cpp:127 -msgid "Kita::FileLoader" -msgstr "" - -#: libkita/imgmanager.cpp:343 -msgid "Do you want to delete the image ?" -msgstr "" - -#: libkita/imgmanager.cpp:402 -msgid "Do you want to replace the file?" -msgstr "" - -#: libkita/imgmanager.moc.cpp:34 libkita/imgmanager.moc.cpp:42 -msgid "Kita::ImgManager" -msgstr "" - -#: prefs/aboneprefbase.cpp:79 +#. i18n: file: ../src/prefs/aboneprefbase.ui:39 +#. i18n: ectx: property (text), widget (QLabel, wordLabel) +#: rc.cpp:42 +msgctxt "@label:textbox Abone NG word" msgid "NG word" msgstr "" -#: prefs/asciiartprefbase.cpp:56 -msgid "show AA (for KDE 3.1.x)" +#. i18n: file: ../src/prefs/aboneprefbase.ui:59 +#. i18n: ectx: property (text), widget (QLabel, nameLabel) +#: rc.cpp:45 +msgctxt "@label:textbox Abone name" +msgid "Name" msgstr "" -#: prefs/debugprefbase.cpp:84 prefs/prefs.cpp:192 prefs/prefs.cpp:197 -#: prefs/prefs.cpp:205 prefs/prefs.cpp:206 -msgid "replace" +#. i18n: file: ../src/prefs/faceprefbase.ui:21 +#. i18n: ectx: attribute (title), widget (QWidget, tab) +#: rc.cpp:48 +msgctxt "Basic options" +msgid "Basic" msgstr "" -#: prefs/debugprefbase.cpp:85 prefs/debugprefbase.cpp:86 -msgid "http://" +#. i18n: file: ../src/prefs/faceprefbase.ui:27 +#. i18n: ectx: property (title), widget (QGroupBox, listGroupBox) +#: rc.cpp:51 +msgid "Board/Subject List" msgstr "" -#: prefs/debugprefbase.cpp:87 -msgid "to:" +#. i18n: file: ../src/prefs/faceprefbase.ui:33 +#. i18n: ectx: property (text), widget (QLabel, listFontLabel) +#: rc.cpp:54 +msgctxt "List font" +msgid "Font" msgstr "" -#: prefs/debugprefbase.cpp:88 -msgid "from:" -msgstr "" - -#: prefs/faceprefbase.cpp:184 -msgid "Board/Subject List" -msgstr "" - -#: prefs/faceprefbase.cpp:185 prefs/faceprefbase.cpp:196 -#: prefs/faceprefbase.cpp:199 +#. i18n: file: ../src/prefs/faceprefbase.ui:46 +#. i18n: ectx: property (text), widget (QPushButton, listFontButton) +#. i18n: file: ../src/prefs/faceprefbase.ui:137 +#. i18n: ectx: property (text), widget (QPushButton, threadFontButton) +#. i18n: file: ../src/prefs/faceprefbase.ui:206 +#. i18n: ectx: property (text), widget (QPushButton, popupFontButton) +#: rc.cpp:57 rc.cpp:72 rc.cpp:87 msgid "set font" msgstr "" -#: prefs/faceprefbase.cpp:187 prefs/faceprefbase.cpp:193 -#: prefs/faceprefbase.cpp:200 -msgid "text color" +#. i18n: file: ../src/prefs/faceprefbase.ui:56 +#. i18n: ectx: property (text), widget (QLabel, listColorLabel) +#: rc.cpp:60 +msgid "Text Color" msgstr "" -#: prefs/faceprefbase.cpp:188 prefs/faceprefbase.cpp:195 -#: prefs/faceprefbase.cpp:201 -msgid "background color" +#. i18n: file: ../src/prefs/faceprefbase.ui:79 +#. i18n: ectx: property (text), widget (QLabel, listBackgroundColorLabel) +#: rc.cpp:63 +msgid "Background Color" msgstr "" -#: prefs/faceprefbase.cpp:190 prefs/faceprefbase.cpp:197 -#: prefs/faceprefbase.cpp:202 -msgid "font" +#. i18n: file: ../src/prefs/faceprefbase.ui:118 +#. i18n: ectx: property (title), widget (QGroupBox, threadGroupBox) +#. i18n: file: ../src/prefs/uiprefbase.ui:82 +#. i18n: ectx: property (title), widget (QGroupBox, threadGroupBox) +#: rc.cpp:66 rc.cpp:117 +msgctxt "@label:textbox" +msgid "Thread" msgstr "" -#: prefs/faceprefbase.cpp:198 -msgid "Popup" +#. i18n: file: ../src/prefs/faceprefbase.ui:124 +#. i18n: ectx: property (text), widget (QLabel, threadFontLabel) +#: rc.cpp:69 +msgctxt "Thread font" +msgid "Font" msgstr "" -#: prefs/faceprefbase.cpp:205 -msgid "Basic" +#. i18n: file: ../src/prefs/faceprefbase.ui:144 +#. i18n: ectx: property (text), widget (QLabel, threadColorLabel) +#: rc.cpp:75 +msgctxt "Thread foreground color" +msgid "Text Color" msgstr "" -#: prefs/faceprefbase.cpp:206 -msgid "use stylesheet ( the setup of color/font is overwritten )." +#. i18n: file: ../src/prefs/faceprefbase.ui:164 +#. i18n: ectx: property (text), widget (QLabel, threadBackgroundColorLabel) +#: rc.cpp:78 +msgctxt "Thread background color" +msgid "Background Color" msgstr "" -#: prefs/faceprefbase.cpp:208 -msgid "Advanced" +#. i18n: file: ../src/prefs/faceprefbase.ui:187 +#. i18n: ectx: property (title), widget (QGroupBox, popupGroupBox) +#: rc.cpp:81 +msgid "Popup" msgstr "" -#: prefs/loginprefbase.cpp:109 -msgid "User ID" +#. i18n: file: ../src/prefs/faceprefbase.ui:193 +#. i18n: ectx: property (text), widget (QLabel, popupFontLabel) +#: rc.cpp:84 +msgctxt "Popup font" +msgid "Font" msgstr "" -#: prefs/loginprefbase.cpp:110 -msgid "Password" +#. i18n: file: ../src/prefs/faceprefbase.ui:213 +#. i18n: ectx: property (text), widget (QLabel, popupColorLabel) +#: rc.cpp:90 +msgctxt "Popup foreground color" +msgid "Text Color" msgstr "" -#: prefs/loginprefbase.cpp:111 -msgid "enables &auto login" +#. i18n: file: ../src/prefs/faceprefbase.ui:233 +#. i18n: ectx: property (text), widget (QLabel, popupBackgroundColorLabel) +#: rc.cpp:93 +msgctxt "Popup background color" +msgid "Background Color" msgstr "" -#: prefs/loginprefbase.cpp:112 -msgid "Be mail address" +#. i18n: file: ../src/prefs/faceprefbase.ui:273 +#. i18n: ectx: attribute (title), widget (QWidget, tab) +#: rc.cpp:96 +msgctxt "Advanced options" +msgid "Advanced" msgstr "" -#: prefs/loginprefbase.cpp:113 -msgid "Be auth code" +#. i18n: file: ../src/prefs/faceprefbase.ui:279 +#. i18n: ectx: property (text), widget (QCheckBox, useStyleSheetCheckBox) +#: rc.cpp:99 +msgid "Use stylesheet (the setup of color/font is overwritten)" msgstr "" -#: prefs/prefs.cpp:45 -msgid "Kita Preferences" +#. i18n: file: ../src/prefs/uiprefbase.ui:17 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_AlwaysUseTab) +#: rc.cpp:102 +msgid "Use new tab when opening the thread (board)." msgstr "" -#: prefs/prefs.cpp:54 -msgid "Face" -msgstr "" - -#: prefs/prefs.cpp:60 -msgid "AsciiArt" -msgstr "" - -#: prefs/prefs.cpp:63 -msgid "User Interface" -msgstr "" - -#: prefs/prefs.cpp:193 -msgid "'To' URL must not contain 'From' URL." -msgstr "" - -#: prefs/prefs.cpp:198 -msgid "" -"This tool may possibly break thread's info.\n" -"Please create backups of '~/.kde/share/apps/kita/cache'\n" -"and '~/.kde/share/apps/kita/favorites.xml' before performing.\n" -"Are you ready?" -msgstr "" - -#: prefs/prefs.cpp:205 -msgid "Complete." -msgstr "" - -#: prefs/prefs.cpp:206 -msgid "Failed.." -msgstr "" - -#: prefs/prefs.moc.cpp:34 prefs/prefs.moc.cpp:42 -msgid "KitaPreferences" -msgstr "" - -#: prefs/prefs.moc.cpp:156 prefs/prefs.moc.cpp:164 -msgid "DebugPrefPage" -msgstr "" - -#: prefs/prefs.moc.cpp:238 prefs/prefs.moc.cpp:246 -msgid "Kita::AsciiArtPrefPage" -msgstr "" - -#: prefs/prefs.moc.cpp:341 prefs/prefs.moc.cpp:349 -msgid "Kita::UIPrefPage" -msgstr "" - -#: prefs/prefs.moc.cpp:438 prefs/prefs.moc.cpp:446 -msgid "Kita::FacePrefPage" -msgstr "" - -#: prefs/uiprefbase.cpp:150 -msgid "Use new tab when opening the thread(board)." -msgstr "" - -#: prefs/uiprefbase.cpp:151 +#. i18n: file: ../src/prefs/uiprefbase.ui:26 +#. i18n: ectx: property (text), widget (QLabel, MarkLabel) +#: rc.cpp:105 msgid "Mark new thread to made:" msgstr "" -#: prefs/uiprefbase.cpp:152 -msgid "within " +#. i18n: file: ../src/prefs/uiprefbase.ui:58 +#. i18n: ectx: property (specialValueText), widget (QSpinBox, kcfg_MarkTime) +#: rc.cpp:108 +msgid "after last access" msgstr "" -#: prefs/uiprefbase.cpp:153 +#. i18n: file: ../src/prefs/uiprefbase.ui:61 +#. i18n: ectx: property (suffix), widget (QSpinBox, kcfg_MarkTime) +#: rc.cpp:111 msgid " hour" msgstr "" -#: prefs/uiprefbase.cpp:154 -msgid "after last access" +#. i18n: file: ../src/prefs/uiprefbase.ui:64 +#. i18n: ectx: property (prefix), widget (QSpinBox, kcfg_MarkTime) +#: rc.cpp:114 +msgid "within " msgstr "" -#: prefs/uiprefbase.cpp:157 -msgid "this option affects from the next thread." +#. i18n: file: ../src/prefs/uiprefbase.ui:93 +#. i18n: ectx: property (specialValueText), widget (QSpinBox, kcfg_ShowNum) +#: rc.cpp:120 +msgid "Display all res" msgstr "" -#: prefs/uiprefbase.cpp:158 -msgid "Show mail address in the thread." +#. i18n: file: ../src/prefs/uiprefbase.ui:96 +#. i18n: ectx: property (suffix), widget (QSpinBox, kcfg_ShowNum) +#: rc.cpp:123 +msgid " res" msgstr "" -#: prefs/uiprefbase.cpp:159 +#. i18n: file: ../src/prefs/uiprefbase.ui:99 +#. i18n: ectx: property (prefix), widget (QSpinBox, kcfg_ShowNum) +#: rc.cpp:126 +msgctxt "@label:spinbox Shown" msgid "Display " msgstr "" -#: prefs/uiprefbase.cpp:160 -msgid " res" +#. i18n: file: ../src/prefs/uiprefbase.ui:115 +#. i18n: ectx: property (text), widget (QLabel, textLabel3_2) +#: rc.cpp:129 +msgid "around the last read response." msgstr "" -#: prefs/uiprefbase.cpp:161 -msgid "Display all res" +#. i18n: file: ../src/prefs/uiprefbase.ui:146 +#. i18n: ectx: property (text), widget (QLabel, textLabel1) +#: rc.cpp:132 +msgid "this option affects from the next thread." msgstr "" -#: prefs/uiprefbase.cpp:162 -msgid "around the last read response." +#. i18n: file: ../src/prefs/uiprefbase.ui:156 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_ShowMailAddress) +#: rc.cpp:135 +msgid "Show mail address in the thread." msgstr "" -#: prefs/uiprefbase.cpp:163 +#. i18n: file: ../src/prefs/uiprefbase.ui:166 +#. i18n: ectx: property (title), widget (QGroupBox, kcfg_ListSortOrder) +#: rc.cpp:138 msgid "When open the board" msgstr "" -#: prefs/uiprefbase.cpp:164 +#. i18n: file: ../src/prefs/uiprefbase.ui:172 +#. i18n: ectx: property (text), widget (QRadioButton, unreadFirstRadio) +#: rc.cpp:141 msgid "Show unread thread first" msgstr "" -#: prefs/uiprefbase.cpp:165 +#. i18n: file: ../src/prefs/uiprefbase.ui:185 +#. i18n: ectx: property (text), widget (QRadioButton, numOrderRadio) +#: rc.cpp:144 msgid "Show thread in numerical order" msgstr "" -#: prefs/uiprefbase.cpp:166 +#. i18n: file: ../src/prefs/uiprefbase.ui:198 +#. i18n: ectx: property (title), widget (QGroupBox, partsGroupBox) +#: rc.cpp:147 msgid "Parts" msgstr "" -#: prefs/uiprefbase.cpp:167 +#. i18n: file: ../src/prefs/uiprefbase.ui:204 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_UsePart) +#: rc.cpp:150 msgid "Use other Part to open external link" msgstr "" -#: prefs/uiprefbase.cpp:168 -msgid "If mime type include this list ( comma separated list )" +#. i18n: file: ../src/prefs/uiprefbase.ui:217 +#. i18n: ectx: property (text), widget (QLabel, mimeListLabel) +#: rc.cpp:153 +msgid "If mime type include this list (comma separated list)" msgstr "" -#: prefs/uiprefbase.cpp:170 +#. i18n: file: ../src/prefs/uiprefbase.ui:236 +#. i18n: ectx: property (text), widget (KUrlLabel, editFileAssociation) +#: rc.cpp:156 msgid "Edit file association..." msgstr "" -#: prefs/writeprefbase.cpp:86 -msgid "Default Name" +#. i18n: file: ../src/prefs/loginprefbase.ui:23 +#. i18n: ectx: property (text), widget (QLabel, userIDLabel) +#: rc.cpp:159 +msgid "User ID" msgstr "" -#: prefs/writeprefbase.cpp:87 -msgid "use always" +#. i18n: file: ../src/prefs/loginprefbase.ui:46 +#. i18n: ectx: property (text), widget (QLabel, passwordLabel) +#: rc.cpp:162 +msgid "Password" msgstr "" -#: prefs/writeprefbase.cpp:88 -msgid "Default Mail" +#. i18n: file: ../src/prefs/loginprefbase.ui:79 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_AutoLogin) +#: rc.cpp:165 +msgid "Enables auto login" msgstr "" -#: prefs/writeprefbase.cpp:89 -msgid "sage checked" +#. i18n: file: ../src/prefs/loginprefbase.ui:90 +#. i18n: ectx: property (text), widget (QLabel, BeMailAddressLabel) +#: rc.cpp:168 +msgid "Be mail address" msgstr "" -#: thread/htmlpart.cpp:1064 -msgid "Open with Image viewer" +#. i18n: file: ../src/prefs/loginprefbase.ui:106 +#. i18n: ectx: property (text), widget (QLabel, BeAuthCodeLabel) +#: rc.cpp:171 +msgid "Be auth code" msgstr "" -#: thread/htmlpart.cpp:1113 thread/threadtabwidget.cpp:469 -msgid "Start" +#. i18n: file: ../src/prefs/writeprefbase.ui:19 +#. i18n: ectx: property (text), widget (QLabel, DefaultNameLabel) +#: rc.cpp:174 +msgid "Default Name" msgstr "" -#: thread/htmlpart.cpp:1119 -msgid "template" +#. i18n: file: ../src/prefs/writeprefbase.ui:35 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_DefaultNameUseAlways) +#: rc.cpp:177 +msgid "Use always" msgstr "" -#: thread/htmlpart.cpp:1123 -msgid "Kokomade Yonda (%1)" +#. i18n: file: ../src/prefs/writeprefbase.ui:62 +#. i18n: ectx: property (text), widget (QLabel, DefaultMailLabel) +#: rc.cpp:180 +msgid "Default Mail" msgstr "" -#: thread/htmlpart.cpp:1130 thread/threadtabwidget.cpp:477 -msgid "End" +#. i18n: file: ../src/prefs/writeprefbase.ui:78 +#. i18n: ectx: property (text), widget (QCheckBox, kcfg_DefaultSage) +#: rc.cpp:183 +msgid "sage checked" msgstr "" -#: thread/htmlpart.cpp:1149 -msgid "Extract by '%1'" +#. i18n: file: ../src/threadproperty.ui:17 +#. i18n: ectx: property (text), widget (QLabel, threadURLLabel0) +#: rc.cpp:186 +msgid "Thread URL" msgstr "" -#: thread/htmlpart.cpp:1150 -msgid "Add '%1' to abone list" +#. i18n: file: ../src/threadproperty.ui:37 +#. i18n: ectx: property (text), widget (QLabel, datURLLabel0) +#: rc.cpp:189 +msgid "Dat URL" msgstr "" -#: thread/htmlpart.cpp:1151 -msgid "Search '%1' by Google" +#. i18n: file: ../src/threadproperty.ui:67 +#. i18n: ectx: property (text), widget (QLabel, label0_3) +#: rc.cpp:192 +msgid "DatManager's information" msgstr "" -#: thread/htmlpart.cpp:1163 -msgid "Copy Link Location" +#. i18n: file: ../src/threadproperty.ui:77 +#. i18n: ectx: property (text), widget (QLabel, threadNameLabel0) +#. i18n: file: ../src/threadproperty.ui:217 +#. i18n: ectx: property (text), widget (QLabel, idx_threadNameWithIndexLabel0) +#: rc.cpp:195 rc.cpp:216 +msgctxt "@label:textbox" +msgid "Thread Name" msgstr "" -#: thread/htmlpart.cpp:1215 thread/htmlpart.cpp:1652 thread/htmlpart.cpp:1716 -msgid "Do you want to add '%1' to abone list ?" +#. i18n: file: ../src/threadproperty.ui:97 +#. i18n: ectx: property (text), widget (QLabel, cachePathLabel0) +#: rc.cpp:198 +msgid "Cache Path" msgstr "" -#: thread/htmlpart.cpp:1392 -msgid "Do you want to stop loading ?" +#. i18n: file: ../src/threadproperty.ui:117 +#. i18n: ectx: property (text), widget (QLabel, indexPathLabel0) +#: rc.cpp:201 +msgid "Index Path" msgstr "" -#: thread/htmlpart.cpp:1530 -msgid "write response" +#. i18n: file: ../src/threadproperty.ui:207 +#. i18n: ectx: property (text), widget (QLabel, label0) +#: rc.cpp:213 +msgid "Index file's information" msgstr "" -#: thread/htmlpart.cpp:1531 -msgid "quote this" +#. i18n: file: ../src/threadproperty.ui:307 +#. i18n: ectx: property (text), widget (QLabel, label0_2) +#: rc.cpp:228 +msgid "\"cache\" file's info (obsolete)" msgstr "" -#: thread/htmlpart.cpp:1542 -msgid "Open with KitaNavi" +#. i18n: file: ../src/writedialogbase.ui:16 +#. i18n: ectx: property (windowTitle), widget (QWidget, WriteDialogBase) +#: rc.cpp:237 +msgid "Write in thread" msgstr "" -#: thread/htmlpart.cpp:1547 -msgid "res tree" +#. i18n: file: ../src/writedialogbase.ui:32 +#. i18n: ectx: property (text), widget (QLabel, textLabel1) +#: rc.cpp:240 +msgid "Board:" msgstr "" -#: thread/htmlpart.cpp:1548 -msgid "reverse res tree" +#. i18n: file: ../src/writedialogbase.ui:50 +#. i18n: ectx: property (text), widget (KSqueezedTextLabel, boardNameLabel) +#: rc.cpp:243 +msgid "board name" msgstr "" -#: thread/htmlpart.cpp:1549 -msgid "extract by name" +#. i18n: file: ../src/writedialogbase.ui:57 +#. i18n: ectx: property (text), widget (QLabel, textLabel1_2) +#: rc.cpp:246 +msgid "Thread:" msgstr "" -#: thread/htmlpart.cpp:1555 -msgid "copy" +#. i18n: file: ../src/writedialogbase.ui:83 +#. i18n: ectx: property (text), widget (QLabel, nameLabel) +#: rc.cpp:249 +msgctxt "@label:textbox The name used when posting" +msgid "name" msgstr "" -#: thread/htmlpart.cpp:1560 -msgid "set Kokomade Yonda" +#. i18n: file: ../src/writedialogbase.ui:96 +#. i18n: ectx: property (text), widget (QLabel, mailLabel) +#: rc.cpp:252 +msgid "mail" msgstr "" -#: thread/htmlpart.cpp:1565 -msgid "add name to abone list" +#. i18n: file: ../src/writedialogbase.ui:109 +#. i18n: ectx: property (text), widget (QCheckBox, sageBox) +#: rc.cpp:255 +msgid "sage" msgstr "" -#: thread/htmlpart.cpp:1703 -msgid "extract by ID" +#. i18n: file: ../src/writedialogbase.ui:116 +#. i18n: ectx: property (text), widget (QCheckBox, beBox) +#: rc.cpp:258 +msgid "be" msgstr "" -#: thread/htmlpart.cpp:1704 -msgid "add id to abone list" +#. i18n: file: ../src/writedialogbase.ui:126 +#. i18n: ectx: attribute (title), widget (KTextEdit, bodyText) +#: rc.cpp:261 +msgid "body" msgstr "" -#: thread/htmlpart.cpp:2038 thread/htmlpart.cpp:2053 -msgid "None" +#. i18n: file: ../src/writedialogbase.ui:155 +#. i18n: ectx: property (text), widget (QLabel, lengthLabel) +#: rc.cpp:264 +msgid "XX/XX | XXXX/XXXX" msgstr "" -#: thread/htmlpart.moc.cpp:34 thread/htmlpart.moc.cpp:42 -msgid "KitaHTMLPart" +#. i18n: file: ../src/writedialogbase.ui:165 +#. i18n: ectx: property (text), widget (QPushButton, buttonOk) +#: rc.cpp:267 +msgid "OK" msgstr "" -#: thread/htmlpart.moc.cpp:522 thread/htmlpart.moc.cpp:530 -msgid "Kita::ResPopup" +#. i18n: file: ../src/writedialogbase.ui:181 +#. i18n: ectx: property (text), widget (QPushButton, buttonCancel) +#: rc.cpp:270 +msgid "Cancel" msgstr "" -#: thread/threadtabwidget.cpp:461 thread/threadviewbase.cpp:120 -msgid "go back anchor" +#. i18n: file: ../src/libkita/accountconfig.kcfg:9 +#. i18n: ectx: label, entry (BeMailAddress), group (Account) +#: rc.cpp:273 +msgid "Mail address of be.2ch.net" msgstr "" -#: thread/threadtabwidget.moc.cpp:34 thread/threadtabwidget.moc.cpp:42 -msgid "KitaThreadTabWidget" +#. i18n: file: ../src/libkita/accountconfig.kcfg:12 +#. i18n: ectx: label, entry (BeAuthCode), group (Account) +#: rc.cpp:276 +msgid "Auth code of be.2ch.net" msgstr "" -#: thread/threadtabwidget.moc.cpp:200 thread/threadtabwidget.moc.cpp:208 -msgid "KitaThreadTabBar" +#. i18n: file: ../src/libkita/accountconfig.kcfg:15 +#. i18n: ectx: label, entry (UserID), group (Account) +#: rc.cpp:279 +msgid "Maru user id" msgstr "" -#: thread/threadtabwidget.moc.cpp:273 thread/threadtabwidget.moc.cpp:281 -msgid "KitaThreadDock" +#. i18n: file: ../src/libkita/accountconfig.kcfg:18 +#. i18n: ectx: label, entry (AutoLogin), group (Account) +#: rc.cpp:282 +msgid "Whether login automatically or not." msgstr "" -#: thread/threadview.cpp:284 -msgid "goback anchor" +#. i18n: file: ../src/libkita/accountconfig.kcfg:22 +#. i18n: ectx: label, entry (Password), group (Account) +#: rc.cpp:285 +msgid "Maru password" msgstr "" -#: thread/threadview.cpp:700 -msgid "kita" +#. i18n: file: ../src/libkita/globalconfig.kcfg:9 +#. i18n: ectx: label, entry (Font), group (Global) +#: rc.cpp:288 +msgid "List font." msgstr "" -#: thread/threadview.cpp:700 -msgid "Not Found" +#. i18n: file: ../src/libkita/globalconfig.kcfg:12 +#. i18n: ectx: label, entry (ThreadFont), group (Global) +#: rc.cpp:291 +msgid "Thread font." msgstr "" -#: thread/threadview.moc.cpp:34 thread/threadview.moc.cpp:42 -msgid "KitaThreadView" +#. i18n: file: ../src/libkita/globalconfig.kcfg:15 +#. i18n: ectx: label, entry (PopupFont), group (Global) +#: rc.cpp:294 +msgid "Popup font." msgstr "" -#: thread/threadview.moc.cpp:627 thread/threadview.moc.cpp:635 -msgid "Kita::KitaSubjectLabel" +#. i18n: file: ../src/libkita/globalconfig.kcfg:18 +#. i18n: ectx: label, entry (ShowMailAddress), group (Global) +#: rc.cpp:297 +msgid "Whether show mail address or not." msgstr "" -#: thread/threadviewbase.cpp:114 -msgid "write" +#. i18n: file: ../src/libkita/globalconfig.kcfg:22 +#. i18n: ectx: label, entry (UsePart), group (Global) +#: rc.cpp:300 +msgid "Whether use embedded part or not." msgstr "" -#: thread/threadviewbase.cpp:117 -msgid "HighLight" +#. i18n: file: ../src/libkita/globalconfig.kcfg:25 +#. i18n: ectx: label, entry (UseImageViewer), group (Global) +#: rc.cpp:303 +msgid "Whether use image viewer or not." msgstr "" -#: thread/threadviewbase.cpp:118 -msgid "highlight search words" +#. i18n: file: ../src/libkita/globalconfig.kcfg:28 +#. i18n: ectx: label, entry (UseImagePopup), group (Global) +#: rc.cpp:306 +msgid "Whether use image popup or not." msgstr "" -#: thread/threadviewbase.cpp:119 -msgid "Goback" +#. i18n: file: ../src/libkita/globalconfig.kcfg:31 +#. i18n: ectx: label, entry (UseMosaic), group (Global) +#: rc.cpp:309 +msgid "Whether use mosaic or not." msgstr "" -#: thread/threadviewbase.cpp:121 -msgid "Bookmark" +#. i18n: file: ../src/libkita/globalconfig.kcfg:34 +#. i18n: ectx: label, entry (UseKitaNavi), group (Global) +#: rc.cpp:312 +msgid "Whether use kitanavi or not." msgstr "" -#: thread/threadviewbase.cpp:123 -msgid "add to bookmark" +#. i18n: file: ../src/libkita/globalconfig.kcfg:37 +#. i18n: ectx: label, entry (ShowNum), group (Global) +#: rc.cpp:315 +msgid "Number of responses displayed once." msgstr "" -#: thread/threadviewbase.cpp:125 -msgid "reload thread" +#. i18n: file: ../src/libkita/globalconfig.kcfg:41 +#. i18n: ectx: label, entry (UseStyleSheet), group (Global) +#: rc.cpp:318 +msgid "Whether use custom stylesheet or not." msgstr "" -#: thread/threadviewbase.cpp:126 -msgid "Del" +#. i18n: file: ../src/libkita/globalconfig.kcfg:45 +#. i18n: ectx: label, entry (MarkTime), group (Global) +#: rc.cpp:321 +msgid "Time marked as newly arrived thread. (0 == after last access.)" msgstr "" -#: thread/threadviewbase.cpp:127 -msgid "delete log" +#. i18n: file: ../src/libkita/globalconfig.kcfg:49 +#. i18n: ectx: label, entry (AboneChain), group (Global) +#: rc.cpp:324 +msgid "Whether abone responses recursively (secret config)." msgstr "" -#: write/writedialogbase.cpp:124 -msgid "Write in thread" +#. i18n: file: ../src/libkita/globalconfig.kcfg:53 +#. i18n: ectx: label, entry (CheckResponsed), group (Global) +#: rc.cpp:327 +msgid "Whether check responsed responses or not (secret config)." msgstr "" -#: write/writedialogbase.cpp:125 -msgid "Board:" +#. i18n: file: ../src/libkita/globalconfig.kcfg:56 +#. i18n: ectx: label, entry (CopyOnClick), group (Global) +#: rc.cpp:330 +msgid "Whether copy URL on click or not (secret config)." msgstr "" -#: write/writedialogbase.cpp:127 -msgid "Thread:" +#. i18n: file: ../src/libkita/globalconfig.kcfg:60 +#. i18n: ectx: label, entry (ListSortOrder), group (Global) +#: rc.cpp:333 +msgid "Choice order of board list." msgstr "" -#: write/writedialogbase.cpp:128 -msgid "name" +#. i18n: file: ../src/libkita/globalconfig.kcfg:68 +#. i18n: ectx: label, entry (PartMimeList), group (Global) +#: rc.cpp:336 +msgid "MIME list to use kpart." msgstr "" -#: write/writedialogbase.cpp:129 -msgid "mail" +#. i18n: file: ../src/libkita/globalconfig.kcfg:72 +#. i18n: ectx: label, entry (BoardListUrl), group (Global) +#: rc.cpp:339 +msgid "URL of board list" msgstr "" -#: write/writedialogbase.cpp:130 -msgid "&sage" +#. i18n: file: ../src/libkita/globalconfig.kcfg:78 +#. i18n: ectx: label, entry (NameCompletionList), group (Completion) +#: rc.cpp:342 +msgid "Name Completion list." msgstr "" -#: write/writedialogbase.cpp:131 -msgid "Alt+S" +#. i18n: file: ../src/libkita/asciiart.kcfg:9 +#. i18n: ectx: label, entry (AsciiArtList), group (Global) +#: rc.cpp:345 +msgid "Ascii Art." msgstr "" -#: write/writedialogbase.cpp:132 -msgid "&be" +#. i18n: file: ../src/libkita/writeconfig.kcfg:9 +#. i18n: ectx: label, entry (DefaultName), group (Write) +#: rc.cpp:348 +msgid "Default name." msgstr "" -#: write/writedialogbase.cpp:133 -msgid "Alt+B" +#. i18n: file: ../src/libkita/writeconfig.kcfg:12 +#. i18n: ectx: label, entry (DefaultNameUseAlways), group (Write) +#: rc.cpp:351 +msgid "Whether use default name or not." msgstr "" -#: write/writedialogbase.cpp:134 -msgid "body" +#. i18n: file: ../src/libkita/writeconfig.kcfg:16 +#. i18n: ectx: label, entry (DefaultMail), group (Write) +#: rc.cpp:354 +msgid "Default mail address." msgstr "" -#: write/writedialogbase.cpp:135 -msgid "XX/XX | XXXX/XXXX" +#. i18n: file: ../src/libkita/writeconfig.kcfg:19 +#. i18n: ectx: label, entry (DefaultSage), group (Write) +#: rc.cpp:357 +msgid "Whether use 'sage' as default or not." msgstr "" -#: write/writetabwidget.cpp:69 -msgid "Can't write to machi BBS in this version." +#. i18n: file: ../src/libkita/colorconfig.kcfg:9 +#. i18n: ectx: label, entry (Thread), group (Color) +#: rc.cpp:360 +msgid "Thread foreground color." msgstr "" -#: write/writetabwidget.cpp:80 -msgid "Do you want to clear the text?" +#. i18n: file: ../src/libkita/colorconfig.kcfg:13 +#. i18n: ectx: label, entry (ThreadBackground), group (Color) +#: rc.cpp:363 +msgid "Thread backgroupd color." msgstr "" -#: write/writetabwidget.cpp:203 write/writeview.cpp:320 -msgid "" -"If you close this dialog, you will lose text.\n" -"Do you want to close?" +#. i18n: file: ../src/libkita/colorconfig.kcfg:17 +#. i18n: ectx: label, entry (Popup), group (Color) +#: rc.cpp:366 +msgid "Popup foreground color." msgstr "" -#: write/writetabwidget.cpp:224 -msgid "quote clipboard" +#. i18n: file: ../src/libkita/colorconfig.kcfg:21 +#. i18n: ectx: label, entry (PopupBackground), group (Color) +#: rc.cpp:369 +msgid "Popup background color." msgstr "" -#: write/writetabwidget.moc.cpp:34 write/writetabwidget.moc.cpp:42 -msgid "KitaWriteTabWidget" +#. i18n: file: ../src/libkita/abone.kcfg:9 +#. i18n: ectx: label, entry (AboneIDList), group (Global) +#: rc.cpp:372 +msgid "Abone ID List." msgstr "" -#: write/writetabwidget.moc.cpp:143 write/writetabwidget.moc.cpp:151 -msgid "KitaWriteTabBar" +#. i18n: file: ../src/libkita/abone.kcfg:12 +#. i18n: ectx: label, entry (AboneNameList), group (Global) +#: rc.cpp:375 +msgid "Abone Name List." msgstr "" -#: write/writetabwidget.moc.cpp:216 write/writetabwidget.moc.cpp:224 -msgid "KitaWriteDock" +#. i18n: file: ../src/libkita/abone.kcfg:15 +#. i18n: ectx: label, entry (AboneWordList), group (Global) +#: rc.cpp:378 +msgid "Abone Word List." msgstr "" - -#: write/writeview.cpp:138 -msgid "preview" -msgstr "" - -#: write/writeview.cpp:257 -msgid "Enter the thread name." -msgstr "" - -#: write/writeview.cpp:264 -msgid "fusianasan." -msgstr "" - -#: write/writeview.cpp:269 -msgid "Body text is too long." -msgstr "" - -#: write/writeview.moc.cpp:34 write/writeview.moc.cpp:42 -msgid "KitaWriteView" -msgstr "" Property changes on: kita/trunk/kita/src ___________________________________________________________________ Modified: svn:ignore - kita kita_client kitaiface.kidl kitaiface_skel.cpp threadproperty.cpp threadproperty.h dummy.cpp Makefile Makefile.in *base.cpp *base.h *.la *.lo *.moc *.moc.cpp *.all_cpp.cpp .deps .libs + moc_* ui_* *_automoc.cpp *_automoc.cpp.files CMakeFiles CTestTestfile.cmake cmake_install.cmake kita kita.shell Makefile Deleted: kita/trunk/kita/src/.cvsignore =================================================================== --- kita/trunk/kita/src/.cvsignore 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/.cvsignore 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,18 +0,0 @@ -kita -kita_client -kitaiface.kidl -kitaiface_skel.cpp -threadproperty.cpp -threadproperty.h -dummy.cpp -Makefile -Makefile.in -*base.cpp -*base.h -*.la -*.lo -*.moc -*.moc.cpp -*.all_cpp.cpp -.deps -.libs Copied: kita/trunk/kita/src/CMakeLists.txt (from rev 2558, kita/branches/KITA-KDE4/kita/src/CMakeLists.txt) =================================================================== --- kita/trunk/kita/src/CMakeLists.txt (rev 0) +++ kita/trunk/kita/src/CMakeLists.txt 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,45 @@ +include_directories(${QT_INCLUDES} ${KDE4_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) + +add_subdirectory(kitaui) +add_subdirectory(libkita) +add_subdirectory(prefs) + + +########### next target ############### + +set(kita_SRCS + bbstabwidget.cpp + bbsview.cpp + boardtabwidget.cpp + boardview.cpp + domtree.cpp + favoritelistview.cpp + htmlpart.cpp + main.cpp + mainwindow.cpp + respopup.cpp + threadlistview.cpp + threadlistheaderview.cpp + threadlistviewitem.cpp + threadtabwidget.cpp + threadview.cpp + viewmediator.cpp + writetabwidget.cpp + writeview.cpp) + +kde4_add_ui_files(kita_SRCS threadlistviewbase.ui threadproperty.ui writedialogbase.ui) + +kde4_add_executable(kita ${kita_SRCS}) + +target_link_libraries(kita ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} kitapref kitautil kitaui) + +install(TARGETS kita ${INSTALL_TARGETS_DEFAULT_ARGS}) + + +########### install files ############### + +install(FILES boardtabwidgetui.rc kitaui.rc threadtabwidgetui.rc writetabwidgetui.rc DESTINATION ${DATA_INSTALL_DIR}/kita) +install(FILES DESTINATION ${DATA_INSTALL_DIR}/kita/icons) +install(FILES kita.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) + +kde4_install_icons(${ICON_INSTALL_DIR}) Deleted: kita/trunk/kita/src/Makefile.am =================================================================== --- kita/trunk/kita/src/Makefile.am 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/Makefile.am 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,52 +0,0 @@ -## Makefile.am for kita - -SUBDIRS = libkita kitaui prefs -# this is the program that gets installed. it's name is used for all -# of the other Makefile.am variables -bin_PROGRAMS = kita - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# the library search path. -kita_LDFLAGS = $(KDE_RPATH) $(all_libraries) - -# the libraries to link against. -kita_LDADD = ./prefs/libkitapref.la ./libkita/libkita.la ./kitaui/libkitaui.la $(LIB_KFILE) $(LIB_KDEPRINT) $(LIB_KDEUI) - -# which sources should be compiled for kita -kita_SOURCES = main.cpp mainwindow.cpp bbstabwidget.cpp bbsview.cpp \ - writetabwidget.cpp writeview.cpp writedialogbase.ui boardtabwidget.cpp \ - boardview.cpp favoritelistview.cpp threadlistviewitem.cpp threadlistview.cpp \ - threadlistviewbase.ui threadproperty.ui domtree.cpp htmlpart.cpp threadtabwidget.cpp \ - threadview.cpp respopup.cpp viewmediator.cpp - -# these are the headers for your project -noinst_HEADERS = mainwindow.h bbstabwidget.h bbsview.h writedialogbase.ui.h \ - writetabwidget.h writeview.h boardtabwidget.h boardview.h \ - favoritelistview.h threadlistviewitem.h threadlistview.h domtree.h htmlpart.h \ - threadtabwidget.h threadview.h respopup.h viewmediator.h - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) *.cpp */*.cpp -o ../po/kita.pot - -KDE_ICON = kita - -# this is where the kdelnk file will go -if KITA_USE_XDG_MENU -kdelnkdir = $(xdg_appsdir) -else -kdelnkdir = $(kde_appsdir)/Internet -endif -kdelnk_DATA = kita.desktop - -# this is where the XML-GUI resource file goes -rcdir = $(kde_datadir)/kita -rc_DATA = kitaui.rc writetabwidgetui.rc boardtabwidgetui.rc threadtabwidgetui.rc - -appicondir = $(kde_datadir)/kita/icons -appicon_ICON = newthread read unread open - Modified: kita/trunk/kita/src/bbstabwidget.cpp =================================================================== --- kita/trunk/kita/src/bbstabwidget.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/bbstabwidget.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,47 +9,43 @@ ***************************************************************************/ #include "bbstabwidget.h" -#include "bbsview.h" #include <klocale.h> -/*--------------------------------------------------------------*/ +#include "bbsview.h" +using namespace Kita; -KitaBBSTabWidget::KitaBBSTabWidget( QWidget* parent, const char* name, WFlags fl ) - : KitaTabWidgetBase( parent, name, fl ) +BBSTabWidget::BBSTabWidget(QWidget* parent) : TabWidgetBase(parent) { - KitaBBSView * view = new KitaBBSView( this ); - addTab( view, i18n( "board name" ) ); + BBSView * view = new BBSView(this); + addTab(view, i18nc("@title:tab", "Board Name")); } -KitaBBSTabWidget::~KitaBBSTabWidget() {} +BBSTabWidget::~BBSTabWidget() {} /* public slot */ -void KitaBBSTabWidget::showBoardList() +void BBSTabWidget::showBoardList() { - static_cast < KitaBBSView* > ( page( 0 ) ) ->showBoardList(); + static_cast<BBSView*>(widget(0))->showBoardList(); } -void KitaBBSTabWidget::updateBoardList() +void BBSTabWidget::updateBoardList() { - static_cast < KitaBBSView* > ( page( 0 ) ) ->updateBoardList(); + static_cast<BBSView*>(widget(0))->updateBoardList(); } /* public slot */ -void KitaBBSTabWidget::setFont( const QFont& font ) +void BBSTabWidget::setFont(const QFont& font) { - KTabWidget::setFont( font ); - static_cast < KitaBBSView* > ( page( 0 ) ) ->setFont( font ); + KTabWidget::setFont(font); + static_cast<BBSView*>(widget(0))->setFont(font); } -void KitaBBSTabWidget::loadOpened() +void BBSTabWidget::loadOpened() { - static_cast < KitaBBSView* > ( page( 0 ) ) ->loadOpened(); + static_cast<BBSView*>(widget(0))->loadOpened(); } - -/* protected */ /* virtual */ -void KitaBBSTabWidget::deleteWidget( QWidget* w ) {} Modified: kita/trunk/kita/src/bbstabwidget.h =================================================================== --- kita/trunk/kita/src/bbstabwidget.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/bbstabwidget.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITABBSTABWIDGET_H #define KITABBSTABWIDGET_H @@ -15,25 +14,23 @@ class QFont; -/*------------------------------------------------*/ - - -class KitaBBSTabWidget : public KitaTabWidgetBase +namespace Kita { - Q_OBJECT -public: - KitaBBSTabWidget( QWidget* parent, const char* name = 0, WFlags fl = 0 ); - ~KitaBBSTabWidget(); + class BBSTabWidget : public TabWidgetBase + { + Q_OBJECT -public slots: - void showBoardList(); - void updateBoardList(); - void setFont( const QFont& font ); - void loadOpened(); + public: + explicit BBSTabWidget(QWidget* parent); + ~BBSTabWidget(); -protected: - virtual void deleteWidget( QWidget* w ); -}; + public slots: + void showBoardList(); + void updateBoardList(); + void setFont(const QFont& font); + void loadOpened(); + }; +} #endif Modified: kita/trunk/kita/src/bbsview.cpp =================================================================== --- kita/trunk/kita/src/bbsview.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/bbsview.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -8,106 +8,94 @@ * (at your option) any later version. * ***************************************************************************/ -#include <kio/netaccess.h> -#include <krun.h> -#include <klistview.h> -#include <kpopupmenu.h> -#include <klocale.h> -#include <kdebug.h> -#include <kstandarddirs.h> +#include "bbsview.h" + +#include <QtCore/QFile> +#include <QtCore/QRegExp> +#include <QtCore/QStringList> +#include <QtCore/QTextCodec> +#include <QtGui/QApplication> +#include <QtGui/QClipboard> +#include <QtGui/QHBoxLayout> +#include <QtGui/QHeaderView> +#include <QtGui/QMouseEvent> +#include <QtGui/QSpacerItem> +#include <QtGui/QTreeWidget> +#include <QtGui/QVBoxLayout> + +#include <kaction.h> +#include <kcombobox.h> #include <kconfig.h> -#include <ksimpleconfig.h> -#include <kdeversion.h> +#include <klocale.h> +#include <kmenu.h> #include <kmessagebox.h> -#include <kiconloader.h> +#include <krun.h> +#include <kstandarddirs.h> +#include <kio/netaccess.h> -#include <qfile.h> -#include <qtextcodec.h> -#include <qstringlist.h> -#include <qregexp.h> -#include <qvaluelist.h> -#include <qheader.h> -#include <qclipboard.h> -#include <qmessagebox.h> -#include <qtoolbutton.h> -#include <qcombobox.h> -#include <qlayout.h> - -#include "bbsview.h" - #include "viewmediator.h" - #include "kitaui/listviewitem.h" - -#include "libkita/qcp932codec.h" -#include "libkita/favoriteboards.h" #include "libkita/boardmanager.h" -#include "libkita/config_xt.h" +#include "libkita/favoriteboards.h" +#include "libkita/globalconfig.h" #include "libkita/kita_misc.h" -namespace Kita +using namespace Kita; + +struct Kita::Category { - struct Category - { - QString category_name; - QStringList boardNameList; - QStringList boardURLList; - }; -} + QString category_name; + QStringList boardNameList; + QStringList boardUrlList; +}; /*--------------------------------------*/ -KitaBBSView::KitaBBSView( QWidget *parent, const char *name ) - : m_favorites( 0 ) +BBSView::BBSView(QWidget *parent) : QWidget(parent), m_favorites(0) { /* copied from Base class */ - if ( !name ) - setName( "KitaBBSViewBase" ); - KitaBBSViewBaseLayout = new QVBoxLayout( this, 0, 0, "KitaBBSViewBaseLayout"); + bbsViewBaseLayout = new QVBoxLayout(this); - layout10 = new QHBoxLayout( 0, 0, 6, "layout10"); + layout10 = new QHBoxLayout(0); - SearchCombo = new QComboBox( FALSE, this, "SearchCombo" ); - SearchCombo->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)4, 0, 0, SearchCombo->sizePolicy().hasHeightForWidth() ) ); - SearchCombo->setEditable( TRUE ); - SearchCombo->setSizeLimit( 10 ); - layout10->addWidget( SearchCombo ); - spacer2 = new QSpacerItem( 467, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - layout10->addItem( spacer2 ); - KitaBBSViewBaseLayout->addLayout( layout10 ); + searchCombo = new KComboBox(this); + searchCombo->setEditable(true); + searchCombo->setMaxCount(10); + layout10->addWidget(searchCombo); + spacer2 = new QSpacerItem(467, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + layout10->addItem(spacer2); + bbsViewBaseLayout->addLayout(layout10); - m_boardList = new KListView( this, "m_boardList" ); - m_boardList->setRootIsDecorated( TRUE ); - m_boardList->setTreeStepSize( 10 ); - m_boardList->setFullWidth( TRUE ); - KitaBBSViewBaseLayout->addWidget( m_boardList ); - resize( QSize(600, 482).expandedTo(minimumSizeHint()) ); - clearWState( WState_Polished ); + m_boardList = new QTreeWidget(this); + m_boardList->setAlternatingRowColors(true); + m_boardList->setRootIsDecorated(true); + bbsViewBaseLayout->addWidget(m_boardList); + resize(QSize(600, 482).expandedTo(minimumSizeHint())); /* copy end */ - m_boardList->setSorting( -1 ); - m_boardList->addColumn( i18n( "board name" ) ); - m_boardList->header() ->setClickEnabled( FALSE ); + m_boardList->setHeaderLabel(i18nc("@title:column", "Board Name")); + m_boardList->header()->setClickable(false); - /* default colors */ - QColorGroup colors = m_boardList->viewport() ->colorGroup(); - m_textColor = colors.text(); - m_baseColor = colors.base(); - m_backColor = m_boardList->viewport() ->paletteBackgroundColor(); - m_altColor = m_boardList->alternateBackground(); + connect(m_boardList, SIGNAL(itemActivated(QTreeWidgetItem*, int)), + SLOT(loadBoard(QTreeWidgetItem*))); + connect(FavoriteBoards::getInstance(), SIGNAL(changed()), + SLOT(refreshFavoriteBoards())); + connect(searchCombo, SIGNAL(textChanged(const QString&)), + SLOT(filter(const QString&))); - connect( m_boardList, SIGNAL( mouseButtonClicked( int, QListViewItem*, const QPoint&, int ) ), - SLOT( slotMouseButtonClicked( int, QListViewItem* ) ) ); - connect( m_boardList, SIGNAL( returnPressed( QListViewItem* ) ), SLOT( loadBoard( QListViewItem* ) ) ); - connect( m_boardList, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ), - SLOT( slotContextMenuRequested( QListViewItem*, const QPoint&, int ) ) ); - connect( Kita::FavoriteBoards::getInstance(), SIGNAL( changed() ), SLOT( refreshFavoriteBoards() ) ); - connect( SearchCombo, SIGNAL( textChanged( const QString& ) ), - SLOT( filter( const QString& ) ) ); + m_openWithBrowserAct + = new KAction(i18nc("@action:inmenu", "Open with Web Browser"), this); + m_copyUrlAct = new KAction(i18nc("@action:inmenu", "Copy URL"), this); + m_copyTitleAndUrlAct + = new KAction(i18nc("@action:inmenu", "Copy title and URL"), this); + m_removeFromFavoritesAct + = new KAction(i18nc("@action:inmenu", "Remove from Favorites"), this); + m_addToFavoritesAct + = new KAction(i18nc("@action:inmenu", "Add to Favorites"), this); } -KitaBBSView::~KitaBBSView() +BBSView::~BBSView() { saveOpened(); } @@ -116,172 +104,170 @@ * download board list, parse, and write to "board_list" * * @see updateBoardList() - * @see KitaConfig::boardListURL() + * @see GlobalConfig::boardListURL() */ -bool KitaBBSView::downloadBoardList() +bool BBSView::downloadBoardList() { // moved urls. - QValueList<QString> oldURLs; - QValueList<QString> newURLs; + QList<QString> oldUrls; + QList<QString> newUrls; QString tmpFile; - QString url = Kita::Config::boardListUrl(); - if ( ! KIO::NetAccess::download( url, tmpFile, NULL ) ) { - return FALSE; + QString url = GlobalConfig::boardListUrl(); + if (! KIO::NetAccess::download(url, tmpFile, 0)) { + return false; } - QFile file( tmpFile ); - if ( ! file.open( IO_ReadOnly ) ) { - return FALSE; + QFile file(tmpFile); + if (! file.open(QIODevice::ReadOnly)) { + return false; } - QTextStream stream( &file ); - QCp932Codec codec; - stream.setCodec( &codec ); - QString html = stream.read(); + QTextStream stream(&file); + QTextCodec* codec = QTextCodec::codecForName("Shift-JIS"); + stream.setCodec(codec); + QString html = stream.readAll(); // parse QStringList list; - QValueList<Kita::Category> categoryList = getCategoryList( html ); - QValueList<Kita::Category>::iterator it; + QList<Category> categoryList = getCategoryList(html); + QList<Category>::iterator it; /* Are there new boards or moved boards ? */ - QString newBoards = QString::null; - QString oldBoards = QString::null; - for ( it = categoryList.begin(); it != categoryList.end(); ++it ) { - Kita::Category category = ( *it ); - QValueList<QString> board_url_list = category.boardURLList; - if ( board_url_list.isEmpty() ) continue; + QString newBoards; + QString oldBoards; + for (it = categoryList.begin(); it != categoryList.end(); ++it) { + Category category = (*it); + QList<QString> board_url_list = category.boardUrlList; + if (board_url_list.isEmpty()) continue; int count = 0; - for ( QValueList<QString>::iterator it2 = board_url_list.begin(); - it2 != board_url_list.end(); ++it2 ) { + for (QList<QString>::iterator it2 = board_url_list.begin(); + it2 != board_url_list.end(); ++it2) { - QString boardURL = *it2; + QString boardUrl = *it2; QString boardName = category.boardNameList[ count ]; - QString oldURL; - int ret = Kita::BoardManager::enrollBoard( boardURL, boardName, oldURL, Kita::Board_Unknown, - TRUE /* test only */ - ); - if ( ret == Kita::Board_enrollNew ) { - newBoards += boardName + " ( " + category.category_name + " ) " + boardURL + "\n"; + QString oldUrl; + int ret = BoardManager::enrollBoard( + boardUrl, boardName, oldUrl, Board_Unknown, + true /* test only */); + if (ret == Board_enrollNew) { + newBoards += boardName + " ( " + category.category_name + + " ) " + boardUrl + '\n'; } - if ( ret == Kita::Board_enrollMoved ) { - oldBoards += boardName + " ( " + category.category_name + " ) " + oldURL + " -> " + boardURL + "\n"; + if (ret == Board_enrollMoved) { + oldBoards += boardName + " ( " + category.category_name + + " ) " + oldUrl + " -> " + boardUrl + '\n'; } count++; - oldURLs += oldURL; - newURLs += boardURL; + oldUrls += oldUrl; + newUrls += boardUrl; } } const int maxNewBoard = 64; /* show new board names */ - if ( newBoards != QString::null && newBoards.contains( "\n" ) < maxNewBoard ) { + if (!newBoards.isEmpty() && newBoards.count("\n") < maxNewBoard) { - QStringList boardList = QStringList::split( "\n", newBoards ); - KMessageBox::informationList( this, - i18n( "New boards:\n\n" ), - boardList, "Kita" ); + QStringList boardList = newBoards.split('\n'); + KMessageBox::informationList(this, + i18n("New boards:\n\n"), + boardList, "Kita"); } /* show moved board names */ - if ( oldBoards != QString::null ) { + if (!oldBoards.isEmpty()) { - QStringList boardList = QStringList::split( "\n", oldBoards ); - KMessageBox::informationList( this, - i18n( "These boards were moved:\n\n" ) - + i18n( "\nPlease create the backup of those caches.\n" ), - boardList, "Kita" ); + QStringList boardList = oldBoards.split('\n'); + KMessageBox::informationList(this, + i18n("These boards were moved:\n\n") + + i18n("\nPlease create the backup of those caches.\n"), + boardList, "Kita"); } - if ( ( newBoards != QString::null && newBoards.contains( "\n" ) < maxNewBoard ) - || oldBoards != QString::null ) { + if ((!newBoards.isEmpty() && newBoards.count("\n") < maxNewBoard) + || !oldBoards.isEmpty()) { - QMessageBox mb( "kita", i18n( "Do you really want to update board list?" ), - QMessageBox::Information, - QMessageBox::Ok, - QMessageBox::Cancel | QMessageBox::Default | QMessageBox::Escape, - QMessageBox::No, this ); + int ret = KMessageBox::warningYesNoCancel(this, + i18n("Do you really want to update board list?"), "kita", + KStandardGuiItem::yes(), + KGuiItem(i18nc("@action:button", "Copy")), + KStandardGuiItem::cancel(), + QString(), KMessageBox::Dangerous); + if (ret == KMessageBox::No) { + QString str = i18n("New boards:\n\n") + newBoards + '\n' + + i18n("These boards were moved:\n\n") + oldBoards; + QApplication::clipboard() ->setText(str , QClipboard::Clipboard); + QApplication::clipboard() ->setText(str , QClipboard::Selection); + } else if (ret == KMessageBox::Cancel) + return false; + } else if (newBoards.isEmpty() && oldBoards.isEmpty()) { - mb.setButtonText( QMessageBox::No, i18n( "Copy" ) ); - - int ret; - while ( ( ret = mb.exec() ) == QMessageBox::No ) { - QString str = i18n( "New boards:\n\n" ) + newBoards + "\n" - + i18n( "These boards were moved:\n\n" ) + oldBoards; - QApplication::clipboard() ->setText( str , QClipboard::Clipboard ); - QApplication::clipboard() ->setText( str , QClipboard::Selection ); - } - - if ( ret == QMessageBox::Cancel ) return FALSE; - } else if ( newBoards == QString::null && oldBoards == QString::null ) { - - QMessageBox::information( this, "Kita", i18n( "no new boards" ) ); - return FALSE; + KMessageBox::information(this, i18n("no new boards"), "Kita"); + return false; } // if moved URL exists. move files. - for( int i=0; i<oldURLs.count(); i++ ) { - QString oldURL = oldURLs[ i ]; - QString newURL = newURLs[ i ]; + for(int i=0; i<oldUrls.count(); i++) { + QString oldUrl = oldUrls[ i ]; + QString newUrl = newUrls[ i ]; - qDebug("move %s -> %s", oldURL.latin1(), newURL.latin1()); - Kita::BoardManager::moveBoard( oldURL, newURL ); +// qDebug("move %s -> %s", oldURL.latin1(), newURL.latin1()); + BoardManager::moveBoard(oldUrl, newUrl); } /* save config */ - QString configPath = locateLocal( "appdata", "board_list" ); - KSimpleConfig config( configPath ); - for ( it = categoryList.begin(); it != categoryList.end(); ++it ) { - Kita::Category category = ( *it ); - QValueList<QString> board_url_list = category.boardURLList; + QString configPath = KStandardDirs::locateLocal("appdata", "board_list"); + KConfig config(configPath); + for (it = categoryList.begin(); it != categoryList.end(); ++it) { + Category category = (*it); + QList<QString> board_url_list = category.boardUrlList; - if ( board_url_list.isEmpty() ) { + if (board_url_list.isEmpty()) { continue; } list << category.category_name; - config.setGroup( category.category_name ); + KConfigGroup group = config.group(category.category_name); - QValueList<QString>::iterator it2; + QList<QString>::iterator it2; int count = 0; - for ( it2 = board_url_list.begin(); it2 != board_url_list.end(); ++it2 ) { - QString key = QString( "item%1" ).arg( count ); - QString boardURL = *it2; + for (it2 = board_url_list.begin(); it2 != board_url_list.end(); ++it2) { + QString key = QString("item%1").arg(count); + QString boardUrl = *it2; QString boardName = category.boardNameList[ count ]; QStringList tmpList; - tmpList << boardURL; + tmpList << boardUrl; tmpList << boardName; - config.writeEntry( key, tmpList ); + group.writeEntry(key, tmpList); count++; } } - config.setGroup( QString::null ); - config.writeEntry( "Categories", list ); + KConfigGroup group2 = config.group(""); + group2.writeEntry("Categories", list); QDateTime now = QDateTime::currentDateTime(); - QString logPath = locateLocal( "appdata", "board_log.txt" ); + QString logPath = KStandardDirs::locateLocal("appdata", "board_log.txt"); - QFile logfile( logPath ); - if ( logfile.open( IO_WriteOnly | IO_Append ) ) { - QTextStream stream( &logfile ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + QFile logfile(logPath); + if (logfile.open(QIODevice::WriteOnly | QIODevice::Append)) { + QTextStream stream(&logfile); + stream.setCodec("UTF-8"); - stream << "Date: " << now.toString( "yyyy/MM/dd hh:mm:ss" ) << endl; - stream << i18n( "New boards:\n\n" ) + newBoards + "\n"; - stream << i18n( "These boards were moved:\n\n" ) + oldBoards; + stream << "Date: " << now.toString("yyyy/MM/dd hh:mm:ss") << endl; + stream << i18n("New boards:\n\n") + newBoards + '\n'; + stream << i18n("These boards were moved:\n\n") + oldBoards; stream << "----------------------------------------" << endl; logfile.close(); } - return TRUE; + return true; } -void KitaBBSView::updateBoardList() +void BBSView::updateBoardList() { - if ( downloadBoardList() ) showBoardList(); + if (downloadBoardList()) showBoardList(); } /** @@ -290,67 +276,54 @@ * @see updateBoardList() * @see downloadBoardList() */ -void KitaBBSView::showBoardList() +void BBSView::showBoardList() { - /* color setting */ - /* - m_textColor = QColor( "white" ); - m_baseColor = QColor( "red" ); - m_backColor = QColor( "yellow" ); - m_altColor = QColor( "blue" ); - */ - /*-------------------------------------------------*/ - - /* set background color */ - m_boardList->viewport() ->setPaletteBackgroundColor( m_backColor ); - m_boardList->setAlternateBackground( m_altColor ); - // clear list m_boardList->clear(); - m_favorites = NULL; + m_favorites = 0; - QString configPath = locateLocal( "appdata", "board_list" ); - KConfig config( configPath ); - QStringList category_list = config.readListEntry( "Categories" ); + QString configPath = KStandardDirs::locateLocal("appdata", "board_list"); + KConfig config(configPath); + QStringList category_list = config.group("").readEntry("Categories", QStringList()); - Kita::ListViewItem* previous = 0; + ListViewItem* previous = 0; QStringList::iterator it; - for ( it = category_list.begin(); it != category_list.end(); ++it ) { - QString category = ( *it ); + for (it = category_list.begin(); it != category_list.end(); ++it) { + QString category = (*it); - config.setGroup( category ); - Kita::ListViewItem* categoryItem = new Kita::ListViewItem( m_boardList, previous, category ); - categoryItem->setColor( m_textColor, m_baseColor ); - Kita::ListViewItem* previousBoard = 0; + KConfigGroup group = config.group(category); + ListViewItem* categoryItem = new ListViewItem( + m_boardList, previous, QStringList(category)); + ListViewItem* previousBoard = 0; - for ( int count = 0; ; count++ ) { - QString key = QString( "item%1" ).arg( count ); - QStringList value = config.readListEntry( key ); - if ( value.count() != 2 ) { + for (int count = 0; ; count++) { + QString key = QString("item%1").arg(count); + QStringList value = group.readEntry(key, QStringList()); + if (value.count() != 2) { break; } - QString boardURL = value[ 0 ]; + QString boardUrl = value[ 0 ]; QString boardName = value[ 1 ]; - if ( boardURL.contains( '/' ) != 4 || boardURL.right( 1 ) != "/" ) { + if (boardUrl.contains('/') != 4 || boardUrl.right(1) != "/") { // OK: http://pc8.2ch.net/linux/ // NG: http://www.machi.to/ // NG: http://find.2ch.net/enq/board.php continue; } - QString oldURL; - Kita::BoardManager::enrollBoard( boardURL, boardName, oldURL ); - Kita::BoardManager::loadBBSHistory( boardURL ); - previousBoard = new Kita::ListViewItem( categoryItem, previousBoard, boardName, boardURL ); - previousBoard->setColor( m_textColor, m_baseColor ); + QString oldUrl; + BoardManager::enrollBoard(boardUrl, boardName, oldUrl); + BoardManager::loadBBSHistory(boardUrl); + previousBoard = new ListViewItem(categoryItem, previousBoard, + QStringList() << boardName << boardUrl); } previous = categoryItem; } - QString boardURL = "http://jbbs.livedoor.jp/computer/18420/" ; - QString boardName = i18n( "Kita Board" ); - QString oldURL; - new Kita::ListViewItem( m_boardList, NULL, boardName, boardURL ); - Kita::BoardManager::enrollBoard( boardURL, boardName, oldURL ); + QString boardUrl = "http://jbbs.livedoor.jp/computer/18420/" ; + QString boardName = i18nc("@item:inlistbox", "Kita Board"); + QString oldUrl; + new ListViewItem(m_boardList, 0, QStringList() << boardName << boardUrl); + BoardManager::enrollBoard(boardUrl, boardName, oldUrl); loadExtBoard(); refreshFavoriteBoards(); @@ -358,35 +331,36 @@ /* private */ -void KitaBBSView::loadExtBoard() +void BBSView::loadExtBoard() { - QString configPath = locateLocal( "appdata", "extbrd.conf" ); - QFile file( configPath ); - if ( file.open( IO_ReadOnly ) ) { + QString configPath = KStandardDirs::locateLocal("appdata", "extbrd.conf"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { - QTextStream stream( &file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + QTextStream stream(&file); + stream.setCodec("UTF-8"); QStringList list; QString str; - Kita::ListViewItem* categoryItem = new Kita::ListViewItem( m_boardList, "extboard" ); - categoryItem->setColor( m_textColor, m_baseColor ); + ListViewItem* categoryItem + = new ListViewItem(m_boardList, QStringList("extboard")); - while ( ( str = stream.readLine() ) != QString::null ) { - if ( ! str.isEmpty() ) { - QStringList list = QStringList::split( "<>", str ); + while (!(str = stream.readLine()).isEmpty()) { + if (! str.isEmpty()) { + QStringList list = str.split("<>"); - if ( list.size() == 2 || list.size() == 3 ) { + if (list.size() == 2 || list.size() == 3) { QString board_title = list[ 0 ]; QString board_url = list[ 1 ]; - Kita::ListViewItem* tmpitem = new Kita::ListViewItem( categoryItem, board_title, board_url ); - tmpitem->setColor( m_textColor, m_baseColor ); - QString oldURL; - int type = Kita::Board_Unknown; - if ( list.size() == 3 ) type = list[ 2 ].toInt(); - Kita::BoardManager::enrollBoard( board_url, board_title, oldURL, type ); + new ListViewItem(categoryItem, + QStringList() << board_title << board_url); + QString oldUrl; + int type = Board_Unknown; + if (list.size() == 3) type = list[ 2 ].toInt(); + BoardManager::enrollBoard( + board_url, board_title, oldUrl, type); } } } @@ -395,34 +369,35 @@ } } -QValueList<Kita::Category> KitaBBSView::getCategoryList( const QString& html ) const +QList<Category> BBSView::getCategoryList(const QString& html) const { - QValueList<Kita::Category> result; + QList<Category> result; - QStringList lines = QStringList::split( "\n", html ); + QStringList lines = html.split('\n'); QStringList::iterator it; - Kita::Category current_category; - current_category.category_name = QString::null; + Category current_category; + current_category.category_name.clear(); current_category.boardNameList.clear(); - current_category.boardURLList.clear(); - for ( it = lines.begin(); it != lines.end(); ++it ) { - QString category_name = Kita::getCategory( *it ); - if ( category_name != QString::null ) { - if ( current_category.category_name != QString::null ) { - result.append( current_category ); + current_category.boardUrlList.clear(); + for (it = lines.begin(); it != lines.end(); ++it) { + QString category_name = getCategory(*it); + if (!category_name.isEmpty()) { + if (!current_category.category_name.isEmpty()) { + result.append(current_category); } current_category.category_name = category_name; current_category.boardNameList.clear(); - current_category.boardURLList.clear(); + current_category.boardUrlList.clear(); } else { - QRegExp regexp( "<A HREF=([^ ]*).*>(.*)</A>", FALSE ); - if ( regexp.search( ( *it ) ) != -1 ) { - QString url = regexp.cap( 1 ); - QString title = regexp.cap( 2 ); - if ( Kita::isBoardURL( url ) && current_category.category_name != QString::null ) { - current_category.boardNameList.append( title ); - current_category.boardURLList.append( url ); + QRegExp regexp("<A HREF=([^ ]*).*>(.*)</A>", Qt::CaseInsensitive); + if (regexp.indexIn((*it)) != -1) { + QString url = regexp.cap(1); + QString title = regexp.cap(2); + if (isBoardUrl(url) + && !current_category.category_name.isEmpty()) { + current_category.boardNameList.append(title); + current_category.boardUrlList.append(url); } } } @@ -430,163 +405,139 @@ return result; } -void KitaBBSView::refreshFavoriteBoards() +void BBSView::refreshFavoriteBoards() { - if ( ! m_favorites ) { - m_favorites = new Kita::ListViewItem( m_boardList, 0, i18n( "Favorites" ) ); + if (!m_favorites) { + m_favorites = new ListViewItem(m_boardList, 0, + QStringList(i18nc("@item:inlistbox", "Favorites"))); } - m_favorites->setColor( m_textColor, m_baseColor ); // remove all items. do { - QListViewItem* child = m_favorites->firstChild(); + QTreeWidgetItem* child = m_favorites->child(0); delete child; - } while ( m_favorites->childCount() != 0 ); + } while (m_favorites->childCount() != 0); // insert items. - QValueList<KURL> boards = Kita::FavoriteBoards::boards(); - QValueList<KURL>::iterator it; + QList<KUrl> boards = FavoriteBoards::boards(); + QList<KUrl>::iterator it; - for ( it = boards.begin(); it != boards.end(); ++it ) { - QString boardURL = ( *it ).prettyURL(); - QString boardName = Kita::BoardManager::boardName( boardURL ); + for (it = boards.begin(); it != boards.end(); ++it) { + QString boardUrl = (*it).prettyUrl(); + QString boardName = BoardManager::boardName(boardUrl); - Kita::ListViewItem* item = new Kita::ListViewItem( m_favorites, 0, boardName, boardURL ); - item->setColor( m_textColor, m_baseColor ); + new ListViewItem(m_favorites, QStringList() << boardName << boardUrl); } } -void KitaBBSView::loadBoard( QListViewItem* item ) +void BBSView::loadBoard(QTreeWidgetItem* item) { - if ( ! item ) return ; + if (! item) return ; - QString boardName = item->text( 0 ); - QString boardURL = Kita::BoardManager::boardURL( item->text( 1 ) ); + QString boardName = item->text(0); + QString boardUrl = BoardManager::boardUrl(item->text(1)); - if ( boardURL.isEmpty() ) { + if (boardUrl.isEmpty()) { return ; } - ViewMediator::getInstance()->openBoard( boardURL ); + ViewMediator::getInstance()->openBoard(boardUrl); } -void KitaBBSView::setFont( const QFont& font ) +void BBSView::setFont(const QFont& font) { - m_boardList->setFont( font ); - SearchCombo->setFont( font ); + m_boardList->setFont(font); + searchCombo->setFont(font); } /* public slot :*/ /* virtual */ -void KitaBBSView::setFocus() +void BBSView::setFocus() { m_boardList->setFocus(); } -void KitaBBSView::slotContextMenuRequested( QListViewItem* item, const QPoint& point, int ) +void BBSView::slotMenuOpenWithBrowser() { - enum { - Menu_OpenWithBrowser, - Menu_CopyURL, - Menu_CopyTitleAndURL, - Menu_AddToFavorites, - Menu_RemoveFromFavorites - }; + QTreeWidgetItem* item = m_boardList->currentItem(); + QString boardName = item->text(0); + KUrl boardUrl = item->text(1); + KRun::runUrl(boardUrl, "text/html", 0); +} - if ( item == 0 ) { - return ; +void BBSView::contextMenuEvent(QContextMenuEvent* e) +{ + QPoint point = e->globalPos(); + QTreeWidgetItem* item + = m_boardList->itemAt(m_boardList->viewport()->mapFromGlobal(point)); + if (item == 0) { + return; } - KPopupMenu popup( 0 ); - popup.insertItem( i18n( "Open with Web Browser" ), Menu_OpenWithBrowser ); - popup.insertItem( i18n( "Copy URL" ), Menu_CopyURL ); - popup.insertItem( i18n( "Copy title and URL" ), Menu_CopyTitleAndURL ); - if ( item->parent() == m_favorites ) { - popup.insertItem( i18n( "Remove from Favorites" ), Menu_RemoveFromFavorites ); - } else { - popup.insertItem( i18n( "Add to Favorites" ), Menu_AddToFavorites ); - } + KMenu popup(0); + popup.addAction(m_openWithBrowserAct); + popup.addAction(m_copyUrlAct); + popup.addAction(m_copyTitleAndUrlAct); + item->parent() == m_favorites ? popup.addAction(m_removeFromFavoritesAct) + : popup.addAction(m_addToFavoritesAct); - QString boardName = item->text( 0 ); - KURL boardURL = item->text( 1 ); - KURL boardURL_upToDate = Kita::BoardManager::boardURL( boardURL ); + QString boardName = item->text(0); + KUrl boardUrl = item->text(1); + KUrl boardUrl_upToDate = BoardManager::boardUrl(boardUrl); QClipboard* clipboard = QApplication::clipboard(); - switch ( popup.exec( point ) ) { - case Menu_OpenWithBrowser: - KRun::runURL( boardURL, "text/html" ); - break; - case Menu_CopyURL: - clipboard->setText( boardURL_upToDate.prettyURL(), QClipboard::Clipboard ); - clipboard->setText( boardURL_upToDate.prettyURL(), QClipboard::Selection ); - break; - case Menu_CopyTitleAndURL: - clipboard->setText( boardName + "\n" + boardURL_upToDate.prettyURL(), QClipboard::Clipboard ); - clipboard->setText( boardName + "\n" + boardURL_upToDate.prettyURL(), QClipboard::Selection ); - break; - case Menu_AddToFavorites: - Kita::FavoriteBoards::append( boardURL_upToDate ); - break; - case Menu_RemoveFromFavorites: - Kita::FavoriteBoards::remove( boardURL ); - break; - default: - break; + QAction *action = popup.exec(point); + if (action == m_openWithBrowserAct) { + KRun::runUrl(boardUrl, "text/html", this); + } else if (action == m_copyUrlAct) { + clipboard->setText(boardUrl_upToDate.prettyUrl(), + QClipboard::Clipboard); + clipboard->setText(boardUrl_upToDate.prettyUrl(), + QClipboard::Selection); + } else if (action == m_copyTitleAndUrlAct) { + clipboard->setText(boardName + '\n' + boardUrl_upToDate.prettyUrl(), + QClipboard::Clipboard); + clipboard->setText(boardName + '\n' + boardUrl_upToDate.prettyUrl(), + QClipboard::Selection); + } else if (action == m_addToFavoritesAct) { + FavoriteBoards::append(boardUrl_upToDate); + } else if (action == m_removeFromFavoritesAct) { + FavoriteBoards::remove(boardUrl); } } -void KitaBBSView::slotMouseButtonClicked( int button, QListViewItem* item ) +void BBSView::loadOpened() { - if ( ! item ) return ; + QString configPath + = KStandardDirs::locateLocal("appdata", "board_state.conf"); + KConfig config(configPath); - QString boardName = item->text( 0 ); - QString boardURL = Kita::BoardManager::boardURL( item->text( 1 ) ); - if ( boardURL.isEmpty() ) { - m_boardList->setOpen( item, !item->isOpen() ); - return ; - } + QStringList openedList + = config.group("").readEntry("Opened", QStringList()); - switch ( button ) { - case MidButton: - ViewMediator::getInstance()->openBoard( boardURL ); - break; - case LeftButton: - ViewMediator::getInstance()->openBoard( boardURL ); - break; - } -} - -void KitaBBSView::loadOpened() -{ - QString configPath = locateLocal( "appdata", "board_state.conf" ); - KConfig config( configPath ); - - QStringList openedList = config.readListEntry( "Opened" ); - - QListViewItem* item; - for ( item = m_boardList->firstChild(); item; item = item->nextSibling() ) { - QString categoryName = item->text( 0 ); - if ( openedList.findIndex( categoryName ) != -1 ) { - item->setOpen( TRUE ); + for (int i = 0, j = m_boardList->topLevelItemCount(); i < j; i++) { + QTreeWidgetItem* item = m_boardList->topLevelItem(i); + QString categoryName = item->text(0); + if (openedList.indexOf(categoryName) != -1) { + item->setExpanded(true); } } } -void KitaBBSView::saveOpened() +void BBSView::saveOpened() { QStringList openedList; - QListViewItem* item; - - for ( item = m_boardList->firstChild(); item; item = item->nextSibling() ) { - QString categoryName = item->text( 0 ); - if ( item->isOpen() ) { + for (int i = 0, j = m_boardList->topLevelItemCount(); i < j; i++) { + QTreeWidgetItem* item = m_boardList->topLevelItem(i); + QString categoryName = item->text(0); + if (item->isExpanded()) { openedList << categoryName; } } + QString configPath + = KStandardDirs::locateLocal("appdata", "board_state.conf"); + KConfig config(configPath); - QString configPath = locateLocal( "appdata", "board_state.conf" ); - KConfig config( configPath ); - - config.writeEntry( "Opened", openedList ); + config.group("").writeEntry("Opened", openedList); } /** @@ -594,24 +545,48 @@ * * @param str string to search. */ -void KitaBBSView::filter( const QString& str ) +void BBSView::filter(const QString& str) { - QListViewItem* categoryItem; - QListViewItem* boardItem; - for ( categoryItem = m_boardList->firstChild(); categoryItem; categoryItem = categoryItem->nextSibling() ) { - bool matched = FALSE; + for (int i = 0, j = m_boardList->topLevelItemCount(); i < j; i++) { + bool matched = false; + QTreeWidgetItem* categoryItem = m_boardList->topLevelItem(i); - for ( boardItem = categoryItem->firstChild(); boardItem; boardItem = boardItem->nextSibling() ) { - QString boardName = boardItem->text( 0 ); - if ( boardName.contains( str ) ) { - boardItem->setVisible( TRUE ); - matched = TRUE; + for (int k = 0, l = categoryItem->childCount(); k < l; k++) { + QTreeWidgetItem* boardItem = categoryItem->child(k); + QString boardName = boardItem->text(0); + if (boardName.contains(str, Qt::CaseInsensitive)) { + boardItem->setHidden(false); + matched = true; } else { - boardItem->setVisible( FALSE ); + boardItem->setHidden(true); } } + categoryItem->setHidden(!matched); + } +} - categoryItem->setVisible( matched ); + +void BBSView::mousePressEvent(QMouseEvent *e) +{ + QTreeWidgetItem* item = m_boardList->itemAt(e->pos()); + if (!item) return; + + QString boardName = item->text(0); + QString boardUrl = BoardManager::boardUrl(item->text(1)); + if (boardUrl.isEmpty()) { + item->setExpanded(!item->isExpanded()); + return ; } + + switch (e->button()) { + case Qt::MidButton: + ViewMediator::getInstance()->openBoard(boardUrl); + break; + case Qt::LeftButton: + ViewMediator::getInstance()->openBoard(boardUrl); + break; + default: + return; + } } Modified: kita/trunk/kita/src/bbsview.h =================================================================== --- kita/trunk/kita/src/bbsview.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/bbsview.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,78 +7,80 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#ifndef KITABBSVIEW_H +#define KITABBSVIEW_H -#ifndef _KITABBSVIEW_H_ -#define _KITABBSVIEW_H_ +#include <QtCore/QList> +#include <QtGui/QWidget> -#include <kparts/browserextension.h> - -#include <qwidget.h> - -class KURL; -class KListView; -class QCp932Codec; +class QHBoxLayout; class QSpacerItem; -class QListViewItem; -class QComboBox; +class QTreeWidget; +class QTreeWidgetItem; class QVBoxLayout; -class QHBoxLayout; +class KAction; +class KComboBox; +class KUrl; + namespace Kita { class Board; class Category; class ListViewItem; -} -/** - * - * @author Hideki Ikemoto <ikemo****@users*****> - **/ -class KitaBBSView : public QWidget -{ - Q_OBJECT - Kita::ListViewItem* m_favorites; + /** + * + * @author Hideki Ikemoto <ikemo****@users*****> + **/ + class BBSView : public QWidget + { + Q_OBJECT + ListViewItem* m_favorites; - /* list color */ - QColor m_textColor; - QColor m_baseColor; - QColor m_backColor; - QColor m_altColor; + QList<Category> getCategoryList(const QString& html) const; - QValueList<Kita::Category> getCategoryList( const QString& html ) const; + void saveOpened(); + KComboBox* searchCombo; + QTreeWidget* m_boardList; + void contextMenuEvent(QContextMenuEvent* e); - void saveOpened(); - QComboBox* SearchCombo; - KListView* m_boardList; + protected: + QVBoxLayout* bbsViewBaseLayout; + QHBoxLayout* layout10; + QSpacerItem* spacer2; -protected: - QVBoxLayout* KitaBBSViewBaseLayout; - QHBoxLayout* layout10; - QSpacerItem* spacer2; + private slots: + void loadBoard(QTreeWidgetItem* item); + void refreshFavoriteBoards(); + void filter(const QString& str); + void slotMenuOpenWithBrowser(); -private slots: - void loadBoard( QListViewItem* item ); - void slotContextMenuRequested( QListViewItem*, const QPoint&, int ); - void slotMouseButtonClicked( int, QListViewItem* ); - void refreshFavoriteBoards(); - void filter( const QString& str ); + public: + explicit BBSView(QWidget *parent); + ~BBSView(); -public: - KitaBBSView( QWidget *parent, const char *name = 0 ); - ~KitaBBSView(); + void loadOpened(); - void loadOpened(); + public slots: + void updateBoardList(); + void showBoardList(); + void setFont(const QFont& font); + virtual void setFocus(); -public slots: - void updateBoardList(); - void showBoardList(); - void setFont( const QFont& font ); - virtual void setFocus(); + private: + void loadExtBoard(); + bool downloadBoardList(); + void mousePressEvent(QMouseEvent *e); + BBSView(const BBSView&); + BBSView& operator=(const BBSView&); -private: - void loadExtBoard(); - bool downloadBoardList(); -}; + KAction* m_openWithBrowserAct; + KAction* m_copyUrlAct; + KAction* m_copyTitleAndUrlAct; + KAction* m_removeFromFavoritesAct; + KAction* m_addToFavoritesAct; + }; +} #endif Modified: kita/trunk/kita/src/boardtabwidget.cpp =================================================================== --- kita/trunk/kita/src/boardtabwidget.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/boardtabwidget.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,163 +10,151 @@ #include "boardtabwidget.h" -#include "viewmediator.h" +#include <QtGui/QApplication> +#include <QtGui/QClipboard> -#include "libkita/boardmanager.h" - -#include <kpopupmenu.h> -#include <kdebug.h> -#include <klocale.h> -#include <krun.h> -#include <kstdaccel.h> #include <kaction.h> +#include <kactioncollection.h> +#include <kmenu.h> +#include <krun.h> +#include <kstandardshortcut.h> -#include <qapplication.h> -#include <qclipboard.h> +#include "boardview.h" +#include "favoritelistview.h" +#include "viewmediator.h" +#include "libkita/boardmanager.h" +using namespace Kita; -KitaBoardTabWidget::KitaBoardTabWidget( QWidget* parent, const char* name, WFlags f ) - : KitaTabWidgetBase( parent, name, f ) +BoardTabWidget::BoardTabWidget(QWidget* parent) : TabWidgetBase(parent) { - setXMLFile( "boardtabwidgetui.rc" ); + setXMLFile("boardtabwidgetui.rc"); - setTabBar( new SubjectTabBar( this ) ); + setTabBar(new SubjectTabBar(this)); - FavoriteListView* favoriteList = new FavoriteListView( this, "favoriteTab" ); - ViewMediator::getInstance()->setFavoriteListView( favoriteList ); - addTab( favoriteList, i18n( "Favorite" ) ); + FavoriteListView* favoriteList = new FavoriteListView(this); + favoriteList->setObjectName("favoriteTab"); + ViewMediator::getInstance()->setFavoriteListView(favoriteList); + addTab(favoriteList, i18nc("@title:tab Favorite boards", "Favorite")); setupActions(); } -KitaBoardTabWidget::~KitaBoardTabWidget() +BoardTabWidget::~BoardTabWidget() {} -void KitaBoardTabWidget::updateBoardView( const KURL& datURL ) +void BoardTabWidget::updateBoardView(const KUrl& datUrl) { - for( int i=0; i<count(); i++) { - KitaBoardView* view = isSubjectView( page( i ) ); - if( view ) { - view->slotUpdateSubject( datURL ); + for(int i=0; i<count(); i++) { + BoardView* view = isSubjectView(widget(i)); + if(view) { + view->slotUpdateSubject(datUrl); } } } /* public slots */ -void KitaBoardTabWidget::loadBoard( const KURL& boardURL ) +void BoardTabWidget::loadBoard(const KUrl& boardUrl) { - KitaBoardView * view = findView( boardURL ); - QString boardName = Kita::BoardManager::boardName( boardURL ); - if ( !view ) { - view = createView( boardName ); + BoardView * view = findView(boardUrl); + QString boardName = BoardManager::boardName(boardUrl); + if (!view) { + view = createView(boardName); } - if ( view ) { - showPage( view ); - view->loadBoard( boardURL ); + if (view) { + setCurrentWidget(view); + view->loadBoard(boardUrl); } } -/* create KitaBoardView */ /* private */ -KitaBoardView* KitaBoardTabWidget::createView( QString label ) +/* create BoardView */ /* private */ +BoardView* BoardTabWidget::createView(QString label) { - KitaBoardView * view = new KitaBoardView( this ); - if ( view ) { - insertTab( view, label, count() - 1 ); + BoardView * view = new BoardView(this); + if (view) { + insertTab(count() - 1, view, label); } return view; } /* private */ -KitaBoardView* KitaBoardTabWidget::findView( const KURL& boardURL ) +BoardView* BoardTabWidget::findView(const KUrl& boardUrl) { int max = count() - 1; - if ( max <= 0 ) return NULL; + if (max <= 0) return 0; int i = 0; - while ( i < max ) { - KitaBoardView * view = isSubjectView( page ( i ) ); - if ( view && view->boardURL() == boardURL ) return view; + while (i < max) { + BoardView * view = isSubjectView(widget(i)); + if (view && view->boardUrl() == boardUrl) return view; i++; } - return NULL; + return 0; } /* protected */ /* virtual */ -void KitaBoardTabWidget::deleteWidget( QWidget* w ) +void BoardTabWidget::deleteWidget(QWidget* w) { - KitaBoardView * view = isSubjectView( w ); - if ( !view ) return ; - removePage( view ); + BoardView * view = isSubjectView(w); + if (!view) return ; + removePage(view); delete view; } /* private */ -KitaBoardView* KitaBoardTabWidget::isSubjectView( QWidget* w ) +BoardView* BoardTabWidget::isSubjectView(QWidget* w) { - KitaBoardView * view = NULL; - if ( w ) { - if ( w->isA( "KitaBoardView" ) ) view = static_cast< KitaBoardView* >( w ); - } - - return view; + return qobject_cast<BoardView*>(w); } /*--------------------------------*/ -/* KitaBoardView actions */ +/* BoardView actions */ /* private */ -void KitaBoardTabWidget::setupActions() +void BoardTabWidget::setupActions() { - new KAction( i18n( "Find" ), - "find", - KStdAccel::find(), - this, - SLOT( slotFocusSearchCombo() ), - actionCollection(), - "subjectview_find" ); + KAction* find_action = actionCollection()->addAction("subjectview_find"); + find_action->setText(i18n("Find")); + find_action->setShortcut(KStandardShortcut::find()); + connect(find_action, SIGNAL(triggered()), this, SLOT(slotFocusSearchCombo())); - new KAction( i18n( "Reload" ), - "reload", - KStdAccel::reload(), - this, - SLOT( slotReloadButton() ), - actionCollection(), - "subjectview_reload" ); + KAction* reload_action = actionCollection()->addAction("subjectview_reload"); + reload_action->setText(i18nc("@action:button Reload the subject view", + "Reload")); + reload_action->setShortcut(KStandardShortcut::reload()); + connect(reload_action, SIGNAL(triggered()), this, SLOT(slotReloadButton())); - new KAction( i18n( "Show Old Logs" ), - 0, - this, - SLOT( slotShowOldLogs() ), - actionCollection(), - "subjectview_showoldlogs" ); + KAction* showoldlogs_action = actionCollection()->addAction("subjectview_showoldlogs"); + showoldlogs_action->setText(i18n("Show Old Logs")); + connect(showoldlogs_action, SIGNAL(triggered()), this, SLOT(slotShowOldLogs())); } /* public slot */ -void KitaBoardTabWidget::slotReloadButton() +void BoardTabWidget::slotReloadButton() { - KitaBoardView * view = isSubjectView( currentPage() ); - if ( view ) view->reloadSubject(); + BoardView * view = isSubjectView(currentWidget()); + if (view) view->reloadSubject(); } /* public slot */ -void KitaBoardTabWidget::slotFocusSearchCombo() +void BoardTabWidget::slotFocusSearchCombo() { - KitaBoardView * view = isSubjectView( currentPage() ); - if ( view ) view->slotFocusSearchCombo(); + BoardView * view = isSubjectView(currentWidget()); + if (view) view->slotFocusSearchCombo(); } /* public slot */ -void KitaBoardTabWidget::slotShowOldLogs( int idx ) +void BoardTabWidget::slotShowOldLogs(int idx) { - KitaBoardView * view; - if ( idx == -1 ) view = isSubjectView( currentPage() ); - else view = isSubjectView( page( idx ) ); - if ( view ) view->toggleShowOldLogs(); + BoardView * view; + if (idx == -1) view = isSubjectView(currentWidget()); + else view = isSubjectView(widget(idx)); + if (view) view->toggleShowOldLogs(); } /*---------------------------------------------------------------------*/ @@ -175,11 +163,24 @@ -SubjectTabBar::SubjectTabBar( QWidget* parent, const char* name ) - : KTabBar( parent, name ) +SubjectTabBar::SubjectTabBar(QWidget* parent) + : KTabBar(parent) { - connect( this, SIGNAL( contextMenu( int, const QPoint& ) ), - SLOT( showPopupMenu( int, const QPoint& ) ) ); + connect(this, SIGNAL(contextMenu(int, const QPoint&)), + SLOT(showPopupMenu(int, const QPoint&))); + m_closeAct = new KAction(i18nc("@action:inmenu", "Close This Tab"), this); + m_closeOtherAct + = new KAction(i18nc("@action:inmenu", "Close Other Tabs"), this); + m_closeRightAct + = new KAction(i18nc("@action:inmenu", "Close Right Tabs"), this); + m_closeLeftAct + = new KAction(i18nc("@action:inmenu", "Close Left Tabs"), this); + m_showOldLogsAct + = new KAction(i18nc("@action:inmenu", "Show Old Logs"), this); + m_openBrowserAct + = new KAction(i18nc("@action:inmenu", "Open with Web Browser"), this); + m_copyTitleAct + = new KAction(i18nc("@action:inmenu", "Copy Title and URL"), this); } SubjectTabBar::~SubjectTabBar() @@ -187,64 +188,53 @@ /* private */ /* virtual */ -void SubjectTabBar::showPopupMenu( int idx, const QPoint& global ) +void SubjectTabBar::showPopupMenu(int idx, const QPoint& global) { - enum{ - MENU_CLOSE, - MENU_CLOSEOTHER, - MENU_CLOSELEFT, - MENU_CLOSERIGHT, - MENU_OPENBROWSER, - MENU_COPYTITLE, - MENU_SHOWTITLEIMG, - MENU_SHOWOLDLOGS - }; - - KitaBoardTabWidget* tabwidget = static_cast<KitaBoardTabWidget*>( parentWidget() ); + BoardTabWidget* tabwidget = static_cast<BoardTabWidget*>(parentWidget()); KActionCollection * collection = tabwidget->actionCollection(); - if ( QString::compare( tabwidget->page( idx ) ->name(), "favoriteTab" ) == 0 ) return ; + if (QString::compare(tabwidget->widget(idx)->objectName(), "favoriteTab") + == 0) + return; + KMenu popup(this); + popup.addAction(m_closeAct); + popup.addAction(collection->action("tab_prevtab")); + popup.addAction(collection->action("tab_nexttab")); + popup.addSeparator(); - KPopupMenu* popup = new KPopupMenu( this ); - popup->clear(); + popup.addAction(m_closeOtherAct); + popup.addAction(m_closeRightAct); + popup.addAction(m_closeLeftAct); + popup.addAction(collection->action("tab_closealltab")); + popup.addSeparator(); - popup->insertItem( i18n( "Close this tab" ) , MENU_CLOSE ); - collection->action( "tab_prevtab" ) ->plug( popup ); - collection->action( "tab_nexttab" ) ->plug( popup ); - popup->insertSeparator(); + popup.addAction(m_showOldLogsAct); + popup.addAction(m_openBrowserAct); + popup.addAction(m_copyTitleAct); + popup.addSeparator(); - popup->insertItem( i18n( "Close Other Tabs" ) , MENU_CLOSEOTHER ); - popup->insertItem( i18n( "Close right tabs" ) , MENU_CLOSERIGHT ); - popup->insertItem( i18n( "Close left tabs" ) , MENU_CLOSELEFT ); - collection->action( "tab_closealltab" ) ->plug( popup ); + popup.addAction(collection->action("tab_configkeys")); - popup->insertSeparator(); - popup->insertItem( i18n( "Show Old Logs" ) , MENU_SHOWOLDLOGS ); - popup->insertItem( i18n( "Open with Web Browser" ), MENU_OPENBROWSER ); - popup->insertItem( i18n( "Copy title and URL" ), MENU_COPYTITLE ); - - popup->insertSeparator(); - collection->action( "tab_configkeys" ) ->plug( popup ); - - KitaBoardView* subjectView = static_cast<KitaBoardView *>( tabwidget->page( idx ) ); + BoardView* subjectView = static_cast<BoardView *>(tabwidget->widget(idx)); QClipboard* clipboard = QApplication::clipboard(); - int ret = popup->exec( global ); - delete popup; - - switch ( ret ) { - case MENU_CLOSE: tabwidget->slotCloseTab( idx ); break; - case MENU_CLOSEOTHER: tabwidget->slotCloseOtherTab( idx ); break; - case MENU_CLOSERIGHT: tabwidget->slotCloseRightTab( idx ); break; - case MENU_CLOSELEFT: tabwidget->slotCloseLeftTab( idx ); break; - case MENU_SHOWOLDLOGS: tabwidget->slotShowOldLogs( idx ); break; - case MENU_OPENBROWSER: - KRun::runURL( subjectView->boardURL(), "text/html" ); - break; - case MENU_COPYTITLE: - QString cliptxt = Kita::BoardManager::boardName( subjectView->boardURL() ) + "\n" + subjectView->boardURL().prettyURL(); - clipboard->setText( cliptxt , QClipboard::Clipboard ); - clipboard->setText( cliptxt , QClipboard::Selection ); - break; + QAction* action = popup.exec(global); + if (action == m_closeAct) { + tabwidget->slotCloseTab(idx); + } else if (action == m_closeOtherAct) { + tabwidget->slotCloseOtherTab(idx); + } else if (action == m_closeRightAct) { + tabwidget->slotCloseRightTab(idx); + } else if (action == m_closeLeftAct) { + tabwidget->slotCloseLeftTab(idx); + } else if (action == m_showOldLogsAct) { + tabwidget->slotShowOldLogs(idx); + } else if (action == m_openBrowserAct) { + KRun::runUrl(subjectView->boardUrl(), "text/html", this); + } else if (action == m_copyTitleAct) { + QString cliptxt = BoardManager::boardName(subjectView->boardUrl()) + + '\n' + subjectView->boardUrl().prettyUrl(); + clipboard->setText(cliptxt , QClipboard::Clipboard); + clipboard->setText(cliptxt , QClipboard::Selection); } } Modified: kita/trunk/kita/src/boardtabwidget.h =================================================================== --- kita/trunk/kita/src/boardtabwidget.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/boardtabwidget.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,63 +7,76 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITABOARDTABWIDGET_H #define KITABOARDTABWIDGET_H +#include "ktabbar.h" #include "kitaui/tabwidgetbase.h" -#include "favoritelistview.h" -#include "boardview.h" +class KAction; -/** - @ author Hideki Ikemoto -*/ -class KitaBoardTabWidget : public KitaTabWidgetBase -{ - Q_OBJECT +namespace Kita { -public: - KitaBoardTabWidget( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); - ~KitaBoardTabWidget(); + class BoardView; - void updateBoardView( const KURL& datURL ); -public slots: - void loadBoard( const KURL& ); + /** + * @author Hideki Ikemoto + */ + class BoardTabWidget : public TabWidgetBase + { + Q_OBJECT -private: - KitaBoardView* createView( QString label ); - KitaBoardView* findView( const KURL& boardURL ); - KitaBoardView* isSubjectView( QWidget* w ); + public: + explicit BoardTabWidget(QWidget* parent = 0); + ~BoardTabWidget(); -protected: - virtual void deleteWidget( QWidget* w ); + void updateBoardView(const KUrl& datUrl); + public slots: + void loadBoard(const KUrl&); - /* tab actions */ + private: + BoardView* createView(QString label); + BoardView* findView(const KUrl& boardUrl); + BoardView* isSubjectView(QWidget* w); -private: - void setupActions(); + protected: + virtual void deleteWidget(QWidget* w); -public slots: - void slotReloadButton(); - void slotFocusSearchCombo(); - void slotShowOldLogs( int idx = -1 ); -}; + /* tab actions */ + + private: + void setupActions(); + + public slots: + void slotReloadButton(); + void slotFocusSearchCombo(); + void slotShowOldLogs(int idx = -1); + }; + /*--------------------------------------------------*/ -class SubjectTabBar : public KTabBar -{ - Q_OBJECT + class SubjectTabBar : public KTabBar + { + Q_OBJECT -public: - SubjectTabBar( QWidget* parent = 0, const char* name = 0 ); - ~SubjectTabBar(); + public: + explicit SubjectTabBar(QWidget* parent = 0); + ~SubjectTabBar(); -public slots: - virtual void showPopupMenu( int idx, const QPoint& global ); + public slots: + virtual void showPopupMenu(int idx, const QPoint& global); -}; + private: + KAction* m_closeAct; + KAction* m_closeOtherAct; + KAction* m_closeRightAct; + KAction* m_closeLeftAct; + KAction* m_showOldLogsAct; + KAction* m_openBrowserAct; + KAction* m_copyTitleAct; + }; +} #endif Deleted: kita/trunk/kita/src/boardtabwidgetui.rc =================================================================== --- kita/trunk/kita/src/boardtabwidgetui.rc 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/boardtabwidgetui.rc 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,15 +0,0 @@ -<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui name="kitaSubjectTabWidget" version="1"> -<MenuBar> - <Menu name="board"><text>&Board</text> - <Action name="tab_closetab" /> - <Separator/> - <Action name="subjectview_reload" /> - <Action name="subjectview_showoldlogs" /> - <Action name="subjectview_showtitleimg" /> - <Action name="subjectview_newthread" /> - <Separator/> - <Action name="tab_configkeys" /> - </Menu> -</MenuBar> -</kpartgui> Copied: kita/trunk/kita/src/boardtabwidgetui.rc (from rev 2558, kita/branches/KITA-KDE4/kita/src/boardtabwidgetui.rc) =================================================================== --- kita/trunk/kita/src/boardtabwidgetui.rc (rev 0) +++ kita/trunk/kita/src/boardtabwidgetui.rc 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,15 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="kitaSubjectTabWidget" version="1"> +<MenuBar> + <Menu name="board"><text>Board</text> + <Action name="tab_closetab" /> + <Separator/> + <Action name="subjectview_reload" /> + <Action name="subjectview_showoldlogs" /> + <Action name="subjectview_showtitleimg" /> + <Action name="subjectview_newthread" /> + <Separator/> + <Action name="tab_configkeys" /> + </Menu> +</MenuBar> +</kpartgui> Modified: kita/trunk/kita/src/boardview.cpp =================================================================== --- kita/trunk/kita/src/boardview.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/boardview.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,125 +10,86 @@ #include "boardview.h" -// include files for Qt -#include <qtoolbutton.h> -#include <qtextbrowser.h> -#include <qtextcodec.h> -#include <qregexp.h> -#include <qfile.h> -#include <qclipboard.h> -#include <qapplication.h> -#include <qdatetime.h> -#include <qlabel.h> -#include <qmessagebox.h> -#include <qcombobox.h> -#include <qheader.h> +#include <QtCore/QDateTime> +#include <QtCore/QList> +#include <QtGui/QApplication> +#include <QtGui/QMouseEvent> -// kdelibs/kio -#include <kio/slaveconfig.h> -#include <kio/netaccess.h> - -// include files for KDE -#include <kwin.h> -#include <kfilterdev.h> -#include <klistview.h> -#include <kiconloader.h> -#include <klocale.h> -#include <kpopupmenu.h> -#include <krun.h> -#include <kdebug.h> +#include <kaction.h> #include <kconfig.h> +#include <kmessagebox.h> #include <kstandarddirs.h> -#include "libkita/thread.h" -#include "libkita/kita_misc.h" -#include "libkita/favoritethreads.h" -#include "libkita/datmanager.h" -#include "libkita/threadindex.h" -#include "libkita/boardmanager.h" -#include "libkita/threadinfo.h" -#include "libkita/config_xt.h" - -#include "threadproperty.h" +#include "boardtabwidget.h" +#include "threadlistheaderview.h" #include "threadlistviewitem.h" #include "viewmediator.h" -#include "boardtabwidget.h" +#include "libkita/boardmanager.h" +#include "libkita/datmanager.h" +#include "libkita/globalconfig.h" +#include "libkita/kita_misc.h" +#include "libkita/thread.h" -KitaBoardView::KitaBoardView( KitaBoardTabWidget* parent, const char* name ) - : Kita::ThreadListView( parent, name ) +using namespace Kita; + +BoardView::BoardView(BoardTabWidget* parent) : ThreadListView(parent) { init(); m_parent = parent; - closeButton->setEnabled( TRUE ); + closeButton->setEnabled(true); - connect( subjectList, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ), - SLOT( slotContextMenuRequested( QListViewItem*, const QPoint&, int ) ) ); - connect( subjectList, SIGNAL( returnPressed( QListViewItem* ) ), - SLOT( loadThread( QListViewItem* ) ) ); - connect( ReloadButton, SIGNAL( clicked() ), - SLOT( reloadSubject() ) ); + connect(reloadButton, SIGNAL(clicked()), + SLOT(reloadSubject())); - connect( closeButton, SIGNAL( clicked() ), - SLOT( slotCloseButton() ) ); + connect(closeButton, SIGNAL(clicked()), + SLOT(slotCloseButton())); - QHeader* header = subjectList->header(); - connect( header, SIGNAL( sizeChange( int, int, int ) ), - SLOT( slotSizeChange( int, int, int ) ) ); + //connect(subjectList, SIGNAL(columnResized(int, int, int)), + // SLOT(slotSizeChange(int, int, int))); TODO - header->installEventFilter( this ); loadLayout(); loadHeaderOnOff(); + + m_deleteLogAct->setVisible(true); } -KitaBoardView::~KitaBoardView() -{} - /* public */ -void KitaBoardView::init() +void BoardView::init() { m_unreadNum = 0; m_readNum = 0; m_newNum = 0; - m_showOldLogs = FALSE; - m_enableSizeChange = FALSE; + m_showOldLogs = false; + m_enableSizeChange = false; } -void KitaBoardView::reloadSubject() +void BoardView::reloadSubject() { - if ( ! m_boardURL.isEmpty() ) { - loadBoard( m_boardURL ); + if (!m_boardUrl.isEmpty()) { + loadBoard(m_boardUrl); } } /* private slot */ -void KitaBoardView::slotCloseButton() +void BoardView::slotCloseButton() { m_parent->slotCloseCurrentTab(); } -const KURL KitaBoardView::boardURL() +const KUrl BoardView::boardUrl() { - return m_boardURL; + return m_boardUrl; } -void KitaBoardView::toggleShowOldLogs() +void BoardView::toggleShowOldLogs() { m_showOldLogs = !m_showOldLogs; - loadBoard( m_boardURL, FALSE ); + loadBoard(m_boardUrl, false); } -void KitaBoardView::loadThread( QListViewItem* item ) -{ - if ( ! item ) return ; - - KURL datURL = item->text( Col_DatURL ); - - ViewMediator::getInstance()->openThread( datURL ); -} - enum { Thread_Old, Thread_Readed, @@ -138,401 +99,288 @@ Thread_HasUnread }; -void KitaBoardView::loadBoard( const KURL& url, bool online ) +void BoardView::loadBoard(const KUrl& url, bool online) { - setActiveWindow(); - topLevelWidget() ->raise(); - m_enableSizeChange = FALSE; + activateWindow(); + topLevelWidget()->raise(); + m_enableSizeChange = false; // reset member variables. // FIXME: FavoriteListView::update() { m_hitList.clear(); m_nextHitIndex = 0; - m_prevquery = ""; + m_prevquery = QStringList(); } - m_boardURL = url; + m_boardUrl = url; m_unreadNum = 0; m_readNum = 0; m_newNum = 0; /* get list of pointers of Thread classes */ - QPtrList<Kita::Thread> oldLogList; - QPtrList<Kita::Thread> threadList; - Kita::BoardManager::getThreadList( m_boardURL, m_showOldLogs, online, threadList, oldLogList ); + QList<Thread*> oldLogList; + QList<Thread*> threadList; + BoardManager::getThreadList( + m_boardUrl, m_showOldLogs, online, threadList, oldLogList); // reset list - subjectList->clear(); + subjectList->clearContents(); QDateTime current = QDateTime::currentDateTime(); - unsigned int countNew = threadList.count(); - unsigned int countOld = oldLogList.count(); - for ( unsigned i = 0; i < countNew + countOld; i++ ) { - - Kita::Thread* thread = i < countNew ? threadList.at( i ) : oldLogList.at( i - countNew ); - KURL datURL = thread->datURL(); - Kita::ThreadListViewItem* item = new Kita::ThreadListViewItem( subjectList ); - int id = ( i < countNew ? i + 1 : 0 ); + int countNew = threadList.count(); + int countOld = oldLogList.count(); + int count = countNew + countOld; + subjectList->setRowCount(count); + subjectList->setSortingEnabled(false); + for (int i = 0; i < count; i++) { + Thread* thread + = i < countNew ? threadList.at(i) : oldLogList.at(i - countNew); + KUrl datUrl = thread->datUrl(); + for (int j = 0, k = subjectList->columnCount(); j < k; j++) { + ThreadListViewItem* item = new ThreadListViewItem(j); + subjectList->setItem(i, j, item); + } + int id = (i < countNew ? i + 1 : 0); int order = i + 1; - updateListViewItem( item, datURL, current, id, order ); + updateRow(i, datUrl, current, id, order); } + subjectList->setSortingEnabled(true); - if ( HideButton->isOn() ) { - HideButton->toggle(); + if (hideButton->isChecked()) { + hideButton->toggle(); } - ViewMediator::getInstance()->setMainURLLine( m_boardURL ); + ViewMediator::getInstance()->setMainUrlLine(m_boardUrl); - switch ( Kita::Config::listSortOrder() ) { - case Kita::Config::EnumListSortOrder::Mark: - subjectList->setSorting( Col_Mark ); + switch (GlobalConfig::listSortOrder()) { + case GlobalConfig::EnumListSortOrder::Mark: + subjectList->sortItems(ColumnMark); break; - case Kita::Config::EnumListSortOrder::ID: - subjectList->setSorting( Col_ID ); + case GlobalConfig::EnumListSortOrder::ID: + subjectList->sortItems(ColumnId); break; default: // do nothing break; } - subjectList->setSelected( subjectList->firstChild(), TRUE ); subjectList->setFocus(); - UpdateKindLabel(); + updateKindLabel(); /* restore column size */ loadLayout(); loadHeaderOnOff(); - m_enableSizeChange = TRUE; + m_enableSizeChange = true; + for (int i = 0, j = subjectList->columnCount(); i < j; i++) { + subjectList->resizeColumnToContents(i); + } + for (int i = 0, j = subjectList->rowCount(); i < j; i++) { + subjectList->resizeRowToContents(i); + } } /* public slot */ /* virtual */ -void KitaBoardView::setFocus() +void BoardView::setFocus() { subjectList->setFocus(); } /* public slot */ -void KitaBoardView::slotFocusSearchCombo() +void BoardView::slotFocusSearchCombo() { - if ( ! SearchCombo->hasFocus() ) { - SearchCombo->setFocus(); - } else { - setFocus(); - } + searchCombo->hasFocus() ? setFocus() : searchCombo->setFocus(); } -void KitaBoardView::UpdateKindLabel() +void BoardView::updateKindLabel() { QString fmtstr; - fmtstr += QString( "<font color=#C50000>%1</font>" ).arg( m_unreadNum ); - fmtstr += QString( "/<font color=#00C200>%1</font>" ).arg( m_readNum ); - fmtstr += QString( "/<font color=#5AAAFF>%1</font>" ).arg( m_newNum ); - KindLabel->setText( fmtstr ); + fmtstr += QString("<font color=#C50000>%1</font>").arg(m_unreadNum); + fmtstr += QString("/<font color=#00C200>%1</font>").arg(m_readNum); + fmtstr += QString("/<font color=#5AAAFF>%1</font>").arg(m_newNum); + kindLabel->setText(fmtstr); } -void KitaBoardView::setFont( const QFont& font ) +void BoardView::setFont(const QFont& font) { - subjectList->setFont( font ); - SearchCombo->setFont( font ); + subjectList->setFont(font); + searchCombo->setFont(font); } -void KitaBoardView::slotUpdateSubject( const KURL& url ) +void BoardView::slotUpdateSubject(const KUrl& url) { QDateTime current = QDateTime::currentDateTime(); - KURL datURL = Kita::getDatURL( url ); - for ( QListViewItem * item = subjectList->firstChild(); item; item = item->nextSibling() ) { - if ( item->text( Col_DatURL ) == datURL.prettyURL() ) { + KUrl datUrl = getDatUrl(url); + for (int i = 0, j = subjectList->rowCount(); i < j; i++) { + if (subjectList->item(i, ColumnDatUrl)->text() == datUrl.prettyUrl()) { - switch ( item->text( Col_MarkOrder ).toInt() ) { - case Thread_Readed : - case Thread_Read : m_readNum--; break; - case Thread_New : m_newNum--; break; - case Thread_HasUnread : m_unreadNum--; break; + switch (subjectList->item(i, ColumnMarkOrder)->text().toInt()) { + case Thread_Readed: + case Thread_Read: + m_readNum--; + break; + case Thread_New: + m_newNum--; + break; + case Thread_HasUnread: + m_unreadNum--; + break; } - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread == NULL ) return ; - int id = item->text( Col_ID ).toInt(); - int order = item->text( Col_IDOrder ).toInt(); - updateListViewItem( item, datURL, current, id, order ); + Thread* thread = Thread::getByUrlNew(datUrl); + if (thread == 0) + return; + int id = subjectList->item(i, ColumnId)->text().toInt(); + int order = subjectList->item(i, ColumnIdOrder)->text().toInt(); + updateRow(i, datUrl, current, id, order); - UpdateKindLabel(); + updateKindLabel(); - return ; + return; } } } - - /* if id == 0, this thread is old thread. */ /* private */ -void KitaBoardView::updateListViewItem( QListViewItem* item, const KURL& datURL, const QDateTime& current, int id, int order ) +void BoardView::updateRow(int row, const KUrl& datUrl, + const QDateTime& current, int id, int order) { QDateTime since; - since.setTime_t( Kita::datToSince( datURL ) ); - QString threadName = Kita::DatManager::threadName( datURL ); - int resNum = Kita::DatManager::getResNum( datURL ); - int readNum = Kita::DatManager::getReadNum( datURL ); - int viewPos = Kita::DatManager::getViewPos( datURL ); - double speed = resNum / ( since.secsTo( current ) / ( 60.0 * 60.0 * 24.0 ) ); + since.setTime_t(datToSince(datUrl)); + DatManager datManager(datUrl); + QString threadName = datManager.threadName(); + int resNum = datManager.getResNum(); + int readNum = datManager.getReadNum(); + int viewPos = datManager.getViewPos(); + double speed = resNum / (since.secsTo(current) / (60.0 * 60.0 * 24.0)); - if ( id ) item->setText( Col_ID, QString().setNum( id ) ); - item->setText( Col_IDOrder, QString().setNum( order ) ); - item->setText( Col_Subject, threadName ); - item->setText( Col_ResNum, QString( "%1" ).arg( resNum, 4 ) ); - item->setText( Col_ReadNum, ( viewPos > 0 ) ? QString( "%1" ).arg( viewPos, 4 ) : QString( "" ) ); - item->setText( Col_Unread, ( viewPos > 0 && resNum > viewPos ) ? QString( "%1" ).arg( resNum - viewPos, 4 ) : QString( "" ) ); - item->setText( Col_Since, since.toString( "yy/MM/dd hh:mm" ) ); - item->setText( Col_DatURL, datURL.prettyURL() ); - item->setText( Col_Speed, QString( " %1 " ).arg( speed, 0, 'f', 2 ) ); + if (id) + subjectList->item(row, ColumnId)->setText(QString::number(id)); + subjectList->item(row, ColumnIdOrder)->setText(QString::number(order)); + subjectList->item(row, ColumnSubject)->setText(threadName); + subjectList->item(row, ColumnResNum)->setText(QString("%1").arg(resNum, 4)); + subjectList->item(row, ColumnReadNum) + ->setText((viewPos > 0) ? QString("%1").arg(viewPos, 4) : QString()); + subjectList->item(row, ColumnUnread) + ->setText((viewPos > 0 && resNum > viewPos) + ? QString("%1").arg(resNum - viewPos, 4) : QString()); + subjectList->item(row, ColumnSince) + ->setText(since.toString("yy/MM/dd hh:mm")); + subjectList->item(row, ColumnDatUrl)->setText(datUrl.prettyUrl()); + subjectList->item(row, ColumnSpeed) + ->setText(QString(" %1 ").arg(speed, 0, 'f', 2)); /* set mark order */ - if ( !id ) { /* old thread */ - - item->setText( Col_MarkOrder, QString::number( Thread_Old ) ); - } else if ( readNum > 0 && ( resNum > readNum || resNum > viewPos ) ) { /* There are new responses. */ - - item->setPixmap( Col_Mark, SmallIcon( "unread" ) ); + if (!id) { /* old thread */ + subjectList->item(row, ColumnMarkOrder) + ->setText(QString::number(Thread_Old)); + } else if (readNum > 0 && (resNum > readNum || resNum > viewPos)) { + /* There are new responses. */ + subjectList->item(row, ColumnMark)->setIcon(QIcon(SmallIcon("unread"))); m_unreadNum++; - item->setText( Col_MarkOrder, QString::number( Thread_HasUnread ) ); - - } else if ( readNum > 0 ) { /* Cache exists */ - - item->setPixmap( Col_Mark, SmallIcon( "read" ) ); + subjectList->item(row, ColumnMarkOrder) + ->setText(QString::number(Thread_HasUnread)); + } else if (readNum > 0) { /* Cache exists */ + subjectList->item(row, ColumnMark)->setIcon(QIcon(SmallIcon("read"))); m_readNum++; - item->setText( Col_MarkOrder, QString::number( ( viewPos > 1000 ) ? Thread_Readed : Thread_Read ) ); - - } else if ( since.secsTo( current ) < 3600 * Kita::Config::markTime() ) { /* new thread */ - - item->setPixmap( Col_Mark, SmallIcon( "newthread" ) ); + subjectList->item(row, ColumnMarkOrder) + ->setText(QString::number((viewPos > 1000) + ? Thread_Readed : Thread_Read)); + } else if (since.secsTo(current) < 3600 * GlobalConfig::markTime()) { + /* new thread */ + subjectList->item(row, ColumnMark) + ->setIcon(QIcon(SmallIcon("newthread"))); m_newNum++; - item->setText( Col_MarkOrder, QString::number( Thread_New ) ); - + subjectList->item(row, ColumnMarkOrder) + ->setText(QString::number(Thread_New)); } else { /* normal */ - - item->setText( Col_MarkOrder, QString::number( Thread_Normal ) ); - item->setPixmap( Col_Mark, NULL ); + subjectList->item(row, ColumnMarkOrder) + ->setText(QString::number(Thread_Normal)); + subjectList->item(row, ColumnMark)->setIcon(QIcon()); } // no effect: m_unreadNum, m_readNum, m_newNum, markOrder - if ( Kita::DatManager::isMainThreadOpened( datURL ) && resNum == readNum ) { /* opened */ - item->setPixmap( Col_Mark, SmallIcon( "open" ) ); + if (datManager.isMainThreadOpened() && resNum == readNum) { + /* opened */ + subjectList->item(row, ColumnMark)->setIcon(QIcon(SmallIcon("open"))); } } -void KitaBoardView::slotContextMenuRequested( QListViewItem* item, const QPoint& point, int ) +void BoardView::deleteLog(const KUrl& url) { - enum { - Menu_OpenWithBrowser, - Menu_CopyURL, - Menu_CopyTitleAndURL, - Menu_Favorites, - Menu_DeleteLog, - Menu_Property - }; - - if ( item == 0 ) { - return ; - } - - QString datURL = item->text( Col_DatURL ); - QString threadURL = Kita::DatManager::threadURL( datURL ); - bool isFavorites = FavoriteThreads::getInstance() ->contains( datURL ); - - // create popup menu. - KPopupMenu popup( 0 ); - popup.insertItem( i18n( "Open with Web Browser" ), Menu_OpenWithBrowser ); - popup.insertItem( i18n( "Copy URL" ), Menu_CopyURL ); - popup.insertItem( i18n( "Copy title and URL" ), Menu_CopyTitleAndURL ); - if ( isFavorites ) { - popup.insertItem( i18n( "Remove from Favorites" ), Menu_Favorites ); - } else { - popup.insertItem( i18n( "Add to Favorites" ), Menu_Favorites ); - } - - if ( Kita::DatManager::getReadNum( datURL ) ) { - popup.insertSeparator(); - popup.insertItem( i18n( "Delete Log" ), Menu_DeleteLog ); - } - - popup.insertSeparator(); - popup.insertItem( i18n( "Property" ), Menu_Property ); - - // exec popup menu. - QClipboard* clipboard = QApplication::clipboard(); - QString cliptxt; - - switch ( popup.exec( point ) ) { - case Menu_OpenWithBrowser: - KRun::runURL( threadURL, "text/html" ); - break; - case Menu_CopyURL: - clipboard->setText( threadURL, QClipboard::Clipboard ); - clipboard->setText( threadURL, QClipboard::Selection ); - break; - case Menu_CopyTitleAndURL: - cliptxt = Kita::DatManager::threadName( datURL ) + "\n" + threadURL; - clipboard->setText( cliptxt , QClipboard::Clipboard ); - clipboard->setText( cliptxt , QClipboard::Selection ); - break; - case Menu_Favorites: - if ( isFavorites ) { - ViewMediator::getInstance()->bookmark( datURL, FALSE ); - } else { - ViewMediator::getInstance()->bookmark( datURL, TRUE ); + if (KMessageBox::warningYesNo(this, i18n("Do you want to delete Log?"), + "Kita") == KMessageBox::Yes) { + if (DatManager(url).deleteCache()) { + ViewMediator::getInstance()->closeThreadTab(url); + slotUpdateSubject(url); } - break; - case Menu_DeleteLog: - deleteLog( threadURL ); - break; - case Menu_Property: { - // FIXME: memory leak - Kita::ThreadProperty* propertyWidget = new Kita::ThreadProperty( 0 ); - propertyWidget->threadURLLabel->setText( threadURL ); - propertyWidget->datURLLabel->setText( datURL ); - - propertyWidget->threadNameLabel->setText( Kita::DatManager::threadName( datURL ) ); - propertyWidget->cachePathLabel->setText( Kita::DatManager::getCachePath( datURL ) ); - propertyWidget->indexPathLabel->setText( Kita::DatManager::getCacheIndexPath( datURL ) ); - propertyWidget->resNumLabel->setText( QString( "%1" ).arg( Kita::DatManager::getResNum( datURL ) ) ); - propertyWidget->readNumLabel->setText( QString( "%1" ).arg( Kita::DatManager::getReadNum( datURL ) ) ); - propertyWidget->viewPosLabel->setText( QString( "%1" ).arg( Kita::DatManager::getViewPos( datURL ) ) ); - - propertyWidget->idx_threadNameWithIndexLabel->setText( Kita::ThreadIndex::getSubject( datURL ) ); - propertyWidget->idx_resNumLabel->setText( QString( "%1" ).arg( Kita::ThreadIndex::getResNum( datURL ) ) ); - propertyWidget->idx_readNumLabel->setText( QString( "%1" ).arg( Kita::ThreadIndex::getReadNum( datURL ) ) ); - propertyWidget->idx_viewPosLabel->setText( QString( "%1" ).arg( Kita::ThreadIndex::getViewPos( datURL ) ) ); - - propertyWidget->cache_readNumLabel->setText( QString( "%1" ).arg( KitaThreadInfo::readNum( datURL ) ) ); - propertyWidget->show(); - } - break; - default: - break; } } -void KitaBoardView::deleteLog( const KURL& url ) +void BoardView::slotSizeChange(int section, int oldSize, int newSize) { - if ( QMessageBox::warning( this, - "Kita", - i18n( "Do you want to delete Log ?" ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - == QMessageBox::Ok ) { - if ( Kita::DatManager::deleteCache( url ) ) { - ViewMediator::getInstance()->closeThreadTab( url ); - slotUpdateSubject( url ); - } - } -} + if (!m_enableSizeChange) return ; + if (autoResize()) return ; -void KitaBoardView::slotSizeChange( int section, int oldSize, int newSize ) -{ - if ( ! m_enableSizeChange ) return ; - if ( autoResize() ) return ; - - QString configPath = locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); - subjectList->saveLayout( &config, "Layout" ); + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); +// KConfig config(configPath); TODO +// subjectList->saveLayout(&config, "Layout"); TODO } -void KitaBoardView::loadLayout() +void BoardView::loadLayout() { - if ( autoResize() ) return ; - QString configPath = locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); - subjectList->restoreLayout( &config, "Layout" ); + if (autoResize()) return ; + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + KConfig config(configPath); + // subjectList->restoreLayout(&config, "Layout"); TODO } -bool KitaBoardView::eventFilter( QObject* watched, QEvent* e ) +void BoardView::saveHeaderOnOff() { - if ( e->type() == QEvent::MouseButtonPress ) { - QMouseEvent * mouseEvent = static_cast<QMouseEvent *>( e ); - if ( mouseEvent->button() == RightButton ) { - KPopupMenu popup; - popup.setCheckable( TRUE ); + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + KConfig config(configPath); - for ( int i = Col_Begin; i <= Col_End; i++ ) { - if ( i != Col_Subject && i != Col_MarkOrder && i != Col_IDOrder ) { - popup.insertItem( i18n( s_colAttr[ i ].itemName ), i ); - popup.setItemChecked( i, subjectList->columnWidth( i ) != 0 ); - } - } - // TODO: don't use magic number. - popup.insertItem( "Auto Resize", 999 ); - popup.setItemChecked( 999, autoResize() ); - - int id = popup.exec( mouseEvent->globalPos() ); - if ( id == -1 ) { - return TRUE; - } - - if ( id == 999 ) { - setAutoResize( ! popup.isItemChecked( 999 ) ); - } else if ( popup.isItemChecked( id ) ) { - hideColumn( id ); - } else { - showColumn( id ); - } - saveHeaderOnOff(); - return TRUE; - } else { - return FALSE; - } - } else { - return subjectList->header() ->eventFilter( watched, e ); + KConfigGroup group = config.group("Column"); + for (int i = ColumnBegin; i <= ColumnEnd; i++) { + group.writeEntry(ThreadListHeaderView::attribute[i].keyName, + subjectList->columnWidth(i) != 0); } } -void KitaBoardView::saveHeaderOnOff() +void BoardView::loadHeaderOnOff() { - QString configPath = locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + KConfig config(configPath); - config.setGroup( "Column" ); - for ( int i = Col_Begin; i <= Col_End; i++ ) { - if ( subjectList->columnWidth( i ) != 0 ) { - config.writeEntry( s_colAttr[ i ].keyName, TRUE ); - } else { - config.writeEntry( s_colAttr[ i ].keyName, FALSE ); - } + KConfigGroup group = config.group("Column"); + for (int i = ColumnBegin; i <= ColumnEnd; i++) { + bool isShown = group.readEntry( + ThreadListHeaderView::attribute[i].keyName, + ThreadListHeaderView::attribute[i].showDefault); + isShown ? showColumn(i) : hideColumn(i); } } -void KitaBoardView::loadHeaderOnOff() +bool BoardView::autoResize() { - QString configPath = locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + KConfig config(configPath); - config.setGroup( "Column" ); - for ( int i = Col_Begin; i <= Col_End; i++ ) { - bool isShown = config.readBoolEntry( s_colAttr[ i ].keyName, s_colAttr[ i ].showDefault ); - qDebug("%s: isShown %d", s_colAttr[i].keyName.latin1(), isShown ); - if ( isShown ) { - showColumn( i ); - } else { - hideColumn( i ); - } - } + return config.group("Column").readEntry("AutoResize", true); } -bool KitaBoardView::autoResize() +void BoardView::setAutoResize(bool flag) { - QString configPath = locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); - config.setGroup( "Column" ); + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + KConfig config(configPath); - return config.readBoolEntry( "AutoResize", TRUE ); + config.group("Column").writeEntry("AutoResize", flag); } - -void KitaBoardView::setAutoResize( bool flag ) -{ - QString configPath = locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); - config.setGroup( "Column" ); - - config.writeEntry( "AutoResize", flag ); -} Modified: kita/trunk/kita/src/boardview.h =================================================================== --- kita/trunk/kita/src/boardview.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/boardview.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,66 +7,70 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#ifndef KITABOARDVIEW_H +#define KITABOARDVIEW_H -#ifndef _KITABOARDVIEW_H_ -#define _KITABOARDVIEW_H_ +#include <kurl.h> -#include <kurl.h> #include "threadlistview.h" +class QTreeWidgetItem; class QWidget; + class KListViewItem; -class KitaBoardTabWidget; -/** - * - * @author Hideki Ikemoto <ikemo****@users*****> - **/ -class KitaBoardView : public Kita::ThreadListView -{ - Q_OBJECT +namespace Kita { + class BoardTabWidget; - KitaBoardTabWidget* m_parent; + /** + * + * @author Hideki Ikemoto <ikemo****@users*****> + */ + class BoardView : public ThreadListView + { + Q_OBJECT -public: - KitaBoardView( KitaBoardTabWidget* parent, const char* name = 0 ); - ~KitaBoardView(); - void init(); - const KURL boardURL(); - void toggleShowOldLogs(); + BoardTabWidget* m_parent; -public slots: - virtual void setFocus(); - void slotFocusSearchCombo(); - void reloadSubject(); - void loadBoard( const KURL& url, bool online = TRUE ); - void setFont( const QFont& font ); - void slotUpdateSubject( const KURL& url ); + public: + explicit BoardView(BoardTabWidget* parent); + void init(); + const KUrl boardUrl(); + void toggleShowOldLogs(); -private: - KURL m_boardURL; - int m_unreadNum, m_readNum, m_newNum; - bool m_showOldLogs; - bool m_enableSizeChange; + public slots: + virtual void setFocus(); + void slotFocusSearchCombo(); + void reloadSubject(); + void loadBoard(const KUrl& url, bool online = true); + void setFont(const QFont& font); + void slotUpdateSubject(const KUrl& url); - void UpdateKindLabel(); - void deleteLog( const KURL& url ); - void loadLayout(); - void updateListViewItem( QListViewItem* item, const KURL& datURL, const QDateTime& current, int id, int order ); - bool eventFilter( QObject* watched, QEvent* e ); - void saveHeaderOnOff(); - void loadHeaderOnOff(); - bool autoResize(); - void setAutoResize( bool flag ); + private: + KUrl m_boardUrl; + int m_unreadNum, m_readNum, m_newNum; + bool m_showOldLogs; + bool m_enableSizeChange; -private slots: - void loadThread( QListViewItem* item ); - void slotContextMenuRequested( QListViewItem*, const QPoint&, int ); - void slotCloseButton(); - void slotSizeChange( int section, int oldSize, int newSize ); + void updateKindLabel(); + void deleteLog(const KUrl& url); + void loadLayout(); + void updateRow(int row, const KUrl& datUrl, + const QDateTime& current, int id, int order); + void saveHeaderOnOff(); + void loadHeaderOnOff(); + bool autoResize(); + void setAutoResize(bool flag); + BoardView(const BoardView&); + BoardView& operator=(const BoardView&); -signals: - void loadBoardCompleted( const KURL& ); -}; + private slots: + void slotCloseButton(); + void slotSizeChange(int section, int oldSize, int newSize); + signals: + void loadBoardCompleted(const KUrl&); + }; +} + #endif Modified: kita/trunk/kita/src/const.h =================================================================== --- kita/trunk/kita/src/const.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/const.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,26 +1,30 @@ -#define DEFAULT_STYLESHEET \ - "body,\n" \ - "body.pop {\n" \ - "}\n" \ - "a.coloredLink:link\n" \ - "{\n" \ - " color: magenta;" \ - "}\n" \ - "div.res_title,\n" \ - "div.pop_res_title {\n" \ - " white-space: nowrap;\n" \ - " padding-bottom: .2em;\n" \ - "}\n" \ - "span.name_noaddr {\n" \ - " color: green;\n" \ - "}\n" \ - "div.res_body,\n" \ - "div.pop_res_body {\n" \ - " margin-left: 3.5em;\n" \ - " padding-bottom: 1.8em;\n" \ - "}\n" \ - "div.kokoyon {\n" \ - " background-color: #CCCCCC;\n" \ - " text-align: center;\n" \ - "}\n" \ - "\n" +#ifndef KITACONST_H +#define KITACONST_H + +const char DEFAULT_STYLESHEET[] = + "body,\n" + "body.pop {\n" + "}\n" + "a.coloredLink:link\n" + "{\n" + " color: magenta;" + "}\n" + "div.res_title,\n" + "div.pop_res_title {\n" + " white-space: nowrap;\n" + " padding-bottom: .2em;\n" + "}\n" + "span.name_noaddr {\n" + " color: green;\n" + "}\n" + "div.res_body,\n" + "div.pop_res_body {\n" + " margin-left: 3.5em;\n" + " padding-bottom: 1.8em;\n" + "}\n" + "div.kokoyon {\n" + " background-color: #CCCCCC;\n" + " text-align: center;\n" + "}\n" + "\n"; +#endif Modified: kita/trunk/kita/src/domtree.cpp =================================================================== --- kita/trunk/kita/src/domtree.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/domtree.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -13,15 +13,16 @@ #include "domtree.h" #include <kurl.h> - #include <dom/dom_text.h> +#include "libkita/datinfo.h" #include "libkita/datmanager.h" -#include "libkita/datinfo.h" +#include "libkita/kita_misc.h" #include "libkita/kita-utf8.h" -#include "libkita/kita_misc.h" -KitaDomTree::KitaDomTree( const DOM::HTMLDocument& hdoc, const KURL& datURL ) +using namespace Kita; + +DomTree::DomTree(const DOM::HTMLDocument& hdoc, const KUrl& datUrl) { m_hdoc = hdoc; m_bufSize = 0; @@ -33,94 +34,102 @@ createHeader(); /* get pointer of DatInfo */ - /* Note that m_datURL is already locked in the KitaHTMLPart. */ - m_datInfo = Kita::DatManager::getDatInfoPointer( datURL ); + /* Note that m_datURL is already locked in the HTMLPart. */ + m_datInfo = DatManager(datUrl).getDatInfoPointer(); } -KitaDomTree::~KitaDomTree() {} +DomTree::~DomTree() {} /* * This function creates DOM elements of both title and body. * To show the res, call appendRes() */ -bool KitaDomTree::createResElement( int num ) +bool DomTree::createResElement(int num) { - Q_ASSERT( num > 0 ); - Q_ASSERT( m_datInfo != NULL ); + Q_ASSERT(num > 0); + Q_ASSERT(m_datInfo != 0); - if ( num < m_bufSize && m_resStatus[ num ] != KITA_HTML_NOTPARSED ) { + if (num < m_bufSize && m_resStatus[ num ] != HTML_NOTPARSED) { /* already parsed */ - return TRUE; + return true; } - if ( num >= m_bufSize ) { + if (num >= m_bufSize) { /* resize buffer size */ - if ( m_bufSize == 0 ) m_bufSize = 100; - while ( num >= m_bufSize ) m_bufSize += 500; + if (m_bufSize == 0) m_bufSize = 100; + while (num >= m_bufSize) m_bufSize += 500; - m_titleElm.resize( m_bufSize ); - m_bodyElm.resize( m_bufSize ); - m_resStatus.resize( m_bufSize, FALSE ); - m_coloredNum.resize( m_bufSize, FALSE ); + m_titleElm.resize(m_bufSize); + m_bodyElm.resize(m_bufSize); + int statusSize = m_resStatus.count(); + m_resStatus.resize(m_bufSize); + for (int i = statusSize; i < m_bufSize; i++) { + m_resStatus[i] = false; + } + int numSize = m_coloredNum.count(); + m_coloredNum.resize(m_bufSize); + for (int i = numSize; i < m_bufSize; i++) { + m_coloredNum[i] = false; + } } /* cleate elements */ QString titleHTML, bodyHTML; - m_resStatus[ num ] = m_datInfo->getHTML( num, TRUE, titleHTML, bodyHTML ); + m_resStatus[ num ] = m_datInfo->getHTML(num, true, titleHTML, bodyHTML); - if ( m_resStatus[ num ] == KITA_HTML_NOTPARSED ) { - return FALSE; + if (m_resStatus[ num ] == HTML_NOTPARSED) { + return false; } - m_titleElm[ num ] = m_hdoc.createElement( "DIV" ); - m_titleElm[ num ].setAttribute( "class", "res_title" ); - m_titleElm[ num ].setAttribute( "id", QString().setNum( num ) ); - m_titleElm[ num ].setInnerHTML( titleHTML ); + m_titleElm[ num ] = m_hdoc.createElement("DIV"); + m_titleElm[ num ].setAttribute("class", "res_title"); + m_titleElm[ num ].setAttribute("id", QString::number(num)); + m_titleElm[ num ].setInnerHTML(titleHTML); - m_bodyElm[ num ] = m_hdoc.createElement( "DIV" ); - m_bodyElm[ num ].setAttribute( "class", "res_body" ); - m_bodyElm[ num ].setAttribute( "id", QString().setNum( num ) ); - m_bodyElm[ num ].setInnerHTML( bodyHTML ); + m_bodyElm[ num ] = m_hdoc.createElement("DIV"); + m_bodyElm[ num ].setAttribute("class", "res_body"); + m_bodyElm[ num ].setAttribute("id", QString::number(num)); + m_bodyElm[ num ].setInnerHTML(bodyHTML); - return TRUE; + return true; } /* * append the response */ -bool KitaDomTree::appendRes( int num ) +bool DomTree::appendRes(int num) { - if ( !createResElement( num ) ) return FALSE; + if (!createResElement(num)) return false; - m_hdoc.body().appendChild( m_titleElm[ num ] ); - m_hdoc.body().appendChild( m_bodyElm[ num ] ); + m_hdoc.body().appendChild(m_titleElm[ num ]); + m_hdoc.body().appendChild(m_bodyElm[ num ]); - if ( num > m_bottomNum ) m_bottomNum = num; + if (num > m_bottomNum) m_bottomNum = num; - return TRUE; + return true; } /* * redraw all */ -void KitaDomTree::redraw( bool force ) +void DomTree::redraw(bool force) { - Q_ASSERT( m_datInfo != NULL ); + Q_ASSERT(m_datInfo != 0); int readNum = m_datInfo->getReadNum(); /* don't forget to reset abone here... */ m_datInfo->resetAbone(); - for ( int i = 1; i <= readNum; i++ ) { + for (int i = 1; i <= readNum; i++) { QString titleHTML, bodyHTML; int oldStatus = m_resStatus[ i ]; - m_resStatus[ i ] = m_datInfo->getHTML( i , TRUE, titleHTML, bodyHTML ); + m_resStatus[ i ] = m_datInfo->getHTML(i , true, titleHTML, bodyHTML); - if ( force || oldStatus != m_resStatus[ i ] ) { - m_titleElm[ i ].setInnerHTML( titleHTML ); - m_bodyElm[ i ].setInnerHTML( bodyHTML ); + if (force || oldStatus != m_resStatus[ i ]) { + m_titleElm[ i ].setInnerHTML(titleHTML); + m_bodyElm[ i ].setInnerHTML(bodyHTML); } } } @@ -129,20 +138,20 @@ /* * change color of number of the res which is responsed. * - * See also KitaDomTree::changeColorOfNumber() , + * See also DomTree::changeColorOfNumber() , * DatInfo::copyOneLineToResDat(), * and DatInfo::collectResponsedRes(). */ -void KitaDomTree::changeColorOfAllResponsedNumber() +void DomTree::changeColorOfAllResponsedNumber() { - for ( int i = 1; i <= m_bottomNum; ++i ) { - if ( m_datInfo->isResponsed( i ) ) { - changeColorOfNumber( i ); + for (int i = 1; i <= m_bottomNum; ++i) { + if (m_datInfo->isResponsed(i)) { + changeColorOfNumber(i); } } } -const int KitaDomTree::getBottomResNumber() const +int DomTree::getBottomResNumber() const { return m_bottomNum; } @@ -150,37 +159,37 @@ /* * append footer & header */ -void KitaDomTree::appendFooterAndHeader() +void DomTree::appendFooterAndHeader() { - Q_ASSERT( m_datInfo != NULL ); + Q_ASSERT(m_datInfo != 0); int readNum = m_datInfo->getReadNum(); - if ( !readNum ) return ; + if (!readNum) return ; - updateHeader( m_header ); - updateFooter( m_footer ); + updateHeader(m_header); + updateFooter(m_footer); - m_hdoc.body().insertBefore( m_header, m_hdoc.body().firstChild() ); - m_hdoc.body().appendChild( m_footer ); + m_hdoc.body().insertBefore(m_header, m_hdoc.body().firstChild()); + m_hdoc.body().appendChild(m_footer); } /* * append kokomadeyonda */ -void KitaDomTree::appendKokoyon() +void DomTree::appendKokoyon() { - Q_ASSERT( m_datInfo != NULL ); + Q_ASSERT(m_datInfo != 0); int readNum = m_datInfo->getReadNum(); - if ( !readNum ) return ; + if (!readNum) return ; int viewPos = m_datInfo->getViewPos(); - if ( viewPos == 0 ) return ; + if (viewPos == 0) return ; int i = viewPos + 1; - if ( i <= readNum ) m_hdoc.body().insertBefore( m_kokoyon, m_titleElm[ i ] ); - else m_hdoc.body().appendChild( m_kokoyon ); + if (i <= readNum) m_hdoc.body().insertBefore(m_kokoyon, m_titleElm[ i ]); + else m_hdoc.body().appendChild(m_kokoyon); } /* @@ -190,14 +199,15 @@ /* * append "A" Node to rootnode */ -void KitaDomTree::appendAnchorNode( DOM::Element rootnode, const QString& href, const QString& linkstr ) +void DomTree::appendAnchorNode(const DOM::Element& root, const QString& href, const QString& linkstr) { + DOM::Element rootnode = root; DOM::Element element; - element = rootnode.appendChild( m_hdoc.createElement( "A" ) ); + element = rootnode.appendChild(m_hdoc.createElement("A")); { - element.setAttribute( "href", href ); - element.appendChild( m_hdoc.createTextNode( linkstr ) ); + element.setAttribute("href", href); + element.appendChild(m_hdoc.createTextNode(linkstr)); } } @@ -209,42 +219,42 @@ * before: #KokomadeYonda 1- 101- 201- #ToSaigo<br><br> * after : #KokomadeYonda 1- 101- 201- 301- 401- #ToSaigo<br><br> */ -void KitaDomTree::updateHeader( DOM::Element& headerElement ) +void DomTree::updateHeader(DOM::Element& headerElement) { - if ( ! m_datInfo ) return ; + if (! m_datInfo) return ; DOM::Element backupElement1, backupElement2, backupElement3; int readNum = m_datInfo->getReadNum(); /* remove <a href="#tosaigo"> and <BR> */ - backupElement1 = headerElement.removeChild( headerElement.lastChild() ); /* BR */ - backupElement2 = headerElement.removeChild( headerElement.lastChild() ); /* BR */ - backupElement3 = headerElement.removeChild( headerElement.lastChild() ); /* "#tosaigo" */ + backupElement1 = headerElement.removeChild(headerElement.lastChild()); /* BR */ + backupElement2 = headerElement.removeChild(headerElement.lastChild()); /* BR */ + backupElement3 = headerElement.removeChild(headerElement.lastChild()); /* "#tosaigo" */ DOM::Node node = headerElement.firstChild(); /* node is now "#kokomade_yonda" */ node = node.nextSibling(); /* " " */ node = node.nextSibling(); /* '1-', '101-' ãªã©ã®ãªã³ã¯ãä½æ */ - for ( int num = 1; num < readNum ; num += 100 ) { - if ( node == NULL ) { - QString href = QString( "#%1" ).arg( num ); - QString linkStr = QString( "%1-" ).arg( num ); + for (int num = 1; num < readNum ; num += 100) { + if (node == 0) { + QString href = QString("#%1").arg(num); + QString linkStr = QString("%1-").arg(num); - appendAnchorNode( headerElement, href, linkStr ); - node = headerElement.appendChild( m_hdoc.createTextNode( " " ) ); + appendAnchorNode(headerElement, href, linkStr); + node = headerElement.appendChild(m_hdoc.createTextNode(" ")); node = node.nextSibling(); } else { // æ¢ã«ãªã³ã¯ãä½ããã¦ããå ´åã¯é£ã°ã node = node.nextSibling(); - if ( node != NULL ) node = node.nextSibling(); + if (node != 0) node = node.nextSibling(); } } /* restore <a href="#tosaigo"> and <BR> */ - headerElement.appendChild( backupElement3 ); /* "#tosaigo" */ - headerElement.appendChild( backupElement2 ); /* BR */ - headerElement.appendChild( backupElement1 ); /* BR */ + headerElement.appendChild(backupElement3); /* "#tosaigo" */ + headerElement.appendChild(backupElement2); /* BR */ + headerElement.appendChild(backupElement1); /* BR */ } /* @@ -254,60 +264,60 @@ * before: #KokomadeYonda 1- 101- 201- #ToSaigo * after : #KokomadeYonda 1- 101- 201- 301- 401- #ToSaigo */ -void KitaDomTree::updateFooter( DOM::Element& footerElement ) +void DomTree::updateFooter(DOM::Element& footerElement) { - Q_ASSERT( m_datInfo != NULL ); + Q_ASSERT(m_datInfo != 0); DOM::Element backupElement; int readNum = m_datInfo->getReadNum(); - backupElement = footerElement.removeChild( footerElement.lastChild() ); /* "#tosaigo" */ + backupElement = footerElement.removeChild(footerElement.lastChild()); /* "#tosaigo" */ DOM::Node node = footerElement.firstChild(); /* node is now "#kokomade_yonda" */ node = node.nextSibling(); /* " " */ node = node.nextSibling(); /* '1-', '101-' ãªã©ã®ãªã³ã¯ãä½æ */ - for ( int num = 1; num < readNum ; num += 100 ) { - if ( node == NULL ) { - QString href = QString( "#%1" ).arg( num ); - QString linkStr = QString( "%1-" ).arg( num ); + for (int num = 1; num < readNum ; num += 100) { + if (node == 0) { + QString href = QString("#%1").arg(num); + QString linkStr = QString("%1-").arg(num); - appendAnchorNode( footerElement, href, linkStr ); - node = footerElement.appendChild( m_hdoc.createTextNode( " " ) ); + appendAnchorNode(footerElement, href, linkStr); + node = footerElement.appendChild(m_hdoc.createTextNode(" ")); node = node.nextSibling(); } else { // æ¢ã«ãªã³ã¯ãä½ããã¦ããå ´åã¯é£ã°ã node = node.nextSibling(); - if ( node != NULL ) node = node.nextSibling(); + if (node != 0) node = node.nextSibling(); } } - footerElement.appendChild( backupElement ); /* "#tosaigo" */ + footerElement.appendChild(backupElement); /* "#tosaigo" */ } /* * create header node */ -void KitaDomTree::createHeader() +void DomTree::createHeader() { QString str; DOM::Element rootnode; - rootnode = m_hdoc.createElement( "DIV" ); + rootnode = m_hdoc.createElement("DIV"); { - rootnode.setAttribute( "kita_type", "header" ); - rootnode.setAttribute( "id", "header" ); + rootnode.setAttribute("kita_type", "header"); + rootnode.setAttribute("id", "header"); - str = Kita::utf8ToUnicode( KITAUTF8_KOKOYON ); - appendAnchorNode( rootnode, "#kokomade_yonda", str ); - rootnode.appendChild( m_hdoc.createTextNode( " " ) ); + str = QString::fromUtf8(KITAUTF8_KOKOYON); + appendAnchorNode(rootnode, "#kokomade_yonda", str); + rootnode.appendChild(m_hdoc.createTextNode(" ")); - str = Kita::utf8ToUnicode( KITAUTF8_SAIGO ); - appendAnchorNode( rootnode, "#tosaigo", str ); + str = QString::fromUtf8(KITAUTF8_SAIGO); + appendAnchorNode(rootnode, "#tosaigo", str); - rootnode.appendChild( m_hdoc.createElement( "BR" ) ); - rootnode.appendChild( m_hdoc.createElement( "BR" ) ); + rootnode.appendChild(m_hdoc.createElement("BR")); + rootnode.appendChild(m_hdoc.createElement("BR")); } m_header = rootnode; @@ -317,22 +327,22 @@ /* * create footer node */ -void KitaDomTree::createFooter() +void DomTree::createFooter() { QString str; DOM::Element rootnode; - rootnode = m_hdoc.createElement( "DIV" ); + rootnode = m_hdoc.createElement("DIV"); { - rootnode.setAttribute( "kita_type", "footer" ); - rootnode.setAttribute( "id", "footer" ); + rootnode.setAttribute("kita_type", "footer"); + rootnode.setAttribute("id", "footer"); - str = Kita::utf8ToUnicode( KITAUTF8_KOKOYON ); - appendAnchorNode( rootnode, "#kokomade_yonda", str ); - rootnode.appendChild( m_hdoc.createTextNode( " " ) ); + str = QString::fromUtf8(KITAUTF8_KOKOYON); + appendAnchorNode(rootnode, "#kokomade_yonda", str); + rootnode.appendChild(m_hdoc.createTextNode(" ")); - str = Kita::utf8ToUnicode( KITAUTF8_SAIGO ); - appendAnchorNode( rootnode, "#tosaigo", str ); + str = QString::fromUtf8(KITAUTF8_SAIGO); + appendAnchorNode(rootnode, "#tosaigo", str); } m_footer = rootnode; @@ -341,19 +351,19 @@ /* * create kokomadeyonda node */ -void KitaDomTree::createKokoyon() +void DomTree::createKokoyon() { QString str, style; DOM::Element rootnode; - str = Kita::utf8ToUnicode( KITAUTF8_KOKOYON2 ); + str = QString::fromUtf8(KITAUTF8_KOKOYON2); - rootnode = m_hdoc.createElement( "DIV" ); + rootnode = m_hdoc.createElement("DIV"); { - rootnode.setAttribute( "class", "kokoyon" ); - rootnode.setAttribute( "kita_type", "kokoyon" ); - rootnode.setAttribute( "id", "kokomade_yonda" ); - rootnode.appendChild( m_hdoc.createTextNode( str ) ); + rootnode.setAttribute("class", "kokoyon"); + rootnode.setAttribute("kita_type", "kokoyon"); + rootnode.setAttribute("id", "kokomade_yonda"); + rootnode.appendChild(m_hdoc.createTextNode(str)); } m_kokoyon = rootnode; @@ -363,14 +373,14 @@ * change color of number * specify color like this: "a.coloredLink:link{ color: red; }" */ -void KitaDomTree::changeColorOfNumber( int num ) +void DomTree::changeColorOfNumber(int num) { - if ( m_coloredNum[ num ] ) return ; + if (m_coloredNum[ num ]) return ; - m_coloredNum[ num ] = TRUE; + m_coloredNum[ num ] = true; DOM::Node node = m_titleElm[ num ]; node = node.firstChild(); - static_cast<DOM::HTMLElement>( node ).setAttribute( "class", "coloredLink" ); + static_cast<DOM::HTMLElement>(node).setAttribute("class", "coloredLink"); } Modified: kita/trunk/kita/src/domtree.h =================================================================== --- kita/trunk/kita/src/domtree.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/domtree.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,68 +7,75 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITADOMTREE_H #define KITADOMTREE_H -#include <qvaluevector.h> +#include <QtCore/QVector> -#include <khtml_part.h> - #include <dom/html_block.h> +#include <dom/html_document.h> namespace Kita { class DatInfo; -} -class KitaDomTree -{ - Kita::DatInfo* m_datInfo; - int m_bufSize; + class DomTree + { + DomTree(const DomTree&); + DomTree& operator=(const DomTree&); - /* bottom number of shown. probably m_bottomNum == m_datInfo->getReadNum */ - int m_bottomNum; + DatInfo* m_datInfo; + int m_bufSize; - QValueVector< int > m_resStatus; /* return val of DatInfo::getHTML(). See datinfo.h */ - QValueVector< bool > m_coloredNum; /* colored number */ + /* bottom number of shown. + * probably m_bottomNum == m_datInfo->getReadNum + */ + int m_bottomNum; - /* DOM elements */ - DOM::HTMLDocument m_hdoc; /* root node of document*/ - QValueVector< DOM::HTMLDivElement > m_titleElm; /* the vector of the element of response */ - QValueVector< DOM::HTMLDivElement > m_bodyElm; /* the vector of the element of response */ - DOM::Element m_header; - DOM::Element m_footer; - DOM::Element m_kokoyon; + /* return val of DatInfo::getHTML(). See datinfo.h */ + QVector<int> m_resStatus; + QVector<bool> m_coloredNum; /* colored number */ -public: - KitaDomTree( const DOM::HTMLDocument& hdoc, const KURL& datURL ); - ~KitaDomTree(); + /* DOM elements */ + DOM::HTMLDocument m_hdoc; /* root node of document*/ + /* the vector of the element of response */ + QVector<DOM::HTMLDivElement> m_titleElm; + /* the vector of the element of response */ + QVector<DOM::HTMLDivElement> m_bodyElm; + DOM::Element m_header; + DOM::Element m_footer; + DOM::Element m_kokoyon; - /* rendering functions */ + public: + DomTree(const DOM::HTMLDocument& hdoc, const KUrl& datUrl); + ~DomTree(); - bool createResElement( int num ); - bool appendRes( int num ); - void redraw( bool force ); - void changeColorOfAllResponsedNumber(); + /* rendering functions */ - /* information */ + bool createResElement(int num); + bool appendRes(int num); + void redraw(bool force); + void changeColorOfAllResponsedNumber(); - const int getBottomResNumber() const; + /* information */ - /* header Node, footer Node, kokomadeyonda Node, etc... */ + int getBottomResNumber() const; - void appendFooterAndHeader(); - void appendKokoyon(); + /* header Node, footer Node, kokomadeyonda Node, etc... */ -private: - void appendAnchorNode( DOM::Element rootnode, const QString& linkstr, const QString& comment ); - void updateHeader( DOM::Element& targetelm ); - void updateFooter( DOM::Element& targetelm ); - void createHeader(); - void createFooter(); - void createKokoyon(); - void changeColorOfNumber( int num ); -}; + void appendFooterAndHeader(); + void appendKokoyon(); + private: + void appendAnchorNode(const DOM::Element& root, const QString& linkstr, + const QString& comment); + void updateHeader(DOM::Element& targetelm); + void updateFooter(DOM::Element& targetelm); + void createHeader(); + void createFooter(); + void createKokoyon(); + void changeColorOfNumber(int num); + }; +} + #endif Modified: kita/trunk/kita/src/favoritelistview.cpp =================================================================== --- kita/trunk/kita/src/favoritelistview.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/favoritelistview.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,173 +10,138 @@ #include "favoritelistview.h" -#include "viewmediator.h" +#include <QtCore/QDateTime> +#include <QtGui/QApplication> +#include <QtGui/QClipboard> +#include <QtGui/QTableWidgetItem> +#include <kaction.h> +#include <kmenu.h> +#include <krun.h> + +#include "threadlistviewitem.h" +#include "viewmediator.h" +#include "libkita/boardmanager.h" +#include "libkita/datmanager.h" #include "libkita/favoritethreads.h" #include "libkita/kita_misc.h" -#include "libkita/datmanager.h" -#include "libkita/boardmanager.h" #include "libkita/thread.h" -#include <qapplication.h> -#include <qclipboard.h> -#include <qdatetime.h> -#include <qtoolbutton.h> -#include <qlabel.h> +using namespace Kita; -#include <klocale.h> -#include <kpopupmenu.h> -#include <krun.h> -#include <klistview.h> - /** * */ -FavoriteListView::FavoriteListView( QWidget* parent, const char* name ) - : Kita::ThreadListView( parent, name ) +FavoriteListView::FavoriteListView(QWidget* parent) : ThreadListView(parent) { - KindLabel->hide(); + kindLabel->hide(); - connect( subjectList, SIGNAL( returnPressed( QListViewItem* ) ), - SLOT( loadThread( QListViewItem* ) ) ); - connect( subjectList, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ), - SLOT( slotContextMenuRequested( QListViewItem*, const QPoint&, int ) ) ); - connect( ReloadButton, SIGNAL( clicked() ), - SLOT( reload() ) ); + connect(subjectList, SIGNAL(itemClicked(QTableWidgetItem*)), + SLOT(loadThread(QTableWidgetItem*))); + connect(reloadButton, SIGNAL(clicked()), + SLOT(reload())); - showColumn( Col_Board ); + showColumn(ColumnBoard); } /** * */ -FavoriteListView::~FavoriteListView() -{} - -/** - * - */ void FavoriteListView::refresh() { // clear m_hitList.clear(); m_nextHitIndex = 0; - m_prevquery = ""; + m_prevquery = QStringList(); - subjectList->clear(); + subjectList->clearContents(); + subjectList->setSortingEnabled(false); + int count = FavoriteThreads::count(); + subjectList->setRowCount(count); + for (int i = 0; i < count; i++) { + for (int j = 0, k = subjectList->columnCount(); j < k; j++) { + ThreadListViewItem* item = new ThreadListViewItem(j); + subjectList->setItem(i, j, item); + } + } + subjectList->setSortingEnabled(true); // insert item. - for ( int i = 0; FavoriteThreads::count() > i; i++ ) { - QString datURL = FavoriteThreads::getDatURL( i ); + for (int i = 0; i < count; i++) { + QString datUrl = FavoriteThreads::getDatUrl(i); QDateTime since; - since.setTime_t( Kita::datToSince( datURL ) ); + since.setTime_t(datToSince(datUrl)); - int viewPos = Kita::DatManager::getViewPos( datURL ); - int resNum = Kita::DatManager::getResNum( datURL ); + DatManager datManager(datUrl); + int viewPos = datManager.getViewPos(); + int resNum = datManager.getResNum(); - KListViewItem* item = new KListViewItem( subjectList ); - item->setText( Col_Board, Kita::BoardManager::boardName( datURL ) ); - item->setText( Col_Subject, Kita::DatManager::threadName( datURL ) ); - item->setText( Col_ReadNum, QString( "%1" ).arg( viewPos, 4 ) ); - if ( resNum > 0 ) { - item->setText( Col_ResNum, QString( "%1" ).arg( resNum, 4 ) ); + subjectList->item(i, ColumnBoard) + ->setText(BoardManager::boardName(datUrl)); + subjectList->item(i, ColumnSubject) + ->setText(datManager.threadName()); + subjectList->item(i, ColumnReadNum) + ->setText(QString("%1").arg(viewPos, 4)); + if (resNum > 0) { + subjectList->item(i, ColumnResNum) + ->setText(QString("%1").arg(resNum, 4)); } - if ( resNum != 0 && resNum != viewPos ) { - item->setText( Col_Unread, QString( "%1" ).arg( resNum - viewPos, 4 ) ); + if (resNum != 0 && resNum != viewPos) { + subjectList->item(i, ColumnUnread) + ->setText(QString("%1").arg(resNum - viewPos, 4)); } - item->setText( Col_Since, since.toString( "yy/MM/dd hh:mm" ) ); - item->setText( Col_DatURL, datURL ); + subjectList->item(i, ColumnSince) + ->setText(since.toString("yy/MM/dd hh:mm")); + subjectList->item(i, ColumnDatUrl)->setText(datUrl); } - subjectList->setSorting( Col_Board ); + subjectList->sortItems(ColumnBoard); + for (int i = 0, j = subjectList->columnCount(); i < j; i++) { + subjectList->resizeColumnToContents(i); + } + for (int i = 0, j = subjectList->rowCount(); i < j; i++) { + subjectList->resizeRowToContents(i); + } } /** * */ -void FavoriteListView::loadThread( QListViewItem* item ) +void FavoriteListView::loadThread(QTableWidgetItem* item) { - if ( ! item ) return ; + if (! item) return ; - QString itemURL = item->text( Col_DatURL ); + QString itemUrl = subjectList->item(item->row(), ColumnDatUrl)->text(); - for ( int i = 0; FavoriteThreads::count() > i; i++ ) { - QString datURL = FavoriteThreads::getDatURL( i ); + for (int i = 0; FavoriteThreads::count() > i; i++) { + QString datUrl = FavoriteThreads::getDatUrl(i); - if ( datURL == itemURL ) { - ViewMediator::getInstance()->openThread( datURL ); + if (datUrl == itemUrl) { + ViewMediator::getInstance()->openThread(datUrl); } } } /** - * show and exec popup menu. - */ -void FavoriteListView::slotContextMenuRequested( QListViewItem* item, const QPoint& point, int ) -{ - if ( ! item ) { - return; - } - - enum { - Menu_OpenWithBrowser, - Menu_CopyURL, - Menu_CopyTitleAndURL, - Menu_RemoveFromFavorites - }; - - KPopupMenu popup( 0 ); - popup.insertItem( i18n( "Open with Web Browser" ), Menu_OpenWithBrowser ); - popup.insertItem( i18n( "Copy URL" ), Menu_CopyURL ); - popup.insertItem( i18n( "Copy title and URL" ), Menu_CopyTitleAndURL ); - popup.insertItem( i18n( "Remove from Favorites" ), Menu_RemoveFromFavorites ); - - QString datURL = item->text( Col_DatURL ); - QString threadURL = Kita::DatManager::threadURL( datURL ); - - QClipboard* clipboard = QApplication::clipboard(); - QString clipText; - - switch ( popup.exec( point ) ) { - case Menu_OpenWithBrowser: - KRun::runURL( Kita::DatManager::threadURL( datURL ), "text/html" ); - break; - case Menu_CopyURL: - clipboard->setText( threadURL ); - break; - case Menu_CopyTitleAndURL: - clipText = Kita::DatManager::threadName( datURL ) + "\n" + threadURL; - clipboard->setText( clipText , QClipboard::Clipboard ); - clipboard->setText( clipText , QClipboard::Selection ); - break; - case Menu_RemoveFromFavorites: - ViewMediator::getInstance()->bookmark( datURL, FALSE ); - break; - default: - break; - } -} - -/** * */ void FavoriteListView::reload() { - QValueList<QString> boardList; + QList<QString> boardList; - for ( int i = 0; FavoriteThreads::count() > i; i++ ) { - QString datURL = FavoriteThreads::getDatURL( i ); - QString boardURL = Kita::BoardManager::boardURL( datURL ); - if ( boardList.contains( boardURL ) == 0 ) { - boardList.append( boardURL ); + for (int i = 0; FavoriteThreads::count() > i; i++) { + QString datUrl = FavoriteThreads::getDatUrl(i); + QString boardUrl = BoardManager::boardUrl(datUrl); + if (boardList.contains(boardUrl) == 0) { + boardList.append(boardUrl); } } - QValueList<QString>::const_iterator it; - for ( it = boardList.begin(); it != boardList.end(); ++it ) { - bool online = TRUE; - QPtrList<Kita::Thread> threadList; - QPtrList<Kita::Thread> tmpList; - Kita::BoardManager::getThreadList( ( *it ), FALSE, online, threadList, tmpList ); + QList<QString>::const_iterator it; + for (it = boardList.begin(); it != boardList.end(); ++it) { + bool online = true; + QList<Thread*> threadList; + QList<Thread*> tmpList; + BoardManager::getThreadList((*it), false, online, threadList, tmpList); } } Modified: kita/trunk/kita/src/favoritelistview.h =================================================================== --- kita/trunk/kita/src/favoritelistview.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/favoritelistview.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,31 +7,29 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#ifndef KITAFAVORITELISTVIEW_H +#define KITAFAVORITELISTVIEW_H -#ifndef FAVORITELISTVIEW_H -#define FAVORITELISTVIEW_H - #include "threadlistview.h" -#include "threadlistviewitem.h" -/** - * - * @author Hideki Ikemoto <ikemo****@users*****> - **/ -class FavoriteListView : public Kita::ThreadListView -{ - Q_OBJECT +namespace Kita { + /** + * + * @author Hideki Ikemoto <ikemo****@users*****> + **/ + class FavoriteListView : public ThreadListView + { + Q_OBJECT -public: - FavoriteListView( QWidget* parent = 0, const char* name = 0 ); - ~FavoriteListView(); + public: + explicit FavoriteListView(QWidget* parent = 0); - void refresh(); + void refresh(); -private slots: - void loadThread( QListViewItem* item ); - void slotContextMenuRequested( QListViewItem*, const QPoint&, int ); - void reload(); -}; + private slots: + void loadThread(QTableWidgetItem* item); + void reload(); + }; +} #endif Modified: kita/trunk/kita/src/htmlpart.cpp =================================================================== --- kita/trunk/kita/src/htmlpart.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/htmlpart.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -8,50 +8,48 @@ * (at your option) any later version. * ***************************************************************************/ -#include <kpopupmenu.h> -#include <klocale.h> +#include "htmlpart.h" + +#include <QtCore/QRegExp> +#include <QtGui/QApplication> +#include <QtGui/QClipboard> +#include <QtGui/QCursor> +#include <QtGui/QScrollBar> +#include <QtGui/QStyle> +#include <QtGui/QStyleOptionComplex> + +#include <kaction.h> #include <khtml_events.h> -#include <kdebug.h> +#include <kmenu.h> +#include <kmessagebox.h> #include <krun.h> -#include <dom/html_element.h> -#include <dom/html_misc.h> - -#include <qcursor.h> -#include <qapplication.h> -#include <qclipboard.h> -#include <qmessagebox.h> -#include <qregexp.h> - -#include "htmlpart.h" +#include "const.h" #include "domtree.h" #include "respopup.h" #include "viewmediator.h" -#include "const.h" - #include "kitaui/htmlview.h" - -#include "libkita/datmanager.h" +#include "libkita/abone.h" #include "libkita/boardmanager.h" -#include "libkita/datinfo.h" +#include "libkita/colorconfig.h" +#include "libkita/datmanager.h" +#include "libkita/globalconfig.h" #include "libkita/kita_misc.h" -#include "libkita/config_xt.h" -#include "libkita/abone.h" +using namespace Kita; /*-------------------------------------------*/ /*-------------------------------------*/ /* Don't forget to call setup() later. */ -KitaHTMLPart::KitaHTMLPart( QWidget* parent, const char* name ) - : KHTMLPart( new KitaHTMLView( this, parent, name ) ) +HTMLPart::HTMLPart(QWidget* parent) : KHTMLPart(new HTMLView(this, parent)) { m_mode = HTMLPART_MODE_MAINPART; - m_popup = NULL; - m_domtree = NULL; - m_datURL = QString::null; - m_updatedKokoyon = FALSE; + m_popup = 0; + m_domtree = 0; + m_datUrl.clear(); + m_updatedKokoyon = false; clearPart(); createHTMLDocument(); @@ -59,29 +57,31 @@ } -KitaHTMLPart::~KitaHTMLPart() +HTMLPart::~HTMLPart() { clearPart(); } /* private */ -void KitaHTMLPart::clearPart() +void HTMLPart::clearPart() { slotDeletePopup(); - /* delete KitaDomTree */ - if ( m_domtree ) delete m_domtree; - m_domtree = NULL; + /* delete DomTree */ + delete m_domtree; + m_domtree = 0; + DatManager datManager(m_datUrl); /* update ViewPos */ - if ( m_mode == HTMLPART_MODE_MAINPART && !m_updatedKokoyon && !m_datURL.isEmpty() ) { - int readNum = Kita::DatManager::getReadNum( m_datURL ); - if ( readNum ) { - Kita::DatManager::setViewPos( m_datURL, readNum ); + if (m_mode == HTMLPART_MODE_MAINPART && !m_updatedKokoyon + && !m_datUrl.isEmpty()) { + int readNum = datManager.getReadNum(); + if (readNum) { + datManager.setViewPos(readNum); } } - m_updatedKokoyon = FALSE; + m_updatedKokoyon = false; /* clear variables */ m_anchorStack.clear(); @@ -89,100 +89,102 @@ m_jumpNumAfterLoading = 0; findTextInit(); - if ( !m_datURL.isEmpty() ) { /* This part is opened. */ + if (!m_datUrl.isEmpty()) { /* This part is opened. */ + /* This part is on the main thread view. */ + if (m_mode == HTMLPART_MODE_MAINPART) { - if ( m_mode == HTMLPART_MODE_MAINPART ) { /* This part is on the main thread view. */ - /* tell Thread class that "thread is closed" */ - Kita::DatManager::setMainThreadOpened( m_datURL, FALSE ); + datManager.setMainThreadOpened(false); /* emit "deactivated all thread view" SIGNAL */ - ViewMediator::getInstance()->changeWriteTab( QString::null ); + KUrl nullUrl(""); + ViewMediator::getInstance()->changeWriteTab(nullUrl); /* update subject tab. */ } } - m_datURL = QString::null; + m_datUrl.clear(); m_mode = HTMLPART_MODE_MAINPART; } /* public */ -bool KitaHTMLPart::setup( int mode, const KURL& url ) +bool HTMLPart::setup(int mode, const KUrl& url) { - Q_ASSERT( !url.isEmpty() ); + Q_ASSERT(!url.isEmpty()); clearPart(); - m_datURL = Kita::getDatURL( url ); + m_datUrl = getDatUrl(url); m_mode = mode; - if ( m_mode == HTMLPART_MODE_MAINPART ) { /* This part is on the main thread view. */ - + if (m_mode == HTMLPART_MODE_MAINPART) { + /* This part is on the main thread view. */ + DatManager datManager(m_datUrl); /* create DatInfo explicitly to open new thread. */ /* Usually, DatInfo is NOT created if ReadNum == 0.*/ /* See also DatManager::createDatInfo() and */ /* DatManager::getDatInfo(). */ - Kita::DatManager::createDatInfo( m_datURL ); + datManager.createDatInfo(); - /* tell Thread class that "thread is opend" */ - Kita::DatManager::setMainThreadOpened( m_datURL, TRUE ); + /* tell Thread class that "thread is opened" */ + datManager.setMainThreadOpened(true); /* reset abone */ - Kita::DatManager::resetAbone( m_datURL ); + datManager.resetAbone(); } /* create HTML Document */ createHTMLDocument(); /* create DOM manager */ - if ( m_mode == HTMLPART_MODE_MAINPART ) { - m_domtree = new KitaDomTree( htmlDocument(), m_datURL ); + if (m_mode == HTMLPART_MODE_MAINPART) { + m_domtree = new DomTree(htmlDocument(), m_datUrl); } - return TRUE; + return true; } /* private */ -void KitaHTMLPart::connectSignals() +void HTMLPart::connectSignals() { /* popup */ - connect( this, SIGNAL( onURL( const QString& ) ), SLOT( slotOnURL( const QString& ) ) ); + connect(this, SIGNAL(onURL(const QString&)), SLOT(slotOnUrl(const QString&))); - connect( view(), SIGNAL( leave() ), SLOT( slotLeave() ) ); - connect( view(), SIGNAL( verticalSliderReleased() ), SLOT( slotVSliderReleased() ) ); - connect( view(), SIGNAL( horizontalSliderReleased() ), SLOT( slotHSliderReleased() ) ); + connect(view(), SIGNAL(leave()), SLOT(slotLeave())); + connect(view()->verticalScrollBar(), SIGNAL(sliderReleased()), SLOT(slotVSliderReleased())); + connect(view()->horizontalScrollBar(), SIGNAL(sliderReleased()), SLOT(slotHSliderReleased())); } /* private */ -void KitaHTMLPart::createHTMLDocument() +void HTMLPart::createHTMLDocument() { /* style */ - QString style = QString( "body { font-size: %1pt; font-family: \"%2\"; color: %3; background-color: %4; }" ) - .arg( Kita::Config::threadFont().pointSize() ) - .arg( Kita::Config::threadFont().family() ) - .arg( Kita::Config::threadColor().name() ) - .arg( Kita::Config::threadBackground().name() ); + QString style = QString("body { font-size: %1pt; font-family: \"%2\"; color: %3; background-color: %4; }") + .arg(GlobalConfig::threadFont().pointSize()) + .arg(GlobalConfig::threadFont().family()) + .arg(ColorConfig::thread().name()) + .arg(ColorConfig::threadBackground().name()); QString text = "<html><head><style>"; text += DEFAULT_STYLESHEET; text += style; text += "</style></head><body></body></html>"; - setJScriptEnabled( FALSE ); - setJavaEnabled( FALSE ); + setJScriptEnabled(false); + setJavaEnabled(false); /* Use dummy URL here, and protocol should be "file:". If protocol is "http:", local image files are not shown (for security reasons ?). */ - begin( "file:/dummy.htm" ); - write( text ); + begin(KUrl("file:/dummy.htm")); + write(text); end(); } @@ -194,21 +196,21 @@ * show responses. * @warning don't forget to call updateScreen() later. */ -void KitaHTMLPart::showResponses( int startnum, int endnum ) +void HTMLPart::showResponses(int startnum, int endnum) { - if ( !m_domtree ) return ; + if (!m_domtree) return ; - for ( int i = startnum ; i <= endnum; i++ ) m_domtree->appendRes( i ); + for (int i = startnum ; i <= endnum; i++) m_domtree->appendRes(i); } /* do parsing only. */ /* call showResponses() later */ /* public */ -void KitaHTMLPart::parseResponses( int startnum, int endnum ) +void HTMLPart::parseResponses(int startnum, int endnum) { - if ( !m_domtree ) return ; + if (!m_domtree) return ; - for ( int i = startnum ; i <= endnum; i++ ) m_domtree->createResElement( i ); + for (int i = startnum ; i <= endnum; i++) m_domtree->createResElement(i); } @@ -218,19 +220,19 @@ /* note that updateScreen() is called internally. */ /* So, you need not call it later. */ /* public slot */ -void KitaHTMLPart::showAll() +void HTMLPart::showAll() { - if ( !m_domtree ) return ; + if (!m_domtree) return ; int bottom = m_domtree->getBottomResNumber(); - int readNum = Kita::DatManager::getReadNum( m_datURL ); - if ( bottom != readNum ) { + int readNum = DatManager(m_datUrl).getReadNum(); + if (bottom != readNum) { - QCursor qc; qc.setShape( Qt::WaitCursor ); - QApplication::setOverrideCursor( qc ); + QCursor qc; qc.setShape(Qt::WaitCursor); + QApplication::setOverrideCursor(qc); - showResponses( 1, readNum ); - updateScreen( TRUE, FALSE ); + showResponses(1, readNum); + updateScreen(true, false); QApplication::restoreOverrideCursor(); } @@ -239,29 +241,29 @@ /* * update screen */ -void KitaHTMLPart::updateScreen( bool showHeaderEtc, bool clock ) +void HTMLPart::updateScreen(bool showHeaderEtc, bool clock) { - if ( !m_domtree ) { + if (!m_domtree) { view()->setFocus(); return ; } /* show clock cursor */ - if ( clock ) { - QCursor qc; qc.setShape( Qt::WaitCursor ); - QApplication::setOverrideCursor( qc ); + if (clock) { + QCursor qc; qc.setShape(Qt::WaitCursor); + QApplication::setOverrideCursor(qc); } /* show header, footer, and kokomadeyonda, etc. */ - if ( showHeaderEtc ) { + if (showHeaderEtc) { m_domtree->appendKokoyon(); m_domtree->appendFooterAndHeader(); } /* change color of number of the res which is responsed. */ - if ( m_mode == HTMLPART_MODE_MAINPART ) { + if (m_mode == HTMLPART_MODE_MAINPART) { - if ( Kita::Config::checkResponsed() ) { + if (GlobalConfig::checkResponsed()) { m_domtree->changeColorOfAllResponsedNumber(); } } @@ -269,44 +271,45 @@ /* update display */ htmlDocument().applyChanges(); view()->layout(); - view()->setVScrollBarMode( QScrollView::AlwaysOn ); + view()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); view()->setFocus(); /* restore cursor */ - if ( clock ) { + if (clock) { QApplication::restoreOverrideCursor(); } } /* public */ -void KitaHTMLPart::setInnerHTML( const QString& innerHTML ) +void HTMLPart::setInnerHTML(const QString& innerHTML) { createHTMLDocument(); - htmlDocument().body().setInnerHTML( innerHTML ); + htmlDocument().body().setInnerHTML(innerHTML); } /* redraw screen */ -void KitaHTMLPart::redrawHTMLPart( const KURL& datURL, bool force ) +void HTMLPart::redrawHTMLPart(const KUrl& datUrl, bool force) { - if ( m_domtree == NULL ) return ; - if ( m_datURL != datURL ) return ; + if (m_domtree == 0) return ; + if (m_datUrl != datUrl) return ; - m_domtree->redraw( force ); + m_domtree->redraw(force); } /* public slot */ -void KitaHTMLPart::slotSetFaceOfHTMLPart() +void HTMLPart::slotSetFaceOfHTMLPart() { - QFont font = Kita::Config::threadFont(); + QFont font = GlobalConfig::threadFont(); DOM::CSSStyleDeclaration style = htmlDocument().body().style(); - style.setProperty( "font-family", font.family(), "" ); - style.setProperty( "font-size", QString( "%1pt" ).arg( font.pointSize() ), "" ); - style.setProperty( "color", Kita::Config::threadColor().name(), "" ); - style.setProperty( "background-color", Kita::Config::threadBackground().name(), "" ); + style.setProperty("font-family", font.family(), ""); + style.setProperty("font-size", QString("%1pt").arg(font.pointSize()), ""); + style.setProperty("color", ColorConfig::thread().name(), ""); + style.setProperty("background-color", + ColorConfig::threadBackground().name(), ""); htmlDocument().applyChanges(); } @@ -320,26 +323,30 @@ /* top = centerNum - preShowNum bottom = centerNum + afterShowNum - readNum = Kita::DatManager::getReadNum + readNum = DatManager::getReadNum No.1 <- show -> No.20 <- not show -> No.(top) <- show -> No.(bottom) <- not show -> No.(readNum) */ -bool KitaHTMLPart::load( int centerNum ) +bool HTMLPart::load(int centerNum) { m_centerNum = centerNum; m_jumpNumAfterLoading = 0; - if ( m_mode != HTMLPART_MODE_MAINPART ) return FALSE; - if ( !m_domtree ) return FALSE; - if ( Kita::DatManager::getReadNum( m_datURL ) == 0 ) return FALSE; + if (m_mode != HTMLPART_MODE_MAINPART) + return false; + if (!m_domtree) + return false; + DatManager datManager(m_datUrl); + if (datManager.getReadNum() == 0) + return false; - int endNum = Kita::DatManager::getReadNum( m_datURL ); - showResponses( 1, endNum ); - updateScreen( TRUE , FALSE ); - gotoAnchor( QString().setNum( m_centerNum ), FALSE ); + int endNum = datManager.getReadNum(); + showResponses(1, endNum); + updateScreen(true , false); + gotoAnchor(QString::number(m_centerNum), false); view() ->setFocus(); - return TRUE; + return true; } @@ -349,53 +356,53 @@ /* see also slotReceiveData() and slotFinishLoad(). */ /* public */ -bool KitaHTMLPart::reload( int jumpNum ) +bool HTMLPart::reload(int jumpNum) { - if ( !m_domtree ) return FALSE; - if ( m_mode != HTMLPART_MODE_MAINPART ) { + if (!m_domtree) return false; + if (m_mode != HTMLPART_MODE_MAINPART) { /* If this is not MainPart, then open MainPart. */ - ViewMediator::getInstance()->openURL( m_datURL ); - return FALSE; + ViewMediator::getInstance()->openUrl(m_datUrl); + return false; } - m_firstReceive = TRUE; - if ( m_centerNum == 0 ) m_centerNum = m_domtree->getBottomResNumber(); + m_firstReceive = true; + if (m_centerNum == 0) m_centerNum = m_domtree->getBottomResNumber(); m_jumpNumAfterLoading = jumpNum; /* DatManager will call back slotReceiveData and slotFinishLoad. */ - Kita::DatManager::updateCache( m_datURL , this ); + DatManager(m_datUrl).updateCache(this); view() ->setFocus(); - return TRUE; + return true; } /*---------------------------------------------*/ -/* This slot is called after Kita::DatManager +/* This slot is called after DatManager received new data, and emits receiveData() */ /* !!! "public" slot !!! */ -void KitaHTMLPart::slotReceiveData() +void HTMLPart::slotReceiveData() { const int delta = 20; - if ( m_mode != HTMLPART_MODE_MAINPART ) return ; - if ( !m_domtree ) return ; + if (m_mode != HTMLPART_MODE_MAINPART) return ; + if (!m_domtree) return ; - int readNum = Kita::DatManager::getReadNum( m_datURL ); + int readNum = DatManager(m_datUrl).getReadNum(); int bottom = m_domtree->getBottomResNumber(); /* parsing */ - parseResponses( bottom + 1, readNum ); + parseResponses(bottom + 1, readNum); /* rendering */ - if ( m_firstReceive || bottom + delta < readNum ) { - showResponses( bottom + 1, readNum ); - updateScreen( TRUE, FALSE ); + if (m_firstReceive || bottom + delta < readNum) { + showResponses(bottom + 1, readNum); + updateScreen(true, false); } - if ( m_firstReceive && m_centerNum < readNum ) { - gotoAnchor( QString().setNum( m_centerNum ), FALSE ); - m_firstReceive = FALSE; + if (m_firstReceive && m_centerNum < readNum) { + gotoAnchor(QString::number(m_centerNum), false); + m_firstReceive = false; } emit receiveData(); @@ -403,23 +410,24 @@ /*--------------------------------------------*/ -/* This slot is called after Kita::DatManager +/* This slot is called after DatManager finished updating new data, and emits finishReload() */ /* !!! "public" slot !!! */ -void KitaHTMLPart::slotFinishLoad() +void HTMLPart::slotFinishLoad() { - if ( m_mode != HTMLPART_MODE_MAINPART ) return ; - if ( !m_domtree ) return ; + if (m_mode != HTMLPART_MODE_MAINPART) return ; + if (!m_domtree) return ; int bottom = m_domtree->getBottomResNumber(); int shownNum = m_centerNum + 5000; - showResponses( bottom + 1, shownNum ); - updateScreen( TRUE, FALSE ); + showResponses(bottom + 1, shownNum); + updateScreen(true, false); // m_domtree->parseAllRes(); m_centerNum = 0; - if ( m_jumpNumAfterLoading ) gotoAnchor( QString().setNum( m_jumpNumAfterLoading ), FALSE ); + if (m_jumpNumAfterLoading) + gotoAnchor(QString::number(m_jumpNumAfterLoading), false); m_jumpNumAfterLoading = 0; emit finishReload(); @@ -434,99 +442,100 @@ /* public */ -bool KitaHTMLPart::gotoAnchor( const QString& anc, bool pushPosition ) +bool HTMLPart::gotoAnchor(const QString& anc, bool pushPosition) { - if ( anc == QString::null ) return FALSE; - if ( !m_domtree || m_mode == HTMLPART_MODE_POPUP ) - return KHTMLPart::gotoAnchor( anc ); + if (anc.isEmpty()) return false; + if (!m_domtree || m_mode == HTMLPART_MODE_POPUP) + return KHTMLPart::gotoAnchor(anc); hidePopup(); QString ancstr = anc; int res = ancstr.toInt(); - if ( res > 1 ) { + if (res > 1) { /* is target valid ? */ - if ( !Kita::DatManager::isResValid( m_datURL, res ) ) return FALSE; + if (!DatManager(m_datUrl).isResValid(res)) + return false; - ancstr = QString().setNum( res ); + ancstr = QString::number(res); } - if ( res == 1 ) ancstr = "header"; - if ( pushPosition ) pushCurrentPosition(); + if (res == 1) ancstr = "header"; + if (pushPosition) pushCurrentPosition(); /* KHTMLPart::gotoAnchor() will fail if the thread is not shown. */ /* So KHTMLPart::gotoAnchor() should be called via custom event. */ - /* See also KitaHTMLPart::customEvent() */ - GotoAnchorEvent * e = new GotoAnchorEvent( ancstr ); - QApplication::postEvent( this, e ); // Qt will delete it when done + /* See also HTMLPart::customEvent() */ + GotoAnchorEvent * e = new GotoAnchorEvent(ancstr); + QApplication::postEvent(this, e); // Qt will delete it when done - return TRUE; + return true; } /* jump to kokomade yonda */ /* public slot */ -void KitaHTMLPart::slotGotoKokoyon() +void HTMLPart::slotGotoKokoyon() { - if ( !m_domtree ) return ; - if ( m_mode != HTMLPART_MODE_MAINPART ) return ; + if (!m_domtree) return ; + if (m_mode != HTMLPART_MODE_MAINPART) return ; - int kokoyon = Kita::DatManager::getViewPos( m_datURL ); - gotoAnchor( QString().setNum( kokoyon ), FALSE ); + int kokoyon = DatManager(m_datUrl).getViewPos(); + gotoAnchor(QString::number(kokoyon), false); } /* public slot */ -void KitaHTMLPart::slotGobackAnchor() +void HTMLPart::slotGobackAnchor() { - if ( m_anchorStack.empty() ) return ; + if (m_anchorStack.isEmpty()) return ; QString anc = m_anchorStack.last(); m_anchorStack.pop_back(); - gotoAnchor( anc , FALSE ); + gotoAnchor(anc , false); } /* private */ -void KitaHTMLPart::pushCurrentPosition() +void HTMLPart::pushCurrentPosition() { - m_anchorStack += getCurrentIDofNode(); + m_anchorStack += getCurrentIdOfNode(); } /* find the id of current node */ /* private */ -QString KitaHTMLPart::getCurrentIDofNode() +QString HTMLPart::getCurrentIdOfNode() { DOM::Node node; node = nodeUnderMouse(); - while ( node != NULL && node.nodeName().string() != "div" ) node = node.parentNode(); - if ( node == NULL ) return QString::null; + while (node != 0 && node.nodeName().string() != "div") node = node.parentNode(); + if (node == 0) return QString(); - return static_cast<DOM::Element>( node ).getAttribute( "id" ).string(); + return static_cast<DOM::Element>(node).getAttribute("id").string(); } /* public slot */ -void KitaHTMLPart::slotClickGotoFooter() +void HTMLPart::slotClickGotoFooter() { - if ( !m_domtree || m_mode != HTMLPART_MODE_MAINPART ) { - gotoAnchor( "footer", FALSE ); + if (!m_domtree || m_mode != HTMLPART_MODE_MAINPART) { + gotoAnchor("footer", false); return ; } int bottom = m_domtree->getBottomResNumber(); - int readNum = Kita::DatManager::getReadNum( m_datURL ); + int readNum = DatManager(m_datUrl).getReadNum(); - if ( readNum != bottom ) { - showResponses( bottom + 1, readNum ); - updateScreen( TRUE, TRUE ); + if (readNum != bottom) { + showResponses(bottom + 1, readNum); + updateScreen(true, true); } - gotoAnchor( "footer", FALSE ); + gotoAnchor("footer", false); } @@ -536,9 +545,9 @@ /* private */ -void KitaHTMLPart::findTextInit() +void HTMLPart::findTextInit() { - m_findNode = NULL; + m_findNode = 0; m_findPos = -1; m_find_y = 0; } @@ -546,75 +555,75 @@ /* public */ -bool KitaHTMLPart::findText( const QString &query, bool reverse ) +bool HTMLPart::findText(const QString &query, bool reverse) { - if ( m_mode != HTMLPART_MODE_MAINPART ) return FALSE; + if (m_mode != HTMLPART_MODE_MAINPART) return false; - QRegExp regexp( query ); - regexp.setCaseSensitive( FALSE ); + QRegExp regexp(query); + regexp.setCaseSensitivity(Qt::CaseInsensitive); /* init */ - if ( m_findNode.isNull() ) { + if (m_findNode.isNull()) { m_findNode = htmlDocument().body(); m_find_y = 0; /* move to the last child node */ - if ( reverse ) { - while ( !m_findNode.lastChild().isNull() ) m_findNode = m_findNode.lastChild(); + if (reverse) { + while (!m_findNode.lastChild().isNull()) m_findNode = m_findNode.lastChild(); m_find_y = view() ->contentsHeight(); } } - while ( 1 ) { + while (1) { - if ( m_findNode.nodeType() == DOM::Node::TEXT_NODE - || m_findNode.nodeType() == DOM::Node::CDATA_SECTION_NODE ) { + if (m_findNode.nodeType() == DOM::Node::TEXT_NODE + || m_findNode.nodeType() == DOM::Node::CDATA_SECTION_NODE) { /* find the word in the current node */ DOM::DOMString nodeText = m_findNode.nodeValue(); QString nodestr = nodeText.string(); - if ( reverse && m_findPos != -1 ) nodestr.setLength( m_findPos ); + if (reverse && m_findPos != -1) nodestr.resize(m_findPos); - if ( reverse ) m_findPos = nodestr.findRev( regexp, m_findPos ); - else m_findPos = nodestr.find( regexp, m_findPos + 1 ); + if (reverse) m_findPos = nodestr.lastIndexOf(regexp, m_findPos); + else m_findPos = nodestr.indexOf(regexp, m_findPos + 1); /* scroll & select & return */ - if ( m_findPos != -1 ) { + if (m_findPos != -1) { int matchLen = regexp.matchedLength(); QRect qr = m_findNode.getRect(); - view() ->setContentsPos( qr.left() - 50, m_find_y - 100 ); - DOM::Range rg( m_findNode, m_findPos, m_findNode, m_findPos + matchLen ); - setSelection( rg ); + view() ->setContentsPos(qr.left() - 50, m_find_y - 100); + DOM::Range rg(m_findNode, m_findPos, m_findNode, m_findPos + matchLen); + setSelection(rg); - return TRUE; + return true; } - } else if ( m_findNode.nodeName().string() == "table" ) { + } else if (m_findNode.nodeName().string() == "table") { QRect qr = m_findNode.getRect(); m_find_y = qr.bottom(); - } else if ( m_findNode.nodeName().string() == "div" ) { + } else if (m_findNode.nodeName().string() == "div") { QRect qr = m_findNode.getRect(); - if ( reverse ) { + if (reverse) { m_find_y = qr.bottom(); } else { m_find_y = qr.top(); } - } else if ( m_findNode.nodeName().string() == "br" ) { + } else if (m_findNode.nodeName().string() == "br") { DOM::Node tmpnode = m_findNode.previousSibling(); - if ( tmpnode != NULL ) { + if (tmpnode != 0) { QRect qr = tmpnode.getRect(); - if ( reverse ) m_find_y -= qr.bottom() - qr.top(); + if (reverse) m_find_y -= qr.bottom() - qr.top(); else m_find_y += qr.bottom() - qr.top(); } } @@ -625,14 +634,14 @@ DOM::Node next; /* move to the next node */ - if ( !reverse ) { + if (!reverse) { next = m_findNode.firstChild(); - if ( next.isNull() ) next = m_findNode.nextSibling(); + if (next.isNull()) next = m_findNode.nextSibling(); - while ( !m_findNode.isNull() && next.isNull() ) { + while (!m_findNode.isNull() && next.isNull()) { m_findNode = m_findNode.parentNode(); - if ( !m_findNode.isNull() ) { + if (!m_findNode.isNull()) { next = m_findNode.nextSibling(); } } @@ -641,24 +650,24 @@ else { next = m_findNode.lastChild(); - if ( next.isNull() ) next = m_findNode.previousSibling(); + if (next.isNull()) next = m_findNode.previousSibling(); - while ( !m_findNode.isNull() && next.isNull() ) { + while (!m_findNode.isNull() && next.isNull()) { m_findNode = m_findNode.parentNode(); - if ( !m_findNode.isNull() ) { + if (!m_findNode.isNull()) { next = m_findNode.previousSibling(); } } } m_findNode = next; - if ( m_findNode.isNull() ) { - m_findNode = NULL; - return FALSE; + if (m_findNode.isNull()) { + m_findNode = 0; + return false; } } - return FALSE; + return false; } @@ -672,192 +681,178 @@ /* private */ -void KitaHTMLPart::showPopupMenu( const KURL& kurl ) +void HTMLPart::showPopupMenu(const KUrl& kurl) { - enum { - ID_Home_Link, - ID_Koko_Link, - ID_End_Link, + QString url = kurl.prettyUrl(); + bool showppm = false; - ID_COPY_Link, - ID_Copy_Str, - ID_Abone_Word, - ID_Open_Browser, - - /*-----------------*/ - ID_Back_Link /* stay bottom */ - }; - - QPoint point = QCursor::pos(); - QString url = kurl.prettyURL(); - bool showppm = FALSE; - const int ID_Goto_Mark = ID_Back_Link + m_anchorStack.size(); - QString str; /* If selected Text is composed of only digits, then show res popup. */ - if ( !m_pushctrl && showSelectedDigitPopup() ) return ; + if (!m_pushctrl && showSelectedDigitPopup()) return ; /*-----------------------------------*/ /* create menu items */ - KPopupMenu* popupMenu = new KPopupMenu( view() ); - KPopupMenu* backSubMenu = NULL; - KPopupMenu* markSubMenu = NULL; + KMenu popupMenu(view()); + KMenu* backSubMenu = 0; + KMenu* markSubMenu = 0; - popupMenu->clear(); - /*------*/ /* jump */ - if ( m_domtree && - ( m_mode == HTMLPART_MODE_MAINPART ) ) { + KAction* homeLinkAct = 0; + KAction* kokoLinkAct = 0; + KAction* endLinkAct = 0; + if (m_domtree && + (m_mode == HTMLPART_MODE_MAINPART)) { - showppm = TRUE; + showppm = true; - /* back */ - if ( !m_anchorStack.empty() ) { - backSubMenu = new KPopupMenu( view() ); - backSubMenu->clear(); + DatManager datManager(m_datUrl); + // back + if (!m_anchorStack.isEmpty()) { + backSubMenu = new KMenu(view()); int i = m_anchorStack.size(); QStringList::iterator it; - for ( it = m_anchorStack.begin(); it != m_anchorStack.end(); it++, i-- ) { - str = ( *it ) + " " + Kita::DatManager::getPlainBody( m_datURL, ( *it ).toInt() ).left( 10 ); - backSubMenu->insertItem( str, ID_Back_Link + ( i - 1 ), 0 ); + for (it = m_anchorStack.begin(); it != m_anchorStack.end(); it++, i--) { + str = (*it) + " " + datManager.getPlainBody((*it).toInt()).left(10); + KAction* backLink = new KAction(str, this); + backSubMenu->addAction(backLink); } - - popupMenu->insertItem( i18n( "Back" ), backSubMenu ); - popupMenu->insertSeparator(); + backSubMenu->setTitle( + i18nc("@title:menu Go back to the responses", "Back")); + popupMenu.addMenu(backSubMenu); + popupMenu.addSeparator(); } - /* mark */ - int readNum = Kita::DatManager::getReadNum( m_datURL ); - for ( int i = 1; i <= readNum ; i++ ) { - if ( Kita::DatManager::isMarked( m_datURL, i ) ) { - if ( !markSubMenu ) { - markSubMenu = new KPopupMenu( view() ); - markSubMenu->clear(); - popupMenu->insertItem( i18n( "Mark" ), markSubMenu ); - popupMenu->insertSeparator(); + // mark + int readNum = datManager.getReadNum(); + for (int i = 1; i <= readNum ; i++) { + if (datManager.isMarked(i)) { + if (!markSubMenu) { + markSubMenu = new KMenu(view()); + markSubMenu->setTitle(i18nc("@title:menu", "Mark")); + popupMenu.addMenu(markSubMenu); + popupMenu.addSeparator(); } - - str = QString().setNum( i ) + " " + Kita::DatManager::getPlainBody( m_datURL, i ).left( 10 ); - markSubMenu->insertItem( str, ID_Goto_Mark + i ); + str = QString::number(i) + " " + + datManager.getPlainBody(i).left(10); + KAction *gotoMarkAct = new KAction(str, this); + markSubMenu->addAction(gotoMarkAct); } } - /* home */ - popupMenu->insertItem( i18n( "Start" ), ID_Home_Link ); + // home + homeLinkAct = new KAction( + i18nc("@action:inmenu Go to the original post", "Start"), this); + popupMenu.addAction(homeLinkAct); - - /* template */ - if ( m_mode == HTMLPART_MODE_MAINPART ) { - - int kokoyon = Kita::DatManager::getViewPos( m_datURL ); - if ( kokoyon ) { - str = i18n( "Kokomade Yonda (%1)" ).arg( kokoyon ); - popupMenu->insertItem( str, ID_Koko_Link ); + // template + if (m_mode == HTMLPART_MODE_MAINPART) { + int kokoyon = datManager.getViewPos(); + if (kokoyon) { + str = i18nc("@action:inmenu", "Kokomade Yonda (%1)", kokoyon); + kokoLinkAct = new KAction(str, this); + popupMenu.addAction(kokoLinkAct); } } - - /* end */ - popupMenu->insertItem( i18n( "End" ), ID_End_Link ); + // end + endLinkAct = new KAction(i18nc("@action:inmenu", "End"), this); + popupMenu.addAction(endLinkAct); } + // copy & abone + KAction* copyStrAct = 0; + KAction* aboneWordAct = 0; + if (hasSelection()) { + if (showppm) popupMenu.addSeparator(); + showppm = true; - /*--------------*/ - /* copy & abone */ - if ( hasSelection() ) { - if ( showppm ) popupMenu->insertSeparator(); - showppm = TRUE; + copyStrAct = new KAction(i18nc("@action:inmenu", "Copy"), this); + popupMenu.addAction(copyStrAct); - popupMenu->insertItem( "Copy", ID_Copy_Str ); - // truncated QString selectedStr = selectedText(); - if ( selectedStr.length() > 20 ) { - selectedStr.truncate( 20 ); - selectedStr.append( "..." ); + if (selectedStr.length() > 20) { + selectedStr.truncate(20); + selectedStr.append("..."); } - popupMenu->insertItem( i18n( "Add '%1' to abone list" ).arg( selectedStr ), ID_Abone_Word ); + aboneWordAct = new KAction(i18nc("@action:inmenu", + "Add '%1' to abone list", selectedStr), this); + popupMenu.addAction(aboneWordAct); } - /*-----------*/ - /* copy link */ - if ( url != QString::null ) { - if ( showppm ) popupMenu->insertSeparator(); - showppm = TRUE; + // copy link + KAction* openBrowserAct = 0; + KAction* copyLinkAct = 0; + if (!url.isEmpty()) { + if (showppm) popupMenu.addSeparator(); + showppm = true; - popupMenu->insertItem( i18n( "Open with Web Browser" ), ID_Open_Browser ); - popupMenu->insertSeparator(); - popupMenu->insertItem( i18n( "Copy Link Location" ), ID_COPY_Link ); + openBrowserAct= new KAction(i18nc("@action:inmenu", + "Open with Web Browser"), this); + popupMenu.addAction(openBrowserAct); + popupMenu.addSeparator(); + + copyLinkAct = new KAction(i18nc("@action:inmenu", + "Copy Link Location"), this); + popupMenu.addAction(copyLinkAct); } - /*-----------------------------------*/ + // show menu + if (showppm) { - /* show menu */ - if ( showppm ) { - QClipboard * clipboard = QApplication::clipboard(); - int ret = popupMenu->exec( point ); - switch ( ret ) { - case ID_COPY_Link: - clipboard->setText( url , QClipboard::Clipboard ); - clipboard->setText( url , QClipboard::Selection ); - break; - - case ID_Open_Browser: - KRun::runURL( url, "text/html" ); - break; - - case ID_Home_Link: gotoAnchor( "header", FALSE ); break; - - case ID_Koko_Link: slotGotoKokoyon(); break; - - case ID_End_Link: slotClickGotoFooter(); break; - - case ID_Copy_Str: - clipboard->setText( selectedText(), QClipboard::Clipboard ); - break; - - case ID_Abone_Word: - - if ( QMessageBox::information( view(), "Kita", - i18n( "Do you want to add '%1' to abone list ?" ).arg( selectedText() ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - == QMessageBox::Ok ) { - - Kita::AboneConfig::aboneWordList().append( selectedText() ); - redrawHTMLPart( m_datURL, FALSE ); + QAction* action = popupMenu.exec(QCursor::pos()); + if (!action) { + delete backSubMenu; + delete markSubMenu; + return; + } + if (action == copyLinkAct) { + clipboard->setText(url , QClipboard::Clipboard); + clipboard->setText(url , QClipboard::Selection); + } else if (action == openBrowserAct) { + KRun::runUrl(kurl, "text/html", view()); + } else if (action == homeLinkAct) { + gotoAnchor("header", false); + } else if (action == kokoLinkAct) { + slotGotoKokoyon(); + } else if (action == endLinkAct) { + slotClickGotoFooter(); + } else if (action == copyStrAct) { + clipboard->setText(selectedText(), QClipboard::Clipboard); + } else if (action == aboneWordAct) { + if (KMessageBox::warningYesNo(view(), + i18n("Do you want to add '%1' to abone list?", + selectedText())) == KMessageBox::Yes) { + AboneConfig::aboneWordList().append(selectedText()); + redrawHTMLPart(m_datUrl, false); } - - break; - - default: - - /* mark */ - if ( ret >= ID_Goto_Mark ) { - gotoAnchor( QString().setNum( ret - ID_Goto_Mark ), FALSE ); + } else { + QMenu* menu = action->menu(); + if (!menu) { + delete backSubMenu; + delete markSubMenu; + return; } - - /* back */ - else if ( ret >= ID_Back_Link ) { - for ( int i = 0; i < ret - ID_Back_Link; i++ ) m_anchorStack.pop_back(); + if (menu == markSubMenu) { + gotoAnchor(QString::number(menu->actions().indexOf(action)), + false); + } else if (menu == backSubMenu) { + for (int i = 0; i < menu->actions().indexOf(action); i++) + m_anchorStack.pop_back(); slotGobackAnchor(); } - - break; } - } - - if ( popupMenu ) delete popupMenu; - if ( backSubMenu ) delete backSubMenu; - if ( markSubMenu ) delete markSubMenu; + delete backSubMenu; + delete markSubMenu; } /*---------------------------------------------------------------*/ @@ -866,14 +861,14 @@ /* protected */ /* virtual */ -void KitaHTMLPart::customEvent( QCustomEvent * e ) +void HTMLPart::customEvent(QEvent * e) { - if ( e->type() == EVENT_GotoAnchor ) { - KHTMLPart::gotoAnchor( static_cast< GotoAnchorEvent* >( e ) ->getAnc() ); + if (e->type() == EVENT_GotoAnchor) { + KHTMLPart::gotoAnchor(static_cast< GotoAnchorEvent* >(e) ->getAnc()); return ; } - KHTMLPart::customEvent( e ); + KHTMLPart::customEvent(e); } @@ -883,39 +878,39 @@ /* protected */ -void KitaHTMLPart::khtmlMousePressEvent( khtml::MousePressEvent* e ) +void HTMLPart::khtmlMousePressEvent(khtml::MousePressEvent* e) { - emit mousePressed(); /* to KitaThreadView to focus this view. */ + emit mousePressed(); /* to ThreadView to focus this view. */ - KURL kurl; - if ( e->url().string() != QString::null ) - kurl = KURL( Kita::BoardManager::boardURL( m_datURL ), e->url().string() ); + KUrl kurl; + if (!e->url().string().isEmpty()) + kurl = KUrl(BoardManager::boardUrl(m_datUrl), e->url().string()); - m_pushctrl = m_pushmidbt = m_pushrightbt = FALSE; - if ( e->qmouseEvent() ->button() & Qt::RightButton ) m_pushrightbt = TRUE; - if ( e->qmouseEvent() ->state() & Qt::ControlButton ) m_pushctrl = TRUE; - if ( e->qmouseEvent() ->button() & Qt::MidButton ) m_pushmidbt = TRUE; + m_pushctrl = m_pushmidbt = m_pushrightbt = false; + if (e->qmouseEvent() ->button() & Qt::RightButton) m_pushrightbt = true; + if (e->qmouseEvent() ->modifiers() & Qt::ControlModifier) m_pushctrl = true; + if (e->qmouseEvent() ->button() & Qt::MidButton) m_pushmidbt = true; - if ( e->url() != NULL ) { + if (e->url() != 0) { - if ( e->url().string().at( 0 ) == '#' ) { /* anchor */ - kurl = m_datURL; - kurl.setRef( e->url().string().mid( 1 ) ) ; + if (e->url().string().at(0) == '#') { /* anchor */ + kurl = m_datUrl; + kurl.setRef(e->url().string().mid(1)) ; } - clickAnchor( kurl ); - m_pushctrl = m_pushmidbt = m_pushrightbt = FALSE; + clickAnchor(kurl); + m_pushctrl = m_pushmidbt = m_pushrightbt = false; return ; } /* popup menu */ - if ( m_pushrightbt ) { - showPopupMenu( kurl ); - m_pushctrl = m_pushmidbt = m_pushrightbt = FALSE; + if (m_pushrightbt) { + showPopupMenu(kurl); + m_pushctrl = m_pushmidbt = m_pushrightbt = false; return ; } - KHTMLPart::khtmlMousePressEvent( e ); + KHTMLPart::khtmlMousePressEvent(e); } @@ -929,23 +924,23 @@ /* private slot */ -void KitaHTMLPart::slotOpenURLRequest( const KURL& urlin, const KParts::URLArgs& ) +void HTMLPart::slotOpenUrlRequest(const KUrl& urlin, const KParts::OpenUrlArguments&) { - clickAnchor( urlin ); + clickAnchor(urlin); } /*------------------------------------------------------*/ /* This function is called when user clicked res anchor */ /* private */ -void KitaHTMLPart::clickAnchor( const KURL& urlin ) +void HTMLPart::clickAnchor(const KUrl& urlin) { QString refstr; - KURL datURL = Kita::getDatURL( urlin , refstr ); + KUrl datUrl = getDatUrl(urlin , refstr); /*--------------------*/ /* Ctrl + right click */ - if ( m_pushctrl && m_pushrightbt ) { - showPopupMenu( urlin ); + if (m_pushctrl && m_pushrightbt) { + showPopupMenu(urlin); return ; } @@ -953,57 +948,57 @@ /* If this is not anchor, then */ /* emit openURLRequest and return */ - if ( datURL.host() != m_datURL.host() || datURL.path() != m_datURL.path() ) { + if (datUrl.host() != m_datUrl.host() || datUrl.path() != m_datUrl.path()) { /* right click */ - if ( m_pushrightbt ) { + if (m_pushrightbt) { /* start multi-popup mode or show popup menu */ - if ( !startMultiPopup() ) showPopupMenu( urlin ); + if (!startMultiPopup()) showPopupMenu(urlin); return ; } /* right click */ - ViewMediator::getInstance()->openURL( urlin ); + ViewMediator::getInstance()->openUrl(urlin); return ; } - if ( refstr == QString::null ) return ; + if (refstr.isEmpty()) return ; /*---------------------------*/ /* show popupmenu for #write */ - if ( refstr.left( 5 ) == "write" ) { - showWritePopupMenu( refstr ); + if (refstr.left(5) == "write") { + showWritePopupMenu(refstr); return ; } /*----------------------------*/ /* extract responses by ID */ - if ( refstr.left( 5 ) == "idpop" ) { - showIDPopup( refstr ); + if (refstr.left(5) == "idpop") { + showIdPopup(refstr); return ; } /*---------------------------*/ /* show popupmenu for #bepop */ - if ( refstr.left( 5 ) == "bepop" ) { - showBePopupMenu( refstr ); + if (refstr.left(5) == "bepop") { + showBePopupMenu(refstr); return ; } /*-------------------------*/ /* start multi-popup mdde */ - if ( m_pushrightbt && startMultiPopup() ) return ; + if (m_pushrightbt && startMultiPopup()) return ; /*----------------------------*/ /* next 100 ,before 100 ,etc. */ - if ( m_mode == HTMLPART_MODE_MAINPART ) { - if ( refstr.left( 7 ) == "tosaigo" ) { + if (m_mode == HTMLPART_MODE_MAINPART) { + if (refstr.left(7) == "tosaigo") { slotClickGotoFooter(); return; } @@ -1014,23 +1009,23 @@ int refNum, refNum2; - int i = refstr.find( "-" ); - if ( i != -1 ) { - refNum = refstr.left( i ).toInt(); - refNum2 = refstr.mid( i + 1 ).toInt(); - if ( refNum2 < refNum ) { + int i = refstr.indexOf("-"); + if (i != -1) { + refNum = refstr.left(i).toInt(); + refNum2 = refstr.mid(i + 1).toInt(); + if (refNum2 < refNum) { refNum2 = refNum; } } else { refNum = refNum2 = refstr.toInt(); } - if ( !refNum ) return ; + if (!refNum) return ; - if ( m_mode == HTMLPART_MODE_POPUP ) { - ViewMediator::getInstance()->openURL( urlin ); + if (m_mode == HTMLPART_MODE_POPUP) { + ViewMediator::getInstance()->openUrl(urlin); } else { - gotoAnchor( QString().setNum( refNum ), TRUE ); + gotoAnchor(QString::number(refNum), true); } } @@ -1039,36 +1034,22 @@ /*---------------------------------------------------------*/ /* popup menu that is opened when user clicked res number. */ /* This funtcion is called in only clickAnchor(). */ /* private */ -void KitaHTMLPart::showWritePopupMenu( const QString& refstr ) +void HTMLPart::showWritePopupMenu(const QString& refstr) { - enum{ - WRITEMENU_RES, - WRITEMENU_QUOTE, - WRITEMENU_SHOWBROWSER, - WRITEMENU_RESTREE, - WRITEMENU_REVERSERESTREE, - WRITEMENU_EXTRACTNAME, - WRITEMENU_COPY, - WRITEMENU_COPYURL, - WRITEMENU_COPYTHREADNAME, - WRITEMENU_SETKOKOYON, - WRITEMENU_MARK, - WRITEMENU_ABONENAME - }; - QClipboard * clipboard = QApplication::clipboard(); QString str, resstr; - int resNum = refstr.mid( 5 ).toInt(); - QString namestr = Kita::DatManager::getPlainName( m_datURL, resNum ); + int resNum = refstr.mid(5).toInt(); + DatManager datManager(m_datUrl); + QString namestr = datManager.getPlainName(resNum); /* show res tree */ - if ( m_pushrightbt ) { + if (m_pushrightbt) { int num; - QString htmlstr = Kita::DatManager::getTreeByRes( m_datURL, resNum, num ); - if ( !num ) return ; - QString tmpstr = QString( "<DIV>No.%1 : [%2]<BR>" ).arg( resNum ).arg( num ); + QString htmlstr = datManager.getTreeByRes(resNum, num); + if (!num) return ; + QString tmpstr = QString("<DIV>No.%1 : [%2]<BR>").arg(resNum).arg(num); tmpstr += htmlstr + "<BR><BR></DIV>"; - showPopup( m_datURL, tmpstr ); + showPopup(m_datUrl, tmpstr); startMultiPopup(); return ; } @@ -1077,128 +1058,138 @@ /* create popup menu */ QString plainStr; - KPopupMenu *popupMenu = new KPopupMenu( view() ); - popupMenu->clear(); + KMenu popupMenu(view()); - /* write */ - if ( m_mode == HTMLPART_MODE_MAINPART ) { + KAction* resAct = 0; + KAction* quoteAct = 0; + if (m_mode == HTMLPART_MODE_MAINPART) { + resAct = new KAction(i18nc("@action:inmenu", "Write Response"), this); + popupMenu.addAction(resAct); + + quoteAct = new KAction(i18nc("@action:inmenu", "Quote This"), this); + popupMenu.addAction(quoteAct); - popupMenu->insertItem( i18n( "write response" ), WRITEMENU_RES ); - popupMenu->insertItem( i18n( "quote this" ), WRITEMENU_QUOTE ); - popupMenu->insertSeparator(); - + popupMenu.addSeparator(); } - /* mark */ - popupMenu->insertItem( i18n( "Mark" ), WRITEMENU_MARK ); - popupMenu->setItemChecked( WRITEMENU_MARK, Kita::DatManager::isMarked( m_datURL, resNum ) ); - popupMenu->insertSeparator(); + // mark + KAction* markAct = new KAction(i18nc("@action:inmenu", "Mark"), this); + markAct->setCheckable(true); + markAct->setChecked(datManager.isMarked(resNum)); + popupMenu.addAction(markAct); - /* open */ - popupMenu->insertItem( i18n( "Open with Web Browser" ), WRITEMENU_SHOWBROWSER ); - popupMenu->insertSeparator(); + popupMenu.addSeparator(); - /* util */ - popupMenu->insertItem( i18n( "res tree" ), WRITEMENU_RESTREE ); - popupMenu->insertItem( i18n( "reverse res tree" ), WRITEMENU_REVERSERESTREE ); - popupMenu->insertItem( i18n( "extract by name" ), WRITEMENU_EXTRACTNAME ); - popupMenu->insertSeparator(); + // open + KAction* showBrowserAct + = new KAction(i18nc("@action:inmenu", "Open with Web Browser"), this); + popupMenu.addAction(showBrowserAct); - /* copy */ - popupMenu->insertItem( i18n( "copy URL" ), WRITEMENU_COPYURL ); - popupMenu->insertItem( i18n( "Copy title and URL" ), WRITEMENU_COPYTHREADNAME ); - popupMenu->insertItem( i18n( "copy" ), WRITEMENU_COPY ); + popupMenu.addSeparator(); - /* kokkoma de yonda */ - if ( m_domtree && m_mode == HTMLPART_MODE_MAINPART ) { - popupMenu->insertSeparator(); - popupMenu->insertItem( i18n( "set Kokomade Yonda" ), WRITEMENU_SETKOKOYON ); - } + // util + KAction* resTreeAct + = new KAction(i18nc("@action:inmenu", "Res Tree"), this); + popupMenu.addAction(resTreeAct); - /* abone */ - popupMenu->insertSeparator(); - popupMenu->insertItem( i18n( "add name to abone list" ), WRITEMENU_ABONENAME ); + KAction* reverseResTreeAct + = new KAction(i18nc("@action:inmenu", "Reverse Res Tree"), this); + popupMenu.addAction(reverseResTreeAct); + KAction* extractNameAct + = new KAction(i18nc("@action:inmenu", "Extract by Name"), this); + popupMenu.addAction(extractNameAct); - /*--------------------------------------*/ - /* show popup menu */ + popupMenu.addSeparator(); - int ret = popupMenu->exec( QCursor::pos() ); - delete popupMenu; - switch ( ret ) { + // copy + KAction* copyUrlAct + = new KAction(i18nc("@action:inmenu", "Copy URL"), this); + popupMenu.addAction(copyUrlAct); - case WRITEMENU_RES: - resstr = ">>" + QString().setNum( resNum ) + "\n"; - ViewMediator::getInstance()->showWriteView( m_datURL, resstr ); - break; + KAction* copyThreadNameAct + = new KAction(i18nc("@action:inmenu", "Copy Title and URL"), this); + popupMenu.addAction(copyThreadNameAct); - case WRITEMENU_QUOTE: - resstr = ">>" + QString().setNum( resNum ) + "\n" - + "> " + Kita::DatManager::getPlainTitle( m_datURL, resNum ) + "\n" - + "> " + Kita::DatManager::getPlainBody( m_datURL, resNum ).replace( "\n", "\n> " ) + "\n"; - ViewMediator::getInstance()->showWriteView( m_datURL, resstr ); - break; + KAction* copyAct = new KAction(i18nc("@action:inmenu", "Copy"), this); + popupMenu.addAction(copyAct); - case WRITEMENU_MARK: - Kita::DatManager::setMark( m_datURL, resNum, ! Kita::DatManager::isMarked( m_datURL, resNum ) ); - break; + // kokkoma de yonda + KAction* setKokoYonAct = 0; + if (m_domtree && m_mode == HTMLPART_MODE_MAINPART) { + popupMenu.addSeparator(); - case WRITEMENU_COPY: - case WRITEMENU_COPYURL: - case WRITEMENU_COPYTHREADNAME: - str = QString::null; + setKokoYonAct + = new KAction(i18nc("@action:inmenu", "Set Kokomade Yonda"), this); + popupMenu.addAction(setKokoYonAct); + } - /* title */ - if ( ret == WRITEMENU_COPYTHREADNAME || ret == WRITEMENU_COPY ) { - str = Kita::DatManager::threadName( m_datURL ); - } + // abone + popupMenu.addSeparator(); - /* url */ - if ( str != QString::null ) str += "\n"; - str += Kita::DatManager::threadURL( m_datURL ) + "/" + QString().setNum( resNum ) + "\n"; + KAction* aboneNameAct + = new KAction(i18nc("@action:inmenu", "Add Name to Abone List"), this); + popupMenu.addAction(aboneNameAct); - /* body */ - if ( ret == WRITEMENU_COPY ) { - str += "\n" - + Kita::DatManager::getPlainTitle( m_datURL, resNum ) + "\n" - + Kita::DatManager::getPlainBody( m_datURL, resNum ) + "\n"; - } - /* copy */ - clipboard->setText( str , QClipboard::Clipboard ); - clipboard->setText( str , QClipboard::Selection ); - break; + // show popup menu + QAction* action = popupMenu.exec(QCursor::pos()); + if (!action) { + return; + } + if (action == resAct) { + resstr = ">>" + QString::number(resNum) + '\n'; + ViewMediator::getInstance()->showWriteView(m_datUrl, resstr); + } else if (action == quoteAct) { + resstr = ">>" + QString::number(resNum) + '\n' + + "> " + datManager.getPlainTitle(resNum) + '\n' + + "> " + datManager.getPlainBody(resNum).replace('\n', "\n> ") + '\n'; + ViewMediator::getInstance()->showWriteView(m_datUrl, resstr); + } else if (action == markAct) { + datManager.setMark(resNum, !datManager.isMarked(resNum)); + } else if (action == copyAct || action == copyUrlAct || action == copyThreadNameAct) { + str.clear(); + // title + if (action == copyThreadNameAct || action == copyAct) { + str = datManager.threadName(); + } - case WRITEMENU_SETKOKOYON: - Kita::DatManager::setViewPos( m_datURL, resNum ); - ViewMediator::getInstance()->updateBoardView( m_datURL ); - m_updatedKokoyon = TRUE; - updateScreen( TRUE, TRUE ); - gotoAnchor( QString().setNum( resNum ), FALSE ); - break; + // url + if (!str.isEmpty()) str += '\n'; + str += datManager.threadUrl() + '/' + QString::number(resNum) + + '\n'; - case WRITEMENU_SHOWBROWSER: - str = Kita::DatManager::threadURL( m_datURL ) + "/" + QString().setNum( resNum ); + // body + if (action == copyAct) { + str += '\n' + + datManager.getPlainTitle(resNum) + '\n' + + datManager.getPlainBody(resNum) + '\n'; + } - KRun::runURL( str, "text/html" ); - break; + // copy + clipboard->setText(str , QClipboard::Clipboard); + clipboard->setText(str , QClipboard::Selection); - case WRITEMENU_ABONENAME: - if ( QMessageBox::information( view(), "Kita", - i18n( "Do you want to add '%1' to abone list ?" ).arg( namestr ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - == QMessageBox::Ok ) { + } else if (action == setKokoYonAct) { + datManager.setViewPos(resNum); + ViewMediator::getInstance()->updateBoardView(m_datUrl); + m_updatedKokoyon = true; + updateScreen(true, true); + gotoAnchor(QString::number(resNum), false); - Kita::AboneConfig::aboneNameList().append( namestr ); - redrawHTMLPart( m_datURL, FALSE ); - } - break; + } else if (action == showBrowserAct) { + str = datManager.threadUrl() + '/' + QString::number(resNum); - default: - break; + KRun::runUrl(str, "text/html", view()); + } else if (action == aboneNameAct) { + if (KMessageBox::warningYesNo(view(), + i18n("Do you want to add '%1' to abone list?", namestr), + "Kita") == KMessageBox::Yes) { + AboneConfig::aboneNameList().append(namestr); + redrawHTMLPart(m_datUrl, false); + } } - } @@ -1206,51 +1197,42 @@ /*--------------------------------------------------*/ /* popup that is opened when user clicked ID */ /* This funtcion is called in only clickAnchor(). */ /* private */ -void KitaHTMLPart::showIDPopup( const QString& refstr ) +void HTMLPart::showIdPopup(const QString& refstr) { - QString strid = refstr.mid( 5 ) - .replace( "%2B", "+" ) - .replace( "%2F", "/" ); + QString strid = refstr.mid(5) + .replace("%2B", "+") + .replace("%2F", "/"); /* popup */ - if ( m_pushrightbt ) { + if (m_pushrightbt) { int num; - QString htmlstr - = Kita::DatManager::getHtmlByID( m_datURL, strid, num ); - if ( num <= 1 ) return ; - QString tmpstr = QString( "<DIV>ID:%1:[%2]<BR>" ).arg( strid ).arg( num ); + QString htmlstr = DatManager(m_datUrl).getHtmlById(strid, num); + if (num <= 1) return ; + QString tmpstr = QString("<DIV>ID:%1:[%2]<BR>").arg(strid).arg(num); tmpstr += htmlstr + "<BR><BR></DIV>"; - showPopup( m_datURL, tmpstr ); + showPopup(m_datUrl, tmpstr); startMultiPopup(); } else { + KMenu popupMenu(view()); - enum{ - IDMENU_ABONE - }; + KAction* aboneAct = new KAction(i18nc("@action:inmenu", + "Add Id to Abone List"), this); + popupMenu.addAction(aboneAct); - KPopupMenu *popupMenu = new KPopupMenu( view() ); - popupMenu->clear(); - popupMenu->insertItem( i18n( "add id to abone list" ), IDMENU_ABONE ); - int ret = popupMenu->exec( QCursor::pos() ); - delete popupMenu; - switch ( ret ) { - - case IDMENU_ABONE: - /* add ID to abone list */ - if ( QMessageBox::information( view(), "Kita", - i18n( "Do you want to add '%1' to abone list ?" ).arg( strid ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - == QMessageBox::Ok ) { - - Kita::AboneConfig::aboneIDList().append( strid ); - redrawHTMLPart( m_datURL, FALSE ); + QAction* action = popupMenu.exec(QCursor::pos()); + if (!action) { + return; + } + if (action == aboneAct) { + // add ID to abone list + if (KMessageBox::warningYesNo(view(), + i18n("Do you want to add '%1' to abone list?", strid), + "Kita") == KMessageBox::Yes) { + AboneConfig::aboneIDList().append(strid); + redrawHTMLPart(m_datUrl, false); } - break; - - default: - break; } } } @@ -1260,49 +1242,38 @@ /*---------------------------------------------------------*/ /* popup menu that is opened when user clicked be anchor. */ /* This funtcion is called in only clickAnchor(). */ /* private */ -void KitaHTMLPart::showBePopupMenu( const QString& refstr ) +void HTMLPart::showBePopupMenu(const QString& refstr) { - QString strURL = "http://be.2ch.net/test/p.php?i=" + refstr.mid( 5 ) - + "&u=d:" + Kita::DatManager::threadURL( m_datURL ) + "/l50"; + QString strUrl = "http://be.2ch.net/test/p.php?i=" + refstr.mid(5) + + "&u=d:" + DatManager(m_datUrl).threadUrl() + "/l50"; - if ( m_pushrightbt ) { - /*---------------------*/ - /* create popup menu */ - KPopupMenu *popupMenu = new KPopupMenu( view() ); - popupMenu->clear(); - - enum{ - BEMENU_COPYURL, - BEMENU_SHOWBROWSER - }; - + if (m_pushrightbt) { + // create popup menu + KMenu popupMenu(view()); + QClipboard * clipboard = QApplication::clipboard(); - popupMenu->insertItem( i18n( "copy URL" ), BEMENU_COPYURL ); - popupMenu->insertItem( i18n( "Open with Web Browser" ), BEMENU_SHOWBROWSER ); + KAction* copyUrlAct + = new KAction(i18nc("@action:inmenu", "copy URL"), this); + popupMenu.addAction(copyUrlAct); - /*--------------------------------------*/ - /* show popup menu */ + KAction* showBrowserAct = new KAction(i18nc("@action:inmenu", + "Open with Web Browser"), this); - int ret = popupMenu->exec( QCursor::pos() ); - delete popupMenu; - switch ( ret ) { - - case BEMENU_COPYURL: - /* copy */ - clipboard->setText( strURL, QClipboard::Clipboard ); - clipboard->setText( strURL, QClipboard::Selection ); - break; - - case BEMENU_SHOWBROWSER: - KRun::runURL( strURL, "text/html" ); - break; - - default: - break; + // show popup menu + QAction* action = popupMenu.exec(QCursor::pos()); + if (!action) { + return; } + if (action == copyUrlAct) { + // copy + clipboard->setText(strUrl, QClipboard::Clipboard); + clipboard->setText(strUrl, QClipboard::Selection); + } else if (action == showBrowserAct) { + KRun::runUrl(strUrl, "text/html", view()); + } } else { - KRun::runURL( strURL, "text/html" ); + KRun::runUrl(strUrl, "text/html", 0); } } @@ -1312,66 +1283,66 @@ /* public */ -bool KitaHTMLPart::isPopupVisible() +bool HTMLPart::isPopupVisible() { - if ( !m_popup ) return FALSE; + if (!m_popup) return false; return m_popup->isVisible(); } /* public slot */ -void KitaHTMLPart::slotDeletePopup() +void HTMLPart::slotDeletePopup() { - if ( m_popup ) delete m_popup; - m_popup = NULL; - m_multiPopup = FALSE; + delete m_popup; + m_popup = 0; + m_multiPopup = false; } /* for convenience */ /* public slot */ -void KitaHTMLPart::slotShowResPopup( QPoint point, int refNum, int refNum2 ) +void HTMLPart::slotShowResPopup(const QPoint& point, int refNum, int refNum2) { - QString innerHTML = Kita::DatManager::getHtml( m_datURL, refNum, refNum2 ); - if ( innerHTML == QString::null ) return ; + QString innerHTML = DatManager(m_datUrl).getHtml(refNum, refNum2); + if (innerHTML.isEmpty()) return ; - showPopupCore( m_datURL, innerHTML, point ); + showPopupCore(m_datUrl, innerHTML, point); } /* for convenience */ /* private */ -void KitaHTMLPart::showPopup( const KURL& url, const QString& innerHTML ) +void HTMLPart::showPopup(const KUrl& url, const QString& innerHTML) { - showPopupCore( url, innerHTML, QCursor::pos() ); + showPopupCore(url, innerHTML, QCursor::pos()); } /* show popup window */ /* private */ -void KitaHTMLPart::showPopupCore( const KURL& url, const QString& innerHTML, QPoint point ) +void HTMLPart::showPopupCore(const KUrl& url, const QString& innerHTML, const QPoint& point) { slotDeletePopup(); - m_multiPopup = FALSE; + m_multiPopup = false; - m_popup = new Kita::ResPopup( view() , url ); + m_popup = new ResPopup(view() , url); - connect( m_popup, SIGNAL( hideChildPopup() ), SLOT( slotHideChildPopup() ) ); + connect(m_popup, SIGNAL(hideChildPopup()), SLOT(slotHideChildPopup())); - m_popup->setText( innerHTML ); + m_popup->setText(innerHTML); m_popup->adjustSize(); - m_popup->adjustPos( point ); + m_popup->adjustPos(point); m_popup->show(); } /*------------------------*/ /* start multi-popup mode */ /* private */ -bool KitaHTMLPart::startMultiPopup() +bool HTMLPart::startMultiPopup() { - if ( m_popup && m_popup->isVisible() ) { - m_multiPopup = TRUE; + if (m_popup && m_popup->isVisible()) { + m_multiPopup = true; m_popup->moveMouseAbove(); } else { - m_multiPopup = FALSE; + m_multiPopup = false; } return m_multiPopup; @@ -1379,86 +1350,86 @@ /* Is it multi-popup mode now ? */ /* private */ -bool KitaHTMLPart::isMultiPopupMode() +bool HTMLPart::isMultiPopupMode() { - if ( !m_popup ) { - m_multiPopup = FALSE; - } else if ( m_popup->isHidden() ) { - m_multiPopup = FALSE; + if (!m_popup) { + m_multiPopup = false; + } else if (m_popup->isHidden()) { + m_multiPopup = false; } return m_multiPopup; } /* private */ -void KitaHTMLPart::hidePopup() +void HTMLPart::hidePopup() { - if ( m_popup ) { + if (m_popup) { m_popup->hide(); } - m_multiPopup = FALSE; + m_multiPopup = false; } -/* return TRUE if this view is under mouse. */ /* private */ -bool KitaHTMLPart::isUnderMouse( int mrgwd, int mrght ) +/* return true if this view is under mouse. */ /* private */ +bool HTMLPart::isUnderMouse(int mrgwd, int mrght) { QPoint pos = QCursor::pos(); int cx = pos.x(), cy = pos.y(); - QPoint viewpos = view() ->mapToGlobal( QPoint( 0, 0 ) ); + QPoint viewpos = view() ->mapToGlobal(QPoint(0, 0)); int px = viewpos.x(), py = viewpos.y(); int wd = view() ->visibleWidth(), ht = view() ->visibleHeight(); - if ( ( px < cx && cx < px + wd + mrgwd ) - && ( py < cy && cy < py + ht + mrght ) ) { - return TRUE; + if ((px < cx && cx < px + wd + mrgwd) + && (py < cy && cy < py + ht + mrght)) { + return true; } - return FALSE; + return false; } /* private slot */ -void KitaHTMLPart::slotLeave() +void HTMLPart::slotLeave() { - if ( isMultiPopupMode() ) return ; - if ( view() ->isHorizontalSliderPressed() ) return ; - if ( view() ->isVerticalSliderPressed () ) return ; + if (isMultiPopupMode()) return ; + if (view()->horizontalScrollBar()->isSliderDown()) return; + if (view()->verticalScrollBar()->isSliderDown()) return; hidePopup(); /* emit signal to have parent hide this if this is popup . */ - if ( m_mode == HTMLPART_MODE_POPUP && !isUnderMouse( 0, 0 ) ) { + if (m_mode == HTMLPART_MODE_POPUP && !isUnderMouse(0, 0)) { emit hideChildPopup(); } } /* private slot */ -void KitaHTMLPart::slotVSliderReleased() +void HTMLPart::slotVSliderReleased() { QScrollBar * bar = view() ->verticalScrollBar(); - QRect rt = bar->sliderRect(); + QRect rt = bar->style()->subControlRect(QStyle::CC_Slider, new QStyleOptionComplex(), QStyle::SC_SliderHandle); int mrg = rt.right() - rt.left(); hidePopup(); /* emit signal to have parent hide this if this is popup . */ - if ( m_mode == HTMLPART_MODE_POPUP && !isUnderMouse( mrg, 0 ) ) { + if (m_mode == HTMLPART_MODE_POPUP && !isUnderMouse(mrg, 0)) { emit hideChildPopup(); } } /* private slot */ -void KitaHTMLPart::slotHSliderReleased() +void HTMLPart::slotHSliderReleased() { QScrollBar * bar = view() ->horizontalScrollBar(); - QRect rt = bar->sliderRect(); + QRect rt = bar->style()->subControlRect(QStyle::CC_Slider, new QStyleOptionComplex(), QStyle::SC_SliderHandle); int mrg = rt.bottom() - rt.top(); hidePopup(); /* emit signal to have parent hide this if this is popup . */ - if ( m_mode == HTMLPART_MODE_POPUP && !isUnderMouse( 0, mrg ) ) { + if (m_mode == HTMLPART_MODE_POPUP && !isUnderMouse(0, mrg)) { emit hideChildPopup(); } } @@ -1466,12 +1437,12 @@ /* private slot */ -void KitaHTMLPart::slotHideChildPopup() +void HTMLPart::slotHideChildPopup() { hidePopup(); /* emit signal to have parent hide this if this is popup . */ - if ( m_mode == HTMLPART_MODE_POPUP && !isUnderMouse( 0, 0 ) ) { + if (m_mode == HTMLPART_MODE_POPUP && !isUnderMouse(0, 0)) { emit hideChildPopup(); } } @@ -1479,7 +1450,7 @@ /*---------------------------------------------------*/ /* This slot is called when mouse moves onto the URL */ /* private slot */ -void KitaHTMLPart::slotOnURL( const QString& url ) +void HTMLPart::slotOnUrl(const QString& url) { /* config */ @@ -1487,37 +1458,40 @@ /*----------------------------*/ - if ( isMultiPopupMode() ) return ; + if (isMultiPopupMode()) return ; slotDeletePopup(); - if ( url.isEmpty() ) return ; - if ( url.left( 7 ) == "mailto:" ) return ; + if (url.isEmpty()) return ; + if (url.left(7) == "mailto:") return ; /* Is Kita active now ? */ - if( ViewMediator::getInstance()->isKitaActive() == FALSE ) return; + if(ViewMediator::getInstance()->isActive() == false) return; /* get reference */ QString refstr; - KURL datURL = m_datURL; - if ( url.at( 0 ) == '#' ) { - refstr = url.mid( 1 ); + KUrl datUrl = m_datUrl; + if (url.at(0) == '#') { + refstr = url.mid(1); } else { - datURL = Kita::getDatURL( KURL( m_datURL, url ) , refstr ); + datUrl = getDatUrl(KUrl(m_datUrl, url) , refstr); } + DatManager datManager(m_datUrl); /*------------------------*/ /* id popup */ - if ( url.left( 6 ) == "#idpop" ) { - int num = Kita::DatManager::getNumByID( m_datURL, url.mid( 6 ) ); + if (url.left(6) == "#idpop") { + int num = datManager.getNumById(url.mid(6)); QString tmpstr; - if ( num >= 2 ) { - tmpstr = QString( "<DIV>ID:%1:[%2]</DIV>" ).arg( url.mid( 6 ) ).arg( num ); + if (num >= 2) { + tmpstr = QString("<DIV>ID:%1:[%2]</DIV>").arg(url.mid(6)).arg(num); } else { - tmpstr = "<DIV>" + i18n( "None" ) + "</DIV>"; + tmpstr = "<DIV>" + + i18nc("@label:textbox This is the first reply", "None") + + "</DIV>"; } - showPopup( m_datURL, tmpstr ); + showPopup(m_datUrl, tmpstr); return ; } @@ -1525,17 +1499,18 @@ /*------------------------*/ /* show reffered num */ - if ( refstr.left( 5 ) == "write" ) { - int no = refstr.mid( 5 ).toInt(); + if (refstr.left(5) == "write") { + int no = refstr.mid(5).toInt(); int num = 0; - Kita::DatManager::getTreeByRes( m_datURL, no, num ); + datManager.getTreeByRes(no, num); QString tmpstr; - if ( num ) { - tmpstr = QString( "<DIV>No.%1 : [%2]</DIV>" ).arg( no ).arg( num ); + if (num) { + tmpstr = QString("<DIV>No.%1 : [%2]</DIV>").arg(no).arg(num); } else { - tmpstr = "<DIV>" + i18n( "None" ) + "</DIV>"; + tmpstr = "<DIV>" + + i18nc("@label:textbox There is no reply", "None") + "</DIV>"; } - showPopup( m_datURL, tmpstr ); + showPopup(m_datUrl, tmpstr); return ; } @@ -1543,29 +1518,29 @@ /*------------------------*/ /* abone */ - if ( url.left( 6 ) == "#abone" ) { - int no = url.mid( 6 ).toInt(); - QString tmpstr = Kita::DatManager::getHtml( m_datURL, no, no, FALSE ); - showPopup( m_datURL, tmpstr ); + if (url.left(6) == "#abone") { + int no = url.mid(6).toInt(); + QString tmpstr = datManager.getHtml(no, no, false); + showPopup(m_datUrl, tmpstr); return ; } /*-------------------------*/ /* popup for anchor */ - QString innerHTML = QString::null; + QString innerHTML; int refNum; int refNum2; - int i = refstr.find( "-" ); - if ( i != -1 ) { /* >>refNum-refNum2 */ + int i = refstr.indexOf("-"); + if (i != -1) { /* >>refNum-refNum2 */ - refNum = refstr.left( i ).toInt(); - refNum2 = refstr.mid( i + 1 ).toInt(); + refNum = refstr.left(i).toInt(); + refNum2 = refstr.mid(i + 1).toInt(); - if ( refNum ) { - if ( refNum2 < refNum ) refNum2 = refNum; - if ( refNum2 - refNum > maxpopup - 1 ) refNum2 = refNum + maxpopup - 1; + if (refNum) { + if (refNum2 < refNum) refNum2 = refNum; + if (refNum2 - refNum > maxpopup - 1) refNum2 = refNum + maxpopup - 1; } } else { /* >>refNum */ @@ -1573,38 +1548,40 @@ refNum2 = refNum; } + DatManager localDatManager(datUrl); /* another thread ? */ - if ( datURL.host() != m_datURL.host() || datURL.path() != m_datURL.path() ) { + if (datUrl.host() != m_datUrl.host() || datUrl.path() != m_datUrl.path()) { /* get board name */ - QString boardName = Kita::BoardManager::boardName( datURL ); - if ( boardName != QString::null ) innerHTML += "[" + boardName + "] "; + QString boardName = BoardManager::boardName(datUrl); + if (!boardName.isEmpty()) innerHTML += '[' + boardName + "] "; /* If idx file of datURL is not read, thread name cannot be obtained. so, create DatInfo if cache exists, and read idx file in DatInfo::DatInfo(). */ - Kita::DatManager::getDatInfoPointer( datURL ); + localDatManager.getDatInfoPointer(); /* get thread Name */ - QString subName = Kita::DatManager::threadName( datURL ); - if ( subName != QString::null ) innerHTML += subName + "<br><br>"; + QString subName = localDatManager.threadName(); + if (!subName.isEmpty()) innerHTML += subName + "<br><br>"; - if ( !refNum ) refNum = refNum2 = 1; + if (!refNum) refNum = refNum2 = 1; } /* get HTML and show it */ - if ( !refNum ) return ; - innerHTML += Kita::DatManager::getHtml( datURL, refNum, refNum2 ); + if (!refNum) return ; + innerHTML += localDatManager.getHtml(refNum, refNum2); - if ( innerHTML != QString::null ) showPopup( datURL, innerHTML ); + if (!innerHTML.isEmpty()) + showPopup(datUrl, innerHTML); } /* If selected Text is composed of only digits, then show res popup. */ /* private */ -bool KitaHTMLPart::showSelectedDigitPopup() +bool HTMLPart::showSelectedDigitPopup() { - if ( !hasSelection() ) return FALSE; + if (!hasSelection()) return false; QString linkstr; int refNum; @@ -1612,14 +1589,14 @@ const QChar *chpt = selectText.unicode(); unsigned int length = selectText.length(); - if ( ( refNum = Kita::stringToPositiveNum( chpt, length ) ) != -1 ) { - QString innerHTML = Kita::DatManager::getHtml( m_datURL, refNum, refNum ); - if ( innerHTML != QString::null ) { - showPopup( m_datURL, innerHTML ); + if ((refNum = stringToPositiveNum(chpt, length)) != -1) { + QString innerHTML = DatManager(m_datUrl).getHtml(refNum, refNum); + if (!innerHTML.isEmpty()) { + showPopup(m_datUrl, innerHTML); startMultiPopup(); - return TRUE; + return true; } } - return FALSE; + return false; } Modified: kita/trunk/kita/src/htmlpart.h =================================================================== --- kita/trunk/kita/src/htmlpart.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/htmlpart.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,13 +7,12 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITAHTMLPART_H #define KITAHTMLPART_H +#include <QtCore/QEvent> + #include <khtml_part.h> -#include <qframe.h> -#include <qevent.h> /* mode */ enum { @@ -25,193 +24,183 @@ }; /* ID of user defined event */ -#define EVENT_GotoAnchor ( QEvent::User + 100 ) +const int EVENT_GotoAnchor = QEvent::User + 100; -class KitaDomTree; -class KURL; +class KUrl; -namespace Kita -{ - class ResPopup; -} - namespace DOM { class Node; } - -/*-------------------------------------------------------------*/ - -class KitaHTMLPart : public KHTMLPart +namespace Kita { - Q_OBJECT + class DomTree; + class ResPopup; - KitaDomTree* m_domtree; - Kita::ResPopup* m_popup; + class HTMLPart : public KHTMLPart + { + Q_OBJECT - /* basic information */ - int m_mode; - KURL m_datURL; - bool m_updatedKokoyon; + DomTree* m_domtree; + ResPopup* m_popup; + /* basic information */ + int m_mode; + KUrl m_datUrl; + bool m_updatedKokoyon; - /* cache */ - bool m_firstReceive; - int m_centerNum; - /* goto anchor */ - QStringList m_anchorStack; - int m_jumpNumAfterLoading; /* see also slotFinishLoad() */ + /* cache */ + bool m_firstReceive; + int m_centerNum; - /* mouse event */ - bool m_pushctrl; - bool m_pushmidbt; - bool m_pushrightbt; + /* goto anchor */ + QStringList m_anchorStack; + int m_jumpNumAfterLoading; /* see also slotFinishLoad() */ - /* search */ - DOM::Node m_findNode; - int m_findPos; - int m_find_y; + /* mouse event */ + bool m_pushctrl; + bool m_pushmidbt; + bool m_pushrightbt; - /* res popup */ - bool m_multiPopup; + /* search */ + DOM::Node m_findNode; + int m_findPos; + int m_find_y; -public: + /* res popup */ + bool m_multiPopup; - KitaHTMLPart( QWidget* parent, const char* name = 0 ); - ~KitaHTMLPart(); - bool setup( int mode , const KURL& url ); + public: - /* rendering */ - void showResponses( int startnum, int endnum ); - void parseResponses( int startnum, int endnum ); - void showAll(); - void updateScreen( bool showHeaderEtc, bool clock ); - void setInnerHTML( const QString& innerHTML ); + HTMLPart(QWidget* parent); + ~HTMLPart(); + bool setup(int mode , const KUrl& url); - /* cache */ - bool load( int centerNum ); - bool reload( int jumpNum ); + /* rendering */ + void showResponses(int startnum, int endnum); + void parseResponses(int startnum, int endnum); + void showAll(); + void updateScreen(bool showHeaderEtc, bool clock); + void setInnerHTML(const QString& innerHTML); - /* goto anchor */ - bool gotoAnchor( const QString& anc, bool pushPosition ); + /* cache */ + bool load(int centerNum); + bool reload(int jumpNum); - /* search */ - bool findText( const QString &query, bool reverse ); + /* goto anchor */ + bool gotoAnchor(const QString& anc, bool pushPosition); - /* popup */ - bool isPopupVisible(); + /* search */ + bool findText(const QString &query, bool reverse); -public slots: + /* popup */ + bool isPopupVisible(); - /* rendering */ - void slotSetFaceOfHTMLPart(); + public slots: - /* cache */ - void slotReceiveData(); - void slotFinishLoad(); + /* rendering */ + void slotSetFaceOfHTMLPart(); - /* goto anchor */ - void slotGotoKokoyon(); - void slotGobackAnchor(); + /* cache */ + void slotReceiveData(); + void slotFinishLoad(); - /* Tugi100, Mae100 etc. */ - void slotClickGotoFooter(); + /* goto anchor */ + void slotGotoKokoyon(); + void slotGobackAnchor(); - /* res popup */ - void slotDeletePopup(); - void slotShowResPopup( QPoint point, int refNum, int refNum2 ); + /* Tugi100, Mae100 etc. */ + void slotClickGotoFooter(); -private: + /* res popup */ + void slotDeletePopup(); + void slotShowResPopup(const QPoint& point, int refNum, int refNum2); - void clearPart(); - void redrawHTMLPart( const KURL& datURL, bool force ); + private: - /* setup */ - void connectSignals(); - void createHTMLDocument(); + void clearPart(); + void redrawHTMLPart(const KUrl& datUrl, bool force); - /* goto anchor */ - void pushCurrentPosition(); - QString getCurrentIDofNode(); + /* setup */ + void connectSignals(); + void createHTMLDocument(); - /* popup menu */ - void showPopupMenu( const KURL& kurl ); + /* goto anchor */ + void pushCurrentPosition(); + QString getCurrentIdOfNode(); - /* click */ - void clickAnchor( const KURL& urlin ); - void showWritePopupMenu( const QString& refstr ); - void showIDPopup( const QString& refstr ); - void showBePopupMenu( const QString& refstr ); + /* popup menu */ + void showPopupMenu(const KUrl& kurl); - /* search */ - void findTextInit(); + /* click */ + void clickAnchor(const KUrl& urlin); + void showWritePopupMenu(const QString& refstr); + void showIdPopup(const QString& refstr); + void showBePopupMenu(const QString& refstr); - /* res popup */ - void showPopup( const KURL& url, const QString& innerHTML ); - void showPopupCore( const KURL& url, const QString& innerHTML, QPoint point ); - bool startMultiPopup(); - bool isMultiPopupMode(); - void hidePopup(); - bool isUnderMouse( int mrgwd, int mrght ); - bool showSelectedDigitPopup(); + /* search */ + void findTextInit(); -protected: + /* res popup */ + void showPopup(const KUrl& url, const QString& innerHTML); + void showPopupCore(const KUrl& url, const QString& innerHTML, + const QPoint& point); + bool startMultiPopup(); + bool isMultiPopupMode(); + void hidePopup(); + bool isUnderMouse(int mrgwd, int mrght); + bool showSelectedDigitPopup(); - /* user event */ - virtual void customEvent( QCustomEvent * e ); + HTMLPart(const HTMLPart&); + HTMLPart& operator=(const HTMLPart&); - /* mouse event */ - virtual void khtmlMousePressEvent( khtml::MousePressEvent* e ); + protected: + /* user event */ + virtual void customEvent(QEvent * e); -private slots: + /* mouse event */ + virtual void khtmlMousePressEvent(khtml::MousePressEvent* e); - /* click */ - void slotOpenURLRequest( const KURL&, const KParts::URLArgs& ); - /* res popup */ - void slotLeave(); - void slotVSliderReleased(); - void slotHSliderReleased(); - void slotHideChildPopup(); - void slotOnURL( const QString& url ); + private slots: + /* click */ + void slotOpenUrlRequest(const KUrl&, const KParts::OpenUrlArguments&); -signals: - void mousePressed(); /* to KitaThreadView */ + /* res popup */ + void slotLeave(); + void slotVSliderReleased(); + void slotHSliderReleased(); + void slotHideChildPopup(); + void slotOnUrl(const QString& url); - /* cache */ - void receiveData(); - void finishReload(); - /* res popup */ - void hideChildPopup(); -}; + signals: + void mousePressed(); /* to ThreadView */ + /* cache */ + void receiveData(); + void finishReload(); + /* res popup */ + void hideChildPopup(); + }; -/*---------------------------------------------------*/ -/*---------------------------------------------------*/ -/*---------------------------------------------------*/ + /* user defined events */ + class GotoAnchorEvent : public QEvent + { + QString m_anc; + public: + GotoAnchorEvent(const QString& anc) + : QEvent(QEvent::Type(EVENT_GotoAnchor)), m_anc(anc) {}; + const QString& getAnc() const { return m_anc; } + }; +} -/* user defined events */ - -class GotoAnchorEvent : public QCustomEvent -{ - QString m_anc; - -public: - - GotoAnchorEvent( const QString& anc ) - : QCustomEvent( EVENT_GotoAnchor ), m_anc( anc ) {}; - - const QString& getAnc() const { return m_anc; } -}; - - #endif Modified: kita/trunk/kita/src/kita.desktop =================================================================== --- kita/trunk/kita/src/kita.desktop 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/kita.desktop 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,11 +1,10 @@ [Desktop Entry] -Encoding=UTF-8 Name=Kita -Exec=kita %i %m -caption "%c" +Exec=kita %i -caption "%c" Icon=kita Type=Application -DocPath=kita/kita.html +X-DocPath=kita/index.html Comment=Kita - 2ch client for KDE -Comment[ja]=Kita - KDEç¨2ã¡ãããããã©ã¦ã¶ -Terminal=0 -Categories=Application;Network; +Comment[ja]=Kita - KDE ç¨2ã¡ãããããã©ã¦ã¶ +Terminal=false +Categories=Network;WebBrowser;KDE; Deleted: kita/trunk/kita/src/kita.lsm =================================================================== --- kita/trunk/kita/src/kita.lsm 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/kita.lsm 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,16 +0,0 @@ -Begin3 -Title: Kita -- 2ch client for KDE -Version: 0.200.0 -Entered-date: -Description: -Keywords: KDE3 Qt -Author: Hideki Ikemoto <ikemo****@users*****> -Maintained-by: Hideki Ikemoto <ikemo****@users*****> -Home-page: -Alternate-site: -Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils - xxxxxx kita-0.200.0.tar.gz - xxx kita-0.200.0.lsm -Platform: Linux. Needs KDE 3.x -Copying-policy: GPL -End Property changes on: kita/trunk/kita/src/kitaui ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in *.la *.lo *.moc *.moc.cpp *.all_cpp.cpp .deps .libs + moc_* *_automoc.cpp *_automoc.cpp.files CMakeFiles CTestTestfile.cmake cmake_install.cmake Makefile Deleted: kita/trunk/kita/src/kitaui/.cvsignore =================================================================== --- kita/trunk/kita/src/kitaui/.cvsignore 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/kitaui/.cvsignore 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,9 +0,0 @@ -Makefile -Makefile.in -*.la -*.lo -*.moc -*.moc.cpp -*.all_cpp.cpp -.deps -.libs Copied: kita/trunk/kita/src/kitaui/CMakeLists.txt (from rev 2558, kita/branches/KITA-KDE4/kita/src/kitaui/CMakeLists.txt) =================================================================== --- kita/trunk/kita/src/kitaui/CMakeLists.txt (rev 0) +++ kita/trunk/kita/src/kitaui/CMakeLists.txt 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,12 @@ +include_directories(${QT_INCLUDES} ${KDE4_INCLUDES} ../libkita) + +########### next target ############### + +set(kitaui_LIB_SRCS htmlview.cpp listviewitem.cpp tabwidgetbase.cpp) + +kde4_add_library(kitaui SHARED ${kitaui_LIB_SRCS}) + +target_link_libraries(kitaui ${KDE4_KDECORE_LIBS} ${KDE4_KHTML_LIBS}) + +set_target_properties(kitaui PROPERTIES VERSION 1.0.0 SOVERSION 1) +install(TARGETS kitaui ${INSTALL_TARGETS_DEFAULT_ARGS}) Deleted: kita/trunk/kita/src/kitaui/Makefile.am =================================================================== --- kita/trunk/kita/src/kitaui/Makefile.am 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/kitaui/Makefile.am 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,7 +0,0 @@ -INCLUDES = -I$(top_srcdir)/kita/src/libkita $(all_includes) -METASOURCES = AUTO -lib_LTLIBRARIES = libkitaui.la -libkitaui_la_LDFLAGS = $(all_libraries) -libkitaui_la_SOURCES = tabwidgetbase.cpp listviewitem.cpp htmlview.cpp -noinst_HEADERS = tabwidgetbase.h listviewitem.h htmlview.h -libkitaui_la_LIBADD = $(LIB_KHTML) Modified: kita/trunk/kita/src/kitaui/htmlview.cpp =================================================================== --- kita/trunk/kita/src/kitaui/htmlview.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/kitaui/htmlview.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -12,51 +12,49 @@ #include <khtml_part.h> -#include <qapplication.h> -#include <qclipboard.h> +using namespace Kita; -KitaHTMLView::KitaHTMLView( KHTMLPart* part, QWidget *parent, const char *name ) - : KHTMLView( part, parent, name ) +HTMLView::HTMLView(KHTMLPart* part, QWidget *parent) : KHTMLView(part, parent) {} -KitaHTMLView::~KitaHTMLView() +HTMLView::~HTMLView() {} -void KitaHTMLView::leaveEvent( QEvent* ) +void HTMLView::leaveEvent(QEvent*) { emit leave(); } /* protected */ -void KitaHTMLView::keyPressEvent( QKeyEvent* e ) +void HTMLView::keyPressEvent(QKeyEvent* e) { - if ( e->key() == Key_Space || e->key() == Key_PageDown - || e->key() == Key_Down || e->key() == Key_End ) { - if ( emitPushDown() ) return ; + if (e->key() == Qt::Key_Space || e->key() == Qt::Key_PageDown + || e->key() == Qt::Key_Down || e->key() == Qt::Key_End) { + if (emitPushDown()) return ; } - KHTMLView::keyPressEvent( e ); + KHTMLView::keyPressEvent(e); } /* protected */ -void KitaHTMLView::viewportWheelEvent( QWheelEvent * e ) +void HTMLView::wheelEvent(QWheelEvent * e) { - if ( e->delta() < 0 ) { /* scroll down */ - if ( emitPushDown() ) return ; + if (e->delta() < 0) { /* scroll down */ + if (emitPushDown()) return ; } - KHTMLView::viewportWheelEvent( e ); + KHTMLView::wheelEvent(e); } /* private */ -bool KitaHTMLView::emitPushDown() +bool HTMLView::emitPushDown() { int y = contentsY(); - if ( y >= contentsHeight() - visibleHeight() ) { - emit pushDown(); /* to KitaHTMLPart in order to call slotClickTugi100 */ - return TRUE; + if (y >= contentsHeight() - visibleHeight()) { + emit pushDown(); /* to HTMLPart in order to call slotClickTugi100 */ + return true; } - return FALSE; + return false; } Modified: kita/trunk/kita/src/kitaui/htmlview.h =================================================================== --- kita/trunk/kita/src/kitaui/htmlview.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/kitaui/htmlview.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -13,26 +13,28 @@ #include <khtmlview.h> -/** - @ author Hideki Ikemoto -*/ -class KitaHTMLView : public KHTMLView -{ - Q_OBJECT -public: - KitaHTMLView( KHTMLPart* part, QWidget *parent, const char *name = 0 ); - ~KitaHTMLView(); -protected: - void leaveEvent( QEvent* ); - void keyPressEvent( QKeyEvent* e ); - void viewportWheelEvent( QWheelEvent * e ); +namespace Kita { + /** + @author Hideki Ikemoto + */ + class KDE_EXPORT HTMLView : public KHTMLView + { + Q_OBJECT + public: + HTMLView(KHTMLPart* part, QWidget *parent); + ~HTMLView(); + protected: + void leaveEvent(QEvent*); + void keyPressEvent(QKeyEvent* e); + void wheelEvent(QWheelEvent * e); -private: - bool emitPushDown(); + private: + bool emitPushDown(); -signals: - void leave(); - void pushDown(); -}; + signals: + void leave(); + void pushDown(); + }; +} #endif Modified: kita/trunk/kita/src/kitaui/listviewitem.cpp =================================================================== --- kita/trunk/kita/src/kitaui/listviewitem.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/kitaui/listviewitem.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -12,58 +12,28 @@ using namespace Kita; -ListViewItem::ListViewItem( QListView *parent, QListViewItem *after, - QString label1, QString label2, QString label3, QString label4, - QString label5, QString label6, QString label7, QString label8 ) - : KListViewItem( parent, after, label1, label2, label3, label4, label5, label6, label7, label8 ) +ListViewItem::ListViewItem(QTreeWidget *parent, QTreeWidgetItem *preceding, + const QStringList& strings) + : QTreeWidgetItem(parent, preceding) { - init(); + for (int i = 0, j = strings.size(); i < j; i++) + setText(i, strings.at(i)); } -ListViewItem::ListViewItem( QListViewItem *parent, QListViewItem *after, - QString label1, QString label2, QString label3, QString label4, - QString label5, QString label6, QString label7, QString label8 ) - : KListViewItem( parent, after, label1, label2, label3, label4, label5, label6, label7, label8 ) +ListViewItem::ListViewItem(QTreeWidget *parent, const QStringList& strings) + : QTreeWidgetItem(parent, strings) { - init(); } -ListViewItem::ListViewItem( QListView* parent, QString label1, QString label2 ) - : KListViewItem( parent, label1, label2 ) +ListViewItem::ListViewItem(QTreeWidgetItem* parent, QTreeWidgetItem *preceding, + const QStringList& strings) + : QTreeWidgetItem(parent, preceding) { - init(); + for (int i = 0, j = strings.size(); i < j; i++) + setText(i, strings.at(i)); } -ListViewItem::ListViewItem( QListViewItem* parent, QString label1, QString label2 ) - : KListViewItem( parent, label1, label2 ) +ListViewItem::ListViewItem(QTreeWidgetItem* parent, const QStringList& strings) + : QTreeWidgetItem(parent, strings) { - init(); } - -ListViewItem::~ListViewItem() -{} - -/* private */ -void ListViewItem::init() -{ - QColorGroup colors = listView() ->viewport() ->colorGroup(); - m_textColor = colors.text(); - m_baseColor = colors.base(); -} - -/* public */ -void ListViewItem::setColor( QColor textColor, QColor baseColor ) -{ - m_textColor = textColor; - m_baseColor = baseColor; -} - -/* public */ /* virtual */ -void ListViewItem::paintCell( QPainter *p, const QColorGroup &cg, - int column, int width, int align ) -{ - QColorGroup color = cg; - color.setColor( QColorGroup::Text, m_textColor ); - color.setColor( QColorGroup::Base, m_baseColor ); - KListViewItem::paintCell( p, color, column, width, align ); -} Modified: kita/trunk/kita/src/kitaui/listviewitem.h =================================================================== --- kita/trunk/kita/src/kitaui/listviewitem.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/kitaui/listviewitem.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -8,43 +8,28 @@ * (at your option) any later version. * ***************************************************************************/ -#ifndef _KITALISTVIEWITEM_H_ -#define _KITALISTVIEWITEM_H_ +#ifndef KITALISTVIEWITEM_H +#define KITALISTVIEWITEM_H -#include <klistview.h> +#include <QtGui/QTreeWidgetItem> +#include <kdemacros.h> + namespace Kita { - class ListViewItem : public KListViewItem + class KDE_EXPORT ListViewItem : public QTreeWidgetItem { - QColor m_textColor; /* text color */ - QColor m_baseColor; /* background color */ - public: - ListViewItem( QListView *parent, QListViewItem *after, - QString, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null ); + ListViewItem(QTreeWidget *parent, QTreeWidgetItem *preceding, + const QStringList& strings); - ListViewItem( QListViewItem *parent, QListViewItem *after, - QString, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null ); + ListViewItem(QTreeWidget *parent, const QStringList& strings); - ListViewItem( QListView* parent, QString = QString::null, QString = QString::null ); + ListViewItem(QTreeWidgetItem *parent, QTreeWidgetItem *preceding, + const QStringList& strings); - ListViewItem( QListViewItem* parent, QString = QString::null, QString = QString::null ); - - ~ListViewItem(); - - void setColor( QColor textColor, QColor baseColor ); - virtual void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ); - - private: - void init(); + ListViewItem(QTreeWidgetItem *parent, const QStringList& strings); }; } Modified: kita/trunk/kita/src/kitaui/tabwidgetbase.cpp =================================================================== --- kita/trunk/kita/src/kitaui/tabwidgetbase.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/kitaui/tabwidgetbase.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -12,133 +12,118 @@ #include "tabwidgetbase.h" -#include "kita_misc.h" -#include "parsemisc.h" -#include "datmanager.h" +#include <QtGui/QApplication> -#include <klibloader.h> -#include <kpopupmenu.h> -#include <kdebug.h> -#include <kstdaccel.h> #include <kaction.h> +#include <kactioncollection.h> #include <klocale.h> -#include <kkeydialog.h> -#include <kparts/dockmainwindow.h> -#include <kparts/factory.h> -#include <kdeversion.h> -#include <kglobal.h> -#include <kconfig.h> -#include <kstandarddirs.h> +#include <kshortcutsdialog.h> +#include <kstandardshortcut.h> +#include <ktabbar.h> -#include <qapplication.h> -#include <qmessagebox.h> -#include <qptrlist.h> -#include <qfontmetrics.h> +using namespace Kita; - -/*--------------------------------------------------------------*/ - - -KitaTabWidgetBase::KitaTabWidgetBase( QWidget* parent, const char* name, WFlags f ) - : KTabWidget( parent, name, f ) +TabWidgetBase::TabWidgetBase(QWidget* parent) : KTabWidget(parent) { - connect( this, SIGNAL( currentChanged ( QWidget * ) ), - SLOT( slotCurrentChanged ( QWidget * ) ) ); + connect(this, SIGNAL(currentChanged (QWidget *)), + SLOT(slotCurrentChanged (QWidget *))); setupActions(); - if ( parent ) { + if (parent) { /* setup part manager */ - m_manager = new KParts::PartManager( parent, this, "KitaPartManager" ); - m_manager->addManagedTopLevelWidget( parent ); + m_manager = new KParts::PartManager(parent, this); + m_manager->addManagedTopLevelWidget(parent); + } else { + m_manager = 0; } } -KitaTabWidgetBase::~KitaTabWidgetBase() +TabWidgetBase::~TabWidgetBase() { - /* romove parts */ - if ( m_manager && !( m_manager->parts() ->isEmpty() ) ) { + /* remove parts */ + if (m_manager && !(m_manager->parts().isEmpty())) { KParts::Part * part; - while ( ( part = m_manager->parts() ->getFirst() ) != NULL ) { - m_manager->removePart( part ); - removePage( part->widget() ); + while ((part = m_manager->parts().first()) != 0) { + m_manager->removePart(part); + removePage(part->widget()); delete part; } } - if ( m_manager ) delete m_manager; - m_manager = NULL; + delete m_manager; + m_manager = 0; /* remove widgets which don't belong to parts */ - QWidget* view = currentPage(); - while ( count() > 0 && view ) { - removePage( view ); + QWidget* view = currentWidget(); + while (count() > 0 && view) { + removePage(view); delete view; - view = currentPage(); + view = currentWidget(); } } /* public slot */ -void KitaTabWidgetBase::slotCurrentChanged( QWidget * w ) +void TabWidgetBase::slotCurrentChanged(QWidget * w) { - if ( m_manager == NULL ) return ; - if ( w == NULL ) return ; - w->setActiveWindow(); + if (m_manager == 0) return ; + if (w == 0) return ; + w->activateWindow(); w->setFocus(); - KParts::Part* part = findPartFromWidget( w ); - if ( part ) { - m_manager->setActivePart( part ); + KParts::Part* part = findPartFromWidget(w); + if (part) { + m_manager->setActivePart(part); } } /* close num-th tab */ /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseTab( int num ) +void TabWidgetBase::slotCloseTab(int num) { - CloseTabEvent * e = new CloseTabEvent( num ); - QApplication::postEvent( this, e ); // Qt will delete it when done + CloseTabEvent * e = new CloseTabEvent(num); + QApplication::postEvent(this, e); // Qt will delete it when done } /* Calling deleteWidget in the child part will be the cause of crash. So you need to call deleteWidget via custom event. */ /* protected */ /* virtual */ -void KitaTabWidgetBase::customEvent( QCustomEvent * e ) +void TabWidgetBase::customEvent(QEvent * e) { - if ( e->type() == EVENT_CloseTab ) { - deleteWidget ( page( static_cast< CloseTabEvent* >( e ) ->getIndex() ) ); + if (e->type() == EVENT_CloseTab) { + deleteWidget (widget(static_cast< CloseTabEvent* >(e) ->getIndex())); } } /* protected */ /* virtual */ -void KitaTabWidgetBase::deleteWidget( QWidget* w ) +void TabWidgetBase::deleteWidget(QWidget* w) { - if ( w == NULL ) return ; + if (w == 0) return ; - removePage( w ); - KParts::Part* part = findPartFromWidget( w ); - if ( part ) m_manager->removePart( part ); + removePage(w); + KParts::Part* part = findPartFromWidget(w); + if (part) m_manager->removePart(part); delete w; } /* protected */ -KParts::Part* KitaTabWidgetBase::findPartFromWidget( QWidget* w ) +KParts::Part* TabWidgetBase::findPartFromWidget(QWidget* w) { - if ( w == NULL ) return NULL; - if ( m_manager == NULL ) return NULL; - if ( m_manager->parts() ->isEmpty() ) return NULL; + if (w == 0) return 0; + if (m_manager == 0) return 0; + if (m_manager->parts().isEmpty()) return 0; KParts::Part *part; - QPtrListIterator<KParts::Part> it( *( m_manager->parts() ) ); - while ( ( part = ( *it ) ) != NULL ) { - if ( part->widget() == w ) return part; + QList<KParts::Part*>::const_iterator it = m_manager->parts().begin(); + while ((part = (*it)) != 0) { + if (part->widget() == w) return part; ++it; } - return NULL; + return 0; } /*------------------------------------*/ @@ -146,176 +131,170 @@ /* private */ -void KitaTabWidgetBase::setupActions() +void TabWidgetBase::setupActions() { - actionCollection() ->setWidget( this ); + actionCollection()->associateWidget(this); + QString str = i18nc("@action:inmenu", "Configure Shortcuts..."); + KAction* tabConfigkeysAction + = actionCollection()->addAction("tab_configkeys"); + tabConfigkeysAction->setText(str); + connect(tabConfigkeysAction, SIGNAL(triggered()), + this, SLOT(slotConfigureKeys())); - QString str = i18n( "Configure S&hortcuts..." ) + "(" + QString( name() ) + ")"; - new KAction( str, - 0, - this, - SLOT( slotConfigureKeys() ), - actionCollection(), - "tab_configkeys" ); + KAction* tabNexttabAction + = actionCollection()->addAction("tab_nexttab"); + tabNexttabAction->setText(i18nc("@action:inmenu", "Activate Next Tab")); + tabNexttabAction->setShortcut(KStandardShortcut::tabNext()); + connect(tabNexttabAction, SIGNAL(triggered()), this, SLOT(slotNextTab())); - new KAction( i18n( "Activate Next Tab" ), - KStdAccel::tabNext(), - this, - SLOT( slotNextTab() ), - actionCollection(), - "tab_nexttab" ); + KAction* tabPrevtabAction = actionCollection()->addAction("tab_prevtab"); + tabPrevtabAction->setText(i18nc("@action:inmenu", + "Activate Previous Tab")); + tabPrevtabAction->setShortcut(KStandardShortcut::tabPrev()); + connect(tabPrevtabAction, SIGNAL(triggered()), this, SLOT(slotPrevTab())); - new KAction( i18n( "Activate Previous Tab" ), - KStdAccel::tabPrev(), - this, - SLOT( slotPrevTab() ), - actionCollection(), - "tab_prevtab" ); + KAction* tabClosetabAction = actionCollection()->addAction("tab_closetab"); + tabClosetabAction->setText(i18nc("@action:inmenu", "Close This Tab")); + tabClosetabAction->setShortcut(KStandardShortcut::close()); + connect(tabClosetabAction, SIGNAL(triggered()), + this, SLOT(slotCloseCurrentTab())); - new KAction( i18n( "Close this tab" ), - KStdAccel::close(), - this, - SLOT( slotCloseCurrentTab() ), - actionCollection(), - "tab_closetab" ); + KAction* tabCloseothertabAction + = actionCollection()->addAction("tab_closetotherab"); + tabCloseothertabAction->setText(i18nc("@action:inmenu", + "Close Other Tabs")); + tabCloseothertabAction->setShortcut(KStandardShortcut::close()); + connect(tabCloseothertabAction, SIGNAL(triggered()), + this, SLOT(slotCloseOtherTab())); - new KAction( i18n( "Close Other Tabs" ), - 0, - this, - SLOT( slotCloseOtherTab() ), - actionCollection(), - "tab_closeothertab" ); + KAction* tabCloserighttabAction + = actionCollection()->addAction("tab_closetrightab"); + tabCloserighttabAction->setText(i18nc("@action:inmenu", + "Close Right Tabs")); + connect(tabCloserighttabAction, SIGNAL(triggered()), + this, SLOT(slotCloseRightTab())); - new KAction( i18n( "Close right tabs" ), - 0, - this, - SLOT( slotCloseRightTab() ), - actionCollection(), - "tab_closerighttab" ); + KAction* tabCloselefttabAction + = actionCollection()->addAction("tab_closetleftab"); + tabCloselefttabAction->setText(i18nc("@action:inmenu", "Close Left Tabs")); + connect(tabCloselefttabAction, SIGNAL(triggered()), + this, SLOT(slotCloseLeftTab())); - new KAction( i18n( "Close left tabs" ), - 0, - this, - SLOT( slotCloseLeftTab() ), - actionCollection(), - "tab_closelefttab" ); - - new KAction( i18n( "Close all tabs" ), - 0, - this, - SLOT( slotCloseAllTab() ), - actionCollection(), - "tab_closealltab" ); + KAction* tabClosealltabAction + = actionCollection()->addAction("tab_closealltab"); + tabClosealltabAction->setText(i18nc("@action:inmenu", "Close All Tabs")); + connect(tabClosealltabAction, SIGNAL(triggered()), + this, SLOT(slotCloseAllTab())); } /* public slot */ -void KitaTabWidgetBase::slotConfigureKeys() +void TabWidgetBase::slotConfigureKeys() { - QString str = "Tab Actions (" + QString( name() ) + ")"; - KKeyDialog dlg( TRUE, this ); - dlg.insert( actionCollection(), str ); + QString str = "Tab Actions"; + KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this); + dlg.addCollection(actionCollection(), str); dlg.configure(); } /* public slot */ -void KitaTabWidgetBase::slotPrevTab() +void TabWidgetBase::slotPrevTab() { int max = count(); - int curpage = currentPageIndex(); - if ( max <= 1 ) return ; + int curpage = currentIndex(); + if (max <= 1) return ; - if ( curpage == 0 ) setCurrentPage( max - 1 ); - else setCurrentPage( curpage - 1 ); + if (curpage == 0) setCurrentIndex(max - 1); + else setCurrentIndex(curpage - 1); } /* public slot */ -void KitaTabWidgetBase::slotNextTab() +void TabWidgetBase::slotNextTab() { int max = count(); - int curpage = currentPageIndex(); - if ( max <= 1 ) return ; + int curpage = currentIndex(); + if (max <= 1) return ; - if ( curpage == max - 1 ) setCurrentPage( 0 ); - else setCurrentPage( curpage + 1 ); + if (curpage == max - 1) setCurrentIndex(0); + else setCurrentIndex(curpage + 1); } /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseCurrentTab() +void TabWidgetBase::slotCloseCurrentTab() { - slotCloseTab( currentPageIndex() ); + slotCloseTab(currentIndex()); } /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseOtherTab( int idx ) +void TabWidgetBase::slotCloseOtherTab(int idx) { int max = count(); - if ( max == 0 ) return ; - if ( idx == -1 ) idx = currentPageIndex(); + if (max == 0) return ; + if (idx == -1) idx = currentIndex(); int i = 0; - while ( i < max && i != idx ) { - slotCloseTab( 0 ); + while (i < max && i != idx) { + slotCloseTab(0); i++; } i++; - while ( i < max ) { - slotCloseTab( 1 ); + while (i < max) { + slotCloseTab(1); i++; } } /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseRightTab( int idx ) +void TabWidgetBase::slotCloseRightTab(int idx) { int max = count(); - if ( max == 0 ) return ; - if ( idx == -1 ) idx = currentPageIndex(); + if (max == 0) return ; + if (idx == -1) idx = currentIndex(); int i, i2; i = i2 = idx + 1; - while ( i < max ) { - slotCloseTab( i2 ); + while (i < max) { + slotCloseTab(i2); i++; } } /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseLeftTab( int idx ) +void TabWidgetBase::slotCloseLeftTab(int idx) { int max = count(); - if ( max == 0 ) return ; - if ( idx == -1 ) idx = currentPageIndex(); + if (max == 0) return ; + if (idx == -1) idx = currentIndex(); int i = 0; - while ( i < max && i != idx ) { - slotCloseTab( 0 ); + while (i < max && i != idx) { + slotCloseTab(0); i++; } } /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseAllTab() +void TabWidgetBase::slotCloseAllTab() { int max = count(); - if ( max == 0 ) return ; + if (max == 0) return ; int i = 0; - while ( i < max ) { - slotCloseTab( 0 ); + while (i < max) { + slotCloseTab(0); i++; } } Modified: kita/trunk/kita/src/kitaui/tabwidgetbase.h =================================================================== --- kita/trunk/kita/src/kitaui/tabwidgetbase.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/kitaui/tabwidgetbase.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -11,106 +11,98 @@ #ifndef KITATABWIDGETBASE_H #define KITATABWIDGETBASE_H +#include <QtCore/QEvent> + #include <ktabwidget.h> #include <kxmlguiclient.h> +#include <kparts/part.h> #include <kparts/partmanager.h> -#include <kparts/browserextension.h> -#include <ktabbar.h> +class QIcon; -#include <kdockwidget.h> +class KMenu; +class KUrl; -#include <qevent.h> -#include <qdict.h> - -class KLibFactory; -class KURL; -class QIconSet; -class KPopupMenu; - namespace KParts { - class DockMainWindow; + class DockMainWindow3; } /* ID of user defined event */ -#define EVENT_CloseTab ( QEvent::User + 100 ) -#define EVENT_ShowDock ( QEvent::User + 101 ) -#define EVENT_FitImageToWinEvent ( QEvent::User + 102 ) -#define EVENT_CancelMoszicEvent ( QEvent::User + 103 ) +const int EVENT_CloseTab = QEvent::User + 100; +const int EVENT_ShowDock = QEvent::User + 101; +const int EVENT_FitImageToWinEvent = QEvent::User + 102; +const int EVENT_CancelMoszicEvent = QEvent::User + 103; - - -/*-----------------------------------------------*/ - - -class KitaTabWidgetBase : public KTabWidget, public KXMLGUIClient +namespace Kita { - Q_OBJECT + class KDE_EXPORT TabWidgetBase : public KTabWidget, public KXMLGUIClient + { + Q_OBJECT -protected: - KParts::PartManager* m_manager; + protected: + KParts::PartManager* m_manager; -public: - KitaTabWidgetBase( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); - virtual ~KitaTabWidgetBase(); + public: + explicit TabWidgetBase(QWidget* parent = 0); + virtual ~TabWidgetBase(); -public slots: - void slotCurrentChanged( QWidget* w ); - void slotCloseTab( int num ); + public slots: + void slotCurrentChanged(QWidget* w); + void slotCloseTab(int num); -protected: - virtual void customEvent( QCustomEvent * e ); - virtual void deleteWidget( QWidget* w ); - KParts::Part* findPartFromWidget( QWidget* w ); + protected: + virtual void customEvent(QEvent * e); + virtual void deleteWidget(QWidget* w); + KParts::Part* findPartFromWidget(QWidget* w); - /*------------------------------------*/ - /* common tab actions */ + /*------------------------------------*/ + /* common tab actions */ -private: - void setupActions(); + private: + void setupActions(); + TabWidgetBase(const TabWidgetBase&); + TabWidgetBase& operator=(const TabWidgetBase&); -public slots: - void slotConfigureKeys(); - void slotPrevTab(); - void slotNextTab(); - void slotCloseCurrentTab(); - void slotCloseOtherTab( int idx = -1 ); - void slotCloseRightTab( int idx = -1 ); - void slotCloseLeftTab( int idx = -1 ); - void slotCloseAllTab(); -}; + public slots: + void slotConfigureKeys(); + void slotPrevTab(); + void slotNextTab(); + void slotCloseCurrentTab(); + void slotCloseOtherTab(int idx = -1); + void slotCloseRightTab(int idx = -1); + void slotCloseLeftTab(int idx = -1); + void slotCloseAllTab(); + }; -/*------------------------------------------------------------------*/ + /* user defined events */ + class CloseTabEvent : public QEvent + { + int m_pageindex; -/* user defined events */ + public: -class CloseTabEvent : public QCustomEvent -{ - int m_pageindex; + CloseTabEvent(int idx) + : QEvent(QEvent::Type(EVENT_CloseTab)), m_pageindex(idx) {} -public: + int getIndex() const { return m_pageindex; } + }; - CloseTabEvent( int idx ) - : QCustomEvent( EVENT_CloseTab ), m_pageindex( idx ) {} - const int getIndex() const { return m_pageindex; } -}; + class ShowDockEvent : public QEvent + { + bool m_activate; + bool m_force; + public: + ShowDockEvent(bool activate, bool force) : QEvent(QEvent::Type(EVENT_ShowDock)) + , m_activate(activate), m_force(force) {} -class ShowDockEvent : public QCustomEvent -{ - bool m_activate; - bool m_force; + bool getActivate() const { return m_activate; } + bool getForce() const { return m_force; } + }; +} -public: - ShowDockEvent( bool activate, bool force ) : QCustomEvent( EVENT_ShowDock ) - , m_activate( activate ), m_force( force ) {} - - const bool getActivate() const { return m_activate; } - const bool getForce() const { return m_force; } -}; - #endif Deleted: kita/trunk/kita/src/kitaui.rc =================================================================== --- kita/trunk/kita/src/kitaui.rc 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/kitaui.rc 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,18 +0,0 @@ -<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui name="kita" version="3"> -<MenuBar> - <Menu name="file"><text>&File</text> - <Action name="load_board_list" /> - <Action name="login" /> - </Menu> - <Menu name="board"><text>&Board</text> - <Action name="dummy" /> - </Menu> - <Menu name="thread"><text>&Thread</text> - <Action name="dummy" /> - </Menu> -</MenuBar> -<ToolBar name="mainToolBar"> - <Action name="url_line_action" /> -</ToolBar> -</kpartgui> Copied: kita/trunk/kita/src/kitaui.rc (from rev 2558, kita/branches/KITA-KDE4/kita/src/kitaui.rc) =================================================================== --- kita/trunk/kita/src/kitaui.rc (rev 0) +++ kita/trunk/kita/src/kitaui.rc 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,18 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="kita" version="3"> +<MenuBar> + <Menu name="file"><text>File</text> + <Action name="load_board_list" /> + <Action name="login" /> + </Menu> + <Menu name="board"><text>Board</text> + <Action name="dummy" /> + </Menu> + <Menu name="thread"><text>Thread</text> + <Action name="dummy" /> + </Menu> +</MenuBar> +<ToolBar name="mainToolBar"> + <Action name="url_line_action" /> +</ToolBar> +</kpartgui> Property changes on: kita/trunk/kita/src/libkita ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in *.la *.lo *.moc *.moc.cpp *.all_cpp.cpp .deps .libs config_xt.cpp config_xt.h asciiart.cpp asciiart.h abone.cpp abone.h + moc_* *_automoc.cpp *_automoc.cpp.files CMakeFiles Makefile cmake_install.cmake CTestTestfile.cmake accountconfig.cpp accountconfig.h colorconfig.cpp colorconfig.h globalconfig.cpp globalconfig.h writeconfig.cpp writeconfig.h Deleted: kita/trunk/kita/src/libkita/.cvsignore =================================================================== --- kita/trunk/kita/src/libkita/.cvsignore 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/.cvsignore 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,15 +0,0 @@ -Makefile -Makefile.in -*.la -*.lo -*.moc -*.moc.cpp -*.all_cpp.cpp -.deps -.libs -config_xt.cpp -config_xt.h -asciiart.cpp -asciiart.h -abone.cpp -abone.h Copied: kita/trunk/kita/src/libkita/CMakeLists.txt (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/CMakeLists.txt) =================================================================== --- kita/trunk/kita/src/libkita/CMakeLists.txt (rev 0) +++ kita/trunk/kita/src/libkita/CMakeLists.txt 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,49 @@ +include_directories(${KDE4_INCLUDES} ${QT_INCLUDES}) + + +########### next target ############### + +set(kita_LIB_SRCS + access.cpp + account.cpp + bbs.cpp + boardmanager.cpp + cache.cpp + datinfo.cpp + datmanager.cpp + downloadmanager.cpp + favoriteboards.cpp + favoritethreads.cpp + favoritethreads.h + flashcgi.cpp + kita_misc.cpp + k2ch.cpp + jbbs.cpp + machibbs.cpp + parser.cpp + postdata.cpp + thread.cpp + thread.h + threadinfo.cpp + threadinfo.h + threadindex.cpp) + +kde4_add_kcfg_files(kita_LIB_SRCS + abone.kcfgc + accountconfig.kcfgc + asciiart.kcfgc + colorconfig.kcfgc + globalconfig.kcfgc + writeconfig.kcfgc) + +kde4_add_library(kitautil SHARED ${kita_LIB_SRCS}) + +target_link_libraries(kitautil ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS}) + +set_target_properties(kitautil PROPERTIES VERSION 1.0.0 SOVERSION 1) +install(TARGETS kitautil ${INSTALL_TARGETS_DEFAULT_ARGS}) + + +########### install files ############### + +install(FILES abone.kcfg asciiart.kcfg globalconfig.kcfg DESTINATION ${KCFG_INSTALL_DIR}) Deleted: kita/trunk/kita/src/libkita/Makefile.am =================================================================== --- kita/trunk/kita/src/libkita/Makefile.am 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/Makefile.am 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,11 +0,0 @@ -INCLUDES = $(all_includes) - -lib_LTLIBRARIES = libkita.la - -libkita_la_SOURCES = thread.h thread.cpp qcp932codec.cpp qcp932codec.h favoritethreads.h favoritethreads.cpp kita_misc.cpp threadinfo.h threadinfo.cpp access.cpp cache.cpp favoriteboards.cpp datmanager.cpp datinfo.cpp account.cpp threadindex.cpp boardmanager.cpp downloadmanager.cpp config_xt.kcfgc asciiart.kcfgc k2ch.cpp machibbs.cpp jbbs.cpp flashcgi.cpp abone.kcfgc - -METASOURCES = AUTO - -noinst_HEADERS = kita_misc.h access.h cache.h favoriteboards.h parsemisc.h datmanager.h datinfo.h account.h threadindex.h boardmanager.h downloadmanager.h event.h k2ch.h machibbs.h jbbs.h flashcgi.h - -kde_kcfg_DATA = config_xt.kcfg asciiart.kcfg abone.kcfg Modified: kita/trunk/kita/src/libkita/abone.kcfg =================================================================== --- kita/trunk/kita/src/libkita/abone.kcfg 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/abone.kcfg 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,5 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<kcfg> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > <kcfgfile name="kita_abonerc" /> <group name="Global"> <entry name="AboneIDList" type="StringList"> Modified: kita/trunk/kita/src/libkita/abone.kcfgc =================================================================== --- kita/trunk/kita/src/libkita/abone.kcfgc 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/abone.kcfgc 2010-02-10 10:04:00 UTC (rev 2559) @@ -3,3 +3,4 @@ NameSpace=Kita Singleton=true Mutators=true +Visibility=KDE_EXPORT Modified: kita/trunk/kita/src/libkita/access.cpp =================================================================== --- kita/trunk/kita/src/libkita/access.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/access.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -8,25 +8,33 @@ * (at your option) any later version. * ***************************************************************************/ #include "access.h" -#include "cache.h" -#include "kita_misc.h" -#include "account.h" -#include "boardmanager.h" -#include <config.h> +#include <QtCore/QByteArray> +#include <QtCore/QDataStream> +#include <QtCore/QDateTime> +#include <QtCore/QFile> +#include <QtCore/QRegExp> +#include <kdatetime.h> #include <kurl.h> +#include <kio/job.h> +#include <kio/jobuidelegate.h> #include <kio/slaveconfig.h> -#include <kio/job.h> -#include <krfcdate.h> -#include <qregexp.h> -#include <qfile.h> +#include "account.h" +#include "boardmanager.h" +#include "cache.h" +#include "config.h" +#include "flashcgi.h" +#include "jbbs.h" +#include "kita_misc.h" +#include "k2ch.h" +#include "machibbs.h" using namespace Kita; -Access::Access( const KURL& datURL ) : m_datURL( datURL ), m_currentJob( 0 ) +Access::Access(const KUrl& datUrl) : m_datUrl(datUrl), m_currentJob(0) { init(); } @@ -35,51 +43,52 @@ void Access::init() { m_readNum = 0; - m_lastLine = QString::null; - m_bbstype = BoardManager::type( m_datURL ); + m_lastLine.clear(); + m_bbstype = BoardManager::type(m_datUrl); m_header = "HTTP/1.1 200 "; /* dummy header */ m_dataSize = 0; - m_threadData = QString::null; + m_threadData.clear(); } /* read data from cache, then emit data to DatInfo. */ /* public */ void Access::getcache() { - QString orgData; + QByteArray orgData; // get cache path. - QString cachePath = Kita::Cache::getPath( m_datURL ); - if ( cachePath == QString::null ) { + Cache cache(m_datUrl); + QString cachePath = cache.getPath(); + if (cachePath.isEmpty()) { return; } // read cache file. - QFile file( cachePath ); - if ( file.open( IO_ReadOnly ) ) { + QFile file(cachePath); + if (file.open(QIODevice::ReadOnly)) { orgData += file.readAll(); file.close(); } // set data size. - if ( orgData == QString::null ) return ; + if (orgData.isEmpty()) return ; m_dataSize = orgData.length(); - switch ( m_bbstype ) { + switch (m_bbstype) { case Board_2ch: case Board_MachiBBS: /* Machi BBS's data is already parsed as 2ch dat. */ { - QString tmpData = Kita::qcpToUnicode( orgData ); - QStringList tmpList = QStringList::split( "\n", tmpData ); - emit receiveData( tmpList ); + QString tmpData = K2ch().datToUnicode(orgData); + QStringList tmpList = tmpData.split('\n'); + emit receiveData(tmpList); } break; default: /* convert data stream into 2ch dat. and emit receiveData SIGNAL. */ - emitDatLineList( orgData ); + emitDatLineList(orgData); break; } } @@ -87,157 +96,164 @@ /* write data to cache */ /* protected */ void Access::writeCacheData() { - if ( m_invalidDataReceived ) return ; - if ( m_threadData.length() == 0 ) return ; + if (m_invalidDataReceived) return ; + if (m_threadData.isEmpty()) return ; m_dataSize += m_threadData.length(); - QString cachePath = Kita::Cache::getPath( m_datURL ); - if ( cachePath != QString::null ) { - FILE * fs = fopen( QFile::encodeName( cachePath ), "a" ); - if ( !fs ) return ; - - fwrite( m_threadData, m_threadData.length(), 1, fs ); - fclose( fs ); + Cache cache(m_datUrl); + QString cachePath = cache.getPath(); + if (!cachePath.isEmpty()) { + QFile file(QFile::encodeName(cachePath)); + if (!file.open(QIODevice::WriteOnly)) + return; + QDataStream out(&file); + out << m_threadData; } - m_threadData = QString::null; /* clear baffer */ + m_threadData.clear(); /* clear baffer */ return ; } /* update cache file */ /* public */ -bool Access::getupdate( int readNum ) +bool Access::getupdate(int readNum) { /* init */ m_readNum = readNum; - m_threadData = QString::null; - m_firstReceive = FALSE; - m_invalidDataReceived = FALSE; - m_lastLine = QString::null; + m_threadData.clear(); + m_firstReceive = false; + m_invalidDataReceived = false; + m_lastLine.clear(); /* set URL of data */ - QString getURL; - switch ( m_bbstype ) { + QString getUrl; + switch (m_bbstype) { case Board_MachiBBS: - getURL = Kita::getThreadURL( m_datURL ); - if ( m_readNum > 0 ) getURL += "&START=" + QString().setNum( m_readNum + 1 ); - Kita::InitParseMachiBBS(); + getUrl = getThreadUrl(m_datUrl); + if (m_readNum > 0) + getUrl += "&START=" + QString::number(m_readNum + 1); + InitParseMachiBBS(); break; case Board_JBBS: - getURL = Kita::getThreadURL( m_datURL ); - getURL.replace( "read.cgi", "rawmode.cgi" ); /* adhoc... */ - if ( m_readNum > 0 ) getURL += "/" + QString().setNum( m_readNum + 1 ) + "-"; + getUrl = getThreadUrl(m_datUrl); + getUrl.replace("read.cgi", "rawmode.cgi"); /* adhoc... */ + if (m_readNum > 0) + getUrl += '/' + QString::number(m_readNum + 1) + '-'; break; default: - getURL = m_datURL.prettyURL(); + getUrl = m_datUrl.prettyUrl(); } /* set UserAgent */ - const QString useragent = QString( "Monazilla/1.00 (Kita/%1)" ).arg( VERSION ); - KIO::SlaveConfig::self() ->setConfigData( "http", - KURL( getURL ).host(), - "UserAgent", useragent ); + const QString useragent = QString("Monazilla/1.00 (Kita/%1)").arg(VERSION); + KIO::SlaveConfig::self() ->setConfigData("http", + KUrl(getUrl).host(), + "UserAgent", useragent); /* create new job */ - KIO::TransferJob* job = KIO::get( getURL, TRUE, FALSE ); + KIO::TransferJob* job + = KIO::get(getUrl, KIO::Reload, KIO::HideProgressInfo); m_currentJob = job; - connect( job, SIGNAL( data( KIO::Job*, const QByteArray& ) ), - SLOT( slotReceiveThreadData( KIO::Job*, const QByteArray& ) ) ); - connect( job, SIGNAL( result( KIO::Job* ) ), SLOT( slotThreadResult( KIO::Job* ) ) ); + connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), + SLOT(slotReceiveThreadData(KIO::Job*, const QByteArray&))); + connect(job, SIGNAL(result(KJob*)), SLOT(slotThreadResult(KJob*))); // use 'HTTP-Headers' metadata. - job->addMetaData( "PropagateHttpHeader", "true" ); + job->addMetaData("PropagateHttpHeader", "true"); /* resume */ - if ( m_bbstype != Board_MachiBBS + if (m_bbstype != Board_MachiBBS && m_bbstype != Board_JBBS - && m_dataSize > 0 ) { - m_firstReceive = TRUE; /* remove first char (i.e. \n). see also slotReceiveThreadData() */ - job->addMetaData( "resume", QString::number( m_dataSize - 1 ) ); - job->addMetaData( "AllowCompressedPage", "false" ); + && m_dataSize > 0) { + m_firstReceive = true; /* remove first char (i.e. \n). see also slotReceiveThreadData() */ + job->addMetaData("resume", QString::number(m_dataSize - 1)); + job->addMetaData("AllowCompressedPage", "false"); } - return TRUE; + return true; } -void Access::slotThreadResult( KIO::Job* job ) +void Access::slotThreadResult(KJob* job) { + KIO::TransferJob *tjob = qobject_cast<KIO::TransferJob *>(job); + if (!tjob) { + return; + } m_currentJob = 0; - if ( job->error() ) { - job->showErrorDialog(); + if (tjob->error()) { + tjob->ui()->setWindow(0); + tjob->ui()->showErrorMessage(); } else { - m_header = job->queryMetaData( "HTTP-Headers" ); + m_header = tjob->queryMetaData("HTTP-Headers"); } writeCacheData(); emit finishLoad(); } -void Access::slotReceiveThreadData( KIO::Job*, const QByteArray& data ) +void Access::slotReceiveThreadData(KIO::Job*, const QByteArray& data) { - QByteArray data_tmp = data.copy(); - + QByteArray data_tmp(data); + // HACK: crash when data contains '\0'. - for ( int i=0; i< data_tmp.size(); i++ ) { - if ( data_tmp[ i ] == '\0' ) data_tmp[ i ] = ' '; + for (int i=0; i< data_tmp.size(); i++) { + if (data_tmp[ i ] == '\0') data_tmp[ i ] = ' '; } - QString cstr( data_tmp ); + if (m_bbstype == Board_MachiBBS + || m_bbstype == Board_JBBS) { - if ( m_bbstype == Board_MachiBBS - || m_bbstype == Board_JBBS ) { - - emitDatLineList( cstr ); + emitDatLineList(data_tmp); return ; } - /* check if received data is invalid ( or broken ). */ - if ( ( m_dataSize > 0 && responseCode() != 206 ) - || ( m_firstReceive && cstr[ 0 ] != '\n' ) - || ( m_dataSize == 0 && responseCode() != 200 ) - ) m_invalidDataReceived = TRUE; + /* check if received data is invalid (or broken). */ + if ((m_dataSize > 0 && responseCode() != 206) + || (m_firstReceive && data_tmp[ 0 ] != '\n') + || (m_dataSize == 0 && responseCode() != 200)) + m_invalidDataReceived = true; - if ( m_invalidDataReceived ) return ; + if (m_invalidDataReceived) return ; /* If this is the first call at resumption, remove LF(\n) at head. */ - if ( m_firstReceive ) { - cstr = cstr.mid( 1 ); + if (m_firstReceive) { + data_tmp = data_tmp.mid(1); } - m_firstReceive = FALSE; + m_firstReceive = false; - emitDatLineList( cstr ); + emitDatLineList(data_tmp); } /* convert data stream into 2ch dat. and emit receiveData SIGNAL. */ /* private */ -void Access::emitDatLineList( const QString& dataStream ) +void Access::emitDatLineList(const QByteArray& dataStream) { - QStringList lineList; + QList<QByteArray> lineList; QStringList datLineList; - if ( dataStream == QString::null ) return ; + if (dataStream.isEmpty()) return ; - bool endIsLF = FALSE; - if ( dataStream.at( dataStream.length() - 1 ) == '\n' ) endIsLF = TRUE; + bool endIsLF = false; + if (dataStream.at(dataStream.length() - 1) == '\n') endIsLF = true; /* split the stream */ m_lastLine += dataStream; - lineList = QStringList::split( "\n", m_lastLine ); - m_lastLine = QString::null; + lineList = m_lastLine.split('\n'); + m_lastLine.clear(); /* save the last line */ - if ( !endIsLF ) { + if (!endIsLF) { - QStringList::iterator lastit = lineList.end(); + QList<QByteArray>::iterator lastit = lineList.end(); lastit--; - if ( lastit != lineList.end() ) { + if (lastit != lineList.end()) { - m_lastLine = ( *lastit ); - lineList.remove( lastit ); + m_lastLine = (*lastit); + lineList.removeLast(); } } @@ -245,115 +261,125 @@ /* convert lines into 2ch dat */ int count = lineList.count(); - for ( int i = 0; i < count ; ++i ) { + for (int i = 0; i < count ; ++i) { - if ( lineList[ i ] != QString::null ) { + if (! lineList[ i ].isEmpty()) { - QString line; + QString line, line2; + QByteArray ba; int nextNum = m_readNum + 1; /* convert line */ - switch ( m_bbstype ) { + switch (m_bbstype) { case Board_MachiBBS: - line = Kita::ParseMachiBBSOneLine( lineList[ i ] , nextNum ); + { + MachiBBS machiBbs; + line = machiBbs.datToUnicode(lineList[i]); + line2 = ParseMachiBBSOneLine(line, nextNum); + ba = machiBbs.datFromUnicode(line2); + } break; case Board_JBBS: - line = Kita::ParseJBBSOneLine( lineList[ i ] , nextNum ); + { + JBBS jBbs; + line = jBbs.datToUnicode(lineList[i]); + line2 = ParseJBBSOneLine(line, nextNum); + ba = jBbs.datFromUnicode(line2); + } break; case Board_FlashCGI: - line = Kita::ParseFlashCGIOneLine( lineList[ i ] ); + { + FlashCGI flashCgi; + line = flashCgi.datToUnicode(lineList[i]); + line2 = ParseFlashCGIOneLine(line); + ba = flashCgi.datFromUnicode(line2); + } break; default: - line = lineList[ i ]; + line = line2 = K2ch().datToUnicode(lineList[i]); + ba = lineList[i]; } - if ( line == QString::null ) continue; + if (line2.isEmpty()) continue; /* add abone lines */ - const QString aboneStr = "abone<><><>abone<>"; - while ( nextNum > m_readNum + 1 ) { + const char aboneStr[] = "abone<><><>abone<>"; + while (nextNum > m_readNum + 1) { datLineList += aboneStr; - m_threadData += aboneStr + "\n"; + m_threadData += aboneStr + '\n'; ++m_readNum; } /* save line */ - if ( m_bbstype == Board_MachiBBS ) m_threadData += line + "\n"; - else m_threadData += lineList[ i ] + "\n"; + if (m_bbstype == Board_MachiBBS) m_threadData += ba + '\n'; + else m_threadData += lineList[ i ] + '\n'; ++m_readNum; - /* encode line */ - switch ( m_bbstype ) { - - case Board_JBBS: - datLineList += Kita::eucToUnicode( line ); - break; - - default: - datLineList += Kita::qcpToUnicode( line ); - } + datLineList += line2; } } /* call DatInfo::slotReceiveData() */ - emit receiveData( datLineList ); + emit receiveData(datLineList); } void Access::killJob() { - if ( m_currentJob ) m_currentJob->kill(); + if (m_currentJob) m_currentJob->kill(); } void Access::stopJob() { - if ( m_currentJob ) m_currentJob->kill( FALSE ); /* emit result signal */ + if (m_currentJob) m_currentJob->kill(); /* emit result signal */ } int Access::serverTime() { - if ( m_currentJob ) m_header = m_currentJob->queryMetaData( "HTTP-Headers" ); + if (m_currentJob) m_header = m_currentJob->queryMetaData("HTTP-Headers"); + //if (m_header.isEmpty()) return QDateTime::currentDateTime().toTime_t(); // parse HTTP headers - QStringList headerList = QStringList::split( "\n", m_header ); - QRegExp regexp( "Date: (.*)" ); - QString dateStr = headerList.grep( regexp ) [ 0 ]; - if ( regexp.search( dateStr ) == -1 ) { + QStringList headerList = m_header.split('\n'); + QRegExp regexp("Date: (.*)"); + QStringList dateStrList = headerList.filter(regexp); + if (dateStrList.isEmpty() || regexp.indexIn(dateStrList[0]) == -1) { // 'Date' header is not found. use current time. return QDateTime::currentDateTime().toTime_t(); } else { - return KRFCDate::parseDate( regexp.cap( 1 ) ); + return KDateTime::fromString(regexp.cap(1), KDateTime::RFCDate) + .toTime_t(); } } int Access::responseCode() { - if ( m_currentJob ) m_header = m_currentJob->queryMetaData( "HTTP-Headers" ); + if (m_currentJob) m_header = m_currentJob->queryMetaData("HTTP-Headers"); // parse HTTP headers - QStringList headerList = QStringList::split( "\n", m_header ); - QRegExp regexp( "HTTP/1\\.[01] ([0-9]+) .*" ); - QString dateStr = headerList.grep( regexp ) [ 0 ]; - if ( regexp.search( dateStr ) == -1 ) { + QStringList headerList = m_header.split('\n'); + QRegExp regexp("HTTP/1\\.[01] ([0-9]+) .*"); + QStringList dateStrList = headerList.filter(regexp); + if (dateStrList.isEmpty() || regexp.indexIn(dateStrList[0]) == -1) { // invalid response - if ( m_bbstype == Board_JBBS ) return 200; /* adhoc... */ + if (m_bbstype == Board_JBBS) return 200; /* adhoc... */ return 0; } else { - return regexp.cap( 1 ).toInt(); + return regexp.cap(1).toInt(); } } /* public */ -const int Access::dataSize() const +int Access::dataSize() const { return m_dataSize; } /* public */ -const bool Access::invalidDataReceived() const +bool Access::invalidDataReceived() const { return m_invalidDataReceived; } @@ -363,65 +389,65 @@ // QString OfflawAccess::get() { - QString getURL = Kita::datToOfflaw( m_datURL.url() ); - KURL kgetURL( getURL ); - kgetURL.addQueryItem( "sid", Account::getSessionID() ); + QString getUrl = datToOfflaw(m_datUrl.url()); + KUrl kgetUrl(getUrl); + kgetUrl.addQueryItem("sid", Account::getSessionId()); - m_threadData = ""; - m_invalidDataReceived = FALSE; + m_threadData.clear(); + m_invalidDataReceived = false; - KIO::SlaveConfig::self() ->setConfigData( "http", - KURL( getURL ).host(), + KIO::SlaveConfig::self() ->setConfigData("http", + KUrl(getUrl).host(), "UserAgent", - QString( "Monazilla/1.00 (Kita/%1)" ).arg( VERSION ) ); + QString("Monazilla/1.00 (Kita/%1)").arg(VERSION)); - KIO::TransferJob* job = KIO::get( kgetURL, TRUE, FALSE ); + KIO::TransferJob* job + = KIO::get(kgetUrl, KIO::Reload, KIO::HideProgressInfo); m_currentJob = job; - connect( job, SIGNAL( data( KIO::Job*, const QByteArray& ) ), - SLOT( slotReceiveThreadData( KIO::Job*, const QByteArray& ) ) ); - connect( job, SIGNAL( result( KIO::Job* ) ), SLOT( slotThreadResult( KIO::Job* ) ) ); + connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), + SLOT(slotReceiveThreadData(KIO::Job*, const QByteArray&))); + connect(job, SIGNAL(result(KJob*)), SLOT(slotThreadResult(KJob*))); // use 'HTTP-Headers' metadata. - job->addMetaData( "PropagateHttpHeader", "true" ); + job->addMetaData("PropagateHttpHeader", "true"); - return QString::null; /* dummy */ + return QString(); /* dummy */ } -void OfflawAccess::slotThreadResult( KIO::Job* job ) +void OfflawAccess::slotThreadResult(KIO::Job* job) { m_currentJob = 0; - if ( job->error() ) { - job->showErrorDialog(); + if (job->error()) { + job->ui()->setWindow(0); + job->ui()->showErrorMessage(); } else { - m_header = job->queryMetaData( "HTTP-Headers" ); + m_header = job->queryMetaData("HTTP-Headers"); } - if ( !m_invalidDataReceived && m_threadData.length() ) { - KURL url = m_datURL; + if (!m_invalidDataReceived && !m_threadData.isEmpty()) { + KUrl url = m_datUrl; writeCacheData(); } emit finishLoad(); } -void OfflawAccess::slotReceiveThreadData( KIO::Job*, const QByteArray& data ) +void OfflawAccess::slotReceiveThreadData(KIO::Job*, const QByteArray& data) { - QString cstr( data ); + QByteArray cstr(data); - if ( ( m_dataSize > 0 && responseCode() != 206 ) - || ( m_dataSize == 0 && responseCode() != 200 ) ) { - m_invalidDataReceived = TRUE; + if ((m_dataSize > 0 && responseCode() != 206) + || (m_dataSize == 0 && responseCode() != 200)) { + m_invalidDataReceived = true; } - if ( m_invalidDataReceived ) return ; + if (m_invalidDataReceived) return ; // "+OK ....../1024K\tLocation:temp/\n" - if ( m_threadData.isEmpty() && cstr[ 0 ] == '+' ) { + if (m_threadData.isEmpty() && cstr[ 0 ] == '+') { // skip first line. - int index = cstr.find( '\n' ); - cstr = cstr.mid( index + 1 ); + int index = cstr.indexOf('\n'); + cstr = cstr.mid(index + 1); } - emitDatLineList( cstr ); + emitDatLineList(cstr); } - -#include "access.moc" Modified: kita/trunk/kita/src/libkita/access.h =================================================================== --- kita/trunk/kita/src/libkita/access.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/access.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,10 +10,11 @@ #ifndef KITAACCESS_H #define KITAACCESS_H +#include <QtCore/QObject> + #include <kurl.h> -#include <qobject.h> - +class KJob; namespace KIO { class Job; @@ -31,7 +32,7 @@ Q_OBJECT public: - Access( const KURL& datURL ); + Access(const KUrl& datUrl); virtual ~Access() {}; void init(); @@ -40,34 +41,37 @@ void stopJob(); int serverTime(); void getcache(); - bool getupdate( int readNum ); + bool getupdate(int readNum); int responseCode(); - const int dataSize() const; - const bool invalidDataReceived() const; + int dataSize() const; + bool invalidDataReceived() const; protected: void writeCacheData(); - void emitDatLineList( const QString& dataStream ); + void emitDatLineList(const QByteArray& dataStream); - const KURL m_datURL; + const KUrl m_datUrl; KIO::Job* m_currentJob; - QString m_threadData; + QByteArray m_threadData; QString m_header; int m_dataSize; bool m_firstReceive; bool m_invalidDataReceived; int m_bbstype; int m_readNum; - QString m_lastLine; + QByteArray m_lastLine; private slots: - void slotReceiveThreadData( KIO::Job* job, const QByteArray& data ); - void slotThreadResult( KIO::Job* job ); + void slotReceiveThreadData(KIO::Job* job, const QByteArray& data); + void slotThreadResult(KJob* job); signals: - void redirection( const QString& ); - void receiveData( const QStringList& ); + void redirection(const QString&); + void receiveData(const QStringList&); void finishLoad(); + private: + Access(const Access&); + Access& operator=(const Access&); }; class OfflawAccess : public Access @@ -75,14 +79,14 @@ Q_OBJECT public: - OfflawAccess( const KURL& datURL ) : Access( datURL ) {}; + OfflawAccess(const KUrl& datUrl) : Access(datUrl) {}; virtual ~OfflawAccess() {}; QString get(); private slots: - void slotReceiveThreadData( KIO::Job* job, const QByteArray& data ); - void slotThreadResult( KIO::Job* job ); + void slotReceiveThreadData(KIO::Job* job, const QByteArray& data); + void slotThreadResult(KIO::Job* job); }; } Modified: kita/trunk/kita/src/libkita/account.cpp =================================================================== --- kita/trunk/kita/src/libkita/account.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/account.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,17 +9,15 @@ ***************************************************************************/ #include "account.h" -#include <config.h> +#include <QtCore/QByteArray> +#include <QtCore/QRegExp> #include <kurl.h> - -#include <kio/slaveconfig.h> -#include <kio/netaccess.h> -#include <kio/jobclasses.h> #include <kio/job.h> +#include <kio/jobuidelegate.h> +#include <kio/slaveconfig.h> -#include <qregexp.h> -#include <qapplication.h> +#include "config.h" using namespace Kita; @@ -27,94 +25,80 @@ Account* Account::getInstance() { - if ( instance == 0 ) { + if (instance == 0) { instance = new Account(); } return instance; } Account::Account() - : m_isLogged( FALSE ) + : m_isLogged(false) {} Account::~Account() {} -bool Account::login( const QString& userID, const QString& password ) +bool Account::login(const QString& userID, const QString& password) { - return getInstance() ->loginInternal( userID, password ); + return getInstance() ->loginInternal(userID, password); } -bool Account::loginInternal( const QString& userID, const QString& password ) +bool Account::loginInternal(const QString& userID, const QString& password) { - m_data.resize( 0 ); + m_data.clear(); - KURL url( "https://2chv.tora3.net/futen.cgi" ); - QString postData = QString( "ID=" ) + userID + QString( "&PW=" ) + password; + KUrl url("https://2chv.tora3.net/futen.cgi"); + QString postData = QString("ID=") + userID + QString("&PW=") + password; - KIO::SlaveConfig::self() ->setConfigData( "https", + KIO::SlaveConfig::self() ->setConfigData("https", url.host(), "UserAgent", - "DOLIB/1.00" ); - m_job = KIO::http_post( url, postData.utf8(), FALSE ); + "DOLIB/1.00"); + m_job = KIO::http_post(url, postData.toUtf8(), false); - connect( m_job, SIGNAL( data( KIO::Job*, const QByteArray& ) ), - SLOT( slotReceiveData( KIO::Job*, const QByteArray& ) ) ); - connect( m_job, SIGNAL( result( KIO::Job* ) ), SLOT( slotResult( KIO::Job* ) ) ); - m_job->addMetaData( "customHTTPHeader", - QString( "X-2ch-UA: Kita/%1" ).arg( VERSION ) ); - m_job->addMetaData( "content-type", - "Content-Type: application/x-www-form-urlencoded" ); + connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), + SLOT(slotReceiveData(KIO::Job*, const QByteArray&))); + connect(m_job, SIGNAL(result(KIO::Job*)), SLOT(slotResult(KIO::Job*))); + m_job->addMetaData("customHTTPHeader", + QString("X-2ch-UA: Kita/%1").arg(VERSION)); + m_job->addMetaData("content-type", + "Content-Type: application/x-www-form-urlencoded"); - enter_loop(); + QEventLoop m_eventLoop; + m_eventLoop.exec(); return m_isLogged; } -void Account::slotReceiveData( KIO::Job*, const QByteArray& data ) +void Account::slotReceiveData(KIO::Job*, const QByteArray& data) { - QCString str( data, data.size() ); - m_data += str; + m_data += data; } -void Account::slotResult( KIO::Job* job ) +void Account::slotResult(KIO::Job* job) { m_job = 0; - if ( job->error() ) { - job->showErrorDialog(); + if (job->error()) { + job->ui()->setWindow(0); + job->ui()->showErrorMessage(); } - QString str( m_data ); - QRegExp regexp( "SESSION-ID=(.*)" ); - if ( regexp.search( str ) == -1 ) { - m_sessionID = QString::null; - m_isLogged = FALSE; + QString str(m_data); + QRegExp regexp("SESSION-ID=(.*)"); + if (regexp.indexIn(str) == -1) { + m_sessionID.clear(); + m_isLogged = false; } else { - QString value = regexp.cap( 1 ); + QString value = regexp.cap(1); - QRegExp error( "^ERROR:p+$" ); - if ( error.search( value ) == -1 ) { - m_isLogged = TRUE; + QRegExp error("^ERROR:p+$"); + if (error.indexIn(value) == -1) { + m_isLogged = true; m_sessionID = value; } else { - m_isLogged = FALSE; - m_sessionID = QString::null; + m_isLogged = false; + m_sessionID.clear(); } } - qApp->exit_loop(); + m_eventLoop.exit(); } - -// from netaccess.cpp -void qt_enter_modal( QWidget* widget ); -void qt_leave_modal( QWidget* widget ); - -void Account::enter_loop() -{ - QWidget dummy( 0, 0, WType_Dialog | WShowModal ); - dummy.setFocusPolicy( QWidget::NoFocus ); - qt_enter_modal( &dummy ); - qApp->enter_loop(); - qt_leave_modal( &dummy ); -} - -#include "account.moc" Modified: kita/trunk/kita/src/libkita/account.h =================================================================== --- kita/trunk/kita/src/libkita/account.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/account.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,8 +10,12 @@ #ifndef KITAACCOUNT_H #define KITAACCOUNT_H -#include <qobject.h> +#include <QtCore/QByteArray> +#include <QtCore/QEventLoop> +#include <QtCore/QObject> +#include <kdemacros.h> + namespace KIO { class Job; @@ -23,28 +27,32 @@ /** @author Hideki Ikemoto */ - class Account : public QObject + class KDE_EXPORT Account : public QObject { Q_OBJECT static Account* instance; KIO::Job* m_job; - QCString m_data; + QByteArray m_data; QString m_sessionID; bool m_isLogged; + QEventLoop m_eventLoop; Account(); ~Account(); void enter_loop(); - bool loginInternal( const QString& userID, const QString& password ); + bool loginInternal(const QString& userID, const QString& password); static Account* getInstance(); private slots: - void slotReceiveData( KIO::Job* job, const QByteArray& data ); - void slotResult( KIO::Job* job ); + void slotReceiveData(KIO::Job* job, const QByteArray& data); + void slotResult(KIO::Job* job); + private: + Account(const Account&); + Account& operator=(const Account&); public: - static const QString& getSessionID() { return getInstance() ->m_sessionID; } + static const QString& getSessionId() { return getInstance() ->m_sessionID; } static bool isLogged() { return getInstance() ->m_isLogged; } - static bool login( const QString& userID, const QString& password ); + static bool login(const QString& userID, const QString& password); }; } Copied: kita/trunk/kita/src/libkita/accountconfig.kcfg (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/accountconfig.kcfg) =================================================================== --- kita/trunk/kita/src/libkita/accountconfig.kcfg (rev 0) +++ kita/trunk/kita/src/libkita/accountconfig.kcfg 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <kcfgfile name="kitarc" /> + <group name="Account"> + <entry name="BeMailAddress" type="String"> + <label>Mail address of be.2ch.net</label> + </entry> + <entry name="BeAuthCode" type="String"> + <label>Auth code of be.2ch.net</label> + </entry> + <entry name="UserID" type="String"> + <label>Maru user id</label> + </entry> + <entry name="AutoLogin" type="Bool"> + <label>Whether login automatically or not.</label> + <default>false</default> + </entry> + <entry name="Password" type="Password"> + <label>Maru password</label> + </entry> + </group> +</kcfg> Copied: kita/trunk/kita/src/libkita/accountconfig.kcfgc (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/accountconfig.kcfgc) =================================================================== --- kita/trunk/kita/src/libkita/accountconfig.kcfgc (rev 0) +++ kita/trunk/kita/src/libkita/accountconfig.kcfgc 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,6 @@ +File=accountconfig.kcfg +ClassName=AccountConfig +NameSpace=Kita +Singleton=true +Mutators=true +Visibility=KDE_EXPORT Modified: kita/trunk/kita/src/libkita/asciiart.kcfg =================================================================== --- kita/trunk/kita/src/libkita/asciiart.kcfg 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/asciiart.kcfg 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,5 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<kcfg> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > <kcfgfile name="kita_asciiartrc" /> <group name="Global"> <entry name="AsciiArtList" type="StringList"> Modified: kita/trunk/kita/src/libkita/asciiart.kcfgc =================================================================== --- kita/trunk/kita/src/libkita/asciiart.kcfgc 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/asciiart.kcfgc 2010-02-10 10:04:00 UTC (rev 2559) @@ -3,3 +3,4 @@ NameSpace=Kita Singleton=true Mutators=true +Visibility=KDE_EXPORT Copied: kita/trunk/kita/src/libkita/bbs.cpp (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/bbs.cpp) =================================================================== --- kita/trunk/kita/src/libkita/bbs.cpp (rev 0) +++ kita/trunk/kita/src/libkita/bbs.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,108 @@ +/*************************************************************************** + * Copyright (C) 2006 by Kita Developers * + * ikemo****@users***** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#include "bbs.h" + +#include <QtCore/QTextCodec> + +using namespace Kita; + +Bbs::Bbs() +{ + m_readCodec = QTextCodec::codecForName("Shift-JIS"); + m_writeCodec = QTextCodec::codecForName("Shift-JIS"); +} + +QString Bbs::datToUnicode(const QByteArray& ba) const +{ + return m_readCodec->toUnicode(ba); +} + +QByteArray Bbs::datFromUnicode(const QString& str) const +{ + return m_readCodec->fromUnicode(str); +} + +QString Bbs::postToUnicode(const QByteArray& ba) const +{ + return m_writeCodec->toUnicode(ba); +} + +QByteArray Bbs::postFromUnicode(const QString& str) const +{ + return m_writeCodec->fromUnicode(str); +} + +// encoding_offset: +// 0 encode both @ and / +// 1 encode @ but not / +// 2 encode neither @ or / +QString Bbs::encode(const QString& segment, int encoding_offset, + int encoding_hint, bool isRawURI) +{ + const char *encode_string = "/@<>#\"&?={}|^~[]\'`\\:+%"; + encode_string += encoding_offset; + + QByteArray local; + if (encoding_hint==0) + local = segment.toLocal8Bit(); + else + { + QTextCodec * textCodec = QTextCodec::codecForMib(encoding_hint); + if (!textCodec) + local = segment.toLocal8Bit(); + else + local = textCodec->fromUnicode(segment); + } + + int old_length = isRawURI ? local.size() - 1 : local.length(); + + if (!old_length) + return segment.isEmpty() ? QString() : QString(""); // differentiate null and empty + + // a worst case approximation + QChar *new_segment = new QChar[ old_length * 3 + 1 ]; + int new_length = 0; + + for (int i = 0; i < old_length; i++) + { + // 'unsave' and 'reserved' characters + // according to RFC 1738, + // 2.2. URL Character Encoding Issues (pp. 3-4) + // WABA: Added non-ascii + unsigned char character = local[i]; + if ((character <= 32) || (character >= 127) || + strchr(encode_string, character)) + { + new_segment[ new_length++ ] = '%'; + + unsigned int c = character / 16; + c += (c > 9) ? ('A' - 10) : '0'; + new_segment[ new_length++ ] = c; + + c = character % 16; + c += (c > 9) ? ('A' - 10) : '0'; + new_segment[ new_length++ ] = c; + + } + else { + unsigned char character = local[i]; + new_segment[ new_length++ ] = character; + } + } + + QString result = QString(new_segment, new_length); + delete [] new_segment; + return result; +} + +QString Bbs::encodeString(const QString &str, int encoding_hint) +{ + return encode(str, 1, encoding_hint); +} Copied: kita/trunk/kita/src/libkita/bbs.h (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/bbs.h) =================================================================== --- kita/trunk/kita/src/libkita/bbs.h (rev 0) +++ kita/trunk/kita/src/libkita/bbs.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (C) 2006 by Kita Developers * + * ikemo****@users***** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#ifndef BBS_H +#define BBS_H + +#include <kdemacros.h> + +class QTextCodec; + +namespace Kita { + class PostData; + + class KDE_EXPORT Bbs { + public: + Bbs(); + virtual ~Bbs() { } + virtual QString buildPostStr(const PostData& data) = 0; + + QString datToUnicode(const QByteArray& ba) const; + QByteArray datFromUnicode(const QString& str) const; + + QString postToUnicode(const QByteArray& ba) const; + QByteArray postFromUnicode(const QString& str) const; + protected: + static QString encodeString(const QString &str, int encoding_hint); + + QTextCodec* m_readCodec; + QTextCodec* m_writeCodec; + + private: + static QString encode(const QString& segment, int encoding_offset, + int encoding_hint, bool isRawURI = false); + }; +} + +#endif + Modified: kita/trunk/kita/src/libkita/boardmanager.cpp =================================================================== --- kita/trunk/kita/src/libkita/boardmanager.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/boardmanager.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,29 +9,26 @@ ***************************************************************************/ #include "boardmanager.h" -#include "qcp932codec.h" -#include "downloadmanager.h" -#include "cache.h" -#include "favoritethreads.h" -#include "thread.h" -#include "threadinfo.h" -#include "favoriteboards.h" -#include "kita_misc.h" -#include "threadindex.h" -#include <config.h> /* VERSION */ +#include <QtCore/QDateTime> +#include <QtCore/QDir> +#include <QtCore/QFile> +#include <QtCore/QRegExp> +#include <QtCore/QTextCodec> +#include <QtCore/QTextStream> -#include <kdebug.h> +#include <kfilterdev.h> #include <kio/netaccess.h> -#include <kfilterdev.h> #include <kio/slaveconfig.h> -#include <kdeversion.h> -#include <qfile.h> -#include <qdir.h> -#include <qregexp.h> -#include <qdatetime.h> -#include <qeucjpcodec.h> +#include "cache.h" +#include "config.h" +#include "favoriteboards.h" +#include "favoritethreads.h" +#include "kita_misc.h" +#include "thread.h" +#include "threadindex.h" +#include "threadinfo.h" using namespace Kita; @@ -40,15 +37,15 @@ /* BoardData */ -BoardData::BoardData( const QString& boardName, +BoardData::BoardData(const QString& boardName, const QString& hostname, const QString& rootPath, const QString& delimiter, const QString& bbsPath, const QString& ext, - int boardtype ) + int boardtype) { - m_readIdx = FALSE; + m_readIdx = false; m_boardName = boardName; m_rootPath = rootPath; m_delimiter = delimiter; @@ -57,14 +54,14 @@ m_type = boardtype; /* set hostname and create URL of board */ - setHostName( hostname ); + setHostName(hostname); /* create default key */ - QStringList keyHosts = m_hostname; - createKeys( keyHosts ); + QStringList keyHosts(m_hostname); + createKeys(keyHosts); /* reset SETTING.TXT */ - setSettingLoaded( FALSE ); + setSettingLoaded(false); } BoardData::~BoardData() @@ -72,22 +69,22 @@ /* public */ -void BoardData::setHostName( const QString& hostName ) +void BoardData::setHostName(const QString& hostName) { m_hostname = hostName; /* m_basePath = (hostname)/(rootPath)/(bbsPath)/ */ - m_basePath = m_hostname + m_rootPath + m_bbsPath + "/"; + m_basePath = m_hostname + m_rootPath + m_bbsPath + '/'; - switch ( m_type ) { + switch (m_type) { case Board_MachiBBS: /* m_cgiBasePath = (hostname)/(rootPath)/(delimiter)?BBS=(bbsPath) */ - m_cgiBasePath = m_hostname + m_rootPath + m_delimiter + "?BBS=" + m_bbsPath.mid( 1 ); + m_cgiBasePath = m_hostname + m_rootPath + m_delimiter + "?BBS=" + m_bbsPath.mid(1); break; /* m_cgiBasePath = (hostname)/(rootPath)/(delimiter)/(bbsPath)/ */ default: - m_cgiBasePath = m_hostname + m_rootPath + m_delimiter + m_bbsPath + "/"; + m_cgiBasePath = m_hostname + m_rootPath + m_delimiter + m_bbsPath + '/'; break; } } @@ -97,13 +94,13 @@ /* information */ /* public */ -const bool BoardData::readIdx() const +bool BoardData::readIdx() const { return m_readIdx; } /* public */ -void BoardData::setReadIdx( bool idx ) +void BoardData::setReadIdx(bool idx) { m_readIdx = idx; } @@ -145,7 +142,7 @@ } /* public */ -const int BoardData::type() const +int BoardData::type() const { return m_type; } @@ -167,13 +164,13 @@ /* SETTING.TXT */ /* public */ -const QString BoardData::settingURL() const +const QString BoardData::settingUrl() const { return m_basePath + "SETTING.TXT"; } /* public */ -const bool BoardData::settingLoaded() const +bool BoardData::settingLoaded() const { return m_settingLoaded; } @@ -185,57 +182,57 @@ } /* public */ -const int BoardData::lineNum() const +int BoardData::lineNum() const { return m_linenum; } /* public */ -const int BoardData::msgCount() const +int BoardData::msgCount() const { return m_msgCount; } /* public */ -const KURL& BoardData::titleImgURL() const +const KUrl& BoardData::titleImgUrl() const { - return m_titleImgURL; + return m_titleImgUrl; } /* public */ -void BoardData::setSettingLoaded( bool set ) +void BoardData::setSettingLoaded(bool set) { m_settingLoaded = set; - if ( ! set ) { - m_defaultName = QString::null; + if (! set) { + m_defaultName.clear(); m_linenum = 0; m_msgCount = 0; - m_titleImgURL = QString::null; + m_titleImgUrl.clear(); } } /* public */ -void BoardData::setDefaultName( const QString& newName ) +void BoardData::setDefaultName(const QString& newName) { m_defaultName = newName; } /* public */ -void BoardData::setLineNum( int newLine ) +void BoardData::setLineNum(int newLine) { m_linenum = newLine; } /* public */ -void BoardData::setMsgCount( int msgCount ) +void BoardData::setMsgCount(int msgCount) { m_msgCount = msgCount; } /* public */ -void BoardData::setTitleImgURL( const KURL& url ) +void BoardData::setTitleImgUrl(const KUrl& url) { - m_titleImgURL = url; + m_titleImgUrl = url; } @@ -243,7 +240,7 @@ /* keys */ /* create keys of DB */ /* public */ -void BoardData::createKeys( const QStringList& keyHostList ) +void BoardData::createKeys(const QStringList& keyHostList) { /* reset keys */ m_keyBasePathList.clear(); @@ -253,23 +250,23 @@ m_keyHostList = keyHostList; /* m_basePath = (hostname)/(rootPath)/(bbsPath)/ */ - for ( unsigned int i = 0; i < m_keyHostList.count(); ++i ) { - if ( m_keyHostList[ i ].length() > 0 ) - m_keyBasePathList += m_keyHostList[ i ] + m_rootPath + m_bbsPath + "/"; + for (int i = 0; i < m_keyHostList.count(); ++i) { + if (m_keyHostList[ i ].length() > 0) + m_keyBasePathList += m_keyHostList[ i ] + m_rootPath + m_bbsPath + '/'; } - switch ( m_type ) { + switch (m_type) { case Board_MachiBBS: /* m_cgiBasePath = (hostname)/(rootPath)/(delimiter)?BBS=(bbsPath) */ - for ( unsigned int i = 0; i < m_keyHostList.count(); ++i ) + for (int i = 0; i < m_keyHostList.count(); ++i) m_keyCgiBasePathList += m_keyHostList[ i ] + m_rootPath + m_delimiter - + "?BBS=" + m_bbsPath.mid( 1 ); + + "?BBS=" + m_bbsPath.mid(1); break; /* m_cgiBasePath = (hostname)/(rootPath)/(delimiter)/(bbsPath)/ */ default: - for ( unsigned int i = 0; i < m_keyHostList.count(); ++i ) - m_keyCgiBasePathList += m_keyHostList[ i ] + m_rootPath + m_delimiter + m_bbsPath + "/"; + for (int i = 0; i < m_keyHostList.count(); ++i) + m_keyCgiBasePathList += m_keyHostList[ i ] + m_rootPath + m_delimiter + m_bbsPath + '/'; break; } } @@ -301,11 +298,11 @@ /* BoardManager */ -QCp932Codec* Kita::BoardManager::m_cp932Codec = NULL; -QEucJpCodec* Kita::BoardManager::m_eucJpCodec = NULL; -BoardDataList Kita::BoardManager::m_boardDataList; -BoardData* Kita::BoardManager::m_previousBoardData = NULL; -QString Kita::BoardManager::m_previousBoardURL; +QTextCodec* BoardManager::m_cp932Codec = 0; +QTextCodec* BoardManager::m_eucJpCodec = 0; +BoardDataList BoardManager::m_boardDataList; +BoardData* BoardManager::m_previousBoardData = 0; +QString BoardManager::m_previousBoardUrl; BoardManager::BoardManager() @@ -320,88 +317,88 @@ } /* (hostname)/(rootPath)/(bbsPath)/ */ /* public */ /* static */ -const QString BoardManager::boardURL( const KURL& url ) +const QString BoardManager::boardUrl(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == NULL ) return QString::null; + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->basePath(); } /* public */ /* static */ -const QStringList BoardManager::allBoardURLList() +const QStringList BoardManager::allBoardUrlList() { QStringList urlList; urlList.clear(); - for ( BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it ) - urlList += ( *it ) ->basePath(); + for (BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it) + urlList += (*it) ->basePath(); return urlList; } /* (hostname)/(rootPath) */ /* public */ /* static */ -const QString BoardManager::boardRoot( const KURL& url ) +const QString BoardManager::boardRoot(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == NULL ) return QString::null; + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->hostName() + bdata->rootPath(); } /* (bbspath) */ /* public */ /* static */ -const QString BoardManager::boardPath( const KURL& url ) +const QString BoardManager::boardPath(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == NULL ) return QString::null; + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->bbsPath(); } /* (ext) */ /* public */ /* static */ -const QString BoardManager::ext( const KURL& url ) +const QString BoardManager::ext(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == NULL ) return QString::null; + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->ext(); } /* ID of board for writing */ /* public */ /* static */ -const QString BoardManager::boardID( const KURL& url ) +const QString BoardManager::boardId(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == NULL ) return QString::null; + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); - return bdata->bbsPath().mid( 1 ); /* remove "/" */ + return bdata->bbsPath().mid(1); /* remove "/" */ } /* (hostname)/(rootPath)/(bbsPath)/subject.txt */ /* public */ /* static */ -const QString BoardManager::subjectURL( const KURL& url ) +const QString BoardManager::subjectUrl(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == NULL ) return QString::null; + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->basePath() + "subject.txt"; } /* public */ /* static */ -const QString BoardManager::boardName( const KURL& url ) +const QString BoardManager::boardName(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == NULL ) return QString::null; + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->boardName(); } /* public */ /* static */ -const int BoardManager::type( const KURL& url ) +int BoardManager::type(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == NULL ) return Board_Unknown; + BoardData * bdata = getBoardData(url); + if (bdata == 0) return Board_Unknown; return bdata->type(); } @@ -416,7 +413,7 @@ Input: url: URL of board. - oldLogs: If TRUE, search cache and get list of pointer of old threads. + oldLogs: If true, search cache and get list of pointer of old threads. online: online or offline mode. Output: @@ -428,26 +425,26 @@ void BoardManager::getThreadList( /* input */ - const KURL& url, + const KUrl& url, bool oldLogs, bool online, /* output */ - QPtrList< Thread >& threadList, - QPtrList< Thread >& oldLogList ) + QList<Thread*>& threadList, + QList<Thread*>& oldLogList) { threadList.clear(); oldLogList.clear(); /* get all obtained threads list from cache */ - if ( url.prettyURL() == "http://virtual/obtained/" ) { + if (url.prettyUrl() == "http://virtual/obtained/") { - QStringList bbslist = allBoardURLList(); + QStringList bbslist = allBoardUrlList(); /* search all cache dirs */ - for ( QStringList::iterator it = bbslist.begin() ; it != bbslist.end(); ++it ) { + for (QStringList::iterator it = bbslist.begin() ; it != bbslist.end(); ++it) { - getCachedThreadList( ( *it ), threadList ); + getCachedThreadList((*it), threadList); } return ; @@ -455,69 +452,74 @@ /*-------------------------*/ - BoardData* bdata = getBoardData( url ); - if ( bdata == NULL ) return ; + BoardData* bdata = getBoardData(url); + if (bdata == 0) return ; /* download subject.txt */ - if ( online ) { + if (online) { /* make directory */ - QString cacheDir = Cache::baseDir() + Cache::serverDir( url ) + Cache::boardDir( url ); - if ( !Kita::mkdir( cacheDir ) ) return ; + Cache cache(url); + QString cacheDir = cache.getDirPath(); + if (!QDir::root().mkpath(cacheDir)) return; - KIO::SlaveConfig::self() ->setConfigData( "http", + KIO::SlaveConfig::self() ->setConfigData("http", url.host() , "UserAgent", - QString( "Monazilla/1.00 (Kita/%1)" ).arg( VERSION ) ); - QString subjectPath = Cache::getSubjectPath( url ); - KIO::NetAccess::download( subjectURL( url ), subjectPath, NULL ); + QString("Monazilla/1.00 (Kita/%1)").arg(VERSION)); + QString subjectPath = cache.getSubjectPath(); + KIO::NetAccess::download(subjectUrl(url), subjectPath, 0); } /* open and read subject.txt */ - readSubjectTxt( bdata, url, threadList ); + readSubjectTxt(bdata, url, threadList); /* get old logs */ - if ( oldLogs ) { + if (oldLogs) { - QPtrList< Thread > tmpList; + QList<Thread*> tmpList; tmpList.clear(); - getCachedThreadList( url, tmpList ); + getCachedThreadList(url, tmpList); - for ( unsigned i = 0; i < tmpList.count(); i++ ) { - - if ( threadList.contains( tmpList.at( i ) ) == 0 ) oldLogList.append( tmpList.at( i ) ); + for (int i = 0; i < tmpList.count(); i++) { + if (threadList.contains(tmpList.at(i)) == 0) + oldLogList.append(tmpList.at(i)); } } } /* read the cache dir & get the list of all threads. */ /* private */ /* static */ -void BoardManager::getCachedThreadList( const KURL& url, QPtrList< Thread >& threadList ) +void BoardManager::getCachedThreadList(const KUrl& url, QList<Thread*>& threadList) { - QString cacheDir = Cache::baseDir() + Cache::serverDir( url ) + Cache::boardDir( url ); - QDir d( cacheDir ); - if ( d.exists() ) { + Cache cache(url); + QString cacheDir = cache.getDirPath(); + QDir d(cacheDir); + if (d.exists()) { /* get all file names */ - QString ext = BoardManager::getBoardData( url ) ->ext(); - QString boardURL = BoardManager::getBoardData( url ) ->basePath(); - QStringList flist = d.entryList( "*" + ext ); + QString ext = BoardManager::getBoardData(url) ->ext(); + QString boardUrl = BoardManager::getBoardData(url) ->basePath(); + QStringList filter('*' + ext); + QStringList flist = d.entryList(filter); - for ( QStringList::iterator it = flist.begin(); it != flist.end(); ++it ) { - if ( ( *it ) == QString::null ) continue; + for (QStringList::iterator it = flist.begin(); it != flist.end(); ++it) { + if ((*it).isEmpty()) continue; - QString datURL = boardURL + "dat/" + ( *it ); + QString datUrl = boardUrl + "dat/" + (*it); /* read idx file */ - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread == NULL ) { + Thread* thread = Thread::getByUrlNew(datUrl); + if (thread == 0) { - thread = Kita::Thread::getByURL( datURL ); - if ( thread == NULL ) continue; - ThreadIndex::loadIndex( thread, datURL, FALSE ); + thread = Thread::getByUrl(datUrl); + if (thread == 0) + continue; + ThreadIndex threadIndex(datUrl); + threadIndex.loadIndex(thread, false); } - if ( thread != NULL ) threadList.append( thread ); + if (thread != 0) threadList.append(thread); } } } @@ -525,89 +527,94 @@ /* open subject.txt and get list of Thread classes */ /* private */ /* static */ -bool BoardManager::readSubjectTxt( BoardData* bdata, const KURL& url, QPtrList< Thread >& threadList ) +bool BoardManager::readSubjectTxt(BoardData* bdata, const KUrl& url, QList<Thread*>& threadList) { /* get all names of cached files to read idx. */ QStringList cacheList; - if ( !bdata->readIdx() ) { - - QString cacheDir = Cache::baseDir() + Cache::serverDir( url ) + Cache::boardDir( url ); - QDir d( cacheDir ); - if ( d.exists() ) { - QString ext = BoardManager::getBoardData( url ) ->ext(); - cacheList = d.entryList( "*" + ext ); + if (!bdata->readIdx()) { + Cache cache(url); + QString cacheDir = cache.getDirPath(); + QDir d(cacheDir); + if (d.exists()) { + QString ext = BoardManager::getBoardData(url) ->ext(); + QStringList filter('*' + ext); + cacheList = d.entryList(filter); } } /* open subject.txt */ - QString subjectPath = Cache::getSubjectPath( url ); - QIODevice * device = KFilterDev::deviceForFile( subjectPath, "application/x-gzip" ); - if ( !device->open( IO_ReadOnly ) ) return FALSE; + Cache cache(url); + QString subjectPath = cache.getSubjectPath(); + QIODevice * device = KFilterDev::deviceForFile(subjectPath, "application/x-gzip"); + if (!device->open(QIODevice::ReadOnly)) return false; - QTextStream stream( device ); + QTextStream stream(device); - if ( BoardManager::type( url ) == Board_JBBS ) { - if ( !m_eucJpCodec ) m_eucJpCodec = new QEucJpCodec(); - stream.setCodec( m_eucJpCodec ); + if (BoardManager::type(url) == Board_JBBS) { + if (!m_eucJpCodec) m_eucJpCodec = QTextCodec::codecForName("eucJP"); + stream.setCodec(m_eucJpCodec); } else { - if ( !m_cp932Codec ) m_cp932Codec = new QCp932Codec(); - stream.setCodec( m_cp932Codec ); + if (!m_cp932Codec) m_cp932Codec = QTextCodec::codecForName("Shift-JIS"); + stream.setCodec(m_cp932Codec); } QRegExp regexp; - switch ( BoardManager::type( url ) ) { + switch (BoardManager::type(url)) { case Board_MachiBBS: case Board_JBBS: - regexp.setPattern( "(\\d+\\.cgi),(.*)\\((\\d+)\\)" ); + regexp.setPattern("(\\d+\\.cgi),(.*)\\((\\d+)\\)"); break; default: - regexp.setPattern( "(\\d+\\.dat)<>(.*)\\((\\d+)\\)" ); + regexp.setPattern("(\\d+\\.dat)<>(.*)\\((\\d+)\\)"); break; } QString line; - while ( ( line = stream.readLine() ) != QString::null ) { - int pos = regexp.search( line ); - if ( pos != -1 ) { - QString fname = regexp.cap( 1 ); - QString subject = regexp.cap( 2 ); - QString num = regexp.cap( 3 ); + while (!(line = stream.readLine()).isEmpty()) { + int pos = regexp.indexIn(line); + if (pos != -1) { + QString fname = regexp.cap(1); + QString subject = regexp.cap(2); + QString num = regexp.cap(3); /* get pointer of Thread class */ - QString datURL = boardURL( url ) + "dat/" + fname; - Kita::Thread* thread = Kita::Thread::getByURL( datURL ); - if ( threadList.find( thread ) == -1 ) { - threadList.append( thread ); + QString datUrl = boardUrl(url) + "dat/" + fname; + Thread* thread = Thread::getByUrl(datUrl); + ThreadIndex threadIndex(datUrl); + if (threadList.indexOf(thread) == -1) { + threadList.append(thread); } /* set thread name */ - thread->setThreadName( subject ); + thread->setThreadName(subject); /* load index file */ - if ( !bdata->readIdx() ) { + if (!bdata->readIdx()) { - if ( cacheList.contains( fname ) ) ThreadIndex::loadIndex( thread, datURL, FALSE ); + if (cacheList.contains(fname)) { + threadIndex.loadIndex(thread, false); + } } /* update res num */ int newNum = num.toInt(); - if ( thread->readNum() ) { /* cache exists */ + if (thread->readNum()) { /* cache exists */ int oldNum = thread->resNum(); - if ( newNum > oldNum ) { - Kita::ThreadIndex::setResNum( datURL, newNum ); + if (newNum > oldNum) { + threadIndex.setResNum(newNum); } } - thread->setResNum( newNum ); + thread->setResNum(newNum); } } device->close(); - bdata->setReadIdx( TRUE ); /* never read idx files again */ + bdata->setReadIdx(true); /* never read idx files again */ - return TRUE; + return true; } /*---------------------------*/ @@ -616,12 +623,12 @@ /* reset all BoardData */ /* public */ /* static */ void BoardManager::clearBoardData() { - for ( BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it ) - delete( *it ); + for (BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it) + delete(*it); m_boardDataList.clear(); - m_previousBoardData = NULL; - m_previousBoardURL = QString::null; + m_previousBoardData = 0; + m_previousBoardUrl.clear(); } /** @@ -633,54 +640,54 @@ * * @param[out] oldURL * - * @retval Board_enrollEnrolled if board is already enrolled. oldURL is QString::null. - * @retval Board_enrollNew if board is new board. oldURL is QString::null. + * @retval Board_enrollEnrolled if board is already enrolled. oldURL is QString(). + * @retval Board_enrollNew if board is new board. oldURL is QString(). * @retval Board_enrollMoved if board is moved. oldURL is old URL. * * @note board is NOT enrolled when board is moved. * To enroll new URL, call BoardManager::moveBoard(). * - * "int type" is type of board. It could be "Kita::Board_Unknown". See also parseBoardURL(). + * "int type" is type of board. It could be "Board_Unknown". See also parseBoardURL(). * - * If "bool test" is TRUE, this function just checks if the board is enrolled (never enroll board). + * If "bool test" is true, this function just checks if the board is enrolled (never enroll board). * */ /* public */ /* static */ -int BoardManager::enrollBoard( const KURL& url, const QString& boardName, QString& oldURL, int type, bool test ) +int BoardManager::enrollBoard(const KUrl& url, const QString& boardName, QString& oldUrl, int type, bool test) { QString hostname; QString rootPath; QString delimiter; QString bbsPath; QString ext; - type = parseBoardURL( url, type, hostname, rootPath, delimiter, bbsPath, ext ); - oldURL = QString::null; + type = parseBoardUrl(url, type, hostname, rootPath, delimiter, bbsPath, ext); + oldUrl.clear(); - if ( type == Board_Unknown ) return Board_enrollFailed; + if (type == Board_Unknown) return Board_enrollFailed; /* check if the board is enrolled or moved. */ - for ( BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it ) { + for (BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it) { - if ( ( *it ) ->boardName() == boardName - && ( *it ) ->type() == type - && ( *it ) ->bbsPath() == bbsPath ) { + if ((*it) ->boardName() == boardName + && (*it) ->type() == type + && (*it) ->bbsPath() == bbsPath) { - if ( ( *it ) ->hostName() == hostname - && ( *it ) ->rootPath() == rootPath ) { /* enrolled */ + if ((*it) ->hostName() == hostname + && (*it) ->rootPath() == rootPath) { /* enrolled */ return Board_enrollEnrolled; } else { /* moved */ - oldURL = ( *it ) ->basePath(); + oldUrl = (*it) ->basePath(); return Board_enrollMoved; } } } /* test only */ - if ( test ) return Board_enrollNew; + if (test) return Board_enrollNew; /* enroll new board */ - BoardData* bdata = new BoardData( boardName, hostname, rootPath, delimiter, bbsPath, ext, type ); - m_boardDataList.append( bdata ); + BoardData* bdata = new BoardData(boardName, hostname, rootPath, delimiter, bbsPath, ext, type); + m_boardDataList.append(bdata); return Board_enrollNew; } @@ -688,10 +695,10 @@ /* parse board URL */ /* return board type. */ /* private */ /* static */ -int BoardManager::parseBoardURL( +int BoardManager::parseBoardUrl( /* input */ - const KURL& url, + const KUrl& url, int type, /* If type = Board_Unknown, type will be decided according to url. */ /* output */ @@ -699,36 +706,36 @@ QString& rootPath, QString& delimiter, QString& bbsPath, - QString& ext ) + QString& ext) { hostname = url.protocol() + "://" + url.host(); - rootPath = QString::null; - delimiter = QString::null; - bbsPath = QString::null; - ext = QString::null; + rootPath.clear(); + delimiter.clear(); + bbsPath.clear(); + ext.clear(); /* decide type */ - if ( type == Board_Unknown ) { + if (type == Board_Unknown) { - if ( url.host().contains( "machi.to" ) ) type = Board_MachiBBS; - else if ( url.host().contains( "jbbs.livedoor.jp" ) ) type = Board_JBBS; + if (url.host().contains("machi.to")) type = Board_MachiBBS; + else if (url.host().contains("jbbs.livedoor.jp")) type = Board_JBBS; else type = Board_2ch; } /* parse */ - switch ( type ) { + switch (type) { case Board_MachiBBS: /* MACHI : http:// *.machi.to/(bbsPath)/ */ delimiter = "/bbs/read.pl"; - bbsPath = url.filename(); + bbsPath = url.fileName(); ext = ".cgi"; break; case Board_JBBS: /* JBBS : http://jbbs.livedoor.jp/(bbsPath)/ */ delimiter = "/bbs/read.cgi"; - bbsPath = url.prettyURL().remove( hostname ); + bbsPath = url.prettyUrl().remove(hostname); type = Board_JBBS; ext = ".cgi"; break; @@ -736,68 +743,68 @@ case Board_FlashCGI: /* test for Flash CGI/Mini Thread */ delimiter = "/test/read.cgi"; - bbsPath = url.filename(); - rootPath = url.prettyURL().remove( hostname + "/" ).remove( bbsPath + "/" ); - if ( rootPath.length() == 0 ) rootPath = QString::null; + bbsPath = url.fileName(); + rootPath = url.prettyUrl().remove(hostname + '/').remove(bbsPath + '/'); + if (rootPath.length() == 0) rootPath.clear(); ext = ".dat"; break; default: /* 2ch : http://(hostname)/(rootPath)/(bbsPath)/ */ delimiter = "/test/read.cgi"; - bbsPath = url.filename(); - rootPath = url.prettyURL().remove( hostname + "/" ).remove( bbsPath + "/" ); - if ( rootPath.length() == 0 ) rootPath = QString::null; + bbsPath = url.fileName(); + rootPath = url.prettyUrl().remove(hostname + '/').remove(bbsPath + '/'); + if (rootPath.length() == 0) rootPath.clear(); ext = ".dat"; type = Board_2ch; break; } /* For example, if bbsPath = "linux/", then m_bbsPath = "/linux" */ - const QRegExp exp( "/$" ); - rootPath.remove( exp ); - bbsPath.remove( exp ); - if ( rootPath != QString::null && rootPath.at( 0 ) != '/' ) rootPath = "/" + rootPath; - if ( bbsPath != QString::null && bbsPath.at( 0 ) != '/' ) bbsPath = "/" + bbsPath; + const QRegExp exp("/$"); + rootPath.remove(exp); + bbsPath.remove(exp); + if (!rootPath.isEmpty() && rootPath.at(0) != '/') rootPath = '/' + rootPath; + if (!bbsPath.isEmpty() && bbsPath.at(0) != '/') bbsPath = '/' + bbsPath; return type; } /* public */ /* static */ -bool BoardManager::isEnrolled( const KURL& url ) +bool BoardManager::isEnrolled(const KUrl& url) { - if ( getBoardData( url ) == NULL ) return FALSE; - return TRUE; + if (getBoardData(url) == 0) return false; + return true; } /* public */ /* static */ -BoardData* BoardManager::getBoardData( const KURL& url ) +BoardData* BoardManager::getBoardData(const KUrl& url) { - if ( url.isEmpty() ) return NULL; - QString urlstr = url.prettyURL(); + if (url.isEmpty()) return 0; + QString urlstr = url.prettyUrl(); /* cache */ - if ( m_previousBoardData != NULL && m_previousBoardURL == urlstr ) return m_previousBoardData; + if (m_previousBoardData != 0 && m_previousBoardUrl == urlstr) return m_previousBoardData; - for ( BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it ) { + for (BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it) { - int count = ( *it ) ->keyBasePathList().count(); - for ( int i = 0; i < count ; ++i ) { - if ( urlstr.contains( ( *it ) ->keyBasePathList() [ i ] ) - || urlstr.contains( ( *it ) ->keyCgiBasePathList() [ i ] ) ) { + int count = (*it) ->keyBasePathList().count(); + for (int i = 0; i < count ; ++i) { + if (urlstr.contains((*it) ->keyBasePathList() [ i ]) + || urlstr.contains((*it) ->keyCgiBasePathList() [ i ])) { /* cache */ - m_previousBoardData = ( *it ); - m_previousBoardURL = urlstr; + m_previousBoardData = (*it); + m_previousBoardUrl = urlstr; - return ( *it ); + return (*it); } } } - return NULL; + return 0; } @@ -806,13 +813,13 @@ /* BBSHISTORY */ -/* load the bbs history file ( BBSHISTORY ), and create keys of Data Base. */ +/* load the bbs history file (BBSHISTORY), and create keys of Data Base. */ /* Before calling this, enroll the board by enrollBoard(). */ /* ex) If the host of board moved like : http:://aaa.com -> http://bbb.com -> http://ccc.com -> http://ddd.com - + then, BBSHISTORY is http://ccc.com @@ -820,58 +827,59 @@ http://aaa.com */ /* public */ /* static */ -bool BoardManager::loadBBSHistory( const KURL& url ) +bool BoardManager::loadBBSHistory(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == NULL ) return FALSE; + BoardData * bdata = getBoardData(url); + if (bdata == 0) return false; - QStringList keyHosts = bdata->hostName(); + QStringList keyHosts(bdata->hostName()); - QFile file( Cache::getBBSHistoryPath( url ) ); - if ( file.open( IO_ReadOnly ) ) { + Cache cache(url); + QFile file(cache.getBBSHistoryPath()); + if (file.open(QIODevice::ReadOnly)) { - QTextStream ts( &file ); + QTextStream ts(&file); QString line; - while ( !ts.eof() ) { + while (!ts.atEnd()) { line = ts.readLine(); keyHosts += line; } - bdata->createKeys( keyHosts ); + bdata->createKeys(keyHosts); file.close(); - return TRUE; + return true; } - return FALSE; + return false; } /* public */ /* static */ -bool BoardManager::moveBoard( const KURL& fromURL, const KURL& toURL ) +bool BoardManager::moveBoard(const KUrl& fromUrl, const KUrl& toUrl) { - QString oldhost = fromURL.protocol() + "://" + fromURL.host(); - QString newhost = toURL.protocol() + "://" + toURL.host(); + QString oldhost = fromUrl.protocol() + "://" + fromUrl.host(); + QString newhost = toUrl.protocol() + "://" + toUrl.host(); - const QRegExp exp( "/$" ); - QString oldURL = fromURL.prettyURL(); - QString newURL = toURL.prettyURL(); - oldURL.remove( exp ); - newURL.remove( exp ); - oldURL += "/"; - newURL += "/"; + const QRegExp exp("/$"); + QString oldUrl = fromUrl.prettyUrl(); + QString newUrl = toUrl.prettyUrl(); + oldUrl.remove(exp); + newUrl.remove(exp); + oldUrl += '/'; + newUrl += '/'; - if ( oldURL == newURL ) return FALSE; + if (oldUrl == newUrl) return false; /* Is oldURL enrolled? */ - BoardData* bdata = getBoardData( oldURL ); - if ( bdata == NULL ) { + BoardData* bdata = getBoardData(oldUrl); + if (bdata == 0) { /* Is newURL enrolled? */ - bdata = getBoardData( newURL ); - if ( bdata == NULL ) return FALSE; + bdata = getBoardData(newUrl); + if (bdata == 0) return false; } @@ -879,16 +887,16 @@ /* update BoardData */ /* get the path of old cache */ - bdata->setHostName( oldhost ); + bdata->setHostName(oldhost); QStringList keyHosts = bdata->keyHostList(); - keyHosts.remove( oldhost ); - keyHosts.prepend( oldhost ); - bdata->createKeys( keyHosts ); - QString oldCachePath = Cache::baseDir() + Cache::serverDir( bdata->basePath() ) - + Cache::boardDir( bdata->basePath() ); + keyHosts.removeOne(oldhost); + keyHosts.prepend(oldhost); + bdata->createKeys(keyHosts); + Cache cache(bdata->basePath()); + QString oldCachePath = cache.getDirPath(); /* update URL */ - bdata->setHostName( newhost ); + bdata->setHostName(newhost); /* update keys */ /* The order of keyHosts will be like this: @@ -900,50 +908,53 @@ */ keyHosts = bdata->keyHostList(); - keyHosts.remove( oldhost ); - keyHosts.prepend( oldhost ); - keyHosts.remove( newhost ); - keyHosts.prepend( newhost ); - bdata->createKeys( keyHosts ); + keyHosts.removeOne(oldhost); + keyHosts.prepend(oldhost); + keyHosts.removeOne(newhost); + keyHosts.prepend(newhost); + bdata->createKeys(keyHosts); /* reset BoardData */ - bdata->setReadIdx( FALSE ); - bdata->setSettingLoaded( FALSE ); + bdata->setReadIdx(false); + bdata->setSettingLoaded(false); /*---------------------------*/ /* move cache dir */ QDir qdir; - if ( ! qdir.exists( oldCachePath ) ) return TRUE; + if (! qdir.exists(oldCachePath)) return true; /* mkdir new server dir */ - QString newCachePath = Cache::baseDir() + Cache::serverDir( bdata->basePath() ); - Kita::mkdir( newCachePath ); + Cache newCache(bdata->basePath()); + QString newCachePath = Cache::baseDir() + newCache.serverDir(); + QDir::root().mkpath(newCachePath); /* backup old dir */ - newCachePath += Cache::boardDir( bdata->basePath() ); - if ( qdir.exists ( newCachePath ) ) { + newCachePath += newCache.boardDir(); + if (qdir.exists (newCachePath)) { QString bkupPath = newCachePath; - bkupPath.truncate( bkupPath.length() - 1 ); /* remove '/' */ - bkupPath += "." + QString().setNum( QDateTime::currentDateTime().toTime_t() ); - qdir.rename( newCachePath, bkupPath ); + bkupPath.truncate(bkupPath.length() - 1); /* remove '/' */ + bkupPath += + '.' + QString::number(QDateTime::currentDateTime().toTime_t()); + qdir.rename(newCachePath, bkupPath); } /* move cache dir */ - if ( qdir.exists( oldCachePath ) ) { - qdir.rename( oldCachePath, newCachePath ); - } else Kita::mkdir( newCachePath ); + if (qdir.exists(oldCachePath)) { + qdir.rename(oldCachePath, newCachePath); + } else + QDir::root().mkpath(newCachePath); /* make old dir */ - if ( ! qdir.exists( oldCachePath ) ) { - Kita::mkdir( oldCachePath ); + if (! qdir.exists(oldCachePath)) { + QDir::root().mkpath(oldCachePath); /* create BBS_MOVED */ QString movedPath = oldCachePath + "/BBS_MOVED"; - QFile file( movedPath ); - if ( file.open( IO_WriteOnly ) ) { - QTextStream stream( &file ); - stream << newURL << endl; + QFile file(movedPath); + if (file.open(QIODevice::WriteOnly)) { + QTextStream stream(&file); + stream << newUrl << endl; } file.close(); } @@ -951,14 +962,15 @@ /*---------------------------*/ /* update BBSHISTRY */ - QFile file( Cache::getBBSHistoryPath( bdata->basePath() ) ); - if ( file.open( IO_WriteOnly ) ) { + Cache historyCache(bdata->basePath()); + QFile file(historyCache.getBBSHistoryPath()); + if (file.open(QIODevice::WriteOnly)) { - QTextStream ts( &file ); + QTextStream ts(&file); - keyHosts.remove( newhost ); - for ( QStringList::iterator it = keyHosts.begin() ; it != keyHosts.end(); ++it ) { - ts << ( *it ) << endl; + keyHosts.removeOne(newhost); + for (QStringList::iterator it = keyHosts.begin() ; it != keyHosts.end(); ++it) { + ts << (*it) << endl; } file.close(); @@ -967,10 +979,10 @@ /*---------------------------*/ /* update other information */ - FavoriteThreads::replace( oldURL, newURL ); - Kita::Thread::replace( oldURL, newURL ); - KitaThreadInfo::replace( oldURL, newURL ); - Kita::FavoriteBoards::replace( oldURL, newURL ); + FavoriteThreads::replace(oldUrl, newUrl); + Thread::replace(oldUrl, newUrl); + ThreadInfo::replace(oldUrl, newUrl); + FavoriteBoards::replace(oldUrl, newUrl); - return TRUE; + return true; } Modified: kita/trunk/kita/src/libkita/boardmanager.h =================================================================== --- kita/trunk/kita/src/libkita/boardmanager.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/boardmanager.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,14 +7,15 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITABOARDMANAGER_H #define KITABOARDMANAGER_H -#include <kapplication.h> +#include <QtCore/QList> +#include <QtCore/QStringList> + #include <kurl.h> -class QCp932Codec; +class QSjisCodec; class QEucJpCodec; namespace Kita @@ -45,7 +46,7 @@ class BoardData { QString m_boardName; - bool m_readIdx; /* If TRUE, idx file has been read. */ + bool m_readIdx; /* If true, idx file has been read. */ QString m_hostname; /* latest host name */ QString m_rootPath; @@ -62,7 +63,7 @@ QString m_defaultName; int m_linenum; int m_msgCount; - KURL m_titleImgURL; + KUrl m_titleImgUrl; /* keys */ QStringList m_keyHostList; /* list of host names. They are keys of DB. */ @@ -70,42 +71,42 @@ QStringList m_keyCgiBasePathList; public: - BoardData( const QString& boardName, const QString& hostname, + BoardData(const QString& boardName, const QString& hostname, const QString& rootPath, const QString& delimiter, - const QString& bbsPath, const QString& ext, int boardtype ); + const QString& bbsPath, const QString& ext, int boardtype); ~BoardData(); - void setHostName( const QString& hostname ); + void setHostName(const QString& hostname); /* information */ - const bool readIdx() const; - void setReadIdx( bool idx ); + bool readIdx() const; + void setReadIdx(bool idx); const QString& boardName() const; const QString& hostName() const; const QString& rootPath() const; const QString& delimiter() const; const QString& bbsPath() const; const QString& ext() const; - const int type() const; + int type() const; const QString& basePath() const; const QString& cgiBasePath() const; /* SETTING.TXT */ - const QString settingURL() const; - const bool settingLoaded() const; + const QString settingUrl() const; + bool settingLoaded() const; const QString& defaultName() const; - const int lineNum() const; - const int msgCount() const; - const KURL& titleImgURL() const; - void setSettingLoaded( bool set ); - void setDefaultName( const QString& newName ); - void setLineNum( int newLine ); - void setMsgCount( int msgCount ); - void setTitleImgURL( const KURL& url ); + int lineNum() const; + int msgCount() const; + const KUrl& titleImgUrl() const; + void setSettingLoaded(bool set); + void setDefaultName(const QString& newName); + void setLineNum(int newLine); + void setMsgCount(int msgCount); + void setTitleImgUrl(const KUrl& url); /* keys */ - void createKeys( const QStringList& keyHostList ); + void createKeys(const QStringList& keyHostList); const QStringList& keyHostList() const; const QStringList& keyBasePathList() const; const QStringList& keyCgiBasePathList() const; @@ -114,63 +115,63 @@ /*--------------------------------------*/ - typedef QValueList< BoardData* > BoardDataList; + typedef QList<BoardData*> BoardDataList; /** @author Hideki Ikemoto */ - class BoardManager + class KDE_EXPORT BoardManager { static BoardDataList m_boardDataList; static BoardData* m_previousBoardData; /* used in getBoardData() */ - static QString m_previousBoardURL; /* used in getBoardData() */ - static QCp932Codec* m_cp932Codec; - static QEucJpCodec* m_eucJpCodec; + static QString m_previousBoardUrl; /* used in getBoardData() */ + static QTextCodec* m_cp932Codec; + static QTextCodec* m_eucJpCodec; public: BoardManager(); ~BoardManager(); - static const QString boardURL( const KURL& url ); - static const QStringList allBoardURLList(); - static const QString boardRoot( const KURL& url ); - static const QString boardPath( const KURL& url ); - static const QString ext( const KURL& url ); - static const QString boardID( const KURL& url ); - static const QString subjectURL( const KURL& url ); - static const QString boardName( const KURL& url ); - static const int type( const KURL& url ); + static const QString boardUrl(const KUrl& url); + static const QStringList allBoardUrlList(); + static const QString boardRoot(const KUrl& url); + static const QString boardPath(const KUrl& url); + static const QString ext(const KUrl& url); + static const QString boardId(const KUrl& url); + static const QString subjectUrl(const KUrl& url); + static const QString boardName(const KUrl& url); + static int type(const KUrl& url); /* ThreadList */ - static void getThreadList( const KURL& url, bool oldLogs, bool online, - QPtrList< Thread >& threadList, QPtrList< Thread >& oldLogList ); + static void getThreadList(const KUrl& url, bool oldLogs, bool online, + QList<Thread*>& threadList, QList<Thread*>& oldLogList); /* BoardData */ static void clearBoardData(); - static int enrollBoard( const KURL& url, const QString& boardName, QString& oldURL, - int type = Board_Unknown, bool test = FALSE ); - static bool isEnrolled( const KURL& url ); - static BoardData* getBoardData( const KURL& url ); + static int enrollBoard(const KUrl& url, const QString& boardName, QString& oldUrl, + int type = Board_Unknown, bool test = false); + static bool isEnrolled(const KUrl& url); + static BoardData* getBoardData(const KUrl& url); /* BBSHISTORY */ - static bool loadBBSHistory( const KURL& url ); - static bool moveBoard( const KURL& fromURL, const KURL& toURL ); + static bool loadBBSHistory(const KUrl& url); + static bool moveBoard(const KUrl& fromUrl, const KUrl& toUrl); private: /* BoardData */ - static int parseBoardURL( const KURL& url, int type, QString& hostname, + static int parseBoardUrl(const KUrl& url, int type, QString& hostname, QString& rootPath, QString& delimiter, - QString& bbsPath, QString& ext ); + QString& bbsPath, QString& ext); /* ThreadList */ - static void getCachedThreadList( const KURL& url, QPtrList< Thread >& threadList ); - static bool readSubjectTxt( BoardData* bdata, const KURL& url, QPtrList< Thread >& threadList ); + static void getCachedThreadList(const KUrl& url, QList<Thread*>& threadList); + static bool readSubjectTxt(BoardData* bdata, const KUrl& url, QList<Thread*>& threadList); /* SETTING.TXT */ - static BoardData* openSettingTxt( const KURL& url ); + static BoardData* openSettingTxt(const KUrl& url); }; } Modified: kita/trunk/kita/src/libkita/cache.cpp =================================================================== --- kita/trunk/kita/src/libkita/cache.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/cache.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -8,64 +8,67 @@ * (at your option) any later version. * ***************************************************************************/ #include "cache.h" -#include "boardmanager.h" -#include <kurl.h> #include <kglobal.h> #include <kstandarddirs.h> -#include <kprotocolmanager.h> +#include "boardmanager.h" + using namespace Kita; +Cache::Cache(const KUrl& url) : m_url(url) +{ +} + QString Cache::baseDir() { - QString dir = KGlobal::dirs() ->saveLocation( "cache", "kita" ); - if ( dir[ dir.length() - 1 ] != '/' ) - dir += "/"; + QString dir = KGlobal::dirs() ->saveLocation("cache", "kita"); + if (dir[ dir.length() - 1 ] != '/') + dir += '/'; return dir; } -QString Cache::serverDir( const KURL& url ) +QString Cache::serverDir() const { /* Is board enrolled ? */ - BoardData * bdata = BoardManager::getBoardData( url ); - if ( bdata == NULL ) return QString::null; + BoardData * bdata = BoardManager::getBoardData(m_url); + if (bdata == 0) return QString(); QString root = bdata->hostName() + bdata->rootPath(); - return root.remove( "http://" ).replace( "/", "_" ) + "/"; + return root.remove("http://").replace('/', '_') + '/'; } -QString Cache::boardDir( const KURL& url ) +QString Cache::boardDir() const { /* Is board enrolled ? */ - BoardData * bdata = BoardManager::getBoardData( url ); - if ( bdata == NULL ) return QString::null; + BoardData * bdata = BoardManager::getBoardData(m_url); + if (bdata == 0) return QString(); QString bbs = bdata->bbsPath(); - return bbs.mid( 1 ).replace( "/", "_" ) + "/"; + return bbs.mid(1).replace('/', '_') + '/'; } -QString Cache::getPath( const KURL& url ) +QString Cache::getPath() const { - QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path == QString::null ) return QString::null; + QString path = getDirPath(); + if (path.isEmpty()) return QString(); - // qDebug( "%s -> %s",url.prettyURL().ascii(),path.ascii()); + // qDebug("%s -> %s",url.prettyUrl().ascii(),path.ascii()); - return path + url.fileName(); + return path + m_url.fileName(); } -QString Cache::getIndexPath( const KURL& url ) +QString Cache::getIndexPath() const { - QString path = getPath( url ); - if ( path == QString::null ) { - return QString::null; + QString path = getPath(); + if (path.isEmpty()) { + return QString(); } else { return path + ".idx"; } @@ -77,28 +80,33 @@ /* public */ -QString Cache::getSettingPath( const KURL& url ) +QString Cache::getSettingPath() const { - QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path == QString::null ) return QString::null; + QString path = getDirPath(); + if (path.isEmpty()) return QString(); return path + "SETTING.TXT"; } /* public */ -QString Cache::getBBSHistoryPath( const KURL& url ) +QString Cache::getBBSHistoryPath() const { - QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path == QString::null ) return QString::null; + QString path = getDirPath(); + if (path.isEmpty()) return QString(); return path + "BBSHISTORY"; } /* public */ -QString Cache::getSubjectPath( const KURL& url ) +QString Cache::getSubjectPath() const { - QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path == QString::null ) return QString::null; + QString path = getDirPath(); + if (path.isEmpty()) return QString(); return path + "subject.txt"; } + +QString Cache::getDirPath() const +{ + return baseDir() + serverDir() + boardDir(); +} Modified: kita/trunk/kita/src/libkita/cache.h =================================================================== --- kita/trunk/kita/src/libkita/cache.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/cache.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,9 +10,9 @@ #ifndef KITACACHE_H #define KITACACHE_H -#include <qstring.h> +#include <QtCore/QString> -class KURL; +#include <kurl.h> namespace Kita { @@ -20,20 +20,26 @@ /** @author Hideki Ikemoto */ - class Cache + class KDE_EXPORT Cache { - public: - static QString baseDir(); - static QString serverDir( const KURL& url ); - static QString boardDir( const KURL& url ); + public: + Cache(const KUrl& url); - static QString getPath( const KURL& url ); - static QString getIndexPath( const KURL& url ); - static QString getSettingPath( const KURL& url ); - static QString getBBSHistoryPath( const KURL& url ); - static QString getSubjectPath( const KURL& url ); + QString serverDir() const; + QString boardDir() const; + + QString getPath() const; + QString getIndexPath() const; + QString getSettingPath() const; + QString getBBSHistoryPath() const; + QString getSubjectPath() const; + QString getDirPath() const; + + static QString baseDir(); + + private: + KUrl m_url; }; - } #endif Copied: kita/trunk/kita/src/libkita/colorconfig.kcfg (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/colorconfig.kcfg) =================================================================== --- kita/trunk/kita/src/libkita/colorconfig.kcfg (rev 0) +++ kita/trunk/kita/src/libkita/colorconfig.kcfg 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <kcfgfile name="kitarc" /> + <group name="Color"> + <entry name="Thread" type="Color"> + <label>Thread foreground color.</label> + <default>black</default> + </entry> + <entry name="ThreadBackground" type="Color"> + <label>Thread backgroupd color.</label> + <default>white</default> + </entry> + <entry name="Popup" type="Color"> + <label>Popup foreground color.</label> + <default>black</default> + </entry> + <entry name="PopupBackground" type="Color"> + <label>Popup background color.</label> + <default>yellow</default> + </entry> + </group> +</kcfg> Copied: kita/trunk/kita/src/libkita/colorconfig.kcfgc (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/colorconfig.kcfgc) =================================================================== --- kita/trunk/kita/src/libkita/colorconfig.kcfgc (rev 0) +++ kita/trunk/kita/src/libkita/colorconfig.kcfgc 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,6 @@ +File=colorconfig.kcfg +ClassName=ColorConfig +NameSpace=Kita +Singleton=true +Mutators=true +Visibility=KDE_EXPORT Deleted: kita/trunk/kita/src/libkita/config_xt.kcfg =================================================================== --- kita/trunk/kita/src/libkita/config_xt.kcfg 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/config_xt.kcfg 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<kcfg> - <kcfgfile name="kitarc" /> - <group name="Global"> - <entry name="Font" type="Font"> - <label>List font.</label> - </entry> - <entry name="ThreadFont" type="Font"> - <label>Thread font.</label> - </entry> - <entry name="PopupFont" type="Font"> - <label>Popup font.</label> - </entry> - <entry name="ShowMailAddress" type="Bool"> - <label>Whether show mail address or not.</label> - <default>false</default> - </entry> - <entry name="UsePart" type="Bool"> - <label>Whether use embedded part or not.</label> - </entry> - <entry name="UseImageViewer" type="Bool"> - <label>Whether use image viewer or not.</label> - </entry> - <entry name="UseImagePopup" type="Bool"> - <label>Whether use image popup or not.</label> - </entry> - <entry name="UseMosaic" type="Bool"> - <label>Whether use mosaic or not.</label> - </entry> - <entry name="UseKitaNavi" type="Bool"> - <label>Whether use kitanavi or not.</label> - </entry> - <entry name="ShowNum" type="Int"> - <label>Number of responses displayed once.</label> - <default>100</default> - </entry> - <entry name="UseStyleSheet" type="Bool"> - <label>Whether use custom stylesheet or not.</label> - <default>false</default> - </entry> - <entry name="MarkTime" type="Int"> - <label>Time marked as newly arrived thread. (0 == after last access.)</label> - <default>24</default> - </entry> - <entry name="AboneChain" type="Bool"> - <label>Whether abone responses recursively(secret config).</label> - <default>false</default> - </entry> - <entry name="CheckResponsed" type="Bool"> - <label>Whether check responsed responses or not(secret config).</label> - </entry> - <entry name="CopyOnClick" type="Bool"> - <label>Whether copy URL on click or not(secret config).</label> - <default>false</default> - </entry> - <entry name="ListSortOrder" type="Enum"> - <label>Choice order of board list.</label> - <choices> - <choice name="Mark" /> - <choice name="ID" /> - </choices> - <default>Mark</default> - </entry> - <entry name="PartMimeList" type="StringList"> - <label>MIME list to use kpart.</label> - <default>image/gif,image/jpeg,image/png,image/x-bmp</default> - </entry> - <entry name="BoardListUrl" type="String"> - <label>URL of board list</label> - <default>http://menu.2ch.net/bbsmenu.html</default> - </entry> - </group> - <group name="Color"> - <entry name="ThreadColor" type="Color"> - <label>Thread foreground color.</label> - <default>black</default> - </entry> - <entry name="ThreadBackground" type="Color"> - <label>Thread backgroupd color.</label> - <default>white</default> - </entry> - <entry name="PopupColor" type="Color"> - <label>Popup foreground color.</label> - <default>black</default> - </entry> - <entry name="PopupBackground" type="Color"> - <label>Popup background color.</label> - <default>yellow</default> - </entry> - </group> - <group name="Account"> - <entry name="BeMailAddress" type="String"> - <label>Mail address of be.2ch.net</label> - </entry> - <entry name="BeAuthCode" type="String"> - <label>Auth code of be.2ch.net</label> - </entry> - <entry name="UserID" type="String"> - <label>Maru user id</label> - </entry> - <entry name="AutoLogin" type="Bool"> - <label>Whether login automatically or not.</label> - <default>false</default> - </entry> - <entry name="Password" type="Password"> - <label>Maru password</label> - </entry> - </group> - <group name="Write"> - <entry name="DefaultName" type="String"> - <label>Default name.</label> - </entry> - <entry name="DefaultNameUseAlways" type="Bool"> - <label>Whether use default name or not.</label> - <default>false</default> - </entry> - <entry name="DefaultMail" type="String"> - <label>Default mail address.</label> - </entry> - <entry name="DefaultSage" type="Bool"> - <label>Whether use 'sage' as default or not.</label> - </entry> - </group> - <group name="Completion"> - <entry name="NameCompletionList" type="StringList"> - <label>Name Completion list.</label> - </entry> - </group> -</kcfg> Deleted: kita/trunk/kita/src/libkita/config_xt.kcfgc =================================================================== --- kita/trunk/kita/src/libkita/config_xt.kcfgc 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/config_xt.kcfgc 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,5 +0,0 @@ -File=config_xt.kcfg -ClassName=Config -NameSpace=Kita -Singleton=true -Mutators=true Modified: kita/trunk/kita/src/libkita/datinfo.cpp =================================================================== --- kita/trunk/kita/src/libkita/datinfo.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/datinfo.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -8,73 +8,73 @@ * (at your option) any later version. * ***************************************************************************/ -#include <qregexp.h> -#include <qstringlist.h> +#include "datinfo.h" + +#include <QtCore/QDir> +#include <QtCore/QRegExp> +#include <QtCore/QStringList> + #include <klocale.h> -#include "datinfo.h" -#include "datmanager.h" +#include "abone.h" #include "access.h" -#include "thread.h" -#include "kita-utf8.h" -#include "kita-utf16.h" -#include "kita_misc.h" #include "account.h" -#include "threadindex.h" #include "cache.h" -#include "config_xt.h" -#include "abone.h" +#include "datmanager.h" +#include "globalconfig.h" +#include "kita_misc.h" +#include "kita-utf8.h" +#include "parser.h" +#include "thread.h" using namespace Kita; -#define RESDAT_DEFAULTSIZE 10 -#define RESDAT_DELTA 1000 +static const int RESDAT_DEFAULTSIZE = 10; +static const int RESDAT_DELTA = 1000; /*------------------------------------------------------*/ /* DatInfo stores & handles all information about *.dat */ -DatInfo::DatInfo( const KURL& url ) : m_access ( 0 ), m_access2( 0 ) +DatInfo::DatInfo(const KUrl& url) : m_threadIndex(m_datUrl), + m_access (0), m_access2(0) { QString refstr; - m_datURL = Kita::getDatURL( url, refstr ); - + m_datUrl = getDatUrl(url, refstr); + m_threadIndex = ThreadIndex(m_datUrl); /* get the pointer of Thread class */ - m_thread = Kita::Thread::getByURLNew( m_datURL ); - if ( m_thread == NULL ) { + m_thread = Thread::getByUrlNew(m_datUrl); + if (m_thread == 0) { /* create Thread */ - m_thread = Kita::Thread::getByURL( m_datURL ); - if ( m_thread == NULL ) return ; + m_thread = Thread::getByUrl(m_datUrl); + if (m_thread == 0) return ; /* read idx file */ - ThreadIndex::loadIndex( m_thread, m_datURL ); + m_threadIndex.loadIndex(m_thread); } - m_thread = Thread::getByURL( m_datURL ); + m_thread = Thread::getByUrl(m_datUrl); /* japanese strings */ -#if KDE_IS_VERSION( 3, 3, 0 ) - m_spacestr = Kita::utf8ToUnicode( KITAUTF8_ZENSPACE ); -#else - m_spacestr = ". "; -#endif - m_framestr1 = Kita::utf8ToUnicode( KITAUTF8_FRAME1 ); /* | */ - m_framestr2 = Kita::utf8ToUnicode( KITAUTF8_FRAME2 ); /* |- */ - m_framestr3 = Kita::utf8ToUnicode( KITAUTF8_FRAME3 ); /* L */ + m_spacestr = QString::fromUtf8(KITAUTF8_ZENSPACE); + m_framestr1 = QString::fromUtf8(KITAUTF8_FRAME1); /* | */ + m_framestr2 = QString::fromUtf8(KITAUTF8_FRAME2); /* |- */ + m_framestr3 = QString::fromUtf8(KITAUTF8_FRAME3); /* L */ /* make directory */ - QString cacheDir = Cache::baseDir() + Cache::serverDir( m_datURL ) + Cache::boardDir( m_datURL ); - if ( !Kita::mkdir( cacheDir ) ) return ; + Cache cache(m_datUrl); + QString cacheDir = cache.getDirPath(); + if (!QDir::root().mkpath(cacheDir)) return ; initPrivate( - TRUE /* load cache */ - ); + true /* load cache */ + ); } DatInfo::~DatInfo() { - initPrivate( FALSE ); + initPrivate(false); } @@ -82,91 +82,93 @@ /* Usually, don't call this. */ /* public */ void DatInfo::init() { - return initPrivate( TRUE ); + return initPrivate(true); } -/* Init. If loadCache = TRUE, load data from cache. */ /* private */ -void DatInfo::initPrivate( bool loadCache ) +/* Init. If loadCache = true, load data from cache. */ /* private */ +void DatInfo::initPrivate(bool loadCache) { /* stop & delete dat loader */ deleteAccessJob(); /* init variables */ - m_broken = FALSE; - m_nowLoading = FALSE; - m_lastLine = QString::null; + m_broken = false; + m_nowLoading = false; + m_lastLine.clear(); /* clear ResDatVec */ m_resDatVec.clear(); - increaseResDatVec( RESDAT_DEFAULTSIZE ); + increaseResDatVec(RESDAT_DEFAULTSIZE); /* reset Abone */ resetAbonePrivate(); /* create dat loader */ - m_access = new Kita::Access( m_datURL ); + m_access = new Access(m_datUrl); - connect( m_access, SIGNAL( receiveData( const QStringList& ) ), - SLOT( slotReceiveData( const QStringList& ) ) ); - connect( m_access, SIGNAL( finishLoad() ), SLOT( slotFinishLoad() ) ); + connect(m_access, SIGNAL(receiveData(const QStringList&)), + SLOT(slotReceiveData(const QStringList&))); + connect(m_access, SIGNAL(finishLoad()), SLOT(slotFinishLoad())); - if ( !loadCache ) return ; + if (!loadCache) return ; /* reset ReadNum before loading cache. */ /* ReadNum & subject are updated by Access::getcache() */ - m_thread->setReadNum( 0 ); + m_thread->setReadNum(0); /* get dat from cahce */ /* slotReceiveData() is called from Access::getcache() */ m_access->getcache(); /* save up-to-date thread information */ - ThreadIndex::saveIndex( m_thread, m_datURL ); + m_threadIndex.saveIndex(m_thread); } /* private */ -void DatInfo::resetResDat( RESDAT& resdat ) +void DatInfo::resetResDat(RESDAT& resdat) const { resdat.num = 0; - resdat.parsed = FALSE; - resdat.broken = FALSE; + resdat.parsed = false; + resdat.broken = false; resdat.anclist.clear(); - resdat.checkAbone = FALSE; - resdat.abone = FALSE; - resdat.isResponsed = FALSE; + resdat.checkAbone = false; + resdat.abone = false; + resdat.isResponsed = false; } /* private */ -void DatInfo::increaseResDatVec( int delta ) +void DatInfo::increaseResDatVec(int delta) { int size = m_resDatVec.size(); RESDAT resdat; - resetResDat( resdat ); - m_resDatVec.resize( size + delta, resdat ); + resetResDat(resdat); + m_resDatVec.resize(size + delta); + for (int i = size; i < size + delta; i++) + m_resDatVec[i] = resdat; } /* delete dat loader */ /* private */ void DatInfo::deleteAccessJob() { - if ( m_access ) { + if (m_access) { m_access->killJob(); delete m_access; - m_access = NULL; + m_access = 0; } - if ( m_access2 ) { + if (m_access2) { m_access2->killJob(); delete m_access2; - m_access2 = NULL; + m_access2 = 0; } } /* public */ -const KURL& DatInfo::url() +const KUrl& DatInfo::url() const { - return m_datURL; + return m_datUrl; } @@ -176,45 +178,48 @@ /* Update cache */ -/* When Kita::Access received new data, +/* When Access received new data, slotReceiveData is called. */ -/* When Kita::Access fineshed loading, +/* When Access fineshed loading, slotFinishLoad is called, and DatInfo emits the finishLoad signal to the parent object */ /* public */ -bool DatInfo::updateCache( const QObject* parent ) +bool DatInfo::updateCache(const QObject* parent) { - if ( m_access == NULL ) return FALSE; - if ( m_nowLoading ) return FALSE; + if (m_access == 0) + return false; + if (m_nowLoading) + return false; - m_nowLoading = TRUE; + m_nowLoading = true; - connect( this, SIGNAL( receiveData() ), - parent, SLOT( slotReceiveData() ) ); + connect(this, SIGNAL(receiveData()), + parent, SLOT(slotReceiveData())); - connect( this, SIGNAL( finishLoad() ), - parent, SLOT( slotFinishLoad() ) ); + connect(this, SIGNAL(finishLoad()), + parent, SLOT(slotFinishLoad())); - m_access->getupdate( m_thread->readNum() ); + m_access->getupdate(m_thread->readNum()); - return TRUE; + return true; } -/* slot called when Kita::Access +/* slot called when Access received new data */ /* private slot */ -void DatInfo::slotReceiveData( const QStringList& lineList ) +void DatInfo::slotReceiveData(const QStringList& lineList) { int rescode = m_access->responseCode(); - if ( m_access2 ) { + if (m_access2) { rescode = m_access2->responseCode(); } - if ( rescode != 200 && rescode != 206 ) return ; + if (rescode != 200 && rescode != 206) return ; /* copy lines to buffer */ int count = lineList.count(); - for ( int i = 0; i < count ; ++i ) copyOneLineToResDat( lineList[ i ] ); + for (int i = 0; i < count ; ++i) + copyOneLineToResDat(lineList[ i ]); emit receiveData(); } @@ -222,113 +227,113 @@ /* copy one line to resdat. See also DatInfo::slotReceiveData() */ /* private */ -bool DatInfo::copyOneLineToResDat( const QString& line ) +bool DatInfo::copyOneLineToResDat(const QString& line) { - if ( line == QString::null ) return FALSE; + if (line.isEmpty()) return false; /* update ReadNum */ const int num = m_thread->readNum() + 1; - m_thread->setReadNum( num ); + m_thread->setReadNum(num); /* If resdat vector is short, then resize the vector. */ - while ( ( int ) m_resDatVec.size() <= num ) increaseResDatVec( RESDAT_DELTA ); + while ((int) m_resDatVec.size() <= num) + increaseResDatVec(RESDAT_DELTA); /* reset ResDat */ RESDAT& resdat = m_resDatVec[ num ]; - resetResDat( resdat ); + resetResDat(resdat); resdat.num = num; resdat.linestr = line; /* get subject */ - if ( num == 1 ) parseDat( num ); + if (num == 1) parseDat(num); /* search all responses which are responsed by this line. */ - if ( Kita::Config::checkResponsed() ) { + if (GlobalConfig::checkResponsed()) { - if ( parseDat( num ) && !checkAbonePrivate( num ) ) { /* parse line here to get AncList */ + if (parseDat(num) && !checkAbonePrivate(num)) { /* parse line here to get AncList */ const int maxRange = 10; AncList& anclist = m_resDatVec[ num ].anclist; - for ( AncList::iterator it = anclist.begin(); it != anclist.end(); ++it ) { + for (AncList::iterator it = anclist.begin(); it != anclist.end(); ++it) { - int fromNum = ( *it ).from; - int toNum = QMIN( num - 1, ( *it ).to ); - if ( toNum - fromNum + 1 > maxRange ) continue; + int fromNum = (*it).from; + int toNum = qMin(num - 1, (*it).to); + if (toNum - fromNum + 1 > maxRange) continue; - for ( int i = fromNum; i <= toNum; ++i ) { + for (int i = fromNum; i <= toNum; ++i) { - if ( !checkAbonePrivate( i ) ) m_resDatVec[ i ].isResponsed = TRUE; + if (!checkAbonePrivate(i)) m_resDatVec[ i ].isResponsed = true; } } } } - return TRUE; + return true; } -/* slot called when Kita::Access +/* slot called when Access finished loading new dat */ /* private slot */ void DatInfo::slotFinishLoad() { /* save thread information */ - ThreadIndex::saveIndex( m_thread, m_datURL ); + m_threadIndex.saveIndex(m_thread); /* re-try by offlaw.cgi */ - if ( m_thread->readNum() == 0 && m_access2 == NULL && DatManager::is2chThread( m_datURL ) ) { - if ( Account::isLogged() ) { - initPrivate( TRUE ); - m_access2 = new OfflawAccess( m_datURL ); - connect( m_access2, SIGNAL( receiveData( const QStringList& ) ), - SLOT( slotReceiveData( const QStringList& ) ) ); - connect( m_access2, SIGNAL( finishLoad() ), SLOT( slotFinishLoad() ) ); + DatManager datManager(m_datUrl); + if (m_thread->readNum() == 0 && m_access2 == 0 + && datManager.is2chThread()) { + if (Account::isLogged()) { + initPrivate(true); + m_access2 = new OfflawAccess(m_datUrl); + connect(m_access2, SIGNAL(receiveData(const QStringList&)), + SLOT(slotReceiveData(const QStringList&))); + connect(m_access2, SIGNAL(finishLoad()), SLOT(slotFinishLoad())); m_access2->get(); return ; } } /* finish loading session & emit signal to the parent object */ - m_nowLoading = FALSE; + m_nowLoading = false; emit finishLoad(); /* disconnect signals */ - disconnect( SIGNAL( receiveData() ) ); - disconnect( SIGNAL( finishLoad() ) ); + disconnect(SIGNAL(receiveData())); + disconnect(SIGNAL(finishLoad())); } /* public */ -int DatInfo::getResponseCode() +int DatInfo::getResponseCode() const { - if ( m_access == NULL ) return 0; - - return m_access->responseCode(); + return (m_access == 0) ? 0 : m_access->responseCode(); } /* public */ -int DatInfo::getServerTime() +int DatInfo::getServerTime() const { - if ( m_access == NULL ) return 0; - - return m_access->serverTime(); + return (m_access == 0) ? 0 : m_access->serverTime(); } /* public */ bool DatInfo::deleteCache() { - if ( m_nowLoading ) return FALSE; + if (m_nowLoading) + return false; - initPrivate( FALSE ); + initPrivate(false); - return TRUE; + return true; } /* public */ -bool DatInfo::isLoadingNow() +bool DatInfo::isLoadingNow() const { return m_nowLoading; } @@ -336,15 +341,17 @@ /* public */ -void DatInfo::stopLoading() +void DatInfo::stopLoading() const { /* Don't lock the mutex here !!! It will cause deadlock , because - Kita::Access::stopJob() calls KitaHTMLPart::slotFinishLoad() back, - then KitaHTMLPart::slotFinishLoad() calls another functions in DatInfo. */ - if ( m_access == NULL ) return ; - if ( ! m_nowLoading ) return ; + Access::stopJob() calls HTMLPart::slotFinishLoad() back, + then HTMLPart::slotFinishLoad() calls another functions in DatInfo. */ + if (m_access == 0) + return; + if (!m_nowLoading) + return; m_access->stopJob(); } @@ -354,51 +361,45 @@ /* They are public */ -const QString& DatInfo::getDat( int num ) +QString DatInfo::getDat(int num) { - if ( !parseDat( num ) ) return QString::null; - - return m_resDatVec[ num ].linestr; + return (!parseDat(num)) ? QString() : m_resDatVec[ num ].linestr; } -const QString& DatInfo::getId( int num ) +QString DatInfo::getId(int num) { - if ( !parseDat( num ) ) return QString::null; - - return m_resDatVec[ num ].id; + return (!parseDat(num)) ? QString() : m_resDatVec[ num ].id; } /* plain strings of name */ -QString DatInfo::getPlainName( int num ) +QString DatInfo::getPlainName(int num) { - if ( !parseDat( num ) ) return QString::null; - - return m_resDatVec[ num ].name; + return (!parseDat(num)) ? QString() : m_resDatVec[ num ].name; } /* plain strings of title */ -QString DatInfo::getPlainTitle( int num ) +QString DatInfo::getPlainTitle(int num) { - if ( !parseDat( num ) ) return QString::null; + if (!parseDat(num)) return QString(); - QString titleHTML; - Kita::createTitleHTML( m_resDatVec[ num ], titleHTML ); + QString titleHtml; + createTitleHtml(m_resDatVec[ num ], titleHtml); QString retStr; - Kita::DatToText( titleHTML, retStr ); + Parser::datToText(titleHtml, retStr); return retStr; } /* plain strings of body */ -QString DatInfo::getPlainBody( int num ) +QString DatInfo::getPlainBody(int num) { - if ( !parseDat( num ) ) return QString::null; + if (!parseDat(num)) return QString(); QString retStr; - Kita::DatToText( m_resDatVec[ num ].bodyHTML, retStr ); + Parser::datToText(m_resDatVec[ num ].bodyHTML, retStr); return retStr; } @@ -412,9 +413,10 @@ return values are defined in datinfo.h. */ /* public */ -int DatInfo::getHTML( int num, bool checkAbone, QString& titleHTML, QString& bodyHTML ) +int DatInfo::getHTML(int num, bool checkAbone, QString& titleHTML, + QString& bodyHTML) { - return getHTMLPrivate( num, checkAbone, titleHTML, bodyHTML ); + return getHTMLPrivate(num, checkAbone, titleHTML, bodyHTML); } /** @@ -424,49 +426,50 @@ * @param[out] titleHTML * @param[out] bodyHTML * - * @retval KITA_HTML_NOTPARSED The dat is not parsed. - * @retval KITA_HTML_ABONE The res dat is marked as abone. - * @retval KITA_HTML_BROKEN The res dat is marked as broken. - * @retval KITA_HTML_NORMAL The res dat is normal. + * @retval HTML_NOTPARSED The dat is not parsed. + * @retval HTML_ABONE The res dat is marked as abone. + * @retval HTML_BROKEN The res dat is marked as broken. + * @retval HTML_NORMAL The res dat is normal. * */ -int DatInfo::getHTMLPrivate( int num, bool checkAbone, QString& titleHTML, QString& bodyHTML ) +int DatInfo::getHTMLPrivate(int num, bool checkAbone, QString& titleHtml, + QString& bodyHtml) { - if ( !parseDat( num ) ) return KITA_HTML_NOTPARSED; + if (!parseDat(num)) return HTML_NOTPARSED; - bool abone = checkAbone & checkAbonePrivate( num ); + bool abone = checkAbone & checkAbonePrivate(num); RESDAT& resdat = m_resDatVec[ num ]; - if ( abone ) { - titleHTML = QString().setNum( num ) + " " + i18n( "Abone" ); - bodyHTML = "<a href=\"#abone" + QString().setNum( num ) + "\">"; - bodyHTML += i18n( "Abone" ) + "</a>"; + if (abone) { + titleHtml = QString::number(num) + ' ' + i18n("Abone"); + bodyHtml = "<a href=\"#abone" + QString::number(num) + "\">"; + bodyHtml += i18n("Abone") + "</a>"; - return KITA_HTML_ABONE; - } else if ( resdat.broken ) { - titleHTML = QString().setNum( num ) + " " + i18n( "Broken" ); - bodyHTML = i18n( "Broken" ); + return HTML_ABONE; + } else if (resdat.broken) { + titleHtml = QString::number(num) + ' ' + i18n("Broken"); + bodyHtml = i18n("Broken"); - return KITA_HTML_BROKEN; + return HTML_BROKEN; } else { - createTitleHTML( resdat, titleHTML ); - bodyHTML = resdat.bodyHTML; + createTitleHtml(resdat, titleHtml); + bodyHtml = resdat.bodyHTML; - return KITA_HTML_NORMAL; + return HTML_NORMAL; } } /* get HTML strings from startnum to endnum. return value is HTML strings */ /* public */ -QString DatInfo::getHTMLString( int startnum, int endnum, bool checkAbone ) +QString DatInfo::getHTMLString(int startnum, int endnum, bool checkAbone) { - QString retHTML = QString::null; + QString retHTML; - for ( int num = startnum; num <= endnum; num++ ) { + for (int num = startnum; num <= endnum; num++) { QString html; - getHTMLofOneRes( num, checkAbone, html ); + getHtmlOfOneRes(num, checkAbone, html); retHTML += html; } @@ -475,20 +478,20 @@ /* return HTML strings that have ID = strid. */ /* public */ -QString DatInfo::getHtmlByID( const QString& strid, int &count ) +QString DatInfo::getHtmlById(const QString& strid, int &count) { - QString retHTML = QString::null; + QString retHTML; count = 0; - for ( int i = 1; i <= m_thread->readNum(); i++ ) { + for (int i = 1; i <= m_thread->readNum(); i++) { - if ( !parseDat( i ) ) continue; + if (!parseDat(i)) continue; - if ( m_resDatVec[ i ].id == strid ) { + if (m_resDatVec[ i ].id == strid) { count ++; QString html; - getHTMLofOneRes( i, TRUE, html ); + getHtmlOfOneRes(i, true, html); retHTML += html; } } @@ -506,13 +509,16 @@ * @param[out] html * */ -void DatInfo::getHTMLofOneRes( int num, bool checkAbone, QString& html ) +void DatInfo::getHtmlOfOneRes(int num, bool checkAbone, QString& html) { - html = QString::null; + html.clear(); QString titleHTML, bodyHTML; - if ( getHTMLPrivate( num, checkAbone, titleHTML, bodyHTML ) == KITA_HTML_NOTPARSED ) return ; + if (getHTMLPrivate(num, checkAbone, titleHTML, bodyHTML) == HTML_NOTPARSED) + return; - if ( m_resDatVec[ num ].isResponsed ) titleHTML.replace( "<a href=\"#write", "<a class=\"coloredLink\" href=\"#write" ); + if (m_resDatVec[ num ].isResponsed) + titleHTML.replace( + "<a href=\"#write", "<a class=\"coloredLink\" href=\"#write"); html += "<div class=\"pop_res_title\">" + titleHTML + "</div>"; html += "<div class=\"pop_res_body\">" + bodyHTML + "</div>"; } @@ -530,9 +536,9 @@ |-->>20, and return count = 3. */ /* Note that this function checks Abone internally. */ /* public */ -QString DatInfo::getTreeByRes( const int rootnum, int& count ) +QString DatInfo::getTreeByRes(int rootnum, int& count) { - return getTreeByResPrivate( rootnum, FALSE, count ); + return getTreeByResPrivate(rootnum, false, count); } /*---------------------------------------*/ @@ -546,79 +552,77 @@ |-->>6, and returns count = 3. */ /* Note that this function checks Abone internally. */ /* public */ -QString DatInfo::getTreeByResReverse( const int rootnum, int& count ) +QString DatInfo::getTreeByResReverse(int rootnum, int& count) { - return getTreeByResPrivate( rootnum, TRUE, count ); + return getTreeByResPrivate(rootnum, true, count); } /* private */ -QString DatInfo::getTreeByResPrivate( - const int rootnum, - bool reverse, /* reverse search */ - int& count ) +QString DatInfo::getTreeByResPrivate(int rootnum, + bool reverse /* reverse search */, int& count) { - QString tmp = QString().setNum( rootnum ); + QString tmp = QString::number(rootnum); QString retstr = "<a href=\"#" + tmp + "\">>>" + tmp + "</a><br>"; - retstr += getTreeByResCore( rootnum, reverse, count, "" ); + retstr += getTreeByResCore(rootnum, reverse, count, ""); return retstr; } /* private */ -QString DatInfo::getTreeByResCore( - const int rootnum, - bool reverse, /* reverse search */ - int& count, QString prestr ) +QString DatInfo::getTreeByResCore(int rootnum, + bool reverse /* reverse search */, int& count, const QString& prestr) { - if ( !parseDat( rootnum ) ) return QString::null; - if ( checkAbonePrivate( rootnum ) ) return QString::null; + if (!parseDat(rootnum)) + return QString(); + if (checkAbonePrivate(rootnum)) + return QString(); - QString retstr = QString::null ; + QString retstr; count = 0; QStringList strlists; - if ( !reverse ) { + if (!reverse) { /* collect responses that have anchor to rootnum */ - for ( int i = rootnum + 1; i <= m_thread->readNum(); i++ ) { - if ( checkAbonePrivate( i ) ) continue; - if ( checkRes( i, rootnum ) ) { + for (int i = rootnum + 1; i <= m_thread->readNum(); i++) { + if (checkAbonePrivate(i)) continue; + if (checkRes(i, rootnum)) { count ++; - strlists += QString().setNum( i ); + strlists += QString::number(i); } } } else { /* collect responses for which rootnum has anchors */ AncList& anclist = m_resDatVec[ rootnum ].anclist; - for ( AncList::iterator it = anclist.begin(); it != anclist.end(); ++it ) { - for ( int i = ( *it ).from; i <= QMIN( rootnum - 1, ( *it ).to ) ; i++ ) { - if ( checkAbonePrivate( i ) ) continue; + for (AncList::iterator it = anclist.begin(); it != anclist.end(); ++it) { + for (int i = (*it).from; i <= qMin(rootnum - 1, (*it).to) ; i++) { + if (checkAbonePrivate(i)) continue; count ++; - strlists += QString().setNum( i ); + strlists += QString::number(i); } } } /* make HTML document */ - if ( count ) { + if (count) { - for ( QStringList::iterator it = strlists.begin(); it != strlists.end(); ++it ) { + for (QStringList::iterator it = strlists.begin(); it != strlists.end(); ++it) { QString tmpstr; - if ( ( *it ) == strlists.last() ) tmpstr = m_framestr3; /* 'L' */ + if ((*it) == strlists.last()) tmpstr = m_framestr3; /* 'L' */ else tmpstr = m_framestr2; /* '|-' */ - retstr += prestr + tmpstr + "<a href=\"#" + ( *it ) + "\">>>" + ( *it ) + "</a><br>"; + retstr += prestr + tmpstr + "<a href=\"#" + (*it) + "\">>>" + (*it) + "</a><br>"; /* call myself recursively */ int tmpnum; tmpstr = prestr; - if ( ( *it ) == strlists.last() ) tmpstr += m_spacestr + m_spacestr + m_spacestr; /* " " */ + if ((*it) == strlists.last()) tmpstr += m_spacestr + m_spacestr + m_spacestr; /* " " */ else tmpstr += m_framestr1 + m_spacestr; /* "| " */ - retstr += getTreeByResCore( ( *it ).toInt(), reverse, tmpnum, tmpstr ); + retstr += getTreeByResCore((*it).toInt(), reverse, tmpnum, tmpstr); count += tmpnum; } } @@ -632,20 +636,23 @@ /* Check if No.num has anchors to No.target */ /* For exsample, if target = 4, and No.num have an anchor >>4, or >>2-6, etc., - then return TRUE. */ /* private */ -bool DatInfo::checkRes( const int num, const int target ) + then return true. */ /* private */ +bool DatInfo::checkRes(int num, int target) { const int range = 20; - if ( !parseDat( num ) ) return FALSE; + if (!parseDat(num)) + return false; AncList& anclist = m_resDatVec[ num ].anclist; - for ( AncList::iterator it = anclist.begin(); it != anclist.end(); ++it ) { - if ( ( *it ).to - ( *it ).from > range ) continue; - if ( target >= ( *it ).from && target <= ( *it ).to ) return TRUE; + for (AncList::iterator it = anclist.begin(); it != anclist.end(); ++it) { + if ((*it).to - (*it).from > range) + continue; + if (target >= (*it).from && target <= (*it).to) + return true; } - return FALSE; + return false; } @@ -653,19 +660,19 @@ /*-----------------------*/ /* several information */ -int DatInfo::getResNum() +int DatInfo::getResNum() const { return m_thread->resNum(); } /* public */ -int DatInfo::getReadNum() +int DatInfo::getReadNum() const { return m_thread->readNum(); } /* public */ -int DatInfo::getViewPos() +int DatInfo::getViewPos() const { return m_thread->viewPos(); } @@ -673,16 +680,19 @@ /* return number of responses that have ID = strid. */ /* Note that this function checks Abone internally. */ /* public */ -int DatInfo::getNumByID( const QString& strid ) +int DatInfo::getNumById(const QString& strid) { int count = 0; - for ( int i = 1; i <= m_thread->readNum(); i++ ) { + for (int i = 1; i <= m_thread->readNum(); i++) { - if ( !parseDat( i ) ) continue; - if ( checkAbonePrivate( i ) ) continue; + if (!parseDat(i)) + continue; + if (checkAbonePrivate(i)) + continue; - if ( m_resDatVec[ i ].id == strid ) count++; + if (m_resDatVec[ i ].id == strid) + count++; } return count; @@ -690,90 +700,89 @@ /* public */ -int DatInfo::getDatSize() +int DatInfo::getDatSize() const { - if ( m_access == NULL ) return 0; - - return m_access->dataSize(); + return (m_access == 0) ? 0 : m_access->dataSize(); } /* public */ -const bool DatInfo::isResponsed( int num ) const +bool DatInfo::isResponsed(int num) const { return m_resDatVec[ num ].isResponsed; } /* public */ -bool DatInfo::isResValid( int num ) +bool DatInfo::isResValid(int num) { - return parseDat( num ); + return parseDat(num); } /* public */ -bool DatInfo::isBroken() +bool DatInfo::isBroken() const { - if ( m_broken ) return m_broken; + if (m_broken) + return m_broken; - if ( m_access == NULL ) return FALSE; + if (m_access == 0) + return false; int rescode = m_access->responseCode(); bool invalid = m_access->invalidDataReceived(); /* see also Access::slotReceiveThreadData() */ - if ( invalid && ( rescode == 200 || rescode == 206 ) ) return TRUE; + if (invalid && (rescode == 200 || rescode == 206)) return true; /* maybe "Dat Ochi" */ - return FALSE; + return false; } /* public */ -bool DatInfo::isResBroken( int num ) +bool DatInfo::isResBroken(int num) { - if ( !parseDat( num ) ) return FALSE; - - return m_resDatVec[ num ].broken; + return (!parseDat(num)) ? false : m_resDatVec[ num ].broken; } /* ID = strid ? */ /* public */ -bool DatInfo::checkID( const QString& strid, int num ) +bool DatInfo::checkId(const QString& strid, int num) { - if ( !parseDat( num ) ) return FALSE; + if (!parseDat(num)) + return false; - if ( m_resDatVec[ num ].id == strid ) return TRUE; + if (m_resDatVec[ num ].id == strid) + return true; - return FALSE; + return false; } /* Are keywords included ? */ /* public */ -bool DatInfo::checkWord( QStringList& stlist, /* list of keywords */ - int num, - bool checkOR /* AND or OR search */ - ) +bool DatInfo::checkWord(const QStringList& stlist, /* list of keywords */ + int num, bool checkOr /* AND or OR search */) { - if ( !parseDat( num ) ) return FALSE; + if (!parseDat(num)) + return false; QString str_text = m_resDatVec[ num ].bodyHTML; - for ( QStringList::iterator it = stlist.begin(); it != stlist.end(); ++it ) { + for (QStringList::const_iterator it = stlist.begin(); it != stlist.end(); ++it) { - QRegExp regexp( ( *it ) ); - regexp.setCaseSensitive( FALSE ); + QRegExp regexp((*it)); + regexp.setCaseSensitivity(Qt::CaseInsensitive); - if ( checkOR ) { /* OR */ - if ( str_text.find( regexp, 0 ) != -1 ) { - return TRUE; + if (checkOr) { /* OR */ + if (str_text.indexOf(regexp, 0) != -1) { + return true; } } else { /* AND */ - if ( str_text.find( regexp, 0 ) == -1 ) return FALSE; + if (str_text.indexOf(regexp, 0) == -1) return false; } } - if ( checkOR ) return FALSE; + if (checkOr) return false; - return TRUE; + return true; } @@ -796,113 +805,210 @@ /* private */ void DatInfo::resetAbonePrivate() { - for ( int i = 1; i < ( int ) m_resDatVec.size(); i++ ) m_resDatVec[ i ].checkAbone = FALSE; + for (int i = 1; i < (int) m_resDatVec.size(); i++) + m_resDatVec[ i ].checkAbone = false; - m_aboneByID = ( ! Kita::AboneConfig::aboneIDList().empty() ); - m_aboneByName = ( ! Kita::AboneConfig::aboneNameList().empty() ); - m_aboneByBody = ( ! Kita::AboneConfig::aboneWordList().empty() ); - m_aboneChain = ( m_aboneByID | m_aboneByName | m_aboneByBody ) & Kita::Config::aboneChain() ; + m_aboneByID = (!AboneConfig::aboneIDList().isEmpty()); + m_aboneByName = (!AboneConfig::aboneNameList().isEmpty()); + m_aboneByBody = (!AboneConfig::aboneWordList().isEmpty()); + m_aboneChain = (m_aboneByID | m_aboneByName | m_aboneByBody) + & GlobalConfig::aboneChain() ; } /*--------------*/ /* check abone */ /* public */ -bool DatInfo::checkAbone( int num ) +bool DatInfo::checkAbone(int num) { - return checkAbonePrivate( num ); + return checkAbonePrivate(num); } /* private */ -bool DatInfo::checkAbonePrivate( int num ) +bool DatInfo::checkAbonePrivate(int num) { - if ( !parseDat( num ) ) return FALSE; + if (!parseDat(num)) + return false; - if ( m_resDatVec[ num ].checkAbone ) return m_resDatVec[ num ].abone; + if (m_resDatVec[num].checkAbone) + return m_resDatVec[num].abone; - m_resDatVec[ num ].checkAbone = TRUE; - bool checktmp = FALSE; + m_resDatVec[num].checkAbone = true; + bool checktmp = false; - if ( m_aboneByID ) - checktmp = checkAboneCore( m_resDatVec[ num ].id, Kita::AboneConfig::aboneIDList() ); + if (m_aboneByID) + checktmp = checkAboneCore(m_resDatVec[num].id, + AboneConfig::aboneIDList()); - if ( !checktmp && m_aboneByName ) - checktmp = checkAboneCore( m_resDatVec[ num ].name, Kita::AboneConfig::aboneNameList() ); + if (!checktmp && m_aboneByName) + checktmp = checkAboneCore(m_resDatVec[num].name, + AboneConfig::aboneNameList()); - if ( !checktmp && m_aboneByBody ) - checktmp = checkAboneCore( m_resDatVec[ num ].bodyHTML, Kita::AboneConfig::aboneWordList() ); + if (!checktmp && m_aboneByBody) + checktmp = checkAboneCore(m_resDatVec[num].bodyHTML, + AboneConfig::aboneWordList()); - if ( !checktmp && m_aboneChain ) { - AncList & anclist = m_resDatVec[ num ].anclist; + if (!checktmp && m_aboneChain) { + AncList & anclist = m_resDatVec[num].anclist; - for ( AncList::iterator it = anclist.begin(); - it != anclist.end() && !checktmp ; ++it ) { + for (AncList::iterator it = anclist.begin(); + it != anclist.end() && !checktmp ; ++it) { - int refNum = ( *it ).from; - int refNum2 = ( *it ).to; + int refNum = (*it).from; + int refNum2 = (*it).to; /* I don't want to enter loop... */ - if ( refNum >= num ) continue; - if ( refNum2 >= num ) refNum2 = num - 1; + if (refNum >= num) continue; + if (refNum2 >= num) refNum2 = num - 1; - for ( int i = refNum; i <= refNum2; i++ ) { - if ( checkAbonePrivate( i ) ) { - checktmp = TRUE; + for (int i = refNum; i <= refNum2; i++) { + if (checkAbonePrivate(i)) { + checktmp = true; break; } } } } - m_resDatVec[ num ].abone = checktmp; + m_resDatVec[num].abone = checktmp; - return m_resDatVec[ num ].abone; + return m_resDatVec[num].abone; } /* private */ -bool DatInfo::checkAboneCore( const QString& str, QStringList strlist ) +bool DatInfo::checkAboneCore(const QString& str, const QStringList& strlist) +const { - if ( strlist.count() ) { + if (strlist.count()) { int i; - for ( QStringList::iterator it = strlist.begin(); - it != strlist.end(); ++it ) { - i = str.find( ( *it ) ); - if ( i != -1 ) { - return TRUE; + for (QStringList::const_iterator it = strlist.begin(); + it != strlist.end(); ++it) { + i = str.indexOf((*it)); + if (i != -1) { + return true; } } } - return FALSE; + return false; } /* parsing function for ResDat */ -/* This function parses the raw data by Kita::parseResDat() */ /* private */ -bool DatInfo::parseDat( int num ) +/* This function parses the raw data by parseResDat() */ /* private */ +bool DatInfo::parseDat(int num) { - if ( num <= 0 || m_thread->readNum() < num ) return FALSE; - if ( m_resDatVec[ num ].parsed ) return TRUE; + if (num <= 0 || m_thread->readNum() < num) + return false; + if (m_resDatVec[ num ].parsed) + return true; // qDebug("parseDat %d",num); - QString subject = QString::null; - Kita::parseResDat( m_resDatVec[ num ], subject ); - if ( num == 1 && subject != QString::null ) m_thread->setThreadName( subject ); - if ( m_resDatVec[ num ].broken ) m_broken = TRUE; + QString subject; + Parser::parseResDat(m_resDatVec[ num ], subject); + if (num == 1 && !subject.isEmpty()) + m_thread->setThreadName(subject); + if (m_resDatVec[ num ].broken) + m_broken = true; - return TRUE; + return true; } -bool DatInfo::isOpened() +bool DatInfo::isOpened() const { return m_isOpened; } -void DatInfo::setIsOpened( bool isOpened ) +void DatInfo::setOpened(bool isOpened) { m_isOpened = isOpened; } + +/* create HTML of title. + + struct RESDAT resdat should be parsed by parseResDat before calling this function. + + output: titleHtml + +*/ +void DatInfo::createTitleHtml(RESDAT& resdat, QString& titleHtml) +{ + titleHtml.clear(); + if (!resdat.parsed) return ; + + bool showMailAddress = GlobalConfig::showMailAddress(); + bool useTableTag = GlobalConfig::useStyleSheet(); + + if (useTableTag) titleHtml += "<table class=\"res_title\"><tr>"; + + /* res number */ + if (useTableTag) titleHtml += "<td class=\"res_title_number\">"; + titleHtml += "<a href=\"#write" + QString::number(resdat.num) + "\">"; + titleHtml += QString::number(resdat.num); + titleHtml += "</a> "; + + /* name & mail address */ + if (useTableTag) titleHtml += "<td class=\"res_title_name\">"; + titleHtml += "<b>" + QString::fromUtf8(KITAUTF8_NAME); + + /* show name with mail address */ + if (showMailAddress) { + + titleHtml += resdat.nameHTML; + if (!resdat.address.isEmpty()) titleHtml += " [" + resdat.address + ']'; + + } else { /* don't show mail address */ + + if (resdat.address.isEmpty()) { + + titleHtml += "<span class=\"name_noaddr\">"; + titleHtml += resdat.name; + titleHtml += "</span>"; + + } else { + + titleHtml += "<a href=\"mailto:" + resdat.address + "\""; + titleHtml += " title=\"" + resdat.address + "\">"; + titleHtml += resdat.name; + titleHtml += "</a>"; + } + } + + titleHtml += "</b> "; + + /* date */ + if (useTableTag) titleHtml += "<td class=\"res_title_date\">"; + titleHtml += QString::fromUtf8(KITAUTF8_COLON) + resdat.date; + if (useTableTag) titleHtml += "</td>"; + + /* ID */ + if (!resdat.id.isEmpty()) { + + if (useTableTag) titleHtml += "<td class=\"res_title_id\">"; + if (resdat.id.count("???") >= 1) titleHtml += " ID:" + resdat.id; + else titleHtml += " <a href=\"#idpop" + resdat.id + "\">ID</a>" + ":" + resdat.id; + if (useTableTag) titleHtml += "</td>"; + } + + /* BE */ + if (!resdat.be.isEmpty()) { + + if (useTableTag) titleHtml += "<td class=\"res_title_be\">"; + titleHtml += " <a href=\"#bepop" + resdat.be + "\">?" + resdat.bepointmark + "</a>"; + if (useTableTag) titleHtml += "</td>"; + } + + /* host */ + if (!resdat.host.isEmpty()) { + + if (useTableTag) titleHtml += "<td class=\"res_title_host\">"; + titleHtml += " HOST:" + resdat.host; + if (useTableTag) titleHtml += "</td>"; + } + + if (useTableTag) titleHtml += "</tr></table>"; +} Modified: kita/trunk/kita/src/libkita/datinfo.h =================================================================== --- kita/trunk/kita/src/libkita/datinfo.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/datinfo.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,25 +7,27 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITADATINFO_H #define KITADATINFO_H -#include <qobject.h> +#include <QtCore/QDateTime> +#include <QtCore/QList> +#include <QtCore/QObject> +#include <QtCore/QVector> + #include <kurl.h> -#include <qvaluevector.h> -#include <qdatetime.h> -#include <qmutex.h> +#include "threadindex.h" + class QStringList; /* return val of DatInfo::getHTML() */ enum{ - KITA_HTML_NOTPARSED, - KITA_HTML_NORMAL, - KITA_HTML_ABONE, - KITA_HTML_BROKEN + HTML_NOTPARSED, + HTML_NORMAL, + HTML_ABONE, + HTML_BROKEN }; @@ -55,7 +57,7 @@ int to; }; -typedef QValueList<ANCNUM> AncList; +typedef QList<ANCNUM> AncList; /* Data Base of response */ @@ -86,7 +88,7 @@ /* Is this res responsed by other one? */ bool isResponsed; }; -typedef QValueVector<RESDAT> ResDatVec; +typedef QVector<RESDAT> ResDatVec; namespace Kita @@ -98,7 +100,7 @@ /*-----------------------*/ - class DatInfo : public QObject + class KDE_EXPORT DatInfo : public QObject { Q_OBJECT @@ -106,7 +108,8 @@ Thread* m_thread; /* basic information */ - KURL m_datURL; + KUrl m_datUrl; + ThreadIndex m_threadIndex; bool m_broken; ResDatVec m_resDatVec; bool m_isOpened; @@ -135,86 +138,95 @@ public: DatInfo(); - DatInfo( const KURL& url ); + DatInfo(const KUrl& url); ~DatInfo(); void init(); - const KURL& url(); + const KUrl& url() const; /* for caching */ - bool updateCache( const QObject* parent ); - int getResponseCode(); - int getServerTime(); + bool updateCache(const QObject* parent); + int getResponseCode() const; + int getServerTime() const; bool deleteCache(); - bool isLoadingNow(); - void stopLoading(); + bool isLoadingNow() const; + void stopLoading() const; /* string data */ - const QString& getDat( int num ); - const QString& getId( int num ); - QString getPlainName( int num ); - QString getPlainTitle( int num ); - QString getPlainBody( int num ); + QString getDat(int num); + QString getId(int num); + QString getPlainName(int num); + QString getPlainTitle(int num); + QString getPlainBody(int num); /* HTML data */ - int getHTML( int num, bool checkAbone, QString& titleHTML, QString& bodyHTML ); - QString getHTMLString( int startnum, int endnum, bool checkAbone = TRUE ); - QString getHtmlByID( const QString& strid, int &count ); - QString getTreeByRes( const int rootnum, int& count ); - QString getTreeByResReverse( const int rootnum, int& count ); + int getHTML(int num, bool checkAbone, QString& titleHTML, + QString& bodyHTML); + QString getHTMLString(int startnum, int endnum, + bool checkAbone = true); + QString getHtmlById(const QString& strid, int &count); + QString getTreeByRes(int rootnum, int& count); + QString getTreeByResReverse(int rootnum, int& count); /* numerical data */ - int getResNum(); - int getReadNum(); - int getViewPos(); - int getNumByID( const QString& strid ); - int getDatSize(); + int getResNum() const; + int getReadNum() const; + int getViewPos() const; + int getNumById(const QString& strid); + int getDatSize() const; - /* several informations */ - const bool isResponsed ( int num ) const; - bool isResValid( int num ); - bool isBroken(); - bool isResBroken( int num ); - bool checkID( const QString& strid, int num ); - bool checkWord( QStringList& stlist, int num, bool checkOR ); - bool isOpened(); - void setIsOpened( bool isOpened ); + /* several information */ + bool isResponsed (int num) const; + bool isResValid(int num); + bool isBroken() const; + bool isResBroken(int num); + bool checkId(const QString& strid, int num); + bool checkWord(const QStringList& stlist, int num, bool checkOr); + bool isOpened() const; + void setOpened(bool isOpened); /* abone check */ - bool checkAbone( int num ); + bool checkAbone(int num); void resetAbone(); /*-------------------------*/ private: - void initPrivate( bool loadCache = TRUE ); - void resetResDat( RESDAT& resdat ); - void increaseResDatVec( int delta ); + void initPrivate(bool loadCache = true); + void resetResDat(RESDAT& resdat) const; + void increaseResDatVec(int delta); void deleteAccessJob(); /* copy data */ - bool copyOneLineToResDat( const QString& line ); + bool copyOneLineToResDat(const QString& line); /* HTML data */ - int getHTMLPrivate( int num, bool checkAbone, QString& titleHTML, QString& bodyHTML ); - void getHTMLofOneRes( int num, bool checkAbone, QString& html ); - QString getTreeByResPrivate( const int rootnum, bool reverse, int& count ); - QString getTreeByResCore( const int rootnum, bool reverse, int& count, QString prestr ); - bool checkRes( const int num, const int target ); + int getHTMLPrivate(int num, bool checkAbone, QString& titleHTML, + QString& bodyHTML); + void getHtmlOfOneRes(int num, bool checkAbone, QString& html); + QString getTreeByResPrivate(int rootnum, bool reverse, int& count); + QString getTreeByResCore(int rootnum, bool reverse, int& count, + const QString& prestr); + bool checkRes(int num, int target); /* for abone */ void resetAbonePrivate(); - bool checkAbonePrivate( int num ); - bool checkAboneCore( const QString& str, QStringList strlist ); + bool checkAbonePrivate(int num); + bool checkAboneCore(const QString& str, const QStringList& strlist) + const; - /* parsing funtions */ - bool parseDat( int num ); + /* parsing functions */ + bool parseDat(int num); + void createTitleHtml(RESDAT& resdat, QString& titleHtml); + + DatInfo(const DatInfo&); + DatInfo& operator=(const DatInfo&); /*----------------------------*/ private slots: - void slotReceiveData( const QStringList& lineList ); + void slotReceiveData(const QStringList& lineList); void slotFinishLoad(); signals: Modified: kita/trunk/kita/src/libkita/datmanager.cpp =================================================================== --- kita/trunk/kita/src/libkita/datmanager.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/datmanager.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,43 +9,43 @@ ***************************************************************************/ /* DatManager manages all information about thread */ +#include "datmanager.h" -#include <qobject.h> -#include <qmutex.h> -#include <qstringlist.h> -#include <qregexp.h> -#include <qfile.h> +#include <QtCore/QFile> +#include <QtCore/QObject> +#include <QtCore/QRegExp> +#include <QtCore/QStringList> -#include "thread.h" -#include "threadinfo.h" -#include "datmanager.h" -#include "datinfo.h" +#include "boardmanager.h" #include "cache.h" +#include "datinfo.h" #include "kita_misc.h" -#include "kita-utf8.h" -#include "kita-utf16.h" +#include "thread.h" #include "threadindex.h" -#include "boardmanager.h" +#include "threadinfo.h" using namespace Kita; -#define DMANAGER_MAXQUEUE 16 +static const int DMANAGER_MAXQUEUE = 16; DatInfoList DatManager::m_datInfoList; /*-----------------------------------------------------------------------*/ +DatManager::DatManager(const KUrl& url) : m_url(url) +{ + m_datUrl = getDatUrl(url); + m_searchDatInfo = searchDatInfo(); + m_datInfo = getDatInfo(); +} /* create DatInfo explicitly. */ /* Usually, DatInfo is NOT created - if cache does not exist( i.e. ReadNum == 0 ). */ /* public */ -bool DatManager::createDatInfo( const KURL& url ) + if cache does not exist(i.e. ReadNum == 0). */ /* public */ +bool DatManager::createDatInfo() const { - if ( getDatInfo( url, - FALSE /* don't check the existence of cache */ - ) == NULL ) return FALSE; - return TRUE; + return getDatInfo(false /* don't check the existence of cache */) != 0; } @@ -54,9 +54,9 @@ /* !!! NOTICE !!! */ /* It is very dangerous to access to DatInfo directly. */ /* Usually, access to it through DatManager. */ /* public */ -DatInfo * DatManager::getDatInfoPointer( const KURL& url ) +DatInfo * DatManager::getDatInfoPointer() const { - return getDatInfo( url ); + return m_datInfo; } @@ -67,83 +67,84 @@ If cache exists, create DatInfo and return its pointer. - If checkCached == TRUE and cache does not exist, return NULL. + If checkCached == true and cache does not exist, return 0. - If checkCached == FALSE and cache does not exist, + If checkCached == false and cache does not exist, create DatInfo and return its pointer anyway. see also DatManager::searchDatInfo() and DatManager::createDatInfo() */ /* private */ -DatInfo* DatManager::getDatInfo( const KURL& url, bool checkCached ) +DatInfo* DatManager::getDatInfo(bool checkCached) const { /* search */ - DatInfo * datInfo = searchDatInfo( url ); - if ( datInfo != NULL ) return datInfo; - /* create and enroll instance */ - return enrollDatInfo( url, checkCached ); + return (m_searchDatInfo != 0) + ? m_searchDatInfo : enrollDatInfo(checkCached); } /* This function just searches instance of DatInfo specified by datURL without creating instance. */ /* private */ -DatInfo* DatManager::searchDatInfo( const KURL& url ) +DatInfo* DatManager::searchDatInfo() const { - KURL datURL = Kita::getDatURL( url ); - if ( datURL.isEmpty() ) return NULL; /* This url is not enrolled in BoardManager. */ - if ( m_datInfoList.count() == 0 ) return NULL; + if (m_datUrl.isEmpty()) + return 0; /* This url is not enrolled in BoardManager. */ + if (m_datInfoList.isEmpty()) + return 0; int i = 0; DatInfoList::Iterator it; DatInfo* datInfo; - for ( it = m_datInfoList.begin(); it != m_datInfoList.end(); ++it, i++ ) { + for (it = m_datInfoList.begin(); it != m_datInfoList.end(); ++it, i++) { - datInfo = ( *it ); + datInfo = (*it); - if ( datURL == datInfo->url() ) { + if (m_datUrl == datInfo->url()) { /* LRU */ - if ( i ) { - m_datInfoList.remove( it ); - m_datInfoList.prepend( datInfo ); + if (i) { + m_datInfoList.erase(it); + m_datInfoList.prepend(datInfo); } return datInfo; } } - return NULL; + return 0; } /* create and enroll the instance of DatInfo and delete old instances. - Note that DatInfo::DatInfo() opens cached data and reads it. */ /* private */ -DatInfo* DatManager::enrollDatInfo( const KURL& url, bool checkCached ) + Note that DatInfo::DatInfo() opens cached data and reads it. */ +/* private */ +DatInfo* DatManager::enrollDatInfo(bool checkCached) const { - KURL datURL = Kita::getDatURL( url ); - if ( datURL.isEmpty() ) return NULL; /* This url is not enrolled in BoardManager. */ + if (m_datUrl.isEmpty()) + return 0; /* This url is not enrolled in BoardManager. */ /* create DatInfo & read cached data */ - DatInfo* datInfo = new DatInfo( datURL ); + DatInfo* datInfo = new DatInfo(m_datUrl); /* Does cache exist ? */ /* If cache does not exist, delete DatInfo here. */ - if ( checkCached && datInfo->getReadNum() == 0 ) { + if (checkCached && datInfo->getReadNum() == 0) { delete datInfo; - return NULL; + return 0; } - m_datInfoList.prepend( datInfo ); + m_datInfoList.prepend(datInfo); - /* delete the all old instances ( LRU algorithm )*/ - if ( m_datInfoList.count() > DMANAGER_MAXQUEUE ) { - - DatInfoList::Iterator it; - for ( it = m_datInfoList.at( DMANAGER_MAXQUEUE ); it != m_datInfoList.end(); ++it ) { - - if ( ( *it ) == NULL ) continue; - DatInfo* deleteInfo = ( *it ); + /* delete the all old instances (LRU algorithm)*/ + if (m_datInfoList.count() > DMANAGER_MAXQUEUE) { + for (int i = DMANAGER_MAXQUEUE; i < m_datInfoList.count(); i++) { + DatInfo* deleteInfo = m_datInfoList.at(i); + if (deleteInfo == 0) + continue; + m_datInfoList.removeAt(i); + i--; + delete datInfo; } } @@ -154,12 +155,8 @@ /* public */ void DatManager::deleteAllDatInfo() { - DatInfoList::Iterator it; - for ( it = m_datInfoList.begin(); it != m_datInfoList.end(); ++it ) { - - if ( ( *it ) == NULL ) continue; - delete ( *it ); - } + while (!m_datInfoList.isEmpty()) + delete m_datInfoList.takeFirst(); } @@ -169,81 +166,69 @@ /* update cache */ /* public */ -bool DatManager::updateCache( const KURL& url , const QObject* parent ) +bool DatManager::updateCache(const QObject* parent) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return FALSE; - - return datInfo->updateCache( parent ); + return (m_datInfo == 0) ? false : m_datInfo->updateCache(parent); } /* public */ -int DatManager::getResponseCode( const KURL& url ) +int DatManager::getResponseCode() const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return 0; - - return datInfo->getResponseCode(); + return (m_datInfo == 0) ? 0 : m_datInfo->getResponseCode(); } /* public */ -int DatManager::getServerTime( const KURL& url ) +int DatManager::getServerTime() const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return 0; - - return datInfo->getServerTime(); + return (m_datInfo == 0) ? 0 : m_datInfo->getServerTime(); } /* public */ -bool DatManager::deleteCache( const KURL& url ) +bool DatManager::deleteCache() const { - KURL datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread == NULL ) return FALSE; - if ( thread->readNum() == 0 ) return FALSE; + Thread* thread = Thread::getByUrlNew(m_datUrl); + if (thread == 0) + return false; + if (thread->readNum() == 0) + return false; /* init DatInfo */ - DatInfo * datInfo = searchDatInfo( datURL ); - if ( datInfo ) { - if ( !datInfo->deleteCache() ) return FALSE; + if (m_searchDatInfo && !m_searchDatInfo->deleteCache()) { + return false; } /* reset readNum & veiwPos */ - thread->setReadNum( 0 ); - thread->setViewPos( 0 ); + thread->setReadNum(0); + thread->setViewPos(0); /* delete cache */ - QString cachePath = Kita::Cache::getPath( datURL ); - QString indexPath = Kita::Cache::getIndexPath( datURL ); - QFile::remove( indexPath ); - QFile::remove( cachePath ); + Cache cache(m_datUrl); + QString cachePath = cache.getPath(); + QString indexPath = cache.getIndexPath(); + QFile::remove(indexPath); + QFile::remove(cachePath); /* delete log from "cache" */ - KitaThreadInfo::removeThreadInfo( datURL.prettyURL() ); - return TRUE; + ThreadInfo::removeThreadInfo(m_datUrl.prettyUrl()); + return true; } /* public */ -bool DatManager::isLoadingNow( const KURL& url ) +bool DatManager::isLoadingNow() const { - DatInfo * datInfo = searchDatInfo( url ); - if ( datInfo == NULL ) return FALSE; - - return datInfo->isLoadingNow(); + return (m_searchDatInfo == 0) ? false : m_searchDatInfo->isLoadingNow(); } /* public */ -void DatManager::stopLoading( const KURL& url ) +void DatManager::stopLoading() const { - DatInfo * datInfo = searchDatInfo( url ); - if ( datInfo == NULL ) return ; - - return datInfo->stopLoading(); + if (m_searchDatInfo == 0) + return; + m_searchDatInfo->stopLoading(); } /*--------------------------------------*/ @@ -251,331 +236,255 @@ /* public */ -const QString& DatManager::getDat( const KURL& url, int num ) +QString DatManager::getDat(int num) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return QString::null; - - return datInfo->getDat( num ); + return (m_datInfo == 0) ? QString() : m_datInfo->getDat(num); } /* public */ -const QString& DatManager::getId( const KURL& url, int num ) +QString DatManager::getId(int num) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return QString::null; - - return datInfo->getId( num ); + return (m_datInfo == 0) ? QString() : m_datInfo->getId(num); } /* public */ -QString DatManager::getPlainName( const KURL& url, int num ) +QString DatManager::getPlainName(int num) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return QString::null; - - return datInfo->getPlainName( num ); + return (m_datInfo == 0) ? QString() : m_datInfo->getPlainName(num); } /* public */ -QString DatManager::getPlainBody( const KURL& url, int num ) +QString DatManager::getPlainBody(int num) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return QString::null; - - return datInfo->getPlainBody( num ); + return (m_datInfo == 0) ? QString() : m_datInfo->getPlainBody(num); } /* public */ -QString DatManager::getPlainTitle( const KURL& url, int num ) +QString DatManager::getPlainTitle(int num) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return QString::null; - - return datInfo->getPlainTitle( num ); + return (m_datInfo == 0) ? QString() : m_datInfo->getPlainTitle(num); } -/* get name (i.e. subject ) of thread from URL of dat file. */ /* public */ -const QString DatManager::threadName( const KURL& url ) +/* get name (i.e. subject) of thread from URL of dat file. */ /* public */ +QString DatManager::threadName() const { - KURL datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread != NULL ) return thread->threadName(); - - return QString::null; + Thread* thread = Thread::getByUrlNew(m_datUrl); + return (thread != 0) ? thread->threadName() : QString(); } /* public */ -const QString DatManager::threadID( const KURL& url ) +QString DatManager::threadId() const { - KURL datURL = Kita::getDatURL( url ); - return datURL.filename().section( ".", 0, 0 ); + return m_datUrl.fileName().section('.', 0, 0); } - -const QString DatManager::getCachePath( const KURL& url ) -{ - return Kita::Cache::getPath( url ); -} - -const QString DatManager::getCacheIndexPath( const KURL& url ) -{ - return Kita::Cache::getIndexPath( url ); -} - /*---------------------------------------*/ /* HTML data */ /* public */ -QString DatManager::getHtml( const KURL& url, int startnum, int endnum, bool checkAbone ) +QString DatManager::getHtml(int startnum, int endnum, bool checkAbone) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return QString::null; - - return datInfo->getHTMLString( startnum, endnum, checkAbone ); + return (m_datInfo == 0) + ? QString() : m_datInfo->getHTMLString(startnum, endnum, checkAbone); } /* public */ -QString DatManager::getHtmlByID( const KURL& url, const QString& strid, int &count ) +QString DatManager::getHtmlById(const QString& strid, int &count) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return QString::null; - - return datInfo->getHtmlByID( strid, count ); + return (m_datInfo == 0) ? QString() : m_datInfo->getHtmlById(strid, count); } /* Get HTML document of res tree.*/ /* public */ -QString DatManager::getTreeByRes( const KURL& url, const int rootnum, int &count ) +QString DatManager::getTreeByRes(int rootnum, int &count) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return QString::null; - - return datInfo->getTreeByRes( rootnum, count ); + return (m_datInfo == 0) + ? QString() : m_datInfo->getTreeByRes(rootnum, count); } /* Get HTML document of reverse res tree.*/ /* public */ -QString DatManager::getTreeByResReverse( const KURL& url, const int rootnum, int &count ) +QString DatManager::getTreeByResReverse(int rootnum, int &count) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return QString::null; - - return datInfo->getTreeByResReverse( rootnum, count ); + return (m_datInfo == 0) + ? QString() : m_datInfo->getTreeByResReverse(rootnum, count); } /* public */ -int DatManager::getResNum( const KURL& url ) +int DatManager::getResNum() const { - KURL datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread != NULL ) return thread->resNum(); - - return 0; + Thread* thread = Thread::getByUrlNew(m_datUrl); + return (thread != 0) ? thread->resNum() : 0; } /* public */ -int DatManager::getReadNum( const KURL& url ) +int DatManager::getReadNum() const { - KURL datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread != NULL ) return thread->readNum(); - - return 0; + Thread* thread = Thread::getByUrlNew(m_datUrl); + return (thread != 0) ? thread->readNum() : 0; } /* public */ -int DatManager::getViewPos( const KURL& url ) +int DatManager::getViewPos() const { - KURL datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread != NULL ) return thread->viewPos(); - - return 0; + Thread* thread = Thread::getByUrlNew(m_datUrl); + return (thread != 0) ? thread->viewPos() : 0; } /* public */ -void DatManager::setViewPos( const KURL& url , int num ) +void DatManager::setViewPos(int num) const { - KURL datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread != NULL ) thread->setViewPos( num ); + Thread* thread = Thread::getByUrlNew(m_datUrl); + if (thread != 0) + thread->setViewPos(num); /* save idx */ - Kita::ThreadIndex::setViewPos( url, num ); + ThreadIndex threadIndex(m_url); + threadIndex.setViewPos(num); /* save "cache" */ - KitaThreadInfo::setReadNum( datURL.prettyURL(), num ); + ThreadInfo::setReadNum(m_datUrl.prettyUrl(), num); } /* public */ -int DatManager::getDatSize( const KURL& url ) +int DatManager::getDatSize() const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return 0; - - return datInfo->getDatSize(); + return (m_datInfo == 0) ? 0 : m_datInfo->getDatSize(); } /* get number of responses which have same ID. */ /* public */ -int DatManager::getNumByID( const KURL& url, const QString& strid ) +int DatManager::getNumById(const QString& strid) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return 0; - - return datInfo->getNumByID( strid ); + return (m_datInfo == 0) ? 0 : m_datInfo->getNumById(strid); } /* public */ -bool DatManager::isThreadEnrolled( const KURL& url ) +bool DatManager::isThreadEnrolled() const { - if ( Kita::getDatURL( url ).isEmpty() ) return FALSE; - - return TRUE; + return !m_datUrl.isEmpty(); } /* public */ -bool DatManager::is2chThread( const KURL& url ) +bool DatManager::is2chThread() const { - if ( BoardManager::type( url ) != Board_2ch ) return FALSE; - if ( Kita::getDatURL( url ).isEmpty() ) return FALSE; + if (BoardManager::type(m_url) != Board_2ch) + return false; + if (m_datUrl.isEmpty()) + return false; - QRegExp url_2ch( ".*\\.2ch\\.net" ); - QRegExp url_bbspink( ".*\\.bbspink\\.com" ); + QRegExp url_2ch(".*\\.2ch\\.net"); + QRegExp url_bbspink(".*\\.bbspink\\.com"); - if ( url_2ch.search( url.host() ) != -1 - || url_bbspink.search( url.host() ) != -1 ) return TRUE; + if (url_2ch.indexIn(m_url.host()) != -1 + || url_bbspink.indexIn(m_url.host()) != -1) + return true; - return FALSE; + return false; } /* public */ -bool DatManager::isResValid( const KURL& url, int num ) +bool DatManager::isResValid(int num) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return FALSE; - - return datInfo->isResValid( num ); + return (m_datInfo == 0) ? false : m_datInfo->isResValid(num); } /* public */ -bool DatManager::isBroken( const KURL& url ) +bool DatManager::isBroken() const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return FALSE; - - return datInfo->isBroken(); + return (m_datInfo == 0) ? false : m_datInfo->isBroken(); } /* public */ -bool DatManager::isResBroken( const KURL& url, int num ) +bool DatManager::isResBroken(int num) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return FALSE; - - return datInfo->isResBroken( num ); + return (m_datInfo == 0) ? false : m_datInfo->isResBroken(num); } /* check if ID == strid */ /* public */ -bool DatManager::checkID( const KURL& url, const QString& strid, int num ) +bool DatManager::checkId(const QString& strid, int num) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return FALSE; - - return datInfo->checkID( strid, num ); + return (m_datInfo == 0) ? false : m_datInfo->checkId(strid, num); } /* check if keywords are included */ /* public */ -bool DatManager::checkWord( const KURL& url, - QStringList& strlist, int num, - bool checkOR /* AND or OR search */ - ) +bool DatManager::checkWord(const QStringList& strlist, int num, + bool checkOr /* AND or OR search */) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return FALSE; - - return datInfo->checkWord( strlist, num, checkOR ); + return (m_datInfo == 0) + ? false : m_datInfo->checkWord(strlist, num, checkOr); } /* public */ -bool DatManager::isMarked( const KURL& url, int num ) +bool DatManager::isMarked(int num) const { - KURL datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread == NULL ) return FALSE; - - return thread->isMarked( num ); + Thread* thread = Thread::getByUrlNew(m_datUrl); + return (thread == 0) ? false : thread->isMarked(num); } /* public */ -void DatManager::setMark( const KURL& url, int num, bool mark ) +void DatManager::setMark(int num, bool mark) const { - KURL datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread == NULL ) return ; + Thread* thread = Thread::getByUrlNew(m_datUrl); + if (thread == 0) + return; - if ( thread->setMark( num, mark ) ) Kita::ThreadIndex::setMarkList( url, thread->markList() ); + if (thread->setMark(num, mark)) { + ThreadIndex threadIndex(m_url); + threadIndex.setMarkList(thread->markList()); + } } /* public */ -bool DatManager::checkAbone( const KURL& url, int num ) +bool DatManager::checkAbone(int num) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return FALSE; - - return datInfo->checkAbone( num ); + return (m_datInfo == 0) ? false : m_datInfo->checkAbone(num); } /* public */ -void DatManager::resetAbone( const KURL& url ) +void DatManager::resetAbone() const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return ; - - datInfo->resetAbone(); + if (m_datInfo == 0) + return; + m_datInfo->resetAbone(); } /* check if the thread is shown on the main thread tab. */ /* public */ -bool DatManager::isMainThreadOpened( const KURL& url ) +bool DatManager::isMainThreadOpened() const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return FALSE; - - return datInfo->isOpened(); + return (m_datInfo == 0) ? false : m_datInfo->isOpened(); } -void DatManager::setMainThreadOpened( const KURL& url, bool isOpened ) +void DatManager::setMainThreadOpened(bool isOpened) const { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == NULL ) return; - - datInfo->setIsOpened( isOpened ); + if (m_datInfo == 0) + return; + m_datInfo->setOpened(isOpened); } @@ -583,8 +492,7 @@ /* obsolete */ /* public */ -const QString DatManager::threadURL( const KURL& url ) +QString DatManager::threadUrl() const { - return Kita::getThreadURL( url ); + return getThreadUrl(m_url); } - Modified: kita/trunk/kita/src/libkita/datmanager.h =================================================================== --- kita/trunk/kita/src/libkita/datmanager.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/datmanager.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,13 +7,13 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#ifndef KITADATMANAGER_H +#define KITADATMANAGER_H -#ifndef KITADATMG_H -#define KITADATMG_H +#include <QtCore/QList> -#include <qvaluelist.h> +#include <kurl.h> -class KURL; class QObject; class QStringList; @@ -21,83 +21,89 @@ { class DatInfo; - typedef QValueList<DatInfo*> DatInfoList; + typedef QList<DatInfo*> DatInfoList; - class DatManager + class KDE_EXPORT DatManager { static DatInfoList m_datInfoList; public: + explicit DatManager(const KUrl& url); - static bool createDatInfo( const KURL& url ); - static DatInfo* getDatInfoPointer( const KURL& url ); + bool createDatInfo() const; + DatInfo* getDatInfoPointer() const; static void deleteAllDatInfo(); /* caching */ - static bool updateCache( const KURL& url , const QObject* parent ); - static int getResponseCode( const KURL& url ); - static int getServerTime( const KURL& url ); - static bool deleteCache( const KURL& url ); - static bool isLoadingNow( const KURL& url ); - static void stopLoading( const KURL& url ); + bool updateCache(const QObject* parent) const; + int getResponseCode() const; + int getServerTime() const; + bool deleteCache() const; + bool isLoadingNow() const; + void stopLoading() const; /* string data */ - static const QString& getDat( const KURL& url, int num ); - static const QString& getId( const KURL& url, int num ); - static QString getPlainName( const KURL& url, int num ); - static QString getPlainBody( const KURL& url, int num ); - static QString getPlainTitle( const KURL& url, int num ); + QString getDat(int num) const; + QString getId(int num) const; + QString getPlainName(int num) const; + QString getPlainBody(int num) const; + QString getPlainTitle(int num) const; - static const QString threadName( const KURL& url ); /* = subject of thread */ - static const QString threadID( const KURL& url ); + QString threadName() const; /* = subject of thread */ + QString threadId() const; - static const QString getCachePath( const KURL& url ); - static const QString getCacheIndexPath( const KURL& url ); - /* HTML data */ - static QString getHtml( const KURL& url, int startnum, int endnum, bool checkAbone = TRUE ); - static QString getHtmlByID( const KURL& url, const QString& strid, int &count ); - static QString getTreeByRes( const KURL& url, const int rootnum, int &count ); - static QString getTreeByResReverse( const KURL& url, const int rootnum, int &count ); + QString getHtml(int startnum, int endnum, + bool checkAbone = true) const; + QString getHtmlById(const QString& strid, int &count) const; + QString getTreeByRes(int rootnum, int &count) const; + QString getTreeByResReverse(int rootnum, int &count) const; /* numerical data */ - static int getResNum( const KURL& url ); - static int getReadNum( const KURL& url ); - static int getViewPos( const KURL& url ); - static void setViewPos( const KURL& url, int num ); - static int getDatSize( const KURL& url ); - static int getNumByID( const KURL& url, const QString& strid ); + int getResNum() const; + int getReadNum() const; + int getViewPos() const; + void setViewPos(int num) const; + int getDatSize() const; + int getNumById(const QString& strid) const; /* another information */ - static bool isThreadEnrolled( const KURL& url ); - static bool is2chThread( const KURL& url ); - static bool isResValid( const KURL& url , int num ); - static bool isBroken( const KURL& url ); - static bool isResBroken( const KURL& url , int num ); - static bool checkID( const KURL& url, const QString& strid, int num ); - static bool checkWord( const KURL& url, QStringList& stlist, int num, bool checkOR ); - static bool isMarked( const KURL& url, int num ); - static void setMark( const KURL& url, int num, bool mark ); + bool isThreadEnrolled() const; + bool is2chThread() const; + bool isResValid(int num) const; + bool isBroken() const; + bool isResBroken(int num) const; + bool checkId(const QString& strid, int num) const; + bool checkWord(const QStringList& stlist, int num, bool checkOr) const; + bool isMarked(int num) const; + void setMark(int num, bool mark) const; /* abone check */ - static bool checkAbone( const KURL& url, int num ); - static void resetAbone( const KURL& url ); + bool checkAbone(int num) const; + void resetAbone() const; /* check if the thread is shown on the main thread tab. */ - static bool isMainThreadOpened( const KURL& url ); - static void setMainThreadOpened( const KURL& url, bool isOpened ); + bool isMainThreadOpened() const; + void setMainThreadOpened(bool isOpened) const; /* obsolete. Don't use them. */ - static const QString threadURL( const KURL& url ); + QString threadUrl() const; private: + DatInfo* getDatInfo(bool checkCached = true) const; + DatInfo* searchDatInfo() const; + DatInfo* enrollDatInfo(bool checkCached) const; - static DatInfo* getDatInfo( const KURL& url, bool checkCached = TRUE ); - static DatInfo* searchDatInfo( const KURL& url ); - static DatInfo* enrollDatInfo( const KURL& url, bool checkCached ); + KUrl m_url; + KUrl m_datUrl; + DatInfo* m_datInfo; + DatInfo* m_searchDatInfo; + + DatManager(const DatManager&); + DatManager& operator=(const DatManager&); }; } Modified: kita/trunk/kita/src/libkita/downloadmanager.h =================================================================== --- kita/trunk/kita/src/libkita/downloadmanager.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/downloadmanager.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,8 +7,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#ifndef KITADOWNLOADMANAGER_H +#define KITADOWNLOADMANAGER_H -#ifndef KITAFILELOADER_H -#define KITAFILELOADER_H - #endif Modified: kita/trunk/kita/src/libkita/event.h =================================================================== --- kita/trunk/kita/src/libkita/event.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/event.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,11 +7,10 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITAEVENT_H #define KITAEVENT_H -#define EVENT_EmitFinigh ( QEvent::User + 200 ) -#define EVENT_DeleteLoader ( QEvent::User + 201 ) +const int EVENT_EmitFinigh = QEvent::User + 200; +const int EVENT_DeleteLoader = QEvent::User + 201; #endif Modified: kita/trunk/kita/src/libkita/favoriteboards.cpp =================================================================== --- kita/trunk/kita/src/libkita/favoriteboards.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/favoriteboards.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -8,10 +8,11 @@ * (at your option) any later version. * ***************************************************************************/ #include "favoriteboards.h" -#include "boardmanager.h" -#include <qdom.h> +#include <QtXml/QDomDocument> +#include "boardmanager.h" + using namespace Kita; FavoriteBoards* FavoriteBoards::instance = 0; @@ -24,68 +25,68 @@ FavoriteBoards* FavoriteBoards::getInstance() { - if ( ! instance ) { + if (! instance) { instance = new FavoriteBoards(); } return instance; } -void FavoriteBoards::append( KURL& url ) +void FavoriteBoards::append(KUrl& url) { - if ( ! getInstance() ->m_list.contains( url ) ) { - getInstance() ->m_list.append( url ); + if (! getInstance() ->m_list.contains(url)) { + getInstance() ->m_list.append(url); getInstance() ->notifyChange(); } } -void FavoriteBoards::remove( KURL& url ) +void FavoriteBoards::remove(KUrl& url) { - if ( getInstance() ->m_list.contains( url ) ) { - getInstance() ->m_list.remove( url ); + if (getInstance() ->m_list.contains(url)) { + getInstance() ->m_list.removeAll(url); getInstance() ->notifyChange(); } } -const QValueList<KURL>& FavoriteBoards::boards() +const QList<KUrl>& FavoriteBoards::boards() { return getInstance() ->m_list; } -bool FavoriteBoards::readFromXML( QString& xml ) +bool FavoriteBoards::readFromXML(QString& xml) { FavoriteBoards * instance = FavoriteBoards::getInstance(); instance->m_list.clear(); QDomDocument document; - if ( ! document.setContent( xml, TRUE ) ) { - return FALSE; + if (! document.setContent(xml, true)) { + return false; } QDomElement root = document.documentElement(); QDomNode node = root.firstChild(); - while ( ! node.isNull() ) { - if ( node.isElement() && - node.nodeName() == QString( "board" ) && - node.namespaceURI() == QString( "http://kita.sourceforge.jp/ns/board" ) ) { - processChildNode( node ); + while (! node.isNull()) { + if (node.isElement() && + node.nodeName() == QString("board") && + node.namespaceURI() == QString("http://kita.sourceforge.jp/ns/board")) { + processChildNode(node); } node = node.nextSibling(); } - return TRUE; + return true; } -void FavoriteBoards::processChildNode( QDomNode& node ) +void FavoriteBoards::processChildNode(QDomNode& node) { - QDomNode urlNode = node.namedItem( "url" ); - if ( ! urlNode.isElement() ) return ; + QDomNode urlNode = node.namedItem("url"); + if (! urlNode.isElement()) return ; QString urlText = urlNode.toElement().text(); - KURL url = KURL( urlText ); - if ( url.isValid() ) { - //FavoriteBoards::append( url ); - if ( !getInstance() ->m_list.contains( url ) ) - getInstance() ->m_list.append( url ); + KUrl url = KUrl(urlText); + if (url.isValid()) { + //FavoriteBoards::append(url); + if (!getInstance() ->m_list.contains(url)) + getInstance() ->m_list.append(url); } } @@ -93,39 +94,39 @@ { QDomDocument document; - QDomProcessingInstruction pi = document.createProcessingInstruction( "xml", "version=\"1.0\"" ); - document.appendChild( pi ); + QDomProcessingInstruction pi = document.createProcessingInstruction("xml", "version=\"1.0\""); + document.appendChild(pi); - QDomElement root = document.createElementNS( "http://kita.sourceforge.jp/ns/boardlist", "boardlist" ); - document.appendChild( root ); + QDomElement root = document.createElementNS("http://kita.sourceforge.jp/ns/boardlist", "boardlist"); + document.appendChild(root); - QValueList<KURL> boards = FavoriteBoards::boards(); - QValueList<KURL>::iterator it; - for ( it = boards.begin(); it != boards.end(); ++it ) { - QDomElement board = document.createElementNS( "http://kita.sourceforge.jp/ns/board", "board" ); - root.appendChild( board ); + QList<KUrl> boards = FavoriteBoards::boards(); + QList<KUrl>::iterator it; + for (it = boards.begin(); it != boards.end(); ++it) { + QDomElement board = document.createElementNS("http://kita.sourceforge.jp/ns/board", "board"); + root.appendChild(board); - QString boardURL = ( *it ).url(); - QDomElement urlElement = document.createElement( "url" ); - board.appendChild( urlElement ); - urlElement.appendChild( document.createTextNode( boardURL ) ); + QString boardUrl = (*it).url(); + QDomElement urlElement = document.createElement("url"); + board.appendChild(urlElement); + urlElement.appendChild(document.createTextNode(boardUrl)); - QString boardName = Kita::BoardManager::boardName( boardURL ); - QDomElement nameElement = document.createElement( "name" ); - board.appendChild( nameElement ); - nameElement.appendChild( document.createTextNode( boardName ) ); + QString boardName = BoardManager::boardName(boardUrl); + QDomElement nameElement = document.createElement("name"); + board.appendChild(nameElement); + nameElement.appendChild(document.createTextNode(boardName)); } - return document.toString( 0 ); + return document.toString(0); } -void FavoriteBoards::replace( QString fromURL, QString toURL ) +void FavoriteBoards::replace(const QString& fromUrl, const QString& toUrl) { - if ( FavoriteBoards::getInstance() == NULL ) return ; - QValueList<KURL>& boardList = FavoriteBoards::getInstance() ->m_list; - for ( QValueList<KURL>::iterator it = boardList.begin(); it != boardList.end(); ++it ) { - QString url = ( *it ).url(); - if ( url.startsWith( fromURL ) ) { - url = url.replace( 0, fromURL.length(), toURL ); + if (FavoriteBoards::getInstance() == 0) return ; + QList<KUrl>& boardList = FavoriteBoards::getInstance() ->m_list; + for (QList<KUrl>::iterator it = boardList.begin(); it != boardList.end(); ++it) { + QString url = (*it).url(); + if (url.startsWith(fromUrl)) { + url = url.replace(0, fromUrl.length(), toUrl); *it = url; } } @@ -136,5 +137,3 @@ { emit changed(); } - -#include "favoriteboards.moc" Modified: kita/trunk/kita/src/libkita/favoriteboards.h =================================================================== --- kita/trunk/kita/src/libkita/favoriteboards.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/favoriteboards.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,7 +10,9 @@ #ifndef KITAFAVORITEBOARDS_H #define KITAFAVORITEBOARDS_H -#include <qobject.h> +#include <QtCore/QList> +#include <QtCore/QObject> + #include <kurl.h> class QDomNode; @@ -20,27 +22,27 @@ /** @author Hideki Ikemoto */ - class FavoriteBoards : public QObject + class KDE_EXPORT FavoriteBoards : public QObject { Q_OBJECT static FavoriteBoards* instance; - QValueList<KURL> m_list; + QList<KUrl> m_list; FavoriteBoards(); ~FavoriteBoards(); - static void processChildNode( QDomNode& node ); + static void processChildNode(QDomNode& node); private: void notifyChange(); public: static FavoriteBoards* getInstance(); - static void append( KURL& url ); - static void remove( KURL& url ); - static const QValueList<KURL>& boards(); - static bool readFromXML( QString& xml ); + static void append(KUrl& url); + static void remove(KUrl& url); + static const QList<KUrl>& boards(); + static bool readFromXML(QString& xml); static QString toXML(); - static void replace( QString fromURL, QString toURL ); + static void replace(const QString& fromUrl, const QString& toUrl); signals: void changed(); }; Modified: kita/trunk/kita/src/libkita/favoritethreads.cpp =================================================================== --- kita/trunk/kita/src/libkita/favoritethreads.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/favoritethreads.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,17 +9,18 @@ ***************************************************************************/ #include "favoritethreads.h" -#include "thread.h" -#include "threadindex.h" + +#include <QtCore/QList> +#include <QtXml/QDomDocument> + #include "boardmanager.h" #include "datmanager.h" #include "kita_misc.h" +#include "thread.h" +#include "threadindex.h" -#include <kdebug.h> +using namespace Kita; -#include <qstylesheet.h> -#include <qdom.h> - // FavoriteThreadItem FavoriteThreadItem::FavoriteThreadItem() {} @@ -27,9 +28,9 @@ FavoriteThreadItem::~ FavoriteThreadItem() {} -bool FavoriteThreadItem::operator==( const FavoriteThreadItem& item ) const +bool FavoriteThreadItem::operator==(const FavoriteThreadItem& item) const { - return ( m_datURL == item.m_datURL ); + return (m_datUrl == item.m_datUrl); } // FavoriteThreads @@ -43,148 +44,150 @@ FavoriteThreads* FavoriteThreads::getInstance() { - if ( ! instance ) { + if (! instance) { instance = new FavoriteThreads(); } return instance; } -void FavoriteThreads::insert( const QString& datURL ) +void FavoriteThreads::insert(const QString& datUrl) { - if ( ! m_threadList.contains( datURL ) ) { - m_threadList.append( datURL ); + if (! m_threadList.contains(datUrl)) { + m_threadList.append(datUrl); } } -void FavoriteThreads::remove( const QString& datURL ) +void FavoriteThreads::remove(const QString& datUrl) { - m_threadList.remove( datURL ); + m_threadList.removeAll(datUrl); } -bool FavoriteThreads::contains( const QString& datURL ) +bool FavoriteThreads::contains(const QString& datUrl) { - if ( m_threadList.contains( datURL ) ) { - return TRUE; + if (m_threadList.contains(datUrl)) { + return true; } else { - return FALSE; + return false; } } -const QValueList<FavoriteThreadItem> FavoriteThreads::threadList() const +const QList<FavoriteThreadItem> FavoriteThreads::threadList() const { return m_threadList; } -bool FavoriteThreads::readFromXML( const QString& xml ) +bool FavoriteThreads::readFromXML(const QString& xml) { FavoriteThreads * instance = FavoriteThreads::getInstance(); instance->m_threadList.clear(); QDomDocument document; - if ( ! document.setContent( xml, TRUE ) ) { - return FALSE; + if (! document.setContent(xml, true)) { + return false; } QDomElement root = document.documentElement(); QDomNode node = root.firstChild(); - while ( !node.isNull() ) { - if ( node.isElement() && - node.nodeName() == QString( "thread" ) && - node.namespaceURI() == QString( "http://kita.sourceforge.jp/ns/thread" ) ) { - processThreadNode( node ); + while (!node.isNull()) { + if (node.isElement() && + node.nodeName() == QString("thread") && + node.namespaceURI() == QString("http://kita.sourceforge.jp/ns/thread")) { + processThreadNode(node); } node = node.nextSibling(); } - return TRUE; + return true; } -void FavoriteThreads::processThreadNode( QDomNode& node ) +void FavoriteThreads::processThreadNode(QDomNode& node) { - QDomNode datURLNode = node.namedItem( "daturl" ); - QDomNode nameNode = node.namedItem( "name" ); + QDomNode datUrlNode = node.namedItem("daturl"); + QDomNode nameNode = node.namedItem("name"); - if ( !datURLNode.isElement() || !nameNode.isElement() ) return ; + if (!datUrlNode.isElement() || !nameNode.isElement()) return ; - QString url = datURLNode.toElement().text(); + QString url = datUrlNode.toElement().text(); QString name = nameNode.toElement().text(); - KURL datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURL( datURL ); - thread->setThreadName( name ); - Kita::ThreadIndex::loadIndex( thread, datURL ); + KUrl datUrl = Kita::getDatUrl(url); + Thread* thread = Thread::getByUrl(datUrl); + thread->setThreadName(name); + ThreadIndex threadIndex(datUrl); + threadIndex.loadIndex(thread); - FavoriteThreads::getInstance() ->insert( datURL.prettyURL() ); + FavoriteThreads::getInstance() ->insert(datUrl.prettyUrl()); } const QString FavoriteThreads::toXML() const { QDomDocument document; - // QDomProcessingInstruction pi = document.createProcessingInstruction( "xml", "version=\"1.0\"" ); - // document.appendChild( pi ); + // QDomProcessingInstruction pi = document.createProcessingInstruction("xml", "version=\"1.0\""); + // document.appendChild(pi); - QDomElement root = document.createElementNS( "http://kita.sourceforge.jp/ns/favorites", "favorites" ); - document.appendChild( root ); + QDomElement root = document.createElementNS("http://kita.sourceforge.jp/ns/favorites", "favorites"); + document.appendChild(root); - QValueList<FavoriteThreadItem>::const_iterator it; - for ( it = threadList().begin(); it != threadList().end(); ++it ) { - QString datURL = ( *it ).m_datURL; - QDomElement threadElement = document.createElementNS( "http://kita.sourceforge.jp/ns/thread", "thread" ); - root.appendChild( threadElement ); + QList<FavoriteThreadItem>::const_iterator it; + for (it = threadList().begin(); it != threadList().end(); ++it) { + QString datUrl = (*it).m_datUrl; + QDomElement threadElement = document.createElementNS("http://kita.sourceforge.jp/ns/thread", "thread"); + root.appendChild(threadElement); - QDomElement datURLElement = document.createElement( "daturl" ); - threadElement.appendChild( datURLElement ); - datURLElement.appendChild( document.createTextNode( datURL ) ); + QDomElement datUrlElement = document.createElement("daturl"); + threadElement.appendChild(datUrlElement); + datUrlElement.appendChild(document.createTextNode(datUrl)); - QString threadName = Kita::DatManager::threadName( datURL ); - QDomElement nameElement = document.createElement( "name" ); - threadElement.appendChild( nameElement ); - nameElement.appendChild( document.createTextNode( threadName ) ); + DatManager datManager(datUrl); + QString threadName = datManager.threadName(); + QDomElement nameElement = document.createElement("name"); + threadElement.appendChild(nameElement); + nameElement.appendChild(document.createTextNode(threadName)); - QString resNum = QString::number( Kita::DatManager::getResNum( datURL ) ); - QDomElement resNumElement = document.createElement( "resnum" ); - threadElement.appendChild( resNumElement ); - resNumElement.appendChild( document.createTextNode( resNum ) ); + QString resNum = QString::number(datManager.getResNum()); + QDomElement resNumElement = document.createElement("resnum"); + threadElement.appendChild(resNumElement); + resNumElement.appendChild(document.createTextNode(resNum)); // board - QDomElement board = document.createElementNS( "http://kita.sourceforge.jp/ns/board", "board" ); - threadElement.appendChild( board ); + QDomElement board = document.createElementNS("http://kita.sourceforge.jp/ns/board", "board"); + threadElement.appendChild(board); - QString boardURL = Kita::BoardManager::boardURL( datURL ); - QDomElement boardURLElement = document.createElement( "url" ); - board.appendChild( boardURLElement ); - boardURLElement.appendChild( document.createTextNode( boardURL ) ); + QString boardUrl = BoardManager::boardUrl(datUrl); + QDomElement boardUrlElement = document.createElement("url"); + board.appendChild(boardUrlElement); + boardUrlElement.appendChild(document.createTextNode(boardUrl)); - QString boardName = Kita::BoardManager::boardName( boardURL ); - QDomElement boardNameElement = document.createElement( "name" ); - board.appendChild( boardNameElement ); - boardNameElement.appendChild( document.createTextNode( boardName ) ); + QString boardName = BoardManager::boardName(boardUrl); + QDomElement boardNameElement = document.createElement("name"); + board.appendChild(boardNameElement); + boardNameElement.appendChild(document.createTextNode(boardName)); } - return document.toString( 0 ); + return document.toString(0); } -void FavoriteThreads::replace( QString fromURL, QString toURL ) +void FavoriteThreads::replace(const QString& fromUrl, const QString& toUrl) { - if ( FavoriteThreads::getInstance() == NULL ) return ; - QValueList<FavoriteThreadItem>& threadList = FavoriteThreads::getInstance() ->m_threadList; - QValueList<FavoriteThreadItem>::iterator it; - for ( it = threadList.begin(); it != threadList.end(); ++it ) { - QString url = ( *it ).m_datURL; - if ( url.find( fromURL ) == 0 ) { - url = url.replace( 0, fromURL.length(), toURL ); - threadList.remove( it ); - threadList.prepend( url ); + if (FavoriteThreads::getInstance() == 0) return ; + QList<FavoriteThreadItem>& threadList = FavoriteThreads::getInstance() ->m_threadList; + QList<FavoriteThreadItem>::iterator it; + for (it = threadList.begin(); it != threadList.end(); ++it) { + QString url = (*it).m_datUrl; + if (url.indexOf(fromUrl) == 0) { + url = url.replace(0, fromUrl.length(), toUrl); + threadList.erase(it); + threadList.prepend(url); it = threadList.begin(); } } } -QString FavoriteThreads::getDatURL( int i ) +QString FavoriteThreads::getDatUrl(int i) { - if ( getInstance() ->m_threadList.count() > i ) { - return getInstance() ->m_threadList[ i ].m_datURL; + if (getInstance() ->m_threadList.count() > i) { + return getInstance() ->m_threadList[ i ].m_datUrl; } else { - return QString::null; + return QString(); } } Modified: kita/trunk/kita/src/libkita/favoritethreads.h =================================================================== --- kita/trunk/kita/src/libkita/favoritethreads.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/favoritethreads.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,16 +7,13 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef FAVORITETHREADS_H #define FAVORITETHREADS_H -#include <kurl.h> +#include <QtCore/QList> +#include <QtCore/QString> -#include <qmap.h> -#include <qxml.h> -#include <qptrlist.h> -#include <qdict.h> +#include <kdemacros.h> class QDomNode; @@ -26,35 +23,35 @@ class FavoriteThreadItem { public: - QString m_datURL; + QString m_datUrl; FavoriteThreadItem(); - FavoriteThreadItem( const QString& datURL ) { m_datURL = datURL; } + FavoriteThreadItem(const QString& datUrl) { m_datUrl = datUrl; } ~FavoriteThreadItem(); - bool operator==( const FavoriteThreadItem& item ) const; + bool operator==(const FavoriteThreadItem& item) const; }; -class FavoriteThreads +class KDE_EXPORT FavoriteThreads { static FavoriteThreads* instance; - QValueList<FavoriteThreadItem> m_threadList; + QList<FavoriteThreadItem> m_threadList; FavoriteThreads(); ~FavoriteThreads(); - const QValueList<FavoriteThreadItem> threadList() const; - static void processThreadNode( QDomNode& node ); + const QList<FavoriteThreadItem> threadList() const; + static void processThreadNode(QDomNode& node); public: static FavoriteThreads* getInstance(); - void insert( const QString& datURL ); - void remove( const QString& datURL ); - bool contains( const QString& datURL ); + void insert(const QString& datUrl); + void remove(const QString& datUrl); + bool contains(const QString& datUrl); const QString toXML() const; - static bool readFromXML( const QString& xml ); - static void replace( QString fromURL, QString toURL ); - static QString getDatURL( int i ); + static bool readFromXML(const QString& xml); + static void replace(const QString& fromUrl, const QString& toUrl); + static QString getDatUrl(int i); static int count() { return getInstance() ->m_threadList.count(); } }; Modified: kita/trunk/kita/src/libkita/flashcgi.cpp =================================================================== --- kita/trunk/kita/src/libkita/flashcgi.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/flashcgi.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,31 +9,24 @@ ***************************************************************************/ #include "flashcgi.h" -#include "qcp932codec.h" +#include <QtCore/QTextCodec> -#include <kurl.h> +#include "kita_misc.h" +#include "postdata.h" -FlashCGI::FlashCGI() -{ -} +using namespace Kita; - -FlashCGI::~FlashCGI() +QString FlashCGI::buildPostStr(const PostData& data) { -} - -QString FlashCGI::buildPostStr( const QString & name, const QString & mail, const QString & body, const QString & boardID, const QString & threadID ) -{ QString ret; - QCp932Codec codec; - int mib = codec.mibEnum(); + int mib = m_writeCodec->mibEnum(); - ( ret += "submit=" ) += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ - ( ret += "&FROM=" ) += KURL::encode_string( name, mib ); - ( ret += "&mail=" ) += KURL::encode_string( mail, mib ); - ( ret += "&MESSAGE=" ) += KURL::encode_string( body, mib ); - ( ret += "&bbs=" ) += boardID; - ( ret += "&key=" ) += threadID; + (ret += "submit=") += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ + (ret += "&FROM=") += encodeString(data.name(), mib); + (ret += "&mail=") += encodeString(data.mail(), mib); + (ret += "&MESSAGE=") += encodeString(data.body(), mib); + (ret += "&bbs=") += data.boardId(); + (ret += "&key=") += data.threadId(); return ret; } Modified: kita/trunk/kita/src/libkita/flashcgi.h =================================================================== --- kita/trunk/kita/src/libkita/flashcgi.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/flashcgi.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,19 +10,19 @@ #ifndef FLASHCGI_H #define FLASHCGI_H -#include <qstring.h> +#include <QtCore/QString> -/** - @author Hideki Ikemoto <ikemo****@users*****> -*/ -class FlashCGI { -public: - static QString buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID ); +#include "bbs.h" -private: - FlashCGI(); - ~FlashCGI(); +namespace Kita { + /** + @author Hideki Ikemoto <ikemo****@users*****> + */ + class KDE_EXPORT FlashCGI : public Bbs { + public: + QString buildPostStr(const PostData& data); -}; + }; +} #endif Copied: kita/trunk/kita/src/libkita/globalconfig.kcfg (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/globalconfig.kcfg) =================================================================== --- kita/trunk/kita/src/libkita/globalconfig.kcfg (rev 0) +++ kita/trunk/kita/src/libkita/globalconfig.kcfg 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <kcfgfile name="kitarc" /> + <group name="Global"> + <entry name="Font" type="Font"> + <label>List font.</label> + </entry> + <entry name="ThreadFont" type="Font"> + <label>Thread font.</label> + </entry> + <entry name="PopupFont" type="Font"> + <label>Popup font.</label> + </entry> + <entry name="ShowMailAddress" type="Bool"> + <label>Whether show mail address or not.</label> + <default>false</default> + </entry> + <entry name="UsePart" type="Bool"> + <label>Whether use embedded part or not.</label> + </entry> + <entry name="UseImageViewer" type="Bool"> + <label>Whether use image viewer or not.</label> + </entry> + <entry name="UseImagePopup" type="Bool"> + <label>Whether use image popup or not.</label> + </entry> + <entry name="UseMosaic" type="Bool"> + <label>Whether use mosaic or not.</label> + </entry> + <entry name="UseKitaNavi" type="Bool"> + <label>Whether use kitanavi or not.</label> + </entry> + <entry name="ShowNum" type="Int"> + <label>Number of responses displayed once.</label> + <default>100</default> + </entry> + <entry name="UseStyleSheet" type="Bool"> + <label>Whether use custom stylesheet or not.</label> + <default>false</default> + </entry> + <entry name="MarkTime" type="Int"> + <label>Time marked as newly arrived thread. (0 == after last access.)</label> + <default>24</default> + </entry> + <entry name="AboneChain" type="Bool"> + <label>Whether abone responses recursively (secret config).</label> + <default>false</default> + </entry> + <entry name="CheckResponsed" type="Bool"> + <label>Whether check responsed responses or not (secret config).</label> + </entry> + <entry name="CopyOnClick" type="Bool"> + <label>Whether copy URL on click or not (secret config).</label> + <default>false</default> + </entry> + <entry name="ListSortOrder" type="Enum"> + <label>Choice order of board list.</label> + <choices> + <choice name="Mark" /> + <choice name="ID" /> + </choices> + <default>Mark</default> + </entry> + <entry name="PartMimeList" type="StringList"> + <label>MIME list to use kpart.</label> + <default>image/gif,image/jpeg,image/png,image/x-bmp</default> + </entry> + <entry name="BoardListUrl" type="String"> + <label>URL of board list</label> + <default>http://menu.2ch.net/bbsmenu.html</default> + </entry> + </group> + <group name="Completion"> + <entry name="NameCompletionList" type="StringList"> + <label>Name Completion list.</label> + </entry> + </group> +</kcfg> Copied: kita/trunk/kita/src/libkita/globalconfig.kcfgc (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/globalconfig.kcfgc) =================================================================== --- kita/trunk/kita/src/libkita/globalconfig.kcfgc (rev 0) +++ kita/trunk/kita/src/libkita/globalconfig.kcfgc 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,6 @@ +File=globalconfig.kcfg +ClassName=GlobalConfig +NameSpace=Kita +Singleton=true +Mutators=true +Visibility=KDE_EXPORT Modified: kita/trunk/kita/src/libkita/jbbs.cpp =================================================================== --- kita/trunk/kita/src/libkita/jbbs.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/jbbs.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,33 +9,31 @@ ***************************************************************************/ #include "jbbs.h" -#include "qcp932codec.h" +#include <QtCore/QTextCodec> -#include <kurl.h> +#include "kita_misc.h" +#include "postdata.h" +using namespace Kita; + JBBS::JBBS() { + m_readCodec = QTextCodec::codecForName("eucJP"); } - -JBBS::~JBBS() +QString JBBS::buildPostStr(const PostData& data) { -} - -QString JBBS::buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime ) -{ QString ret; - QCp932Codec codec; - int mib = codec.mibEnum(); + int mib = m_writeCodec->mibEnum(); - ( ret += "submit=" ) += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ - ( ret += "&NAME=" ) += KURL::encode_string( name, mib ); - ( ret += "&MAIL=" ) += KURL::encode_string( mail, mib ); - ( ret += "&MESSAGE=" ) += KURL::encode_string( body, mib ).replace( ";", "%3B" ); - ( ret += "&BBS=" ) += boardID.section( "/", 1, 1 ); - ( ret += "&DIR=" ) += boardID.section( "/", 0, 0 ); - ( ret += "&KEY=" ) += threadID; - ( ret += "&TIME=" ) += QString::number( serverTime ); + ret += "submit=%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ + ret += "&NAME=" + encodeString(data.name(), mib); + ret += "&MAIL=" + encodeString(data.mail(), mib); + ret += "&MESSAGE=" + encodeString(data.body(), mib).replace(';', "%3B"); + ret += "&BBS=" + data.boardId().section('/', 1, 1); + ret += "&DIR=" + data.boardId().section('/', 0, 0); + ret += "&KEY=" + data.threadId(); + ret += "&TIME=" + QString::number(data.serverTime()); return ret; } Modified: kita/trunk/kita/src/libkita/jbbs.h =================================================================== --- kita/trunk/kita/src/libkita/jbbs.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/jbbs.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,19 +10,20 @@ #ifndef JBBS_H #define JBBS_H -#include <qstring.h> +#include <QtCore/QString> -/** - @author Hideki Ikemoto <ikemo****@users*****> -*/ -class JBBS { -public: - static QString buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime ); +#include "bbs.h" -private: - JBBS(); - ~JBBS(); +namespace Kita { + /** + @author Hideki Ikemoto <ikemo****@users*****> + */ + class KDE_EXPORT JBBS : public Bbs { + public: + JBBS(); -}; + QString buildPostStr(const PostData& data); + }; +} #endif Modified: kita/trunk/kita/src/libkita/k2ch.cpp =================================================================== --- kita/trunk/kita/src/libkita/k2ch.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/k2ch.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,47 +9,37 @@ ***************************************************************************/ #include "k2ch.h" -#include "qcp932codec.h" +#include <QtCore/QTextCodec> -#include <kurl.h> +#include "kita_misc.h" +#include "postdata.h" -K2ch::K2ch() -{ -} +using namespace Kita; - -K2ch::~K2ch() +QString K2ch::buildPostStr(const PostData& data) { -} - -QString K2ch::buildPostStr( const QString& name, const QString& mail, - const QString& body, const QString& boardID, - const QString& threadID, int serverTime, - const QString& sessionID ) -{ QString ret; - QCp932Codec codec; - int mib = codec.mibEnum(); + int mib = m_writeCodec->mibEnum(); - ( ret += "submit=" ) += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ + ret += "submit=%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ /* from, mail, message, bbs */ - ( ret += "&FROM=" ) += KURL::encode_string( name, mib ); - ( ret += "&mail=" ) += KURL::encode_string( mail, mib ); - ( ret += "&MESSAGE=" ) += KURL::encode_string( body, mib ); - ( ret += "&bbs=" ) += boardID; - ( ret += "&hana=mogera" ); + ret += "&FROM=" + encodeString(data.name(), mib); + ret += "&mail=" + encodeString(data.mail(), mib); + ret += "&MESSAGE=" + encodeString(data.body(), mib); + ret += "&bbs=" + data.boardId(); + ret += "&tepo=don"; /* key */ - ( ret += "&key=" ) += threadID; + ret += "&key=" + data.threadId(); /* time */ - ( ret += "&time=" ) += QString::number( serverTime ); + ret += "&time=" + QString::number(data.serverTime()); /* login */ - if ( ! sessionID.isEmpty() ) { - ( ret += "&sid=" ) += sessionID; + if (!data.sessionId().isEmpty()) { + ret += "&sid=" + data.sessionId(); } return ret; Modified: kita/trunk/kita/src/libkita/k2ch.h =================================================================== --- kita/trunk/kita/src/libkita/k2ch.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/k2ch.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,18 +10,18 @@ #ifndef K2CH_H #define K2CH_H -#include <qstring.h> -/** - @author Hideki Ikemoto <ikemo****@users*****> -*/ -class K2ch { -public: - static QString buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime, const QString& sessionID ); +#include <QtCore/QString> -private: - K2ch(); - ~K2ch(); +#include "bbs.h" -}; +namespace Kita { + /** + @author Hideki Ikemoto <ikemo****@users*****> + */ + class KDE_EXPORT K2ch : public Bbs { + public: + QString buildPostStr(const PostData& data); + }; +} #endif Modified: kita/trunk/kita/src/libkita/kita-utf16.h =================================================================== --- kita/trunk/kita/src/libkita/kita-utf16.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/kita-utf16.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,10 +7,14 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * **************************************************************************/ +#ifndef KITAUTF16_H +#define KITAUTF16_H /* UTF-16 */ -#define UTF16_BRACKET 0xFF1E /* > */ -#define UTF16_0 0xFF10 /* 0 */ -#define UTF16_9 0xFF19 /* 9 */ -#define UTF16_EQ 0xFF1D /* = */ -#define UTF16_COMMA 0xFF0C /* , */ +const int UTF16_BRACKET = 0xFF1E; /* > */ +const int UTF16_0 = 0xFF10; /* 0 */ +const int UTF16_9 = 0xFF19; /* 9 */ +const int UTF16_EQ = 0xFF1D; /* = */ +const int UTF16_COMMA = 0xFF0C; /* , */ + +#endif Modified: kita/trunk/kita/src/libkita/kita-utf8.h =================================================================== --- kita/trunk/kita/src/libkita/kita-utf8.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/kita-utf8.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,37 +7,39 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * **************************************************************************/ - +#ifndef KITAUTF8_H +#define KITAUTF8_H /* UTF-8 japanese strings */ -#define KITAUTF8_ZENSPACE "ã" -#define KITAUTF8_EXTRACT "æ½åº" -#define KITAUTF8_NOWRENEW " æ´æ°ä¸ã»ã»ã»" -#define KITAUTF8_NOWEXPAND " å±éä¸ã»ã»ã»" -#define KITAUTF8_INCACHE "ãã£ãã·ã¥æ¸" -#define KITAUTF8_KOKOYON "ããã¾ã§èªãã " -#define KITAUTF8_KOKOYON2 "ââââââââââããã¾ã§èªãã ââââââââââ" -#define KITAUTF8_TEMPLATE "ââââââââââãã³ãã¬ã¼ãââââââââââ" -#define KITAUTF8_COLON "ï¼" -#define KITAUTF8_BTITLE "æ¿çæ¿" -#define KITAUTF8_NAME "ååï¼" -#define KITAUTF8_SAIGO "æå¾" -#define KITAUTF8_KOWARE "ããã¯å£ãã¦ãã¾ãã" -#define KITAUTF8_ABONE "ãã¼ã¼ã" -#define KITAUTF8_GOTO "移å" -#define KITAUTF8_FRAME1 "â" -#define KITAUTF8_FRAME2 "â" -#define KITAUTF8_FRAME3 "â" +const char KITAUTF8_ZENSPACE[] = "ã"; +const char KITAUTF8_EXTRACT[] = "æ½åº"; +const char KITAUTF8_NOWRENEW[] = " æ´æ°ä¸ã»ã»ã»"; +const char KITAUTF8_NOWEXPAND[] = " å±éä¸ã»ã»ã»"; +const char KITAUTF8_INCACHE[] = "ãã£ãã·ã¥æ¸"; +const char KITAUTF8_KOKOYON[] = "ããã¾ã§èªãã "; +const char KITAUTF8_KOKOYON2[] = "ââââââââââããã¾ã§èªãã ââââââââââ"; +const char KITAUTF8_TEMPLATE[] = "ââââââââââãã³ãã¬ã¼ãââââââââââ"; +const char KITAUTF8_COLON[] = "ï¼"; +const char KITAUTF8_BTITLE[] = "æ¿çæ¿"; +const char KITAUTF8_NAME[] = "ååï¼"; +const char KITAUTF8_SAIGO[] = "æå¾"; +const char KITAUTF8_KOWARE[] = "ããã¯å£ãã¦ãã¾ãã"; +const char KITAUTF8_ABONE[] = "ãã¼ã¼ã"; +const char KITAUTF8_GOTO[] = "移å"; +const char KITAUTF8_FRAME1[] = "â"; +const char KITAUTF8_FRAME2[] = "â"; +const char KITAUTF8_FRAME3[] = "â"; -#define KITAUTF8_HEART "â¥" -#define KITAUTF8_DIA "â¦" -#define KITAUTF8_CLUB "â£" -#define KITAUTF8_SPADE "â " +const char KITAUTF8_HEART[] = "â¥"; +const char KITAUTF8_DIA[] = "â¦"; +const char KITAUTF8_CLUB[] = "â£"; +const char KITAUTF8_SPADE[] = "â "; /* for writing */ -#define KITAUTF8_WRITEERROR "ERROR" -#define KITAUTF8_WRITETRUE "æ¸ããã¿ã¾ãã" -#define KITAUTF8_WRITECOOKIE "æ¸ãè¾¼ã¿ç¢ºèª" -#define KITAUTF8_WRITECOOKIEMSG "æ稿確èª\nã»æ稿è ã¯ãæ稿ã«é¢ãã¦çºçãã責任ãå ¨ã¦æ稿è ã«å¸°ããã¨ãæ¿è«¾ãã¾ãã\nã»æ稿è ã¯ã話é¡ã¨ç¡é¢ä¿ãªåºåã®æ稿ã«é¢ãã¦ãç¸å¿ã®è²»ç¨ãæ¯æããã¨ãæ¿è«¾ãã¾ã\nã»æ稿è ã¯ãæ稿ãããå 容åã³ããã«å«ã¾ããç¥ç財ç£æ¨©ãï¼èä½æ¨©æ³ç¬¬21æ¡ãªãã第28æ¡ã«è¦å®ããã権å©ãå«ãï¼ãã®ä»ã®æ¨©å©ã«ã¤ãï¼ç¬¬ä¸è ã«å¯¾ãã¦å許諾ãã権å©ãå«ã¿ã¾ããï¼ãæ²ç¤ºæ¿éå¶è ã«å¯¾ããç¡åã§è²æ¸¡ãããã¨ãæ¿è«¾ãã¾ãããã ããæ²ç¤ºæ¿éå¶è ã¯ãæ稿è ã«å¯¾ãã¦æ¥æ¬å½å å¤ã«ããã¦ç¡åã§éç¬å çã«è¤è£½ãå ¬è¡éä¿¡ãé å¸åã³ç¿»è¨³ãã権å©ãæ稿è ã«è¨±è«¾ãã¾ããã¾ããæ稿è ã¯æ²ç¤ºæ¿éå¶è ãæå®ãã第ä¸è ã«å¯¾ãã¦ãä¸åã®æ¨©å©ï¼ç¬¬ä¸è ã«å¯¾ãã¦å許諾ãã権å©ãå«ã¿ã¾ãï¼ã許諾ããªããã¨ãæ¿è«¾ãã¾ãã\nã»æ稿è ã¯ãæ²ç¤ºæ¿éå¶è ãããã¯ãã®æå®ããè ã«å¯¾ãã¦ãèä½è äººæ ¼æ¨©ãä¸åè¡ä½¿ããªããã¨ãæ¿è«¾ãã¾ãã\n\nå ¨è²¬ä»»ãè² ããã¨ãæ¿è«¾ãã¦æ¸ãè¾¼ã¿ã¾ãã\n" -#define KITAUTF8_WRITENEWTHREAD "æ¸ãè¾¼ã¿ã«é¢ãã¦æ§ã ãªãã°æ å ±ãè¨é²ããã¦ãã¾ãã\nå ¬åºè¯ä¿ã«åããããä»äººã«è¿·æããããæ¸ãè¾¼ã¿ã¯æ§ãã¦ä¸ãã" +const char KITAUTF8_WRITEERROR[] = "ERROR"; +const char KITAUTF8_WRITETRUE[] = "æ¸ããã¿ã¾ãã"; +const char KITAUTF8_WRITECOOKIE[] = "æ¸ãè¾¼ã¿ç¢ºèª"; +const char KITAUTF8_WRITECOOKIEMSG[] = "æ稿確èª\nã»æ稿è ã¯ãæ稿ã«é¢ãã¦çºçãã責任ãå ¨ã¦æ稿è ã«å¸°ããã¨ãæ¿è«¾ãã¾ãã\nã»æ稿è ã¯ã話é¡ã¨ç¡é¢ä¿ãªåºåã®æ稿ã«é¢ãã¦ãç¸å¿ã®è²»ç¨ãæ¯æããã¨ãæ¿è«¾ãã¾ã\nã»æ稿è ã¯ãæ稿ãããå 容åã³ããã«å«ã¾ããç¥ç財ç£æ¨©ãï¼èä½æ¨©æ³ç¬¬21æ¡ãªãã第28æ¡ã«è¦å®ããã権å©ãå«ãï¼ãã®ä»ã®æ¨©å©ã«ã¤ãï¼ç¬¬ä¸è ã«å¯¾ãã¦å許諾ãã権å©ãå«ã¿ã¾ããï¼ãæ²ç¤ºæ¿éå¶è ã«å¯¾ããç¡åã§è²æ¸¡ãããã¨ãæ¿è«¾ãã¾ãããã ããæ²ç¤ºæ¿éå¶è ã¯ãæ稿è ã«å¯¾ãã¦æ¥æ¬å½å å¤ã«ããã¦ç¡åã§éç¬å çã«è¤è£½ãå ¬è¡éä¿¡ãé å¸åã³ç¿»è¨³ãã権å©ãæ稿è ã«è¨±è«¾ãã¾ããã¾ããæ稿è ã¯æ²ç¤ºæ¿éå¶è ãæå®ãã第ä¸è ã«å¯¾ãã¦ãä¸åã®æ¨©å©ï¼ç¬¬ä¸è ã«å¯¾ãã¦å許諾ãã権å©ãå«ã¿ã¾ãï¼ã許諾ããªããã¨ãæ¿è«¾ãã¾ãã\nã»æ稿è ã¯ãæ²ç¤ºæ¿éå¶è ãããã¯ãã®æå®ããè ã«å¯¾ãã¦ãèä½è äººæ ¼æ¨©ãä¸åè¡ä½¿ããªããã¨ãæ¿è«¾ãã¾ãã\n\nå ¨è²¬ä»»ãè² ããã¨ãæ¿è«¾ãã¦æ¸ãè¾¼ã¿ã¾ãã\n"; +const char KITAUTF8_WRITENEWTHREAD[] = "æ¸ãè¾¼ã¿ã«é¢ãã¦æ§ã ãªãã°æ å ±ãè¨é²ããã¦ãã¾ãã\nå ¬åºè¯ä¿ã«åããããä»äººã«è¿·æããããæ¸ãè¾¼ã¿ã¯æ§ãã¦ä¸ãã"; +#endif Modified: kita/trunk/kita/src/libkita/kita_misc.cpp =================================================================== --- kita/trunk/kita/src/libkita/kita_misc.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/kita_misc.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,264 +9,76 @@ ***************************************************************************/ #include "kita_misc.h" -#include "qcp932codec.h" -#include "datinfo.h" /* struct RESDAT is defined. */ -#include "kita-utf8.h" -#include "kita-utf16.h" -#include "config_xt.h" -#include "datmanager.h" +#include <QtCore/QRegExp> +#include <QtGui/QFont> + #include <kurl.h> -#include <klocale.h> -#include <kdebug.h> -#include <kdeversion.h> -#include <qregexp.h> -#include <qeucjpcodec.h> -#include <qdir.h> -#include <qmutex.h> -#include <qdatetime.h> +#include "boardmanager.h" +#include "datmanager.h" +#include "kita-utf16.h" -#define KITA_RESDIGIT 4 +using namespace Kita; +/* fro convertURL */ +static int m_prevConvMode; +static QString m_prevConvUrl; +static QString m_prevConvNewUrl; +static QString m_prevConvRefstr; -namespace Kita -{ - static QCp932Codec* qcpCodec = NULL; - static QTextCodec* utf8Codec = NULL; - static QTextCodec* eucCodec = NULL; +/* for ParseMachiBBSOneLine */ +static QString m_machiSubject; +static QString m_machiLine; - static QString m_weekstr[ 7 ]; - static QString m_colonstr; - static QString m_colonnamestr; - - /* fro convertURL */ - static int m_prevConvMode; - static QString m_prevConvURL; - static QString m_prevConvNewURL; - static QString m_prevConvRefstr; - - /* for ParseMachiBBSOneLine */ - static QString m_machiSubject; - static QString m_machiLine; -} - - -/*---------------------------------------------------*/ - -/* Text codecs */ - - -QString Kita::qcpToUnicode( const QString& str ) -{ - if ( !Kita::qcpCodec ) Kita::qcpCodec = new QCp932Codec(); - - return Kita::qcpCodec->toUnicode( str ); -} - - -QString Kita::utf8ToUnicode( const QString& str ) -{ - if ( !Kita::utf8Codec ) Kita::utf8Codec = QTextCodec::codecForName( "utf8" ); - - return Kita::utf8Codec->toUnicode( str ); -} - - -QString Kita::eucToUnicode( const QString& str ) -{ - if ( !Kita::eucCodec ) Kita::eucCodec = QTextCodec::codecForName( "eucJP" ); - - return Kita::eucCodec->toUnicode( str ); -} - - - /*------------------------------------------------------------*/ /*------------------------------------------------------------*/ -/* conversion of DAT */ - - -/* get HTML from raw data */ -QString Kita::datToHtml( const QString& rawData, int num ) -{ - QString retHTML, subject, titleHTML; - RESDAT resdat; - - resdat.num = num; - resdat.linestr = rawData; - resdat.parsed = FALSE; - parseResDat( resdat, subject ); - createTitleHTML( resdat, titleHTML ); - - retHTML = "<div class=\"res_title\">" + titleHTML + "</div>"; - retHTML += "<div class=\"res_body\">" + resdat.bodyHTML + "</div>"; - - return retHTML; -} - - -/* get plain text from raw data */ -/* - This function replaces "<br>" to "\n", removes HTML tags and - replaces special chars. -*/ -void Kita::DatToText( - - /* input */ - const QString &rawData, - - /* output */ - QString& text -) -{ - text = QString::null; - - unsigned int startPos, pos; - const QChar *chpt = rawData.unicode(); - unsigned int length = rawData.length(); - - for ( unsigned int i = startPos = 0 ; i < length ; i++ ) { - - switch ( chpt[ i ].unicode() ) { - - case '<': - - /* " <br> " */ - if ( chpt[ i + 1 ] == 'b' && chpt[ i + 2 ] == 'r' && chpt[ i + 3 ] == '>' ) { - - unsigned int i2 = i - startPos; - if ( i > 0 && chpt[ i - 1 ] == ' ' ) i2--; /* remove space before <br> */ - text += rawData.mid( startPos, i2 ) + '\n'; - startPos = i + 4; - if ( chpt[ startPos ] == ' ' ) startPos++; /* remove space after <br> */ - i = startPos - 1; - } - - /*----------------------------------------*/ - - /* remove HTML tags <[^>]*> */ - else { - - if ( i - startPos ) text += rawData.mid( startPos, i - startPos ); - while ( chpt[ i ] != '>' && i < length ) i++; - startPos = i + 1; - } - - break; - - - /*----------------------------------*/ - - case '&': - - /* special char */ - { - QString tmpstr; - tmpstr = parseSpecialChar( chpt + i, pos ); - - if ( tmpstr != QString::null ) { - text += rawData.mid( startPos, i - startPos ) + tmpstr; - startPos = i + pos; - i = startPos - 1; - } - } - - break; - } - } - - text += rawData.mid( startPos ); -} - - -/* parsing function for special char (such as ♥ */ - -/* For example, if cdat = "&", then - - pos (= length of cdat) = 5, - retstr = "&". */ -QString Kita::parseSpecialChar( - - /* input */ - const QChar *cdat, - - /* output */ - unsigned int& pos ) -{ - QString retstr = QString::null; - - if ( ( pos = isEqual( cdat , ">" ) ) ) retstr = ">"; - else if ( ( pos = isEqual( cdat , "<" ) ) ) retstr = "<"; - else if ( ( pos = isEqual( cdat , " " ) ) ) retstr = " "; - else if ( ( pos = isEqual( cdat , "&" ) ) ) retstr = "&"; - else if ( ( pos = isEqual( cdat , """ ) ) ) retstr = "\""; - - else if ( ( pos = isEqual( cdat , "♥" ) ) ) - retstr = utf8ToUnicode( KITAUTF8_HEART ); - - else if ( ( pos = isEqual( cdat , "♦" ) ) ) - retstr = utf8ToUnicode( KITAUTF8_DIA ); - - else if ( ( pos = isEqual( cdat , "♣" ) ) ) - retstr = utf8ToUnicode( KITAUTF8_CLUB ); - - else if ( ( pos = isEqual( cdat , "♠" ) ) ) - retstr = utf8ToUnicode( KITAUTF8_SPADE ); - - return retstr; -} - - -/*------------------------------------------------------------*/ -/*------------------------------------------------------------*/ - /* conversion of URL */ -KURL Kita::getDatURL( const KURL& url , QString& refstr ) +KUrl Kita::getDatUrl(const KUrl& url , QString& refstr) { - return convertURL( URLMODE_DAT, url, refstr ); + return convertUrl(URLMODE_DAT, url, refstr); } -KURL Kita::getDatURL( const KURL& url ) +KUrl Kita::getDatUrl(const KUrl& url) { QString refstr; - return convertURL( URLMODE_DAT, url, refstr ); + return convertUrl(URLMODE_DAT, url, refstr); } -QString Kita::getThreadURL( const KURL& url, QString& refstr ) +QString getThreadUrl(const KUrl& url, QString& refstr) { - return convertURL( URLMODE_THREAD, url, refstr ); + return convertUrl(URLMODE_THREAD, url, refstr); } -QString Kita::getThreadURL( const KURL& url ) +QString Kita::getThreadUrl(const KUrl& url) { QString refstr; - return convertURL( URLMODE_THREAD, url, refstr ); + return convertUrl(URLMODE_THREAD, url, refstr); } -QString Kita::getNewThreadWriteURL( const KURL& m_datURL ) +QString Kita::getWriteUrl(const KUrl& m_datUrl) { - int m_bbstype = Kita::BoardManager::type( m_datURL ); + int m_bbstype = BoardManager::type(m_datUrl); QString m_bbscgi; /* set path of bbs.cgi */ - switch ( m_bbstype ) { + switch (m_bbstype) { - case Kita::Board_JBBS: { - QString cgipath = Kita::BoardManager::boardRoot( m_datURL ) - + "/bbs/write.cgi/" + Kita::BoardManager::boardID( m_datURL ) + "/"; + case Board_JBBS: { + QString cgipath = BoardManager::boardRoot(m_datUrl) + + "/bbs/write.cgi/" + BoardManager::boardId(m_datUrl) + '/'; - cgipath += "new/"; + cgipath += DatManager(m_datUrl).threadId() + '/'; m_bbscgi = cgipath; } break; - case Kita::Board_MachiBBS: { - QString cgipath = Kita::BoardManager::boardRoot( m_datURL ) + case Board_MachiBBS: { + QString cgipath = BoardManager::boardRoot(m_datUrl) + "/bbs/write.cgi"; m_bbscgi = cgipath; } @@ -275,52 +87,17 @@ default: - m_bbscgi = Kita::BoardManager::boardRoot( m_datURL ) + "/test/bbs.cgi"; + m_bbscgi = BoardManager::boardRoot(m_datUrl) + "/test/bbs.cgi"; } return m_bbscgi; } -QString Kita::getWriteURL( const KURL& m_datURL ) -{ - int m_bbstype = Kita::BoardManager::type( m_datURL ); - QString m_bbscgi; - - /* set path of bbs.cgi */ - switch ( m_bbstype ) { - - case Kita::Board_JBBS: { - QString cgipath = Kita::BoardManager::boardRoot( m_datURL ) - + "/bbs/write.cgi/" + Kita::BoardManager::boardID( m_datURL ) + "/"; - - cgipath += Kita::DatManager::threadID( m_datURL ) + "/"; - - m_bbscgi = cgipath; - } - - break; - - case Kita::Board_MachiBBS: { - QString cgipath = Kita::BoardManager::boardRoot( m_datURL ) - + "/bbs/write.cgi"; - m_bbscgi = cgipath; - } - - break; - - default: - - m_bbscgi = Kita::BoardManager::boardRoot( m_datURL ) + "/test/bbs.cgi"; - } - - return m_bbscgi; -} - /* convert thread URL, and get reference. If mode = URLMODE_DAT, output is URL of dat file. If mode = URLMODE_THREAD, output is URL of read.cgi . - If url is NOT enrolled, return QString::null. + If url is NOT enrolled, return QString(). (ex.1) @@ -347,96 +124,96 @@ refstr : 1-100 */ -QString Kita::convertURL( +QString Kita::convertUrl( /* input */ int mode, /* if 0, output is dat URL. If 1, output is thread URL */ - const KURL& url , + const KUrl& url , /* output */ - QString& refstr ) + QString& refstr) { - refstr = QString::null; + refstr.clear(); - if ( url.isEmpty() ) return QString::null; + if (url.isEmpty()) return QString(); /* cache */ - if ( m_prevConvMode == mode && m_prevConvURL == url.prettyURL() ) { + if (m_prevConvMode == mode && m_prevConvUrl == url.prettyUrl()) { refstr = m_prevConvRefstr; - return m_prevConvNewURL; + return m_prevConvNewUrl; } /* Is board enrolled ? */ - BoardData* bdata = Kita::BoardManager::getBoardData( url ); - if ( bdata == NULL ) return QString::null; + BoardData* bdata = BoardManager::getBoardData(url); + if (bdata == 0) return QString(); - QString urlstr = url.prettyURL(); + QString urlstr = url.prettyUrl(); /* get thread & reference */ - QString thread = QString::null; - QString refBase = QString::null;; + QString thread; + QString refBase; - if ( urlstr.contains( "/dat/" ) ) { + if (urlstr.contains("/dat/")) { /* url = (hostname)/(rootPath)/(bbsPath)/dat/(thread_ID).(ext)#(refBase) */ - thread = url.filename().remove( bdata->ext() ); + thread = url.fileName().remove(bdata->ext()); refBase = url.ref(); - } else if ( urlstr.contains( bdata->delimiter() ) ) { + } else if (urlstr.contains(bdata->delimiter())) { QString tmpstr; - switch ( bdata->type() ) { + switch (bdata->type()) { /* machi BBS */ /* ex.) If url = http://kanto.machi.to/bbs/read.pl?BBS=kana&KEY=1096716679 , then, thread = 1096716679 */ case Board_MachiBBS: - thread = url.queryItem( "KEY" ); - refBase = QString::null; + thread = url.queryItem("KEY"); + refBase.clear(); break; /* url = (hostname)/(rootPath)/(delimiter)/(bbsPath)/(thread_ID)/(refBase) */ default: - tmpstr = urlstr.section( bdata->delimiter() + bdata->bbsPath(), 1, 1 ); - thread = tmpstr.section( '/', 1, 1 ); - refBase = tmpstr.section( '/', 2, 2 ); + tmpstr = urlstr.section(bdata->delimiter() + bdata->bbsPath(), 1, 1); + thread = tmpstr.section('/', 1, 1); + refBase = tmpstr.section('/', 2, 2); break; } } - if ( thread == QString::null ) return QString::null; + if (thread.isEmpty()) return QString(); - if ( refBase != QString::null ) { + if (!refBase.isEmpty()) { - if ( refBase.at( 0 ) == '-' ) refstr = "1" + refBase; + if (refBase.at(0) == '-') refstr = '1' + refBase; else refstr = refBase; } /* create new URL */ - QString newURL; - if ( mode == URLMODE_DAT ) newURL = bdata->basePath() + "dat/" + thread + bdata->ext(); + QString newUrl; + if (mode == URLMODE_DAT) newUrl = bdata->basePath() + "dat/" + thread + bdata->ext(); else { - newURL = bdata->cgiBasePath(); + newUrl = bdata->cgiBasePath(); - switch ( bdata->type() ) { + switch (bdata->type()) { case Board_MachiBBS: - newURL += "&KEY=" + thread; + newUrl += "&KEY=" + thread; break; default: - newURL += thread; + newUrl += thread; break; } } /* cache */ m_prevConvMode = mode; - m_prevConvURL = url.prettyURL(); - m_prevConvNewURL = newURL; + m_prevConvUrl = url.prettyUrl(); + m_prevConvNewUrl = newUrl; m_prevConvRefstr = refstr; - return newURL; + return newUrl; } @@ -445,27 +222,27 @@ * http://pc5.2ch.net/linux/dat/1089905503.dat * -> http://pc5.2ch.net/test/offlaw.cgi?bbs=linux&key=1089905503 */ -QString Kita::datToOfflaw( const KURL& datURL ) +QString Kita::datToOfflaw(const KUrl& datUrl) { /* TODO: not tested. */ - KURL url( datURL ); + KUrl url(datUrl); QString root = url.host(); - QStringList list = QStringList::split( ".", url.fileName() ); - if ( list.size() != 2 ) { - return QString::null; + QStringList list = url.fileName().split('.'); + if (list.size() != 2) { + return QString(); } QString datName = list[ 0 ]; - url.cd( ".." ); - if ( url.fileName() != "dat" ) { - return QString::null; + url.cd(".."); + if (url.fileName() != "dat") { + return QString(); } - url.cd( ".." ); + url.cd(".."); QString board = url.fileName(); - return QString( "http://%1/test/offlaw.cgi?raw=0.0&bbs=%2&key=%3" ).arg( root ).arg( board ).arg( datName ); + return QString("http://%1/test/offlaw.cgi?raw=0.0&bbs=%2&key=%3").arg(root).arg(board).arg(datName); } @@ -474,73 +251,31 @@ /* utilities */ -/* create directory recursively */ -bool Kita::mkdir( const QString& targetPath ) +uint Kita::datToSince(const KUrl& datUrl) { - QDir qdir( targetPath ); - if ( !qdir.exists() ) { - - QStringList pathList = QStringList::split( "/", targetPath ); - QString path = QString::null; - - for ( unsigned int i = 0; i < pathList.count(); ++i ) { - - path += "/" + pathList[ i ]; - - qdir = path; - if ( !qdir.exists() ) { - if ( !qdir.mkdir( path ) ) return FALSE; - } - } - } - - return TRUE; + return KUrl(datUrl).fileName().section('.', 0, 0).toInt(); } -QString Kita::unescape( const QString& str ) -{ - QString ret = str; - return ret.replace( "<", "<" ).replace( ">", ">" ).replace( "&", "&" ); -} - -uint Kita::datToSince( const KURL& datURL ) -{ - return KURL( datURL ).fileName().section( '.', 0, 0 ).toInt(); -} - - -/* if cdat == str, return str.length() */ -int Kita::isEqual( const QChar *cdat, const QString& str ) -{ - int i = 0; - while ( str.at( i ) != '\0' ) { - if ( *cdat != str.at( i ) ) return 0; - cdat++;i++; - } - return i; -} - - /* convert strings to positive number. */ /* if cdat is not number, return -1. */ /* For example, if cdat = "1234", then ret = 1234. If cdat = "abcd", then ret = -1. */ -int Kita::stringToPositiveNum( const QChar *cdat, const unsigned int length ) +int Kita::stringToPositiveNum(const QChar *cdat, const unsigned int length) { int ret = 0; - for ( unsigned int i = 0 ; i < length ; i++ ) { + for (unsigned int i = 0 ; i < length ; i++) { unsigned short c = cdat[ i ].unicode(); - if ( ( c < UTF16_0 || c > UTF16_9 ) && ( c < '0' || c > '9' ) ) return -1; + if ((c < UTF16_0 || c > UTF16_9) && (c < '0' || c > '9')) return -1; ret *= 10; - if ( c >= UTF16_0 ) ret += c - UTF16_0; + if (c >= UTF16_0) ret += c - UTF16_0; else ret += c - '0'; } @@ -554,14 +289,14 @@ /* internal parsing functions */ -QStringList Kita::parseSearchQuery( const QString& input ) +QStringList Kita::parseSearchQuery(const QString& input) { - QStringList tmp = QStringList::split( ' ', input ); + QStringList tmp = input.split(' '); QStringList ret_list; - QRegExp truncSpace( "\\s*$" ); + QRegExp truncSpace("\\s*$"); QStringList::iterator it = tmp.begin(); - for ( ; it != tmp.end(); ++it ) - ret_list += ( *it ).replace( truncSpace, "" ); + for (; it != tmp.end(); ++it) + ret_list += (*it).remove(truncSpace); return ret_list; } @@ -572,104 +307,104 @@ /* init parser. Don't forget to call this before parsing. */ void Kita::InitParseMachiBBS() { - m_machiSubject = QString::null; - m_machiLine = QString::null; + m_machiSubject.clear(); + m_machiLine.clear(); } -QString Kita::ParseMachiBBSOneLine( const QString& inputLine, int& nextNum ) +QString Kita::ParseMachiBBSOneLine(const QString& inputLine, int& nextNum) { - QString ret = QString::null; + QString ret; m_machiLine += inputLine; int num = 0; - QString name = QString::null; - QString mail = QString::null; - QString date = QString::null; - QString time = QString::null; - QString id = QString::null; - QString host = QString::null; - QString message = QString::null; + QString name; + QString mail; + QString date; + QString time; + QString id; + QString host; + QString message; // Subject - QRegExp title_regexp( "<title>(.*)</title>" ); + QRegExp title_regexp("<title>(.*)</title>"); // pattern 1 (tokyo,kanagawa,...) - QRegExp regexp ( "<dt>(\\d*) .*<font color=\"#......\"><b> (.*) </b></font> .* (..../../..).* (..:..:..) ID:([^<]*)<br><dd>(.*)" ); - QRegExp regexp2( "<dt>(\\d*) .*<a href=\"mailto:(.*)\"><b> (.*) </B></a> .* (..../../..).* (..:..:..) ID:([^<]*)<br><dd>(.*)" ); + QRegExp regexp ("<dt>(\\d*) .*<font color=\"#......\"><b> (.*) </b></font> .* (..../../..).* (..:..:..) ID:([^<]*)<br><dd>(.*)"); + QRegExp regexp2("<dt>(\\d*) .*<a href=\"mailto:(.*)\"><b> (.*) </B></a> .* (..../../..).* (..:..:..) ID:([^<]*)<br><dd>(.*)"); // pattern 2 (hokkaido,...) - QRegExp regexp3( "<dt>(\\d*) .*<font color=\"#......\"><b> (.*) </b></font> .* (..../../..).* (..:..:..) ID:([^<]*) <font size=.>\\[ ([^ ]*) \\]</font><br><dd>(.*)" ); - QRegExp regexp4( "<dt>(\\d*) .*<a href=\"mailto:(.*)\"><b> (.*) </B></a> .* (..../../..).* (..:..:..) ID:([^<]*) <font size=.>\\[ ([^ ]*) \\]</font><br><dd>(.*)" ); + QRegExp regexp3("<dt>(\\d*) .*<font color=\"#......\"><b> (.*) </b></font> .* (..../../..).* (..:..:..) ID:([^<]*) <font size=.>\\[ ([^ ]*) \\]</font><br><dd>(.*)"); + QRegExp regexp4("<dt>(\\d*) .*<a href=\"mailto:(.*)\"><b> (.*) </B></a> .* (..../../..).* (..:..:..) ID:([^<]*) <font size=.>\\[ ([^ ]*) \\]</font><br><dd>(.*)"); /* abone */ - QRegExp regexp5( "<dt>(\\d*) .*<br><dd>.*" ); + QRegExp regexp5("<dt>(\\d*) .*<br><dd>.*"); - if ( regexp.search( m_machiLine ) != -1 ) { + if (regexp.indexIn(m_machiLine) != -1) { - num = regexp.cap( 1 ).toInt(); - name = regexp.cap( 2 ); - date = regexp.cap( 3 ); - time = regexp.cap( 4 ); - id = regexp.cap( 5 ); - message = regexp.cap( 6 ); + num = regexp.cap(1).toInt(); + name = regexp.cap(2); + date = regexp.cap(3); + time = regexp.cap(4); + id = regexp.cap(5); + message = regexp.cap(6); - } else if ( regexp2.search( m_machiLine ) != -1 ) { + } else if (regexp2.indexIn(m_machiLine) != -1) { - num = regexp2.cap( 1 ).toInt(); - mail = regexp2.cap( 2 ); - name = regexp2.cap( 3 ); - date = regexp2.cap( 4 ); - time = regexp2.cap( 5 ); - id = regexp2.cap( 6 ); - message = regexp2.cap( 7 ); + num = regexp2.cap(1).toInt(); + mail = regexp2.cap(2); + name = regexp2.cap(3); + date = regexp2.cap(4); + time = regexp2.cap(5); + id = regexp2.cap(6); + message = regexp2.cap(7); - } else if ( regexp3.search( m_machiLine ) != -1 ) { + } else if (regexp3.indexIn(m_machiLine) != -1) { - num = regexp3.cap( 1 ).toInt(); - name = regexp3.cap( 2 ); - date = regexp3.cap( 3 ); - time = regexp3.cap( 4 ); - id = regexp3.cap( 5 ); - host = regexp3.cap( 6 ); - message = regexp3.cap( 7 ); + num = regexp3.cap(1).toInt(); + name = regexp3.cap(2); + date = regexp3.cap(3); + time = regexp3.cap(4); + id = regexp3.cap(5); + host = regexp3.cap(6); + message = regexp3.cap(7); - } else if ( regexp4.search( m_machiLine ) != -1 ) { + } else if (regexp4.indexIn(m_machiLine) != -1) { - num = regexp4.cap( 1 ).toInt(); - mail = regexp4.cap( 2 ); - name = regexp4.cap( 3 ); - date = regexp4.cap( 4 ); - time = regexp4.cap( 5 ); - id = regexp4.cap( 6 ); - host = regexp4.cap( 7 ); - message = regexp4.cap( 8 ); + num = regexp4.cap(1).toInt(); + mail = regexp4.cap(2); + name = regexp4.cap(3); + date = regexp4.cap(4); + time = regexp4.cap(5); + id = regexp4.cap(6); + host = regexp4.cap(7); + message = regexp4.cap(8); - } else if ( regexp5.search( m_machiLine ) != -1 ) { /* abone */ + } else if (regexp5.indexIn(m_machiLine) != -1) { /* abone */ - num = regexp5.cap( 1 ).toInt(); - m_machiLine = QString::null; - if ( num == nextNum ) return "abone<><><>abone<>"; - else return QString::null; + num = regexp5.cap(1).toInt(); + m_machiLine.clear(); + if (num == nextNum) return "abone<><><>abone<>"; + else return QString(); - } else if ( title_regexp.search( m_machiLine ) != -1 ) { /* get title */ + } else if (title_regexp.indexIn(m_machiLine) != -1) { /* get title */ - m_machiSubject = title_regexp.cap( 1 ); - m_machiLine = QString::null; - return QString::null; + m_machiSubject = title_regexp.cap(1); + m_machiLine.clear(); + return QString(); } - else return QString::null; + else return QString(); - if ( num >= nextNum ) { + if (num >= nextNum) { - if ( num != 1 ) m_machiSubject = QString::null; - ret += name + "<><>" + date + " " + time + " ID:" + id; - if ( host != QString::null ) ret += " HOST:" + host; + if (num != 1) m_machiSubject.clear(); + ret += name + "<><>" + date + ' ' + time + " ID:" + id; + if (!host.isEmpty()) ret += " HOST:" + host; ret += "<>" + message + "<>" + m_machiSubject; nextNum = num; } - m_machiLine = QString::null; + m_machiLine.clear(); return ret; } @@ -678,11 +413,11 @@ /* for JBBS */ -QString Kita::ParseJBBSOneLine( const QString& line, int& nextNum ) +QString Kita::ParseJBBSOneLine(const QString& line, int& nextNum) { - QString ret = QString::null; - QStringList list = QStringList::split( "<>", line, TRUE ); - if ( list.size() != 7 ) return QString::null; + QString ret; + QStringList list = line.split("<>"); + if (list.size() != 7) return QString(); int num = list[ 0 ].toInt(); QString name = list[ 1 ]; @@ -692,15 +427,15 @@ QString subject = list[ 5 ]; QString id = list[ 6 ]; - if ( num < nextNum ) return QString::null; + if (num < nextNum) return QString(); /* remove tag */ - QRegExp rex( "<[^<]*>" ); - name.remove( rex ); + QRegExp rex("<[^<]*>"); + name.remove(rex); /* remove week */ - rex = QRegExp( "\\(.*\\)" ); - date.remove( rex ); + rex = QRegExp("\\(.*\\)"); + date.remove(rex); ret += name + "<>" + mail + "<>" + date + " ID:" + id + "<>" + body + "<>" + subject; nextNum = num; @@ -713,11 +448,11 @@ /* for Flash CGI/Mini Thread */ -QString Kita::ParseFlashCGIOneLine( const QString& line ) +QString Kita::ParseFlashCGIOneLine(const QString& line) { - QString ret = QString::null; - QStringList list = QStringList::split( "<>", line, TRUE ); - if ( list.size() != 13 ) return QString::null; + QString ret; + QStringList list = line.split("<>"); + if (list.size() != 13) return QString(); QString name = list[ 0 ]; QString mail = list[ 1 ]; @@ -728,11 +463,11 @@ QString host = list[ 7 ]; /* remove tag */ - QRegExp rex( "<[^<]*>" ); - name.remove( rex ); + QRegExp rex("<[^<]*>"); + name.remove(rex); ret += name + "<>" + mail + "<>" + date + " ID:" + id; - if ( host != QString::null ) ret += " HOST:" + host; + if (!host.isEmpty()) ret += " HOST:" + host; ret += "<>" + body + "<>" + subject; return ret; @@ -747,662 +482,33 @@ /*-------------------------------------------------*/ /*-------------------------------------------------*/ - -/* Main Parser */ - -/* - struct RESDAT is defined in datinfo.h. - This function is called from Kita::DatToHtml() and DatInfo::parseDat() - - input: - - resdat.num ... number - resdat.linestr ... raw line strings - - output: - - resdat.* - subject -*/ -bool Kita::parseResDat( RESDAT& resdat, QString& subject ) +QString Kita::getCategory(const QString& line) { - if ( resdat.parsed ) return TRUE; - - resdat.parsed = TRUE; - resdat.broken = FALSE; - resdat.anclist.clear(); - - /* search the staring positions of each section to split raw data. */ - const QChar *chpt = resdat.linestr.unicode(); - unsigned int length = resdat.linestr.length(); - unsigned int section = 0; - unsigned int sectionPos[ 5 ]; - for ( unsigned int i = 0 ; i < length ; i++ ) { - - /* sections are splitted by "<>" */ - if ( chpt[ i ] == '<' && chpt[ i + 1 ] == '>' ) { - section++; - - - if ( section >= 5 ) { - resdat.broken = TRUE; - return TRUE; - } - - sectionPos[ section ] = i + 2; - i++; - } - } - - /* broken data */ - if ( section != 4 ) { - resdat.broken = TRUE; - return TRUE; - } - - // qDebug("[%d] %d %d %d %d",section, sectionPos[1],sectionPos[2],sectionPos[3],sectionPos[4] ); - - /* name */ - length = sectionPos[ 1 ] - 2 ; - parseName( resdat.linestr.mid( 0, length ), resdat ); - - /* mail */ - length = sectionPos[ 2 ] - 2 - sectionPos[ 1 ]; - DatToText( resdat.linestr.mid( sectionPos[ 1 ], length ), resdat.address ); - - /* date, ID, host */ - length = sectionPos[ 3 ] - 2 - sectionPos[ 2 ]; - parseDateId( resdat.linestr.mid( sectionPos[ 2 ], length ), resdat ); - - /* body */ - length = sectionPos[ 4 ] - 2 - sectionPos[ 3 ]; - parseBody( resdat.linestr.mid( sectionPos[ 3 ], length ), resdat ); - - /* subject */ - subject = resdat.linestr.mid( sectionPos[ 4 ] ); - - return TRUE; -} - - -/* parse name */ - -/* output: - - resdat.name - resdat.nameHTML - -*/ -void Kita::parseName( const QString& rawStr, RESDAT& resdat ) -{ - unsigned int i = 0, pos; - int refNum[ 2 ]; - QString linkurl, linkstr; - - DatToText( rawStr, resdat.name ); - - const QChar * chpt = resdat.name.unicode(); - unsigned int length = resdat.name.length(); - resdat.nameHTML = QString::null; - - /* anchor */ - while ( parseResAnchor( chpt + i, length - i, linkstr, refNum, pos ) ) { - - linkurl = QString( "#%1" ).arg( refNum[ 0 ] ); - if ( refNum[ 1 ] ) linkurl += QString( "-%1" ).arg( refNum[ 1 ] ); - - resdat.nameHTML += "<a href=\"" + linkurl + "\">"; - resdat.nameHTML += linkstr; - resdat.nameHTML += "</a>"; - - ANCNUM anctmp; - if ( refNum[ 1 ] < refNum[ 0 ] ) refNum[ 1 ] = refNum[ 0 ]; - anctmp.from = refNum[ 0 ]; - anctmp.to = refNum[ 1 ]; - resdat.anclist += anctmp; - - i += pos; - } - - /* non-digits strings */ - if ( i < length ) { - - resdat.nameHTML += "<span class=\"name_noaddr\">"; - resdat.nameHTML += resdat.name.mid( i ); - resdat.nameHTML += "</span>"; - } - -} - - -/* parse date, ID, host */ - -/* output : - - resdat.dateTime - resdat.date - resdat.id - resdat.host - -*/ -void Kita::parseDateId( const QString& rawStr, RESDAT& resdat ) -{ - resdat.date = rawStr; - resdat.id = QString::null; - resdat.host = QString::null; - resdat.be = QString::null; - resdat.bepointmark = QString::null; - - const QChar *chpt = rawStr.unicode(); - unsigned int pos = 0, startpos = 0; - unsigned int length = rawStr.length(); - - while ( chpt[ pos ] != '\0' && - !( chpt[ pos ] == 'I' && chpt[ pos + 1 ] == 'D' ) && - !( chpt[ pos ] == 'B' && chpt[ pos + 1 ] == 'E' ) ) { - pos++; - } - resdat.date = rawStr.left( pos ); - - /* id */ - if ( chpt[ pos ] == 'I' && chpt[ pos + 1 ] == 'D' ) { - pos += 3; - startpos = pos; - while ( chpt[ pos ] != ' ' && pos++ < length ); - resdat.id = rawStr.mid( startpos, pos - startpos ); - pos++; - } - - // qDebug("date %s, ID %s", (const char*)resdat.date.local8Bit(), resdat.id.ascii() ); - - if ( pos >= length ) return ; - - /* be */ - if ( chpt[ pos ] == 'B' && chpt[ pos + 1 ] == 'E' ) { - pos += 3; - startpos = pos; - while ( chpt[ pos ] != '-' && pos++ < length ); - resdat.be = rawStr.mid( startpos, pos - startpos ); - pos++; - if ( pos < length && chpt[ pos ] == '#') { - startpos = pos; - while ( chpt[ pos ] == '#' && pos++ < length ); - resdat.bepointmark = rawStr.mid( startpos, pos - startpos ); - } - } - - if ( pos >= length ) return ; - - /* host */ - if ( chpt[ pos ] == 'H' && chpt[ pos + 1 ] == 'O' ) { - pos += 5; - startpos = pos; - while ( chpt[ pos ] != ' ' && pos++ < length ); - resdat.host = rawStr.mid( startpos, pos - startpos ); - pos++; - // qDebug("host %s", resdat.host.ascii()); - } -} - - - -/* parse body */ - -/* output : - - resdat.bodyHTML - -*/ -void Kita::parseBody( const QString &rawStr, RESDAT& resdat ) -{ - resdat.bodyHTML = QString::null; - - unsigned int startPos, pos; - QString linkstr, linkurl; - const QChar *chpt = rawStr.unicode(); - unsigned int length = rawStr.length(); - - bool ancChain = FALSE; - - /* ancChain is chain for anchor. For examle, if anchor ">2" - appeared, ancChain is set to TRUE. Moreover, if next strings - are "=5", anchor for 5 is also set. Thus, we can obtain anchors - for strings ">2=5" as follows: - - <a href="#2">>2</a><a href="#5">=5</a> - */ - - int offset = 0; - if ( chpt[ 0 ] == ' ' ) offset = 1; /* remove one space after <> */ - for ( unsigned int i = startPos = offset ; i < length ; i++ ) { - - switch ( chpt[ i ].unicode() ) { - - case '<': - - /* " <br> " */ - if ( chpt[ i + 1 ] == 'b' && chpt[ i + 2 ] == 'r' && chpt[ i + 3 ] == '>' ) { - - /* reset anchor chain */ - ancChain = FALSE; - - unsigned int i2 = i - startPos; - if ( i > 0 && chpt[ i - 1 ] == ' ' ) i2--; /* remove space before <br> */ - resdat.bodyHTML += rawStr.mid( startPos, i2 ); - - resdat.bodyHTML += "<br>"; - - startPos = i + 4; - if ( chpt[ startPos ] == ' ' ) startPos++; /* remove space after <br> */ - i = startPos - 1; - } - - /*----------------------------------------*/ - - /* remove HTML tags <[^>]*> */ - else { - - if ( i - startPos ) resdat.bodyHTML += rawStr.mid( startPos, i - startPos ); - while ( chpt[ i ] != '>' && i < length ) i++; - startPos = i + 1; - } - - break; - - /*----------------------------------------*/ - - case 'h': /* "http://" or "ttp://" or "tp:" */ - case 't': - - if ( parseLink( chpt + i, length - i, linkstr, linkurl, pos ) ) { - - resdat.bodyHTML += rawStr.mid( startPos, i - startPos ); - resdat.bodyHTML += "<a href=\"" + linkurl + "\">"; - resdat.bodyHTML += linkstr; - resdat.bodyHTML += "</a>"; - - startPos = i + pos; - i = startPos - 1; - } - - break; - - /*----------------------------------*/ - - case '&': - - /* > */ - if ( chpt[ i + 1 ] == 'g' && chpt[ i + 2 ] == 't' && chpt[ i + 3 ] == ';' ) - ancChain = createResAnchor( rawStr, resdat, chpt, i, startPos ); - - break; - - /*----------------------------------------*/ - - /* unicode '>' */ - case UTF16_BRACKET: - - ancChain = createResAnchor( rawStr, resdat, chpt, i, startPos ); - break; - - /*----------------------------------*/ - - default: - - if ( ancChain ) ancChain = createResAnchor( rawStr, resdat, chpt, i, startPos ); - } - } - - resdat.bodyHTML += rawStr.mid( startPos ); -} - - - -/* parsing function for link */ - -/* For example, - - cdat = "ttp://foo.com", - - then - - linkstr = "ttp://foo.com", - linkurl = "http://foo.com", - pos (= length of cdat) = 13, - - and return TRUE. - */ -bool Kita::parseLink( - - /* input */ - const QChar *cdat, const unsigned int length, - - /* output */ - QString& linkstr, QString& linkurl, unsigned int& pos -) -{ - - /*-----------------------------*/ - - linkstr = QString::null; - linkurl = QString::null; - - QString retlinkstr = QString::null; - QString prefix = QString::null; - QString scheme = QString::null; - - if ( isEqual( cdat , "http://" ) ) { - prefix = "http://"; - scheme = "http://"; - } else if ( isEqual( cdat , "ttp://" ) ) { - prefix = "ttp://"; - scheme = "http://"; - } else if ( isEqual( cdat , "tp://" ) ) { - prefix = "tp://"; - scheme = "http://"; - } else if ( isEqual( cdat , "https://" ) ) { - prefix = "https://"; - scheme = "https://"; - } else if ( isEqual( cdat , "ttps://" ) ) { - prefix = "ttps://"; - scheme = "https://"; - } else if ( isEqual( cdat , "tps://" ) ) { - prefix = "tps://"; - scheme = "https://"; + QRegExp regexp("<BR><BR><B>(.*)</B><BR>"); + if (regexp.indexIn(line) != -1) { + return regexp.cap(1); } else { - return FALSE; + return QString(); } - - pos = prefix.length(); - while ( cdat[ pos ] >= '!' && cdat[ pos ] <= '~' && - cdat[ pos ] != ' ' && cdat[ pos ] != '<' && cdat[ pos ] != '>' - && pos < length ) { - retlinkstr += cdat[ pos++ ]; - } - if ( pos > length ) return FALSE; - - if ( retlinkstr != QString::null ) DatToText( retlinkstr, linkstr ); - - linkurl = scheme + linkstr; - linkstr = prefix + linkstr; - - return TRUE; } - - -/* parsing function for anchor (>>digits) */ - -/* This fuction parses res anchor. - - For example, if cdat = ">12-20", then - - linkstr = ">12-20", - refNum[0] = 12, - refNum[1] = 20, - pos (= length of cdat ) = 9, - ret = TRUE; - -*/ -bool Kita::parseResAnchor( - - /* input */ - const QChar *cdat, const unsigned int length, - - /* output */ - QString& linkstr, int* refNum, unsigned int& pos ) +bool Kita::isBoardUrl(const QString& url) { + QRegExp url_2ch("http://.*\\.2ch\\.net/.*"); + QRegExp url_bbspink("http://.*\\.bbspink\\.com/.*"); + QRegExp url_www_2ch("http://www\\.2ch\\.net/.*"); + QRegExp url_machibbs("http://.*\\.machi\\.to/.*"); - struct LocalFunc { - static bool isHYPHEN( unsigned short c ) - { + if (url.isEmpty()) return false; - /* UTF-16 */ - if ( c == '-' - || ( c >= 0x2010 && c <= 0x2015 ) - || ( c == 0x2212 ) - || ( c == 0xFF0D ) /* UTF8: 0xEFBC8D */ - ) { - return TRUE; - } + if (url_2ch.indexIn(url) == -1 && url_bbspink.indexIn(url) == -1 + && url_machibbs.indexIn(url) == -1) return false; + if (url_www_2ch.indexIn(url) != -1) return false; - return FALSE; - } - }; - - bool ret = FALSE; - int i; - - if ( length == 0 ) return FALSE; - - linkstr = QString::null; - refNum[ 0 ] = 0; - refNum[ 1 ] = 0; - pos = 0; - - /* check '>' twice */ - for ( i = 0;i < 2;i++ ) { - - if ( cdat[ pos ].unicode() == UTF16_BRACKET ) { - linkstr += cdat[ pos ]; - pos++; - } else if ( cdat[ pos ] == '&' && cdat[ pos + 1 ] == 'g' /* > */ - && cdat[ pos + 2 ] == 't' && cdat[ pos + 3 ] == ';' ) { - linkstr += ">"; - pos += 4; - } - - } - - /* check ',' */ - if ( !pos ) { - if ( cdat[ pos ] == ',' || cdat[ pos ].unicode() == UTF16_COMMA ) { - linkstr += ","; - pos ++; - } - } - - /* check '=' */ - if ( !pos ) { - if ( cdat[ pos ] == '=' || cdat[ pos ].unicode() == UTF16_EQ ) { - linkstr += "="; - pos ++; - } - } - - /* check digits */ - int hyphen = 0; - - for ( i = 0 ; i < KITA_RESDIGIT + 1 && pos < length ; i++, pos++ ) { - - unsigned short c = cdat[ pos ].unicode(); - - if ( ( c < UTF16_0 || c > UTF16_9 ) - && ( c < '0' || c > '9' ) - && ( !LocalFunc::isHYPHEN( c ) - || ( i == 0 && LocalFunc::isHYPHEN( c ) ) - || ( hyphen && LocalFunc::isHYPHEN( c ) ) ) - ) break; - - linkstr += cdat[ pos ]; - - if ( LocalFunc::isHYPHEN( c ) ) { - hyphen = 1; - i = -1; - } else { - if ( c >= UTF16_0 ) c = '0' + cdat[ pos ].unicode() - UTF16_0; - refNum[ hyphen ] *= 10; - refNum[ hyphen ] += c - '0'; - } - - ret = TRUE; - } - - return ret; + return true; } - - -/* create res anchor */ -/* This function is called from parseBody internally. - See also parseBody. */ -bool Kita::createResAnchor( const QString &rawStr, RESDAT& resdat, - const QChar *chpt, unsigned int &i, unsigned int &startPos ) +QString Kita::fontToString(const QFont& font) { - QString linkstr, linkurl; - int refNum[ 2 ]; - unsigned int pos; - unsigned int length = rawStr.length(); - - /* parse anchor */ - if ( !parseResAnchor( chpt + i, length - i, linkstr, refNum, pos ) ) { - - i += pos - 1; - return FALSE; - } - - /* create anchor */ - resdat.bodyHTML += rawStr.mid( startPos, i - startPos ); - linkurl = QString( "#%1" ).arg( refNum[ 0 ] ); - if ( refNum[ 1 ] ) linkurl += QString( "-%1" ).arg( refNum[ 1 ] ); - - resdat.bodyHTML += "<a href=\"" + linkurl + "\">"; - resdat.bodyHTML += linkstr; - resdat.bodyHTML += "</a>"; - - /* add anchor to ancList */ - ANCNUM anctmp; - if ( refNum[ 1 ] < refNum[ 0 ] ) refNum[ 1 ] = refNum[ 0 ]; - anctmp.from = refNum[ 0 ]; - anctmp.to = refNum[ 1 ]; - resdat.anclist += anctmp; - - startPos = i + pos; - i = startPos - 1; - - return TRUE; + return font.family() + ' ' + QString::number(font.pointSize()); } - - -/* create HTML of title. - - struct RESDAT resdat should be parsed by parseResDat before calling this function. - - output: titleHTML - -*/ -void Kita::createTitleHTML( RESDAT& resdat, QString& titleHTML ) -{ - titleHTML = QString::null; - if ( !resdat.parsed ) return ; - - bool showMailAddress = Kita::Config::showMailAddress(); - bool useTableTag = Kita::Config::useStyleSheet(); - - if ( m_colonstr == QString::null ) { - m_colonstr = utf8ToUnicode( KITAUTF8_COLON ); - m_colonnamestr = utf8ToUnicode( KITAUTF8_NAME ); - } - - if ( useTableTag ) titleHTML += "<table class=\"res_title\"><tr>"; - - /* res number */ - if ( useTableTag ) titleHTML += "<td class=\"res_title_number\">"; - titleHTML += "<a href=\"#write" + QString().setNum( resdat.num ) + "\">"; - titleHTML += QString().setNum( resdat.num ); - titleHTML += "</a> "; - - - /* name & mail address */ - if ( useTableTag ) titleHTML += "<td class=\"res_title_name\">"; - titleHTML += "<b>" + m_colonnamestr; - - /* show name with mail address */ - if ( showMailAddress ) { - - titleHTML += resdat.nameHTML; - if ( resdat.address != QString::null ) titleHTML += " [" + resdat.address + "]"; - - } else { /* don't show mail address */ - - if ( resdat.address == QString::null ) { - - titleHTML += "<span class=\"name_noaddr\">"; - titleHTML += resdat.name; - titleHTML += "</span>"; - - } else { - - titleHTML += "<a href=\"mailto:" + resdat.address + "\""; - titleHTML += " title=\"" + resdat.address + "\">"; - titleHTML += resdat.name; - titleHTML += "</a>"; - } - } - - titleHTML += "</b> "; - - /* date */ - if ( useTableTag ) titleHTML += "<td class=\"res_title_date\">"; - titleHTML += m_colonstr + resdat.date; - if ( useTableTag ) titleHTML += "</td>"; - - /* ID */ - if ( resdat.id != QString::null ) { - - if ( useTableTag ) titleHTML += "<td class=\"res_title_id\">"; - if ( resdat.id.contains( "???", TRUE ) >= 1 ) titleHTML += " ID:" + resdat.id; - else titleHTML += " <a href=\"#idpop" + resdat.id + "\">ID</a>" + ":" + resdat.id; - if ( useTableTag ) titleHTML += "</td>"; - } - - /* BE */ - if ( resdat.be != QString::null ) { - - if ( useTableTag ) titleHTML += "<td class=\"res_title_be\">"; - titleHTML += " <a href=\"#bepop" + resdat.be + "\">?" + resdat.bepointmark + "</a>"; - if ( useTableTag ) titleHTML += "</td>"; - } - - /* host */ - if ( resdat.host != QString::null ) { - - if ( useTableTag ) titleHTML += "<td class=\"res_title_host\">"; - titleHTML += " HOST:" + resdat.host; - if ( useTableTag ) titleHTML += "</td>"; - } - - if ( useTableTag ) titleHTML += "</tr></table>"; -} - - -QString Kita::getCategory( const QString& line ) -{ - QRegExp regexp( "<BR><BR><B>(.*)</B><BR>", FALSE ); - if ( regexp.search( line ) != -1 ) { - return regexp.cap( 1 ); - } else { - return QString::null; - } -} - -bool Kita::isBoardURL( const QString& url ) -{ - QRegExp url_2ch( "http://.*\\.2ch\\.net/.*" ); - QRegExp url_bbspink( "http://.*\\.bbspink\\.com/.*" ); - QRegExp url_www_2ch( "http://www\\.2ch\\.net/.*" ); - QRegExp url_machibbs( "http://.*\\.machi\\.to/.*" ); - - if ( url.isEmpty() ) return FALSE; - - if ( url_2ch.search( url ) == -1 && url_bbspink.search( url ) == -1 - && url_machibbs.search( url ) == -1 ) return FALSE; - if ( url_www_2ch.search( url ) != -1 ) return FALSE; - - return TRUE; -} - -QString Kita::fontToString( const QFont& font ) -{ - return font.family() + " " + QString::number( font.pointSize() ); -} Modified: kita/trunk/kita/src/libkita/kita_misc.h =================================================================== --- kita/trunk/kita/src/libkita/kita_misc.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/kita_misc.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,17 +7,18 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITAKITA_MISC_H #define KITAKITA_MISC_H -#include "boardmanager.h" +#include <QtCore/QString> -#include <qstring.h> +#include <kdemacros.h> -class KURL; class QDateTime; +class QFont; +class KUrl; + struct RESDAT; @@ -32,79 +33,43 @@ /** * @author Hideki Ikemoto */ - /*------------------------------*/ - /* text codecs */ - QString qcpToUnicode( const QString& str ); - QString utf8ToUnicode( const QString& str ); - QString eucToUnicode( const QString& str ); - - - /*------------------------------*/ - /* conversion of DAT */ - QString datToHtml( const QString& rawData, int num ); - void DatToText( const QString &rawData, QString& text ); - QString parseSpecialChar( const QChar *cdat, unsigned int& pos ); - - - /*------------------------------*/ /* conversion of URL */ - KURL getDatURL( const KURL& url , QString& refstr ); - KURL getDatURL( const KURL& url ); + KDE_EXPORT KUrl getDatUrl(const KUrl& url , QString& refstr); + KDE_EXPORT KUrl getDatUrl(const KUrl& url); - QString getThreadURL( const KURL& url, QString& refstr ); - QString getThreadURL( const KURL& url ); - QString getWriteURL( const KURL& datURL ); - QString getNewThreadWriteURL( const KURL& datURL ); + QString getThreadUrl(const KUrl& url, QString& refstr); + KDE_EXPORT QString getThreadUrl(const KUrl& url); + KDE_EXPORT QString getWriteUrl(const KUrl& datUrl); - QString convertURL( int mode, const KURL& url , QString& refstr ); + QString convertUrl(int mode, const KUrl& url , QString& refstr); - QString datToOfflaw( const KURL& datURL ); + QString datToOfflaw(const KUrl& datUrl); /*------------------------------*/ /* utilities */ - bool mkdir( const QString& path ); - QString unescape( const QString& str ); - uint datToSince( const KURL& datURL ); - int isEqual( const QChar *cdat, const QString& str ); - int stringToPositiveNum( const QChar *cdat, const unsigned int length ); - QString getCategory( const QString& line ); - bool isBoardURL( const QString& url ); - QString fontToString( const QFont& font ); + KDE_EXPORT uint datToSince(const KUrl& datUrl); + KDE_EXPORT int stringToPositiveNum(const QChar *cdat, const unsigned int length); + KDE_EXPORT QString getCategory(const QString& line); + KDE_EXPORT bool isBoardUrl(const QString& url); + KDE_EXPORT QString fontToString(const QFont& font); /*------------------------------*/ - /* internal parsing funtions */ - QStringList parseSearchQuery( const QString& input ); + /* internal parsing functions */ + KDE_EXPORT QStringList parseSearchQuery(const QString& input); /* for MACHI BBS */ void InitParseMachiBBS(); - QString ParseMachiBBSOneLine( const QString& inputLine, int& nextNum ); + QString ParseMachiBBSOneLine(const QString& inputLine, int& nextNum); /* for JBBS */ - QString ParseJBBSOneLine( const QString& line, int& nextNum ); + QString ParseJBBSOneLine(const QString& line, int& nextNum); /* for Flash CGI/Mini Thread */ - QString ParseFlashCGIOneLine( const QString& line ); - - - /* for 2ch */ - bool parseResDat( RESDAT& resdat, QString& subject ); - - void parseName( const QString& rawStr, RESDAT& resdat ); - void parseDateId( const QString& rawStr, RESDAT& resdat ); - void parseBody( const QString &rawStr, RESDAT& resdat ); - - bool parseLink( const QChar *cdat, const unsigned int length, - QString& linkstr, QString& linkurl, unsigned int& pos ); - bool parseResAnchor( const QChar *cdat, const unsigned int length, - QString& linkstr, int* refNum, unsigned int& pos ); - bool createResAnchor( const QString &rawStr, RESDAT& resdat, - const QChar *chpt, unsigned int &i, unsigned int &index ); - - void createTitleHTML( RESDAT& resdat, QString& titletext ); + QString ParseFlashCGIOneLine(const QString& line); } #endif Modified: kita/trunk/kita/src/libkita/machibbs.cpp =================================================================== --- kita/trunk/kita/src/libkita/machibbs.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/machibbs.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,32 +9,25 @@ ***************************************************************************/ #include "machibbs.h" -#include "qcp932codec.h" +#include <QtCore/QTextCodec> -#include <kurl.h> +#include "kita_misc.h" +#include "postdata.h" -MachiBBS::MachiBBS() -{ -} +using namespace Kita; - -MachiBBS::~MachiBBS() +QString MachiBBS::buildPostStr(const PostData& data) { -} - -QString MachiBBS::buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime ) -{ QString ret; - QCp932Codec codec; - int mib = codec.mibEnum(); + int mib = m_writeCodec->mibEnum(); - ( ret += "submit=" ) += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ - ( ret += "&NAME=" ) += KURL::encode_string( name, mib ); - ( ret += "&MAIL=" ) += KURL::encode_string( mail, mib ); - ( ret += "&MESSAGE=" ) += KURL::encode_string( body, mib ); - ( ret += "&BBS=" ) += boardID; - ( ret += "&KEY=" ) += threadID; - ( ret += "&TIME=" ) += QString::number( serverTime ); + (ret += "submit=") += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ + (ret += "&NAME=") += encodeString(data.name(), mib); + (ret += "&MAIL=") += encodeString(data.mail(), mib); + (ret += "&MESSAGE=") += encodeString(data.body(), mib); + (ret += "&BBS=") += data.boardId(); + (ret += "&KEY=") += data.threadId(); + (ret += "&TIME=") += QString::number(data.serverTime()); return ret; } Modified: kita/trunk/kita/src/libkita/machibbs.h =================================================================== --- kita/trunk/kita/src/libkita/machibbs.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/machibbs.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,19 +10,19 @@ #ifndef MACHIBBS_H #define MACHIBBS_H -#include <qstring.h> +#include <QtCore/QString> -/** - @author Hideki Ikemoto <ikemo****@users*****> -*/ -class MachiBBS { -public: - static QString buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime ); +#include "bbs.h" -private: - MachiBBS(); - ~MachiBBS(); +namespace Kita { + /** + @author Hideki Ikemoto <ikemo****@users*****> + */ + class KDE_EXPORT MachiBBS : public Bbs { + public: + virtual QString buildPostStr(const PostData& data); -}; + }; +} #endif Deleted: kita/trunk/kita/src/libkita/parsemisc.h =================================================================== --- kita/trunk/kita/src/libkita/parsemisc.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/parsemisc.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,39 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2004 by Kita Developers * -* ikemo****@users***** * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -***************************************************************************/ - -/* obsolete */ - -#ifndef KITAPARMISC_H -#define KITAPARMISC_H - -#include "kita_misc.h" - -class KURL; - -namespace Kita -{ - - class ParseMisc - { - public: - static KURL parseURL( const KURL& url , QString& refstr ) - { - return Kita::getDatURL( url , refstr ); - } - - static KURL parseURLonly( const KURL& url ) { return Kita::getDatURL( url ); } - - static QString utf8ToUnicode( const QString& str ) { return Kita::utf8ToUnicode( str ); } - }; - -} - -#endif - Copied: kita/trunk/kita/src/libkita/parser.cpp (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/parser.cpp) =================================================================== --- kita/trunk/kita/src/libkita/parser.cpp (rev 0) +++ kita/trunk/kita/src/libkita/parser.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,667 @@ +/*************************************************************************** + * Copyright (C) 2009 by Kita Developers * + * ikemo****@users***** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#include "parser.h" + +#include <QtCore/QString> + +#include "datinfo.h" +#include "globalconfig.h" +#include "kita-utf16.h" +#include "kita-utf8.h" + +using namespace Kita; +using namespace Kita::Parser; + +static const int KITA_RESDIGIT = 4; + +/* if cdat == str, return str.length() */ +static int isEqual(const QChar *cdat, const QString& str) +{ + int i = 0; + const int size = str.size(); + while (i < size && str.at(i) != '\0') { + if (*cdat != str.at(i)) return 0; + cdat++;i++; + } + return i; +} + +/* parsing function for special char (such as ♥ */ + +/* For example, if cdat = "&", then + + pos (= length of cdat) = 5, + retstr = "&". */ +static QString parseSpecialChar( + + /* input */ + const QChar *cdat, + + /* output */ + unsigned int& pos) +{ + QString retstr; + + if ((pos = isEqual(cdat , ">"))) retstr = '>'; + else if ((pos = isEqual(cdat , "<"))) retstr = '<'; + else if ((pos = isEqual(cdat , " "))) retstr = ' '; + else if ((pos = isEqual(cdat , "&"))) retstr = '&'; + else if ((pos = isEqual(cdat , """))) retstr = '"'; + + else if ((pos = isEqual(cdat , "♥"))) + retstr = QString::fromUtf8(KITAUTF8_HEART); + + else if ((pos = isEqual(cdat , "♦"))) + retstr = QString::fromUtf8(KITAUTF8_DIA); + + else if ((pos = isEqual(cdat , "♣"))) + retstr = QString::fromUtf8(KITAUTF8_CLUB); + + else if ((pos = isEqual(cdat , "♠"))) + retstr = QString::fromUtf8(KITAUTF8_SPADE); + + return retstr; +} + +/* get plain text from raw data */ +/* + This function replaces "<br>" to "\n", removes HTML tags and + replaces special chars. +*/ +void Parser::datToText( + + /* input */ + const QString &rawData, + + /* output */ + QString& text +) +{ + text.clear(); + + unsigned int startPos, pos; + const QChar *chpt = rawData.unicode(); + unsigned int length = rawData.length(); + + for (unsigned int i = startPos = 0 ; i < length ; i++) { + + switch (chpt[ i ].unicode()) { + + case '<': + + /* " <br> " */ + if (chpt[ i + 1 ] == 'b' && chpt[ i + 2 ] == 'r' && chpt[ i + 3 ] == '>') { + + unsigned int i2 = i - startPos; + if (i > 0 && chpt[ i - 1 ] == ' ') i2--; /* remove space before <br> */ + text += rawData.mid(startPos, i2) + '\n'; + startPos = i + 4; + if (chpt[ startPos ] == ' ') startPos++; /* remove space after <br> */ + i = startPos - 1; + } + + /*----------------------------------------*/ + + /* remove HTML tags <[^>]*> */ + else { + + if (i - startPos) text += rawData.mid(startPos, i - startPos); + while (chpt[ i ] != '>' && i < length) i++; + startPos = i + 1; + } + + break; + + /*----------------------------------*/ + + case '&': + + /* special char */ + { + QString tmpstr; + tmpstr = parseSpecialChar(chpt + i, pos); + + if (!tmpstr.isEmpty()) { + text += rawData.mid(startPos, i - startPos) + tmpstr; + startPos = i + pos; + i = startPos - 1; + } + } + + break; + } + } + + text += rawData.mid(startPos); +} + +/* parsing function for anchor (>>digits) */ + +/* This function parses res anchor. + + For example, if cdat = ">12-20", then + + linkstr = ">12-20", + refNum[0] = 12, + refNum[1] = 20, + pos (= length of cdat) = 9, + ret = true; + +*/ +static bool parseResAnchor( + + /* input */ + const QChar *cdat, const unsigned int length, + + /* output */ + QString& linkstr, int* refNum, unsigned int& pos) +{ + + struct LocalFunc { + static bool isHYPHEN(unsigned short c) + { + + /* UTF-16 */ + if (c == '-' + || (c >= 0x2010 && c <= 0x2015) + || (c == 0x2212) + || (c == 0xFF0D) /* UTF8: 0xEFBC8D */ + ) { + return true; + } + + return false; + } + }; + + bool ret = false; + + if (length == 0) return false; + + linkstr.clear(); + refNum[ 0 ] = 0; + refNum[ 1 ] = 0; + pos = 0; + + /* check '>' twice */ + for (int i = 0; i < 2; i++) { + + if (cdat[ pos ].unicode() == UTF16_BRACKET) { + linkstr += cdat[ pos ]; + pos++; + } else if (cdat[ pos ] == '&' && cdat[ pos + 1 ] == 'g' /* > */ + && cdat[ pos + 2 ] == 't' && cdat[ pos + 3 ] == ';') { + linkstr += '>'; + pos += 4; + } + + } + + /* check ',' */ + if (!pos) { + if (cdat[ pos ] == ',' || cdat[ pos ].unicode() == UTF16_COMMA) { + linkstr += ','; + pos ++; + } + } + + /* check '=' */ + if (!pos) { + if (cdat[ pos ] == '=' || cdat[ pos ].unicode() == UTF16_EQ) { + linkstr += '='; + pos ++; + } + } + + /* check digits */ + int hyphen = 0; + + for (int i = 0 ; i < KITA_RESDIGIT + 1 && pos < length ; i++, pos++) { + + unsigned short c = cdat[ pos ].unicode(); + + if ((c < UTF16_0 || c > UTF16_9) + && (c < '0' || c > '9') + && (!LocalFunc::isHYPHEN(c) + || (i == 0 && LocalFunc::isHYPHEN(c)) + || (hyphen && LocalFunc::isHYPHEN(c))) + ) break; + + linkstr += cdat[ pos ]; + + if (LocalFunc::isHYPHEN(c)) { + hyphen = 1; + i = -1; + } else { + if (c >= UTF16_0) c = '0' + cdat[ pos ].unicode() - UTF16_0; + refNum[ hyphen ] *= 10; + refNum[ hyphen ] += c - '0'; + } + + ret = true; + } + + return ret; +} + +/* parse name */ + +/* output: + + resdat.name + resdat.nameHTML + +*/ +static void parseName(const QString& rawStr, RESDAT& resdat) +{ + unsigned int i = 0, pos; + int refNum[ 2 ]; + QString linkurl, linkstr; + + datToText(rawStr, resdat.name); + + const QChar * chpt = resdat.name.unicode(); + unsigned int length = resdat.name.length(); + resdat.nameHTML.clear(); + + /* anchor */ + while (parseResAnchor(chpt + i, length - i, linkstr, refNum, pos)) { + + linkurl = QString("#%1").arg(refNum[ 0 ]); + if (refNum[ 1 ]) linkurl += QString("-%1").arg(refNum[ 1 ]); + + resdat.nameHTML += "<a href=\"" + linkurl + "\">"; + resdat.nameHTML += linkstr; + resdat.nameHTML += "</a>"; + + ANCNUM anctmp; + if (refNum[ 1 ] < refNum[ 0 ]) refNum[ 1 ] = refNum[ 0 ]; + anctmp.from = refNum[ 0 ]; + anctmp.to = refNum[ 1 ]; + resdat.anclist += anctmp; + + i += pos; + } + + /* non-digits strings */ + if (i < length) { + + resdat.nameHTML += "<span class=\"name_noaddr\">"; + resdat.nameHTML += resdat.name.mid(i); + resdat.nameHTML += "</span>"; + } + +} + +/* parse date, ID, host */ + +/* output : + + resdat.dateTime + resdat.date + resdat.id + resdat.host + +*/ +static void parseDateId(const QString& rawStr, RESDAT& resdat) +{ + resdat.date = rawStr; + resdat.id.clear(); + resdat.host.clear(); + resdat.be.clear(); + resdat.bepointmark.clear(); + + const QChar *chpt = rawStr.unicode(); + unsigned int pos = 0, startpos = 0; + unsigned int length = rawStr.length(); + + while (chpt[ pos ] != '\0' && + !(chpt[ pos ] == 'I' && chpt[ pos + 1 ] == 'D') && + !(chpt[ pos ] == 'B' && chpt[ pos + 1 ] == 'E')) { + pos++; + } + resdat.date = rawStr.left(pos); + + /* id */ + if (chpt[ pos ] == 'I' && chpt[ pos + 1 ] == 'D') { + pos += 3; + startpos = pos; + while (chpt[ pos ] != ' ' && pos++ < length) {}; + resdat.id = rawStr.mid(startpos, pos - startpos); + pos++; + } + + // qDebug("date %s, ID %s", (const char*)resdat.date.local8Bit(), resdat.id.ascii()); + + if (pos >= length) return ; + + /* be */ + if (chpt[ pos ] == 'B' && chpt[ pos + 1 ] == 'E') { + pos += 3; + startpos = pos; + while (chpt[ pos ] != '-' && pos++ < length) {}; + resdat.be = rawStr.mid(startpos, pos - startpos); + pos++; + if (pos < length && chpt[ pos ] == '#') { + startpos = pos; + while (chpt[ pos ] == '#' && pos++ < length) {}; + resdat.bepointmark = rawStr.mid(startpos, pos - startpos); + } + } + + if (pos >= length) return ; + + /* host */ + if (chpt[ pos ] == 'H' && chpt[ pos + 1 ] == 'O') { + pos += 5; + startpos = pos; + while (chpt[ pos ] != ' ' && pos++ < length) {}; + resdat.host = rawStr.mid(startpos, pos - startpos); + pos++; + // qDebug("host %s", resdat.host.ascii()); + } +} + +/* parsing function for link */ + +/* For example, + + cdat = "ttp://foo.com", + + then + + linkstr = "ttp://foo.com", + linkurl = "http://foo.com", + pos (= length of cdat) = 13, + + and return true. + */ +static bool parseLink( + + /* input */ + const QChar *cdat, const unsigned int length, + + /* output */ + QString& linkstr, QString& linkurl, unsigned int& pos +) +{ + + /*-----------------------------*/ + + linkstr.clear(); + linkurl.clear(); + + QString retlinkstr; + QString prefix; + QString scheme; + + if (isEqual(cdat , "http://")) { + prefix = "http://"; + scheme = "http://"; + } else if (isEqual(cdat , "ttp://")) { + prefix = "ttp://"; + scheme = "http://"; + } else if (isEqual(cdat , "tp://")) { + prefix = "tp://"; + scheme = "http://"; + } else if (isEqual(cdat , "https://")) { + prefix = "https://"; + scheme = "https://"; + } else if (isEqual(cdat , "ttps://")) { + prefix = "ttps://"; + scheme = "https://"; + } else if (isEqual(cdat , "tps://")) { + prefix = "tps://"; + scheme = "https://"; + } else { + return false; + } + + pos = prefix.length(); + while (cdat[ pos ] >= '!' && cdat[ pos ] <= '~' && + cdat[ pos ] != ' ' && cdat[ pos ] != '<' && cdat[ pos ] != '>' + && pos < length) { + retlinkstr += cdat[ pos++ ]; + } + if (pos > length) return false; + + if (!retlinkstr.isEmpty()) datToText(retlinkstr, linkstr); + + linkurl = scheme + linkstr; + linkstr = prefix + linkstr; + + return true; +} + +/* create res anchor */ +/* This function is called from parseBody internally. + See also parseBody. */ +static bool createResAnchor(const QString &rawStr, RESDAT& resdat, + const QChar *chpt, unsigned int &i, unsigned int &startPos) +{ + QString linkstr, linkurl; + int refNum[ 2 ]; + unsigned int pos; + unsigned int length = rawStr.length(); + + /* parse anchor */ + if (!parseResAnchor(chpt + i, length - i, linkstr, refNum, pos)) { + + i += pos - 1; + return false; + } + + /* create anchor */ + resdat.bodyHTML += rawStr.mid(startPos, i - startPos); + linkurl = QString("#%1").arg(refNum[ 0 ]); + if (refNum[ 1 ]) linkurl += QString("-%1").arg(refNum[ 1 ]); + + resdat.bodyHTML += "<a href=\"" + linkurl + "\">"; + resdat.bodyHTML += linkstr; + resdat.bodyHTML += "</a>"; + + /* add anchor to ancList */ + ANCNUM anctmp; + if (refNum[ 1 ] < refNum[ 0 ]) refNum[ 1 ] = refNum[ 0 ]; + anctmp.from = refNum[ 0 ]; + anctmp.to = refNum[ 1 ]; + resdat.anclist += anctmp; + + startPos = i + pos; + i = startPos - 1; + + return true; +} + +/* parse body */ + +/* output : + + resdat.bodyHTML + +*/ +static void parseBody(const QString &rawStr, RESDAT& resdat) +{ + resdat.bodyHTML.clear(); + + unsigned int startPos; + QString linkstr, linkurl; + const QChar *chpt = rawStr.unicode(); + unsigned int length = rawStr.length(); + + bool ancChain = false; + + /* ancChain is chain for anchor. For examle, if anchor ">2" + appeared, ancChain is set to true. Moreover, if next strings + are "=5", anchor for 5 is also set. Thus, we can obtain anchors + for strings ">2=5" as follows: + + <a href="#2">>2</a><a href="#5">=5</a> + */ + + int offset = 0; + if (chpt[ 0 ] == ' ') offset = 1; /* remove one space after <> */ + for (unsigned int i = startPos = offset ; i < length ; i++) { + + switch (chpt[ i ].unicode()) { + + case '<': + + /* " <br> " */ + if (chpt[ i + 1 ] == 'b' && chpt[ i + 2 ] == 'r' && chpt[ i + 3 ] == '>') { + + /* reset anchor chain */ + ancChain = false; + + unsigned int i2 = i - startPos; + if (i > 0 && chpt[ i - 1 ] == ' ') i2--; /* remove space before <br> */ + resdat.bodyHTML += rawStr.mid(startPos, i2); + + resdat.bodyHTML += "<br>"; + + startPos = i + 4; + if (chpt[ startPos ] == ' ') startPos++; /* remove space after <br> */ + i = startPos - 1; + } + + /*----------------------------------------*/ + + /* remove HTML tags <[^>]*> */ + else { + + if (i - startPos) resdat.bodyHTML += rawStr.mid(startPos, i - startPos); + while (chpt[ i ] != '>' && i < length) i++; + startPos = i + 1; + } + + break; + + /*----------------------------------------*/ + + case 'h': /* "http://" or "ttp://" or "tp:" */ + case 't': + { + unsigned int pos = 0; + if (parseLink(chpt + i, length - i, linkstr, linkurl, pos)) { + resdat.bodyHTML += rawStr.mid(startPos, i - startPos); + resdat.bodyHTML += "<a href=\"" + linkurl + "\">"; + resdat.bodyHTML += linkstr; + resdat.bodyHTML += "</a>"; + + startPos = i + pos; + i = startPos - 1; + } + } + + break; + + /*----------------------------------*/ + + case '&': + + /* > */ + if (chpt[ i + 1 ] == 'g' && chpt[ i + 2 ] == 't' && chpt[ i + 3 ] == ';') + ancChain = createResAnchor(rawStr, resdat, chpt, i, startPos); + + break; + + /*----------------------------------------*/ + + /* unicode '>' */ + case UTF16_BRACKET: + + ancChain = createResAnchor(rawStr, resdat, chpt, i, startPos); + break; + + /*----------------------------------*/ + + default: + + if (ancChain) ancChain = createResAnchor(rawStr, resdat, chpt, i, startPos); + } + } + + resdat.bodyHTML += rawStr.mid(startPos); +} + +/* Main Parser */ + +/* + struct RESDAT is defined in datinfo.h. + This function is called from DatToHtml() and DatInfo::parseDat() + + input: + + resdat.num ... number + resdat.linestr ... raw line strings + + output: + + resdat.* + subject +*/ +bool Parser::parseResDat(RESDAT& resdat, QString& subject) +{ + if (resdat.parsed) return true; + + resdat.parsed = true; + resdat.broken = false; + resdat.anclist.clear(); + + /* search the staring positions of each section to split raw data. */ + const QChar *chpt = resdat.linestr.unicode(); + unsigned int length = resdat.linestr.length(); + unsigned int section = 0; + unsigned int sectionPos[ 5 ]; + for (unsigned int i = 0 ; i < length ; i++) { + + /* sections are splitted by "<>" */ + if (chpt[ i ] == '<' && chpt[ i + 1 ] == '>') { + section++; + + if (section >= 5) { + resdat.broken = true; + return true; + } + + sectionPos[ section ] = i + 2; + i++; + } + } + + /* broken data */ + if (section != 4) { + resdat.broken = true; + return true; + } + + // qDebug("[%d] %d %d %d %d",section, sectionPos[1],sectionPos[2],sectionPos[3],sectionPos[4]); + + /* name */ + length = sectionPos[ 1 ] - 2 ; + parseName(resdat.linestr.mid(0, length), resdat); + + /* mail */ + length = sectionPos[ 2 ] - 2 - sectionPos[ 1 ]; + datToText(resdat.linestr.mid(sectionPos[ 1 ], length), resdat.address); + + /* date, ID, host */ + length = sectionPos[ 3 ] - 2 - sectionPos[ 2 ]; + parseDateId(resdat.linestr.mid(sectionPos[ 2 ], length), resdat); + + /* body */ + length = sectionPos[ 4 ] - 2 - sectionPos[ 3 ]; + parseBody(resdat.linestr.mid(sectionPos[ 3 ], length), resdat); + + /* subject */ + subject = resdat.linestr.mid(sectionPos[ 4 ]); + + return true; +} Copied: kita/trunk/kita/src/libkita/parser.h (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/parser.h) =================================================================== --- kita/trunk/kita/src/libkita/parser.h (rev 0) +++ kita/trunk/kita/src/libkita/parser.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2009 by Kita Developers * + * ikemo****@users***** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#ifndef PARSER_H +#define PARSER_H + +class QString; + +class RESDAT; + +namespace Kita { + namespace Parser { + bool parseResDat(RESDAT& resdat, QString& subject); + void datToText(const QString &rawData, QString& text); + } +} + +#endif Copied: kita/trunk/kita/src/libkita/postdata.cpp (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/postdata.cpp) =================================================================== --- kita/trunk/kita/src/libkita/postdata.cpp (rev 0) +++ kita/trunk/kita/src/libkita/postdata.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (C) 2006 by Kita Developers * + * ikemo****@users***** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#include "postdata.h" + +#include "account.h" +#include "datmanager.h" + +using namespace Kita; + +PostData::PostData(const KUrl& datUrl, const QString& name, const QString& mail, + const QString& body, const QString& boardId) +{ + m_datUrl = datUrl; + m_name = name; + m_mail = mail; + m_body = body; + m_boardId = boardId; + DatManager datManager(m_datUrl); + m_threadId = datManager.threadId(); + m_serverTime = datManager.getServerTime(); + /* login */ + if (datManager.is2chThread() && Account::isLogged()) { + m_sessionId = KUrl::toPercentEncoding(Account::getSessionId()); + } +} + +const QString& PostData::name() const +{ + return m_name; +} + +const QString& PostData::mail() const +{ + return m_mail; +} + +const QString& PostData::body() const +{ + return m_body; +} + +const QString& PostData::boardId() const +{ + return m_boardId; +} + +const QString& PostData::threadId() const +{ + return m_threadId; +} + +int PostData::serverTime() const +{ + return m_serverTime; +} + +const QString& PostData::sessionId() const +{ + return m_sessionId; +} Copied: kita/trunk/kita/src/libkita/postdata.h (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/postdata.h) =================================================================== --- kita/trunk/kita/src/libkita/postdata.h (rev 0) +++ kita/trunk/kita/src/libkita/postdata.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2006 by Kita Developers * + * ikemo****@users***** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#ifndef POSTDATA_H +#define POSTDATA_H + +#include <QtCore/QString> + +#include <kurl.h> + +namespace Kita { + class KDE_EXPORT PostData { + public: + PostData(const KUrl& datUrl, const QString& name, + const QString& mail, const QString& body, + const QString& boardId); + + const QString& name() const; + const QString& mail() const; + const QString& body() const; + const QString& boardId() const; + const QString& threadId() const; + int serverTime() const; + const QString& sessionId() const; + private: + KUrl m_datUrl; + QString m_name; + QString m_mail; + QString m_body; + QString m_boardId; + QString m_threadId; + int m_serverTime; + QString m_sessionId; + }; +} + +#endif Deleted: kita/trunk/kita/src/libkita/qcp932codec.cpp =================================================================== --- kita/trunk/kita/src/libkita/qcp932codec.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/qcp932codec.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,280 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2003 by Hideki Ikemoto * -* ikemo****@wakab***** * -* * -* Permission is hereby granted, free of charge, to any person obtaining * -* a copy of this software and associated documentation files (the * -* "Software"), to deal in the Software without restriction, including * -* without limitation the rights to use, copy, modify, merge, publish, * -* distribute, sublicense, and/or sell copies of the Software, and to * -* permit persons to whom the Software is furnished to do so, subject to * -* the following conditions: * -* * -* The above copyright notice and this permission notice shall be * -* included in all copies or substantial portions of the Software. * -* * -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.* -* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * -* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * -* OTHER DEALINGS IN THE SOFTWARE. * -***************************************************************************/ - -#include "qcp932codec.h" -#include <qjpunicode.h> - -#include <kdebug.h> - -#define QValidChar(u) ((u) ? QChar((ushort)(u)) : QChar::replacement) - -static unsigned short const jisx0208_ibm_extension_to_unicode[] = - { - /* 115 ku */ - 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, - 0x2177, 0x2178, 0x2179, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, - 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0xffe2, 0xffe4, 0xff07, - 0xff02, 0x3231, 0x2116, 0x2121, 0x2235, 0x7e8a, 0x891c, 0x9348, - 0x9288, 0x84dc, 0x4fc9, 0x70bb, 0x6631, 0x68c8, 0x92f9, 0x66fb, - 0x5f45, 0x4e28, 0x4ee1, 0x4efc, 0x4f00, 0x4f03, 0x4f39, 0x4f56, - 0x4f92, 0x4f8a, 0x4f9a, 0x4f94, 0x4fcd, 0x5040, 0x5022, 0x4fff, - 0x501e, 0x5046, 0x5070, 0x5042, 0x5094, 0x50f4, 0x50d8, 0x514a, - 0x5164, 0x519d, 0x51be, 0x51ec, 0x5215, 0x529c, 0x52a6, 0x52c0, - 0x52db, 0x5300, 0x5307, 0x5324, 0x5372, 0x5393, 0x53b2, 0x53dd, - 0xfa0e, 0x549c, 0x548a, 0x54a9, 0x54ff, 0x5586, 0x5759, 0x5765, - 0x57ac, 0x57c8, 0x57c7, 0xfa0f, 0xfa10, 0x589e, 0x58b2, - /* 116 ku */ - 0x590b, 0x5953, 0x595b, 0x595d, 0x5963, 0x59a4, 0x59ba, - 0x5b56, 0x5bc0, 0x752f, 0x5bd8, 0x5bec, 0x5c1e, 0x5ca6, 0x5cba, - 0x5cf5, 0x5d27, 0x5d53, 0xfa11, 0x5d42, 0x5d6d, 0x5db8, 0x5db9, - 0x5dd0, 0x5f21, 0x5f34, 0x5f67, 0x5fb7, 0x5fde, 0x605d, 0x6085, - 0x608a, 0x60de, 0x60d5, 0x6120, 0x60f2, 0x6111, 0x6137, 0x6130, - 0x6198, 0x6213, 0x62a6, 0x63f5, 0x6460, 0x649d, 0x64ce, 0x654e, - 0x6600, 0x6615, 0x663b, 0x6609, 0x662e, 0x661e, 0x6624, 0x6665, - 0x6657, 0x6659, 0xfa12, 0x6673, 0x6699, 0x66a0, 0x66b2, 0x66bf, - 0x66fa, 0x670e, 0xf929, 0x6766, 0x67bb, 0x6852, 0x67c0, 0x6801, - 0x6844, 0x68cf, 0xfa13, 0x6968, 0xfa14, 0x6998, 0x69e2, 0x6a30, - 0x6a6b, 0x6a46, 0x6a73, 0x6a7e, 0x6ae2, 0x6ae4, 0x6bd6, 0x6c3f, - 0x6c5c, 0x6c86, 0x6c6f, 0x6cda, 0x6d04, 0x6d87, 0x6d6f, - /* 117 ku */ - 0x6d96, 0x6dac, 0x6dcf, 0x6df8, 0x6df2, 0x6dfc, 0x6e39, - 0x6e5c, 0x6e27, 0x6e3c, 0x6ebf, 0x6f88, 0x6fb5, 0x6ff5, 0x7005, - 0x7007, 0x7028, 0x7085, 0x70ab, 0x710f, 0x7104, 0x715c, 0x7146, - 0x7147, 0xfa15, 0x71c1, 0x71fe, 0x72b1, 0x72be, 0x7324, 0xfa16, - 0x7377, 0x73bd, 0x73c9, 0x73d6, 0x73e3, 0x73d2, 0x7407, 0x73f5, - 0x7426, 0x742a, 0x7429, 0x742e, 0x7462, 0x7489, 0x749f, 0x7501, - 0x756f, 0x7682, 0x769c, 0x769e, 0x769b, 0x76a6, 0xfa17, 0x7746, - 0x52af, 0x7821, 0x784e, 0x7864, 0x787a, 0x7930, 0xfa18, 0xfa19, - 0xfa1a, 0x7994, 0xfa1b, 0x799b, 0x7ad1, 0x7ae7, 0xfa1c, 0x7aeb, - 0x7b9e, 0xfa1d, 0x7d48, 0x7d5c, 0x7db7, 0x7da0, 0x7dd6, 0x7e52, - 0x7f47, 0x7fa1, 0xfa1e, 0x8301, 0x8362, 0x837f, 0x83c7, 0x83f6, - 0x8448, 0x84b4, 0x8553, 0x8559, 0x856b, 0xfa1f, 0x85b0, - /* 118 ku */ - 0xfa20, 0xfa21, 0x8807, 0x88f5, 0x8a12, 0x8a37, 0x8a79, - 0x8aa7, 0x8abe, 0x8adf, 0xfa22, 0x8af6, 0x8b53, 0x8b7f, 0x8cf0, - 0x8cf4, 0x8d12, 0x8d76, 0xfa23, 0x8ecf, 0xfa24, 0xfa25, 0x9067, - 0x90de, 0xfa26, 0x9115, 0x9127, 0x91da, 0x91d7, 0x91de, 0x91ed, - 0x91ee, 0x91e4, 0x91e5, 0x9206, 0x9210, 0x920a, 0x923a, 0x9240, - 0x923c, 0x924e, 0x9259, 0x9251, 0x9239, 0x9267, 0x92a7, 0x9277, - 0x9278, 0x92e7, 0x92d7, 0x92d9, 0x92d0, 0xfa27, 0x92d5, 0x92e0, - 0x92d3, 0x9325, 0x9321, 0x92fb, 0xfa28, 0x931e, 0x92ff, 0x931d, - 0x9302, 0x9370, 0x9357, 0x93a4, 0x93c6, 0x93de, 0x93f8, 0x9431, - 0x9445, 0x9448, 0x9592, 0xf9dc, 0xfa29, 0x969d, 0x96af, 0x9733, - 0x973b, 0x9743, 0x974d, 0x974f, 0x9751, 0x9755, 0x9857, 0x9865, - 0xfa2a, 0xfa2b, 0x9927, 0xfa2c, 0x999e, 0x9a4e, 0x9ad9, - /* 119 ku */ - 0x9adc, 0x9b75, 0x9b72, 0x9b8f, 0x9bb1, 0x9bbb, 0x9c00, - 0x9d70, 0x9d6b, 0xfa2d, 0x9e19, 0x9ed1, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - }; - -static uint cp932ToUnicode( QJpUnicodeConv* conv, uint h, uint l ) -{ - uint ku; - uint ten; - - if ( h >= 0x81 && h <= 0x9f ) { - ku = h * 2 - 257; - } else if ( h >= 0xe0 && h <= 0xfc ) { - ku = h * 2 - 385; - } else { - return 0x0000; - } - - if ( l >= 0x40 && l <= 0x7e ) { - ten = l - 63; - } else if ( l >= 0x80 && l <= 0x9e ) { - ten = l - 64; - } else if ( l >= 0x9f && l <= 0xfc ) { - ten = l - 158; - ku++; - } else { - return 0x0000; - } - - if ( ku >= 115 && ku <= 119 && ten <= 94 ) { - return jisx0208_ibm_extension_to_unicode[ ( ku - 115 ) * 94 + ( ten - 1 ) ]; - } - return conv->jisx0208ToUnicode( ku + 0x20, ten + 0x20 ); -} - -QCp932Codec::QCp932Codec() : QTextCodec(), - conv( QJpUnicodeConv::newConverter( QJpUnicodeConv::Microsoft_CP932 | - QJpUnicodeConv::NEC_VDC | - QJpUnicodeConv::IBM_VDC ) ) -{} - - -QCp932Codec::~QCp932Codec() -{ - if ( conv ) { - delete conv; - } -} - -const char * QCp932Codec::name() const -{ - return "CP932"; -} - -// see http://www.iana.org/assignments/character-sets -const char * QCp932Codec::mimeName() const -{ - return "Windows-31J"; -} - -int QCp932Codec::mibEnum() const -{ - return 2024; -} - -QTextDecoder* QCp932Codec::makeDecoder() const -{ - return new QCp932Decoder( conv ); -} - -/* -QTextEncoder* QCp932Codec::makeEncoder() const -{ -}*/ - -/*QString QCp932Codec::toUnicode(const char* chars, int len) const -{ -}*/ - -static uint jisx0212ToSjis( uint h, uint l ) -{ - if ( ( 0x0021 <= h ) && ( h <= 0x007e ) && ( 0x0021 <= l ) && ( l <= 0x007e ) ) { - return ( ( ( ( h - 1 ) >> 1 ) + ( ( h <= 0x5e ) ? 0x71 : 0xb1 ) ) << 8 ) | - ( l + ( ( h & 1 ) ? ( ( l < 0x60 ) ? 0x1f : 0x20 ) : 0x7e ) ); - } - return 0x0000; -} - -QCString QCp932Codec::fromUnicode( const QString& uc, int& lenInOut ) const -{ - int ulen = QMAX( ( int ) uc.length(), lenInOut ); - int clen = ulen * 2 + 1; - QCString ret( clen ); - char *pos = ( char * ) ret.data(); - - for ( int i = 0; i < ulen; i++ ) { - uint c = uc[ i ].unicode(); - uint j; - - /* convert WAVE DASH to FULLWIDTH TILDE */ - if ( c == 0x301C ) c = 0xFF5E; - - if ( ( j = conv->unicodeToJisx0201( c ) ) != 0 ) { - // ascii(jis x 0201) or hankaku-kana - *pos++ = j; - } else if ( ( j = conv->unicodeToSjis( c ) ) != 0 ) { - *pos++ = ( j >> 8 ); - *pos++ = ( j & 0xff ); - } else if ( ( j = conv->unicodeToJisx0212( c ) ) != 0 ) { - // support NEC and IBM extension... - j = jisx0212ToSjis( ( j & 0xff00 ) >> 8, j & 0x00ff ); - *pos++ = ( j >> 8 ); - *pos++ = ( j & 0xff ); - } else { - // invalid - *pos++ = '?'; - } - } - lenInOut = pos - ( char * ) ret.data(); - ret.truncate( lenInOut ); - return ret; -} - -/*bool QCp932Codec::canEncode(QChar ch) const -{ -} - -bool QCp932Codec::canEncode(const QString& s) const -{ -}*/ - -// FIXME: implement -int QCp932Codec::heuristicContentMatch( const char*, int ) const -{ - // kdWarning( 7743 ) << "XXX heuristicContentMatch" << endl; - return 0; -} - -// FIXME: implement -int QCp932Codec::heuristicNameMatch( const char * hint ) const -{ - // kdWarning( 7743 ) << "XXX heuristicNameMatch hint = " << hint << endl; - return 0; -} - -QCp932Decoder::QCp932Decoder( QJpUnicodeConv* _conv ) : QTextDecoder(), conv( _conv ) -{} - -QCp932Decoder::~QCp932Decoder() -{} - -QString QCp932Decoder::toUnicode( const char* chars, int len ) -{ - QString ret; - static int buf = -1; - - for ( int i = 0; i < len; i++ ) { - unsigned char c = chars[ i ]; - if ( buf >= 0 ) { // 2-byte - if ( ( c >= 0x40 && c <= 0x7e ) || ( c >= 0x80 && c <= 0xfc ) ) { - // valid kanji - uint u = cp932ToUnicode( conv, buf, c ); - ret += QValidChar( u ); - } else { - // invalid - ret += QChar::replacement; - } - buf = -1; - } else { - if ( ( c >= 0x81 && c <= 0x9f ) || ( c >= 0xe0 && c <= 0xfc ) ) { - // 1st-byte of 2-byte character. - buf = ( int ) c; - } else if ( c >= 0xa1 && c <= 0xdf ) { - // hankaku-kana - uint u = conv->jisx0201ToUnicode( c ); - ret += QValidChar( u ); - } else { - // 1-byte character. - uint u = conv->asciiToUnicode( c ); - ret += QValidChar( u ); - } - } - } - return ret; -} Deleted: kita/trunk/kita/src/libkita/qcp932codec.h =================================================================== --- kita/trunk/kita/src/libkita/qcp932codec.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/qcp932codec.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,67 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2003 by Hideki Ikemoto * -* ikemo****@wakab***** * -* * -* Permission is hereby granted, free of charge, to any person obtaining * -* a copy of this software and associated documentation files (the * -* "Software"), to deal in the Software without restriction, including * -* without limitation the rights to use, copy, modify, merge, publish, * -* distribute, sublicense, and/or sell copies of the Software, and to * -* permit persons to whom the Software is furnished to do so, subject to * -* the following conditions: * -* * -* The above copyright notice and this permission notice shall be * -* included in all copies or substantial portions of the Software. * -* * -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.* -* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * -* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * -* OTHER DEALINGS IN THE SOFTWARE. * -***************************************************************************/ - -#ifndef _QCP932CODEC_H_ -#define _QCP932CODEC_H_ - -#include <qtextcodec.h> - -class QJpUnicodeConv; -/** - * - * Hideki Ikemoto - **/ -class QCp932Codec : public QTextCodec -{ -private: - QJpUnicodeConv* conv; -public: - QCp932Codec(); - ~QCp932Codec(); - virtual const char * name() const; - virtual const char * mimeName() const; - virtual int mibEnum() const; - virtual QTextDecoder* makeDecoder() const; - // virtual QTextEncoder* makeEncoder() const; - // virtual QString toUnicode(const char* chars, int len) const; - // using QTextCodec::fromUnicode; - virtual QCString fromUnicode( const QString& uc, int& lenInOut ) const; - // virtual bool canEncode(QChar ch) const; - // virtual bool canEncode(const QString& s) const; - virtual int heuristicContentMatch( const char* chars, int len ) const; - virtual int heuristicNameMatch( const char * hint ) const; -}; - -class QCp932Decoder : public QTextDecoder -{ -private: - QJpUnicodeConv* conv; - -public: - QCp932Decoder( QJpUnicodeConv* _conv ); - ~QCp932Decoder(); - virtual QString toUnicode( const char* chars, int len ); -}; - -#endif Modified: kita/trunk/kita/src/libkita/thread.cpp =================================================================== --- kita/trunk/kita/src/libkita/thread.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/thread.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,23 +10,22 @@ #include "thread.h" -#include <qregexp.h> +#include <QtCore/QRegExp> - using namespace Kita; -QDict<Thread>* Thread::m_threadDict = 0; +QMultiHash<QString, Thread*>* Thread::m_threadDict = 0; -Thread::Thread( const KURL& datURL ) - : m_datURL( datURL ), m_threadName( 0 ) , m_resNum( 0 ), m_readNum( 0 ), m_viewPos( 0 ) +Thread::Thread(const KUrl& datUrl) + : m_datUrl(datUrl), m_threadName(0) , m_resNum(0), m_readNum(0), m_viewPos(0) {} Thread::~Thread() {} -const KURL& Thread::datURL() const +const KUrl& Thread::datUrl() const { - return m_datURL; + return m_datUrl; } /* public */ @@ -36,88 +35,89 @@ } /* public */ -void Thread::setThreadName( QString threadName ) +void Thread::setThreadName(const QString& name) { + QString threadName = name; /* remove space */ - QRegExp qrx( " +$" ); - threadName.replace( qrx, "" ); + QRegExp qrx(" +$"); + threadName.remove(qrx); /* unescape */ - threadName.replace( "<", "<" ).replace( ">", ">" ).replace( "&", "&" ); + threadName.replace("<", "<").replace(">", ">").replace("&", "&"); m_threadName = threadName; } /* public */ -const int Thread::resNum() const +int Thread::resNum() const { return m_resNum; } /* public */ -void Thread::setResNum( int num ) +void Thread::setResNum(int num) { m_resNum = num; } /* public */ -const int Thread::readNum() const +int Thread::readNum() const { return m_readNum; } /* public */ -void Thread::setReadNum( int num ) +void Thread::setReadNum(int num) { m_readNum = num; - if ( m_resNum < m_readNum ) setResNum( m_readNum ); + if (m_resNum < m_readNum) setResNum(m_readNum); } /* public */ -const int Thread::viewPos() const +int Thread::viewPos() const { return m_viewPos; } /* public */ -void Thread::setViewPos( int num ) +void Thread::setViewPos(int num) { m_viewPos = num; } /* public */ -const QValueList< int >& Thread::markList() const +const QList<int>& Thread::markList() const { return m_markList; } /* public */ -void Thread::setMarkList( const QValueList< int >& markList ) +void Thread::setMarkList(const QList<int>& markList) { m_markList = markList; } /* public */ -bool Thread::isMarked( int num ) +bool Thread::isMarked(int num) { - QValueList< int >::iterator it; - for ( it = m_markList.begin(); it != m_markList.end(); ++it ) { - if ( ( *it ) == num ) return TRUE; + QList<int>::iterator it; + for (it = m_markList.begin(); it != m_markList.end(); ++it) { + if ((*it) == num) return true; } - return FALSE; + return false; } /* public */ -bool Thread::setMark( int num, bool newStatus ) +bool Thread::setMark(int num, bool newStatus) { - bool status = isMarked( num ); - if ( status == newStatus ) return FALSE; + bool status = isMarked(num); + if (status == newStatus) return false; - if ( newStatus ) m_markList += num; - else m_markList.remove( num ); + if (newStatus) m_markList += num; + else m_markList.removeAll(num); - return TRUE; + return true; } @@ -125,42 +125,43 @@ /* static functions */ -Thread* Thread::getByURL( const KURL& datURL ) +Thread* Thread::getByUrl(const KUrl& datUrl) { - if ( m_threadDict == 0 ) { - m_threadDict = new QDict<Thread>(); + if (m_threadDict == 0) { + m_threadDict = new QMultiHash<QString, Thread*>(); } - Thread* thread = m_threadDict->find( datURL.prettyURL() ); - if ( thread ) return thread; + Thread* thread = m_threadDict->value(datUrl.prettyUrl()); + if (thread) return thread; - Thread* newThread = new Thread( datURL ); - m_threadDict->insert( datURL.prettyURL(), newThread ); + Thread* newThread = new Thread(datUrl); + m_threadDict->insert(datUrl.prettyUrl(), newThread); return newThread; } /* static & public */ -Thread* Thread::getByURLNew( const KURL& datURL ) +Thread* Thread::getByUrlNew(const KUrl& datUrl) { - if ( m_threadDict == NULL ) return NULL; + if (m_threadDict == 0) return 0; - return m_threadDict->find( datURL.prettyURL() ); + return m_threadDict->value(datUrl.prettyUrl()); } -void Thread::replace( const QString& fromURL, const QString& toURL ) +void Thread::replace(const QString& fromUrl, const QString& toUrl) { - if ( m_threadDict == NULL ) return ; - QDictIterator<Kita::Thread> it( *m_threadDict ); - for ( ; it.current(); ++it ) { - QString url = it.currentKey(); - Kita::Thread* thread = it.current(); - if ( url.find( fromURL ) == 0 ) { - m_threadDict->remove( url ); - url = url.replace( 0, fromURL.length(), toURL ); - thread->m_datURL = url; - m_threadDict->insert( url, thread ); - it.toFirst(); + if (m_threadDict == 0) return ; + QHashIterator<QString, Thread*> it(*m_threadDict); + while (it.hasNext()) { + it.next(); + QString url = it.key(); + Thread* thread = it.value(); + if (url.indexOf(fromUrl) == 0) { + m_threadDict->remove(url); + url = url.replace(0, fromUrl.length(), toUrl); + thread->m_datUrl = url; + m_threadDict->insert(url, thread); + it.toFront(); } } } Modified: kita/trunk/kita/src/libkita/thread.h =================================================================== --- kita/trunk/kita/src/libkita/thread.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/thread.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,58 +7,58 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITATHREAD_H #define KITATHREAD_H +#include <QtCore/QMultiHash> +#include <QtCore/QList> + #include <kurl.h> -#include <qdict.h> -#include <qvaluelist.h> namespace Kita { /** @author Hideki Ikemoto */ - class Thread + class KDE_EXPORT Thread { - static QDict<Thread>* m_threadDict; + static QMultiHash<QString, Thread*>* m_threadDict; - KURL m_datURL; + KUrl m_datUrl; QString m_threadName; int m_resNum; int m_readNum; int m_viewPos; - QValueList< int > m_markList; + QList<int> m_markList; public: - Thread( const KURL& datURL ); + Thread(const KUrl& datUrl); ~Thread(); - const KURL& datURL() const; + const KUrl& datUrl() const; const QString& threadName() const; - void setThreadName( QString threadName ); + void setThreadName(const QString& name); - const int resNum() const; - void setResNum( int num ); + int resNum() const; + void setResNum(int num); - const int readNum() const; - void setReadNum( int num ); + int readNum() const; + void setReadNum(int num); - const int viewPos() const; - void setViewPos( int viewPos ); + int viewPos() const; + void setViewPos(int viewPos); - const QValueList< int >& markList() const; - void setMarkList( const QValueList< int >& markList ); - bool isMarked( int num ); - bool setMark( int num, bool newStatus ); + const QList<int>& markList() const; + void setMarkList(const QList<int>& markList); + bool isMarked(int num); + bool setMark(int num, bool newStatus); /*----------------------*/ - static Thread* getByURL( const KURL& datURL ); - static Thread* getByURLNew( const KURL& datURL ); - static void replace( const QString& fromURL, const QString& toURL ); + static Thread* getByUrl(const KUrl& datUrl); + static Thread* getByUrlNew(const KUrl& datUrl); + static void replace(const QString& fromUrl, const QString& toUrl); }; } Modified: kita/trunk/kita/src/libkita/threadindex.cpp =================================================================== --- kita/trunk/kita/src/libkita/threadindex.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/threadindex.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,257 +7,254 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ + #include "threadindex.h" +#include <QtCore/QFile> + #include <kconfig.h> +#include <KConfigGroup> -#include <qfile.h> - #include "cache.h" +#include "datmanager.h" +#include "kita_misc.h" #include "thread.h" #include "threadinfo.h" -#include "kita_misc.h" -#include "datmanager.h" using namespace Kita; -QString ThreadIndex::getSubject( const KURL& url ) +ThreadIndex::ThreadIndex(const KUrl& url) : m_url(url) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - return getSubjectPrivate( config ); + Cache cache(m_url); + m_indexPath = cache.getIndexPath(); } -void ThreadIndex::setSubject( const KURL& url, const QString& str ) +QString ThreadIndex::getSubject() const { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - setSubjectPrivate( str, config ); + KConfig config(m_indexPath); + return getSubjectPrivate(config); } -int ThreadIndex::getResNum( const KURL& url ) +void ThreadIndex::setSubject(const QString& str) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - return getResNumPrivate( url, config ); + KConfig config(m_indexPath); + setSubjectPrivate(config, str); } -void ThreadIndex::setResNum( const KURL& url, int resNum ) +int ThreadIndex::getResNum() const { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - setResNumPrivate( resNum, config ); + KConfig config(m_indexPath); + return getResNumPrivate(config); } -int ThreadIndex::getReadNum( const KURL& url ) +void ThreadIndex::setResNum(int resNum) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - return getReadNumPrivate( url, config, TRUE ); + KConfig config(m_indexPath); + setResNumPrivate(config, resNum); } -void ThreadIndex::setReadNum( const KURL& url, int readNum ) +int ThreadIndex::getReadNum() const { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - setReadNumPrivate( readNum, config ); + KConfig config(m_indexPath); + return getReadNumPrivate(config, true); } -int ThreadIndex::getViewPos( const KURL& url ) +void ThreadIndex::setReadNum(int readNum) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - return getViewPosPrivate( config ); + KConfig config(m_indexPath); + setReadNumPrivate(config, readNum); } -void ThreadIndex::setViewPos( const KURL& url, int viewPos ) +int ThreadIndex::getViewPos() const { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - setViewPosPrivate( viewPos, config ); + KConfig config(m_indexPath); + return getViewPosPrivate(config); } -void ThreadIndex::setMarkList( const KURL& url, const QValueList< int >& markList ) +void ThreadIndex::setViewPos(int viewPos) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - setMarkListPrivate( markList, config ); + KConfig config(m_indexPath); + setViewPosPrivate(config, viewPos); } +void ThreadIndex::setMarkList(const QList<int>& markList) +{ + KConfig config(m_indexPath); + setMarkListPrivate(config, markList); +} + /*------------------------------------------------------------*/ -/* load thread information */ /* public */ /* static */ -void ThreadIndex::loadIndex( Kita::Thread* thread, const KURL& url, bool checkCached ) +/* load thread information */ /* public */ +void ThreadIndex::loadIndex(Thread* thread, bool checkCached) const { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - + KConfig config(m_indexPath); /* load read number */ - int readNum = getReadNumPrivate( url, config, checkCached ); - if ( readNum == 0 ) return ; /* cache does not exist. */ - thread->setReadNum( readNum ); + int readNum = getReadNumPrivate(config, checkCached); + if (readNum == 0) return ; /* cache does not exist. */ + thread->setReadNum(readNum); /* load thread name */ - QString subject = getSubjectPrivate( config ); - if ( subject == QString::null && thread->threadName() != QString::null ) { + QString subject = getSubjectPrivate(config); + if (subject.isEmpty() && !thread->threadName().isEmpty()) { subject = thread->threadName(); - config.writeEntry( "Subject", subject ); + KConfigGroup group = config.group(""); + group.writeEntry("Subject", subject); } - if ( subject == QString::null ) thread->setThreadName( "?" ); - else thread->setThreadName( subject ); + if (subject.isEmpty()) thread->setThreadName("?"); + else thread->setThreadName(subject); /* load res number */ - thread->setResNum( getResNumPrivate( url, config ) ); + thread->setResNum(getResNumPrivate(config)); /* load view pos */ - thread->setViewPos( getViewPosPrivate( config ) ); - if ( thread->viewPos() > thread->readNum() ) thread->setReadNum( thread->viewPos() ); + thread->setViewPos(getViewPosPrivate(config)); + if (thread->viewPos() > thread->readNum()) + thread->setReadNum(thread->viewPos()); /* load mark */ - thread->setMarkList( getMarkListPrivate( config ) ); + thread->setMarkList(getMarkListPrivate(config)); } -/* save thread information */ /* public */ /* static */ -void ThreadIndex::saveIndex( const Kita::Thread* thread, const KURL& url ) +/* save thread information */ /* public */ +void ThreadIndex::saveIndex(const Thread* thread) { /* If readNum == 0, delete idx file */ - if ( thread->readNum() == 0 ) { - - QString indexPath = Kita::DatManager::getCacheIndexPath( url ); - QFile::remove( indexPath ); - qDebug( "delete %s", indexPath.ascii() ); + if (thread->readNum() == 0) { + QFile::remove(m_indexPath); } + KConfig config(m_indexPath); - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - /* save thread name */ - setSubjectPrivate( thread->threadName(), config ); + setSubjectPrivate(config, thread->threadName()); /* save res number */ - setResNumPrivate( thread->resNum(), config ); + setResNumPrivate(config, thread->resNum()); /* save read number */ - setReadNumPrivate( thread->readNum(), config ); + setReadNumPrivate(config, thread->readNum()); /* save view pos */ - setViewPosPrivate( thread->viewPos(), config ); + setViewPosPrivate(config, thread->viewPos()); /* save mark */ - setMarkListPrivate( thread->markList(), config ); + setMarkListPrivate(config, thread->markList()); /* save "cache" */ - KURL datURL = Kita::getDatURL( url ); - int num = ( thread->viewPos() ? thread->viewPos() : thread->readNum() ); - KitaThreadInfo::setReadNum( datURL.prettyURL(), num ); + KUrl datUrl = getDatUrl(m_url); + int num = (thread->viewPos() ? thread->viewPos() : thread->readNum()); + ThreadInfo::setReadNum(datUrl.prettyUrl(), num); } /*------------------------------------------------------------------*/ -/* private */ /* static */ -QString ThreadIndex::getSubjectPrivate( KConfig& config ) +/* private */ +QString ThreadIndex::getSubjectPrivate(const KConfig& config) const { - return config.readEntry( "Subject" ); + return config.group("").readEntry("Subject"); } -/* private */ /* static */ -void ThreadIndex::setSubjectPrivate( const QString& str, KConfig& config ) +/* private */ +void ThreadIndex::setSubjectPrivate(KConfig& config, const QString& str) { - config.writeEntry( "Subject", str ); + config.group("").writeEntry("Subject", str); } /*-------*/ -/* private */ /* static */ -int ThreadIndex::getResNumPrivate( const KURL& url, KConfig& config ) +/* private */ +int ThreadIndex::getResNumPrivate(KConfig& config) const { - int resNum = config.readNumEntry( "ResNum" ); + int resNum = config.group("").readEntry("ResNum", 0); /* use obsoleted "cache" file */ - if ( !resNum ) { - KURL datURL = Kita::getDatURL( url ); - resNum = KitaThreadInfo::readNum( datURL.prettyURL() ); - if ( resNum ) config.writeEntry( "ResNum", resNum ); + if (!resNum) { + KUrl datUrl = getDatUrl(m_url); + resNum = ThreadInfo::readNum(datUrl.prettyUrl()); + if (resNum) + config.group("").writeEntry("ResNum", resNum); } return resNum; } -/* private */ /* static */ -void ThreadIndex::setResNumPrivate( int resNum, KConfig& config ) +/* private */ +void ThreadIndex::setResNumPrivate(KConfig& config, int resNum) { - config.writeEntry( "ResNum", resNum ); + config.group("").writeEntry("ResNum", resNum); } /*-------*/ -/* private */ /* static */ -int ThreadIndex::getReadNumPrivate( const KURL& url, KConfig& config, bool checkCached ) +/* private */ +int ThreadIndex::getReadNumPrivate(KConfig& config, bool checkCached) const { /* If cache does not exist, return 0 */ - if ( checkCached ) { - - QString path = Kita::DatManager::getCachePath( url ); - if ( ! QFile::exists( path ) ) { - qDebug( "%s does not exits", path.ascii() ); + if (checkCached) { + Cache cache(m_url); + QString path = cache.getPath(); + if (!QFile::exists(path)) { return 0; } } - int readNum = config.readNumEntry( "ReadNum" ); + int readNum = config.group("").readEntry("ReadNum", 0); - if ( !readNum ) { + if (!readNum) { /* use ViewPos instead of ReadNum. */ - readNum = config.readNumEntry( "ViewPos" ); + readNum = config.group("").readEntry("ViewPos", 0); /* use obsoleted "cache" file */ - if ( !readNum ) { - KURL datURL = Kita::getDatURL( url ); - readNum = KitaThreadInfo::readNum( datURL.prettyURL() ); + if (!readNum) { + KUrl datUrl = getDatUrl(m_url); + readNum = ThreadInfo::readNum(datUrl.prettyUrl()); } - if ( readNum ) config.writeEntry( "ReadNum", readNum ); + if (readNum) + config.group("").writeEntry("ReadNum", readNum); } return readNum; } -/* private */ /* static */ -void ThreadIndex::setReadNumPrivate( int readNum, KConfig& config ) +/* private */ +void ThreadIndex::setReadNumPrivate(KConfig& config, int readNum) { - config.writeEntry( "ReadNum", readNum ); + config.group("").writeEntry("ReadNum", readNum); } /*-------*/ -/* private */ /* static */ -int ThreadIndex::getViewPosPrivate( KConfig& config ) +/* private */ +int ThreadIndex::getViewPosPrivate(const KConfig& config) const { - return config.readNumEntry( "ViewPos" ); + return config.group("").readEntry("ViewPos", 0); } -/* private */ /* static */ -void ThreadIndex::setViewPosPrivate( int viewPos, KConfig& config ) +/* private */ +void ThreadIndex::setViewPosPrivate(KConfig& config, int viewPos) { - config.writeEntry( "ViewPos", viewPos ); + config.group("").writeEntry("ViewPos", viewPos); } /*-------*/ -/* private */ /* static */ -QValueList< int > ThreadIndex::getMarkListPrivate( KConfig& config ) +/* private */ +QList<int> ThreadIndex::getMarkListPrivate(const KConfig& config) const { - return config.readIntListEntry( "Mark" ); + QList<int> default_value; + return config.group("").readEntry("Mark", default_value); } -/* private */ /* static */ -void ThreadIndex::setMarkListPrivate( const QValueList< int >& markList, KConfig& config ) +/* private */ +void ThreadIndex::setMarkListPrivate(KConfig& config, + const QList<int>& markList) { - config.writeEntry( "Mark", markList ); + config.group("").writeEntry("Mark", markList); } Modified: kita/trunk/kita/src/libkita/threadindex.h =================================================================== --- kita/trunk/kita/src/libkita/threadindex.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/threadindex.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,12 +10,11 @@ #ifndef KITATHREADINDEX_H #define KITATHREADINDEX_H -#define USE_INDEX +#include <QtCore/QList> +#include <QtCore/QString> -#include <qstring.h> -#include <qvaluelist.h> +#include <kurl.h> -class KURL; class KConfig; namespace Kita @@ -25,44 +24,49 @@ /** @author Hideki Ikemoto */ - class ThreadIndex + class KDE_EXPORT ThreadIndex { public: - static QString getSubject( const KURL& url ); - static void setSubject( const KURL& url, const QString& str ); + ThreadIndex(const KUrl& url); - static int getResNum( const KURL& url ); - static void setResNum( const KURL& url, int resNum ); + QString getSubject() const; + void setSubject(const QString& str); - static int getReadNum( const KURL& url ); - static void setReadNum( const KURL& url, int readNum ); + int getResNum() const; + void setResNum(int resNum); - static int getViewPos( const KURL& url ); - static void setViewPos( const KURL& url, int viewPos ); + int getReadNum() const; + void setReadNum(int readNum); - static void setMarkList( const KURL& url, const QValueList< int >& markList ); + int getViewPos() const; + void setViewPos(int viewPos); + void setMarkList(const QList<int>& markList); + /*---------------------------------*/ - static void loadIndex( Kita::Thread* thread, const KURL& url, bool checkCached = TRUE ); - static void saveIndex( const Kita::Thread* thread, const KURL& url ); + void loadIndex(Thread* thread, bool checkCached = true) const; + void saveIndex(const Thread* thread); private: - static QString getSubjectPrivate( KConfig& config ); - static void setSubjectPrivate( const QString& str, KConfig& config ); + QString getSubjectPrivate(const KConfig& config) const; + void setSubjectPrivate(KConfig& config, const QString& str); - static int getResNumPrivate( const KURL& url, KConfig& config ); - static void setResNumPrivate( int resNum, KConfig& config ); + int getResNumPrivate(KConfig& config) const; + void setResNumPrivate(KConfig& config, int resNum); - static int getReadNumPrivate( const KURL& url, KConfig& config, bool checkCached ); - static void setReadNumPrivate( int readNum, KConfig& config ); + int getReadNumPrivate(KConfig& config, bool checkCached) const; + void setReadNumPrivate(KConfig& config, int readNum); - static int getViewPosPrivate( KConfig& config ); - static void setViewPosPrivate( int viewPos, KConfig& config ); + int getViewPosPrivate(const KConfig& config) const; + void setViewPosPrivate(KConfig& config, int viewPos); - static QValueList< int > getMarkListPrivate( KConfig& config ); - static void setMarkListPrivate( const QValueList< int >& markList, KConfig& config ); + QList<int> getMarkListPrivate(const KConfig& config) const; + void setMarkListPrivate(KConfig& config, const QList<int>& markList); + + KUrl m_url; + QString m_indexPath; }; } Modified: kita/trunk/kita/src/libkita/threadinfo.cpp =================================================================== --- kita/trunk/kita/src/libkita/threadinfo.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/threadinfo.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,75 +10,76 @@ #include "threadinfo.h" -#include <kurl.h> +#include <QtCore/QDataStream> +#include <QtCore/QMap> -#include <qmap.h> -#include <qdatastream.h> +using namespace Kita; -KitaThreadInfo* KitaThreadInfo::instance = 0; +ThreadInfo* ThreadInfo::instance = 0; -KitaThreadInfo::KitaThreadInfo() : m_readDict() +ThreadInfo::ThreadInfo() : m_readDict() {} -KitaThreadInfo::~KitaThreadInfo() +ThreadInfo::~ThreadInfo() {} -KitaThreadInfo* KitaThreadInfo::getInstance() +ThreadInfo* ThreadInfo::getInstance() { - if ( instance == 0 ) { - instance = new KitaThreadInfo(); + if (instance == 0) { + instance = new ThreadInfo(); } return instance; } -int KitaThreadInfo::readNum( const QString& url ) +int ThreadInfo::readNum(const QString& url) { - KitaThreadInfo * instance = KitaThreadInfo::getInstance(); - if ( instance->m_readDict.contains( url ) ) { + ThreadInfo * instance = ThreadInfo::getInstance(); + if (instance->m_readDict.contains(url)) { return instance->m_readDict[ url ]; } else { return 0; } } -void KitaThreadInfo::setReadNum( const QString& url, int num ) +void ThreadInfo::setReadNum(const QString& url, int num) { - KitaThreadInfo * instance = KitaThreadInfo::getInstance(); - instance->m_readDict.insert( url, num ); + ThreadInfo * instance = ThreadInfo::getInstance(); + instance->m_readDict.insert(url, num); } -void KitaThreadInfo::replace( const QString fromURL, const QString toURL ) +void ThreadInfo::replace(const QString& fromUrl, const QString& toUrl) { QMap<QString, int>::Iterator it; - KitaThreadInfo* instance = KitaThreadInfo::getInstance(); - if ( instance == NULL ) return ; + ThreadInfo* instance = ThreadInfo::getInstance(); + if (instance == 0) return ; - for ( it = instance->m_readDict.begin(); it != instance->m_readDict.end(); ++it ) { + for (it = instance->m_readDict.begin(); it != instance->m_readDict.end(); ++it) { QString url = it.key(); - int num = it.data(); - if ( url.find( fromURL ) == 0 ) { - url = url.replace( 0, fromURL.length(), toURL ); - instance->m_readDict.erase( it ); - instance->m_readDict.insert( url, num ); - it = instance->m_readDict.begin(); // TODO もっと早い方法は? + int num = it.value(); + if (url.indexOf(fromUrl) == 0) { + url = url.replace(0, fromUrl.length(), toUrl); + instance->m_readDict.erase(it); + instance->m_readDict.insert(url, num); + it = instance->m_readDict.begin(); // TODO ãã£ã¨æ©ãæ¹æ³ã¯? } } } -void KitaThreadInfo::removeThreadInfo( const QString& url ) +void ThreadInfo::removeThreadInfo(const QString& url) { - KitaThreadInfo * instance = KitaThreadInfo::getInstance(); - instance->m_readDict.remove( url ); + ThreadInfo * instance = ThreadInfo::getInstance(); + instance->m_readDict.remove(url); } +namespace Kita { + QDataStream& operator<<(QDataStream& s, ThreadInfo& c) + { + s << c.m_readDict; + return s; + } -QDataStream& operator<<( QDataStream& s, KitaThreadInfo& c ) -{ - s << c.m_readDict; - return s; + QDataStream& operator>>(QDataStream& s, ThreadInfo& c) + { + s >> c.m_readDict; + return s; + } } - -QDataStream& operator>>( QDataStream& s, KitaThreadInfo& c ) -{ - s >> c.m_readDict; - return s; -} Modified: kita/trunk/kita/src/libkita/threadinfo.h =================================================================== --- kita/trunk/kita/src/libkita/threadinfo.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/libkita/threadinfo.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,35 +7,36 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#ifndef KITATHREADINFO_H +#define KITATHREADINFO_H -#ifndef _KITATHREADINFO_H_ -#define _KITATHREADINFO_H_ +#include <QtCore/QMap> -#include <kurl.h> +#include <kdemacros.h> -#include <qmap.h> - -/** - * - * Hideki Ikemoto - **/ - -class KitaThreadInfo +namespace Kita { -public: - static KitaThreadInfo* getInstance(); - static void setReadNum( const QString& url, int num ); - static int readNum( const QString& url ); - static void replace( const QString fromURL, const QString toURL ); - static void removeThreadInfo( const QString& url ); - friend QDataStream& operator<<( QDataStream& s, KitaThreadInfo& c ); - friend QDataStream& operator>>( QDataStream& s, KitaThreadInfo& c ); -private: - KitaThreadInfo(); - ~KitaThreadInfo(); - QMap<QString, int> m_readDict; - QMap<QString, int> m_resNumDict; - static KitaThreadInfo* instance; -}; + /** + * + * Hideki Ikemoto + **/ + class KDE_EXPORT ThreadInfo + { + public: + static ThreadInfo* getInstance(); + static void setReadNum(const QString& url, int num); + static int readNum(const QString& url); + static void replace(const QString& fromUrl, const QString& toUrl); + static void removeThreadInfo(const QString& url); + KDE_EXPORT friend QDataStream& operator<<(QDataStream& s, ThreadInfo& c); + KDE_EXPORT friend QDataStream& operator>>(QDataStream& s, ThreadInfo& c); + private: + ThreadInfo(); + ~ThreadInfo(); + QMap<QString, int> m_readDict; + QMap<QString, int> m_resNumDict; + static ThreadInfo* instance; + }; +} #endif Copied: kita/trunk/kita/src/libkita/writeconfig.kcfg (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/writeconfig.kcfg) =================================================================== --- kita/trunk/kita/src/libkita/writeconfig.kcfg (rev 0) +++ kita/trunk/kita/src/libkita/writeconfig.kcfg 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <kcfgfile name="kitarc" /> + <group name="Write"> + <entry name="DefaultName" type="String"> + <label>Default name.</label> + </entry> + <entry name="DefaultNameUseAlways" type="Bool"> + <label>Whether use default name or not.</label> + <default>false</default> + </entry> + <entry name="DefaultMail" type="String"> + <label>Default mail address.</label> + </entry> + <entry name="DefaultSage" type="Bool"> + <label>Whether use 'sage' as default or not.</label> + <default>true</default> + </entry> + </group> +</kcfg> Copied: kita/trunk/kita/src/libkita/writeconfig.kcfgc (from rev 2558, kita/branches/KITA-KDE4/kita/src/libkita/writeconfig.kcfgc) =================================================================== --- kita/trunk/kita/src/libkita/writeconfig.kcfgc (rev 0) +++ kita/trunk/kita/src/libkita/writeconfig.kcfgc 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,6 @@ +File=writeconfig.kcfg +ClassName=WriteConfig +NameSpace=Kita +Singleton=true +Mutators=true +Visibility=KDE_EXPORT Modified: kita/trunk/kita/src/main.cpp =================================================================== --- kita/trunk/kita/src/main.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/main.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,66 +10,68 @@ #include "mainwindow.h" -#include <config.h> +#include <cstdlib> // setenv() -#include <kuniqueapplication.h> -#include <dcopclient.h> #include <kaboutdata.h> #include <kcmdlineargs.h> -#include <klocale.h> +#include <kuniqueapplication.h> -#include "libkita/config_xt.h" +#include "libkita/config.h" +#include "libkita/globalconfig.h" static const char *description = - I18N_NOOP( "Kita - 2ch client for KDE" ); + I18N_NOOP("Kita - 2ch client for KDE"); -static const char *version = VERSION; +using namespace Kita; -static KCmdLineOptions options[] = - { - { "+[URL]", I18N_NOOP( "Document to open." ), 0 }, - { "boardlist <boardlist>", I18N_NOOP( "board list's URL." ), "http://menu.2ch.net/bbsmenu.html" }, - { 0, 0, 0 } - }; - -int main( int argc, char **argv ) +int main(int argc, char **argv) { - KAboutData about( "kita", I18N_NOOP( "Kita" ), version, description, - KAboutData::License_GPL, "(C) 2003-2004 Kita Developers", 0, 0, "ikemo****@users*****" ); - about.addAuthor( "Hideki Ikemoto", I18N_NOOP( "maintainer, initial code" ), "ikemo****@users*****" ); - about.addAuthor( "konqueror plugin no hito", I18N_NOOP( "konqueror plugin, KDE part" ), "ogiri****@users*****" ); - about.addAuthor( "421", I18N_NOOP( "kitanavi, threadview's improvement" ) ); - about.addAuthor( "Toshihiko Okada", I18N_NOOP( "improvements" ), "tossi****@users*****" ); - about.addAuthor( "75", I18N_NOOP( "stylesheet support" ) ); - KCmdLineArgs::init( argc, argv, &about ); - KCmdLineArgs::addCmdLineOptions( options ); + // for code page 932 with NEC special characters + setenv("UNICODEMAP_JP", "cp932,nec-vdc", 1); + KAboutData about("kita", "kita", ki18n("Kita"), VERSION, ki18n(description), + KAboutData::License_GPL, ki18n("(C) 2003-2010 Kita Developers"), + KLocalizedString(), QByteArray(), "ikemo****@users*****"); + about.addAuthor(ki18n("Hideki Ikemoto"), ki18n("maintainer, initial code"), + "ikemo****@users*****"); + about.addAuthor(ki18n("konqueror plugin no hito"), + ki18n("konqueror plugin, KDE part"), "ogiri****@users*****"); + about.addAuthor(ki18n("421"), ki18n("kitanavi, threadview's improvement")); + about.addAuthor(ki18n("Toshihiko Okada"), ki18n("improvements"), + "tossi****@users*****"); + about.addAuthor(ki18n("75"), ki18n("stylesheet support")); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineOptions options; + options.add("+[URL]", ki18n("Document to open.")); + options.add("boardlist <boardlist>", ki18n("board list's URL."), + "http://menu.2ch.net/bbsmenu.html"); + KCmdLineArgs::addCmdLineOptions(options); KUniqueApplication app; // register ourselves as a dcop client - app.dcopClient() ->registerAs( app.name(), FALSE ); +// app.dcopClient() ->registerAs(app.name(), FALSE); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); - Kita::Config::setBoardListUrl( QString( args->getOption( "boardlist" ) ) ); + GlobalConfig::setBoardListUrl(QString(args->getOption("boardlist"))); // see if we are starting with session management - if ( app.isRestored() ) - RESTORE( KitaMainWindow ) - else { + if (app.isSessionRestored()) { + kRestoreMainWindows<MainWindow>(); + } else { // no session.. just start up normally KCmdLineArgs * args = KCmdLineArgs::parsedArgs(); - if ( args->count() == 0 ) { - KitaMainWindow * widget = new KitaMainWindow; + if (args->count() == 0) { + MainWindow * widget = new MainWindow; widget->show(); } else { int i = 0; - for ( ; i < args->count(); i++ ) { - KitaMainWindow *widget = new KitaMainWindow; + for (; i < args->count(); i++) { + MainWindow *widget = new MainWindow; widget->show(); - widget->load( args->url( i ) ); + widget->load(args->url(i)); } } args->clear(); - } + } return app.exec(); } Modified: kita/trunk/kita/src/mainwindow.cpp =================================================================== --- kita/trunk/kita/src/mainwindow.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/mainwindow.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,72 +10,54 @@ #include "mainwindow.h" -#include "prefs/prefs.h" +#include <QtCore/QEvent> +#include <QtCore/QFile> +#include <QtGui/QBoxLayout> +#include <QtGui/QKeyEvent> +#include <QtGui/QSplitter> -#include "threadview.h" -#include "threadtabwidget.h" -#include "boardview.h" -#include "boardtabwidget.h" -#include "bbsview.h" +#include <kaction.h> +#include <kactioncollection.h> +#include <kapplication.h> +#include <kconfig.h> +#include <kedittoolbar.h> +#include <kglobal.h> +#include <klineedit.h> +#include <klocale.h> +#include <kmenubar.h> +#include <kshortcutsdialog.h> +#include <kstandarddirs.h> +#include <kstatusbar.h> +#include <ktoggleaction.h> +#include <ktoolbar.h> +#include <kurl.h> +#include <kxmlguifactory.h> + #include "bbstabwidget.h" -#include "writetabwidget.h" +#include "boardtabwidget.h" +#include "threadtabwidget.h" #include "viewmediator.h" - -#include "libkita/threadinfo.h" +#include "writetabwidget.h" +#include "libkita/abone.h" +#include "libkita/account.h" +#include "libkita/accountconfig.h" +#include "libkita/asciiart.h" +#include "libkita/colorconfig.h" +#include "libkita/datmanager.h" #include "libkita/favoriteboards.h" #include "libkita/favoritethreads.h" +#include "libkita/globalconfig.h" #include "libkita/kita_misc.h" -#include "libkita/account.h" -#include "libkita/datmanager.h" -#include "libkita/boardmanager.h" -#include "libkita/config_xt.h" -#include "libkita/asciiart.h" -#include "libkita/abone.h" +#include "libkita/threadinfo.h" +#include "libkita/writeconfig.h" +#include "prefs/preferences.h" -#include <qdragobject.h> -#include <qtextcodec.h> -#include <qevent.h> -#include <qregexp.h> -#include <qmessagebox.h> -#include <qclipboard.h> -#include <qpushbutton.h> -#include <qlayout.h> +using namespace Kita; -#include <klineedit.h> -#include <kglobal.h> -#include <klocale.h> -#include <kiconloader.h> -#include <kmenubar.h> -#include <kstatusbar.h> -#include <kkeydialog.h> -#include <kaccel.h> -#include <kio/netaccess.h> -#include <kuserprofile.h> -#include <kfiledialog.h> -#include <kconfig.h> -#include <kurl.h> -#include <krun.h> -#include <kstandarddirs.h> -#include <kdebug.h> -#include <ksimpleconfig.h> -#include <kedittoolbar.h> -#include <kstdaccel.h> -#include <kaction.h> -#include <kstdaction.h> -#include <kshortcut.h> -#include <kaboutdata.h> -#include <kparts/partmanager.h> -#include <kdeversion.h> -#include <kglobal.h> - -KitaMainWindow::KitaMainWindow() - : KMainWindow( 0, "Kita" ) +MainWindow::MainWindow() : KXmlGuiWindow(0), m_prefDialog(0) { - // FIXME: merge *.po - KGlobal::locale() ->insertCatalogue( "kitapart" ); - // accept dnd - setAcceptDrops( TRUE ); + setAcceptDrops(true); // setup view, dock setupView(); @@ -87,22 +69,22 @@ loadCache(); // load ascii art - Kita::AsciiArtConfig::self()->readConfig(); - if ( Kita::AsciiArtConfig::self()->asciiArtList().empty() ) { + AsciiArtConfig::self()->readConfig(); + if (AsciiArtConfig::self()->asciiArtList().isEmpty()) { loadAsciiArt(); } // load abone lists - Kita::AboneConfig::self()->readConfig(); - if ( Kita::AboneConfig::self()->aboneIDList().empty() ) { + AboneConfig::self()->readConfig(); + if (AboneConfig::self()->aboneIDList().isEmpty()) { loadAboneIDList(); } - if ( Kita::AboneConfig::self()->aboneNameList().empty() ) { + if (AboneConfig::self()->aboneNameList().isEmpty()) { loadAboneNameList(); } - if ( Kita::AboneConfig::self()->aboneWordList().empty() ) { + if (AboneConfig::self()->aboneWordList().isEmpty()) { loadAboneWordList(); } @@ -112,7 +94,10 @@ // for compativility loadCompletion(); - Kita::Config::self()->readConfig(); + AccountConfig::self()->readConfig(); + ColorConfig::self()->readConfig(); + GlobalConfig::self()->readConfig(); + WriteConfig::self()->readConfig(); // apply the saved mainwindow settings, if any, and ask the mainwindow // to automatically save settings if changed: window size, toolbar @@ -120,23 +105,23 @@ setAutoSaveSettings(); // set list font - setFont( Kita::Config::font() ); + setFont(GlobalConfig::font()); // allow the view to change the statusbar and caption - connect( m_urlLine, SIGNAL( returnPressed() ), - SLOT( slotURLLine() ) ); + connect(m_urlLine, SIGNAL(returnPressed()), + SLOT(slotUrlLine())); - QPopupMenu* settingsPopup = static_cast<QPopupMenu *>( factory() ->container( "settings", this ) ); - connect( settingsPopup, SIGNAL( aboutToShow() ), - SLOT( settingsMenuAboutToShow() ) ); + QMenu* settingsPopup = static_cast<QMenu *>(factory() ->container("settings", this)); + connect(settingsPopup, SIGNAL(aboutToShow()), + SLOT(settingsMenuAboutToShow())); // load favorite boards; loadFavoriteBoards(); // load boad list { - QString configPath = locateLocal( "appdata", "board_list" ); - if ( QFile::exists( configPath ) ) { + QString configPath = KStandardDirs::locateLocal("appdata", "board_list"); + if (QFile::exists(configPath)) { m_bbsTab->showBoardList(); m_bbsTab->loadOpened(); } else { @@ -150,16 +135,16 @@ // update favorite list ViewMediator::getInstance()->updateFavoriteListView(); - if ( Kita::Config::autoLogin() ) { + if (AccountConfig::autoLogin()) { login(); } } -KitaMainWindow::~KitaMainWindow() +MainWindow::~MainWindow() { - Kita::AboneConfig::self()->writeConfig(); + AboneConfig::self()->writeConfig(); - Kita::AsciiArtConfig::self()->writeConfig(); + AsciiArtConfig::self()->writeConfig(); saveFavoriteBoards(); @@ -167,378 +152,375 @@ saveCache(); - saveMainWindowSettings( KGlobal::config(), "MainWindow" ); + saveMainWindowSettings(KGlobal::config().data()->group("MainWindow")); - Kita::Config::self()->writeConfig(); + AccountConfig::self()->writeConfig(); + ColorConfig::self()->writeConfig(); + GlobalConfig::self()->writeConfig(); + WriteConfig::self()->writeConfig(); - Kita::DatManager::deleteAllDatInfo(); + DatManager::deleteAllDatInfo(); } -void KitaMainWindow::load( const KURL& url ) +void MainWindow::load(const KUrl& url) { - setCaption( url.url() ); + setCaption(url.url()); } -void KitaMainWindow::bookmark( const QString& datURL, bool on ) +void MainWindow::bookmark(const QString& datUrl, bool on) { FavoriteThreads * favorite = FavoriteThreads::getInstance(); - if ( on ) { - favorite->insert( datURL ); - } else { - favorite->remove( datURL ); - } + on ? favorite->insert(datUrl) : favorite->remove(datUrl); saveFavorites(); ViewMediator::getInstance()->updateFavoriteListView(); } -void KitaMainWindow::login() +void MainWindow::login() { - if ( Kita::Account::login( Kita::Config::userID(), Kita::Config::password() ) ) { - setMainStatus( i18n( "Login succeeded." ) ); + if (Account::login(AccountConfig::userID(), AccountConfig::password())) { + setMainStatus(i18nc("@info:status", "Login succeeded.")); } else { - setMainStatus( i18n( "Login failed." ) ); + setMainStatus(i18nc("@info:status", "Login failed.")); } } -void KitaMainWindow::newToolbarConfig() +void MainWindow::newToolbarConfig() { // this slot is called when user clicks "Ok" or "Apply" in the toolbar editor. // recreate our GUI, and re-apply the settings (e.g. "text under icons", etc.) - applyMainWindowSettings( KGlobal::config(), "MainWindow" ); + applyMainWindowSettings(KGlobal::config().data()->group("MainWindow")); } -void KitaMainWindow::optionsShowToolbar() +void MainWindow::optionsShowToolbar() { // this is all very cut and paste code for showing/hiding the // toolbar - if ( m_toolbarAction->isChecked() ) { + if (m_toolbarAction->isChecked()) { toolBar() ->show(); } else { toolBar() ->hide(); } } -void KitaMainWindow::optionsShowStatusbar() +void MainWindow::optionsShowStatusbar() { // this is all very cut and paste code for showing/hiding the // statusbar - if ( m_statusbarAction->isChecked() ) { + if (m_statusbarAction->isChecked()) { statusBar() ->show(); } else { statusBar() ->hide(); } } -void KitaMainWindow::optionsConfigureKeys() +void MainWindow::optionsConfigureKeys() { - KKeyDialog dlg( TRUE, this ); - dlg.insert( actionCollection(), "Kita" ); - dlg.configure(); + KShortcutsDialog::configure(actionCollection()); } -void KitaMainWindow::optionsConfigureToolbars() +void MainWindow::optionsConfigureToolbars() { // use the standard toolbar editor - KEditToolbar dlg( factory() ); - connect( &dlg, SIGNAL( newToolbarConfig() ), - SLOT( newToolbarConfig() ) ); + KEditToolBar dlg(factory()); + connect(&dlg, SIGNAL(newToolbarConfig()), + SLOT(newToolbarConfig())); dlg.exec(); } -void KitaMainWindow::optionsPreferences() +void MainWindow::optionsPreferences() { - // popup some sort of preference dialog, here - if ( KConfigDialog::showDialog( "Kita Preferences" ) ) { - return; + if (m_prefDialog == 0) { + m_prefDialog = new Preferences(this); + m_prefDialog->load(); + connect(m_prefDialog, SIGNAL(fontChanged(const QFont&)), + SLOT(setFont(const QFont&))); + m_prefDialog->show(); + } else { + m_prefDialog->show(); + m_prefDialog->raise(); } - - KitaPreferences* dialog = new KitaPreferences( this ); - - connect( dialog, SIGNAL( fontChanged( const QFont& ) ), - SLOT( setFont( const QFont& ) ) ); - - dialog->show(); } -void KitaMainWindow::settingsMenuAboutToShow() +void MainWindow::settingsMenuAboutToShow() { - m_toolbarAction->setChecked( toolBar() ->isVisible() ); - m_statusbarAction->setChecked( statusBar() ->isVisible() ); + m_toolbarAction->setChecked(toolBar() ->isVisible()); + m_statusbarAction->setChecked(statusBar() ->isVisible()); } -void KitaMainWindow::setFont( const QFont& font ) +void MainWindow::setFont(const QFont& font) { - m_boardTab->setFont( font ); - m_bbsTab->setFont( font ); + m_boardTab->setFont(font); + m_bbsTab->setFont(font); } -void KitaMainWindow::setUrl( const KURL& url ) +void MainWindow::setUrl(const KUrl& url) { - m_urlLine->setText( url.url() ); + m_urlLine->setText(url.url()); } -void KitaMainWindow::slotEditCopy() +void MainWindow::slotEditCopy() { - QWidget * widget = kapp->focusWidget(); + QWidget * widget = KApplication::kApplication()->focusWidget(); - if ( widget ) { - QKeyEvent e( QEvent::KeyPress, Key_C, 'C', ControlButton ); - QApplication::sendEvent( widget, &e ); + if (widget) { + QKeyEvent e(QEvent::KeyPress, Qt::Key_C, Qt::ControlModifier); + QApplication::sendEvent(widget, &e); } } -void KitaMainWindow::setMainStatus( const QString& statusStr ) +void MainWindow::setMainStatus(const QString& statusStr) { // display the text on the statusbar - statusBar() ->message( statusStr ); + statusBar()->showMessage(statusStr); } -void KitaMainWindow::slotURLLine() +void MainWindow::slotUrlLine() { - KURL url = m_urlLine->text(); - KURL datURL = Kita::getDatURL( url ); - m_threadTab->slotShowMainThread( datURL ); + KUrl url = m_urlLine->text(); + KUrl datUrl = getDatUrl(url); + m_threadTab->slotShowMainThread(datUrl); } // // private method // -void KitaMainWindow::setupActions() +void MainWindow::setupActions() { - KStdAction::quit( this, SLOT( close() ), actionCollection() ); - KStdAction::copy( this, SLOT( slotEditCopy() ), actionCollection() ); + KStandardAction::quit(this, SLOT(close()), actionCollection()); + KStandardAction::copy(this, SLOT(slotEditCopy()), actionCollection()); - m_toolbarAction = KStdAction::showToolbar( this, - SLOT( optionsShowToolbar() ), - actionCollection() ); + setStandardToolBarMenuEnabled(true); - m_statusbarAction = KStdAction::showStatusbar( this, - SLOT( optionsShowStatusbar() ), - actionCollection() ); + m_toolbarAction + = new KToggleAction(i18nc("@action:inmenu", "Show Toolbar"), this); + actionCollection()->addAction("toolBar", m_toolbarAction); + connect(m_toolbarAction, SIGNAL(toggled(bool)), + SLOT(optionsShowToolbar())); - m_urlLine = new KLineEdit( "", 0 ); + m_statusbarAction = KStandardAction::showStatusbar(this, + SLOT(optionsShowStatusbar()), + actionCollection()); - new KWidgetAction( m_urlLine, - i18n( "URL Line" ), - 0, - this, - SLOT( slotURLLine() ), - actionCollection(), "url_line_action" ); + m_urlLine = new KLineEdit; + KAction* urlLineAction = new KAction(this); + urlLineAction->setDefaultWidget(m_urlLine); + urlLineAction->setText(i18nc("@action:intoolbar", "Location Bar")); + actionCollection()->addAction("url_line_action", urlLineAction); + connect(urlLineAction, SIGNAL(triggered()), this, SLOT(slotUrlLine())); - KStdAction::keyBindings( this, SLOT( optionsConfigureKeys() ), actionCollection() ); - KStdAction::configureToolbars( this, SLOT( optionsConfigureToolbars() ), actionCollection() ); - KStdAction::preferences( this, SLOT( optionsPreferences() ), actionCollection() ); + KStandardAction::keyBindings(this, SLOT(optionsConfigureKeys()), + actionCollection()); + KStandardAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), + actionCollection()); + KStandardAction::preferences(this, SLOT(optionsPreferences()), + actionCollection()); - new KAction( i18n( "Load board list" ), - 0, - m_bbsTab, - SLOT( updateBoardList() ), - actionCollection(), - "load_board_list" ); + KAction* loadBoardAction + = actionCollection()->addAction("load_board_list"); + loadBoardAction->setText(i18nc("@action:inmenu", "Load Board List")); + connect(loadBoardAction, SIGNAL(triggered()), + m_bbsTab, SLOT(updateBoardList())); - new KAction( i18n( "Login" ), - 0, - this, - SLOT( login() ), - actionCollection(), - "login" ); + KAction* loginAction = actionCollection()->addAction("login"); + loginAction->setText(i18nc("@action:inmenu Login menu", "Login")); + connect(loginAction, SIGNAL(triggered()), m_bbsTab, SLOT(login())); - setXMLFile( "kitaui.rc" ); - KMainWindow::createGUI(); - factory() ->addClient( m_bbsTab ); - factory() ->addClient( m_boardTab ); - factory() ->addClient( m_threadTab ); - factory() ->addClient( m_writeTab ); + setXMLFile("kitaui.rc"); + KXmlGuiWindow::createGUI(); + factory()->addClient(m_bbsTab); + factory()->addClient(m_boardTab); + factory()->addClient(m_threadTab); + factory()->addClient(m_writeTab); } -void KitaMainWindow::setupView() +void MainWindow::setupView() { - ViewMediator::getInstance()->setMainWindow( this ); + ViewMediator::getInstance()->setMainWindow(this); - QWidget* mainWidget = new QWidget( this ); + QWidget* mainWidget = new QWidget(this); - QBoxLayout* mainLayout = new QVBoxLayout( mainWidget ); - QSplitter* hsplit = new QSplitter( mainWidget ); - mainLayout->addWidget( hsplit ); + QBoxLayout* mainLayout = new QVBoxLayout(mainWidget); + QSplitter* hsplit = new QSplitter(mainWidget); + mainLayout->addWidget(hsplit); - m_bbsTab = new KitaBBSTabWidget( hsplit, "Board" ); + m_bbsTab = new BBSTabWidget(hsplit); - QSplitter* vsplit = new QSplitter( QSplitter::Vertical, hsplit ); + QSplitter* vsplit = new QSplitter(Qt::Vertical, hsplit); - m_boardTab = new KitaBoardTabWidget( vsplit, "Subject" ); - ViewMediator::getInstance()->setBoardTabWidget( m_boardTab ); + m_boardTab = new BoardTabWidget(vsplit); + ViewMediator::getInstance()->setBoardTabWidget(m_boardTab); - m_threadTab = new KitaThreadTabWidget( vsplit, "Thread View" ); - ViewMediator::getInstance()->setThreadTabWidget( m_threadTab ); + m_threadTab = new ThreadTabWidget(vsplit); + ViewMediator::getInstance()->setThreadTabWidget(m_threadTab); - hsplit->setSizes( QValueList<int>() << 100 << 500 ); - vsplit->setSizes( QValueList<int>() << 200 << 300 ); + hsplit->setSizes(QList<int>() << 100 << 500); + vsplit->setSizes(QList<int>() << 200 << 300); - setCentralWidget( mainWidget ); + setCentralWidget(mainWidget); /* write dock */ - m_writeTab = new KitaWriteTabWidget( 0, "Write View" ); - ViewMediator::getInstance()->setWriteTabWidget( m_writeTab ); + m_writeTab = new WriteTabWidget(0); + ViewMediator::getInstance()->setWriteTabWidget(m_writeTab); } -void KitaMainWindow::loadCache() +void MainWindow::loadCache() { - KitaThreadInfo * cache = KitaThreadInfo::getInstance(); - QString cacheConfigPath = locateLocal( "appdata", "cache" ); - QFile file( cacheConfigPath ); - if ( file.open( IO_ReadOnly ) ) { - QDataStream stream( &file ); + ThreadInfo * cache = ThreadInfo::getInstance(); + QString cacheConfigPath = KStandardDirs::locateLocal("appdata", "cache"); + QFile file(cacheConfigPath); + if (file.open(QIODevice::ReadOnly)) { + QDataStream stream(&file); stream >> *cache; } } -void KitaMainWindow::saveCache() +void MainWindow::saveCache() { - KitaThreadInfo * cache = KitaThreadInfo::getInstance(); - QString cacheConfigPath = locateLocal( "appdata", "cache" ); - QFile file( cacheConfigPath ); - if ( file.open( IO_WriteOnly ) ) { - QDataStream stream( &file ); + ThreadInfo * cache = ThreadInfo::getInstance(); + QString cacheConfigPath = KStandardDirs::locateLocal("appdata", "cache"); + QFile file(cacheConfigPath); + if (file.open(QIODevice::WriteOnly)) { + QDataStream stream(&file); stream << *cache; } } -void KitaMainWindow::loadFavorites() +void MainWindow::loadFavorites() { - QString favoritesConfigPath = locateLocal( "appdata", "favorites.xml" ); - QFile file( favoritesConfigPath ); - if ( file.open( IO_ReadOnly ) ) { - QTextStream stream( &file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + QString favoritesConfigPath = KStandardDirs::locateLocal("appdata", "favorites.xml"); + QFile file(favoritesConfigPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); - QString xml = stream.read(); - FavoriteThreads::readFromXML( xml ); + QString xml = stream.readAll(); + FavoriteThreads::readFromXML(xml); } } -void KitaMainWindow::saveFavorites() +void MainWindow::saveFavorites() { - QString favoritesConfigPath = locateLocal( "appdata", "favorites.xml" ); - QFile file( favoritesConfigPath ); - if ( file.open( IO_WriteOnly ) ) { - QTextStream stream( &file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); - stream << FavoriteThreads::getInstance() ->toXML(); + QString favoritesConfigPath + = KStandardDirs::locateLocal("appdata", "favorites.xml"); + QFile file(favoritesConfigPath); + if (file.open(QIODevice::WriteOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); + stream << FavoriteThreads::getInstance()->toXML(); } } -void KitaMainWindow::loadFavoriteBoards() +void MainWindow::loadFavoriteBoards() { - QString configPath = locateLocal( "appdata", "favorite_boards.xml" ); - QFile file( configPath ); - if ( file.open( IO_ReadOnly ) ) { - QTextStream stream( &file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + QString configPath = KStandardDirs::locateLocal("appdata", "favorite_boards.xml"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); - QString xml = stream.read(); - Kita::FavoriteBoards::readFromXML( xml ); + QString xml = stream.readAll(); + FavoriteBoards::readFromXML(xml); } } -void KitaMainWindow::saveFavoriteBoards() +void MainWindow::saveFavoriteBoards() { - QString configPath = locateLocal( "appdata", "favorite_boards.xml" ); - QFile file( configPath ); - if ( file.open( IO_WriteOnly ) ) { - QTextStream stream( &file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); - stream << Kita::FavoriteBoards::toXML(); + QString configPath = KStandardDirs::locateLocal("appdata", "favorite_boards.xml"); + QFile file(configPath); + if (file.open(QIODevice::WriteOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); + stream << FavoriteBoards::toXML(); } } -void KitaMainWindow::loadCompletion() +void MainWindow::loadCompletion() { - QString configPath = locateLocal( "appdata", "completion" ); - KSimpleConfig config( configPath ); + QString configPath = KStandardDirs::locateLocal("appdata", "completion"); + KConfig config(configPath); - Kita::Config::setNameCompletionList( config.readListEntry( "name" ) ); + GlobalConfig::setNameCompletionList( + config.group("").readEntry("name", QStringList())); } -void KitaMainWindow::loadAsciiArt() +void MainWindow::loadAsciiArt() { - QString configPath = locateLocal( "appdata", "asciiart" ); - QFile file( configPath ); - if ( file.open( IO_ReadOnly ) ) { - QTextStream stream( &file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + QString configPath = KStandardDirs::locateLocal("appdata", "asciiart"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); QStringList list; QString str; - while ( ( str = stream.readLine() ) != QString::null ) { - if ( ! str.isEmpty() ) { + while (!(str = stream.readLine()).isEmpty()) { + if (! str.isEmpty()) { list << str; } } - Kita::AsciiArtConfig::setAsciiArtList( list ); + AsciiArtConfig::setAsciiArtList(list); } } -void KitaMainWindow::loadAboneIDList() +void MainWindow::loadAboneIDList() { - QString configPath = locateLocal( "appdata", "abone_id" ); - QFile file( configPath ); - if ( file.open( IO_ReadOnly ) ) { - QTextStream stream( &file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + QString configPath = KStandardDirs::locateLocal("appdata", "abone_id"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); QStringList list; QString str; - while ( ( str = stream.readLine() ) != QString::null ) { - if ( ! str.isEmpty() ) { + while (!(str = stream.readLine()).isEmpty()) { + if (! str.isEmpty()) { list << str; } } - Kita::AboneConfig::setAboneIDList( list ); + AboneConfig::setAboneIDList(list); } } -void KitaMainWindow::loadAboneNameList() +void MainWindow::loadAboneNameList() { - QString configPath = locateLocal( "appdata", "abone_name" ); - QFile file( configPath ); - if ( file.open( IO_ReadOnly ) ) { - QTextStream stream( &file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + QString configPath = KStandardDirs::locateLocal("appdata", "abone_name"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); QStringList list; QString str; - while ( ( str = stream.readLine() ) != QString::null ) { - if ( ! str.isEmpty() ) { + while (!(str = stream.readLine()).isEmpty()) { + if (! str.isEmpty()) { list << str; } } - Kita::AboneConfig::setAboneNameList( list ); + AboneConfig::setAboneNameList(list); } } -void KitaMainWindow::loadAboneWordList() +void MainWindow::loadAboneWordList() { - QString configPath = locateLocal( "appdata", "abone_word" ); - QFile file( configPath ); - if ( file.open( IO_ReadOnly ) ) { - QTextStream stream( &file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + QString configPath = KStandardDirs::locateLocal("appdata", "abone_word"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); QStringList list; QString str; - while ( ( str = stream.readLine() ) != QString::null ) { - if ( ! str.isEmpty() ) { + while (!(str = stream.readLine()).isEmpty()) { + if (! str.isEmpty()) { list << str; } } - Kita::AboneConfig::setAboneWordList( list ); + AboneConfig::setAboneWordList(list); } } - -#include "mainwindow.moc" Modified: kita/trunk/kita/src/mainwindow.h =================================================================== --- kita/trunk/kita/src/mainwindow.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/mainwindow.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,33 +7,22 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#ifndef KITAMAINWINDOW_H +#define KITAMAINWINDOW_H -#ifndef _KITA_H_ -#define _KITA_H_ +#include <kxmlguiwindow.h> -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <kapplication.h> -#include <kparts/dockmainwindow.h> - -class KPrinter; -class KToggleAction; -class KURL; class KLineEdit; +class KToggleAction; +class KUrl; -class KitaBBSTabWidget; -class KitaBoardTabWidget; -class KitaThreadTabWidget; -class KitaWriteTabWidget; +namespace Kita { + class BBSTabWidget; + class BoardTabWidget; + class ThreadTabWidget; + class WriteTabWidget; + class Preferences; -namespace KParts -{ - class URLArgs; - class Part; -} - /** * This class serves as the main window for Kita. It handles the * menus, toolbars, and status bars. @@ -43,56 +32,61 @@ * @version $APP_VERSION */ -class KitaMainWindow : public KMainWindow -{ - Q_OBJECT -public: - KitaMainWindow(); - virtual ~KitaMainWindow(); + class MainWindow : public KXmlGuiWindow + { + Q_OBJECT + public: + MainWindow(); + virtual ~MainWindow(); - void load( const KURL& url ); - void setMainStatus( const QString& statusStr ); - void setUrl( const KURL& url ); - void bookmark( const QString& datURL, bool on ); + void load(const KUrl& url); + void setMainStatus(const QString& statusStr); + void setUrl(const KUrl& url); + void bookmark(const QString& datUrl, bool on); -private slots: - void login(); - void newToolbarConfig(); - void optionsShowToolbar(); - void optionsShowStatusbar(); - void optionsConfigureKeys(); - void optionsConfigureToolbars(); - void optionsPreferences(); - void settingsMenuAboutToShow(); - void setFont( const QFont& font ); + private slots: + void login(); + void newToolbarConfig(); + void optionsShowToolbar(); + void optionsShowStatusbar(); + void optionsConfigureKeys(); + void optionsConfigureToolbars(); + void optionsPreferences(); + void settingsMenuAboutToShow(); + void setFont(const QFont& font); - void slotEditCopy(); - void slotURLLine(); + void slotEditCopy(); + void slotUrlLine(); -private: - KLineEdit* m_urlLine; + private: + KLineEdit* m_urlLine; - KToggleAction *m_toolbarAction; - KToggleAction *m_statusbarAction; + KToggleAction *m_toolbarAction; + KToggleAction *m_statusbarAction; - KitaThreadTabWidget* m_threadTab; - KitaBBSTabWidget* m_bbsTab; - KitaBoardTabWidget* m_boardTab; - KitaWriteTabWidget* m_writeTab; + ThreadTabWidget* m_threadTab; + BBSTabWidget* m_bbsTab; + BoardTabWidget* m_boardTab; + WriteTabWidget* m_writeTab; - void setupActions(); - void setupView(); - void loadCache(); - void saveCache(); - void loadFavorites(); - void saveFavorites(); - void loadFavoriteBoards(); - void saveFavoriteBoards(); - void loadCompletion(); - void loadAsciiArt(); - void loadAboneIDList(); - void loadAboneNameList(); - void loadAboneWordList(); -}; + Preferences *m_prefDialog; + void setupActions(); + void setupView(); + void loadCache(); + void saveCache(); + void loadFavorites(); + void saveFavorites(); + void loadFavoriteBoards(); + void saveFavoriteBoards(); + void loadCompletion(); + void loadAsciiArt(); + void loadAboneIDList(); + void loadAboneNameList(); + void loadAboneWordList(); -#endif // _KITA_H_ + MainWindow(const MainWindow&); + MainWindow& operator=(const MainWindow&); + }; +} + +#endif // MAINWINDOW_H Property changes on: kita/trunk/kita/src/prefs ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in *base.cpp *base.h write_page.cpp write_page.h login_page.cpp login_page.h *.la *.lo *.moc *.moc.cpp .deps .libs + moc_* ui_* *_automoc.cpp *_automoc.cpp.files CMakeFiles CTestTestfile.cmake cmake_install.cmake Makefile Deleted: kita/trunk/kita/src/prefs/.cvsignore =================================================================== --- kita/trunk/kita/src/prefs/.cvsignore 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/.cvsignore 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,14 +0,0 @@ -Makefile -Makefile.in -*base.cpp -*base.h -write_page.cpp -write_page.h -login_page.cpp -login_page.h -*.la -*.lo -*.moc -*.moc.cpp -.deps -.libs Copied: kita/trunk/kita/src/prefs/CMakeLists.txt (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/CMakeLists.txt) =================================================================== --- kita/trunk/kita/src/prefs/CMakeLists.txt (rev 0) +++ kita/trunk/kita/src/prefs/CMakeLists.txt 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,30 @@ +include_directories(${QT_INCLUDES} ${KDE4_INCLUDES} + .. ${CMAKE_CURRENT_BINARY_DIR}/..) + + +########### next target ############### + +set(kitapref_LIB_SRCS + abstractprefpage.cpp + asciiartprefpage.cpp + aboneprefpage.cpp + loginprefpage.cpp + faceprefpage.cpp + preferences.cpp + uiprefpage.cpp + writeprefpage.cpp) + +kde4_add_ui_files(kitapref_LIB_SRCS + aboneprefbase.ui + asciiartprefbase.ui + faceprefbase.ui + loginprefbase.ui + uiprefbase.ui + writeprefbase.ui) + +kde4_add_library(kitapref SHARED ${kitapref_LIB_SRCS}) + +target_link_libraries(kitapref ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} kitautil) + +set_target_properties(kitapref PROPERTIES VERSION 1.0.0 SOVERSION 1) +install(TARGETS kitapref ${INSTALL_TARGETS_DEFAULT_ARGS}) Deleted: kita/trunk/kita/src/prefs/Makefile.am =================================================================== --- kita/trunk/kita/src/prefs/Makefile.am 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/Makefile.am 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,6 +0,0 @@ -INCLUDES = $(all_includes) -I.. -METASOURCES = AUTO -lib_LTLIBRARIES = libkitapref.la -libkitapref_la_LDFLAGS = $(all_libraries) -libkitapref_la_SOURCES = aboneprefbase.ui aboneprefpage.cpp asciiartprefbase.ui login_page.ui uiprefbase.ui prefs.cpp faceprefbase.ui write_page.ui -noinst_HEADERS = aboneprefpage.h prefs.h write_page.ui.h Modified: kita/trunk/kita/src/prefs/aboneprefbase.ui =================================================================== --- kita/trunk/kita/src/prefs/aboneprefbase.ui 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/aboneprefbase.ui 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,94 +1,84 @@ -<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> -<class>Kita::AbonePrefBase</class> -<widget class="QWidget"> - <property name="name"> - <cstring>Kita::AbonePrefBase</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>600</width> - <height>480</height> - </rect> - </property> - <property name="caption"> - <string>Form1</string> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout8</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>idLabel</cstring> - </property> - <property name="text"> - <string>ID</string> - </property> - </widget> - <widget class="KTextEdit"> - <property name="name"> - <cstring>idAboneText</cstring> - </property> - </widget> - </vbox> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout6</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>wordLabel</cstring> - </property> - <property name="text"> - <string>NG word</string> - </property> - </widget> - <widget class="KTextEdit"> - <property name="name"> - <cstring>wordAboneText</cstring> - </property> - </widget> - </vbox> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout7</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>nameLabel</cstring> - </property> - <property name="text"> - <string>Name</string> - </property> - </widget> - <widget class="KTextEdit"> - <property name="name"> - <cstring>nameAboneText</cstring> - </property> - </widget> - </vbox> - </widget> - </hbox> -</widget> -<layoutdefaults spacing="6" margin="11"/> -</UI> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Kita::AbonePrefBase</class> + <widget class="QWidget" name="Kita::AbonePrefBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <layout class="QHBoxLayout"> + <item> + <layout class="QVBoxLayout"> + <item> + <widget class="QLabel" name="idLabel"> + <property name="text"> + <string comment="@label:textbox Abone ID">ID</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>idAboneText</cstring> + </property> + </widget> + </item> + <item> + <widget class="KTextEdit" name="idAboneText"/> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout"> + <item> + <widget class="QLabel" name="wordLabel"> + <property name="text"> + <string comment="@label:textbox Abone NG word">NG word</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>wordAboneText</cstring> + </property> + </widget> + </item> + <item> + <widget class="KTextEdit" name="wordAboneText"/> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout"> + <item> + <widget class="QLabel" name="nameLabel"> + <property name="text"> + <string comment="@label:textbox Abone name">Name</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>nameAboneText</cstring> + </property> + </widget> + </item> + <item> + <widget class="KTextEdit" name="nameAboneText"/> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <customwidgets> + <customwidget> + <class>KTextEdit</class> + <extends>QTextEdit</extends> + <header>ktextedit.h</header> + </customwidget> + </customwidgets> +</ui> Modified: kita/trunk/kita/src/prefs/aboneprefpage.cpp =================================================================== --- kita/trunk/kita/src/prefs/aboneprefpage.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/aboneprefpage.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,54 +7,48 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ + #include "aboneprefpage.h" -#include <ktextedit.h> - #include "libkita/abone.h" using namespace Kita; -AbonePrefPage::AbonePrefPage( QWidget *parent, const char *name ) - : Kita::AbonePrefBase( parent, name ) +AbonePrefPage::AbonePrefPage(QWidget *parent) +: AbstractPrefPage(parent) { - idAboneText->setText( Kita::AboneConfig::aboneIDList().join( "\n" ) ); - nameAboneText->setText( Kita::AboneConfig::aboneNameList().join( "\n" ) ); - wordAboneText->setText( Kita::AboneConfig::aboneWordList().join( "\n" ) ); - - connect( idAboneText, SIGNAL( textChanged() ), SLOT( slotTextChanged() ) ); - connect( nameAboneText, SIGNAL( textChanged() ), SLOT( slotTextChanged() ) ); - connect( wordAboneText, SIGNAL( textChanged() ), SLOT( slotTextChanged() ) ); - - m_changed = FALSE; + setupUi(this); + load(); + connect(idAboneText, SIGNAL(textChanged()), SIGNAL(changed())); + connect(nameAboneText, SIGNAL(textChanged()), SIGNAL(changed())); + connect(wordAboneText, SIGNAL(textChanged()), SIGNAL(changed())); } -AbonePrefPage::~AbonePrefPage() -{} - -void AbonePrefPage::slotTextChanged() -{ - m_changed = TRUE; - emit changed(); -} - void AbonePrefPage::apply() { - if ( m_changed ) { - QString idText = idAboneText->text(); - QStringList idList = QStringList::split( '\n', idText ); - Kita::AboneConfig::setAboneIDList( idList ); + QString idText = idAboneText->toPlainText(); + QStringList idList = idText.split('\n', QString::SkipEmptyParts); + AboneConfig::setAboneIDList(idList); - QString nameText = nameAboneText->text(); - QStringList nameList = QStringList::split( '\n', nameText ); - Kita::AboneConfig::setAboneNameList( nameList ); + QString nameText = nameAboneText->toPlainText(); + QStringList nameList = nameText.split('\n', QString::SkipEmptyParts); + AboneConfig::setAboneNameList(nameList); - QString wordText = wordAboneText->text(); - QStringList wordList = QStringList::split( '\n', wordText ); - Kita::AboneConfig::setAboneWordList( wordList ); - } + QString wordText = wordAboneText->toPlainText(); + QStringList wordList = wordText.split('\n', QString::SkipEmptyParts); + AboneConfig::setAboneWordList(wordList); +} - m_changed = FALSE; +void AbonePrefPage::load() +{ + idAboneText->setText(AboneConfig::aboneIDList().join("\n")); + nameAboneText->setText(AboneConfig::aboneNameList().join("\n")); + wordAboneText->setText(AboneConfig::aboneWordList().join("\n")); } -#include "aboneprefpage.moc" +void AbonePrefPage::reset() +{ + AboneConfig::self()->useDefaults(true); + load(); + AboneConfig::self()->useDefaults(false); +} Modified: kita/trunk/kita/src/prefs/aboneprefpage.h =================================================================== --- kita/trunk/kita/src/prefs/aboneprefpage.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/aboneprefpage.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,26 +10,22 @@ #ifndef KITAABONEPREFPAGE_H #define KITAABONEPREFPAGE_H -#include "aboneprefbase.h" +#include "abstractprefpage.h" +#include "ui_aboneprefbase.h" namespace Kita { /** @author Hideki Ikemoto */ - class AbonePrefPage : public AbonePrefBase + class AbonePrefPage : public AbstractPrefPage, public Ui::AbonePrefBase { Q_OBJECT - bool m_changed; public: - AbonePrefPage( QWidget *parent = 0, const char *name = 0 ); - ~AbonePrefPage(); - public slots: - void apply(); - private slots: - void slotTextChanged(); - signals: - void changed(); + AbonePrefPage(QWidget *parent = 0); + virtual void apply(); + virtual void load(); + virtual void reset(); }; } Copied: kita/trunk/kita/src/prefs/abstractprefpage.cpp (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/abstractprefpage.cpp) =================================================================== --- kita/trunk/kita/src/prefs/abstractprefpage.cpp (rev 0) +++ kita/trunk/kita/src/prefs/abstractprefpage.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,17 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#include "abstractprefpage.h" + +using namespace Kita; + +AbstractPrefPage::AbstractPrefPage(QWidget* parent) : QWidget(parent) +{ +} Copied: kita/trunk/kita/src/prefs/abstractprefpage.h (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/abstractprefpage.h) =================================================================== --- kita/trunk/kita/src/prefs/abstractprefpage.h (rev 0) +++ kita/trunk/kita/src/prefs/abstractprefpage.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,32 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#ifndef KITAABSTRACTPREFPAGE_H +#define KITAABSTRACTPREFPAGE_H + +#include <QtGui/QWidget> + +namespace Kita +{ + class AbstractPrefPage : public QWidget + { + Q_OBJECT + public: + explicit AbstractPrefPage(QWidget* parent = 0); + virtual void apply() = 0; + virtual void load() = 0; + virtual void reset() = 0; + + signals: + void changed(); + }; +} + +#endif // KITAABSTRACTPREFPAGE_H Modified: kita/trunk/kita/src/prefs/asciiartprefbase.ui =================================================================== --- kita/trunk/kita/src/prefs/asciiartprefbase.ui 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/asciiartprefbase.ui 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,33 +1,26 @@ -<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> -<class>AsciiArtPrefBase</class> -<widget class="QWidget"> - <property name="name"> - <cstring>AsciiArtPrefBase</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>600</width> - <height>480</height> - </rect> - </property> - <property name="caption"> - <string>Form1</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="KTextEdit"> - <property name="name"> - <cstring>asciiArtText</cstring> - </property> - </widget> - </vbox> -</widget> -<layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>ktextedit.h</includehint> -</includehints> -</UI> +<ui version="4.0" > + <class>Kita::AsciiArtPrefBase</class> + <widget class="QWidget" name="Kita::AsciiArtPrefBase" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <layout class="QVBoxLayout" > + <item> + <widget class="KTextEdit" name="asciiArtText" /> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11" /> + <customwidgets> + <customwidget> + <class>KTextEdit</class> + <extends>QTextEdit</extends> + <header>ktextedit.h</header> + </customwidget> + </customwidgets> +</ui> Copied: kita/trunk/kita/src/prefs/asciiartprefpage.cpp (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/asciiartprefpage.cpp) =================================================================== --- kita/trunk/kita/src/prefs/asciiartprefpage.cpp (rev 0) +++ kita/trunk/kita/src/prefs/asciiartprefpage.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,44 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#include "asciiartprefpage.h" + +#include "libkita/asciiart.h" +#include "libkita/globalconfig.h" + +using namespace Kita; + +AsciiArtPrefPage::AsciiArtPrefPage(QWidget* parent) : AbstractPrefPage(parent) +{ + setupUi(this); + load(); + connect(asciiArtText, SIGNAL(textChanged()), SIGNAL(changed())); +} + +void AsciiArtPrefPage::apply() +{ + QString text = asciiArtText->toPlainText(); + QStringList list = text.split('\n'); + + AsciiArtConfig::setAsciiArtList(list); +} + +void AsciiArtPrefPage::load() +{ + asciiArtText->setText(AsciiArtConfig::asciiArtList().join("\n")); + asciiArtText->setFont(GlobalConfig::threadFont()); +} + +void AsciiArtPrefPage::reset() +{ + AsciiArtConfig::self()->useDefaults(true); + load(); + AsciiArtConfig::self()->useDefaults(false); +} Copied: kita/trunk/kita/src/prefs/asciiartprefpage.h (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/asciiartprefpage.h) =================================================================== --- kita/trunk/kita/src/prefs/asciiartprefpage.h (rev 0) +++ kita/trunk/kita/src/prefs/asciiartprefpage.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,31 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#ifndef KITAASCIIARTPREFPAGE_H +#define KITAASCIIARTPREFPAGE_H + +#include "abstractprefpage.h" +#include "ui_asciiartprefbase.h" + +namespace Kita +{ + class AsciiArtPrefPage + : public AbstractPrefPage, public Ui::AsciiArtPrefBase + { + Q_OBJECT + public: + AsciiArtPrefPage(QWidget* parent = 0); + virtual void apply(); + virtual void load(); + virtual void reset(); + }; +} + +#endif // KITAASCIIARTPREFPAGE_H Modified: kita/trunk/kita/src/prefs/faceprefbase.ui =================================================================== --- kita/trunk/kita/src/prefs/faceprefbase.ui 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/faceprefbase.ui 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,321 +1,340 @@ -<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> -<class>Kita::FacePrefBase</class> -<widget class="QWidget"> - <property name="name"> - <cstring>Kita::FacePrefBase</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>600</width> - <height>508</height> - </rect> - </property> - <property name="caption"> - <string>Form1</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QTabWidget" row="0" column="0"> - <property name="name"> - <cstring>tabWidget2</cstring> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Kita::FacePrefBase</class> + <widget class="QWidget" name="Kita::FacePrefBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>508</height> + </rect> + </property> + <layout class="QGridLayout"> + <item row="0" column="0"> + <widget class="KTabWidget" name="tabWidget2"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string comment="Basic options">Basic</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QGroupBox" name="listGroupBox"> + <property name="title"> + <string>Board/Subject List</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="listFontLabel"> + <property name="text"> + <string comment="List font">Font</string> </property> - <widget class="QWidget"> - <property name="name"> - <cstring>tab</cstring> - </property> - <attribute name="title"> - <string>Basic</string> - </attribute> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <spacer row="0" column="1"> - <property name="name"> - <cstring>spacer1</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - <spacer row="3" column="0"> - <property name="name"> - <cstring>spacer2</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - <widget class="QGroupBox" row="0" column="0"> - <property name="name"> - <cstring>listGroupBox</cstring> - </property> - <property name="title"> - <string>Board/Subject List</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QPushButton" row="0" column="1"> - <property name="name"> - <cstring>listFontButton</cstring> - </property> - <property name="text"> - <string>set font</string> - </property> - </widget> - <widget class="KColorButton" row="2" column="1"> - <property name="name"> - <cstring>listBackgroundColorButton</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string></string> - </property> - </widget> - <widget class="QLabel" row="1" column="0"> - <property name="name"> - <cstring>listColorLabel</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>text color</string> - </property> - </widget> - <widget class="QLabel" row="2" column="0"> - <property name="name"> - <cstring>listBackgroundColorLabel</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>background color</string> - </property> - </widget> - <widget class="KColorButton" row="1" column="1"> - <property name="name"> - <cstring>listColorButton</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string></string> - </property> - </widget> - <widget class="QLabel" row="0" column="0"> - <property name="name"> - <cstring>listFontLabel</cstring> - </property> - <property name="text"> - <string>font</string> - </property> - </widget> - </grid> - </widget> - <widget class="QGroupBox" row="1" column="0"> - <property name="name"> - <cstring>threadGroupBox</cstring> - </property> - <property name="title"> - <string>Thread</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="KColorButton" row="1" column="1"> - <property name="name"> - <cstring>threadColorButton</cstring> - </property> - <property name="text"> - <string></string> - </property> - </widget> - <widget class="QLabel" row="1" column="0"> - <property name="name"> - <cstring>threadColorLabel</cstring> - </property> - <property name="text"> - <string>text color</string> - </property> - </widget> - <widget class="KColorButton" row="2" column="1"> - <property name="name"> - <cstring>threadBackgroundColorButton</cstring> - </property> - <property name="text"> - <string></string> - </property> - </widget> - <widget class="QLabel" row="2" column="0"> - <property name="name"> - <cstring>threadBackgroundColorLabel</cstring> - </property> - <property name="text"> - <string>background color</string> - </property> - </widget> - <widget class="QPushButton" row="0" column="1"> - <property name="name"> - <cstring>threadFontButton</cstring> - </property> - <property name="text"> - <string>set font</string> - </property> - </widget> - <widget class="QLabel" row="0" column="0"> - <property name="name"> - <cstring>threadFontLabel</cstring> - </property> - <property name="text"> - <string>font</string> - </property> - </widget> - </grid> - </widget> - <widget class="QGroupBox" row="2" column="0"> - <property name="name"> - <cstring>popupGroupBox</cstring> - </property> - <property name="title"> - <string>Popup</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QPushButton" row="0" column="1"> - <property name="name"> - <cstring>popupFontButton</cstring> - </property> - <property name="text"> - <string>set font</string> - </property> - </widget> - <widget class="QLabel" row="1" column="0"> - <property name="name"> - <cstring>popupColorLabel</cstring> - </property> - <property name="text"> - <string>text color</string> - </property> - </widget> - <widget class="QLabel" row="2" column="0"> - <property name="name"> - <cstring>popupBackgroundColorLabel</cstring> - </property> - <property name="text"> - <string>background color</string> - </property> - </widget> - <widget class="QLabel" row="0" column="0"> - <property name="name"> - <cstring>popupFontLabel</cstring> - </property> - <property name="text"> - <string>font</string> - </property> - </widget> - <widget class="KColorButton" row="1" column="1"> - <property name="name"> - <cstring>popupColorButton</cstring> - </property> - <property name="text"> - <string></string> - </property> - </widget> - <widget class="KColorButton" row="2" column="1"> - <property name="name"> - <cstring>popupBackgroundColorButton</cstring> - </property> - <property name="text"> - <string></string> - </property> - </widget> - </grid> - </widget> - </grid> - </widget> - <widget class="QWidget"> - <property name="name"> - <cstring>tab</cstring> - </property> - <attribute name="title"> - <string>Advanced</string> - </attribute> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QCheckBox"> - <property name="name"> - <cstring>useStyleSheetCheckBox</cstring> - </property> - <property name="text"> - <string>use stylesheet ( the setup of color/font is overwritten ).</string> - </property> - </widget> - <widget class="KTextEdit"> - <property name="name"> - <cstring>styleSheetText</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string></string> - </property> - </widget> - </vbox> - </widget> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>listFontButton</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="listFontButton"> + <property name="text"> + <string>set font</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="listColorLabel"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Text Color</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KColorButton" name="listColorButton"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="listBackgroundColorLabel"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Background Color</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="KColorButton" name="listBackgroundColorButton"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> </widget> - </grid> -</widget> -<connections> - <connection> - <sender>useStyleSheetCheckBox</sender> - <signal>toggled(bool)</signal> - <receiver>styleSheetText</receiver> - <slot>setEnabled(bool)</slot> - </connection> -</connections> -<layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>ktextedit.h</includehint> -</includehints> -</UI> + </item> + <item row="0" column="1"> + <spacer name="spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="threadGroupBox"> + <property name="title"> + <string comment="@label:textbox">Thread</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="threadFontLabel"> + <property name="text"> + <string comment="Thread font">Font</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>threadFontButton</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="threadFontButton"> + <property name="text"> + <string>set font</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="threadColorLabel"> + <property name="text"> + <string comment="Thread foreground color">Text Color</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>threadColorButton</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KColorButton" name="threadColorButton"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="threadBackgroundColorLabel"> + <property name="text"> + <string comment="Thread background color">Background Color</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>threadBackgroundColorButton</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="KColorButton" name="threadBackgroundColorButton"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="0"> + <widget class="QGroupBox" name="popupGroupBox"> + <property name="title"> + <string>Popup</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="popupFontLabel"> + <property name="text"> + <string comment="Popup font">Font</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>popupFontButton</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="popupFontButton"> + <property name="text"> + <string>set font</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="popupColorLabel"> + <property name="text"> + <string comment="Popup foreground color">Text Color</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>popupColorButton</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KColorButton" name="popupColorButton"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="popupBackgroundColorLabel"> + <property name="text"> + <string comment="Popup background color">Background Color</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>popupBackgroundColorLabel</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="KColorButton" name="popupBackgroundColorButton"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <spacer name="spacer2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string comment="Advanced options">Advanced</string> + </attribute> + <layout class="QVBoxLayout"> + <item> + <widget class="QCheckBox" name="useStyleSheetCheckBox"> + <property name="text"> + <string>Use stylesheet (the setup of color/font is overwritten)</string> + </property> + </widget> + </item> + <item> + <widget class="KTextEdit" name="styleSheetText"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text" stdset="0"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <customwidgets> + <customwidget> + <class>KColorButton</class> + <extends>QPushButton</extends> + <header>kcolorbutton.h</header> + </customwidget> + <customwidget> + <class>KTabWidget</class> + <extends>QTabWidget</extends> + <header>ktabwidget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>KTextEdit</class> + <extends>QTextEdit</extends> + <header>ktextedit.h</header> + </customwidget> + </customwidgets> + <includes> + <include location="local">kcolorbutton.h</include> + <include location="local">ktextedit.h</include> + </includes> + <connections> + <connection> + <sender>useStyleSheetCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>styleSheetText</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> Copied: kita/trunk/kita/src/prefs/faceprefpage.cpp (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/faceprefpage.cpp) =================================================================== --- kita/trunk/kita/src/prefs/faceprefpage.cpp (rev 0) +++ kita/trunk/kita/src/prefs/faceprefpage.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,128 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#include "faceprefpage.h" + +#include <kfontdialog.h> + +#include "libkita/colorconfig.h" +#include "libkita/globalconfig.h" +#include "libkita/kita_misc.h" + +using namespace Kita; + +FacePrefPage::FacePrefPage(QWidget* parent) : AbstractPrefPage(parent) +{ + setupUi(this); + load(); + // font + connect(listFontButton, SIGNAL(clicked()), SLOT(slotFontButtonClicked())); + + connect(threadFontButton, SIGNAL(clicked()), + SLOT(slotThreadFontButtonClicked())); + + connect(popupFontButton, SIGNAL(clicked()), + SLOT(slotPopupFontButtonClicked())); + + // color + connect(threadColorButton, SIGNAL(changed(const QColor&)), + SIGNAL(changed())); + connect(threadBackgroundColorButton, SIGNAL(changed(const QColor&)), + SIGNAL(changed())); + connect(popupColorButton, SIGNAL(changed(const QColor&)), + SIGNAL(changed())); + connect(popupBackgroundColorButton, SIGNAL(changed(const QColor&)), + SIGNAL(changed())); +} + +void FacePrefPage::apply() +{ + // font + QFont font = listFontButton->font(); + GlobalConfig::setFont(font); + emit fontChanged(font); + + QFont threadFont = threadFontButton->font(); + GlobalConfig::setThreadFont(threadFont); + + QFont popupFont = popupFontButton->font(); + GlobalConfig::setPopupFont(popupFont); + + // color + ColorConfig::setThread(threadColorButton->color()); + ColorConfig::setThreadBackground(threadBackgroundColorButton->color()); + ColorConfig::setPopup(popupColorButton->color()); + ColorConfig::setPopupBackground(popupBackgroundColorButton->color()); +} + +void FacePrefPage::load() +{ + // font + QFont font = GlobalConfig::font(); + listFontButton->setText(fontToString(font)); + listFontButton->setFont(font); + + QFont threadFont = GlobalConfig::threadFont(); + threadFontButton->setText(fontToString(threadFont)); + threadFontButton->setFont(threadFont); + + QFont popupFont = GlobalConfig::popupFont(); + popupFontButton->setText(fontToString(popupFont)); + popupFontButton->setFont(popupFont); + + // color + threadColorButton->setColor(ColorConfig::thread()); + threadBackgroundColorButton->setColor(ColorConfig::threadBackground()); + popupColorButton->setColor(ColorConfig::popup()); + popupBackgroundColorButton->setColor(ColorConfig::popupBackground()); + +} + +void FacePrefPage::reset() +{ + ColorConfig::self()->useDefaults(true); + GlobalConfig::self()->useDefaults(true); + load(); + GlobalConfig::self()->useDefaults(false); + ColorConfig::self()->useDefaults(false); +} + +void FacePrefPage::slotThreadFontButtonClicked() +{ + QFont threadFont = threadFontButton->font(); + + if (KFontDialog::getFont(threadFont, false, this) == QDialog::Accepted) { + threadFontButton->setText(fontToString(threadFont)); + threadFontButton->setFont(threadFont); + emit changed(); + } +} + +void FacePrefPage::slotFontButtonClicked() +{ + QFont font = listFontButton->font(); + + if (KFontDialog::getFont(font, false, this) == QDialog::Accepted) { + listFontButton->setText(fontToString(font)); + listFontButton->setFont(font); + emit changed(); + } +} + +void FacePrefPage::slotPopupFontButtonClicked() +{ + QFont font = popupFontButton->font(); + + if (KFontDialog::getFont(font, false, this) == QDialog::Accepted) { + popupFontButton->setText(fontToString(font)); + popupFontButton->setFont(font); + emit changed(); + } +} Copied: kita/trunk/kita/src/prefs/faceprefpage.h (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/faceprefpage.h) =================================================================== --- kita/trunk/kita/src/prefs/faceprefpage.h (rev 0) +++ kita/trunk/kita/src/prefs/faceprefpage.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,38 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#ifndef KITAFACEPREFPAGE_H +#define KITAFACEPREFPAGE_H + +#include "abstractprefpage.h" +#include "ui_faceprefbase.h" + +namespace Kita +{ + class FacePrefPage : public AbstractPrefPage, public Ui::FacePrefBase + { + Q_OBJECT + public: + FacePrefPage(QWidget* parent = 0); + virtual void apply(); + virtual void load(); + virtual void reset(); + + private slots: + void slotFontButtonClicked(); + void slotPopupFontButtonClicked(); + void slotThreadFontButtonClicked(); + + signals: + void fontChanged(const QFont&); + }; +} + +#endif // KITAFACEPREFPAGE_H Deleted: kita/trunk/kita/src/prefs/login_page.ui =================================================================== --- kita/trunk/kita/src/prefs/login_page.ui 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/login_page.ui 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,198 +0,0 @@ -<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> -<class>Kita::LoginPrefPage</class> -<widget class="QWidget"> - <property name="name"> - <cstring>Kita::LoginPrefPage</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>600</width> - <height>484</height> - </rect> - </property> - <property name="caption"> - <string>Form1</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout6</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout6</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout5</cstring> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel" row="0" column="0"> - <property name="name"> - <cstring>userIDLabel</cstring> - </property> - <property name="text"> - <string>User ID</string> - </property> - </widget> - <widget class="KLineEdit" row="0" column="1"> - <property name="name"> - <cstring>kcfg_UserID</cstring> - </property> - </widget> - <widget class="KLineEdit" row="1" column="1"> - <property name="name"> - <cstring>kcfg_Password</cstring> - </property> - <property name="echoMode"> - <enum>Password</enum> - </property> - </widget> - <widget class="QLabel" row="1" column="0"> - <property name="name"> - <cstring>passwordLabel</cstring> - </property> - <property name="text"> - <string>Password</string> - </property> - </widget> - </grid> - </widget> - <spacer> - <property name="name"> - <cstring>spacer6</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>285</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - <widget class="QCheckBox"> - <property name="name"> - <cstring>kcfg_AutoLogin</cstring> - </property> - <property name="text"> - <string>enables &auto login</string> - </property> - <property name="accel"> - <string>Alt+A</string> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout6</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout9</cstring> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel" row="0" column="0"> - <property name="name"> - <cstring>BeMailAddressLabel</cstring> - </property> - <property name="text"> - <string>Be mail address</string> - </property> - </widget> - <widget class="KLineEdit" row="0" column="1"> - <property name="name"> - <cstring>kcfg_BeMailAddress</cstring> - </property> - </widget> - <widget class="QLabel" row="1" column="0"> - <property name="name"> - <cstring>BeAuthCodeLabel</cstring> - </property> - <property name="text"> - <string>Be auth code</string> - </property> - </widget> - <widget class="KLineEdit" row="1" column="1"> - <property name="name"> - <cstring>kcfg_BeAuthCode</cstring> - </property> - </widget> - </grid> - </widget> - <spacer> - <property name="name"> - <cstring>spacer7</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - </vbox> - </widget> - <spacer> - <property name="name"> - <cstring>spacer5</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>325</height> - </size> - </property> - </spacer> - </vbox> -</widget> -<layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>klineedit.h</includehint> - <includehint>klineedit.h</includehint> - <includehint>klineedit.h</includehint> - <includehint>klineedit.h</includehint> -</includehints> -</UI> Copied: kita/trunk/kita/src/prefs/loginprefbase.ui (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/loginprefbase.ui) =================================================================== --- kita/trunk/kita/src/prefs/loginprefbase.ui (rev 0) +++ kita/trunk/kita/src/prefs/loginprefbase.ui 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Kita::LoginPrefBase</class> + <widget class="QWidget" name="Kita::LoginPrefBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>484</height> + </rect> + </property> + <layout class="QVBoxLayout"> + <item> + <layout class="QVBoxLayout"> + <item> + <layout class="QHBoxLayout"> + <item> + <layout class="QGridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="userIDLabel"> + <property name="text"> + <string>User ID</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>kcfg_UserID</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KLineEdit" name="kcfg_UserID"/> + </item> + <item row="1" column="1"> + <widget class="KLineEdit" name="kcfg_Password"> + <property name="echoMode"> + <enum>QLineEdit::Password</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="passwordLabel"> + <property name="text"> + <string>Password</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>kcfg_Password</cstring> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="spacer6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>285</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <widget class="QCheckBox" name="kcfg_AutoLogin"> + <property name="text"> + <string>Enables auto login</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout"> + <item> + <layout class="QGridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="BeMailAddressLabel"> + <property name="text"> + <string>Be mail address</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>kcfg_BeMailAddress</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KLineEdit" name="kcfg_BeMailAddress"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="BeAuthCodeLabel"> + <property name="text"> + <string>Be auth code</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>kcfg_BeAuthCode</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KLineEdit" name="kcfg_BeAuthCode"/> + </item> + </layout> + </item> + <item> + <spacer name="spacer7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </item> + <item> + <spacer name="spacer5"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>325</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <customwidgets> + <customwidget> + <class>KLineEdit</class> + <extends>QLineEdit</extends> + <header>klineedit.h</header> + </customwidget> + </customwidgets> + <includes> + <include location="local">klineedit.h</include> + </includes> +</ui> Copied: kita/trunk/kita/src/prefs/loginprefpage.cpp (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/loginprefpage.cpp) =================================================================== --- kita/trunk/kita/src/prefs/loginprefpage.cpp (rev 0) +++ kita/trunk/kita/src/prefs/loginprefpage.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,55 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#include "loginprefpage.h" + +#include "libkita/accountconfig.h" + +using namespace Kita; + +LoginPrefPage::LoginPrefPage(QWidget* parent) : AbstractPrefPage(parent) +{ + setupUi(this); + load(); + connect(kcfg_BeMailAddress, SIGNAL(textChanged(const QString &)), + SIGNAL(changed())); + connect(kcfg_BeAuthCode, SIGNAL(textChanged(const QString &)), + SIGNAL(changed())); + connect(kcfg_UserID, SIGNAL(textChanged(const QString &)), + SIGNAL(changed())); + connect(kcfg_AutoLogin, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(kcfg_Password, SIGNAL(textChanged(const QString &)), + SIGNAL(changed())); +} + +void LoginPrefPage::apply() +{ + AccountConfig::setBeMailAddress(kcfg_BeMailAddress->text()); + AccountConfig::setBeAuthCode(kcfg_BeAuthCode->text()); + AccountConfig::setUserID(kcfg_UserID->text()); + AccountConfig::setAutoLogin(kcfg_AutoLogin->isChecked()); + AccountConfig::setPassword(kcfg_Password->text()); +} + +void LoginPrefPage::load() +{ + kcfg_BeMailAddress->setText(AccountConfig::beMailAddress()); + kcfg_BeAuthCode->setText(AccountConfig::beAuthCode()); + kcfg_UserID->setText(AccountConfig::userID()); + kcfg_AutoLogin->setChecked(AccountConfig::autoLogin()); + kcfg_Password->setText(AccountConfig::password()); +} + +void LoginPrefPage::reset() +{ + AccountConfig::self()->useDefaults(true); + load(); + AccountConfig::self()->useDefaults(false); +} Copied: kita/trunk/kita/src/prefs/loginprefpage.h (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/loginprefpage.h) =================================================================== --- kita/trunk/kita/src/prefs/loginprefpage.h (rev 0) +++ kita/trunk/kita/src/prefs/loginprefpage.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,30 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#ifndef KITALOGINPREFPAGE_H +#define KITALOGINPREFPAGE_H + +#include "abstractprefpage.h" +#include "ui_loginprefbase.h" + +namespace Kita +{ + class LoginPrefPage : public AbstractPrefPage, public Ui::LoginPrefBase + { + Q_OBJECT + public: + LoginPrefPage(QWidget* parent = 0); + virtual void apply(); + virtual void load(); + virtual void reset(); + }; +} + +#endif // KITALOGINPREFPAGE_H Copied: kita/trunk/kita/src/prefs/preferences.cpp (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/preferences.cpp) =================================================================== --- kita/trunk/kita/src/prefs/preferences.cpp (rev 0) +++ kita/trunk/kita/src/prefs/preferences.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,117 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#include "preferences.h" + +#include "aboneprefpage.h" +#include "asciiartprefpage.h" +#include "faceprefpage.h" +#include "loginprefpage.h" +#include "uiprefpage.h" +#include "writeprefpage.h" +#include "libkita/globalconfig.h" + +using namespace Kita; + +Preferences::Preferences(QWidget* parent) : KPageDialog(parent) +{ + setWindowTitle("Kita Preferences"); + + setButtons(Ok | Apply | Cancel | Default); + enableButtonApply(false); + setDefaultButton(Ok); + + // this is the base class for your preferences dialog. it is now + // a Treelist dialog.. but there are a number of other + // possibilities (including Tab, Swallow, and just Plain) + FacePrefPage* facePage = new FacePrefPage(0); + KPageWidgetItem* faceItem + = addPage(facePage, i18n("Face")); + faceItem->setIcon(KIcon("view-list-details")); + connect(facePage, SIGNAL(fontChanged(const QFont&)), + SIGNAL(fontChanged(const QFont&))); + connect(facePage, SIGNAL(changed()), SLOT(slotChanged())); + m_pageList.append(facePage); + + AsciiArtPrefPage* asciiArtPage = new AsciiArtPrefPage(0); + KPageWidgetItem* asciiArtItem + = addPage(asciiArtPage, i18n("AsciiArt")); + asciiArtItem->setIcon(KIcon("kita")); + connect(asciiArtPage, SIGNAL(changed()), SLOT(slotChanged())); + m_pageList.append(asciiArtPage); + + UIPrefPage* uiPage = new UIPrefPage(0); + KPageWidgetItem* configureItem + = addPage(uiPage, i18n("User Interface")); + configureItem->setIcon(KIcon("configure")); + connect(uiPage, SIGNAL(changed()), SLOT(slotChanged())); + m_pageList.append(uiPage); + + AbonePrefPage* abonePage = new AbonePrefPage(0); + KPageWidgetItem* aboneItem = addPage(abonePage, i18n("Abone")); + aboneItem->setIcon(KIcon("kita")); + connect(abonePage, SIGNAL(changed()), SLOT(slotChanged())); + m_pageList.append(abonePage); + + LoginPrefPage* loginPage = new LoginPrefPage(0); + KPageWidgetItem* loginItem + = addPage(loginPage, i18n("Login")); + loginItem->setIcon(KIcon("network-connect")); + connect(loginPage, SIGNAL(changed()), SLOT(slotChanged())); + m_pageList.append(loginPage); + + WritePrefPage* writePage = new WritePrefPage(0); + KPageWidgetItem* writeItem + = addPage(writePage, i18n("Write")); + writeItem->setIcon(KIcon("document-edit")); + connect(writePage, SIGNAL(changed()), SLOT(slotChanged())); + m_pageList.append(writePage); +} + +void Preferences::load() +{ + AbstractPrefPage* page; + foreach (page, m_pageList) { + page->load(); + } + enableButtonApply(false); +} + +void Preferences::apply() +{ + AbstractPrefPage* page; + foreach (page, m_pageList) { + page->apply(); + } + enableButtonApply(false); +} + +void Preferences::reset() +{ + AbstractPrefPage* page; + foreach (page, m_pageList) { + page->reset(); + } +} + +void Preferences::slotButtonClicked(int button) +{ + if (button == Ok || button == Apply) { + apply(); + } else if (button == Default) { + reset(); + } + KPageDialog::slotButtonClicked(button); +} + +void Preferences::slotChanged() +{ + enableButtonApply(true); +} Copied: kita/trunk/kita/src/prefs/preferences.h (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/preferences.h) =================================================================== --- kita/trunk/kita/src/prefs/preferences.h (rev 0) +++ kita/trunk/kita/src/prefs/preferences.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,46 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#ifndef KITAPREFERENCES_H +#define KITAPREFERENCES_H + +#include <QtCore/QList> + +#include <kpagedialog.h> + +namespace Kita +{ + class AbstractPrefPage; + + class KDE_EXPORT Preferences : public KPageDialog + { + Q_OBJECT + + public: + Preferences(QWidget* parent); + void load(); + + private: + QList<AbstractPrefPage*> m_pageList; + void apply(); + void reset(); + Preferences(const Preferences&); + Preferences& operator=(const Preferences&); + + private slots: + virtual void slotButtonClicked(int button); + void slotChanged(); + + signals: + void fontChanged(const QFont&); + }; +} + +#endif // KITAPREFERENCES_H Deleted: kita/trunk/kita/src/prefs/prefs.cpp =================================================================== --- kita/trunk/kita/src/prefs/prefs.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/prefs.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,352 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2003 by Hideki Ikemoto * -* ikemo****@users***** * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -***************************************************************************/ - -#include "prefs.h" - -#include <klocale.h> -#include <kfontdialog.h> -#include <kcolordialog.h> -#include <kpushbutton.h> -#include <ktextedit.h> -#include <kcolorbutton.h> -#include <kurllabel.h> -#include <kmessagebox.h> -#include <kapplication.h> -#include <kiconloader.h> - -#include <qlayout.h> -#include <qlabel.h> -#include <qpushbutton.h> -#include <qlistbox.h> -#include <qmessagebox.h> -#include <qcheckbox.h> -#include <qspinbox.h> -#include <qbuttongroup.h> -#include <qvbox.h> - -#include "libkita/kita_misc.h" -#include "libkita/boardmanager.h" -#include "libkita/config_xt.h" -#include "libkita/asciiart.h" -#include "aboneprefpage.h" -#include "login_page.h" -#include "write_page.h" - -using namespace Kita; - -KitaPreferences::KitaPreferences( QWidget* parent ) - : KConfigDialog( parent, "Kita Preferences", Kita::Config::self(), IconList ) -{ - enableButtonApply( FALSE ); - enableButton( Help, FALSE ); - // this is the base class for your preferences dialog. it is now - // a Treelist dialog.. but there are a number of other - // possibilities (including Tab, Swallow, and just Plain) - - m_facePage = new Kita::FacePrefPage( 0 ); - addPage( m_facePage, i18n( "Face" ), "view_detailed" ); - - connect( m_facePage, SIGNAL( fontChanged( const QFont& ) ), - SIGNAL( fontChanged( const QFont& ) ) ); - - m_asciiArtPage = new Kita::AsciiArtPrefPage( 0 ); - addPage( m_asciiArtPage, i18n( "AsciiArt" ), "kita" ); - - m_uiPage = new Kita::UIPrefPage( 0 ); - addPage( m_uiPage, i18n( "User Interface" ), "configure" ); - - m_abonePage = new Kita::AbonePrefPage( 0 ); - addPage( m_abonePage, i18n( "Abone" ), "kita" ); - - m_loginPage = new Kita::LoginPrefPage( 0 ); - addPage( m_loginPage, i18n( "Login" ), "connect_established" ); - - m_writePage = new Kita::WritePrefPage( 0 ); - addPage( m_writePage, i18n( "Write" ), "edit" ); - - connect( m_facePage, SIGNAL( changed() ), SLOT( slotChanged() ) ); - connect( m_asciiArtPage, SIGNAL( changed() ), SLOT( slotChanged() ) ); - connect( m_uiPage, SIGNAL( changed() ), SLOT( slotChanged() ) ); - connect( m_abonePage, SIGNAL( changed() ), SLOT( slotChanged() ) ); - connect( m_loginPage, SIGNAL( changed() ), SLOT( slotChanged() ) ); - connect( m_writePage, SIGNAL( changed() ), SLOT( slotChanged() ) ); - - connect( this, SIGNAL( aboutToShowPage( QWidget* ) ), SLOT( slotAboutToShowPage( QWidget* ) ) ); -} - -void KitaPreferences::slotApply() -{ - qDebug( "activePageIndex = %d", activePageIndex() ); - switch ( activePageIndex() ) { - // TODO: refactoring. - case 0: - // face - m_facePage->apply(); - break; - case 1: - // asciiart - m_asciiArtPage->apply(); - break; - case 2: - // user interface - m_uiPage->apply(); - break; - case 3: - // abone - m_abonePage->apply(); - break; - case 4: - // login - break; - case 5: - // write - break; - } - enableButtonApply( FALSE ); -} - -void KitaPreferences::slotDefault() -{ - switch ( activePageIndex() ) { - case 0: - // face - m_facePage->reset(); - break; - case 1: - // asciiart - m_asciiArtPage->reset(); - break; - case 2: - // user - m_uiPage->reset(); - break; - case 3: - // abone - break; - case 4: - // login - break; - case 5: - // write - break; - case 6: - // debug - break; - } - enableButtonApply( TRUE ); -} - -void KitaPreferences::slotChanged() -{ - enableButtonApply( TRUE ); -} - -void KitaPreferences::slotOk() -{ - m_facePage->apply(); - m_asciiArtPage->apply(); - m_uiPage->apply(); - m_abonePage->apply(); - - KDialogBase::slotOk(); -} - -void KitaPreferences::slotAboutToShowPage( QWidget* page ) -{ - if ( activePageIndex() == 1 ) { - // ascii art - m_asciiArtPage->init(); - } -} - -AsciiArtPrefPage::AsciiArtPrefPage( QWidget* parent ) - : AsciiArtPrefBase( parent ) -{ - init(); - - connect( asciiArtText, SIGNAL( textChanged() ), SIGNAL( changed() ) ); -} - -void AsciiArtPrefPage::init() -{ - asciiArtText->setText( Kita::AsciiArtConfig::asciiArtList().join( "\n" ) ); - asciiArtText->setFont( Kita::Config::threadFont() ); -} - -void AsciiArtPrefPage::apply() -{ - QString text = asciiArtText->text(); - QStringList list = QStringList::split( '\n', text ); - - Kita::AsciiArtConfig::setAsciiArtList( list ); -} - -void AsciiArtPrefPage::reset() -{ -} - -UIPrefPage::UIPrefPage( QWidget* parent ) - : UIPrefBase( parent ) -{ - connect( editFileAssociation, SIGNAL( leftClickedURL() ), SLOT( slotEditFileAssociation() ) ); -} - -void UIPrefPage::apply() -{ -} - -void UIPrefPage::reset() -{ - kcfg_AlwaysUseTab->setChecked( TRUE ); - kcfg_MarkTime->setValue( 24 ); - kcfg_ShowMailAddress->setChecked( FALSE ); - kcfg_ShowNum->setValue( 100 ); - kcfg_ListSortOrder->setButton( Kita::Config::EnumListSortOrder::Mark ); - kcfg_PartMimeList->setText( "image/gif,image/jpeg,image/png,image/x-bmp" ); - kcfg_UsePart->setChecked( TRUE ); -} - -void UIPrefPage::slotEditFileAssociation() -{ - KApplication::kdeinitExec( "kcmshell", "filetypes" ); -} - -FacePrefPage::FacePrefPage( QWidget* parent ) - : FacePrefBase( parent ) -{ - // font - connect( listFontButton, SIGNAL( clicked() ), SLOT( slotFontButtonClicked() ) ); - - connect( threadFontButton, SIGNAL( clicked() ), - SLOT( slotThreadFontButtonClicked() ) ); - - connect( popupFontButton, SIGNAL( clicked() ), - SLOT( slotPopupFontButtonClicked() ) ); - - updateButtons(); - - m_threadFontchanged = FALSE; - m_threadColorChanged = FALSE; - - // color - threadColorButton->setColor( Kita::Config::threadColor() ); - threadBackgroundColorButton->setColor( Kita::Config::threadBackground() ); - popupColorButton->setColor( Kita::Config::popupColor() ); - popupBackgroundColorButton->setColor( Kita::Config::popupBackground() ); - - connect( threadColorButton, SIGNAL( changed( const QColor& ) ), SIGNAL( changed() ) ); - connect( threadBackgroundColorButton, SIGNAL( changed( const QColor& ) ), SIGNAL( changed() ) ); - connect( threadColorButton, SIGNAL( changed( const QColor& ) ), SLOT( slotColorChanged() ) ); - connect( threadBackgroundColorButton, SIGNAL( changed( const QColor& ) ), SLOT( slotColorChanged() ) ); - connect( popupColorButton, SIGNAL( changed( const QColor& ) ), SIGNAL( changed() ) ); - connect( popupBackgroundColorButton, SIGNAL( changed( const QColor& ) ), SIGNAL( changed() ) ); -} - -void FacePrefPage::apply() -{ - // font - QFont font = listFontButton->font(); - Kita::Config::setFont( font ); - emit fontChanged( font ); - - if ( m_threadFontchanged ) { - QFont threadFont = threadFontButton->font(); - Kita::Config::setThreadFont( threadFont ); - } - m_threadFontchanged = FALSE; - - QFont popupFont = popupFontButton->font(); - Kita::Config::setPopupFont( popupFont ); - - // color - if ( m_threadColorChanged ) { - Kita::Config::setThreadColor( threadColorButton->color() ); - Kita::Config::setThreadBackground( threadBackgroundColorButton->color() ); - } - m_threadColorChanged = FALSE; - Kita::Config::setPopupColor( popupColorButton->color() ); - Kita::Config::setPopupBackground( popupBackgroundColorButton->color() ); -} - -void FacePrefPage::reset() -{ - // font - QFont font; - listFontButton->setText( Kita::fontToString( font ) ); - listFontButton->setFont( font ); - - threadFontButton->setText( Kita::fontToString( font ) ); - threadFontButton->setFont( font ); - m_threadFontchanged = TRUE; - - popupFontButton->setText( Kita::fontToString( font ) ); - popupFontButton->setFont( font ); - - // color - threadColorButton->setColor( Qt::black ); - threadBackgroundColorButton->setColor( Qt::white ); - popupColorButton->setColor( Qt::black ); - popupBackgroundColorButton->setColor( Qt::yellow ); - m_threadColorChanged = TRUE; -} - -void FacePrefPage::updateButtons() -{ - QFont font = Kita::Config::font(); - listFontButton->setText( Kita::fontToString( font ) ); - listFontButton->setFont( font ); - - QFont threadFont = Kita::Config::threadFont(); - threadFontButton->setText( Kita::fontToString( threadFont ) ); - threadFontButton->setFont( threadFont ); - - QFont popupFont = Kita::Config::popupFont(); - popupFontButton->setText( Kita::fontToString( popupFont ) ); - popupFontButton->setFont( popupFont ); -} - -void FacePrefPage::slotThreadFontButtonClicked() -{ - QFont threadFont = threadFontButton->font(); - - if ( KFontDialog::getFont( threadFont, FALSE, this ) == QDialog::Accepted ) { - threadFontButton->setText( Kita::fontToString( threadFont ) ); - threadFontButton->setFont( threadFont ); - emit changed(); - m_threadFontchanged = TRUE; - } -} - -void FacePrefPage::slotFontButtonClicked() -{ - QFont font = listFontButton->font(); - - if ( KFontDialog::getFont( font, FALSE, this ) == QDialog::Accepted ) { - listFontButton->setText( Kita::fontToString( font ) ); - listFontButton->setFont( font ); - emit changed(); - } -} - -void FacePrefPage::slotPopupFontButtonClicked() -{ - QFont font = popupFontButton->font(); - - if ( KFontDialog::getFont( font, FALSE, this ) == QDialog::Accepted ) { - popupFontButton->setText( Kita::fontToString( font ) ); - popupFontButton->setFont( font ); - emit changed(); - } -} - -void FacePrefPage::slotColorChanged() -{ - m_threadColorChanged = TRUE; -} Deleted: kita/trunk/kita/src/prefs/prefs.h =================================================================== --- kita/trunk/kita/src/prefs/prefs.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/prefs.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,135 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2003 by Hideki Ikemoto * -* ikemo****@users***** * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -***************************************************************************/ - -#ifndef _KITAPREF_H_ -#define _KITAPREF_H_ - -#include <kconfigdialog.h> -#include <qframe.h> - -#include "asciiartprefbase.h" -#include "uiprefbase.h" -#include "faceprefbase.h" - -#include "libkita/favoritethreads.h" -#include "libkita/threadinfo.h" -#include "libkita/favoriteboards.h" - -class DebugPrefPage; - -namespace Kita -{ - class AsciiArtPrefPage; - class UIPrefPage; - class AbonePrefPage; - class LoginPrefPage; - class FacePrefPage; - class WritePrefPage; -} - -class KitaPreferences : public KConfigDialog -{ - Q_OBJECT - -public: - KitaPreferences( QWidget* parent ); - -protected: - virtual void slotApply(); - -private: - Kita::FacePrefPage* m_facePage; - Kita::AsciiArtPrefPage* m_asciiArtPage; - Kita::UIPrefPage* m_uiPage; - Kita::AbonePrefPage* m_abonePage; - Kita::LoginPrefPage* m_loginPage; - Kita::WritePrefPage* m_writePage; - -private slots: - void slotChanged(); - virtual void slotOk(); - virtual void slotDefault(); - void slotAboutToShowPage( QWidget* page ); - -signals: - void fontChanged( const QFont& ); -}; - -/*class DebugPrefPage : public DebugPrefBase -{ - Q_OBJECT - -public: - DebugPrefPage( QWidget* parent = 0 ); - -public slots: - void replace(); -};*/ - -namespace Kita -{ - class AsciiArtPrefPage : public AsciiArtPrefBase - { - Q_OBJECT - public: - AsciiArtPrefPage( QWidget* parent = 0 ); - public slots: - void init(); - void apply(); - void reset(); - - signals: - void changed(); - }; - - class UIPrefPage : public UIPrefBase - { - Q_OBJECT - public: - UIPrefPage( QWidget* parent = 0 ); - void apply(); - void reset(); - - private slots: - /// open 'file association setting dialog' - void slotEditFileAssociation(); - - signals: - void changed(); - }; - - class FacePrefPage : public FacePrefBase - { - Q_OBJECT - - bool m_threadFontchanged; - bool m_threadColorChanged; - - public: - FacePrefPage( QWidget* parent = 0 ); - void apply(); - void reset(); - - public slots: - void slotFontButtonClicked(); - void slotPopupFontButtonClicked(); - void slotThreadFontButtonClicked(); - void slotColorChanged(); - - private: - void updateButtons(); - - signals: - void fontChanged( const QFont& ); - void changed(); - }; -} - -#endif // _KITAPREF_H_ Modified: kita/trunk/kita/src/prefs/uiprefbase.ui =================================================================== --- kita/trunk/kita/src/prefs/uiprefbase.ui 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/uiprefbase.ui 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,307 +1,276 @@ -<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> -<class>Kita::UIPrefBase</class> -<widget class="QWidget"> - <property name="name"> - <cstring>Kita::UIPrefBase</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>646</width> - <height>534</height> - </rect> - </property> - <property name="caption"> - <string>Form1</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Kita::UIPrefBase</class> + <widget class="QWidget" name="Kita::UIPrefBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>646</width> + <height>534</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QCheckBox" name="kcfg_AlwaysUseTab"> + <property name="text"> + <string>Use new tab when opening the thread (board).</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout"> + <item> + <widget class="QLabel" name="MarkLabel"> + <property name="text"> + <string>Mark new thread to made:</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>kcfg_MarkTime</cstring> + </property> + </widget> + </item> + <item> + <spacer name="spacer6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QSpinBox" name="kcfg_MarkTime"> + <property name="toolTip"> + <string/> + </property> + <property name="specialValueText"> + <string>after last access</string> + </property> + <property name="suffix"> + <string> hour</string> + </property> + <property name="prefix"> + <string>within </string> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>24</number> + </property> + <property name="value"> + <number>24</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QGroupBox" name="threadGroupBox"> + <property name="title"> + <string comment="@label:textbox">Thread</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="_2"> + <item> + <widget class="QSpinBox" name="kcfg_ShowNum"> + <property name="wrapping"> + <bool>true</bool> + </property> + <property name="specialValueText"> + <string>Display all res</string> + </property> + <property name="suffix"> + <string> res</string> + </property> + <property name="prefix"> + <string comment="@label:spinbox Shown">Display </string> + </property> + <property name="maximum"> + <number>1000</number> + </property> + <property name="singleStep"> + <number>50</number> + </property> + <property name="value"> + <number>100</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="textLabel3_2"> + <property name="text"> + <string>around the last read response.</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>kcfg_ShowNum</cstring> + </property> + </widget> + </item> + <item> + <spacer name="spacer11_2_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <widget class="QLabel" name="textLabel1"> + <property name="text"> + <string>this option affects from the next thread.</string> </property> - <widget class="QCheckBox"> - <property name="name"> - <cstring>kcfg_AlwaysUseTab</cstring> - </property> - <property name="text"> - <string>Use new tab when opening the thread(board).</string> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout2</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>MarkLabel</cstring> - </property> - <property name="text"> - <string>Mark new thread to made:</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer6</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QSpinBox"> - <property name="name"> - <cstring>kcfg_MarkTime</cstring> - </property> - <property name="prefix"> - <string>within </string> - </property> - <property name="suffix"> - <string> hour</string> - </property> - <property name="specialValueText"> - <string>after last access</string> - </property> - <property name="maxValue"> - <number>24</number> - </property> - <property name="minValue"> - <number>0</number> - </property> - <property name="value"> - <number>24</number> - </property> - <property name="toolTip" stdset="0"> - <string></string> - </property> - </widget> - </hbox> - </widget> - <widget class="QButtonGroup"> - <property name="name"> - <cstring>buttonGroup3</cstring> - </property> - <property name="title"> - <string>Thread</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel1</cstring> - </property> - <property name="text"> - <string>this option affects from the next thread.</string> - </property> - </widget> - <widget class="QCheckBox"> - <property name="name"> - <cstring>kcfg_ShowMailAddress</cstring> - </property> - <property name="text"> - <string>Show mail address in the thread.</string> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout13_2</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QSpinBox"> - <property name="name"> - <cstring>kcfg_ShowNum</cstring> - </property> - <property name="prefix"> - <string>Display </string> - </property> - <property name="suffix"> - <string> res</string> - </property> - <property name="specialValueText"> - <string>Display all res</string> - </property> - <property name="wrapping"> - <bool>true</bool> - </property> - <property name="maxValue"> - <number>1000</number> - </property> - <property name="lineStep"> - <number>50</number> - </property> - <property name="value"> - <number>100</number> - </property> - </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel3_2</cstring> - </property> - <property name="text"> - <string>around the last read response.</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer11_2_2</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - </vbox> - </widget> - <widget class="QButtonGroup"> - <property name="name"> - <cstring>kcfg_ListSortOrder</cstring> - </property> - <property name="title"> - <string>When open the board</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QRadioButton"> - <property name="name"> - <cstring>unreadFirstRadio</cstring> - </property> - <property name="text"> - <string>Show unread thread first</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <property name="buttonGroupId"> - <number>0</number> - </property> - </widget> - <widget class="QRadioButton"> - <property name="name"> - <cstring>numOrderRadio</cstring> - </property> - <property name="text"> - <string>Show thread in numerical order</string> - </property> - <property name="buttonGroupId"> - <number>1</number> - </property> - </widget> - </vbox> - </widget> - <widget class="QGroupBox"> - <property name="name"> - <cstring>extPartGroup</cstring> - </property> - <property name="title"> - <string>Parts</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLineEdit" row="2" column="0"> - <property name="name"> - <cstring>kcfg_PartMimeList</cstring> - </property> - </widget> - <widget class="QCheckBox" row="0" column="0"> - <property name="name"> - <cstring>kcfg_UsePart</cstring> - </property> - <property name="text"> - <string>Use other Part to open external link</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <widget class="QLabel" row="1" column="0"> - <property name="name"> - <cstring>mimeListLabel</cstring> - </property> - <property name="text"> - <string>If mime type include this list ( comma separated list )</string> - </property> - <property name="buddy" stdset="0"> - <cstring>PartMimeList</cstring> - </property> - <property name="toolTip" stdset="0"> - <string></string> - </property> - </widget> - </grid> - </widget> - <widget class="KURLLabel"> - <property name="name"> - <cstring>editFileAssociation</cstring> - </property> - <property name="text"> - <string>Edit file association...</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer2</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>30</width> - <height>70</height> - </size> - </property> - </spacer> - </vbox> -</widget> -<connections> - <connection> - <sender>kcfg_UsePart</sender> - <signal>toggled(bool)</signal> - <receiver>kcfg_PartMimeList</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>kcfg_UsePart</sender> - <signal>toggled(bool)</signal> - <receiver>mimeListLabel</receiver> - <slot>setEnabled(bool)</slot> - </connection> -</connections> -<layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>kurllabel.h</includehint> -</includehints> -</UI> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="kcfg_ShowMailAddress"> + <property name="text"> + <string>Show mail address in the thread.</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="kcfg_ListSortOrder"> + <property name="title"> + <string>When open the board</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QRadioButton" name="unreadFirstRadio"> + <property name="text"> + <string>Show unread thread first</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="buttonGroupId" stdset="0"> + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="numOrderRadio"> + <property name="text"> + <string>Show thread in numerical order</string> + </property> + <property name="buttonGroupId" stdset="0"> + <number>1</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="partsGroupBox"> + <property name="title"> + <string>Parts</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QCheckBox" name="kcfg_UsePart"> + <property name="text"> + <string>Use other Part to open external link</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="mimeListLabel"> + <property name="toolTip"> + <string/> + </property> + <property name="text"> + <string>If mime type include this list (comma separated list)</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>kcfg_PartMimeList</cstring> + </property> + </widget> + </item> + <item> + <widget class="KLineEdit" name="kcfg_PartMimeList"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="KUrlLabel" name="editFileAssociation"> + <property name="text"> + <string>Edit file association...</string> + </property> + </widget> + </item> + <item> + <spacer name="spacer2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>30</width> + <height>70</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <customwidgets> + <customwidget> + <class>KLineEdit</class> + <extends>QLineEdit</extends> + <header>klineedit.h</header> + </customwidget> + <customwidget> + <class>KUrlLabel</class> + <extends>QLabel</extends> + <header>kurllabel.h</header> + </customwidget> + </customwidgets> + <includes> + <include location="local">kurllabel.h</include> + </includes> + <resources/> + <connections/> +</ui> Copied: kita/trunk/kita/src/prefs/uiprefpage.cpp (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/uiprefpage.cpp) =================================================================== --- kita/trunk/kita/src/prefs/uiprefpage.cpp (rev 0) +++ kita/trunk/kita/src/prefs/uiprefpage.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,47 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#include "uiprefpage.h" + +#include <ktoolinvocation.h> + +using namespace Kita; + +UIPrefPage::UIPrefPage(QWidget* parent) : AbstractPrefPage(parent) +{ + setupUi(this); + load(); + connect(editFileAssociation, SIGNAL(leftClickedUrl()), + SLOT(slotEditFileAssociation())); +} + +void UIPrefPage::apply() +{ +} + +void UIPrefPage::load() +{ +} + +void UIPrefPage::reset() +{ + kcfg_AlwaysUseTab->setChecked(true); + kcfg_MarkTime->setValue(24); + kcfg_ShowMailAddress->setChecked(false); + kcfg_ShowNum->setValue(100); + //kcfg_ListSortOrder->setButton(GlobalConfig::EnumListSortOrder::Mark);TODO + kcfg_PartMimeList->setText("image/gif,image/jpeg,image/png,image/x-bmp"); + kcfg_UsePart->setChecked(true); +} + +void UIPrefPage::slotEditFileAssociation() +{ + KToolInvocation::kdeinitExec("kcmshell", QStringList("filetypes")); +} Copied: kita/trunk/kita/src/prefs/uiprefpage.h (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/uiprefpage.h) =================================================================== --- kita/trunk/kita/src/prefs/uiprefpage.h (rev 0) +++ kita/trunk/kita/src/prefs/uiprefpage.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,34 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#ifndef KITAUIPREFPAGE_H +#define KITAUIPREFPAGE_H + +#include "abstractprefpage.h" +#include "ui_uiprefbase.h" + +namespace Kita +{ + class UIPrefPage : public AbstractPrefPage, public Ui::UIPrefBase + { + Q_OBJECT + public: + UIPrefPage(QWidget* parent = 0); + virtual void apply(); + virtual void load(); + virtual void reset(); + + private slots: + /// open 'file association setting dialog' + void slotEditFileAssociation(); + }; +} + +#endif // KITAUIPREFPAGE_H Deleted: kita/trunk/kita/src/prefs/write_page.ui =================================================================== --- kita/trunk/kita/src/prefs/write_page.ui 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/write_page.ui 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,156 +0,0 @@ -<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> -<class>Kita::WritePrefPage</class> -<widget class="QWidget"> - <property name="name"> - <cstring>Kita::WritePrefPage</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>600</width> - <height>480</height> - </rect> - </property> - <property name="caption"> - <string>Form1</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout7</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>DefaultNameLabel</cstring> - </property> - <property name="text"> - <string>Default Name</string> - </property> - </widget> - <widget class="KLineEdit"> - <property name="name"> - <cstring>kcfg_DefaultName</cstring> - </property> - </widget> - <widget class="QCheckBox"> - <property name="name"> - <cstring>kcfg_DefaultNameUseAlways</cstring> - </property> - <property name="text"> - <string>use always</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer4</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>188</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout6</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>DefaultMailLabel</cstring> - </property> - <property name="text"> - <string>Default Mail</string> - </property> - </widget> - <widget class="KLineEdit"> - <property name="name"> - <cstring>kcfg_DefaultMail</cstring> - </property> - </widget> - <widget class="QCheckBox"> - <property name="name"> - <cstring>kcfg_DefaultSage</cstring> - </property> - <property name="text"> - <string>sage checked</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer5</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>100</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - <spacer> - <property name="name"> - <cstring>spacer3</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>400</height> - </size> - </property> - </spacer> - </vbox> -</widget> -<connections> - <connection> - <sender>kcfg_DefaultSage</sender> - <signal>toggled(bool)</signal> - <receiver>Kita::WritePrefPage</receiver> - <slot>DefaultSageCheckBoxToggled(bool)</slot> - </connection> -</connections> -<includes> - <include location="local" impldecl="in implementation">write_page.ui.h</include> -</includes> -<slots> - <slot>DefaultSageCheckBoxToggled( bool on )</slot> -</slots> -<layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>klineedit.h</includehint> - <includehint>klineedit.h</includehint> -</includehints> -</UI> Deleted: kita/trunk/kita/src/prefs/write_page.ui.h =================================================================== --- kita/trunk/kita/src/prefs/write_page.ui.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/prefs/write_page.ui.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,18 +0,0 @@ -/**************************************************************************** -** ui.h extension file, included from the uic-generated form implementation. -** -** If you wish to add, delete or rename functions or slots use -** Qt Designer which will update this file, preserving your code. Create an -** init() function in place of a constructor, and a destroy() function in -** place of a destructor. -*****************************************************************************/ - - -void Kita::WritePrefPage::DefaultSageCheckBoxToggled( bool on ) -{ - if ( on ) { - kcfg_DefaultMail->setReadOnly( TRUE ); - } else { - kcfg_DefaultMail->setReadOnly( FALSE ); - } -} Copied: kita/trunk/kita/src/prefs/writeprefbase.ui (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/writeprefbase.ui) =================================================================== --- kita/trunk/kita/src/prefs/writeprefbase.ui (rev 0) +++ kita/trunk/kita/src/prefs/writeprefbase.ui 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Kita::WritePrefBase</class> + <widget class="QWidget" name="Kita::WritePrefBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <layout class="QVBoxLayout"> + <item> + <layout class="QHBoxLayout"> + <item> + <widget class="QLabel" name="DefaultNameLabel"> + <property name="text"> + <string>Default Name</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>kcfg_DefaultName</cstring> + </property> + </widget> + </item> + <item> + <widget class="KLineEdit" name="kcfg_DefaultName"/> + </item> + <item> + <widget class="QCheckBox" name="kcfg_DefaultNameUseAlways"> + <property name="text"> + <string>Use always</string> + </property> + </widget> + </item> + <item> + <spacer name="spacer4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>188</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout"> + <item> + <widget class="QLabel" name="DefaultMailLabel"> + <property name="text"> + <string>Default Mail</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="buddy"> + <cstring>kcfg_DefaultMail</cstring> + </property> + </widget> + </item> + <item> + <widget class="KLineEdit" name="kcfg_DefaultMail"/> + </item> + <item> + <widget class="QCheckBox" name="kcfg_DefaultSage"> + <property name="text"> + <string>sage checked</string> + </property> + </widget> + </item> + <item> + <spacer name="spacer5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>100</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="spacer3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>400</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <customwidgets> + <customwidget> + <class>KLineEdit</class> + <extends>QLineEdit</extends> + <header>klineedit.h</header> + </customwidget> + </customwidgets> + <includes> + <include location="local">klineedit.h</include> + </includes> +</ui> Copied: kita/trunk/kita/src/prefs/writeprefpage.cpp (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/writeprefpage.cpp) =================================================================== --- kita/trunk/kita/src/prefs/writeprefpage.cpp (rev 0) +++ kita/trunk/kita/src/prefs/writeprefpage.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,60 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#include "writeprefpage.h" + +#include "libkita/writeconfig.h" + +using namespace Kita; + +WritePrefPage::WritePrefPage(QWidget* parent) : AbstractPrefPage(parent) +{ + setupUi(this); + load(); + connect(kcfg_DefaultName, SIGNAL(textChanged(const QString &)), + SIGNAL(changed())); + connect(kcfg_DefaultMail, SIGNAL(textChanged(const QString &)), + SIGNAL(changed())); + connect(kcfg_DefaultNameUseAlways, SIGNAL(toggled(bool)), + SIGNAL(changed())); + connect(kcfg_DefaultSage, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(kcfg_DefaultSage, SIGNAL(toggled(bool)), SLOT(slotToggled(bool))); +} + +void WritePrefPage::apply() +{ + WriteConfig::setDefaultName(kcfg_DefaultName->text()); + WriteConfig::setDefaultNameUseAlways( + kcfg_DefaultNameUseAlways->isChecked()); + WriteConfig::setDefaultMail(kcfg_DefaultMail->text()); + WriteConfig::setDefaultSage(kcfg_DefaultSage->isChecked()); +} + +void WritePrefPage::load() +{ + kcfg_DefaultName->setText(WriteConfig::defaultName()); + kcfg_DefaultNameUseAlways->setChecked(WriteConfig::defaultNameUseAlways()); + kcfg_DefaultMail->setText(WriteConfig::defaultMail()); + bool isSage = WriteConfig::defaultSage(); + kcfg_DefaultMail->setReadOnly(isSage); + kcfg_DefaultSage->setChecked(isSage); +} + +void WritePrefPage::reset() +{ + WriteConfig::self()->useDefaults(true); + load(); + WriteConfig::self()->useDefaults(false); +} + +void WritePrefPage::slotToggled(bool on) +{ + kcfg_DefaultMail->setReadOnly(on); +} Copied: kita/trunk/kita/src/prefs/writeprefpage.h (from rev 2558, kita/branches/KITA-KDE4/kita/src/prefs/writeprefpage.h) =================================================================== --- kita/trunk/kita/src/prefs/writeprefpage.h (rev 0) +++ kita/trunk/kita/src/prefs/writeprefpage.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,32 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@users***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#ifndef KITAWRITEPREFPAGE_H +#define KITAWRITEPREFPAGE_H + +#include "abstractprefpage.h" +#include "ui_writeprefbase.h" + +namespace Kita +{ + class WritePrefPage : public AbstractPrefPage, public Ui::WritePrefBase + { + Q_OBJECT + public: + WritePrefPage(QWidget* parent = 0); + virtual void apply(); + virtual void load(); + virtual void reset(); + private slots: + void slotToggled(bool on); + }; +} + +#endif // KITAWRITEPREFPAGE_H Modified: kita/trunk/kita/src/respopup.cpp =================================================================== --- kita/trunk/kita/src/respopup.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/respopup.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,287 +10,290 @@ #include "respopup.h" -#include <qapplication.h> -#include <qcursor.h> +#include <QtGui/QApplication> +#include <QtGui/QCursor> +#include <QtGui/QDesktopWidget> +#include <dom/html_document.h> #include <dom/html_element.h> +#include "const.h" +#include "htmlpart.h" #include "kitaui/htmlview.h" +#include "libkita/colorconfig.h" +#include "libkita/globalconfig.h" -#include "libkita/config_xt.h" +using namespace Kita; -#include "const.h" - -namespace Kita +ResPopup::ResPopup(KHTMLView* view, const KUrl& url) + : QFrame(view, + Qt::FramelessWindowHint + | Qt::Tool + | Qt::Window + | Qt::X11BypassWindowManagerHint + ) { - ResPopup::ResPopup( KHTMLView* view, const KURL& url ) - : QFrame( view, "res_popup", - WStyle_Customize - | WStyle_NoBorder - | WStyle_Tool - | WType_TopLevel - | WX11BypassWM - ) - { - m_url = url; - m_htmlPart = NULL; + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_url = url; + m_htmlPart = 0; - m_htmlPart = new KitaHTMLPart( this ); - m_htmlPart->setup( HTMLPART_MODE_POPUP , url ); - connect( m_htmlPart, SIGNAL( hideChildPopup() ), SIGNAL( hideChildPopup() ) ); - } + m_htmlPart = new HTMLPart(this); + m_htmlPart->view()->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_htmlPart->setup(HTMLPART_MODE_POPUP , url); + connect(m_htmlPart, SIGNAL(hideChildPopup()), SIGNAL(hideChildPopup())); +} - ResPopup::~ResPopup() - { - if ( m_htmlPart ) delete m_htmlPart; - } +ResPopup::~ResPopup() +{ + delete m_htmlPart; +} - /* public */ - void ResPopup::setText( const QString& str ) - { - const int maxwd = 1600; - const int maxht = 1200; +/* public */ +void ResPopup::setText(const QString& str) +{ + const int maxwd = 1600; + const int maxht = 1200; - QString style = QString( "body.pop {" - " font-size: %1pt; " - " font-family: %2; " - " color: %3; " - " background-color: %4; " - " border-width: 0;" - "}" ) - .arg( Kita::Config::popupFont().pointSize() ) - .arg( Kita::Config::popupFont().family() ) - .arg( Kita::Config::popupColor().name() ) - .arg( Kita::Config::popupBackground().name() ); + QString style = QString("body.pop {" + " font-size: %1pt; " + " font-family: %2; " + " color: %3; " + " background-color: %4; " + " border-width: 0;" + "}") + .arg(GlobalConfig::popupFont().pointSize()) + .arg(GlobalConfig::popupFont().family()) + .arg(ColorConfig::popup().name()) + .arg(ColorConfig::popupBackground().name()); - QString text = "<html><head><style>"; - text += DEFAULT_STYLESHEET; - text += style; - text += "</style></head><body class=\"pop\">"; - text += str; - text += "</body></html>"; + QString text = "<html><head><style>"; + text += DEFAULT_STYLESHEET; + text += style; + text += "</style></head><body class=\"pop\">"; + text += str; + text += "</body></html>"; - if ( m_htmlPart ) { - m_htmlPart->view() ->resize( maxwd, maxht ); - m_htmlPart->setJScriptEnabled( FALSE ); - m_htmlPart->setJavaEnabled( FALSE ); - m_htmlPart->begin( "file:/dummy.htm" ); - m_htmlPart->write( text ); - m_htmlPart->end(); - m_htmlPart->view() ->setVScrollBarMode( QScrollView::AlwaysOff ); - } + if (m_htmlPart) { + m_htmlPart->view()->setMinimumSize(maxwd, maxht); + m_htmlPart->setJScriptEnabled(false); + m_htmlPart->setJavaEnabled(false); + m_htmlPart->begin(KUrl("file:/dummy.htm")); + m_htmlPart->write(text); + m_htmlPart->end(); + //m_htmlPart->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); TODO } +} +/* public */ +void ResPopup::adjustSize() +{ +#if 0 + if (!m_htmlPart) return ; - /* public */ - void ResPopup::adjustSize() - { - if ( !m_htmlPart ) return ; + int width = 0, xx = 0, leftmrg = 0; + int maxwidth = 0, maxheight = 0; + DOM::Node curnode = m_htmlPart->htmlDocument().body().firstChild(); - int width = 0, xx = 0, leftmrg = 0; - int maxwidth = 0, maxheight = 0; - DOM::Node curnode = m_htmlPart->htmlDocument().body().firstChild(); + for (;;) { - for ( ;; ) { + QRect qr = curnode.getRect(); + int tmpwd = qr.right() - qr.left(); - QRect qr = curnode.getRect(); - int tmpwd = qr.right() - qr.left(); + /*----------------------------------*/ - /*----------------------------------*/ + if (curnode.nodeType() == DOM::Node::TEXT_NODE) { + if (xx == 0) xx = qr.left(); + width += tmpwd; + } - if ( curnode.nodeType() == DOM::Node::TEXT_NODE ) { - if ( xx == 0 ) xx = qr.left(); - width += tmpwd; - } + /*----------------------------------*/ - /*----------------------------------*/ + else if (curnode.nodeName().string() == "div") { + if (leftmrg == 0) leftmrg = qr.left(); + width = 0; + xx = 0; + } - else if ( curnode.nodeName().string() == "div" ) { - if ( leftmrg == 0 ) leftmrg = qr.left(); - width = 0; - xx = 0; - } + /*----------------------------------*/ - /*----------------------------------*/ + else if (curnode.nodeName().string() == "br") { + width = 0; + xx = 0; + } - else if ( curnode.nodeName().string() == "br" ) { - width = 0; - xx = 0; - } + /*----------------------------------*/ - /*----------------------------------*/ + if (leftmrg + xx + width > maxwidth) maxwidth = leftmrg + xx + width; + if (qr.bottom() > maxheight) maxheight = qr.bottom(); - if ( leftmrg + xx + width > maxwidth ) maxwidth = leftmrg + xx + width; - if ( qr.bottom() > maxheight ) maxheight = qr.bottom(); + /* move to the next node */ + DOM::Node next = curnode.firstChild(); - /* move to the next node */ - DOM::Node next = curnode.firstChild(); + if (next.isNull()) next = curnode.nextSibling(); - if ( next.isNull() ) next = curnode.nextSibling(); + while (!curnode.isNull() && next.isNull()) { + curnode = curnode.parentNode(); + if (!curnode.isNull()) next = curnode.nextSibling(); + } - while ( !curnode.isNull() && next.isNull() ) { - curnode = curnode.parentNode(); - if ( !curnode.isNull() ) next = curnode.nextSibling(); - } + curnode = next; - curnode = next; + if (curnode.isNull()) break; + } - if ( curnode.isNull() ) break; - } + const int mrg = 32; - const int mrg = 32; + int wd = maxwidth + mrg; + int ht = maxheight + mrg; +#endif + QFrame::adjustSize(); + m_htmlPart->view()->setMinimumSize(width(), height()); +} - int wd = maxwidth + mrg; - int ht = maxheight + mrg; - m_htmlPart->view() ->resize( wd, ht ); - QFrame::adjustSize(); - } +/* public */ +void ResPopup::adjustPos(const QPoint& point) +{ + QPoint pos = point; + enum{ + POS_LeftUp, + POS_RightUp, + POS_LeftDown, + POS_RightDown + }; + /* config */ - /* public */ - void ResPopup::adjustPos( QPoint pos ) - { - enum{ - POS_LeftUp, - POS_RightUp, - POS_LeftDown, - POS_RightDown - }; + const int mrg = 16; - /* config */ + /*----------------------------*/ - const int mrg = 16; + if (!m_htmlPart) return ; - /*----------------------------*/ + QRect qr = QApplication::desktop() ->rect(); + int sw = qr.width(), sh = qr.height(); + int wd = width(), ht = height(); + int x = pos.x(), y = pos.y(); + int idx; - if ( !m_htmlPart ) return ; + if ((x + mrg) + wd < sw + && (y - mrg) - ht >= 0) idx = POS_RightUp; - QRect qr = QApplication::desktop() ->rect(); - int sw = qr.width(), sh = qr.height(); - int wd = width(), ht = height(); - int x = pos.x(), y = pos.y(); - int idx; + else if ((x - mrg) - wd >= 0 + && y - (ht + mrg) >= 0) idx = POS_LeftUp; - if ( ( x + mrg ) + wd < sw - && ( y - mrg ) - ht >= 0 ) idx = POS_RightUp; + else if ((x + mrg) + wd < sw + && (y + mrg) + ht < sh) idx = POS_RightDown; - else if ( ( x - mrg ) - wd >= 0 - && y - ( ht + mrg ) >= 0 ) idx = POS_LeftUp; + else if ((x - mrg) - wd >= 0 + && (y + mrg) + ht < sh) idx = POS_LeftDown; - else if ( ( x + mrg ) + wd < sw - && ( y + mrg ) + ht < sh ) idx = POS_RightDown; + else { + int area[ 4 ]; + area[ 0 ] = (sw - x) * y; + area[ 1 ] = x * y; + area[ 2 ] = (sw - x) * (sh - y); + area[ 3 ] = x * (sh - y); - else if ( ( x - mrg ) - wd >= 0 - && ( y + mrg ) + ht < sh ) idx = POS_LeftDown; + idx = 0; + for (int i = 1; i < 4; ++i) if (area[ i ] > area[ idx ]) idx = i; + } - else { - int area[ 4 ]; - area[ 0 ] = ( sw - x ) * y; - area[ 1 ] = x * y; - area[ 2 ] = ( sw - x ) * ( sh - y ); - area[ 3 ] = x * ( sh - y ); + switch (idx) { - idx = 0; - for ( int i = 1; i < 4; ++i ) if ( area[ i ] > area[ idx ] ) idx = i; - } + case POS_RightUp: + x = x + mrg; + y = (y - mrg) - ht; + break; - switch ( idx ) { + case POS_LeftUp: + x = (x - mrg) - wd; + y = (y - mrg) - ht; + break; - case POS_RightUp: - x = x + mrg; - y = ( y - mrg ) - ht; - break; + case POS_RightDown: + x = x + mrg; + y = y + mrg; + break; - case POS_LeftUp: - x = ( x - mrg ) - wd; - y = ( y - mrg ) - ht; - break; + case POS_LeftDown: + x = (x - mrg) - wd; + y = y + mrg; + break; + } - case POS_RightDown: - x = x + mrg; - y = y + mrg; - break; + if (x < 0) { - case POS_LeftDown: - x = ( x - mrg ) - wd; - y = y + mrg; - break; - } + x = ht % 16; + } + if (x + wd >= sw) { - if ( x < 0 ) { + x = sw - wd - (ht % 16); - x = ht % 16; + if (x < 0) { + if (m_htmlPart) m_htmlPart->view() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + x = 0; + wd = sw; } - if ( x + wd >= sw ) { + } - x = sw - wd - ( ht % 16 ); - - if ( x < 0 ) { - if ( m_htmlPart ) m_htmlPart->view() ->setVScrollBarMode( QScrollView::AlwaysOn ); - x = 0; - wd = sw; - } + if (y < 0) { + if (x <= pos.x() && pos.x() < x + wd) { + if (m_htmlPart) m_htmlPart->view() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + ht += y; } + y = 0; + } + if (y + ht >= sh) { - if ( y < 0 ) { - if ( x <= pos.x() && pos.x() < x + wd ) { - if ( m_htmlPart ) m_htmlPart->view() ->setVScrollBarMode( QScrollView::AlwaysOn ); - ht += y; - } - y = 0; - } - if ( y + ht >= sh ) { + if (x <= pos.x() && pos.x() < x + wd) { + if (m_htmlPart) m_htmlPart->view() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + ht = sh - y; + } else { + y = sh - ht; - if ( x <= pos.x() && pos.x() < x + wd ) { - if ( m_htmlPart ) m_htmlPart->view() ->setVScrollBarMode( QScrollView::AlwaysOn ); - ht = sh - y; - } else { - y = sh - ht; - - if ( y < 0 ) { - if ( m_htmlPart ) m_htmlPart->view() ->setVScrollBarMode( QScrollView::AlwaysOn ); - y = 0; - ht = sh; - } + if (y < 0) { + if (m_htmlPart) m_htmlPart->view() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + y = 0; + ht = sh; } } + } - pos.setX( x ); - pos.setY( y ); - move( pos ); + pos.setX(x); + pos.setY(y); + move(pos); - if ( m_htmlPart ) m_htmlPart->view() ->resize( wd, ht ); - resize( wd , ht ); - } + if (m_htmlPart) m_htmlPart->view() ->resize(wd, ht); + resize(wd , ht); +} - /* move mouse pointer above the popup frame */ /* public */ - void ResPopup::moveMouseAbove() - { - /* config */ +/* move mouse pointer above the popup frame */ /* public */ +void ResPopup::moveMouseAbove() +{ + /* config */ - const int mrg = 10; + const int mrg = 10; - /*-------------------------------*/ + /*-------------------------------*/ - QPoint pos = QCursor::pos(); - int cx = pos.x(), cy = pos.y(); - int px = x(); - int py = y(); - int wd = width(); - int ht = height(); + QPoint pos = QCursor::pos(); + int cx = pos.x(), cy = pos.y(); + int px = x(); + int py = y(); + int wd = width(); + int ht = height(); - if ( cx <= px ) cx = px + mrg; - else if ( cx >= px + wd ) cx = px + wd - mrg; + if (cx <= px) cx = px + mrg; + else if (cx >= px + wd) cx = px + wd - mrg; - if ( cy <= py ) cy = py + mrg; - else if ( cy >= py + ht ) cy = py + ht - mrg; + if (cy <= py) cy = py + mrg; + else if (cy >= py + ht) cy = py + ht - mrg; - QCursor::setPos( cx, cy ); - } + QCursor::setPos(cx, cy); } Modified: kita/trunk/kita/src/respopup.h =================================================================== --- kita/trunk/kita/src/respopup.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/respopup.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,34 +7,40 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#ifndef KITARESPOPUP_H +#define KITARESPOPUP_H -#ifndef RESPOPUP_H -#define RESPOPUP_H +#include <QtGui/QFrame> -#include <qframe.h> +#include <kurl.h> -#include "htmlpart.h" +class KHTMLView; + namespace Kita { + class HTMLPart; + class ResPopup : public QFrame { Q_OBJECT - KitaHTMLPart* m_htmlPart; - KURL m_url; + HTMLPart* m_htmlPart; + KUrl m_url; public: - ResPopup( KHTMLView* view, const KURL& datURL ); + ResPopup(KHTMLView* view, const KUrl& datUrl); ~ResPopup(); - void setText( const QString& str ); + void setText(const QString& str); void adjustSize(); - void adjustPos( QPoint pos ); + void adjustPos(const QPoint& point); void moveMouseAbove(); private: - void showImage( const KURL& url ); + void showImage(const KUrl& url); + ResPopup(const ResPopup&); + ResPopup& operator=(const ResPopup&); signals: void hideChildPopup(); Copied: kita/trunk/kita/src/threadlistheaderview.cpp (from rev 2558, kita/branches/KITA-KDE4/kita/src/threadlistheaderview.cpp) =================================================================== --- kita/trunk/kita/src/threadlistheaderview.cpp (rev 0) +++ kita/trunk/kita/src/threadlistheaderview.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,92 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@wakab***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#include "threadlistheaderview.h" + +#include <QtGui/QContextMenuEvent> + +#include "kaction.h" +#include "klocale.h" +#include "kmenu.h" + +#include "threadlistviewitem.h" + +using namespace Kita; + +const struct ColumnAttribute ThreadListHeaderView::attribute[] = { + // labelName, itemName, + // keyName, showDefault + { " ", I18N_NOOP("Mark"), + "ColumnMark", true }, + { I18N_NOOP2("@title:column", "No."), I18N_NOOP("ID"), + "ColumnId", true }, + { " ", I18N_NOOP("Icon"), + "ColumnIcon", true }, + { I18N_NOOP2("@title:column", "Title"), I18N_NOOP("Subject"), + "ColumnSubject", true }, + { I18N_NOOP2("@title:column", "ResNum"), I18N_NOOP("ResNum"), + "ColumnResNum", true }, + { I18N_NOOP2("@title:column", "ReadNum"), I18N_NOOP("ReadNum"), + "ColumnReadNum", true }, + { I18N_NOOP2("@title:column", "ViewPos"), I18N_NOOP("ViewPos"), + "ColumnViewPos", false }, + { I18N_NOOP2("@title:column", "Unread"), I18N_NOOP("Unread"), + "ColumnUnread", true }, + { I18N_NOOP2("@title:column", "Since"), I18N_NOOP("Since"), + "ColumnSince", true }, + { I18N_NOOP2("@title:column", "Thread's speed"), + I18N_NOOP("Speed"), "ColumnSpeed", true }, + { I18N_NOOP2("@title:column", "Board"), I18N_NOOP("Board"), + "ColumnBoard", false }, + { I18N_NOOP2("@title:column", "Dat URL"), I18N_NOOP("DatURL"), + "ColumnDatUrl", false }, + { I18N_NOOP2("@title:column", "Mark Order"), I18N_NOOP("MarkOrder"), + "ColumnMarkOrder", false }, + { I18N_NOOP2("@title:column", "ID Order"), I18N_NOOP("IDOrder"), + "ColumnIdOrder", false } +}; + +ThreadListHeaderView::ThreadListHeaderView(QWidget* parent) + : QHeaderView(Qt::Horizontal, parent) +{ + setClickable(true); + m_autoResizeAct + = new KAction(i18nc("@action:inmenu", "Auto Resize"), this); + m_autoResizeAct->setCheckable(true); +} + +void ThreadListHeaderView::contextMenuEvent(QContextMenuEvent *event) +{ + KMenu popup; + for (int i = ColumnBegin; i <= ColumnEnd; i++) { + if (i != ColumnSubject && i != ColumnMarkOrder && i != ColumnIdOrder) { + KAction* action = new KAction(i18n(attribute[i].itemName), this); + action->setCheckable(true); + action->setChecked(!isSectionHidden(i)); + action->setData(QVariant(i)); + popup.addAction(action); + } + } +// m_autoResizeAct->setChecked(autoResize()); TODO + popup.addAction(m_autoResizeAct); + + QAction* action = popup.exec(event->globalPos()); + if (!action) { + return; + } + if (action == m_autoResizeAct) { + //setAutoResize(!action->isChecked());TODO + } else if (action->isChecked()) { + showSection(action->data().toInt()); + } else { + hideSection(action->data().toInt()); + } + //saveHeaderOnOff(); TODO +} Copied: kita/trunk/kita/src/threadlistheaderview.h (from rev 2558, kita/branches/KITA-KDE4/kita/src/threadlistheaderview.h) =================================================================== --- kita/trunk/kita/src/threadlistheaderview.h (rev 0) +++ kita/trunk/kita/src/threadlistheaderview.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,42 @@ +/*************************************************************************** +* Copyright (C) 2003 by Hideki Ikemoto * +* ikemo****@wakab***** * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ +#ifndef KITATHREADLISTHEADERVIEW_H +#define KITATHREADLISTHEADERVIEW_H + +#include <QtGui/QHeaderView> + +class KAction; + +struct ColumnAttribute +{ + const char* const labelName; /// for header's label + const char* const itemName; /// for header's popupItem + QString keyName; /// for KConfig's key + bool showDefault; /// default setting. +}; + +namespace Kita +{ + class ThreadListHeaderView : public QHeaderView + { + Q_OBJECT + + public: + explicit ThreadListHeaderView(QWidget* parent = 0); + static const ColumnAttribute attribute[]; + + private: + void contextMenuEvent(QContextMenuEvent *event); + + KAction* m_autoResizeAct; + }; +} + +#endif Modified: kita/trunk/kita/src/threadlistview.cpp =================================================================== --- kita/trunk/kita/src/threadlistview.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/threadlistview.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,186 +10,265 @@ #include "threadlistview.h" -#include "viewmediator.h" +#include <QtGui/QClipboard> +#include <QtGui/QContextMenuEvent> +#include <QtGui/QHeaderView> -#include <kiconloader.h> -#include <klistview.h> -#include <klocale.h> +#include <kaction.h> +#include <kmenu.h> +#include <krun.h> #include <kurl.h> -#include <qtoolbutton.h> -#include <qcombobox.h> -#include <qregexp.h> -#include <qheader.h> - -#include "libkita/thread.h" -#include "libkita/config_xt.h" +#include "threadlistheaderview.h" +#include "threadlistviewitem.h" +#include "ui_threadproperty.h" +#include "viewmediator.h" +#include "libkita/cache.h" +#include "libkita/datmanager.h" +#include "libkita/favoritethreads.h" #include "libkita/kita_misc.h" +#include "libkita/threadindex.h" +#include "libkita/threadinfo.h" -#include "threadlistviewitem.h" - using namespace Kita; -struct Col_Attr ThreadListView::s_colAttr[] = - { - // labelName, itemName, keyName, showDefault - { I18N_NOOP( " " ), I18N_NOOP( "Mark" ), "Col_Mark", TRUE }, - { I18N_NOOP( "No." ), I18N_NOOP( "ID" ), "Col_ID", TRUE }, - { I18N_NOOP( " " ), I18N_NOOP( "Icon" ), "Col_Icon", TRUE }, - { I18N_NOOP( "Title" ), I18N_NOOP( "Subject" ), "Col_Subject", TRUE }, - { I18N_NOOP( "ResNum" ), I18N_NOOP( "ResNum" ), "Col_ResNum", TRUE }, - { I18N_NOOP( "ReadNum" ), I18N_NOOP( "ReadNum" ), "Col_ReadNum", TRUE }, - { I18N_NOOP( "ViewPos" ), I18N_NOOP( "ViewPos" ), "Col_ViewPos", FALSE }, - { I18N_NOOP( "Unread" ), I18N_NOOP( "Unread" ), "Col_Unread", TRUE }, - { I18N_NOOP( "Since" ), I18N_NOOP( "Since" ), "Col_Since", TRUE }, - { I18N_NOOP( "Thread's speed" ), I18N_NOOP( "Speed" ), "Col_Speed", TRUE }, - { I18N_NOOP( "Board" ), I18N_NOOP( "Board" ), "Col_Board", FALSE }, - { I18N_NOOP( "Dat URL" ), I18N_NOOP( "DatURL" ), "Col_DatURL", FALSE }, - { I18N_NOOP( "Mark Order" ), I18N_NOOP( "MarkOrder" ), "Col_MarkOrder", FALSE }, - { I18N_NOOP( "ID Order" ), I18N_NOOP( "IDOrder" ), "Col_IDOrder", FALSE } - }; - -ThreadListView::ThreadListView( QWidget* parent, const char* name ) - : ThreadListViewBase( parent, name ) +ThreadListView::ThreadListView(QWidget* parent) + : QWidget(parent) { - HideButton->setPixmap( SmallIcon( "filter" ) ); - ReloadButton->setPixmap( SmallIcon( "reload" ) ); - closeButton->setPixmap( SmallIcon( "fileclose" ) ); + setupUi(this); + hideButton->setIcon(SmallIcon("view-filter")); + reloadButton->setIcon(SmallIcon("view-refresh")); + closeButton->setIcon(SmallIcon("tab-close")); - QHeader* header = subjectList->header(); - for ( int i = Col_Begin; i <= Col_End; i++ ) { - subjectList->addColumn( i18n( s_colAttr[ i ].labelName ) ); + ThreadListHeaderView* header = new ThreadListHeaderView; - if ( s_colAttr[ i ].showDefault != TRUE ) { - hideColumn( i ); + subjectList->setAlternatingRowColors(true); + subjectList->setColumnCount(ColumnEnd - ColumnBegin + 1); + subjectList->setHorizontalHeader(header); + subjectList->setShowGrid(false); + subjectList->setSortingEnabled(true); + subjectList->verticalHeader()->setVisible(false); + QStringList labels; + for (int i = ColumnBegin; i <= ColumnEnd; i++) { + labels << i18nc("@title:column", + ThreadListHeaderView::attribute[i].labelName); + if (!ThreadListHeaderView::attribute[i].showDefault) { + hideColumn(i); } } - header->setStretchEnabled( TRUE, Col_Subject ); + subjectList->setHorizontalHeaderLabels(labels); + subjectList->setSelectionBehavior(QAbstractItemView::SelectRows); + subjectList->setSelectionMode(QAbstractItemView::SingleSelection); - connect( SearchCombo, SIGNAL( activated( int ) ), - SLOT( slotSearchButton() ) ); - connect( SearchCombo, SIGNAL( textChanged( const QString& ) ), - SLOT( slotSearchButton() ) ); - connect( HideButton, SIGNAL( toggled( bool ) ), - SLOT( slotHideButton( bool ) ) ); - connect( subjectList, SIGNAL( mouseButtonClicked( int, QListViewItem*, const QPoint&, int ) ), - SLOT( slotMouseButtonClicked( int, QListViewItem* ) ) ); + connect(searchCombo, SIGNAL(activated(int)), + SLOT(slotSearchButton())); + connect(searchCombo, SIGNAL(textChanged(const QString&)), + SLOT(slotSearchButton())); + connect(hideButton, SIGNAL(toggled(bool)), + SLOT(slotHideButton(bool))); + connect(subjectList, SIGNAL(itemClicked(QTableWidgetItem*)), + SLOT(slotItemClicked(QTableWidgetItem*))); + + m_openWithBrowserAct + = new KAction(i18nc("@action:inmenu", "Open with Web Browser") , this); + m_copyUrlAct = new KAction(i18nc("@action:inmenu", "Copy URL"), this); + m_copyTitleAndUrlAct + = new KAction(i18nc("@action:inmenu", "Copy title and URL"), this); + m_favoritesAct = new KAction(this); + m_deleteLogAct = new KAction(i18nc("@action:inmenu", "Delete Log"), this); + m_deleteLogAct->setVisible(false); + m_propertyAct = new KAction(i18nc("@action:inmenu", "Property"), this); } -ThreadListView::~ThreadListView() -{} +ThreadListView::~ThreadListView() {} void ThreadListView::slotSearchButton() { insertSearchCombo(); - QStringList list = Kita::parseSearchQuery( SearchCombo->currentText() ); + QStringList list = parseSearchQuery(searchCombo->currentText()); - if ( list.isEmpty() ) { + if (list.isEmpty()) { clearSearch(); - } else if ( list != m_prevquery ) { - searchNew( list ); - HideButton->setOn( TRUE ); + } else if (list != m_prevquery) { + searchNew(list); + hideButton->setDown(true); + slotHideButton(true); } else { - searchNext( list ); + searchNext(list); } } void ThreadListView::insertSearchCombo() { - for ( int count = 0; count < SearchCombo->count(); ++count ) { - if ( SearchCombo->text( count ) == SearchCombo->currentText() ) { + for (int count = 0; count < searchCombo->count(); ++count) { + if (searchCombo->itemText(count) == searchCombo->currentText()) { return; } } - SearchCombo->insertItem( SearchCombo->currentText() ); + searchCombo->addItem(searchCombo->currentText()); } -void ThreadListView::searchNext( const QStringList &query ) +void ThreadListView::searchNext(const QStringList &query) { - Q_ASSERT( query == m_prevquery ); - Q_ASSERT( m_nextHitIndex < m_hitList.size() ); + Q_ASSERT(query == m_prevquery); + Q_ASSERT(m_nextHitIndex < static_cast<unsigned>(m_hitList.size())); - KListViewItem* item = m_hitList[ m_nextHitIndex ]; - subjectList->ensureItemVisible( item ); - subjectList->setSelected( item, TRUE ); + QTableWidgetItem* item = m_hitList[m_nextHitIndex]; + subjectList->scrollToItem(item); + subjectList->setRangeSelected(QTableWidgetSelectionRange( + item->row(), 0, item->row(), subjectList->columnCount() - 1), + true); m_nextHitIndex++; - if ( m_nextHitIndex >= m_hitList.size() ) m_nextHitIndex = 0; + if (m_nextHitIndex >= static_cast<unsigned>(m_hitList.size())) + m_nextHitIndex = 0; } -void ThreadListView::searchNew( const QStringList &query ) +void ThreadListView::searchNew(const QStringList &query) { m_hitList.clear(); m_nextHitIndex = 0; m_prevquery = query; - - QListViewItemIterator listIt( subjectList ); - while ( listIt.current() != 0 ) { - KListViewItem * item = static_cast<KListViewItem*>( listIt.current() ); - item->setPixmap( Col_Icon, 0 ); - - QStringList::const_iterator queryIt = query.begin(); - for ( ; queryIt != query.end(); ++queryIt ) { - if ( item->text( Col_Subject ).contains( *queryIt, FALSE ) ) { - item->setPixmap( Col_Icon, SmallIcon( "find" ) ); - m_hitList.append( item ); + for (int i = 0, j = subjectList->rowCount(); i < j; i++) { + subjectList->item(i, ColumnIcon)->setIcon(QIcon()); + for (int k = 0, l = query.count(); k < l; k++) { + if (subjectList->item(i, ColumnSubject)->text() + .contains(query[k], Qt::CaseInsensitive)) { + subjectList->item(i, ColumnIcon) + ->setIcon(SmallIcon("edit-find")); + m_hitList.append(subjectList->item(i, 0)); break; } } - ++listIt; } } void ThreadListView::clearSearch() { - QListViewItemIterator listIt( subjectList ); - while ( listIt.current() != 0 ) { - KListViewItem * item = static_cast<KListViewItem *>( listIt.current() ); - item->setPixmap( Col_Icon, 0 ); - item->setVisible( TRUE ); - ++listIt; + for (int i = 0, j = subjectList->rowCount(); i < j; i++) { + subjectList->item(i, ColumnIcon)->setIcon(QIcon()); + subjectList->showRow(i); } } -void ThreadListView::slotHideButton( bool on ) +void ThreadListView::slotHideButton(bool on) { - QListViewItemIterator listIt( subjectList ); - while ( listIt.current() != 0 ) { - KListViewItem * item = static_cast<KListViewItem *>( listIt.current() ); - if ( on && ! item->pixmap( Col_Icon ) ) { - item->setVisible( FALSE ); + for (int i = 0, j = subjectList->rowCount(); i < j; i++) { + if (on && subjectList->item(i, ColumnIcon)->icon().isNull()) { + subjectList->hideRow(i); } else { - item->setVisible( TRUE ); + subjectList->showRow(i); } - ++listIt; } } -void ThreadListView::slotMouseButtonClicked( int button, QListViewItem* item ) +void ThreadListView::slotItemClicked(QTableWidgetItem* item) { - if ( ! item ) return ; + if (!item) return; + for (int i = 0, j = subjectList->columnCount(); i < j; i++) + subjectList->item(item->row(), i)->setSelected(true); + KUrl datUrl = subjectList->item(item->row(), ColumnDatUrl)->text(); + ViewMediator::getInstance()->openThread(datUrl); +} - KURL datURL = item->text( Col_DatURL ); - - if ( button == LeftButton ) { - ViewMediator::getInstance()->openThread( datURL ); - } +void ThreadListView::hideColumn(int col) +{ + subjectList->hideColumn(col); } -void ThreadListView::hideColumn( int col ) +void ThreadListView::showColumn(int col) { - QHeader* header = subjectList->header(); - subjectList->setColumnWidthMode( col, QListView::Manual ); - header->setResizeEnabled( FALSE, col ); - subjectList->setColumnWidth( col, 0 ); + subjectList->showColumn(col); } -void ThreadListView::showColumn( int col ) +void ThreadListView::contextMenuEvent(QContextMenuEvent *event) { - QHeader* header = subjectList->header(); - subjectList->setColumnWidthMode( col, QListView::Maximum ); - header->setResizeEnabled( TRUE, col ); - subjectList->adjustColumn( col ); + QTableWidgetItem* item = subjectList->itemAt( + subjectList->viewport()->mapFromGlobal(event->globalPos())); + if (item == 0) { + return; + } + + QString datUrl = subjectList->item(item->row(), ColumnDatUrl)->text(); + DatManager datManager(datUrl); + QString threadUrl = datManager.threadUrl(); + + // create popup menu. + KMenu popup(0); + + popup.addAction(m_openWithBrowserAct); + popup.addAction(m_copyUrlAct); + popup.addAction(m_copyTitleAndUrlAct); + + bool isFavorites = FavoriteThreads::getInstance()->contains(datUrl); + m_favoritesAct->setText(isFavorites + ? i18nc("@action:inmenu", "Remove from Favorites") + : i18nc("@action:inmenu", "Add to Favorites")); + popup.addAction(m_favoritesAct); + + if (datManager.getReadNum()) { + popup.addSeparator(); + popup.addAction(m_deleteLogAct); + } + popup.addSeparator(); + popup.addAction(m_propertyAct); + + // exec popup menu. + QClipboard* clipboard = QApplication::clipboard(); + + QAction* action = popup.exec(QCursor::pos()); + if (!action) { + return; + } + if (action == m_openWithBrowserAct) { + KRun::runUrl(threadUrl, "text/html", this); + } else if (action == m_copyUrlAct) { + clipboard->setText(threadUrl, QClipboard::Clipboard); + clipboard->setText(threadUrl, QClipboard::Selection); + } else if (action == m_copyTitleAndUrlAct) { + QString cliptxt = datManager.threadName() + '\n' + threadUrl; + clipboard->setText(cliptxt , QClipboard::Clipboard); + clipboard->setText(cliptxt , QClipboard::Selection); + } else if (action == m_favoritesAct) { + ViewMediator::getInstance()->bookmark(datUrl, !isFavorites); + } else if (action == m_deleteLogAct) { + deleteLog(threadUrl); + } else if (action == m_propertyAct) { + QWidget* widget = new QWidget; + Ui::ThreadProperty* propertyWidget + = new Ui::ThreadProperty; + propertyWidget->setupUi(widget); + propertyWidget->threadUrlLabel->setText(threadUrl); + propertyWidget->datUrlLabel->setText(datUrl); + + propertyWidget->threadNameLabel + ->setText(datManager.threadName()); + propertyWidget->cachePathLabel + ->setText(Cache(datUrl).getPath()); + propertyWidget->indexPathLabel + ->setText(Cache(datUrl).getIndexPath()); + propertyWidget->resNumLabel + ->setText(QString::number(datManager.getResNum())); + propertyWidget->readNumLabel + ->setText(QString::number(datManager.getReadNum())); + propertyWidget->viewPosLabel + ->setText(QString::number(datManager.getViewPos())); + + ThreadIndex threadIndex(datUrl); + propertyWidget->idx_threadNameWithIndexLabel + ->setText(threadIndex.getSubject()); + propertyWidget->idx_resNumLabel + ->setText(QString::number(threadIndex.getResNum())); + propertyWidget->idx_readNumLabel + ->setText(QString::number(threadIndex.getReadNum())); + propertyWidget->idx_viewPosLabel + ->setText(QString::number(threadIndex.getViewPos())); + + propertyWidget->cache_readNumLabel + ->setText(QString::number(ThreadInfo::readNum(datUrl))); + widget->show(); + } } -#include "threadlistview.moc" +// dummy function. reimplemented in BoardView +void ThreadListView::deleteLog(const KUrl&) {} Modified: kita/trunk/kita/src/threadlistview.h =================================================================== --- kita/trunk/kita/src/threadlistview.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/threadlistview.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,54 +10,54 @@ #ifndef KITATHREADLISTVIEW_H #define KITATHREADLISTVIEW_H -#include "threadlistviewbase.h" +#include <QtCore/QList> -#include <klistview.h> -#include <kparts/browserextension.h> +#include "ui_threadlistviewbase.h" -struct Col_Attr -{ - QString labelName; /// for header's label - QString itemName; /// for header's popupItem - QString keyName; /// for KConfig's key - bool showDefault; /// default setting. -}; +class KAction; - namespace Kita { class Thread; /** @author Hideki Ikemoto */ - class ThreadListView : public Kita::ThreadListViewBase + class ThreadListView : public QWidget, public Ui::ThreadListViewBase { Q_OBJECT public: - ThreadListView( QWidget* parent = 0, const char *name = 0 ); - ~ThreadListView(); + explicit ThreadListView(QWidget* parent = 0); + virtual ~ThreadListView(); protected: - static struct Col_Attr s_colAttr[]; QStringList m_prevquery; unsigned m_nextHitIndex; - QValueList<KListViewItem *> m_hitList; + QList<QTableWidgetItem *> m_hitList; + KAction* m_deleteLogAct; void insertSearchCombo(); - void searchNext( const QStringList& input ); - void searchNew( const QStringList& query ); + void searchNext(const QStringList& input); + void searchNew(const QStringList& query); void clearSearch(); - void hideColumn( int col ); - void showColumn( int col ); + void hideColumn(int col); + void showColumn(int col); + void contextMenuEvent(QContextMenuEvent* event); + virtual void deleteLog(const KUrl& url); protected slots: - void slotHideButton( bool on ); - void slotMouseButtonClicked( int, QListViewItem* ); + void slotHideButton(bool on); + void slotItemClicked(QTableWidgetItem*); private slots: void slotSearchButton(); + private: + KAction* m_openWithBrowserAct; + KAction* m_copyUrlAct; + KAction* m_copyTitleAndUrlAct; + KAction* m_favoritesAct; + KAction* m_propertyAct; }; } Modified: kita/trunk/kita/src/threadlistviewbase.ui =================================================================== --- kita/trunk/kita/src/threadlistviewbase.ui 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/threadlistviewbase.ui 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,155 +1,132 @@ -<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> -<class>Kita::ThreadListViewBase</class> -<widget class="QWidget"> - <property name="name"> - <cstring>Kita::ThreadListViewBase</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>601</width> - <height>483</height> - </rect> - </property> - <property name="caption"> - <string>Form2</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>0</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout3</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QComboBox"> - <property name="name"> - <cstring>SearchCombo</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>200</width> - <height>0</height> - </size> - </property> - <property name="editable"> - <bool>true</bool> - </property> - <property name="sizeLimit"> - <number>10</number> - </property> - </widget> - <widget class="QToolButton"> - <property name="name"> - <cstring>HideButton</cstring> - </property> - <property name="text"> - <string>Hide</string> - </property> - <property name="toggleButton"> - <bool>true</bool> - </property> - <property name="toolTip" stdset="0"> - <string>filter thread</string> - </property> - </widget> - <widget class="QToolButton"> - <property name="name"> - <cstring>ReloadButton</cstring> - </property> - <property name="text"> - <string>Reload</string> - </property> - <property name="toggleButton"> - <bool>false</bool> - </property> - <property name="toolTip" stdset="0"> - <string>reload board</string> - </property> - </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>KindLabel</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>5</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>AlignVCenter|AlignLeft</set> - </property> - <property name="indent"> - <number>5</number> - </property> - <property name="toolTip" stdset="0"> - <string>unread/read/new threads</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer1</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>150</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QToolButton"> - <property name="name"> - <cstring>closeButton</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Close</string> - </property> - <property name="toolTip" stdset="0"> - <string>close tab</string> - </property> - </widget> - </hbox> - </widget> - <widget class="KListView"> - <property name="name"> - <cstring>subjectList</cstring> - </property> - <property name="allColumnsShowFocus"> - <bool>true</bool> - </property> - </widget> - </vbox> -</widget> -<layoutdefaults spacing="6" margin="11"/> -</UI> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Kita::ThreadListViewBase</class> + <widget class="QWidget" name="Kita::ThreadListViewBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>601</width> + <height>483</height> + </rect> + </property> + <layout class="QVBoxLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <layout class="QHBoxLayout"> + <item> + <widget class="KComboBox" name="searchCombo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>200</width> + <height>0</height> + </size> + </property> + <property name="editable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="hideButton"> + <property name="toolTip"> + <string>Filter thread</string> + </property> + <property name="text"> + <string>Hide</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="reloadButton"> + <property name="toolTip"> + <string>Reload board</string> + </property> + <property name="text"> + <string comment="@action:button Reload the board">Reload</string> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="kindLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>unread/read/new threads</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <property name="indent"> + <number>5</number> + </property> + </widget> + </item> + <item> + <spacer name="spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>150</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QToolButton" name="closeButton"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string comment="@info:tooltip">Close tab</string> + </property> + <property name="text"> + <string>Close</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QTableWidget" name="subjectList"/> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>KComboBox</class> + <extends>QComboBox</extends> + <header>kcombobox.h</header> + </customwidget> + </customwidgets> +</ui> Modified: kita/trunk/kita/src/threadlistviewitem.cpp =================================================================== --- kita/trunk/kita/src/threadlistviewitem.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/threadlistviewitem.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -12,30 +12,29 @@ using namespace Kita; -ThreadListViewItem::ThreadListViewItem( QListView* parent ) - : Kita::ListViewItem( parent ) +ThreadListViewItem::ThreadListViewItem(int column) + : QTableWidgetItem(Qt::ItemIsSelectable), m_column(column) {} -ThreadListViewItem::~ThreadListViewItem() -{} - /* public */ /* virtual */ -int ThreadListViewItem::compare( QListViewItem* i, int col, bool ascending ) const +bool ThreadListViewItem::operator<(const QTableWidgetItem& other) const { - switch ( col ) { - case Col_ResNum: - case Col_ReadNum: - case Col_Unread: - return i->key( col, ascending ).toInt() - key( col, ascending ).toInt(); - case Col_ID: - return key( Col_IDOrder, ascending ).toInt() - i->key( Col_IDOrder, ascending ).toInt(); - case Col_Mark: - return QString::localeAwareCompare( i->key( Col_MarkOrder, ascending ), key( Col_MarkOrder, ascending ) ); - case Col_Since: - return QString::localeAwareCompare( i->key( col, ascending ), key( col, ascending ) ); - case Col_Speed: - return static_cast<int>( i->key( col, ascending ).toDouble() * 1000 - key( col, ascending ).toDouble() * 1000 ); + QString thisText = text(); + QString otherText = other.text(); + switch (m_column) { + case ColumnResNum: + case ColumnReadNum: + case ColumnUnread: + return thisText.toInt() > otherText.toInt(); + case ColumnId: + return thisText.toInt() > otherText.toInt(); + case ColumnMark: + return QString::localeAwareCompare(thisText, otherText) > 0; + case ColumnSince: + return QString::localeAwareCompare(thisText, otherText) > 0; + case ColumnSpeed: + return thisText.toDouble() * 1000 > otherText.toDouble() * 1000; default: - return QString::localeAwareCompare( key( col, ascending ), i->key( col, ascending ) ); + return QString::localeAwareCompare(thisText, otherText) > 0; } } Modified: kita/trunk/kita/src/threadlistviewitem.h =================================================================== --- kita/trunk/kita/src/threadlistviewitem.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/threadlistviewitem.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,41 +7,42 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#ifndef KITATHREADLISTVIEWITEM_H +#define KITATHREADLISTVIEWITEM_H -#ifndef _KITATHREADLISTVIEWITEM_H_ -#define _KITATHREADLISTVIEWITEM_H_ +#include <QtGui/QTableWidgetItem> -#include "kitaui/listviewitem.h" - enum ThreadListCol { - Col_Begin = 0, - Col_Mark = 0, - Col_ID, - Col_Icon, - Col_Subject, - Col_ResNum, - Col_ReadNum, - Col_ViewPos, - Col_Unread, - Col_Since, - Col_Speed, - Col_Board, - Col_DatURL, - Col_MarkOrder, - Col_IDOrder, - Col_End = Col_IDOrder + ColumnBegin = 0, + ColumnMark = 0, + ColumnId, + ColumnIcon, + ColumnSubject, + ColumnResNum, + ColumnReadNum, + ColumnViewPos, + ColumnUnread, + ColumnSince, + ColumnSpeed, + ColumnBoard, + ColumnDatUrl, + ColumnMarkOrder, + ColumnIdOrder, + ColumnEnd = ColumnIdOrder }; namespace Kita { - /* for KitaBoardView */ - class ThreadListViewItem : public Kita::ListViewItem + /* for BoardView */ + class ThreadListViewItem : public QTableWidgetItem { public: - ThreadListViewItem( QListView* parent ); - ~ThreadListViewItem(); + ThreadListViewItem(int column); - virtual int compare( QListViewItem* i, int col, bool ascending ) const; + virtual bool operator<(const QTableWidgetItem& other) const; + + private: + int m_column; }; } Modified: kita/trunk/kita/src/threadproperty.ui =================================================================== --- kita/trunk/kita/src/threadproperty.ui 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/threadproperty.ui 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,582 +1,357 @@ -<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> -<class>Kita::ThreadProperty</class> -<widget class="QWidget"> - <property name="name"> - <cstring>Kita::ThreadProperty</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>793</width> - <height>719</height> - </rect> - </property> - <property name="caption"> - <string>Form1</string> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>threadURLLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>110</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Thread URL</string> - </property> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Kita::ThreadProperty</class> + <widget class="QWidget" name="Kita::ThreadProperty"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>500</width> + <height>365</height> + </rect> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="threadUrlLabel0"> + <property name="text"> + <string>Thread URL</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>threadURLLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>10</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="threadUrlLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>datURLLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>40</y> - <width>110</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Dat URL</string> - </property> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="datUrlLabel0"> + <property name="text"> + <string>Dat URL</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>datURLLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>40</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="datUrlLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="Line"> - <property name="name"> - <cstring>line1_3</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>60</y> - <width>770</width> - <height>20</height> - </rect> - </property> - <property name="frameShape"> - <enum>HLine</enum> - </property> - <property name="frameShadow"> - <enum>Sunken</enum> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> + </item> + <item row="2" column="0" colspan="2"> + <widget class="Line" name="line1_3"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>label0_3</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>80</y> - <width>150</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>DatManager's information</string> - </property> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QLabel" name="label0_3"> + <property name="text"> + <string>DatManager's information</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>cachePathLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>150</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="threadNameLabel0"> + <property name="text"> + <string comment="@label:textbox">Thread Name</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>threadNameLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>120</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="4" column="1"> + <widget class="QLabel" name="threadNameLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>threadNameLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>120</y> - <width>110</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Thread Name</string> - </property> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="cachePathLabel0"> + <property name="text"> + <string>Cache Path</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>indexPathLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>180</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="5" column="1"> + <widget class="QLabel" name="cachePathLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>resNumLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>210</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="indexPathLabel0"> + <property name="text"> + <string>Index Path</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>cache_resNumLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>530</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="6" column="1"> + <widget class="QLabel" name="indexPathLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>idx_threadNameWithIndexLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>360</y> - <width>110</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>Thread Name</string> - </property> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="resNumLabel0"> + <property name="text"> + <string>ResNum</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="Line"> - <property name="name"> - <cstring>line1</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>300</y> - <width>770</width> - <height>20</height> - </rect> - </property> - <property name="frameShape"> - <enum>HLine</enum> - </property> - <property name="frameShadow"> - <enum>Sunken</enum> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> + </item> + <item row="7" column="1"> + <widget class="QLabel" name="resNumLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>cache_readNumLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>560</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="8" column="0"> + <widget class="QLabel" name="readNumLabel0"> + <property name="text"> + <string>ReadNum</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>idx_threadNameWithIndexLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>360</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="8" column="1"> + <widget class="QLabel" name="readNumLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>label0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>320</y> - <width>130</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>Index file's information</string> - </property> + </item> + <item row="9" column="0"> + <widget class="QLabel" name="viewPosLabel0"> + <property name="text"> + <string>ViewPos</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>idx_readNumLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>420</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="9" column="1"> + <widget class="QLabel" name="viewPosLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>idx_resNumLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>390</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="10" column="0" colspan="2"> + <widget class="Line" name="line1"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>label0_2</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>500</y> - <width>190</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>"cache" file's info (obsolete)</string> - </property> + </item> + <item row="11" column="0" colspan="2"> + <widget class="QLabel" name="label0"> + <property name="text"> + <string>Index file's information</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>idx_viewPosLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>450</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="12" column="0"> + <widget class="QLabel" name="idx_threadNameWithIndexLabel0"> + <property name="text"> + <string comment="@label:textbox">Thread Name</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="Line"> - <property name="name"> - <cstring>line1_2</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>470</y> - <width>770</width> - <height>20</height> - </rect> - </property> - <property name="frameShape"> - <enum>HLine</enum> - </property> - <property name="frameShadow"> - <enum>Sunken</enum> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> + </item> + <item row="12" column="1"> + <widget class="QLabel" name="idx_threadNameWithIndexLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>readNumLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>240</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="13" column="0"> + <widget class="QLabel" name="idx_resNumLabel0"> + <property name="text"> + <string>ResNum</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>viewPosLabel</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>270</y> - <width>650</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string></string> - </property> + </item> + <item row="13" column="1"> + <widget class="QLabel" name="idx_resNumLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>cachePathLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>150</y> - <width>110</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Cache Path</string> - </property> + </item> + <item row="14" column="0"> + <widget class="QLabel" name="idx_readNumLabel0"> + <property name="text"> + <string>ReadNum</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>indexPathLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>180</y> - <width>110</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Index Path</string> - </property> + </item> + <item row="14" column="1"> + <widget class="QLabel" name="idx_readNumLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>viewPosLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>270</y> - <width>110</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>ViewPos</string> - </property> + </item> + <item row="15" column="0"> + <widget class="QLabel" name="idx_viewPosLabel0"> + <property name="text"> + <string>ViewPos</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>idx_resNumLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>390</y> - <width>110</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>ResNum</string> - </property> + </item> + <item row="15" column="1"> + <widget class="QLabel" name="idx_viewPosLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>idx_readNumLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>420</y> - <width>110</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>ReadNum</string> - </property> + </item> + <item row="16" column="0" colspan="2"> + <widget class="Line" name="line1_2"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>idx_viewPosLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>450</y> - <width>110</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>ViewPos</string> - </property> + </item> + <item row="17" column="0" colspan="2"> + <widget class="QLabel" name="label0_2"> + <property name="text"> + <string>"cache" file's info (obsolete)</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>cache_resNumLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>530</y> - <width>110</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>ResNum</string> - </property> + </item> + <item row="18" column="0"> + <widget class="QLabel" name="cache_resNumLabel0"> + <property name="text"> + <string>ResNum</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>cache_readNumLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>560</y> - <width>110</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>ReadNum</string> - </property> + </item> + <item row="18" column="1"> + <widget class="QLabel" name="cache_resNumLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>resNumLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>210</y> - <width>110</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>ResNum</string> - </property> + </item> + <item row="19" column="0"> + <widget class="QLabel" name="cache_readNumLabel0"> + <property name="text"> + <string>ReadNum</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>readNumLabel0</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>240</y> - <width>110</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>ReadNum</string> - </property> + </item> + <item row="19" column="1"> + <widget class="QLabel" name="cache_readNumLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> </widget> -</widget> -<layoutdefaults spacing="6" margin="11"/> -</UI> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> +</ui> Modified: kita/trunk/kita/src/threadtabwidget.cpp =================================================================== --- kita/trunk/kita/src/threadtabwidget.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/threadtabwidget.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,107 +9,101 @@ ***************************************************************************/ #include "threadtabwidget.h" -#include "threadview.h" -#include "htmlpart.h" -#include "viewmediator.h" -#include "libkita/kita_misc.h" -#include "libkita/parsemisc.h" -#include "libkita/datmanager.h" -#include "libkita/boardmanager.h" -#include "libkita/kita-utf8.h" -#include "libkita/config_xt.h" +#include <QtGui/QApplication> +#include <QtGui/QClipboard> +#include <QtGui/QContextMenuEvent> -#include <kdebug.h> -#include <kstdaccel.h> #include <kaction.h> +#include <kactioncollection.h> #include <klocale.h> -#include <krun.h> -#include <kpopupmenu.h> +#include <kmenu.h> +#include <kstandardaction.h> +#include <kstandardshortcut.h> -#include <qapplication.h> -#include <qregexp.h> -#include <qclipboard.h> -#include <qmessagebox.h> +#include "threadview.h" +#include "viewmediator.h" +#include "libkita/datmanager.h" +#include "libkita/globalconfig.h" +#include "libkita/kita_misc.h" +using namespace Kita; -/*--------------------------------------------------------------------------------*/ - - -KitaThreadTabWidget::KitaThreadTabWidget( QWidget* parent, const char* name, WFlags f ) - : KitaTabWidgetBase( parent, name, f ) +ThreadTabWidget::ThreadTabWidget(QWidget* parent) : TabWidgetBase(parent) { - setXMLFile( "threadtabwidgetui.rc" ); + setXMLFile("threadtabwidgetui.rc"); + m_actionList = actionCollection()->actions(); + setupActions(); /* default view */ - createView( "thread" ); + createView(i18nc("@title:tab", "Thread")); } -KitaThreadTabWidget::~KitaThreadTabWidget() {} +ThreadTabWidget::~ThreadTabWidget() {} /* show "Main thread" view */ /* public slots */ -void KitaThreadTabWidget::slotShowMainThread( const KURL& url ) +void ThreadTabWidget::slotShowMainThread(const KUrl& url) { QString refstr; - KURL datURL = Kita::ParseMisc::parseURL( url, refstr ); - QString threadName = Kita::DatManager::threadName( datURL ); + KUrl datUrl = getDatUrl(url, refstr); + QString threadName = DatManager(datUrl).threadName(); int jumpNum = 0; int viewMode = VIEWMODE_MAINVIEW; - KitaThreadView* currentView = isThreadView( currentPage() ); - if ( currentView ) viewMode = currentView->getViewMode(); + ThreadView* currentView = isThreadView(currentWidget()); + if (currentView) viewMode = currentView->getViewMode(); - if ( refstr != QString::null ) { - int i = refstr.find( "-" ); - if ( i != -1 ) jumpNum = refstr.left( i ).toInt(); + if (!refstr.isEmpty()) { + int i = refstr.indexOf("-"); + if (i != -1) jumpNum = refstr.left(i).toInt(); else jumpNum = refstr.toInt(); } - KitaThreadView* view = findMainView( datURL ); + ThreadView* view = findMainView(datUrl); - if ( view ) { + if (view) { - setCurrentPage( indexOf( view ) ); + setCurrentWidget(view); - if ( view->threadURL().isEmpty() ) { + if (view->threadUrl().isEmpty()) { /* Show on the default view */ - view->showThread( datURL, jumpNum ); + view->showThread(datUrl, jumpNum); } else { /* The view is already shown */ /* TODO: jump to jumpNum after reloading */ - view->slotReloadButton( jumpNum ); + view->slotReloadButton(jumpNum); } } else { - KitaThreadView * newView = createView( threadName ); + ThreadView * newView = createView(threadName); - if ( newView ) { - newView->showThread( datURL, jumpNum ); - showPage( newView ); + if (newView) { + newView->showThread(datUrl, jumpNum); + setCurrentWidget(newView); } } - slotUpdateThreadTab( datURL ); + slotUpdateThreadTab(datUrl); } /* close "all" views which URL is url. */ /* public slot */ -void KitaThreadTabWidget::slotCloseThreadTab( const KURL& url ) +void ThreadTabWidget::slotCloseThreadTab(const KUrl& url) { int max = count(); - if ( max == 0 ) return ; - KURL datURL = Kita::ParseMisc::parseURLonly( url ); + if (max == 0) return ; + KUrl datUrl = getDatUrl(url); int i, i2; i = i2 = 0; - while ( i < max ) { - KitaThreadView * view = isThreadView( page ( i ) ); - if ( view ) { - if ( view->datURL() == datURL ) { - slotCloseTab( i2 ); + while (i < max) { + ThreadView * view = isThreadView(widget(i)); + if (view) { + if (view->datUrl() == datUrl) { + slotCloseTab(i2); i2--; } } @@ -119,90 +113,85 @@ -/* create KitaThreadView */ /* private */ -KitaThreadView* KitaThreadTabWidget::createView( QString label ) +/* create ThreadView */ /* private */ +ThreadView* ThreadTabWidget::createView(const QString& label) { - KitaThreadView * view = new KitaThreadView( this ); - if ( view ) { - addTab( view, label ); + ThreadView * view = new ThreadView(this); + if (view) { + addTab(view, label); } return view; } /* private */ -KitaThreadView* KitaThreadTabWidget::findMainView( const KURL& url ) +ThreadView* ThreadTabWidget::findMainView(const KUrl& url) { - KURL datURL = Kita::ParseMisc::parseURLonly( url ); + KUrl datUrl = getDatUrl(url); int max = count(); - if ( max == 0 ) return NULL; + if (max == 0) return 0; int i = 0; - while ( i < max ) { - KitaThreadView * view = isThreadView( page ( i ) ); - if ( view ) { - if ( view->getViewMode() == VIEWMODE_MAINVIEW ) { + while (i < max) { + ThreadView * view = isThreadView(widget(i)); + if (view) { + if (view->getViewMode() == VIEWMODE_MAINVIEW) { - if ( view->datURL() == datURL - || view->datURL().isEmpty() /* default view */ - ) return view; + if (view->datUrl() == datUrl + || view->datUrl().isEmpty() /* default view */ + ) return view; } } i++; } - return NULL; + return 0; } /* private */ -KitaThreadView* KitaThreadTabWidget::isThreadView( QWidget* w ) +ThreadView* ThreadTabWidget::isThreadView(QWidget* w) { - KitaThreadView * view = NULL; - if ( w ) { - if ( w->isA( "KitaThreadView" ) ) view = static_cast< KitaThreadView* >( w ); - } - - return view; + return qobject_cast<ThreadView*>(w); } /* private slots */ -void KitaThreadTabWidget::slotUpdateThreadTab( const KURL& url ) +void ThreadTabWidget::slotUpdateThreadTab(const KUrl& url) { - KURL datURL = Kita::ParseMisc::parseURLonly( url ); + KUrl datUrl = getDatUrl(url); - KitaThreadView * view = findMainView( datURL ); - if ( view ) { - QString threadName = Kita::DatManager::threadName( datURL ); + ThreadView * view = findMainView(datUrl); + if (view) { + QString threadName = DatManager(datUrl).threadName(); - setTabLabel( view, threadName ); - setTabToolTip( view, threadName ); + setTabText(indexOf(view), threadName); + setTabToolTip(indexOf(view), threadName); } } -void KitaThreadTabWidget::slotFontChanged() +void ThreadTabWidget::slotFontChanged() { - QFont font = Kita::Config::threadFont(); - setFont( font ); + QFont font = GlobalConfig::threadFont(); + setFont(font); } /* protected */ /* virtual */ -void KitaThreadTabWidget::deleteWidget( QWidget* w ) +void ThreadTabWidget::deleteWidget(QWidget* w) { - KitaTabWidgetBase::deleteWidget( w ); + TabWidgetBase::deleteWidget(w); - if ( count() == 0 ) { - ViewMediator::getInstance()->setMainCaption( QString::null ); - ViewMediator::getInstance()->setMainStatus( QString::null ); - ViewMediator::getInstance()->setMainURLLine( QString::null ); + if (count() == 0) { + ViewMediator::getInstance()->setMainCaption(QString()); + ViewMediator::getInstance()->setMainStatus(QString()); + ViewMediator::getInstance()->setMainUrlLine(KUrl()); /* default view */ - KitaThreadView * threadView = createView( "thread" ); + ThreadView * threadView = createView(i18nc("@title:tab", "Thread")); - if ( threadView ) { - showPage( threadView ); + if (threadView) { + setCurrentWidget(threadView); } } } @@ -210,164 +199,159 @@ /*--------------------------------*/ -/* KitaThreadView actions */ +/* ThreadView actions */ /* private */ -void KitaThreadTabWidget::setupActions() +void ThreadTabWidget::setupActions() { - KStdAction::copy( this, SLOT( slotCopyText() ), actionCollection() ); + KStandardAction::copy(this, SLOT(slotCopyText()), + actionCollection()); + KStandardAction::find(this, SLOT(slotFocusSearchCombo()), + actionCollection()); + KStandardAction::findNext(this, SLOT(slotSearchNext()), + actionCollection()); + KStandardAction::findPrev(this, SLOT(slotSearchPrev()), + actionCollection()); - new KAction( i18n( "Find" ), - "find", - KStdAccel::find(), - this, - SLOT( slotFocusSearchCombo() ), - actionCollection(), - "threadview_find" ); + KAction* gobackAction = actionCollection()->addAction("threadview_goback"); + gobackAction->setText(i18nc("@action:inmenu", "Go Back Anchor")); + gobackAction->setShortcut(Qt::Key_Backspace); + gobackAction->setIcon(SmallIcon("arrow-left-double")); + connect(gobackAction, SIGNAL(triggered()), this, SLOT(slotGobackAnchor())); - KStdAction::findNext( this, - SLOT( slotSearchNext() ), - actionCollection(), - "threadview_findnext" ); + KAction* gotoheaderAction + = actionCollection()->addAction("threadview_gotoheader"); + gotoheaderAction->setText(i18nc("@action:inmenu", "Start")); + gotoheaderAction->setShortcut(Qt::Key_Home); + gotoheaderAction->setIcon(SmallIcon("go-up")); + connect(gotoheaderAction, SIGNAL(triggered()), + this, SLOT(slotGotoHeader())); - KStdAction::findPrev( this, - SLOT( slotSearchPrev() ), - actionCollection(), - "threadview_findprev" ); + KAction* gotofooterAction + = actionCollection()->addAction("threadview_gotofooter"); + gotofooterAction->setText(i18nc("@action:inmenu", "End")); + gotofooterAction->setShortcut(Qt::Key_End); + gotofooterAction->setIcon(SmallIcon("go-down")); + connect(gotofooterAction, SIGNAL(triggered()), this, SLOT(slotGotoFooter())); - new KAction( i18n( "go back anchor" ), - "2leftarrow", - Key_Backspace, - this, - SLOT( slotGobackAnchor() ), - actionCollection(), - "threadview_goback" ); + KAction* reload_action + = actionCollection()->addAction("threadview_reload"); + reload_action->setText(i18nc("@action:button", "Reload")); + reload_action->setShortcut(KStandardShortcut::reload()); + reload_action->setIcon(SmallIcon("view-refresh")); + connect(reload_action, SIGNAL(triggered()), this, SLOT(slotReloadButton())); - new KAction( i18n( "Start" ), - "up", - Key_Home, - this, - SLOT( slotGotoHeader() ), - actionCollection(), - "threadview_gotoheader" ); + KAction* stopAction = actionCollection()->addAction("threadview_stop"); + stopAction->setText(i18nc("@action:inmenu", "Stop")); + stopAction->setShortcut(Qt::Key_Escape); + stopAction->setIcon(SmallIcon("process-stop")); + connect(stopAction, SIGNAL(triggered()), this, SLOT(slotStopLoading())); - new KAction( i18n( "End" ), - "down", - Key_End, - this, - SLOT( slotGotoFooter() ), - actionCollection(), - "threadview_gotofooter" ); - - new KAction( i18n( "Reload" ), - "reload", - KStdAccel::reload(), - this, - SLOT( slotReloadButton() ), - actionCollection(), - "threadview_reload" ); - - new KAction( i18n( "Stop" ), - "stop", - Key_Escape, - this, - SLOT( slotStopLoading() ), - actionCollection(), - "threadview_stop" ); - - new KAction( i18n( "Delete" ), - "edittrash", - Key_Delete, - this, - SLOT( slotDeleteButtonClicked() ), - actionCollection(), - "threadview_delete" ); + KAction* deleteAction = actionCollection()->addAction("threadview_delete"); + deleteAction->setText(i18nc("@action:button", "Delete")); + deleteAction->setShortcut(Qt::Key_Delete); + deleteAction->setIcon(SmallIcon("trash-empty")); + connect(deleteAction, SIGNAL(triggered()), this, SLOT(slotDeleteButtonClicked())); } -/* KitaThreadView actions */ +/* ThreadView actions */ /* copy selected text (Ctrl+C) */ /* public slot */ -void KitaThreadTabWidget::slotCopyText() +void ThreadTabWidget::slotCopyText() { - QWidget * w = currentPage(); - KitaThreadView * view = isThreadView( w ); - if ( view ) { + QWidget * w = currentWidget(); + ThreadView * view = isThreadView(w); + if (view) { QClipboard * clipboard = QApplication::clipboard(); QString text = view->selectedText(); - clipboard->setText( text, QClipboard::Clipboard ); + clipboard->setText(text, QClipboard::Clipboard); } } /* public slot */ -void KitaThreadTabWidget::slotFocusSearchCombo() +void ThreadTabWidget::slotFocusSearchCombo() { - KitaThreadView * view = isThreadView( currentPage() ); - if ( view ) view->focusSearchCombo(); + ThreadView * view = isThreadView(currentWidget()); + if (view) view->focusSearchCombo(); } /* public slot */ -void KitaThreadTabWidget::slotSearchNext() +void ThreadTabWidget::slotSearchNext() { - KitaThreadView * view = isThreadView( currentPage() ); - if ( view ) view->slotSearchNext(); + ThreadView * view = isThreadView(currentWidget()); + if (view) view->slotSearchNext(); } /* public slot */ -void KitaThreadTabWidget::slotSearchPrev() +void ThreadTabWidget::slotSearchPrev() { - KitaThreadView * view = isThreadView( currentPage() ); - if ( view ) view->slotSearchPrev(); + ThreadView * view = isThreadView(currentWidget()); + if (view) view->slotSearchPrev(); } /* public slot */ -void KitaThreadTabWidget::slotGobackAnchor() +void ThreadTabWidget::slotGobackAnchor() { - KitaThreadView * view = isThreadView( currentPage() ); - if ( view ) view->slotGobackAnchor(); + ThreadView * view = isThreadView(currentWidget()); + if (view) view->slotGobackAnchor(); } /* public slot */ -void KitaThreadTabWidget::slotGotoHeader() +void ThreadTabWidget::slotGotoHeader() { - KitaThreadView * view = isThreadView( currentPage() ); - if ( view ) view->slotGotoHeader(); + ThreadView * view = isThreadView(currentWidget()); + if (view) view->slotGotoHeader(); } /* public slot */ -void KitaThreadTabWidget::slotGotoFooter() +void ThreadTabWidget::slotGotoFooter() { - KitaThreadView * view = isThreadView( currentPage() ); - if ( view ) view->slotGotoFooter(); + ThreadView * view = isThreadView(currentWidget()); + if (view) view->slotGotoFooter(); } /* public slot */ -void KitaThreadTabWidget::slotReloadButton() +void ThreadTabWidget::slotReloadButton() { - KitaThreadView * view = isThreadView( currentPage() ); - if ( view ) view->slotReloadButton(); + ThreadView * view = isThreadView(currentWidget()); + if (view) view->slotReloadButton(); } /* public slot */ -void KitaThreadTabWidget::slotStopLoading() +void ThreadTabWidget::slotStopLoading() { - KitaThreadView * view = isThreadView( currentPage() ); - if ( view ) view->slotStopLoading(); + ThreadView * view = isThreadView(currentWidget()); + if (view) view->slotStopLoading(); } /* public slot */ -void KitaThreadTabWidget::slotDeleteButtonClicked() +void ThreadTabWidget::slotDeleteButtonClicked() { - KitaThreadView * view = isThreadView( currentPage() ); - if ( view ) view->slotDeleteButtonClicked(); + ThreadView * view = isThreadView(currentWidget()); + if (view) view->slotDeleteButtonClicked(); } + +void ThreadTabWidget::contextMenuEvent(QContextMenuEvent* e) +{ + KMenu popup; + QAction* act; + foreach (act, m_actionList) { + popup.addAction(act); + } + popup.exec(e->globalPos()); +/* KActionCollection * collection = client->actionCollection(); + KAction* action; + action = new KAction(i18n("goback anchor"), SmallIcon("idea"), KShortcut(), m_threadPart, SLOT(gobackAnchor()), collection, "goback_anchor"); + emit popupMenu(client, global, url, mimeType, mode);*/ // TODO +} Modified: kita/trunk/kita/src/threadtabwidget.h =================================================================== --- kita/trunk/kita/src/threadtabwidget.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/threadtabwidget.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,60 +7,61 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITATHREADTABWIDGET_H #define KITATHREADTABWIDGET_H #include "kitaui/tabwidgetbase.h" -class KitaThreadView; +namespace Kita { + class ThreadView; -/*-----------------------------------------------*/ + class ThreadTabWidget : public TabWidgetBase + { + Q_OBJECT + public: + explicit ThreadTabWidget(QWidget* parent = 0); + ~ThreadTabWidget(); -class KitaThreadTabWidget : public KitaTabWidgetBase -{ - Q_OBJECT + public slots: + void slotShowMainThread(const KUrl& datUrl); + void slotCloseThreadTab(const KUrl& url); + void slotUpdateThreadTab(const KUrl& url); -public: - KitaThreadTabWidget( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); - ~KitaThreadTabWidget(); + private: + ThreadView* createView(const QString& label); + ThreadView* findMainView(const KUrl& url); + ThreadView* isThreadView(QWidget* w); -public slots: - void slotShowMainThread( const KURL& datURL ); - void slotCloseThreadTab( const KURL& url ); - void slotUpdateThreadTab( const KURL& url ); + private slots: + void slotFontChanged(); -private: - KitaThreadView* createView( QString label ); - KitaThreadView* findMainView( const KURL& url ); - KitaThreadView* isThreadView( QWidget* w ); -private slots: - void slotFontChanged(); + protected: + virtual void deleteWidget(QWidget* w); -protected: - virtual void deleteWidget( QWidget* w ); + /*------------------------------------*/ + /* ThreadView actions */ + private: + void setupActions(); + void contextMenuEvent(QContextMenuEvent* e); - /*------------------------------------*/ - /* KitaThreadView actions */ + QList<QAction*> m_actionList; -private: - void setupActions(); + public slots: + void slotCopyText(); + void slotFocusSearchCombo(); + void slotSearchNext(); + void slotSearchPrev(); + void slotGobackAnchor(); + void slotGotoHeader(); + void slotGotoFooter(); + void slotReloadButton(); + void slotStopLoading(); + void slotDeleteButtonClicked(); + }; +} -public slots: - void slotCopyText(); - void slotFocusSearchCombo(); - void slotSearchNext(); - void slotSearchPrev(); - void slotGobackAnchor(); - void slotGotoHeader(); - void slotGotoFooter(); - void slotReloadButton(); - void slotStopLoading(); - void slotDeleteButtonClicked(); -}; - #endif Deleted: kita/trunk/kita/src/threadtabwidgetui.rc =================================================================== --- kita/trunk/kita/src/threadtabwidgetui.rc 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/threadtabwidgetui.rc 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,22 +0,0 @@ -<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui name="kitaThreadTabWidget" version="1"> -<MenuBar> - <Menu name="thread"><text>&Thread</text> - <Action name="tab_closetab" /> - <Separator/> - <Action name="threadview_goback" /> - <Action name="threadview_gotoheader" /> - <Action name="threadview_gotofooter" /> - <Separator/> - <Action name="threadview_reload" /> - <Action name="threadview_stop" /> - <Action name="threadview_delete" /> - <Separator/> - <Action name="threadview_find" /> - <Action name="threadview_findnext" /> - <Action name="threadview_findprev" /> - <Separator/> - <Action name="tab_configkeys" /> - </Menu> -</MenuBar> -</kpartgui> Copied: kita/trunk/kita/src/threadtabwidgetui.rc (from rev 2558, kita/branches/KITA-KDE4/kita/src/threadtabwidgetui.rc) =================================================================== --- kita/trunk/kita/src/threadtabwidgetui.rc (rev 0) +++ kita/trunk/kita/src/threadtabwidgetui.rc 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,22 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="kitaThreadTabWidget" version="1"> +<MenuBar> + <Menu name="thread"><text>Thread</text> + <Action name="tab_closetab" /> + <Separator/> + <Action name="threadview_goback" /> + <Action name="threadview_gotoheader" /> + <Action name="threadview_gotofooter" /> + <Separator/> + <Action name="threadview_reload" /> + <Action name="threadview_stop" /> + <Action name="threadview_delete" /> + <Separator/> + <Action name="threadview_find" /> + <Action name="threadview_findnext" /> + <Action name="threadview_findprev" /> + <Separator/> + <Action name="tab_configkeys" /> + </Menu> +</MenuBar> +</kpartgui> Modified: kita/trunk/kita/src/threadview.cpp =================================================================== --- kita/trunk/kita/src/threadview.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/threadview.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -11,275 +11,250 @@ #include "threadview.h" -#include <kpopupmenu.h> -#include <krun.h> -#include <kurl.h> -#include <khtmlview.h> -#include <kiconloader.h> -#include <klocale.h> +#include <QtGui/QHBoxLayout> +#include <QtGui/QToolButton> +#include <QtGui/QVBoxLayout> + #include <kaction.h> -#include <kmessagebox.h> -#include <kdebug.h> -#include <kapplication.h> -#include <ktextbrowser.h> #include <kcombobox.h> - +#include <khtmlview.h> +#include <kmessagebox.h> +#include <kurl.h> +#include <dom/html_document.h> #include <dom/html_inline.h> -#include <dom/html_base.h> -#include <dom/html_list.h> -#include <qclipboard.h> -#include <qlayout.h> -#include <qtoolbutton.h> -#include <qlabel.h> -#include <qcombobox.h> -#include <qprogressdialog.h> -#include <qcursor.h> -#include <qtextbrowser.h> -#include <qmessagebox.h> -#include <qdatetime.h> -#include <qeucjpcodec.h> -#include <qsimplerichtext.h> -#include <qpopupmenu.h> - #include "htmlpart.h" +#include "threadtabwidget.h" #include "viewmediator.h" - -#include "libkita/kita-utf8.h" -#include "libkita/qcp932codec.h" -#include "libkita/favoritethreads.h" -#include "libkita/favoriteboards.h" -#include "libkita/datmanager.h" #include "libkita/boardmanager.h" +#include "libkita/datmanager.h" +#include "libkita/favoritethreads.h" #include "libkita/kita_misc.h" -#include "libkita/config_xt.h" +#include "libkita/kita-utf8.h" -#define MAX_LABEL_LENGTH 60 +static const int MAX_LABEL_LENGTH = 60; +using namespace Kita; -KitaThreadView::KitaThreadView( KitaThreadTabWidget* parent, const char* name ) +ThreadView::ThreadView(ThreadTabWidget* parent) { m_parent = parent; /* copied from Base class */ - if ( !name ) - setName( "KitaThreadViewBase" ); - setFocusPolicy( QWidget::ClickFocus ); - KitaThreadViewBaseLayout = new QVBoxLayout( this, 0, 0, "KitaThreadViewBaseLayout"); + setFocusPolicy(Qt::ClickFocus); + threadViewBaseLayout = new QVBoxLayout(this); - layout2 = new QHBoxLayout( 0, 0, 6, "layout2"); + layout2 = new QHBoxLayout(0); + layout2->setSpacing(6); - writeButton = new QToolButton( this, "writeButton" ); - writeButton->setEnabled( FALSE ); - layout2->addWidget( writeButton ); + writeButton = new QToolButton(this); + writeButton->setEnabled(false); + layout2->addWidget(writeButton); - SearchCombo = new QComboBox( FALSE, this, "SearchCombo" ); - SearchCombo->setMinimumSize( QSize( 200, 0 ) ); - SearchCombo->setEditable( TRUE ); - SearchCombo->setSizeLimit( 10 ); - SearchCombo->setMaxCount( 15 ); - SearchCombo->setInsertionPolicy( QComboBox::AtTop ); - SearchCombo->setDuplicatesEnabled( FALSE ); - layout2->addWidget( SearchCombo ); + searchCombo = new KComboBox(this); + searchCombo->setMinimumSize(QSize(200, 0)); + searchCombo->setEditable(true); + searchCombo->setMaxVisibleItems(10); + searchCombo->setMaxCount(15); + searchCombo->setInsertPolicy(KComboBox::InsertAtTop); + searchCombo->setDuplicatesEnabled(false); + layout2->addWidget(searchCombo); - HighLightButton = new QToolButton( this, "HighLightButton" ); - HighLightButton->setToggleButton( TRUE ); - layout2->addWidget( HighLightButton ); + highLightButton = new QToolButton(this); + highLightButton->setCheckable(true); + layout2->addWidget(highLightButton); - BookmarkButton = new QToolButton( this, "BookmarkButton" ); - BookmarkButton->setEnabled( FALSE ); - BookmarkButton->setToggleButton( TRUE ); - layout2->addWidget( BookmarkButton ); + bookmarkButton = new QToolButton(this); + bookmarkButton->setEnabled(false); + bookmarkButton->setCheckable(true); + bookmarkButton->setToolTip(i18nc("@info:tooltip", "Add to bookmark")); + layout2->addWidget(bookmarkButton); - ReloadButton = new QToolButton( this, "ReloadButton" ); - ReloadButton->setEnabled( FALSE ); - layout2->addWidget( ReloadButton ); + reloadButton = new QToolButton(this); + reloadButton->setEnabled(false); + reloadButton->setToolTip(i18nc("@info:tooltip", "Reload")); + layout2->addWidget(reloadButton); - gotoCombo = new QComboBox( FALSE, this, "gotoCombo" ); - gotoCombo->setMinimumSize( QSize( 200, 0 ) ); - layout2->addWidget( gotoCombo ); + gotoCombo = new KComboBox(this); + gotoCombo->setMinimumSize(QSize(200, 0)); + layout2->addWidget(gotoCombo); - deleteButton = new QToolButton( this, "deleteButton" ); - deleteButton->setEnabled( FALSE ); - layout2->addWidget( deleteButton ); - spacer2 = new QSpacerItem( 30, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - layout2->addItem( spacer2 ); + deleteButton = new QToolButton(this); + deleteButton->setEnabled(false); + deleteButton->setToolTip(i18nc("@info:tooltip", "Delete")); + layout2->addWidget(deleteButton); + spacer2 = new QSpacerItem(30, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + layout2->addItem(spacer2); - closeButton = new QToolButton( this, "closeButton" ); - closeButton->setEnabled( FALSE ); - layout2->addWidget( closeButton ); - KitaThreadViewBaseLayout->addLayout( layout2 ); + closeButton = new QToolButton(this); + closeButton->setEnabled(false); + closeButton->setToolTip(i18nc("@info:tooltip", "Close tab")); + layout2->addWidget(closeButton); + threadViewBaseLayout->addLayout(layout2); - threadFrame = new QFrame( this, "threadFrame" ); - threadFrame->setFrameShape( QFrame::StyledPanel ); - threadFrame->setFrameShadow( QFrame::Raised ); - KitaThreadViewBaseLayout->addWidget( threadFrame ); - resize( QSize(870, 480).expandedTo(minimumSizeHint()) ); - clearWState( WState_Polished ); + threadFrame = new QFrame(this); + threadFrame->setFrameShape(QFrame::StyledPanel); + threadFrame->setFrameShadow(QFrame::Raised); + threadViewBaseLayout->addWidget(threadFrame); + resize(QSize(870, 480).expandedTo(minimumSizeHint())); + setAttribute(Qt::WA_WState_Polished); /* copy end */ - m_threadPart = new KitaHTMLPart( threadFrame ); - QHBoxLayout* aLayout = new QHBoxLayout( threadFrame ); - aLayout->addWidget( m_threadPart->view() ); + m_threadPart = new HTMLPart(threadFrame); + QHBoxLayout* aLayout = new QHBoxLayout(threadFrame); + aLayout->addWidget(m_threadPart->view()); { - HighLightButton->setPixmap( SmallIcon( "idea" ) ); - ReloadButton->setPixmap( SmallIcon( "reload" ) ); - BookmarkButton->setPixmap( SmallIcon( "bookmark_add" ) ); - writeButton->setPixmap( SmallIcon( "pencil" ) ); - deleteButton->setPixmap( SmallIcon( "edittrash" ) ); - closeButton->setPixmap( SmallIcon( "fileclose" ) ); + highLightButton->setIcon(SmallIcon("help-hint")); + reloadButton->setIcon(SmallIcon("view-refresh")); + bookmarkButton->setIcon(SmallIcon("bookmark-new")); + writeButton->setIcon(SmallIcon("draw-freehand")); + deleteButton->setIcon(SmallIcon("trash-empty")); + closeButton->setIcon(SmallIcon("tab-close")); } - setAcceptDrops( TRUE ); // DND Drop eneble: 2nd stage. - enable on "KitaThreadView" widget and disable on the others(child widgets of "KitaThreadView"). - threadFrame->setAcceptDrops( FALSE ); // don't treat Drop event on child. - m_threadPart->view() ->setAcceptDrops( FALSE ); // don't treat Drop event on child. + setAcceptDrops(true); // DND Drop eneble: 2nd stage. - enable on "ThreadView" widget and disable on the others(child widgets of "ThreadView"). + threadFrame->setAcceptDrops(false); // don't treat Drop event on child. + m_threadPart->view() ->setAcceptDrops(false); // don't treat Drop event on child. - m_threadPart->enableMetaRefresh( FALSE ); //disable <meta refresh="..."> +// m_threadPart->enableMetaRefresh(false); //disable <meta refresh="..."> // TODO - connect( deleteButton, SIGNAL( clicked() ), - SLOT( slotDeleteButtonClicked() ) ); - connect( writeButton, SIGNAL( clicked() ), - SLOT( slotWriteButtonClicked() ) ); - connect( m_threadPart, SIGNAL( finishReload() ), - SLOT( slotUpdateInfo() ) ); - connect( m_threadPart, SIGNAL( nodeActivated( const DOM::Node& ) ), - SLOT( slotDOMNodeActivated( const DOM::Node& ) ) ); - connect( m_threadPart, SIGNAL( mousePressed() ), - SLOT( setFocus() ) ); + connect(deleteButton, SIGNAL(clicked()), + SLOT(slotDeleteButtonClicked())); + connect(writeButton, SIGNAL(clicked()), + SLOT(slotWriteButtonClicked())); + connect(m_threadPart, SIGNAL(finishReload()), + SLOT(slotUpdateInfo())); + connect(m_threadPart, SIGNAL(nodeActivated(const DOM::Node&)), + SLOT(slotDOMNodeActivated(const DOM::Node&))); + connect(m_threadPart, SIGNAL(mousePressed()), + SLOT(setFocus())); - connect( BookmarkButton, SIGNAL( toggled( bool ) ), - SLOT( slotBookmarkButtonClicked( bool ) ) ); - connect( SearchCombo, SIGNAL( activated( int ) ), - SLOT( slotSearchButton() ) ); - connect( ReloadButton, SIGNAL( clicked() ), - SLOT( slotReloadButton() ) ); - connect( gotoCombo, SIGNAL( activated( int ) ), - SLOT( slotComboActivated( int ) ) ); - connect( closeButton, SIGNAL( clicked() ), - SLOT( slotCloseButton() ) ); + connect(bookmarkButton, SIGNAL(toggled(bool)), + SLOT(slotBookmarkButtonClicked(bool))); + connect(searchCombo, SIGNAL(activated(int)), + SLOT(slotSearchButton())); + connect(reloadButton, SIGNAL(clicked()), + SLOT(slotReloadButton())); + connect(gotoCombo, SIGNAL(activated(int)), + SLOT(slotComboActivated(int))); + connect(closeButton, SIGNAL(clicked()), + SLOT(slotCloseButton())); m_viewmode = VIEWMODE_MAINVIEW; m_rescode = 200; m_serverTime = 0; - m_datURL = QString::null; + m_datUrl.clear(); } -KitaThreadView::~KitaThreadView() +ThreadView::~ThreadView() { - if ( m_threadPart ) { + if (m_threadPart) { delete m_threadPart; - m_threadPart = NULL; + m_threadPart = 0; } } -const KURL KitaThreadView::threadURL() const +const KUrl ThreadView::threadUrl() const { - return Kita::getThreadURL( m_datURL ); + return getThreadUrl(m_datUrl); } -const KURL KitaThreadView::datURL() const +const KUrl ThreadView::datUrl() const { - return m_datURL; + return m_datUrl; } -void KitaThreadView::slotDOMNodeActivated( const DOM::Node& node ) +void ThreadView::slotDOMNodeActivated(const DOM::Node& node) { { //process Anchor tags. Anchor tags not proccessed here cause 'emit KParts::BrowserExtention::openURLRequest()' DOM::HTMLAnchorElement anchor = node; - if ( ! anchor.href().isEmpty() ) { - kdDebug() << "AnchorNodeActivated::" << endl; + if (! anchor.href().isEmpty()) { +// kdDebug() << "AnchorNodeActivated::" << endl; } // end: anchor.href().isEmpty() } // end of Anchor tags. } -void KitaThreadView::setSubjectLabel( const QString& boardName, const QString& threadName, const QString boardURL ) +void ThreadView::setSubjectLabel(const QString& boardName, const QString& threadName, const QString& boardUrl) { QString disp; - if ( boardName.isEmpty() ) { + if (boardName.isEmpty()) { disp = threadName; } else { - disp = QString( "<a href=\"%1\">[%2]</a> %3" ).arg( boardURL ).arg( boardName ).arg( threadName ); + disp = QString("<a href=\"%1\">[%2]</a> %3").arg(boardUrl).arg(boardName).arg(threadName); } - //disp.truncate( MAX_LABEL_LENGTH ); + //disp.truncate(MAX_LABEL_LENGTH); } -void KitaThreadView::updateButton() +void ThreadView::updateButton() { - writeButton->setEnabled( TRUE ); - BookmarkButton->setEnabled( TRUE ); - ReloadButton->setEnabled( TRUE ); - deleteButton->setEnabled( TRUE ); - closeButton->setEnabled( TRUE ); + writeButton->setEnabled(true); + bookmarkButton->setEnabled(true); + reloadButton->setEnabled(true); + deleteButton->setEnabled(true); + closeButton->setEnabled(true); - if ( HighLightButton->isOn() ) { - HighLightButton->toggle(); + if (highLightButton->isChecked()) { + highLightButton->toggle(); } - // don't emit SIGNAL( toggled() ) - disconnect( BookmarkButton, SIGNAL( toggled( bool ) ), this, SLOT( slotBookmarkButtonClicked( bool ) ) ); - if ( FavoriteThreads::getInstance() ->contains( m_datURL.prettyURL() ) ) { - BookmarkButton->setOn( TRUE ); + // don't emit SIGNAL(toggled()) + disconnect(bookmarkButton, SIGNAL(toggled(bool)), this, SLOT(slotBookmarkButtonClicked(bool))); + if (FavoriteThreads::getInstance() ->contains(m_datUrl.prettyUrl())) { + bookmarkButton->setChecked(true); } else { - BookmarkButton->setOn( FALSE ); + bookmarkButton->setChecked(false); } - connect( BookmarkButton, SIGNAL( toggled( bool ) ), SLOT( slotBookmarkButtonClicked( bool ) ) ); + connect(bookmarkButton, SIGNAL(toggled(bool)), SLOT(slotBookmarkButtonClicked(bool))); } /*--------------------*/ /* write response */ /*--------------------*/ /* private slots */ -void KitaThreadView::slotWriteButtonClicked( QString resStr ) +void ThreadView::slotWriteButtonClicked(const QString& resStr) { - ViewMediator::getInstance()->showWriteView( m_datURL, resStr ); + ViewMediator::getInstance()->showWriteView(m_datUrl, resStr); } -void KitaThreadView::insertSearchCombo() +void ThreadView::insertSearchCombo() { - for ( int count = 0; count < SearchCombo->count(); ++count ) { - if ( SearchCombo->text( count ) == SearchCombo->currentText() ) { + for (int count = 0; count < searchCombo->count(); ++count) { + if (searchCombo->itemText(count) == searchCombo->currentText()) { // found return ; } } - SearchCombo->insertItem( SearchCombo->currentText() ); + searchCombo->addItem(searchCombo->currentText()); } -void KitaThreadView::slotPopupMenu( KXMLGUIClient* client, const QPoint& global, const KURL& url, const QString& mimeType, mode_t mode ) -{ - KActionCollection * collection = client->actionCollection(); - KAction* action; - action = new KAction( i18n( "goback anchor" ), SmallIcon( "idea" ), KShortcut(), m_threadPart, SLOT( gobackAnchor() ), collection, "goback_anchor" ); - emit popupMenu( client, global, url, mimeType, mode ); -} -void KitaThreadView::setFont( const QFont& font ) +void ThreadView::setFont(const QFont& font) { // m_threadPart->setStandardFont(font.family()); - SearchCombo->setFont( font ); + searchCombo->setFont(font); DOM::CSSStyleDeclaration style = m_threadPart->htmlDocument().body().style(); - style.setProperty( "font-family", font.family(), "" ); - style.setProperty( "font-size", QString( "%1pt" ).arg( font.pointSize() ), "" ); + style.setProperty("font-family", font.family(), ""); + style.setProperty("font-size", QString("%1pt").arg(font.pointSize()), ""); } -void KitaThreadView::slotBookmarkButtonClicked( bool on ) +void ThreadView::slotBookmarkButtonClicked(bool on) { - ViewMediator::getInstance()->bookmark( m_datURL.prettyURL(), on ); + ViewMediator::getInstance()->bookmark(m_datUrl.prettyUrl(), on); } -void KitaThreadView::focusSearchCombo() +void ThreadView::focusSearchCombo() { - if ( ! SearchCombo->hasFocus() ) { - SearchCombo->setFocus(); + if (! searchCombo->hasFocus()) { + searchCombo->setFocus(); } else { setFocus(); } @@ -287,10 +262,10 @@ /* public slot */ /* virtual */ -void KitaThreadView::setFocus() +void ThreadView::setFocus() { - ViewMediator::getInstance()->changeWriteTab( m_datURL ); - showStatusBar( QString::null ); + ViewMediator::getInstance()->changeWriteTab(m_datUrl); + showStatusBar(QString()); m_threadPart->view() ->setFocus(); } @@ -302,48 +277,48 @@ /*-------*/ /* setup */ /*-------*/ -void KitaThreadView::setup( const KURL& datURL, int mode ) +void ThreadView::setup(const KUrl& datUrl, int mode) { /* config. */ /*---------------------------------------*/ /* setup */ - m_datURL = Kita::getDatURL( datURL ); + m_datUrl = getDatUrl(datUrl); /* setup HTMLPart */ int partMode = HTMLPART_MODE_MAINPART; - m_threadPart->setup( partMode, m_datURL ); + m_threadPart->setup(partMode, m_datUrl); - /* mode. Mode is defined in kitathreadview.h */ + /* mode. Mode is defined in threadview.h */ m_viewmode = mode; /* reset search direction */ - m_revsearch = FALSE; + m_revsearch = false; } /*--------------------------------------------------------*/ /* Show thread */ -/* This function is called from KitaThreadTabWidget class */ +/* This function is called from ThreadTabWidget class */ /*--------------------------------------------------------*/ -void KitaThreadView::showThread( const KURL& datURL, int num ) +void ThreadView::showThread(const KUrl& datUrl, int num) { /* If this widget is not parent, then do nothing. */ - if ( m_viewmode != VIEWMODE_MAINVIEW ) return ; + if (m_viewmode != VIEWMODE_MAINVIEW) return ; - if ( num == 0 ) num = Kita::DatManager::getViewPos( datURL ); + if (num == 0) num = DatManager(datUrl).getViewPos(); - if ( topLevelWidget() ->isMinimized() ) topLevelWidget() ->showNormal(); + if (topLevelWidget() ->isMinimized()) topLevelWidget() ->showNormal(); topLevelWidget() ->raise(); - setActiveWindow(); + activateWindow(); /* setup */ - setup( datURL, VIEWMODE_MAINVIEW ); + setup(datUrl, VIEWMODE_MAINVIEW); /* get log from cahce */ m_rescode = 200; - if ( !m_threadPart->load( num ) ) showStatusBar( "" ); + if (!m_threadPart->load(num)) showStatusBar(""); /* update data */ slotUpdateInfo(); @@ -355,70 +330,74 @@ /*---------*/ /* reload */ /*---------*/ /* public slot */ -void KitaThreadView::slotReloadButton( int jumpNum ) +void ThreadView::slotReloadButton(int jumpNum) { topLevelWidget() ->raise(); - setActiveWindow(); + activateWindow(); - if ( m_threadPart->reload( jumpNum ) ) { - showStatusBar( Kita::utf8ToUnicode( KITAUTF8_NOWRENEW ) ); + if (m_threadPart->reload(jumpNum)) { + showStatusBar(QString::fromUtf8(KITAUTF8_NOWRENEW)); } } /*-----------------------------------*/ /* stop loading the thread */ /* public slot */ -void KitaThreadView::slotStopLoading() +void ThreadView::slotStopLoading() { /* hide popup */ - if ( m_threadPart->isPopupVisible() ) { + if (m_threadPart->isPopupVisible()) { m_threadPart->slotDeletePopup(); return ; } /* unforcus search combo */ - if ( SearchCombo->hasFocus() ) { + if (searchCombo->hasFocus()) { setFocus(); return ; } - Kita::DatManager::stopLoading( m_datURL ); + DatManager(m_datUrl).stopLoading(); } /*-----------------------------------------*/ /* show the information at the statusbar. */ /*-----------------------------------------*/ -void KitaThreadView::showStatusBar( QString info ) +void ThreadView::showStatusBar(const QString &information) { - if ( m_datURL.isEmpty() ) return ; - QString captionStr = QString::null; - QString infostr = QString::null; - QString errstr = QString::null; - int viewPos = Kita::DatManager::getViewPos( m_datURL ); - int resNum = Kita::DatManager::getResNum( m_datURL ); - bool broken = Kita::DatManager::isBroken( m_datURL ); - int datSize = Kita::DatManager::getDatSize( m_datURL ); + if (m_datUrl.isEmpty()) return ; + QString info = information; + QString captionStr; + QString infostr; + QString errstr; + DatManager datManager(m_datUrl); + int viewPos = datManager.getViewPos(); + int resNum = datManager.getResNum(); + bool broken = datManager.isBroken(); + int datSize = datManager.getDatSize(); - switch ( m_viewmode ) { + switch (m_viewmode) { case VIEWMODE_MAINVIEW: - errstr = QString::null; - if ( m_rescode != 200 && m_rescode != 206 && m_rescode != 0 ) - errstr = QString( "Error %1" ).arg( m_rescode ); - if ( broken ) info += " This thread is broken."; + errstr.clear(); + if (m_rescode != 200 && m_rescode != 206 && m_rescode != 0) + errstr = QString("Error %1").arg(m_rescode); + if (broken) + info += " " + i18nc("@info:status", "This thread is broken."); /* show status bar,caption, url */ - infostr = Kita::DatManager::threadName( m_datURL ) + - QString( " [Total: %1 New: %2] %3 k" ).arg( resNum ).arg( resNum - viewPos ).arg( datSize / 1024 ) - + info + " " + errstr; + infostr = datManager.threadName() + + QString(" [Total: %1 New: %2] %3 k").arg(resNum) + .arg(resNum - viewPos).arg(datSize / 1024) + + info + ' ' + errstr; - captionStr = Kita::DatManager::threadName( m_datURL ) + QString( " (%1)" ).arg( viewPos ); + captionStr = datManager.threadName() + QString(" (%1)").arg(viewPos); - ViewMediator::getInstance()->setMainCaption( captionStr ); - ViewMediator::getInstance()->setMainStatus( infostr ); - ViewMediator::getInstance()->setMainURLLine( Kita::getThreadURL( m_datURL ) ); + ViewMediator::getInstance()->setMainCaption(captionStr); + ViewMediator::getInstance()->setMainStatus(infostr); + ViewMediator::getInstance()->setMainUrlLine(getThreadUrl(m_datUrl)); return ; break; @@ -434,34 +413,35 @@ /*--------------------*/ /* update information */ /* public */ -void KitaThreadView::slotUpdateInfo() +void ThreadView::slotUpdateInfo() { - m_rescode = Kita::DatManager::getResponseCode( m_datURL ); - m_serverTime = Kita::DatManager::getServerTime( m_datURL ); + DatManager datManager(m_datUrl); + m_rescode = datManager.getResponseCode(); + m_serverTime = datManager.getServerTime(); - /* uptate informations */ - setSubjectLabel( Kita::BoardManager::boardName( m_datURL ), - Kita::DatManager::threadName( m_datURL ) - + QString( " (%1)" ) - .arg( Kita::DatManager::getReadNum( m_datURL ) ), - Kita::BoardManager::boardURL( m_datURL ) ); + /* uptate information */ + setSubjectLabel(BoardManager::boardName(m_datUrl), + datManager.threadName() + + QString(" (%1)") + .arg(datManager.getReadNum()), + BoardManager::boardUrl(m_datUrl)); updateButton(); gotoCombo->clear(); - gotoCombo->insertItem( Kita::utf8ToUnicode( KITAUTF8_GOTO ) ); - gotoCombo->insertItem( Kita::utf8ToUnicode( KITAUTF8_KOKOYON ) ); - for ( int i = 1; i < Kita::DatManager::getReadNum( m_datURL ); i += 100 ) { - gotoCombo->insertItem( QString().setNum( i ) + "-" ); + gotoCombo->addItem(QString::fromUtf8(KITAUTF8_GOTO)); + gotoCombo->addItem(QString::fromUtf8(KITAUTF8_KOKOYON)); + for (int i = 1; i < datManager.getReadNum(); i += 100) { + gotoCombo->addItem(QString::number(i) + '-'); } - gotoCombo->insertItem( Kita::utf8ToUnicode( KITAUTF8_SAIGO ) ); + gotoCombo->addItem(QString::fromUtf8(KITAUTF8_SAIGO)); gotoCombo->adjustSize(); - ViewMediator::getInstance()->updateBoardView( m_datURL ); - ViewMediator::getInstance()->updateThreadView( m_datURL ); + ViewMediator::getInstance()->updateBoardView(m_datUrl); + ViewMediator::getInstance()->updateThreadView(m_datUrl); - showStatusBar( "" ); + showStatusBar(""); - emit showThreadCompleted(); /* to KitaThreadPart */ + emit showThreadCompleted(); /* to ThreadPart */ } @@ -470,124 +450,125 @@ /*------------------------*/ /* search function */ /*------------------------*/ /* private slots */ -void KitaThreadView::slotSearchButton() +void ThreadView::slotSearchButton() { - if ( m_datURL.isEmpty() ) return ; /* Nothing is shown on the screen.*/ + if (m_datUrl.isEmpty()) return ; /* Nothing is shown on the screen.*/ - QString str = SearchCombo->currentText(); - if ( str.at( 0 ) == ':' ) { + QString str = searchCombo->currentText(); + if (str.at(0) == ':') { /* show res popup */ - if ( str.at( 1 ) == 'p' ) { - int refNum = str.mid( 2 ).toInt(); - QPoint pos = mapToGlobal( SearchCombo->pos() ); - pos.setY( pos.y() + SearchCombo->height() / 2 ); - m_threadPart->slotShowResPopup( pos , refNum, refNum ); + if (str.at(1) == 'p') { + int refNum = str.mid(2).toInt(); + QPoint pos = mapToGlobal(searchCombo->pos()); + pos.setY(pos.y() + searchCombo->height() / 2); + m_threadPart->slotShowResPopup(pos , refNum, refNum); return ; } /* find by find dialog */ - else if ( str.at( 1 ) == 'f' ) { - KAction * act = static_cast< KAction* >( m_threadPart->action( "find" ) ); - if ( act ) act->activate(); + else if (str.at(1) == 'f') { + KAction * act = static_cast< KAction* >(m_threadPart->action("find")); + if (act) act->trigger(); return ; } /* jump */ - QString anc = str.mid( 1 ); - m_threadPart->gotoAnchor( anc, FALSE ); - SearchCombo->setFocus(); + QString anc = str.mid(1); + m_threadPart->gotoAnchor(anc, false); + searchCombo->setFocus(); return ; } - slotSearchPrivate( FALSE ); + slotSearchPrivate(false); } /* public slot */ -void KitaThreadView::slotSearchNext() { slotSearchPrivate( FALSE ); } -void KitaThreadView::slotSearchPrev() { slotSearchPrivate( TRUE ); } +void ThreadView::slotSearchNext() { slotSearchPrivate(false); } +void ThreadView::slotSearchPrev() { slotSearchPrivate(true); } /* private */ -void KitaThreadView::slotSearchPrivate( bool rev ) +void ThreadView::slotSearchPrivate(bool rev) { - if ( m_datURL.isEmpty() ) return ; /* Nothing is shown on the screen.*/ + if (m_datUrl.isEmpty()) return ; /* Nothing is shown on the screen.*/ /* jump */ - QString str = SearchCombo->currentText(); - if ( str == QString::null ) return ; - if ( str == "" ) return ; - if ( str.at( 0 ) == ':' ) return ; - if ( str.at( 0 ) == '?' ) return ; + QString str = searchCombo->currentText(); + if (str.isEmpty()) return ; + if (str.isEmpty()) return ; + if (str.at(0) == ':') return ; + if (str.at(0) == '?') return ; QStringList query; - query += SearchCombo->currentText(); - int ResNum = Kita::DatManager::getResNum( m_datURL ); - for ( int i = 1; i <= ResNum; i++ ) { + query += searchCombo->currentText(); + DatManager datManager(m_datUrl); + int ResNum = datManager.getResNum(); + for (int i = 1; i <= ResNum; i++) { - if ( Kita::DatManager::checkWord( m_datURL, query, i, FALSE ) ) { + if (datManager.checkWord(query, i, false)) { /* if this is parent, then show all responses, and search */ - if ( m_viewmode == VIEWMODE_MAINVIEW ) m_threadPart->showAll(); + if (m_viewmode == VIEWMODE_MAINVIEW) m_threadPart->showAll(); insertSearchCombo(); - QStringList list = Kita::parseSearchQuery( SearchCombo->currentText() ); - m_threadPart->findText( SearchCombo->currentText(), rev ); - SearchCombo->setFocus(); + QStringList list = parseSearchQuery(searchCombo->currentText()); + m_threadPart->findText(searchCombo->currentText(), rev); + searchCombo->setFocus(); return ; } } - QMessageBox::information( this, i18n( "kita" ), i18n( "Not Found" ) ); + KMessageBox::information(this, i18n("Not Found"), i18n("kita")); } /* public slot */ -void KitaThreadView::slotGobackAnchor() { m_threadPart->slotGobackAnchor(); } -void KitaThreadView::slotGotoHeader() { m_threadPart->gotoAnchor( "header", FALSE );} -void KitaThreadView::slotGotoFooter() { m_threadPart->slotClickGotoFooter(); } +void ThreadView::slotGobackAnchor() { m_threadPart->slotGobackAnchor(); } +void ThreadView::slotGotoHeader() { m_threadPart->gotoAnchor("header", false);} +void ThreadView::slotGotoFooter() { m_threadPart->slotClickGotoFooter(); } // vim:sw=2: -void KitaThreadView::slotComboActivated( int index ) +void ThreadView::slotComboActivated(int index) { - if ( index == gotoCombo->count() - 1 ) { + if (index == gotoCombo->count() - 1) { // last - m_threadPart->gotoAnchor( "footer", FALSE ); - } else if ( index == 1 ) { + m_threadPart->gotoAnchor("footer", false); + } else if (index == 1) { // kokomade yonda - m_threadPart->gotoAnchor( "kokomade_yonda", FALSE ); - } else if ( index != 0 ) { - QString numText = gotoCombo->text( index ); - numText.truncate( numText.length() - 1 ); - m_threadPart->gotoAnchor( numText, FALSE ); + m_threadPart->gotoAnchor("kokomade_yonda", false); + } else if (index != 0) { + QString numText = gotoCombo->itemText(index); + numText.truncate(numText.length() - 1); + m_threadPart->gotoAnchor(numText, false); } } -void KitaThreadView::slotDeleteButtonClicked() +void ThreadView::slotDeleteButtonClicked() { - if ( m_datURL.isEmpty() ) return ; + if (m_datUrl.isEmpty()) + return; - int rescode = Kita::DatManager::getResponseCode( m_datURL ); - if ( ( rescode != 200 && rescode != 206 ) - || FavoriteThreads::getInstance() ->contains( m_datURL.prettyURL() ) ) { - if ( QMessageBox::warning( this, - "Kita", - i18n( "Do you want to delete Log ?" ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - != QMessageBox::Ok ) return ; + DatManager datManager(m_datUrl); + int rescode = datManager.getResponseCode(); + if ((rescode != 200 && rescode != 206) + || FavoriteThreads::getInstance()->contains(m_datUrl.prettyUrl())) { + if (KMessageBox::warningYesNo(this, i18n("Do you want to delete Log?"), + "Kita") != KMessageBox::Ok) + return; } - if ( Kita::DatManager::deleteCache( m_datURL ) ) { - m_parent->slotCloseThreadTab( m_datURL ); - ViewMediator::getInstance()->updateBoardView( m_datURL ); + if (datManager.deleteCache()) { + m_parent->slotCloseThreadTab(m_datUrl); + ViewMediator::getInstance()->updateBoardView(m_datUrl); } } -void KitaThreadView::slotCloseButton() +void ThreadView::slotCloseButton() { m_parent->slotCloseCurrentTab(); } -const QString KitaThreadView::selectedText() const +const QString ThreadView::selectedText() const { return m_threadPart->selectedText(); } Modified: kita/trunk/kita/src/threadview.h =================================================================== --- kita/trunk/kita/src/threadview.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/threadview.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,32 +7,23 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#ifndef KITATHREADVIEW_H +#define KITATHREADVIEW_H -#ifndef _KITATHREADVIEW_H_ -#define _KITATHREADVIEW_H_ +#include <QtGui/QWidget> -#include <kparts/browserextension.h> +#include <kurl.h> #include <dom/html_base.h> -#include <ktextbrowser.h> - -class KURL; -class KitaHTMLPart; +class QFrame; +class QHBoxLayout; +class QSpacerItem; class QToolButton; -class QSpacerItem; -class QComboBox; class QVBoxLayout; -class QHBoxLayout; -class KitaThreadTabWidget; -#include <qvaluestack.h> // for gcc-2.9x -template <class T> class QValueStack; +class KComboBox; +class KXMLGUIClient; -namespace Kita -{ - class KitaSubjectLabel; -} - /* mode , m_viewmode uses them. */ enum { VIEWMODE_MAINVIEW, @@ -43,84 +34,94 @@ class Job; } -/** - * - * @author Hideki Ikemoto <ikemo****@users*****> - **/ - -class KitaThreadView : public QWidget +namespace Kita { - Q_OBJECT + class HTMLPart; + class ThreadTabWidget; + class SubjectLabel; + + /** + * + * @author Hideki Ikemoto <ikemo****@users*****> + **/ - KitaThreadTabWidget* m_parent; + class ThreadView : public QWidget + { + Q_OBJECT -public: - KitaThreadView( KitaThreadTabWidget* parent, const char* name = 0 ); - ~KitaThreadView(); - const KURL threadURL() const; - const KURL datURL() const; - const QString selectedText() const; + ThreadTabWidget* m_parent; - void setup( const KURL& datURL, int mode ); - void showStatusBar( QString info ); - int getViewMode() { return m_viewmode; } + public: + ThreadView(ThreadTabWidget* parent); + ~ThreadView(); + const KUrl threadUrl() const; + const KUrl datUrl() const; + const QString selectedText() const; -public slots: - virtual void setFocus(); + void setup(const KUrl& datUrl, int mode); + void showStatusBar(const QString& information); + int getViewMode() { return m_viewmode; } - void showThread( const KURL& datURL, int num ); - void setFont( const QFont& font ); - void slotReloadButton( int jumpNum = 0 ); - void slotStopLoading(); - void focusSearchCombo(); - void slotDeleteButtonClicked(); - void slotSearchNext(); - void slotSearchPrev(); - void slotGobackAnchor(); - void slotGotoHeader(); - void slotGotoFooter(); + public slots: + virtual void setFocus(); -protected slots: - void slotDOMNodeActivated( const DOM::Node& node ); - void slotPopupMenu( KXMLGUIClient*, const QPoint&, const KURL&, const QString&, mode_t ); + void showThread(const KUrl& datUrl, int num); + void setFont(const QFont& font); + void slotReloadButton(int jumpNum = 0); + void slotStopLoading(); + void focusSearchCombo(); + void slotDeleteButtonClicked(); + void slotSearchNext(); + void slotSearchPrev(); + void slotGobackAnchor(); + void slotGotoHeader(); + void slotGotoFooter(); -private: - int m_serverTime; - KURL m_datURL; - KitaHTMLPart* m_threadPart; + protected slots: + void slotDOMNodeActivated(const DOM::Node& node); - bool m_revsearch; - int m_viewmode; - int m_rescode; + private: + void insertSearchCombo(); + void setSubjectLabel(const QString& boardName, + const QString& threadName, const QString& boardUrl); + void updateButton(); - void insertSearchCombo(); - void setSubjectLabel( const QString& boardName, const QString& threadName, const QString boardURL ); - void updateButton(); - QToolButton* writeButton; - QComboBox* SearchCombo; - QToolButton* HighLightButton; - QToolButton* BookmarkButton; - QToolButton* ReloadButton; - QComboBox* gotoCombo; - QToolButton* deleteButton; - QToolButton* closeButton; - QFrame* threadFrame; - QVBoxLayout* KitaThreadViewBaseLayout; - QHBoxLayout* layout2; - QSpacerItem* spacer2; + ThreadView(const ThreadView&); + ThreadView& operator=(const ThreadView&); -private slots: - void slotSearchButton(); - void slotBookmarkButtonClicked( bool on ); - void slotWriteButtonClicked( QString resstr = QString::null ); - void slotComboActivated( int index ); - void slotUpdateInfo(); - void slotSearchPrivate( bool rev ); - void slotCloseButton(); + int m_serverTime; + KUrl m_datUrl; + HTMLPart* m_threadPart; -signals: - void popupMenu( KXMLGUIClient*, const QPoint&, const KURL&, const QString&, mode_t ); - void showThreadCompleted(); /* to KitaThreadPart */ -}; + bool m_revsearch; + int m_viewmode; + int m_rescode; + QToolButton* writeButton; + KComboBox* searchCombo; + QToolButton* highLightButton; + QToolButton* bookmarkButton; + QToolButton* reloadButton; + KComboBox* gotoCombo; + QToolButton* deleteButton; + QToolButton* closeButton; + QFrame* threadFrame; + QVBoxLayout* threadViewBaseLayout; + QHBoxLayout* layout2; + QSpacerItem* spacer2; + + private slots: + void slotSearchButton(); + void slotBookmarkButtonClicked(bool on); + void slotWriteButtonClicked(const QString& resstr = QString()); + void slotComboActivated(int index); + void slotUpdateInfo(); + void slotSearchPrivate(bool rev); + void slotCloseButton(); + + signals: + void showThreadCompleted(); /* to ThreadPart */ + }; +} + #endif Modified: kita/trunk/kita/src/viewmediator.cpp =================================================================== --- kita/trunk/kita/src/viewmediator.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/viewmediator.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -9,10 +9,17 @@ ***************************************************************************/ #include "viewmediator.h" +#include <krun.h> +#include <kio/netaccess.h> + +#include "boardtabwidget.h" +#include "favoritelistview.h" +#include "mainwindow.h" +#include "threadtabwidget.h" +#include "writetabwidget.h" #include "libkita/datmanager.h" -#include <kio/netaccess.h> -#include <krun.h> +using namespace Kita; ViewMediator* ViewMediator::instance = 0; @@ -26,115 +33,115 @@ ViewMediator* ViewMediator::getInstance() { - if( instance == 0 ) { + if(instance == 0) { instance = new ViewMediator(); } return instance; } -void ViewMediator::closeThreadTab( const KURL& url ) +void ViewMediator::closeThreadTab(const KUrl& url) { - Q_ASSERT( m_threadTabWidget ); + Q_ASSERT(m_threadTabWidget); - m_threadTabWidget->slotCloseThreadTab( url ); + m_threadTabWidget->slotCloseThreadTab(url); } -void ViewMediator::showWriteView( const KURL& url, const QString& resStr ) +void ViewMediator::showWriteView(const KUrl& url, const QString& resStr) { - Q_ASSERT( m_writeTabWidget ); + Q_ASSERT(m_writeTabWidget); - m_writeTabWidget->resize( 500, 400 ); + m_writeTabWidget->resize(500, 400); m_writeTabWidget->show(); - m_writeTabWidget->slotShowWriteView( url, resStr ); + m_writeTabWidget->slotShowWriteView(url, resStr); } -void ViewMediator::openBoard( const KURL& url ) +void ViewMediator::openBoard(const KUrl& url) { - Q_ASSERT( m_boardTabWidget ); + Q_ASSERT(m_boardTabWidget); - m_boardTabWidget->loadBoard( url ); + m_boardTabWidget->loadBoard(url); } -void ViewMediator::openThread( const KURL& url ) +void ViewMediator::openThread(const KUrl& url) { - Q_ASSERT( m_threadTabWidget ); + Q_ASSERT(m_threadTabWidget); - m_threadTabWidget->slotShowMainThread( url ); + m_threadTabWidget->slotShowMainThread(url); } -void ViewMediator::setMainStatus( const QString& statusStr ) +void ViewMediator::setMainStatus(const QString& statusStr) { - Q_ASSERT( m_mainWindow ); + Q_ASSERT(m_mainWindow); - m_mainWindow->setMainStatus( statusStr ); + m_mainWindow->setMainStatus(statusStr); } -void ViewMediator::setMainURLLine( const KURL& url ) +void ViewMediator::setMainUrlLine(const KUrl& url) { - Q_ASSERT( m_mainWindow ); + Q_ASSERT(m_mainWindow); - m_mainWindow->setUrl( url ); + m_mainWindow->setUrl(url); } -void ViewMediator::setMainCaption( const QString& str ) +void ViewMediator::setMainCaption(const QString& str) { - Q_ASSERT( m_mainWindow ); + Q_ASSERT(m_mainWindow); - m_mainWindow->setCaption( str ); + m_mainWindow->setCaption(str); } -void ViewMediator::bookmark( const QString& datURL, bool on ) +void ViewMediator::bookmark(const QString& datUrl, bool on) { - Q_ASSERT( m_mainWindow ); + Q_ASSERT(m_mainWindow); - m_mainWindow->bookmark( datURL, on ); + m_mainWindow->bookmark(datUrl, on); } -bool ViewMediator::isKitaActive() +bool ViewMediator::isActive() { - Q_ASSERT( m_mainWindow ); + Q_ASSERT(m_mainWindow); - if( m_mainWindow->isActiveWindow() ) return TRUE; + if(m_mainWindow->isActiveWindow()) return true; - return FALSE; + return false; } -void ViewMediator::updateBoardView( const KURL& datURL ) +void ViewMediator::updateBoardView(const KUrl& datUrl) { - Q_ASSERT( m_boardTabWidget ); + Q_ASSERT(m_boardTabWidget); - m_boardTabWidget->updateBoardView( datURL ); + m_boardTabWidget->updateBoardView(datUrl); } -void ViewMediator::updateThreadView( const KURL& datURL ) +void ViewMediator::updateThreadView(const KUrl& datUrl) { - Q_ASSERT( m_threadTabWidget ); + Q_ASSERT(m_threadTabWidget); - m_threadTabWidget->slotUpdateThreadTab( datURL ); + m_threadTabWidget->slotUpdateThreadTab(datUrl); } -void ViewMediator::changeWriteTab( const KURL& datURL ) +void ViewMediator::changeWriteTab(const KUrl& datUrl) { - Q_ASSERT( m_writeTabWidget ); + Q_ASSERT(m_writeTabWidget); - m_writeTabWidget->slotChangeWriteTab( datURL ); + m_writeTabWidget->slotChangeWriteTab(datUrl); } void ViewMediator::updateFavoriteListView() { - Q_ASSERT( m_favoriteListView ); + Q_ASSERT(m_favoriteListView); m_favoriteListView->refresh(); } -void ViewMediator::openURL( const KURL& url ) +void ViewMediator::openUrl(const KUrl& url) { // open thread. - if ( Kita::DatManager::isThreadEnrolled( url ) ) { - m_threadTabWidget->slotShowMainThread( url ); + if (DatManager(url).isThreadEnrolled()) { + m_threadTabWidget->slotShowMainThread(url); return; } - QString mimetype = KIO::NetAccess::mimetype( url , m_threadTabWidget ); - KRun::runURL( url, mimetype ); + QString mimetype = KIO::NetAccess::mimetype(url , m_threadTabWidget); + KRun::runUrl(url, mimetype, 0); } Modified: kita/trunk/kita/src/viewmediator.h =================================================================== --- kita/trunk/kita/src/viewmediator.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/viewmediator.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,52 +7,67 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ -#ifndef VIEWMEDIATOR_H -#define VIEWMEDIATOR_H +#ifndef KITAVIEWMEDIATOR_H +#define KITAVIEWMEDIATOR_H -#include "threadtabwidget.h" -#include "writetabwidget.h" -#include "boardtabwidget.h" -#include "bbstabwidget.h" -#include "mainwindow.h" +class QString; -/** - * @author Hideki Ikemoto <ikemo****@wakab*****> - */ -class ViewMediator { - static ViewMediator* instance; - KitaThreadTabWidget* m_threadTabWidget; - KitaBoardTabWidget* m_boardTabWidget; - KitaWriteTabWidget* m_writeTabWidget; - KitaMainWindow* m_mainWindow; - FavoriteListView* m_favoriteListView; +class KUrl; - ViewMediator(); - ~ViewMediator(); +namespace Kita { + class BoardTabWidget; + class MainWindow; + class ThreadTabWidget; + class WriteTabWidget; + class FavoriteListView; -public: - static ViewMediator* getInstance(); + /** + * @author Hideki Ikemoto <ikemo****@wakab*****> + */ + class ViewMediator { + static ViewMediator* instance; + ThreadTabWidget* m_threadTabWidget; + BoardTabWidget* m_boardTabWidget; + WriteTabWidget* m_writeTabWidget; + MainWindow* m_mainWindow; + FavoriteListView* m_favoriteListView; - void setThreadTabWidget( KitaThreadTabWidget* threadTabWidget ) { m_threadTabWidget = threadTabWidget; } - void setBoardTabWidget( KitaBoardTabWidget* boardTabWidget ) { m_boardTabWidget = boardTabWidget; } - void setWriteTabWidget( KitaWriteTabWidget* writeTabWidget ) { m_writeTabWidget = writeTabWidget; } - void setMainWindow( KitaMainWindow* mainWindow ) { m_mainWindow = mainWindow; } - void setFavoriteListView( FavoriteListView* favoriteListView ) { m_favoriteListView = favoriteListView; } + ViewMediator(); + ~ViewMediator(); - void closeThreadTab( const KURL& url ); - void showWriteView( const KURL& url, const QString& resStr ); - void openBoard( const KURL& url ); - void openThread( const KURL& url ); - void setMainStatus( const QString& statusStr ); - void setMainURLLine( const KURL& url ); - void setMainCaption( const QString& str ); - void bookmark( const QString& datURL, bool on ); - bool isKitaActive(); - void updateBoardView( const KURL& datURL ); - void updateThreadView( const KURL& datURL ); - void changeWriteTab( const KURL& datURL ); - void updateFavoriteListView(); - void openURL( const KURL& url ); -}; + public: + static ViewMediator* getInstance(); + void setThreadTabWidget(ThreadTabWidget* threadTabWidget) + { m_threadTabWidget = threadTabWidget; } + void setBoardTabWidget(BoardTabWidget* boardTabWidget) + { m_boardTabWidget = boardTabWidget; } + void setWriteTabWidget(WriteTabWidget* writeTabWidget) + { m_writeTabWidget = writeTabWidget; } + void setMainWindow(MainWindow* mainWindow) + { m_mainWindow = mainWindow; } + void setFavoriteListView(FavoriteListView* favoriteListView) + { m_favoriteListView = favoriteListView; } + + void closeThreadTab(const KUrl& url); + void showWriteView(const KUrl& url, const QString& resStr); + void openBoard(const KUrl& url); + void openThread(const KUrl& url); + void setMainStatus(const QString& statusStr); + void setMainUrlLine(const KUrl& url); + void setMainCaption(const QString& str); + void bookmark(const QString& datUrl, bool on); + bool isActive(); + void updateBoardView(const KUrl& datUrl); + void updateThreadView(const KUrl& datUrl); + void changeWriteTab(const KUrl& datUrl); + void updateFavoriteListView(); + void openUrl(const KUrl& url); + + private: + ViewMediator(const ViewMediator&); + ViewMediator& operator=(const ViewMediator&); + }; +} + #endif Modified: kita/trunk/kita/src/writedialogbase.ui =================================================================== --- kita/trunk/kita/src/writedialogbase.ui 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/writedialogbase.ui 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,258 +1,216 @@ -<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> -<class>KitaWriteDialogBase</class> -<widget class="QWidget"> - <property name="name"> - <cstring>KitaWriteDialogBase</cstring> +<ui version="4.0" stdsetdef="1" > + <author></author> + <comment></comment> + <exportmacro></exportmacro> + <class>WriteDialogBase</class> + <widget class="QWidget" name="WriteDialogBase" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>534</width> + <height>380</height> + </rect> </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>534</width> - <height>380</height> - </rect> + <property name="windowTitle" > + <string>Write in thread</string> </property> - <property name="caption"> - <string>Write in thread</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout4</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel1</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>5</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Board:</string> - </property> - </widget> - <widget class="KSqueezedTextLabel"> - <property name="name"> - <cstring>boardNameLabel</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>1</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>board name</string> - </property> - </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel1_2</cstring> - </property> - <property name="text"> - <string>Thread:</string> - </property> - </widget> - <widget class="KLineEdit"> - <property name="name"> - <cstring>threadNameLine</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>3</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </hbox> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout4</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>nameLabel</cstring> - </property> - <property name="text"> - <string>name</string> - </property> - </widget> - <widget class="KLineEdit"> - <property name="name"> - <cstring>nameLine</cstring> - </property> - </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>mailLabel</cstring> - </property> - <property name="text"> - <string>mail</string> - </property> - </widget> - <widget class="KLineEdit"> - <property name="name"> - <cstring>mailLine</cstring> - </property> - </widget> - <widget class="QCheckBox"> - <property name="name"> - <cstring>sageBox</cstring> - </property> - <property name="text"> - <string>&sage</string> - </property> - <property name="accel"> - <string>Alt+S</string> - </property> - </widget> - <widget class="QCheckBox"> - <property name="name"> - <cstring>beBox</cstring> - </property> - <property name="text"> - <string>&be</string> - </property> - <property name="accel"> - <string>Alt+B</string> - </property> - </widget> - </hbox> - </widget> - <widget class="QTabWidget"> - <property name="name"> - <cstring>qtw</cstring> - </property> - <widget class="QTextEdit"> - <property name="name"> - <cstring>bodyText</cstring> - </property> - <attribute name="title"> - <string>body</string> - </attribute> + <layout class="QVBoxLayout" > + <item> + <layout class="QHBoxLayout" > + <item> + <widget class="QLabel" name="textLabel1" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Board:</string> + </property> + <property name="wordWrap" > + <bool>false</bool> + </property> </widget> + </item> + <item> + <widget class="KSqueezedTextLabel" name="boardNameLabel" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>board name</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="textLabel1_2" > + <property name="text" > + <string>Thread:</string> + </property> + <property name="wordWrap" > + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="KLineEdit" name="threadNameLine" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>3</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" > + <item> + <widget class="QLabel" name="nameLabel" > + <property name="text" > + <string comment="@label:textbox The name used when posting">name</string> + </property> + <property name="wordWrap" > + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="KLineEdit" name="nameLine" /> + </item> + <item> + <widget class="QLabel" name="mailLabel" > + <property name="text" > + <string>mail</string> + </property> + <property name="wordWrap" > + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="KLineEdit" name="mailLine" /> + </item> + <item> + <widget class="QCheckBox" name="sageBox" > + <property name="text" > + <string>sage</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="beBox" > + <property name="text" > + <string>be</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="KTabWidget" name="qtw" > + <widget class="KTextEdit" name="bodyText" > + <attribute name="title" > + <string>body</string> + </attribute> + </widget> </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout4</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QComboBox"> - <property name="name"> - <cstring>faceCombo</cstring> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>Horizontal Spacing2</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QLabel"> - <property name="name"> - <cstring>lengthLabel</cstring> - </property> - <property name="text"> - <string>XX/XX | XXXX/XXXX</string> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>buttonOk</cstring> - </property> - <property name="text"> - <string>&OK</string> - </property> - <property name="accel"> - <string></string> - </property> - <property name="autoDefault"> - <bool>true</bool> - </property> - <property name="default"> - <bool>true</bool> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>buttonCancel</cstring> - </property> - <property name="text"> - <string>&Cancel</string> - </property> - <property name="accel"> - <string></string> - </property> - <property name="autoDefault"> - <bool>true</bool> - </property> - </widget> - </hbox> - </widget> - </vbox> -</widget> -<connections> + </item> + <item> + <layout class="QHBoxLayout" > + <item> + <widget class="KComboBox" name="faceCombo" /> + </item> + <item> + <spacer name="Horizontal Spacing2" > + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + <property name="sizeType" > + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="lengthLabel" > + <property name="text" > + <string>XX/XX | XXXX/XXXX</string> + </property> + <property name="wordWrap" > + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonOk" > + <property name="text" > + <string>OK</string> + </property> + <property name="shortcut" > + <string/> + </property> + <property name="autoDefault" > + <bool>true</bool> + </property> + <property name="default" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonCancel" > + <property name="text" > + <string>Cancel</string> + </property> + <property name="shortcut" > + <string/> + </property> + <property name="autoDefault" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11" /> + <connections> <connection> - <sender>sageBox</sender> - <signal>toggled(bool)</signal> - <receiver>KitaWriteDialogBase</receiver> - <slot>sageBoxToggled(bool)</slot> + <sender>sageBox</sender> + <signal>toggled(bool)</signal> + <receiver>WriteDialogBase</receiver> + <slot>sageBoxToggled(bool)</slot> </connection> -</connections> -<includes> - <include location="local" impldecl="in implementation">writedialogbase.ui.h</include> -</includes> -<variables> - <variable>QString m_mailswap;</variable> -</variables> -<slots> - <slot access="protected">sageBoxToggled( bool on )</slot> -</slots> -<functions> - <function access="protected" specifier="non virtual" returnType="const QString">name() const</function> - <function access="protected" specifier="non virtual" returnType="const QString">mail() const</function> - <function specifier="non virtual" returnType="const QString">body() const</function> -</functions> -<layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>ksqueezedtextlabel.h</includehint> - <includehint>klineedit.h</includehint> - <includehint>klineedit.h</includehint> - <includehint>klineedit.h</includehint> -</includehints> -</UI> + </connections> + <customwidgets> + <customwidget> + <class>KTextEdit</class> + <extends>QTextEdit</extends> + <header>ktextedit.h</header> + </customwidget> + <customwidget> + <class>KTabWidget</class> + <extends>QTabWidget</extends> + <header>ktabwidget.h</header> + </customwidget> + </customwidgets> +</ui> Deleted: kita/trunk/kita/src/writedialogbase.ui.h =================================================================== --- kita/trunk/kita/src/writedialogbase.ui.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/writedialogbase.ui.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,36 +0,0 @@ -/**************************************************************************** -** ui.h extension file, included from the uic-generated form implementation. -** -** If you wish to add, delete or rename functions or slots use -** Qt Designer which will update this file, preserving your code. Create an -** init() function in place of a constructor, and a destroy() function in -** place of a destructor. -*****************************************************************************/ - - -void KitaWriteDialogBase::sageBoxToggled( bool on ) -{ - if ( on ) { - m_mailswap = mailLine->text(); - mailLine->setText( "sage" ); - mailLine->setReadOnly( TRUE ); - } else { - mailLine->setReadOnly( FALSE ); - mailLine->setText( m_mailswap ); - } -} - -const QString KitaWriteDialogBase::name() const -{ - return nameLine->text(); -} - -const QString KitaWriteDialogBase::mail() const -{ - return mailLine->text(); -} - -const QString KitaWriteDialogBase::body() const -{ - return bodyText->text(); -} Modified: kita/trunk/kita/src/writetabwidget.cpp =================================================================== --- kita/trunk/kita/src/writetabwidget.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/writetabwidget.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -8,71 +8,64 @@ * (at your option) any later version. * ***************************************************************************/ -#include "libkita/kita_misc.h" -#include "libkita/datmanager.h" -#include "libkita/boardmanager.h" #include "writetabwidget.h" -#include "writeview.h" -#include <kdebug.h> -#include <kstdaccel.h> +#include <QtGui/QClipboard> + #include <kaction.h> -#include <klocale.h> -#include <kpopupmenu.h> -#include <kapplication.h> +#include <kactioncollection.h> +#include <kmessagebox.h> -#include <qmessagebox.h> -#include <qclipboard.h> +#include "writeview.h" +#include "libkita/boardmanager.h" +#include "libkita/datmanager.h" +#include "libkita/kita_misc.h" -/*--------------------------------------------------------------------------------*/ +using namespace Kita; - -KitaWriteTabWidget::KitaWriteTabWidget( QWidget* parent, const char* name, WFlags f ) - : KitaTabWidgetBase( parent, name, f ) +WriteTabWidget::WriteTabWidget(QWidget* parent) : TabWidgetBase(parent) { - setXMLFile( "writetabwidgetui.rc" ); + setXMLFile("writetabwidgetui.rc"); setupActions(); } -KitaWriteTabWidget::~KitaWriteTabWidget() {} +WriteTabWidget::~WriteTabWidget() {} /* public slot */ -void KitaWriteTabWidget::slotShowWriteView( const KURL& url, - const QString& resStr ) +void WriteTabWidget::slotShowWriteView(const KUrl& url, + const QString& resStr) { - openWriteView( url, resStr, QString::null ); + openWriteView(url, resStr, QString()); } /* private */ -void KitaWriteTabWidget::openWriteView( const KURL& url, - const QString& resStr, const QString& subject ) +void WriteTabWidget::openWriteView(const KUrl& url, + const QString& resStr, const QString& subject) { // TODO: machiBBS kakiko support. - if ( Kita::BoardManager::type( url ) == Kita::Board_MachiBBS ) { -// QMessageBox::warning( this, QString( "<(_ _)>" ), -// i18n( "Can't write to machi BBS in this version." ) ); + if (BoardManager::type(url) == Board_MachiBBS) { +// KMessageBox::sorry(this, +// i18n("Can't write to machi BBS in this version."), +// "<(_ _)>"); // return ; } /* view exists */ - KitaWriteView* view = findWriteView( url ); - if ( view ) { - - if ( view->body().length() ) { - - if ( QMessageBox::warning( this, "Kita", - i18n( "Do you want to clear the text?" ), - QMessageBox::Ok, - QMessageBox::Cancel | QMessageBox::Default ) == QMessageBox::Cancel ) return ; + WriteView* view = findWriteView(url); + if (view) { + if (view->body().length()) { + if (KMessageBox::warningYesNo(this, + i18n("Do you want to clear the text?"), "Kita") + == KMessageBox::No) return; } /* clear */ - view->setMessage( resStr ); - setCurrentPage( indexOf( view ) ); + view->setMessage(resStr); + setCurrentWidget(view); return ; } @@ -81,117 +74,108 @@ QString threadName; /* write res */ - KitaWriteView* new_dlg; - threadName = Kita::DatManager::threadName( url ); - new_dlg = new KitaWriteView( this, url ); - new_dlg->setMessage( resStr ); - addTab( new_dlg, threadName ); - showPage( new_dlg ); + WriteView* new_dlg; + threadName = DatManager(url).threadName(); + new_dlg = new WriteView(this, url); + new_dlg->setMessage(resStr); + addTab(new_dlg, threadName); + setCurrentWidget(new_dlg); } /* private */ -KitaWriteView* KitaWriteTabWidget::findWriteView( const KURL& url ) +WriteView* WriteTabWidget::findWriteView(const KUrl& url) { - KURL datURL = Kita::getDatURL( url ); - if ( datURL.isEmpty() ) return NULL; + KUrl datUrl = getDatUrl(url); + if (datUrl.isEmpty()) return 0; int max = count(); - if ( max == 0 ) return NULL; + if (max == 0) return 0; - for( int i=0; i < max; i++ ) { - KitaWriteView * view = isWriteView( page ( i ) ); - if ( view ) { - if ( view->datURL() == datURL ) return view; + for(int i=0; i < max; i++) { + WriteView * view = isWriteView(widget (i)); + if (view) { + if (view->datUrl() == datUrl) return view; } } - return NULL; + return 0; } /* private */ -KitaWriteView* KitaWriteTabWidget::isWriteView( QWidget* w ) +WriteView* WriteTabWidget::isWriteView(QWidget* w) { - KitaWriteView * view = NULL; - if ( w ) { - if ( w->isA( "KitaWriteView" ) ) view = static_cast< KitaWriteView* >( w ); - } - - return view; + return qobject_cast<WriteView*>(w); } /* when thread view is focused, this slot is called */ -/* See also KitaThreadView::setFocus. */ /* private slot */ -void KitaWriteTabWidget::slotChangeWriteTab( const KURL& url ) +/* See also ThreadView::setFocus. */ /* private slot */ +void WriteTabWidget::slotChangeWriteTab(const KUrl& url) { - KitaWriteView * view; + WriteView * view; int max = count(); - if ( max == 0 ) return ; + if (max == 0) return ; /* disable all ok buttons. */ - for( int i=0; i < max ; i++ ) { - view = isWriteView( page( i ) ); - if ( view ) view->slotEnableWriting( FALSE ); + for(int i=0; i < max ; i++) { + view = isWriteView(widget(i)); + if (view) view->slotEnableWriting(false); } /* show current url page. */ - view = findWriteView( url ); - if ( view ) { - if ( currentPage() != view ) setCurrentPage( indexOf( view ) ); - view->slotEnableWriting( TRUE ); + view = findWriteView(url); + if (view) { + if (currentWidget() != view) setCurrentWidget(view); + view->slotEnableWriting(true); } } /* protected */ /* virtual */ -void KitaWriteTabWidget::deleteWidget( QWidget* w ) +void WriteTabWidget::deleteWidget(QWidget* w) { - KitaWriteView * view = isWriteView( w ); + WriteView * view = isWriteView(w); - if ( view == NULL ) return ; + if (view == 0) return ; - if ( view->body().length() ) { - if ( QMessageBox::warning( this, "Kita", - i18n( "If you close this dialog, you will lose text.\n" - "Do you want to close?" ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - == QMessageBox::Cancel ) return ; + if (view->body().length()) { + if (KMessageBox::warningYesNo(this, + i18n("If you close this dialog, you will lose text.\n" + "Do you want to close?"), "Kita") == KMessageBox::No) return; } - KitaTabWidgetBase::deleteWidget( w ); + TabWidgetBase::deleteWidget(w); } /*--------------------------------*/ -/* KitaWriteTabWidget actions */ +/* WriteTabWidget actions */ /* private */ -void KitaWriteTabWidget::setupActions() +void WriteTabWidget::setupActions() { - new KAction( i18n( "quote clipboard" ), - Key_F2, - this, - SLOT( slotQuoteClipboard() ), - actionCollection(), - "writeview_quoteclip" ); + KAction* quoteclip_action = actionCollection()->addAction("writeview_quoteclip"); + quoteclip_action->setText(i18n("quote clipboard")); + quoteclip_action->setShortcut(Qt::Key_F2); + connect(quoteclip_action, SIGNAL(triggered()), this, SLOT(slotQuoteClipboard())); } /* public slot */ -void KitaWriteTabWidget::slotQuoteClipboard() +void WriteTabWidget::slotQuoteClipboard() { - KitaWriteView * view = isWriteView( currentPage() ); - if ( view ) { + WriteView * view = isWriteView(currentWidget()); + if (view) { QClipboard * clipboard = QApplication::clipboard(); - QString str = clipboard->text( QClipboard::Selection ); - if ( str == QString::null ) str = clipboard->text( QClipboard::Clipboard ); - if ( str != QString::null ) { + QString str = clipboard->text(QClipboard::Selection); + if (str.isEmpty()) str = clipboard->text(QClipboard::Clipboard); + if (!str.isEmpty()) { - QString msg = "\n> " + str.replace( "\n", "\n> " ) + "\n"; - view->insertMessage( msg ); + QString msg = "\n> " + str.replace('\n', "\n> ") + '\n'; + view->insertMessage(msg); } } } Modified: kita/trunk/kita/src/writetabwidget.h =================================================================== --- kita/trunk/kita/src/writetabwidget.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/writetabwidget.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,46 +7,45 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITAWRITETABWIDGET_H #define KITAWRITETABWIDGET_H #include "kitaui/tabwidgetbase.h" -class KitaWriteView; +namespace Kita { + class WriteView; -/*-----------------------------------------------*/ + class WriteTabWidget : public TabWidgetBase + { + Q_OBJECT + public: + explicit WriteTabWidget(QWidget* parent = 0); + ~WriteTabWidget(); + void slotShowWriteView(const KUrl& url, const QString& resStr); -class KitaWriteTabWidget : public KitaTabWidgetBase -{ - Q_OBJECT + private: + void openWriteView(const KUrl& url, const QString& resStr = QString(), + const QString& subject = QString()); + WriteView* findWriteView(const KUrl& url); + WriteView* isWriteView(QWidget* w); -public: - KitaWriteTabWidget( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); - ~KitaWriteTabWidget(); - void slotShowWriteView( const KURL& url, const QString& resStr ); + public: + void slotChangeWriteTab(const KUrl& url); -private: - void openWriteView( const KURL& url, const QString& resStr = QString::null, const QString& subject = QString::null ); - KitaWriteView* findWriteView( const KURL& url ); - KitaWriteView* isWriteView( QWidget* w ); + protected: + virtual void deleteWidget(QWidget* w); -public: - void slotChangeWriteTab( const KURL& url ); -protected: - virtual void deleteWidget( QWidget* w ); + /*------------------------------------*/ + /* WriteTabWidget actions */ + private: + void setupActions(); - /*------------------------------------*/ - /* KitaWriteTabWidget actions */ + public slots: + void slotQuoteClipboard(); + }; +} -private: - void setupActions(); - -public slots: - void slotQuoteClipboard(); -}; - #endif Deleted: kita/trunk/kita/src/writetabwidgetui.rc =================================================================== --- kita/trunk/kita/src/writetabwidgetui.rc 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/writetabwidgetui.rc 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,3 +0,0 @@ -<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui name="kitaWriteTabWidget" version="1"> -</kpartgui> Copied: kita/trunk/kita/src/writetabwidgetui.rc (from rev 2558, kita/branches/KITA-KDE4/kita/src/writetabwidgetui.rc) =================================================================== --- kita/trunk/kita/src/writetabwidgetui.rc (rev 0) +++ kita/trunk/kita/src/writetabwidgetui.rc 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,3 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="kitaWriteTabWidget" version="1"> +</kpartgui> Modified: kita/trunk/kita/src/writeview.cpp =================================================================== --- kita/trunk/kita/src/writeview.cpp 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/writeview.cpp 2010-02-10 10:04:00 UTC (rev 2559) @@ -10,302 +10,284 @@ #include "writeview.h" -#include "viewmediator.h" +#include <QtCore/QFile> +#include <QtCore/QTextCodec> -#include "libkita/qcp932codec.h" -#include "libkita/datmanager.h" -#include "libkita/boardmanager.h" +#include <kmessagebox.h> +#include <kstandarddirs.h> +#include <kio/job.h> + +#include "viewmediator.h" +#include "writetabwidget.h" #include "libkita/account.h" -#include "libkita/kita-utf8.h" -#include "libkita/kita_misc.h" -#include "libkita/config_xt.h" +#include "libkita/accountconfig.h" #include "libkita/asciiart.h" +#include "libkita/boardmanager.h" +#include "libkita/datmanager.h" +#include "libkita/flashcgi.h" +#include "libkita/globalconfig.h" +#include "libkita/jbbs.h" +#include "libkita/kita_misc.h" +#include "libkita/kita-utf8.h" #include "libkita/k2ch.h" #include "libkita/machibbs.h" -#include "libkita/jbbs.h" -#include "libkita/flashcgi.h" +#include "libkita/postdata.h" +#include "libkita/writeconfig.h" -#include "htmlpart.h" +using namespace Kita; -#include "kitaui/htmlview.h" - -#include <ksqueezedtextlabel.h> -#include <klocale.h> -#include <kdebug.h> -#include <kstandarddirs.h> -#include <klineedit.h> -#include <kmessagebox.h> -#include <kio/job.h> - -#include <qapplication.h> -#include <qtextedit.h> -#include <qpushbutton.h> -#include <qlabel.h> -#include <qcombobox.h> -#include <qeucjpcodec.h> -#include <qfile.h> -#include <qmessagebox.h> -#include <ktabwidget.h> -#include <qcheckbox.h> -#include <qlayout.h> - - - -/*--------------------------------------------------------------------*/ - -QCp932Codec* KitaWriteView::m_cp932Codec = NULL; - /* Call setMessage() to set message later. -See also KitaWriteTabWidget::slotShowWriteView(). +See also WriteTabWidget::slotShowWriteView(). Call slotPostMessage() to post the message. */ -KitaWriteView::KitaWriteView( KitaWriteTabWidget* parent, const KURL& url ) - : KitaWriteDialogBase( parent, 0 ) +WriteView::WriteView(WriteTabWidget* parent, const KUrl& url) + : QWidget(parent) { - m_cp932Codec = new QCp932Codec(); - m_datURL = Kita::getDatURL( url ); - m_bbstype = Kita::BoardManager::type( m_datURL ); - m_bbscgi = Kita::getWriteURL( m_datURL ); + setupUi(this); + m_datUrl = getDatUrl(url); + m_bbstype = BoardManager::type(m_datUrl); + m_bbscgi = getWriteUrl(m_datUrl); m_parent = parent; initUI(); } -void KitaWriteView::initUI() +void WriteView::initUI() { /* connect signals */ - connect( buttonOk, SIGNAL( clicked() ), - SLOT( slotPostMessage() ) ); + connect(buttonOk, SIGNAL(clicked()), + SLOT(slotPostMessage())); - connect( buttonCancel, SIGNAL( clicked() ), - SLOT( slotCancel() ) ); + connect(buttonCancel, SIGNAL(clicked()), + SLOT(slotCancel())); - connect( faceCombo, SIGNAL( activated( const QString& ) ), - bodyText, SLOT( insert( const QString& ) ) ); + connect(faceCombo, SIGNAL(activated(const QString&)), + bodyText, SLOT(insertPlainText(const QString&))); - connect( bodyText, SIGNAL( textChanged() ), - SLOT( slotBodyTextChanged() ) ); + connect(bodyText, SIGNAL(textChanged()), + SLOT(slotBodyTextChanged())); /* setup preview view */ - qtw->setCurrentPage( 0 ); + qtw->setCurrentIndex(0); /* setup labels and edit lines */ - QFont font = Kita::Config::threadFont(); - bodyText->setFont( font ); - bodyText->setTabChangesFocus( TRUE ); + QFont font = GlobalConfig::threadFont(); + bodyText->setFont(font); + bodyText->setTabChangesFocus(true); - boardNameLabel->setText( Kita::BoardManager::boardName( m_datURL ) ); + boardNameLabel->setText(BoardManager::boardName(m_datUrl)); // setup name field. - nameLine->setText( Kita::Config::defaultName() ); - QStringList compList = Kita::Config::self()->nameCompletionList(); - nameLine->completionObject()->setItems( compList ); + nameLine->setText(WriteConfig::defaultName()); + QStringList compList = GlobalConfig::self()->nameCompletionList(); + nameLine->completionObject()->setItems(compList); // setup mail field & 'sage' checkbox - if ( Kita::Config::defaultSage() ) { - mailLine->setText( "sage" ); - sageBox->setChecked( TRUE ); + if (WriteConfig::defaultSage()) { + mailLine->setText("sage"); + sageBox->setChecked(true); } else { - mailLine->setText( Kita::Config::defaultMail() ); + mailLine->setText(WriteConfig::defaultMail()); } m_mailswap = ""; // setup 'be' checkbox - QRegExp host_2ch( ".+\\.2ch\\.net" ); - if ( host_2ch.search( m_bbscgi.host() ) != -1 - && Kita::Config::beMailAddress().length() > 0 - && Kita::Config::beAuthCode().length() > 0 ) { - beBox->setChecked( TRUE ); + QRegExp host_2ch(".+\\.2ch\\.net"); + if (host_2ch.indexIn(m_bbscgi.host()) != -1 + && AccountConfig::beMailAddress().length() > 0 + && AccountConfig::beAuthCode().length() > 0) { + beBox->setChecked(true); } /* setup AA */ faceCombo->clear(); - faceCombo->setFont( Kita::Config::threadFont() ); - faceCombo->insertItem( "" ); - QStringList list = Kita::AsciiArtConfig::asciiArtList(); + faceCombo->setFont(GlobalConfig::threadFont()); + faceCombo->addItem(""); + QStringList list = AsciiArtConfig::asciiArtList(); QStringList::iterator it; - for ( it = list.begin(); it != list.end(); ++it ) { - faceCombo->insertItem( *it ); + for (it = list.begin(); it != list.end(); ++it) { + faceCombo->addItem(*it); } // init thread name field. - threadNameLine->setText( Kita::DatManager::threadName( m_datURL ) ); - threadNameLine->setReadOnly( TRUE ); - threadNameLine->setFrame( FALSE ); - threadNameLine->setFocusPolicy( NoFocus ); + threadNameLine->setText(DatManager(m_datUrl).threadName()); + threadNameLine->setReadOnly(true); + threadNameLine->setFrame(false); + threadNameLine->setFocusPolicy(Qt::NoFocus); } -KitaWriteView::~KitaWriteView() +WriteView::~WriteView() { } /* public */ -void KitaWriteView::setMessage( const QString& bodyStr ) +void WriteView::setMessage(const QString& bodyStr) { bodyText->clear(); - bodyText->insert( bodyStr ); + bodyText->insertPlainText(bodyStr); bodyText->setFocus(); } /* public */ -void KitaWriteView::insertMessage( const QString& str ) +void WriteView::insertMessage(const QString& str) { - bodyText->insert( str ); + bodyText->insertPlainText(str); bodyText->setFocus(); } /* public information */ -const KURL KitaWriteView::datURL() const +const KUrl WriteView::datUrl() const { - return m_datURL; + return m_datUrl; } -const QString KitaWriteView::threadName() const +const QString WriteView::threadName() const { return threadNameLine->text(); } -const QString KitaWriteView::boardID() const +const QString WriteView::boardId() const { - return Kita::BoardManager::boardID( m_datURL ); + return BoardManager::boardId(m_datUrl); } -const QString KitaWriteView::boardName() const +const QString WriteView::boardName() const { - return Kita::BoardManager::boardName( m_datURL ); + return BoardManager::boardName(m_datUrl); } /* public slot */ /* virtual */ -void KitaWriteView::setFocus() +void WriteView::setFocus() { bodyText->setFocus(); } -bool KitaWriteView::checkFields() +bool WriteView::checkFields() { - if ( body().length() == 0 ) { - return FALSE; + if (body().length() == 0) { + return false; } else { - return TRUE; + return true; } } -QString KitaWriteView::buildPostMessage() +QString WriteView::buildPostMessage() { + PostData postData(m_datUrl, name(), mail(), body(), boardId()); QString postStr; - switch ( m_bbstype ) { + switch (m_bbstype) { + case Board_JBBS: + postStr = JBBS().buildPostStr(postData); + break; - case Kita::Board_JBBS: postStr = getJBBSPostStr(); break; + case Board_FlashCGI: + postStr = FlashCGI().buildPostStr(postData); + break; - case Kita::Board_FlashCGI: postStr = getFlashCGIPostStr(); break; + case Board_MachiBBS: + postStr = MachiBBS().buildPostStr(postData); + break; - case Kita::Board_MachiBBS: postStr = getMachiBBSPostStr(); break; - - default: postStr = getPostStr(); break; + default: + postStr = K2ch().buildPostStr(postData); + break; } return postStr; } /* call this slot to post the message. */ /* public slot */ -void KitaWriteView::slotPostMessage() +void WriteView::slotPostMessage() { - if ( !checkFields() ) return; + if (!checkFields()) return; QString name = nameLine->text(); - QStringList list = Kita::Config::nameCompletionList(); - list.append( name ); - Kita::Config::setNameCompletionList( list ); + QStringList list = GlobalConfig::nameCompletionList(); + list.append(name); + GlobalConfig::setNameCompletionList(list); /* build post message */ QString postStr = buildPostMessage(); /* referrer */ - QString refStr = Kita::BoardManager::boardURL( m_datURL ); + QString refStr = BoardManager::boardUrl(m_datUrl); - m_array.resize( 0 ); + m_array.clear(); - KIO::TransferJob* job = KIO::http_post( m_bbscgi, postStr.utf8(), TRUE ); - job->addMetaData( "content-type", "Content-type: application/x-www-form-urlencoded" ); - job->addMetaData( "referrer", refStr ); + KIO::TransferJob* job = KIO::http_post(m_bbscgi, postStr.toUtf8()); + job->addMetaData("content-type", "Content-type: application/x-www-form-urlencoded"); + job->addMetaData("referrer", refStr); /* 2ch.net cookie modify */ - if ( m_bbstype == Kita::Board_2ch && beBox->isChecked() ) { + if (m_bbstype == Board_2ch && beBox->isChecked()) { QString cookie = "Cookie: "; - QString BeMailAddress = Kita::Config::beMailAddress(); - QString BeAuthCode = Kita::Config::beAuthCode(); - if ( BeMailAddress.length() > 0 && BeAuthCode.length() > 0 ) { + QString BeMailAddress = AccountConfig::beMailAddress(); + QString BeAuthCode = AccountConfig::beAuthCode(); + if (BeMailAddress.length() > 0 && BeAuthCode.length() > 0) { cookie += "DMDM=" + BeMailAddress + "; "; cookie += "MDMD=" + BeAuthCode + "; "; } - job->addMetaData( "customHTTPHeader", cookie ); + job->addMetaData("customHTTPHeader", cookie); } - connect( job, SIGNAL( data( KIO::Job*, const QByteArray& ) ), - this, SLOT( slotRecieveData( KIO::Job*, const QByteArray& ) ) ); + connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), + this, SLOT(slotRecieveData(KIO::Job*, const QByteArray&))); /* slotPostFinished() is called when done. */ - connect( job, SIGNAL( result( KIO::Job* ) ), - this, SLOT( slotPostFinished( KIO::Job* ) ) ); + connect(job, SIGNAL(result(KJob*)), + this, SLOT(slotPostFinished(KJob*))); } /* public slot */ -void KitaWriteView::slotCancel() +void WriteView::slotCancel() { - if ( body().length() == 0 ) { + if (body().length() == 0) { m_parent->slotCloseCurrentTab(); return ; } - switch ( QMessageBox::warning( this, "Kita", - i18n( "If you close this dialog, you will lose text.\n" - "Do you want to close?" ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) ) { - case QMessageBox::Ok: - setMessage( QString::null ); - m_parent->slotCloseCurrentTab(); - break; - case QMessageBox::Cancel: - // do nothing - break; - } + if (KMessageBox::warningYesNo(this, + i18n("If you close this dialog, you will lose text.\n" + "Do you want to close?"), "Kita") == KMessageBox::No) return; + setMessage(QString()); + m_parent->slotCloseCurrentTab(); } /* public slot */ -void KitaWriteView::slotEnableWriting( bool enable ) +void WriteView::slotEnableWriting(bool enable) { - buttonOk->setEnabled( enable ); + buttonOk->setEnabled(enable); } /* see also slotPostMessage() */ /* private slot */ -void KitaWriteView::slotRecieveData( KIO::Job*, const QByteArray& data ) +void WriteView::slotRecieveData(KIO::Job*, const QByteArray& data) { - m_array.append( data.data() ); + m_array.append(data.data()); } -void KitaWriteView::processPostFinished() +void WriteView::processPostFinished() { QString response; - QString ckstr = QTextCodec::codecForName( "utf8" ) ->toUnicode( KITAUTF8_WRITECOOKIE ); + QString ckstr = QString::fromUtf8(KITAUTF8_WRITECOOKIE); // x-euc-jp & euc-jp - if ( m_array.contains( "euc-jp" ) ) { - response = QTextCodec::codecForName( "eucJP" ) ->toUnicode( m_array ); + if (m_array.contains("euc-jp")) { + response = QTextCodec::codecForName("eucJP")->toUnicode(m_array); } else { - response = QTextCodec::codecForName( "sjis" ) ->toUnicode( m_array ); + response = QTextCodec::codecForName("sjis")->toUnicode(m_array); } - int retcode = resultCode( response ); - switch ( retcode ) { + int retcode = resultCode(response); + switch (retcode) { case K2ch_True: @@ -313,10 +295,10 @@ logPostMessage(); /* clear message */ - setMessage( QString::null ); + setMessage(QString()); /* reload thread */ - ViewMediator::getInstance()->openThread( m_datURL ); + ViewMediator::getInstance()->openThread(m_datUrl); m_parent->slotCloseCurrentTab(); @@ -327,17 +309,16 @@ case K2ch_Check: case K2ch_Error: - KMessageBox::error( 0, resultMessage( response ), resultTitle( response ) ); + KMessageBox::error(0, resultMessage(response), resultTitle(response)); break; /* eat cookie, then re-post message */ case K2ch_Cookie: - if ( KMessageBox::questionYesNo( 0, - QTextCodec::codecForName( "utf8" ) ->toUnicode( KITAUTF8_WRITECOOKIEMSG ), - resultTitle( response ) ) - == KMessageBox::Yes ) { + if (KMessageBox::questionYesNo(0, + QString::fromUtf8(KITAUTF8_WRITECOOKIEMSG), resultTitle(response)) + == KMessageBox::Yes) { slotPostMessage(); } @@ -350,108 +331,55 @@ /* This slot is called when posting is done. */ /* see also slotPostMessage() */ /* private slot */ -void KitaWriteView::slotPostFinished( KIO::Job* ) +void WriteView::slotPostFinished(KJob*) { processPostFinished(); } -int KitaWriteView::getWriteResNum() +int WriteView::getWriteResNum() { - return Kita::DatManager::getReadNum( m_datURL ) + 1; + return DatManager(m_datUrl).getReadNum() + 1; } /* private slot */ -bool KitaWriteView::slotBodyTextChanged() +bool WriteView::slotBodyTextChanged() { - int lines = bodyText->lines(); - int tmpln = bodyText->length(); - int length = m_cp932Codec->fromUnicode( body(), tmpln ).length(); + QString text = bodyText->toPlainText(); + int lines = text.count('\n') + 1; + int length + = QTextCodec::codecForName("Shift_JIS")->fromUnicode(body()).length(); /* replace '\n' -> " <br> ", '>' -> "<", and etc. */ - length += ( ( body().contains( '\n' ) ) * 5 - + ( body().contains( '>' ) ) * 3 - + ( body().contains( '<' ) ) * 3 - ); + length += ((body().count('\n')) * 5 + + (body().count('>')) * 3 + + (body().count('<')) * 3 + ); QString str; - str = QString().setNum( lines ); - str += " | " + QString().setNum( length ); - lengthLabel->setText( str ); + str = QString::number(lines); + str += " | " + QString::number(length); + lengthLabel->setText(str); - return TRUE; + return true; } -/* create posting message for 2ch */ /* private */ -QString KitaWriteView::getPostStr() -{ - QString sessionID; - QString threadID = Kita::DatManager::threadID( m_datURL ); - int serverTime = Kita::DatManager::getServerTime( m_datURL ); - - /* login */ - if ( Kita::DatManager::is2chThread( m_datURL ) && Kita::Account::isLogged() ) { - sessionID = KURL::encode_string( Kita::Account::getSessionID() ); - } - - return K2ch::buildPostStr( name(), mail(), - body(), boardID(), - threadID, serverTime, - sessionID ); -} - -QString KitaWriteView::getMachiBBSPostStr() -{ - QString threadID = Kita::DatManager::threadID( m_datURL ); - int serverTime = Kita::DatManager::getServerTime( m_datURL ); - - return MachiBBS::buildPostStr( name(), mail(), - body(), boardID(), - threadID, serverTime ); -} - - -/* create posting message for JBBS */ /* private */ /* private */ -QString KitaWriteView::getJBBSPostStr() -{ - QString threadID = Kita::DatManager::threadID( m_datURL ); - int serverTime = Kita::DatManager::getServerTime( m_datURL ); - - return JBBS::buildPostStr( name(), mail(), - body(), boardID(), - threadID, serverTime ); -} - - -/* create posting message for Flash CGI */ /* private */ /* private */ -QString KitaWriteView::getFlashCGIPostStr() -{ - QString threadID = Kita::DatManager::threadID( m_datURL ); - - QString ret; - - return FlashCGI::buildPostStr( name(), mail(), - body(), boardID(), - threadID ); -} - - /* save post log */ /* private */ -void KitaWriteView::logPostMessage() +void WriteView::logPostMessage() { - QString threadURL = Kita::DatManager::threadURL( m_datURL ); + QString threadUrl = DatManager(m_datUrl).threadUrl(); QDateTime now = QDateTime::currentDateTime(); - QString logPath = locateLocal( "appdata", "log.txt" ); + QString logPath = KStandardDirs::locateLocal("appdata", "log.txt"); - QFile file( logPath ); - if ( file.open( IO_WriteOnly | IO_Append ) ) { - QTextStream stream( &file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + QFile file(logPath); + if (file.open(QIODevice::WriteOnly | QIODevice::Append)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); - stream << "Date : " << now.toString( "yyyy/MM/dd hh:mm:ss" ) << endl; // current time + stream << "Date : " << now.toString("yyyy/MM/dd hh:mm:ss") << endl; // current time stream << "Board : " << boardName() << endl; stream << "Thread : " << threadName() << endl; - stream << "URL : " << threadURL << endl; + stream << "URL : " << threadUrl << endl; stream << "Name : " << name() << endl; stream << "Mail : " << mail() << endl << endl; stream << body() << endl; @@ -463,39 +391,39 @@ /* get result code from 2ch tag or title. */ /* private */ -int KitaWriteView::resultCode( const QString& response ) const +int WriteView::resultCode(const QString& response) const { /* see also libkita/kita-utf8.h */ - QString errstr = QTextCodec::codecForName( "utf8" ) ->toUnicode( KITAUTF8_WRITEERROR ); - QString truestr = QTextCodec::codecForName( "utf8" ) ->toUnicode( KITAUTF8_WRITETRUE ); - QString ckstr = QTextCodec::codecForName( "utf8" ) ->toUnicode( KITAUTF8_WRITECOOKIE ); + QString errstr = QString::fromUtf8(KITAUTF8_WRITEERROR); + QString truestr = QString::fromUtf8(KITAUTF8_WRITETRUE); + QString ckstr = QString::fromUtf8(KITAUTF8_WRITECOOKIE); - QRegExp regexp( "<!-- 2ch_X:(.*) -->" ); - int pos = regexp.search( response ); + QRegExp regexp("<!-- 2ch_X:(.*) -->"); + int pos = regexp.indexIn(response); - if ( pos != -1 ) { + if (pos != -1) { /* get code from 2ch tag */ - QString k2ch_X = regexp.cap( 1 ); + QString k2ch_X = regexp.cap(1); - if ( k2ch_X == "true" ) return K2ch_True; - if ( k2ch_X == "false" ) return K2ch_False; - if ( k2ch_X == "error" ) return K2ch_Error; - if ( k2ch_X == "check" ) return K2ch_Check; - if ( k2ch_X == "cookie" ) return K2ch_Cookie; + if (k2ch_X == "true") return K2ch_True; + if (k2ch_X == "false") return K2ch_False; + if (k2ch_X == "error") return K2ch_Error; + if (k2ch_X == "check") return K2ch_Check; + if (k2ch_X == "cookie") return K2ch_Cookie; return K2ch_Unknown; } else { /* get code from title */ - QString title = resultTitle( response ); - if ( title == QString::null ) return K2ch_Unknown; + QString title = resultTitle(response); + if (title.isEmpty()) return K2ch_Unknown; - if ( title.contains( errstr ) ) return K2ch_Error; - if ( title.contains( truestr ) ) return K2ch_True; - if ( title.contains( ckstr ) ) return K2ch_Cookie; + if (title.contains(errstr)) return K2ch_Error; + if (title.contains(truestr)) return K2ch_True; + if (title.contains(ckstr)) return K2ch_Cookie; /* for Flash CGI */ - if ( m_bbstype == Kita::Board_FlashCGI ) { - if ( title.contains( "ERROR!!" ) ) { + if (m_bbstype == Board_FlashCGI) { + if (title.contains("ERROR!!")) { return K2ch_Error; } else { return K2ch_True; @@ -503,10 +431,10 @@ } /* for JBBS. adhoc... */ - if ( m_bbstype == Kita::Board_JBBS ) { + if (m_bbstype == Board_JBBS) { // x-euc-jp & euc-jp - if ( response.contains( "euc-jp" ) ) { + if (response.contains("euc-jp")) { return K2ch_True; } else { return K2ch_Error; @@ -519,54 +447,53 @@ /* private */ -QString KitaWriteView::resultMessage( const QString& response ) const +QString WriteView::resultMessage(const QString& response) const { - QRegExp tags( "(<[^<]+>|</[^<]+>)" ); + QRegExp tags("(<[^<]+>|</[^<]+>)"); - if ( m_bbstype == Kita::Board_FlashCGI ) { + if (m_bbstype == Board_FlashCGI) { - QRegExp regexp( "<blockquote>(.*)</blockquote>" ); - int pos = regexp.search( response ); - if ( pos != -1 ) { - return regexp.cap( 1 ).replace( "<br>", "\n" ); + QRegExp regexp("<blockquote>(.*)</blockquote>"); + int pos = regexp.indexIn(response); + if (pos != -1) { + return regexp.cap(1).replace("<br>", "\n"); } - return QString::null; + return QString(); } { - QRegExp bold_start( "<b>" ); - QRegExp bold_end( "</b>" ); - int startPos = bold_start.search( response ); - if ( startPos != -1 ) { + QRegExp bold_start("<b>"); + QRegExp bold_end("</b>"); + int startPos = bold_start.indexIn(response); + if (startPos != -1) { startPos += 3; - int endPos = bold_end.search( response ); - if ( endPos != -1 && startPos < endPos ) { - QString message = response.mid( startPos, endPos - startPos ); - message.remove( tags ); + int endPos = bold_end.indexIn(response); + if (endPos != -1 && startPos < endPos) { + QString message = response.mid(startPos, endPos - startPos); + message.remove(tags); return message; } } } - QRegExp body_regexp( "<body>([^<]*)</body>" ); - if ( body_regexp.search( response ) != -1 ) { - return body_regexp.cap( 1 ); + QRegExp body_regexp("<body>([^<]*)</body>"); + if (body_regexp.indexIn(response) != -1) { + return body_regexp.cap(1); } - return QString::null; + return QString(); } /* private */ -QString KitaWriteView::resultTitle( const QString& response ) const +QString WriteView::resultTitle(const QString& response) const { - QRegExp regexp( "<title>(.*)</title>" ); - regexp.setCaseSensitive( FALSE ); - int pos = regexp.search( response ); - if ( pos != -1 ) { - return regexp.cap( 1 ); + QRegExp regexp("<title>(.*)</title>"); + int pos = regexp.indexIn(response, Qt::CaseInsensitive); + if (pos != -1) { + return regexp.cap(1); } else { - return QString::null; + return QString(); } } Modified: kita/trunk/kita/src/writeview.h =================================================================== --- kita/trunk/kita/src/writeview.h 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita/src/writeview.h 2010-02-10 10:04:00 UTC (rev 2559) @@ -7,20 +7,16 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#ifndef KITAWRITEVIEW_H +#define KITAWRITEVIEW_H -#ifndef _KITAWRITEDIALOG_H_ -#define _KITAWRITEDIALOG_H_ +#include <QtCore/QByteArray> +#include <QtGui/QWidget> -#include <qwidget.h> #include <kio/job.h> -#include <kparts/browserextension.h> -#include "writedialogbase.h" -#include "writetabwidget.h" +#include "ui_writedialogbase.h" -class KitaPreviewPart; -class QCp932Codec; - /* result code */ enum{ K2ch_Unknown, @@ -31,65 +27,92 @@ K2ch_Cookie }; +namespace Kita { + class PreviewPart; + class WriteTabWidget; -/** - * - * Hideki Ikemoto - **/ -class KitaWriteView : public KitaWriteDialogBase -{ - Q_OBJECT + /** + * + * Hideki Ikemoto + **/ + class WriteView : public QWidget, public ::Ui::WriteDialogBase + { + Q_OBJECT - KitaWriteTabWidget* m_parent; + WriteTabWidget* m_parent; - QString getPostStr(); - QString getMachiBBSPostStr(); - QString getJBBSPostStr(); - QString getFlashCGIPostStr(); + WriteView(const WriteView&); + WriteView& operator=(const WriteView&); -protected: + protected: - QCString m_array; - KURL m_bbscgi; - int m_bbstype; - KURL m_datURL; - static QCp932Codec* m_cp932Codec; + QByteArray m_array; + KUrl m_bbscgi; + int m_bbstype; + KUrl m_datUrl; + QString m_mailswap; - void initUI(); - bool checkFields(); - QString buildPostMessage(); - int getWriteResNum(); - void processPostFinished(); - void logPostMessage(); - int resultCode( const QString& response ) const; - QString resultMessage( const QString& response ) const; - QString resultTitle( const QString& response ) const; + void initUI(); + bool checkFields(); + QString buildPostMessage(); + int getWriteResNum(); + void processPostFinished(); + void logPostMessage(); + int resultCode(const QString& response) const; + QString resultMessage(const QString& response) const; + QString resultTitle(const QString& response) const; -public: - KitaWriteView( KitaWriteTabWidget* parent, const KURL& url ); - virtual ~KitaWriteView(); - void setMessage( const QString& bodyStr ); - void insertMessage( const QString& str ); + public: + WriteView(WriteTabWidget* parent, const KUrl& url); + virtual ~WriteView(); + void setMessage(const QString& bodyStr); + void insertMessage(const QString& str); - const KURL datURL() const; - const QString threadName() const; - const QString boardName() const; - const QString boardID() const; + const KUrl datUrl() const; + const QString threadName() const; + const QString boardName() const; + const QString boardId() const; + const QString name() const + { + return nameLine->text(); + } -public slots: + const QString mail() const + { + return mailLine->text(); + } - virtual void setFocus(); - void slotPostMessage(); - void slotCancel(); - void slotEnableWriting( bool enable ); + const QString body() const + { + return bodyText->toPlainText(); + } -private slots: + public slots: - void slotRecieveData( KIO::Job*, const QByteArray& ); - void slotPostFinished( KIO::Job* ); + virtual void setFocus(); + void slotPostMessage(); + void slotCancel(); + void slotEnableWriting(bool enable); + void sageBoxToggled(bool on) + { + if (on) { + m_mailswap = mailLine->text(); + mailLine->setText("sage"); + mailLine->setReadOnly(true); + } else { + mailLine->setReadOnly(false); + mailLine->setText(m_mailswap); + } + } -protected slots: - bool slotBodyTextChanged(); + private slots: -}; + void slotRecieveData(KIO::Job*, const QByteArray&); + void slotPostFinished(KJob*); + + protected slots: + bool slotBodyTextChanged(); + + }; +} #endif Deleted: kita/trunk/kita.spec =================================================================== --- kita/trunk/kita.spec 2010-02-10 08:20:57 UTC (rev 2558) +++ kita/trunk/kita.spec 2010-02-10 10:04:00 UTC (rev 2559) @@ -1,98 +0,0 @@ -%define version 0.200.0 - -%define use_xdg_menu %{!?_with_xdg_menu:0}%{?_with_xdg_menu:1} - -%define is_suse %(if [ -e /etc/SuSE-release ]; then echo "yes"; else echo "no"; fi) -%if %{is_suse} == "yes" -%define _prefix /opt/kde3 -%endif - -%define is_x86_64 %(if [ "x86_64" == `uname -m` ]; then echo "yes"; else echo "no"; fi) - -Summary: 2ch client for KDE -Name: kita -Version: %{version} -Release: 1 -Source: kita-%{version}.tar.gz -License: GPL -URL: http://sourceforge.jp/projects/kita/ -Group: Application/Internet -Packager: Hideki Ikemoto <ikemo****@users*****> -BuildRoot: %{_tmppath}/%{name}-%{version}-root - -# TurboLinux uses 'Serial' field. -#Serial: 2004051601 - -%description -2ch client for KDE - -%prep -%setup -q - -%build -./configure --prefix=%{_prefix} \ -%if %{is_x86_64} == "yes" - --enable-libsuffix=64 \ - %if %{is_suse} == "yes" - --with-qt-libraries=/usr/lib64/qt-3.3/lib64 \ - %else - --with-qt-libraries=/usr/lib64/qt-3.3/lib \ - %endif -%endif -%if %{use_xdg_menu} - --enable-xdg-menu -%endif - -make clean -make - -%install -rm -rf %{buildroot} -%makeinstall - -%clean -rm -rf %{buildroot} - -%post -p /sbin/ldconfig -%postun -p /sbin/ldconfig -%files -%defattr(-, root, root) -%doc AUTHORS COPYING ChangeLog NEWS README README.2ch TODO -%{_bindir}/* -%{_libdir}/*.so* -%{_libdir}/*.la -#%{_libdir}/kde3/*.so -#%{_libdir}/kde3/*.la -%{_datadir}/apps/kita/*ui.rc -%{_datadir}/apps/kita/icons/*/*/*/* -#%{_datadir}/apps/konqsidebartng/*/* -%if %{use_xdg_menu} -%{_datadir}/applications/kita.desktop -%else -%{_datadir}/applnk/Internet/kita.desktop -%endif -#%{_datadir}/applnk/Settings/Network/kcm_k2ch.desktop -#%{_datadir}/config/kio_k2chrc -#%{_datadir}/services/* -#%{_datadir}/mimelnk/text/* -%{_datadir}/locale/ja/LC_MESSAGES/* -%{_datadir}/icons/*/*/*/* -%{_datadir}/doc/HTML/en/kita/* -%changelog -* Sun Nov 21 2004 Hideki Ikemoto<ikemo****@users*****> -- remove kitapart/kita*ui.rc - -* Sat Oct 07 2004 Hideki Ikemoto<ikemo****@users*****> -- set %%{_prefix} if SuSE - -* Sat May 15 2004 Hideki Ikemoto<ikemo****@users*****> -- add 'Serial' field (comment) - -* Sat Dec 13 2003 Hideki Ikemoto<ikemo****@users*****> -- don't use %%configure - -* Mon Oct 13 2003 Hideki Ikemoto<ikemo****@users*****> -- add files - -* Wed Mar 03 2003 Hideki Ikemoto<ikemo****@users*****> -- initial release. Copied: kita/trunk/kita.spec.cmake (from rev 2558, kita/branches/KITA-KDE4/kita.spec.cmake) =================================================================== --- kita/trunk/kita.spec.cmake (rev 0) +++ kita/trunk/kita.spec.cmake 2010-02-10 10:04:00 UTC (rev 2559) @@ -0,0 +1,107 @@ +Summary: 2ch client for KDE +Summary(ja): KDE ç¨ 2ch ãã©ã¦ã¶ +Name: kita +Version: @VERSION@ +Release: 1 +URL: http://sourceforge.jp/projects/kita/ +Source: kita-%{version}.tar.bz2 +License: GPL +Group: Application/Internet +BuildRoot: %{_tmppath}/%{name}-%{version}-root +%if 0%{?suse_version} +BuildRequires: libkde4-devel +%kde4_runtime_requires +%else +BuildRequires: gcc-c++ +BuildRequires: kdelibs-devel >= 4.2 +Requires: kdelibs >= 4.2 +%endif + +%description +Kita is a 2ch client for KDE. + +%description -l ja +Kita 㯠KDE ç¨ 2ch ãã©ã¦ã¶ã§ãã + +%prep +%setup -q + +%build +%if 0%{?suse_version} +%cmake_kde4 -d build +%make_jobs +%else +mkdir -p %{_target_platform} +pushd %{_target_platform} +%cmake_kde4 .. +popd +make %{?_smp_mflags} -C %{_target_platform} +%endif + +%install +%if 0%{?suse_version} +cd build +%makeinstall +%else +make install DESTDIR=%{buildroot} -C %{_target_platform} +%endif +strip --strip-unneeded %{buildroot}/%{_libdir}/lib%{name}*.so*.*.* +strip %{buildroot}/%{_bindir}/%{name} +rm %{buildroot}/%{_libdir}/lib%{name}*.so + +%if 0%{?suse_version} +%suse_update_desktop_file %{name} +%kde_post_install +%endif + +%clean +rm -rf %{buildroot} + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig +%files +%defattr(-, root, root) +#%doc AUTHORS COPYING ChangeLog NEWS README README.2ch TODO +%{_bindir}/%{name} +%{_libdir}/lib%{name}*.so* +%{_datadir}/applications/kde4/%{name}.desktop +%dir %{_datadir}/kde4/apps/%{name} +%{_datadir}/kde4/apps/%{name}/*ui.rc +%if 0%{?suse_version} +%{_datadir}/kde4/config.kcfg/*.kcfg +%else +%{_kde4_datadir}/config.kcfg/*.kcfg +%endif +%{_datadir}/icons/hicolor/16x16/actions/*.png +%{_datadir}/icons/hicolor/48x48/apps/%{name}.png +%lang(ja) %{_datadir}/locale/ja/LC_MESSAGES/%{name}.mo +%if 0%{?suse_version} +%dir %{_datadir}/doc/kde/HTML/en/%{name} +%{_datadir}/doc/kde/HTML/en/%{name}/common +%{_datadir}/doc/kde/HTML/en/%{name}/index.cache.bz2 +%{_datadir}/doc/kde/HTML/en/%{name}/index.docbook +%else +%dir %{_kde4_docdir}/HTML/en/%{name} +%{_kde4_docdir}/HTML/en/%{name}/common +%{_kde4_docdir}/HTML/en/%{name}/index.cache.bz2 +%{_kde4_docdir}/HTML/en/%{name}/index.docbook +%endif + +%changelog +* Sun Nov 21 2004 Hideki Ikemoto<ikemo****@users*****> - 0.173.0 +- remove kitapart/kita*ui.rc + +* Sat Oct 07 2004 Hideki Ikemoto<ikemo****@users*****> +- set %%{_prefix} if SuSE + +* Sat May 15 2004 Hideki Ikemoto<ikemo****@users*****> +- add 'Serial' field (comment) + +* Sat Dec 13 2003 Hideki Ikemoto<ikemo****@users*****> +- don't use %%configure + +* Mon Oct 13 2003 Hideki Ikemoto<ikemo****@users*****> +- add files + +* Wed Mar 03 2003 Hideki Ikemoto<ikemo****@users*****> +- initial release.