svnno****@sourc*****
svnno****@sourc*****
2009年 7月 18日 (土) 16:11:43 JST
Revision: 2424 http://sourceforge.jp/projects/kita/svn/view?view=rev&revision=2424 Author: nogu Date: 2009-07-18 16:11:43 +0900 (Sat, 18 Jul 2009) Log Message: ----------- namespace Kita Modified Paths: -------------- kita/branches/KITA-KDE4/kita/src/bbstabwidget.cpp kita/branches/KITA-KDE4/kita/src/bbstabwidget.h kita/branches/KITA-KDE4/kita/src/bbsview.cpp kita/branches/KITA-KDE4/kita/src/bbsview.h kita/branches/KITA-KDE4/kita/src/boardtabwidget.cpp kita/branches/KITA-KDE4/kita/src/boardtabwidget.h kita/branches/KITA-KDE4/kita/src/boardview.cpp kita/branches/KITA-KDE4/kita/src/boardview.h kita/branches/KITA-KDE4/kita/src/domtree.cpp kita/branches/KITA-KDE4/kita/src/domtree.h kita/branches/KITA-KDE4/kita/src/favoritelistview.cpp kita/branches/KITA-KDE4/kita/src/favoritelistview.h kita/branches/KITA-KDE4/kita/src/htmlpart.cpp kita/branches/KITA-KDE4/kita/src/htmlpart.h kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.cpp kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.h kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.cpp kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.h kita/branches/KITA-KDE4/kita/src/libkita/access.cpp kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.cpp kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.h kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h kita/branches/KITA-KDE4/kita/src/libkita/datmanager.cpp kita/branches/KITA-KDE4/kita/src/libkita/datmanager.h kita/branches/KITA-KDE4/kita/src/libkita/downloadmanager.h kita/branches/KITA-KDE4/kita/src/libkita/event.h kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.cpp kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.cpp kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.h kita/branches/KITA-KDE4/kita/src/libkita/flashcgi.cpp kita/branches/KITA-KDE4/kita/src/libkita/jbbs.cpp kita/branches/KITA-KDE4/kita/src/libkita/k2ch.cpp kita/branches/KITA-KDE4/kita/src/libkita/kita-utf16.h kita/branches/KITA-KDE4/kita/src/libkita/kita-utf8.h kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.cpp kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.h kita/branches/KITA-KDE4/kita/src/libkita/machibbs.cpp kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h kita/branches/KITA-KDE4/kita/src/libkita/thread.cpp kita/branches/KITA-KDE4/kita/src/libkita/thread.h kita/branches/KITA-KDE4/kita/src/libkita/threadindex.cpp kita/branches/KITA-KDE4/kita/src/libkita/threadindex.h kita/branches/KITA-KDE4/kita/src/libkita/threadinfo.cpp kita/branches/KITA-KDE4/kita/src/libkita/threadinfo.h kita/branches/KITA-KDE4/kita/src/main.cpp kita/branches/KITA-KDE4/kita/src/mainwindow.cpp kita/branches/KITA-KDE4/kita/src/mainwindow.h kita/branches/KITA-KDE4/kita/src/prefs/prefs.cpp kita/branches/KITA-KDE4/kita/src/prefs/prefs.h kita/branches/KITA-KDE4/kita/src/respopup.cpp kita/branches/KITA-KDE4/kita/src/respopup.h kita/branches/KITA-KDE4/kita/src/threadlistview.cpp kita/branches/KITA-KDE4/kita/src/threadlistview.h kita/branches/KITA-KDE4/kita/src/threadlistviewitem.h kita/branches/KITA-KDE4/kita/src/threadproperty.ui kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp kita/branches/KITA-KDE4/kita/src/threadtabwidget.h kita/branches/KITA-KDE4/kita/src/threadview.cpp kita/branches/KITA-KDE4/kita/src/threadview.h kita/branches/KITA-KDE4/kita/src/viewmediator.cpp kita/branches/KITA-KDE4/kita/src/viewmediator.h kita/branches/KITA-KDE4/kita/src/writedialogbase.ui kita/branches/KITA-KDE4/kita/src/writetabwidget.cpp kita/branches/KITA-KDE4/kita/src/writetabwidget.h kita/branches/KITA-KDE4/kita/src/writeview.cpp kita/branches/KITA-KDE4/kita/src/writeview.h Modified: kita/branches/KITA-KDE4/kita/src/bbstabwidget.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/bbstabwidget.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/bbstabwidget.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -14,40 +14,38 @@ #include "bbsview.h" -/*--------------------------------------------------------------*/ +using namespace Kita; - -KitaBBSTabWidget::KitaBBSTabWidget(QWidget* parent) - : KitaTabWidgetBase(parent) +BBSTabWidget::BBSTabWidget(QWidget* parent) : TabWidgetBase(parent) { - KitaBBSView * view = new KitaBBSView(this); + BBSView * view = new BBSView(this); addTab(view, i18n("board name")); } -KitaBBSTabWidget::~KitaBBSTabWidget() {} +BBSTabWidget::~BBSTabWidget() {} /* public slot */ -void KitaBBSTabWidget::showBoardList() +void BBSTabWidget::showBoardList() { - static_cast < KitaBBSView* > (widget(0)) ->showBoardList(); + static_cast<BBSView*>(widget(0))->showBoardList(); } -void KitaBBSTabWidget::updateBoardList() +void BBSTabWidget::updateBoardList() { - static_cast < KitaBBSView* > (widget(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* > (widget(0)) ->setFont(font); + static_cast<BBSView*>(widget(0))->setFont(font); } -void KitaBBSTabWidget::loadOpened() +void BBSTabWidget::loadOpened() { - static_cast < KitaBBSView* > (widget(0)) ->loadOpened(); + static_cast<BBSView*>(widget(0))->loadOpened(); } Modified: kita/branches/KITA-KDE4/kita/src/bbstabwidget.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/bbstabwidget.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/bbstabwidget.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -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,22 +14,23 @@ class QFont; -/*------------------------------------------------*/ +namespace Kita +{ + class BBSTabWidget : public TabWidgetBase + { + Q_OBJECT -class KitaBBSTabWidget : public KitaTabWidgetBase -{ - Q_OBJECT + public: + explicit BBSTabWidget(QWidget* parent); + ~BBSTabWidget(); -public: - explicit KitaBBSTabWidget(QWidget* parent); - ~KitaBBSTabWidget(); + public slots: + void showBoardList(); + void updateBoardList(); + void setFont(const QFont& font); + void loadOpened(); + }; +} -public slots: - void showBoardList(); - void updateBoardList(); - void setFont(const QFont& font); - void loadOpened(); -}; - #endif Modified: kita/branches/KITA-KDE4/kita/src/bbsview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/bbsview.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/bbsview.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -41,26 +41,22 @@ #include "libkita/favoriteboards.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 *, const char *name) - : m_favorites(0) +BBSView::BBSView(QWidget *, const char *name) : m_favorites(0) { /* copied from Base class */ - if (!name) - setObjectName("KitaBBSViewBase"); - KitaBBSViewBaseLayout = new QVBoxLayout(this); + BBSViewBaseLayout = new QVBoxLayout(this); layout10 = new QHBoxLayout(0); @@ -75,11 +71,11 @@ layout10->addWidget(SearchCombo); spacer2 = new QSpacerItem(467, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); layout10->addItem(spacer2); - KitaBBSViewBaseLayout->addLayout(layout10); + BBSViewBaseLayout->addLayout(layout10); m_boardList = new QTreeWidget(this); m_boardList->setRootIsDecorated(true); - KitaBBSViewBaseLayout->addWidget(m_boardList); + BBSViewBaseLayout->addWidget(m_boardList); resize(QSize(600, 482).expandedTo(minimumSizeHint())); setAttribute(Qt::WA_WState_Polished); /* copy end */ @@ -99,13 +95,13 @@ connect(m_boardList, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(slotContextMenuRequested(const QPoint&))); - connect(Kita::FavoriteBoards::getInstance(), SIGNAL(changed()), + connect(FavoriteBoards::getInstance(), SIGNAL(changed()), SLOT(refreshFavoriteBoards())); connect(SearchCombo, SIGNAL(textChanged(const QString&)), SLOT(filter(const QString&))); } -KitaBBSView::~KitaBBSView() +BBSView::~BBSView() { saveOpened(); } @@ -114,16 +110,16 @@ * download board list, parse, and write to "board_list" * * @see updateBoardList() - * @see KitaConfig::boardListURL() + * @see Config::boardListURL() */ -bool KitaBBSView::downloadBoardList() +bool BBSView::downloadBoardList() { // moved urls. QList<QString> oldURLs; QList<QString> newURLs; QString tmpFile; - QString url = Kita::Config::boardListUrl(); + QString url = Config::boardListUrl(); if (! KIO::NetAccess::download(url, tmpFile, 0)) { return false; } @@ -140,14 +136,14 @@ // parse QStringList list; - QList<Kita::Category> categoryList = getCategoryList(html); - QList<Kita::Category>::iterator it; + QList<Category> categoryList = getCategoryList(html); + QList<Category>::iterator it; /* Are there new boards or moved boards ? */ QString newBoards; QString oldBoards; for (it = categoryList.begin(); it != categoryList.end(); ++it) { - Kita::Category category = (*it); + Category category = (*it); QList<QString> board_url_list = category.boardURLList; if (board_url_list.isEmpty()) continue; @@ -158,14 +154,14 @@ QString boardURL = *it2; QString boardName = category.boardNameList[ count ]; QString oldURL; - int ret = Kita::BoardManager::enrollBoard( - boardURL, boardName, oldURL, Kita::Board_Unknown, + int ret = BoardManager::enrollBoard( + boardURL, boardName, oldURL, Board_Unknown, true /* test only */); - if (ret == Kita::Board_enrollNew) { + if (ret == Board_enrollNew) { newBoards += boardName + " ( " + category.category_name + " ) " + boardURL + '\n'; } - if (ret == Kita::Board_enrollMoved) { + if (ret == Board_enrollMoved) { oldBoards += boardName + " ( " + category.category_name + " ) " + oldURL + " -> " + boardURL + '\n'; } @@ -228,14 +224,14 @@ QString newURL = newURLs[ i ]; // qDebug("move %s -> %s", oldURL.latin1(), newURL.latin1()); - Kita::BoardManager::moveBoard(oldURL, newURL); + BoardManager::moveBoard(oldURL, newURL); } /* save config */ QString configPath = KStandardDirs::locateLocal("appdata", "board_list"); KConfig config(configPath); for (it = categoryList.begin(); it != categoryList.end(); ++it) { - Kita::Category category = (*it); + Category category = (*it); QList<QString> board_url_list = category.boardURLList; if (board_url_list.isEmpty()) { @@ -279,7 +275,7 @@ return true; } -void KitaBBSView::updateBoardList() +void BBSView::updateBoardList() { if (downloadBoardList()) showBoardList(); } @@ -290,7 +286,7 @@ * @see updateBoardList() * @see downloadBoardList() */ -void KitaBBSView::showBoardList() +void BBSView::showBoardList() { /* color setting */ /* @@ -315,15 +311,16 @@ 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); KConfigGroup group = config.group(category); - Kita::ListViewItem* categoryItem = new Kita::ListViewItem(m_boardList, previous, QStringList(category)); + ListViewItem* categoryItem = new ListViewItem( + m_boardList, previous, QStringList(category)); categoryItem->setColor(m_textColor.color(), m_baseColor.color()); - Kita::ListViewItem* previousBoard = 0; + ListViewItem* previousBoard = 0; for (int count = 0; ; count++) { QString key = QString("item%1").arg(count); @@ -340,9 +337,10 @@ continue; } QString oldURL; - Kita::BoardManager::enrollBoard(boardURL, boardName, oldURL); - Kita::BoardManager::loadBBSHistory(boardURL); - previousBoard = new Kita::ListViewItem(categoryItem, previousBoard, QStringList() << boardName << boardURL); + BoardManager::enrollBoard(boardURL, boardName, oldURL); + BoardManager::loadBBSHistory(boardURL); + previousBoard = new ListViewItem(categoryItem, previousBoard, + QStringList() << boardName << boardURL); previousBoard->setColor(m_textColor.color(), m_baseColor.color()); } previous = categoryItem; @@ -351,9 +349,8 @@ QString boardURL = "http://jbbs.livedoor.jp/computer/18420/" ; QString boardName = i18n("Kita Board"); QString oldURL; - new Kita::ListViewItem(m_boardList, 0, - QStringList() << boardName << boardURL); - Kita::BoardManager::enrollBoard(boardURL, boardName, oldURL); + new ListViewItem(m_boardList, 0, QStringList() << boardName << boardURL); + BoardManager::enrollBoard(boardURL, boardName, oldURL); loadExtBoard(); refreshFavoriteBoards(); @@ -361,7 +358,7 @@ /* private */ -void KitaBBSView::loadExtBoard() +void BBSView::loadExtBoard() { QString configPath = KStandardDirs::locateLocal("appdata", "extbrd.conf"); QFile file(configPath); @@ -373,8 +370,8 @@ QStringList list; QString str; - Kita::ListViewItem* categoryItem - = new Kita::ListViewItem(m_boardList, QStringList("extboard")); + ListViewItem* categoryItem + = new ListViewItem(m_boardList, QStringList("extboard")); categoryItem->setColor(m_textColor.color(), m_baseColor.color()); while (!(str = stream.readLine()).isEmpty()) { @@ -385,15 +382,14 @@ QString board_title = list[ 0 ]; QString board_url = list[ 1 ]; - Kita::ListViewItem* tmpitem - = new Kita::ListViewItem(categoryItem, + ListViewItem* tmpitem = new ListViewItem(categoryItem, QStringList() << board_title << board_url); tmpitem->setColor( m_textColor.color(), m_baseColor.color()); QString oldURL; - int type = Kita::Board_Unknown; + int type = Board_Unknown; if (list.size() == 3) type = list[ 2 ].toInt(); - Kita::BoardManager::enrollBoard( + BoardManager::enrollBoard( board_url, board_title, oldURL, type); } } @@ -403,19 +399,19 @@ } } -QList<Kita::Category> KitaBBSView::getCategoryList(const QString& html) const +QList<Category> BBSView::getCategoryList(const QString& html) const { - QList<Kita::Category> result; + QList<Category> result; QStringList lines = html.split('\n'); QStringList::iterator it; - Kita::Category current_category; + 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); + QString category_name = getCategory(*it); if (!category_name.isEmpty()) { if (!current_category.category_name.isEmpty()) { result.append(current_category); @@ -428,7 +424,7 @@ if (regexp.indexIn((*it)) != -1) { QString url = regexp.cap(1); QString title = regexp.cap(2); - if (Kita::isBoardURL(url) + if (isBoardURL(url) && !current_category.category_name.isEmpty()) { current_category.boardNameList.append(title); current_category.boardURLList.append(url); @@ -439,10 +435,10 @@ return result; } -void KitaBBSView::refreshFavoriteBoards() +void BBSView::refreshFavoriteBoards() { if (! m_favorites) { - m_favorites = new Kita::ListViewItem(m_boardList, + m_favorites = new ListViewItem(m_boardList, QStringList(i18n("Favorites"))); } m_favorites->setColor(m_textColor.color(), m_baseColor.color()); @@ -454,26 +450,25 @@ } while (m_favorites->childCount() != 0); // insert items. - QList<KUrl> boards = Kita::FavoriteBoards::boards(); + 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); + QString boardName = BoardManager::boardName(boardURL); - Kita::ListViewItem* item - = new Kita::ListViewItem(m_favorites, + ListViewItem* item = new ListViewItem(m_favorites, QStringList() << boardName << boardURL); item->setColor(m_textColor.color(), m_baseColor.color()); } } -void KitaBBSView::loadBoard(QTreeWidgetItem* item) +void BBSView::loadBoard(QTreeWidgetItem* item) { if (! item) return ; QString boardName = item->text(0); - QString boardURL = Kita::BoardManager::boardURL(item->text(1)); + QString boardURL = BoardManager::boardURL(item->text(1)); if (boardURL.isEmpty()) { return ; @@ -482,19 +477,19 @@ ViewMediator::getInstance()->openBoard(boardURL); } -void KitaBBSView::setFont(const QFont& font) +void BBSView::setFont(const QFont& font) { m_boardList->setFont(font); SearchCombo->setFont(font); } /* public slot :*/ /* virtual */ -void KitaBBSView::setFocus() +void BBSView::setFocus() { m_boardList->setFocus(); } -void KitaBBSView::slotMenuOpenWithBrowser() +void BBSView::slotMenuOpenWithBrowser() { QTreeWidgetItem* item = m_boardList->currentItem(); QString boardName = item->text(0); @@ -502,7 +497,7 @@ KRun::runUrl(boardURL, "text/html", 0); } -void KitaBBSView::slotContextMenuRequested(const QPoint& point) +void BBSView::slotContextMenuRequested(const QPoint& point) { QTreeWidgetItem* item = m_boardList->itemAt(point); if (item == 0) { @@ -510,7 +505,7 @@ } KMenu popup(0); - + KAction* openWithBrowserAct = new KAction(i18n("Open with Web Browser"), this); popup.addAction(openWithBrowserAct); @@ -535,7 +530,7 @@ QString boardName = item->text(0); KUrl boardURL = item->text(1); - KUrl boardURL_upToDate = Kita::BoardManager::boardURL(boardURL); + KUrl boardURL_upToDate = BoardManager::boardURL(boardURL); QClipboard* clipboard = QApplication::clipboard(); QAction *action = popup.exec(point); @@ -553,13 +548,13 @@ clipboard->setText(boardName + '\n' + boardURL_upToDate.prettyUrl(), QClipboard::Selection); } else if (action == addToFavoritesAct) { - Kita::FavoriteBoards::append(boardURL_upToDate); + FavoriteBoards::append(boardURL_upToDate); } else if (action == removeFromFavoritesAct) { - Kita::FavoriteBoards::remove(boardURL); + FavoriteBoards::remove(boardURL); } } -void KitaBBSView::loadOpened() +void BBSView::loadOpened() { QString configPath = KStandardDirs::locateLocal("appdata", "board_state.conf"); @@ -577,7 +572,7 @@ } } -void KitaBBSView::saveOpened() +void BBSView::saveOpened() { QStringList openedList; for (int i = 0, j = m_boardList->topLevelItemCount(); i < j; i++) { @@ -599,7 +594,7 @@ * * @param str string to search. */ -void KitaBBSView::filter(const QString& str) +void BBSView::filter(const QString& str) { for (int i = 0, j = m_boardList->topLevelItemCount(); i < j; i++) { @@ -621,13 +616,13 @@ } -void KitaBBSView::mousePressEvent(QMouseEvent *e) +void BBSView::mousePressEvent(QMouseEvent *e) { QTreeWidgetItem* item = m_boardList->itemAt(e->pos()); if (!item) return; QString boardName = item->text(0); - QString boardURL = Kita::BoardManager::boardURL(item->text(1)); + QString boardURL = BoardManager::boardURL(item->text(1)); if (boardURL.isEmpty()) { item->setExpanded(!item->isExpanded()); return ; Modified: kita/branches/KITA-KDE4/kita/src/bbsview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/bbsview.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/bbsview.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITABBSVIEW_H #define KITABBSVIEW_H @@ -28,58 +27,58 @@ 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 */ - QBrush m_textColor; - QBrush m_baseColor; - QColor m_backColor; + /* list color */ + QBrush m_textColor; + QBrush m_baseColor; + QColor m_backColor; - QList<Kita::Category> getCategoryList(const QString& html) const; + QList<Category> getCategoryList(const QString& html) const; - void saveOpened(); - KComboBox* SearchCombo; - QTreeWidget* m_boardList; + void saveOpened(); + KComboBox* SearchCombo; + QTreeWidget* m_boardList; -protected: - QVBoxLayout* KitaBBSViewBaseLayout; - QHBoxLayout* layout10; - QSpacerItem* spacer2; + protected: + QVBoxLayout* BBSViewBaseLayout; + QHBoxLayout* layout10; + QSpacerItem* spacer2; -private slots: - void loadBoard(QTreeWidgetItem* item); - void slotContextMenuRequested(const QPoint&); - void refreshFavoriteBoards(); - void filter(const QString& str); - void slotMenuOpenWithBrowser(); + private slots: + void loadBoard(QTreeWidgetItem* item); + void slotContextMenuRequested(const QPoint&); + void refreshFavoriteBoards(); + void filter(const QString& str); + void slotMenuOpenWithBrowser(); -public: - explicit KitaBBSView(QWidget *parent, const char *name = 0); - ~KitaBBSView(); + public: + explicit BBSView(QWidget *parent, const char *name = 0); + ~BBSView(); - 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); - KitaBBSView(const KitaBBSView&); - KitaBBSView& operator=(const KitaBBSView&); -}; + private: + void loadExtBoard(); + bool downloadBoardList(); + void mousePressEvent(QMouseEvent *e); + BBSView(const BBSView&); + BBSView& operator=(const BBSView&); + }; +} #endif Modified: kita/branches/KITA-KDE4/kita/src/boardtabwidget.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/boardtabwidget.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/boardtabwidget.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -24,8 +24,9 @@ #include "viewmediator.h" #include "libkita/boardmanager.h" -KitaBoardTabWidget::KitaBoardTabWidget(QWidget* parent) - : KitaTabWidgetBase(parent) +using namespace Kita; + +BoardTabWidget::BoardTabWidget(QWidget* parent) : TabWidgetBase(parent) { setXMLFile("boardtabwidgetui.rc"); @@ -39,13 +40,13 @@ 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(widget(i)); + BoardView* view = isSubjectView(widget(i)); if(view) { view->slotUpdateSubject(datURL); } @@ -53,10 +54,10 @@ } /* public slots */ -void KitaBoardTabWidget::loadBoard(const KUrl& boardURL) +void BoardTabWidget::loadBoard(const KUrl& boardURL) { - KitaBoardView * view = findView(boardURL); - QString boardName = Kita::BoardManager::boardName(boardURL); + BoardView * view = findView(boardURL); + QString boardName = BoardManager::boardName(boardURL); if (!view) { view = createView(boardName); } @@ -67,10 +68,10 @@ } } -/* create KitaBoardView */ /* private */ -KitaBoardView* KitaBoardTabWidget::createView(QString label) +/* create BoardView */ /* private */ +BoardView* BoardTabWidget::createView(QString label) { - KitaBoardView * view = new KitaBoardView(this); + BoardView * view = new BoardView(this); if (view) { insertTab(count() - 1, view, label); } @@ -79,14 +80,14 @@ } /* private */ -KitaBoardView* KitaBoardTabWidget::findView(const KUrl& boardURL) +BoardView* BoardTabWidget::findView(const KUrl& boardURL) { int max = count() - 1; if (max <= 0) return 0; int i = 0; while (i < max) { - KitaBoardView * view = isSubjectView(widget(i)); + BoardView * view = isSubjectView(widget(i)); if (view && view->boardURL() == boardURL) return view; i++; } @@ -96,9 +97,9 @@ /* protected */ /* virtual */ -void KitaBoardTabWidget::deleteWidget(QWidget* w) +void BoardTabWidget::deleteWidget(QWidget* w) { - KitaBoardView * view = isSubjectView(w); + BoardView * view = isSubjectView(w); if (!view) return ; removePage(view); delete view; @@ -106,21 +107,21 @@ /* private */ -KitaBoardView* KitaBoardTabWidget::isSubjectView(QWidget* w) +BoardView* BoardTabWidget::isSubjectView(QWidget* w) { - KitaBoardView * view = 0; + BoardView * view = 0; if (w) { - if (w->inherits("KitaBoardView")) view = static_cast< KitaBoardView* >(w); + if (w->inherits("BoardView")) view = static_cast<BoardView*>(w); } return view; } /*--------------------------------*/ -/* KitaBoardView actions */ +/* BoardView actions */ /* private */ -void KitaBoardTabWidget::setupActions() +void BoardTabWidget::setupActions() { KAction* find_action = actionCollection()->addAction("subjectview_find"); find_action->setText(i18n("Find")); @@ -138,23 +139,23 @@ } /* public slot */ -void KitaBoardTabWidget::slotReloadButton() +void BoardTabWidget::slotReloadButton() { - KitaBoardView * view = isSubjectView(currentWidget()); + BoardView * view = isSubjectView(currentWidget()); if (view) view->reloadSubject(); } /* public slot */ -void KitaBoardTabWidget::slotFocusSearchCombo() +void BoardTabWidget::slotFocusSearchCombo() { - KitaBoardView * view = isSubjectView(currentWidget()); + BoardView * view = isSubjectView(currentWidget()); if (view) view->slotFocusSearchCombo(); } /* public slot */ -void KitaBoardTabWidget::slotShowOldLogs(int idx) +void BoardTabWidget::slotShowOldLogs(int idx) { - KitaBoardView * view; + BoardView * view; if (idx == -1) view = isSubjectView(currentWidget()); else view = isSubjectView(widget(idx)); if (view) view->toggleShowOldLogs(); @@ -180,7 +181,7 @@ /* private */ /* virtual */ void SubjectTabBar::showPopupMenu(int idx, const QPoint& global) { - KitaBoardTabWidget* tabwidget = static_cast<KitaBoardTabWidget*>(parentWidget()); + BoardTabWidget* tabwidget = static_cast<BoardTabWidget*>(parentWidget()); KActionCollection * collection = tabwidget->actionCollection(); if (QString::compare(tabwidget->widget(idx) ->objectName(), "favoriteTab") == 0) return ; @@ -213,11 +214,11 @@ KAction* copyTitleAct = new KAction(i18n("Copy title and URL"), this); popup.addAction(copyTitleAct); - + popup.addSeparator(); popup.addAction(collection->action("tab_configkeys")); - KitaBoardView* subjectView = static_cast<KitaBoardView *>(tabwidget->widget(idx)); + BoardView* subjectView = static_cast<BoardView *>(tabwidget->widget(idx)); QClipboard* clipboard = QApplication::clipboard(); QAction* action = popup.exec(global); @@ -237,7 +238,8 @@ } else if (action == openBrowserAct) { KRun::runUrl(subjectView->boardURL(), "text/html", this); } else if (action == copyTitleAct) { - QString cliptxt = Kita::BoardManager::boardName(subjectView->boardURL()) + '\n' + subjectView->boardURL().prettyUrl(); + QString cliptxt = BoardManager::boardName(subjectView->boardURL()) + + '\n' + subjectView->boardURL().prettyUrl(); clipboard->setText(cliptxt , QClipboard::Clipboard); clipboard->setText(cliptxt , QClipboard::Selection); } Modified: kita/branches/KITA-KDE4/kita/src/boardtabwidget.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/boardtabwidget.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/boardtabwidget.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,63 +7,65 @@ * 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" -class KitaBoardView; +namespace Kita { -/** - @ author Hideki Ikemoto -*/ -class KitaBoardTabWidget : public KitaTabWidgetBase -{ - Q_OBJECT + class BoardView; -public: - explicit KitaBoardTabWidget(QWidget* parent = 0); - ~KitaBoardTabWidget(); + /** + * @author Hideki Ikemoto + */ + class BoardTabWidget : public TabWidgetBase + { + Q_OBJECT - void updateBoardView(const KUrl& datURL); -public slots: - void loadBoard(const KUrl&); + public: + explicit BoardTabWidget(QWidget* parent = 0); + ~BoardTabWidget(); -private: - KitaBoardView* createView(QString label); - KitaBoardView* findView(const KUrl& boardURL); - KitaBoardView* isSubjectView(QWidget* w); + void updateBoardView(const KUrl& datURL); + public slots: + void loadBoard(const KUrl&); -protected: - virtual void deleteWidget(QWidget* w); + private: + BoardView* createView(QString label); + BoardView* findView(const KUrl& boardURL); + BoardView* isSubjectView(QWidget* w); + protected: + virtual void deleteWidget(QWidget* w); - /* tab actions */ -private: - void setupActions(); + /* tab actions */ -public slots: - void slotReloadButton(); - void slotFocusSearchCombo(); - void slotShowOldLogs(int idx = -1); -}; + 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); - ~SubjectTabBar(); + public: + 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); -}; + }; +} #endif Modified: kita/branches/KITA-KDE4/kita/src/boardview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/boardview.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/boardview.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -36,8 +36,9 @@ #include "libkita/threadindex.h" #include "libkita/threadinfo.h" -KitaBoardView::KitaBoardView(KitaBoardTabWidget* parent) - : Kita::ThreadListView(parent) +using namespace Kita; + +BoardView::BoardView(BoardTabWidget* parent) : ThreadListView(parent) { init(); m_parent = parent; @@ -61,7 +62,7 @@ } /* public */ -void KitaBoardView::init() +void BoardView::init() { m_unreadNum = 0; m_readNum = 0; @@ -71,7 +72,7 @@ } -void KitaBoardView::reloadSubject() +void BoardView::reloadSubject() { if (! m_boardURL.isEmpty()) { loadBoard(m_boardURL); @@ -80,24 +81,24 @@ /* private slot */ -void KitaBoardView::slotCloseButton() +void BoardView::slotCloseButton() { m_parent->slotCloseCurrentTab(); } -const KUrl KitaBoardView::boardURL() +const KUrl BoardView::boardURL() { return m_boardURL; } -void KitaBoardView::toggleShowOldLogs() +void BoardView::toggleShowOldLogs() { m_showOldLogs = !m_showOldLogs; loadBoard(m_boardURL, false); } -void KitaBoardView::loadThread(QTableWidgetItem* item) +void BoardView::loadThread(QTableWidgetItem* item) { if (! item) return ; @@ -115,7 +116,7 @@ Thread_HasUnread }; -void KitaBoardView::loadBoard(const KUrl& url, bool online) +void BoardView::loadBoard(const KUrl& url, bool online) { activateWindow(); topLevelWidget() ->raise(); @@ -135,9 +136,9 @@ m_newNum = 0; /* get list of pointers of Thread classes */ - QList<Kita::Thread*> oldLogList; - QList<Kita::Thread*> threadList; - Kita::BoardManager::getThreadList( + QList<Thread*> oldLogList; + QList<Thread*> threadList; + BoardManager::getThreadList( m_boardURL, m_showOldLogs, online, threadList, oldLogList); // reset list @@ -153,11 +154,11 @@ int count = countNew + countOld; subjectList->setRowCount(count); for (int i = 0; i < count; i++) { - Kita::Thread* thread + 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++) { - Kita::ThreadListViewItem* item = new Kita::ThreadListViewItem(j); + ThreadListViewItem* item = new ThreadListViewItem(j); subjectList->setItem(i, j, item); } int id = (i < countNew ? i + 1 : 0); @@ -170,11 +171,11 @@ } ViewMediator::getInstance()->setMainURLLine(m_boardURL); - switch (Kita::Config::listSortOrder()) { - case Kita::Config::EnumListSortOrder::Mark: + switch (Config::listSortOrder()) { + case Config::EnumListSortOrder::Mark: subjectList->sortItems(ColumnMark); break; - case Kita::Config::EnumListSortOrder::ID: + case Config::EnumListSortOrder::ID: subjectList->sortItems(ColumnId); break; default: @@ -201,13 +202,13 @@ } /* public slot */ /* virtual */ -void KitaBoardView::setFocus() +void BoardView::setFocus() { subjectList->setFocus(); } /* public slot */ -void KitaBoardView::slotFocusSearchCombo() +void BoardView::slotFocusSearchCombo() { if (! SearchCombo->hasFocus()) { SearchCombo->setFocus(); @@ -216,7 +217,7 @@ } } -void KitaBoardView::updateKindLabel() +void BoardView::updateKindLabel() { QString fmtstr; fmtstr += QString("<font color=#C50000>%1</font>").arg(m_unreadNum); @@ -225,17 +226,17 @@ kindLabel->setText(fmtstr); } -void KitaBoardView::setFont(const QFont& font) +void BoardView::setFont(const QFont& 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); + KUrl datURL = getDatURL(url); for (int i = 0, j = subjectList->rowCount(); i < j; i++) { if (subjectList->item(i, ColumnDatUrl)->text() == datURL.prettyUrl()) { @@ -246,7 +247,7 @@ case Thread_HasUnread : m_unreadNum--; break; } - Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + 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(); @@ -264,16 +265,16 @@ /* if id == 0, this thread is old thread. */ /* private */ -void KitaBoardView::updateListViewItem(QTableWidgetItem* item, +void BoardView::updateListViewItem(QTableWidgetItem* item, const KUrl& datURL, const QDateTime& current, int id, int order) { int row = item->row(); 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); + since.setTime_t(datToSince(datURL)); + QString threadName = DatManager::threadName(datURL); + int resNum = DatManager::getResNum(datURL); + int readNum = DatManager::getReadNum(datURL); + int viewPos = DatManager::getViewPos(datURL); double speed = resNum / (since.secsTo(current) / (60.0 * 60.0 * 24.0)); if (id) subjectList->item(row, ColumnId)->setText(QString::number(id)); @@ -308,7 +309,7 @@ subjectList->item(row, ColumnMarkOrder) ->setText(QString::number((viewPos > 1000) ? Thread_Readed : Thread_Read)); - } else if (since.secsTo(current) < 3600 * Kita::Config::markTime()) { + } else if (since.secsTo(current) < 3600 * Config::markTime()) { /* new thread */ subjectList->item(row, ColumnMark) ->setIcon(QIcon(SmallIcon("newthread"))); @@ -322,13 +323,13 @@ } // no effect: m_unreadNum, m_readNum, m_newNum, markOrder - if (Kita::DatManager::isMainThreadOpened(datURL) && resNum == readNum) { + if (DatManager::isMainThreadOpened(datURL) && resNum == readNum) { /* opened */ subjectList->item(row, ColumnMark)->setIcon(QIcon(SmallIcon("open"))); } } -void KitaBoardView::slotContextMenuRequested(const QPoint& point) +void BoardView::slotContextMenuRequested(const QPoint& point) { QTableWidgetItem* item = subjectList->itemAt(point); if (item == 0) { @@ -336,7 +337,7 @@ } QString datURL = subjectList->item(item->row(), ColumnDatUrl)->text(); - QString threadURL = Kita::DatManager::threadURL(datURL); + QString threadURL = DatManager::threadURL(datURL); bool isFavorites = FavoriteThreads::getInstance()->contains(datURL); // create popup menu. @@ -360,7 +361,7 @@ popup.addAction(favoritesAct); KAction* deleteLogAct = 0; - if (Kita::DatManager::getReadNum(datURL)) { + if (DatManager::getReadNum(datURL)) { popup.addSeparator(); deleteLogAct = new KAction(i18n("Delete Log"), this); @@ -385,7 +386,7 @@ clipboard->setText(threadURL, QClipboard::Clipboard); clipboard->setText(threadURL, QClipboard::Selection); } else if (action == copyTitleAndURLAct) { - cliptxt = Kita::DatManager::threadName(datURL) + '\n' + threadURL; + cliptxt = DatManager::threadName(datURL) + '\n' + threadURL; clipboard->setText(cliptxt , QClipboard::Clipboard); clipboard->setText(cliptxt , QClipboard::Selection); } else if (action == favoritesAct) { @@ -394,52 +395,52 @@ deleteLog(threadURL); } else if (action == propertyAct) { QWidget* widget = new QWidget; - Kita::Ui::ThreadProperty* propertyWidget - = new Kita::Ui::ThreadProperty; + Ui::ThreadProperty* propertyWidget + = new Ui::ThreadProperty; propertyWidget->setupUi(widget); propertyWidget->threadURLLabel->setText(threadURL); propertyWidget->datURLLabel->setText(datURL); propertyWidget->threadNameLabel-> - setText(Kita::DatManager::threadName(datURL)); + setText(DatManager::threadName(datURL)); propertyWidget->cachePathLabel-> - setText(Kita::DatManager::getCachePath(datURL)); + setText(DatManager::getCachePath(datURL)); propertyWidget->indexPathLabel-> - setText(Kita::DatManager::getCacheIndexPath(datURL)); + setText(DatManager::getCacheIndexPath(datURL)); propertyWidget->resNumLabel-> - setText(QString::number(Kita::DatManager::getResNum(datURL))); + setText(QString::number(DatManager::getResNum(datURL))); propertyWidget->readNumLabel-> - setText(QString::number(Kita::DatManager::getReadNum(datURL))); + setText(QString::number(DatManager::getReadNum(datURL))); propertyWidget->viewPosLabel-> - setText(QString::number(Kita::DatManager::getViewPos(datURL))); + setText(QString::number(DatManager::getViewPos(datURL))); propertyWidget->idx_threadNameWithIndexLabel-> - setText(Kita::ThreadIndex::getSubject(datURL)); + setText(ThreadIndex::getSubject(datURL)); propertyWidget->idx_resNumLabel-> - setText(QString::number(Kita::ThreadIndex::getResNum(datURL))); + setText(QString::number(ThreadIndex::getResNum(datURL))); propertyWidget->idx_readNumLabel-> - setText(QString::number(Kita::ThreadIndex::getReadNum(datURL))); + setText(QString::number(ThreadIndex::getReadNum(datURL))); propertyWidget->idx_viewPosLabel-> - setText(QString::number(Kita::ThreadIndex::getViewPos(datURL))); + setText(QString::number(ThreadIndex::getViewPos(datURL))); propertyWidget->cache_readNumLabel-> - setText(QString::number(KitaThreadInfo::readNum(datURL))); + setText(QString::number(ThreadInfo::readNum(datURL))); widget->show(); } } -void KitaBoardView::deleteLog(const KUrl& url) +void BoardView::deleteLog(const KUrl& url) { if (KMessageBox::warningYesNo(this, i18n("Do you want to delete Log ?"), "Kita") == KMessageBox::Yes) { - if (Kita::DatManager::deleteCache(url)) { + if (DatManager::deleteCache(url)) { ViewMediator::getInstance()->closeThreadTab(url); slotUpdateSubject(url); } } } -void KitaBoardView::slotSizeChange(int section, int oldSize, int newSize) +void BoardView::slotSizeChange(int section, int oldSize, int newSize) { if (! m_enableSizeChange) return ; if (autoResize()) return ; @@ -450,7 +451,7 @@ // subjectList->saveLayout(&config, "Layout"); TODO } -void KitaBoardView::loadLayout() +void BoardView::loadLayout() { if (autoResize()) return ; QString configPath @@ -459,7 +460,7 @@ // subjectList->restoreLayout(&config, "Layout"); TODO } -bool KitaBoardView::eventFilter(QObject* watched, QEvent* e) +bool BoardView::eventFilter(QObject* watched, QEvent* e) { if (e->type() == QEvent::MouseButtonPress) { QMouseEvent * mouseEvent = static_cast<QMouseEvent *>(e); @@ -502,7 +503,7 @@ } } -void KitaBoardView::saveHeaderOnOff() +void BoardView::saveHeaderOnOff() { QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); @@ -518,7 +519,7 @@ } } -void KitaBoardView::loadHeaderOnOff() +void BoardView::loadHeaderOnOff() { QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); @@ -536,7 +537,7 @@ } } -bool KitaBoardView::autoResize() +bool BoardView::autoResize() { QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); @@ -545,7 +546,7 @@ return config.group("Column").readEntry("AutoResize", true); } -void KitaBoardView::setAutoResize(bool flag) +void BoardView::setAutoResize(bool flag) { QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); Modified: kita/branches/KITA-KDE4/kita/src/boardview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/boardview.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/boardview.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITABOARDVIEW_H #define KITABOARDVIEW_H @@ -19,59 +18,62 @@ 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: - explicit KitaBoardView(KitaBoardTabWidget* parent); - 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(QTableWidgetItem* item, const KUrl& datURL, + private: + KUrl m_boardURL; + int m_unreadNum, m_readNum, m_newNum; + bool m_showOldLogs; + bool m_enableSizeChange; + + void updateKindLabel(); + void deleteLog(const KUrl& url); + void loadLayout(); + void updateListViewItem(QTableWidgetItem* 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); - KitaBoardView(const KitaBoardView&); - KitaBoardView& operator=(const KitaBoardView&); + bool eventFilter(QObject* watched, QEvent* e); + void saveHeaderOnOff(); + void loadHeaderOnOff(); + bool autoResize(); + void setAutoResize(bool flag); + BoardView(const BoardView&); + BoardView& operator=(const BoardView&); -private slots: - void loadThread(QTableWidgetItem* item); - void slotContextMenuRequested(const QPoint&); - void slotCloseButton(); - void slotSizeChange(int section, int oldSize, int newSize); + private slots: + void loadThread(QTableWidgetItem* item); + void slotContextMenuRequested(const QPoint&); + void slotCloseButton(); + void slotSizeChange(int section, int oldSize, int newSize); -signals: - void loadBoardCompleted(const KUrl&); -}; + signals: + void loadBoardCompleted(const KUrl&); + }; +} #endif Modified: kita/branches/KITA-KDE4/kita/src/domtree.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/domtree.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/domtree.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -20,7 +20,9 @@ #include "libkita/kita_misc.h" #include "libkita/kita-utf8.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; @@ -32,22 +34,22 @@ 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::getDatInfoPointer(datURL); } -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 != 0); - if (num < m_bufSize && m_resStatus[ num ] != KITA_HTML_NOTPARSED) { + if (num < m_bufSize && m_resStatus[ num ] != HTML_NOTPARSED) { /* already parsed */ return true; } @@ -75,7 +77,7 @@ QString titleHTML, bodyHTML; m_resStatus[ num ] = m_datInfo->getHTML(num, true, titleHTML, bodyHTML); - if (m_resStatus[ num ] == KITA_HTML_NOTPARSED) { + if (m_resStatus[ num ] == HTML_NOTPARSED) { return false; } @@ -95,7 +97,7 @@ /* * append the response */ -bool KitaDomTree::appendRes(int num) +bool DomTree::appendRes(int num) { if (!createResElement(num)) return false; @@ -110,7 +112,7 @@ /* * redraw all */ -void KitaDomTree::redraw(bool force) +void DomTree::redraw(bool force) { Q_ASSERT(m_datInfo != 0); @@ -136,11 +138,11 @@ /* * 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)) { @@ -149,7 +151,7 @@ } } -int KitaDomTree::getBottomResNumber() const +int DomTree::getBottomResNumber() const { return m_bottomNum; } @@ -157,7 +159,7 @@ /* * append footer & header */ -void KitaDomTree::appendFooterAndHeader() +void DomTree::appendFooterAndHeader() { Q_ASSERT(m_datInfo != 0); @@ -174,7 +176,7 @@ /* * append kokomadeyonda */ -void KitaDomTree::appendKokoyon() +void DomTree::appendKokoyon() { Q_ASSERT(m_datInfo != 0); @@ -197,7 +199,7 @@ /* * append "A" Node to rootnode */ -void KitaDomTree::appendAnchorNode(const DOM::Element& root, 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; @@ -217,7 +219,7 @@ * 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 ; @@ -262,7 +264,7 @@ * 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 != 0); @@ -297,7 +299,7 @@ /* * create header node */ -void KitaDomTree::createHeader() +void DomTree::createHeader() { QString str; DOM::Element rootnode; @@ -307,11 +309,11 @@ rootnode.setAttribute("kita_type", "header"); rootnode.setAttribute("id", "header"); - str = Kita::utf8ToUnicode(KITAUTF8_KOKOYON); + str = utf8ToUnicode(KITAUTF8_KOKOYON); appendAnchorNode(rootnode, "#kokomade_yonda", str); rootnode.appendChild(m_hdoc.createTextNode(" ")); - str = Kita::utf8ToUnicode(KITAUTF8_SAIGO); + str = utf8ToUnicode(KITAUTF8_SAIGO); appendAnchorNode(rootnode, "#tosaigo", str); rootnode.appendChild(m_hdoc.createElement("BR")); @@ -325,7 +327,7 @@ /* * create footer node */ -void KitaDomTree::createFooter() +void DomTree::createFooter() { QString str; DOM::Element rootnode; @@ -335,11 +337,11 @@ rootnode.setAttribute("kita_type", "footer"); rootnode.setAttribute("id", "footer"); - str = Kita::utf8ToUnicode(KITAUTF8_KOKOYON); + str = utf8ToUnicode(KITAUTF8_KOKOYON); appendAnchorNode(rootnode, "#kokomade_yonda", str); rootnode.appendChild(m_hdoc.createTextNode(" ")); - str = Kita::utf8ToUnicode(KITAUTF8_SAIGO); + str = utf8ToUnicode(KITAUTF8_SAIGO); appendAnchorNode(rootnode, "#tosaigo", str); } @@ -349,12 +351,12 @@ /* * create kokomadeyonda node */ -void KitaDomTree::createKokoyon() +void DomTree::createKokoyon() { QString str, style; DOM::Element rootnode; - str = Kita::utf8ToUnicode(KITAUTF8_KOKOYON2); + str = utf8ToUnicode(KITAUTF8_KOKOYON2); rootnode = m_hdoc.createElement("DIV"); { @@ -371,7 +373,7 @@ * 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 ; Modified: kita/branches/KITA-KDE4/kita/src/domtree.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/domtree.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/domtree.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITADOMTREE_H #define KITADOMTREE_H @@ -19,58 +18,64 @@ namespace Kita { class DatInfo; -} -class KitaDomTree -{ - KitaDomTree(const KitaDomTree&); - KitaDomTree& operator=(const KitaDomTree&); + class DomTree + { + DomTree(const DomTree&); + DomTree& operator=(const DomTree&); - Kita::DatInfo* m_datInfo; - int m_bufSize; + DatInfo* m_datInfo; + int m_bufSize; - /* bottom number of shown. probably m_bottomNum == m_datInfo->getReadNum */ - int m_bottomNum; + /* bottom number of shown. + * probably m_bottomNum == m_datInfo->getReadNum + */ + int m_bottomNum; - QVector<int> m_resStatus; /* return val of DatInfo::getHTML(). See datinfo.h */ - QVector<bool> m_coloredNum; /* colored number */ + /* return val of DatInfo::getHTML(). See datinfo.h */ + QVector<int> m_resStatus; + QVector<bool> m_coloredNum; /* colored number */ - /* DOM elements */ - DOM::HTMLDocument m_hdoc; /* root node of document*/ - QVector<DOM::HTMLDivElement> m_titleElm; /* the vector of the element of response */ - QVector<DOM::HTMLDivElement> m_bodyElm; /* the vector of the element of response */ - DOM::Element m_header; - DOM::Element m_footer; - DOM::Element m_kokoyon; + /* 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; -public: - KitaDomTree(const DOM::HTMLDocument& hdoc, const KUrl& datURL); - ~KitaDomTree(); + public: + DomTree(const DOM::HTMLDocument& hdoc, const KUrl& datURL); + ~DomTree(); - /* rendering functions */ + /* rendering functions */ - bool createResElement(int num); - bool appendRes(int num); - void redraw(bool force); - void changeColorOfAllResponsedNumber(); + bool createResElement(int num); + bool appendRes(int num); + void redraw(bool force); + void changeColorOfAllResponsedNumber(); - /* information */ + /* information */ - int getBottomResNumber() const; + int getBottomResNumber() const; - /* header Node, footer Node, kokomadeyonda Node, etc... */ + /* header Node, footer Node, kokomadeyonda Node, etc... */ - void appendFooterAndHeader(); - void appendKokoyon(); + 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); -}; + 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/branches/KITA-KDE4/kita/src/favoritelistview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/favoritelistview.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/favoritelistview.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -27,11 +27,12 @@ #include "libkita/kita_misc.h" #include "libkita/thread.h" +using namespace Kita; + /** * */ -FavoriteListView::FavoriteListView(QWidget* parent) - : Kita::ThreadListView(parent) +FavoriteListView::FavoriteListView(QWidget* parent) : ThreadListView(parent) { kindLabel->hide(); @@ -66,15 +67,15 @@ 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); + int viewPos = DatManager::getViewPos(datURL); + int resNum = DatManager::getResNum(datURL); subjectList->setItem(i, ColumnBoard, - new QTableWidgetItem(Kita::BoardManager::boardName(datURL))); + new QTableWidgetItem(BoardManager::boardName(datURL))); subjectList->setItem(i, ColumnSubject, - new QTableWidgetItem(Kita::DatManager::threadName(datURL))); + new QTableWidgetItem(DatManager::threadName(datURL))); subjectList->setItem(i, ColumnReadNum, new QTableWidgetItem(QString("%1").arg(viewPos, 4))); if (resNum > 0) { @@ -142,7 +143,7 @@ popup.addAction(removeFromFavoritesAct); QString datURL = subjectList->item(item->row(), ColumnDatUrl)->text(); - QString threadURL = Kita::DatManager::threadURL(datURL); + QString threadURL = DatManager::threadURL(datURL); QClipboard* clipboard = QApplication::clipboard(); QString clipText; @@ -152,11 +153,11 @@ return; } if (action == openWithBrowserAct) { - KRun::runUrl(Kita::DatManager::threadURL(datURL), "text/html", this); + KRun::runUrl(DatManager::threadURL(datURL), "text/html", this); } else if (action == copyURLAct) { clipboard->setText(threadURL); } else if (action == copyTitleAndURLAct) { - clipText = Kita::DatManager::threadName(datURL) + '\n' + threadURL; + clipText = DatManager::threadName(datURL) + '\n' + threadURL; clipboard->setText(clipText , QClipboard::Clipboard); clipboard->setText(clipText , QClipboard::Selection); } else if (action == removeFromFavoritesAct) { @@ -173,7 +174,7 @@ for (int i = 0; FavoriteThreads::count() > i; i++) { QString datURL = FavoriteThreads::getDatURL(i); - QString boardURL = Kita::BoardManager::boardURL(datURL); + QString boardURL = BoardManager::boardURL(datURL); if (boardList.contains(boardURL) == 0) { boardList.append(boardURL); } @@ -182,8 +183,8 @@ QList<QString>::const_iterator it; for (it = boardList.begin(); it != boardList.end(); ++it) { bool online = true; - QList<Kita::Thread*> threadList; - QList<Kita::Thread*> tmpList; - Kita::BoardManager::getThreadList((*it), false, online, threadList, tmpList); + QList<Thread*> threadList; + QList<Thread*> tmpList; + BoardManager::getThreadList((*it), false, online, threadList, tmpList); } } Modified: kita/branches/KITA-KDE4/kita/src/favoritelistview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/favoritelistview.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/favoritelistview.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,29 +7,30 @@ * 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" -/** - * - * @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: - explicit FavoriteListView(QWidget* parent = 0); + public: + explicit FavoriteListView(QWidget* parent = 0); - void refresh(); + void refresh(); -private slots: - void loadThread(int row, int column); - void slotContextMenuRequested(const QPoint&); - void reload(); -}; + private slots: + void loadThread(int row, int column); + void slotContextMenuRequested(const QPoint&); + void reload(); + }; +} #endif Modified: kita/branches/KITA-KDE4/kita/src/htmlpart.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/htmlpart.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/htmlpart.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -35,14 +35,14 @@ #include "libkita/datmanager.h" #include "libkita/kita_misc.h" +using namespace Kita; /*-------------------------------------------*/ /*-------------------------------------*/ /* Don't forget to call setup() later. */ -KitaHTMLPart::KitaHTMLPart(QWidget* parent) - : KHTMLPart(new KitaHTMLView(this, parent)) +HTMLPart::HTMLPart(QWidget* parent) : KHTMLPart(new HTMLView(this, parent)) { m_mode = HTMLPART_MODE_MAINPART; m_popup = 0; @@ -56,26 +56,26 @@ } -KitaHTMLPart::~KitaHTMLPart() +HTMLPart::~HTMLPart() { clearPart(); } /* private */ -void KitaHTMLPart::clearPart() +void HTMLPart::clearPart() { slotDeletePopup(); - /* delete KitaDomTree */ + /* delete DomTree */ delete m_domtree; m_domtree = 0; /* update ViewPos */ if (m_mode == HTMLPART_MODE_MAINPART && !m_updatedKokoyon && !m_datURL.isEmpty()) { - int readNum = Kita::DatManager::getReadNum(m_datURL); + int readNum = DatManager::getReadNum(m_datURL); if (readNum) { - Kita::DatManager::setViewPos(m_datURL, readNum); + DatManager::setViewPos(m_datURL, readNum); } } m_updatedKokoyon = false; @@ -91,7 +91,7 @@ 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(m_datURL, false); /* emit "deactivated all thread view" SIGNAL */ KUrl nullUrl(""); @@ -108,13 +108,13 @@ /* public */ -bool KitaHTMLPart::setup(int mode, const KUrl& url) +bool HTMLPart::setup(int mode, const KUrl& url) { 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. */ @@ -123,13 +123,13 @@ /* Usually, DatInfo is NOT created if ReadNum == 0.*/ /* See also DatManager::createDatInfo() and */ /* DatManager::getDatInfo(). */ - Kita::DatManager::createDatInfo(m_datURL); + DatManager::createDatInfo(m_datURL); /* tell Thread class that "thread is opened" */ - Kita::DatManager::setMainThreadOpened(m_datURL, true); + DatManager::setMainThreadOpened(m_datURL, true); /* reset abone */ - Kita::DatManager::resetAbone(m_datURL); + DatManager::resetAbone(m_datURL); } /* create HTML Document */ @@ -137,7 +137,7 @@ /* create DOM manager */ if (m_mode == HTMLPART_MODE_MAINPART) { - m_domtree = new KitaDomTree(htmlDocument(), m_datURL); + m_domtree = new DomTree(htmlDocument(), m_datURL); } return true; @@ -145,7 +145,7 @@ /* private */ -void KitaHTMLPart::connectSignals() +void HTMLPart::connectSignals() { /* popup */ connect(this, SIGNAL(onURL(const QString&)), SLOT(slotOnURL(const QString&))); @@ -158,14 +158,14 @@ /* 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()); + .arg(Config::threadFont().pointSize()) + .arg(Config::threadFont().family()) + .arg(Config::threadColor().name()) + .arg(Config::threadBackground().name()); QString text = "<html><head><style>"; text += DEFAULT_STYLESHEET; @@ -192,7 +192,7 @@ * 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 ; @@ -202,7 +202,7 @@ /* 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 ; @@ -216,12 +216,12 @@ /* 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 ; int bottom = m_domtree->getBottomResNumber(); - int readNum = Kita::DatManager::getReadNum(m_datURL); + int readNum = DatManager::getReadNum(m_datURL); if (bottom != readNum) { QCursor qc; qc.setShape(Qt::WaitCursor); @@ -237,7 +237,7 @@ /* * update screen */ -void KitaHTMLPart::updateScreen(bool showHeaderEtc, bool clock) +void HTMLPart::updateScreen(bool showHeaderEtc, bool clock) { if (!m_domtree) { view()->setFocus(); @@ -259,7 +259,7 @@ /* change color of number of the res which is responsed. */ if (m_mode == HTMLPART_MODE_MAINPART) { - if (Kita::Config::checkResponsed()) { + if (Config::checkResponsed()) { m_domtree->changeColorOfAllResponsedNumber(); } } @@ -278,7 +278,7 @@ /* public */ -void KitaHTMLPart::setInnerHTML(const QString& innerHTML) +void HTMLPart::setInnerHTML(const QString& innerHTML) { createHTMLDocument(); htmlDocument().body().setInnerHTML(innerHTML); @@ -287,7 +287,7 @@ /* redraw screen */ -void KitaHTMLPart::redrawHTMLPart(const KUrl& datURL, bool force) +void HTMLPart::redrawHTMLPart(const KUrl& datURL, bool force) { if (m_domtree == 0) return ; if (m_datURL != datURL) return ; @@ -296,15 +296,15 @@ } /* public slot */ -void KitaHTMLPart::slotSetFaceOfHTMLPart() +void HTMLPart::slotSetFaceOfHTMLPart() { - QFont font = Kita::Config::threadFont(); + QFont font = Config::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("color", Config::threadColor().name(), ""); + style.setProperty("background-color", Config::threadBackground().name(), ""); htmlDocument().applyChanges(); } @@ -318,20 +318,20 @@ /* 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 (DatManager::getReadNum(m_datURL) == 0) return false; - int endNum = Kita::DatManager::getReadNum(m_datURL); + int endNum = DatManager::getReadNum(m_datURL); showResponses(1, endNum); updateScreen(true , false); gotoAnchor(QString().setNum(m_centerNum), false); @@ -347,7 +347,7 @@ /* 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) { @@ -361,7 +361,7 @@ m_jumpNumAfterLoading = jumpNum; /* DatManager will call back slotReceiveData and slotFinishLoad. */ - Kita::DatManager::updateCache(m_datURL , this); + DatManager::updateCache(m_datURL , this); view() ->setFocus(); return true; @@ -370,16 +370,16 @@ /*---------------------------------------------*/ -/* 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 ; - int readNum = Kita::DatManager::getReadNum(m_datURL); + int readNum = DatManager::getReadNum(m_datURL); int bottom = m_domtree->getBottomResNumber(); /* parsing */ @@ -401,10 +401,10 @@ /*--------------------------------------------*/ -/* 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 ; @@ -432,7 +432,7 @@ /* public */ -bool KitaHTMLPart::gotoAnchor(const QString& anc, bool pushPosition) +bool HTMLPart::gotoAnchor(const QString& anc, bool pushPosition) { if (anc.isEmpty()) return false; if (!m_domtree || m_mode == HTMLPART_MODE_POPUP) @@ -446,7 +446,7 @@ if (res > 1) { /* is target valid ? */ - if (!Kita::DatManager::isResValid(m_datURL, res)) return false; + if (!DatManager::isResValid(m_datURL, res)) return false; ancstr = QString().setNum(res); } @@ -456,7 +456,7 @@ /* KHTMLPart::gotoAnchor() will fail if the thread is not shown. */ /* So KHTMLPart::gotoAnchor() should be called via custom event. */ - /* See also KitaHTMLPart::customEvent() */ + /* See also HTMLPart::customEvent() */ GotoAnchorEvent * e = new GotoAnchorEvent(ancstr); QApplication::postEvent(this, e); // Qt will delete it when done @@ -466,19 +466,19 @@ /* jump to kokomade yonda */ /* public slot */ -void KitaHTMLPart::slotGotoKokoyon() +void HTMLPart::slotGotoKokoyon() { if (!m_domtree) return ; if (m_mode != HTMLPART_MODE_MAINPART) return ; - int kokoyon = Kita::DatManager::getViewPos(m_datURL); + int kokoyon = DatManager::getViewPos(m_datURL); gotoAnchor(QString().setNum(kokoyon), false); } /* public slot */ -void KitaHTMLPart::slotGobackAnchor() +void HTMLPart::slotGobackAnchor() { if (m_anchorStack.empty()) return ; @@ -491,14 +491,14 @@ /* private */ -void KitaHTMLPart::pushCurrentPosition() +void HTMLPart::pushCurrentPosition() { m_anchorStack += getCurrentIDofNode(); } /* find the id of current node */ /* private */ -QString KitaHTMLPart::getCurrentIDofNode() +QString HTMLPart::getCurrentIDofNode() { DOM::Node node; node = nodeUnderMouse(); @@ -509,7 +509,7 @@ } /* public slot */ -void KitaHTMLPart::slotClickGotoFooter() +void HTMLPart::slotClickGotoFooter() { if (!m_domtree || m_mode != HTMLPART_MODE_MAINPART) { gotoAnchor("footer", false); @@ -517,7 +517,7 @@ } int bottom = m_domtree->getBottomResNumber(); - int readNum = Kita::DatManager::getReadNum(m_datURL); + int readNum = DatManager::getReadNum(m_datURL); if (readNum != bottom) { showResponses(bottom + 1, readNum); @@ -534,7 +534,7 @@ /* private */ -void KitaHTMLPart::findTextInit() +void HTMLPart::findTextInit() { m_findNode = 0; m_findPos = -1; @@ -544,7 +544,7 @@ /* 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; @@ -670,7 +670,7 @@ /* private */ -void KitaHTMLPart::showPopupMenu(const KUrl& kurl) +void HTMLPart::showPopupMenu(const KUrl& kurl) { QString url = kurl.prettyUrl(); bool showppm = false; @@ -704,7 +704,7 @@ 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); + str = (*it) + " " + DatManager::getPlainBody(m_datURL, (*it).toInt()).left(10); KAction* backLink = new KAction(str, this); backSubMenu->addAction(backLink); } @@ -714,16 +714,16 @@ } // mark - int readNum = Kita::DatManager::getReadNum(m_datURL); + int readNum = DatManager::getReadNum(m_datURL); for (int i = 1; i <= readNum ; i++) { - if (Kita::DatManager::isMarked(m_datURL, i)) { + if (DatManager::isMarked(m_datURL, i)) { if (!markSubMenu) { markSubMenu = new KMenu(view()); markSubMenu->setTitle(i18n("Mark")); popupMenu.addMenu(markSubMenu); popupMenu.addSeparator(); } - str = QString().setNum(i) + " " + Kita::DatManager::getPlainBody(m_datURL, i).left(10); + str = QString().setNum(i) + " " + DatManager::getPlainBody(m_datURL, i).left(10); KAction *gotoMarkAct = new KAction(str, this); markSubMenu->addAction(gotoMarkAct); } @@ -735,7 +735,7 @@ // template if (m_mode == HTMLPART_MODE_MAINPART) { - int kokoyon = Kita::DatManager::getViewPos(m_datURL); + int kokoyon = DatManager::getViewPos(m_datURL); if (kokoyon) { str = i18n("Kokomade Yonda (%1)").arg(kokoyon); kokoLinkAct = new KAction(str, this); @@ -813,7 +813,7 @@ if (KMessageBox::warningYesNo(view(), i18n("Do you want to add '%1' to abone list ?") .arg(selectedText())) == KMessageBox::Yes) { - Kita::AboneConfig::aboneWordList().append(selectedText()); + AboneConfig::aboneWordList().append(selectedText()); redrawHTMLPart(m_datURL, false); } } else { @@ -842,7 +842,7 @@ /* protected */ /* virtual */ -void KitaHTMLPart::customEvent(QEvent * e) +void HTMLPart::customEvent(QEvent * e) { if (e->type() == EVENT_GotoAnchor) { KHTMLPart::gotoAnchor(static_cast< GotoAnchorEvent* >(e) ->getAnc()); @@ -859,13 +859,13 @@ /* 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().isEmpty()) - kurl = KUrl(Kita::BoardManager::boardURL(m_datURL), e->url().string()); + 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; @@ -905,7 +905,7 @@ /* private slot */ -void KitaHTMLPart::slotOpenURLRequest(const KUrl& urlin, const KParts::OpenUrlArguments&) +void HTMLPart::slotOpenURLRequest(const KUrl& urlin, const KParts::OpenUrlArguments&) { clickAnchor(urlin); } @@ -913,10 +913,10 @@ /*------------------------------------------------------*/ /* 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 */ @@ -1015,17 +1015,17 @@ /*---------------------------------------------------------*/ /* 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) { QClipboard * clipboard = QApplication::clipboard(); QString str, resstr; int resNum = refstr.mid(5).toInt(); - QString namestr = Kita::DatManager::getPlainName(m_datURL, resNum); + QString namestr = DatManager::getPlainName(m_datURL, resNum); /* show res tree */ if (m_pushrightbt) { int num; - QString htmlstr = Kita::DatManager::getTreeByRes(m_datURL, resNum, num); + QString htmlstr = DatManager::getTreeByRes(m_datURL, resNum, num); if (!num) return ; QString tmpstr = QString("<DIV>No.%1 : [%2]<BR>").arg(resNum).arg(num); tmpstr += htmlstr + "<BR><BR></DIV>"; @@ -1055,7 +1055,7 @@ // mark KAction* markAct = new KAction(i18n("Mark"), this); markAct->setCheckable(true); - markAct->setChecked(Kita::DatManager::isMarked(m_datURL, resNum)); + markAct->setChecked(DatManager::isMarked(m_datURL, resNum)); popupMenu.addAction(markAct); popupMenu.addSeparator(); @@ -1114,28 +1114,28 @@ ViewMediator::getInstance()->showWriteView(m_datURL, resstr); } else if (action == quoteAct) { resstr = ">>" + QString().setNum(resNum) + '\n' - + "> " + Kita::DatManager::getPlainTitle(m_datURL, resNum) + '\n' - + "> " + Kita::DatManager::getPlainBody(m_datURL, resNum).replace('\n', "\n> ") + '\n'; + + "> " + DatManager::getPlainTitle(m_datURL, resNum) + '\n' + + "> " + DatManager::getPlainBody(m_datURL, resNum).replace('\n', "\n> ") + '\n'; ViewMediator::getInstance()->showWriteView(m_datURL, resstr); } else if (action == markAct) { - Kita::DatManager::setMark(m_datURL, resNum, ! Kita::DatManager::isMarked(m_datURL, resNum)); + DatManager::setMark(m_datURL, resNum, !DatManager::isMarked(m_datURL, resNum)); } else if (action == copyAct || action == copyUrlAct || action == copyThreadNameAct) { str.clear(); // title if (action == copyThreadNameAct || action == copyAct) { - str = Kita::DatManager::threadName(m_datURL); + str = DatManager::threadName(m_datURL); } // url if (!str.isEmpty()) str += '\n'; - str += Kita::DatManager::threadURL(m_datURL) + '/' + QString().setNum(resNum) + '\n'; + str += DatManager::threadURL(m_datURL) + '/' + QString().setNum(resNum) + '\n'; // body if (action == copyAct) { str += '\n' - + Kita::DatManager::getPlainTitle(m_datURL, resNum) + '\n' - + Kita::DatManager::getPlainBody(m_datURL, resNum) + '\n'; + + DatManager::getPlainTitle(m_datURL, resNum) + '\n' + + DatManager::getPlainBody(m_datURL, resNum) + '\n'; } // copy @@ -1143,21 +1143,21 @@ clipboard->setText(str , QClipboard::Selection); } else if (action == setKokoYonAct) { - Kita::DatManager::setViewPos(m_datURL, resNum); + DatManager::setViewPos(m_datURL, resNum); ViewMediator::getInstance()->updateBoardView(m_datURL); m_updatedKokoyon = true; updateScreen(true, true); gotoAnchor(QString().setNum(resNum), false); } else if (action == showBrowserAct) { - str = Kita::DatManager::threadURL(m_datURL) + '/' + QString().setNum(resNum); + str = DatManager::threadURL(m_datURL) + '/' + QString().setNum(resNum); KRun::runUrl(str, "text/html", view()); } else if (action == aboneNameAct) { if (KMessageBox::warningYesNo(view(), i18n("Do you want to add '%1' to abone list ?").arg(namestr), "Kita") == KMessageBox::Yes) { - Kita::AboneConfig::aboneNameList().append(namestr); + AboneConfig::aboneNameList().append(namestr); redrawHTMLPart(m_datURL, false); } } @@ -1168,7 +1168,7 @@ /*--------------------------------------------------*/ /* 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", "+") @@ -1178,7 +1178,7 @@ if (m_pushrightbt) { int num; QString htmlstr - = Kita::DatManager::getHtmlByID(m_datURL, strid, num); + = DatManager::getHtmlByID(m_datURL, strid, num); if (num <= 1) return ; QString tmpstr = QString("<DIV>ID:%1:[%2]<BR>").arg(strid).arg(num); tmpstr += htmlstr + "<BR><BR></DIV>"; @@ -1201,7 +1201,7 @@ if (KMessageBox::warningYesNo(view(), i18n("Do you want to add '%1' to abone list ?").arg(strid), "Kita") == KMessageBox::Yes) { - Kita::AboneConfig::aboneIDList().append(strid); + AboneConfig::aboneIDList().append(strid); redrawHTMLPart(m_datURL, false); } } @@ -1213,10 +1213,10 @@ /*---------------------------------------------------------*/ /* 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"; + + "&u=d:" + DatManager::threadURL(m_datURL) + "/l50"; if (m_pushrightbt) { // create popup menu @@ -1252,7 +1252,7 @@ /* public */ -bool KitaHTMLPart::isPopupVisible() +bool HTMLPart::isPopupVisible() { if (!m_popup) return false; return m_popup->isVisible(); @@ -1260,7 +1260,7 @@ /* public slot */ -void KitaHTMLPart::slotDeletePopup() +void HTMLPart::slotDeletePopup() { delete m_popup; m_popup = 0; @@ -1269,9 +1269,9 @@ /* for convenience */ /* public slot */ -void KitaHTMLPart::slotShowResPopup(const 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); + QString innerHTML = DatManager::getHtml(m_datURL, refNum, refNum2); if (innerHTML.isEmpty()) return ; showPopupCore(m_datURL, innerHTML, point); @@ -1279,19 +1279,19 @@ /* 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()); } /* show popup window */ /* private */ -void KitaHTMLPart::showPopupCore(const KUrl& url, const QString& innerHTML, const QPoint& point) +void HTMLPart::showPopupCore(const KUrl& url, const QString& innerHTML, const QPoint& point) { slotDeletePopup(); m_multiPopup = false; - m_popup = new Kita::ResPopup(view() , url); + m_popup = new ResPopup(view() , url); connect(m_popup, SIGNAL(hideChildPopup()), SLOT(slotHideChildPopup())); @@ -1304,7 +1304,7 @@ /*------------------------*/ /* start multi-popup mode */ /* private */ -bool KitaHTMLPart::startMultiPopup() +bool HTMLPart::startMultiPopup() { if (m_popup && m_popup->isVisible()) { @@ -1319,7 +1319,7 @@ /* Is it multi-popup mode now ? */ /* private */ -bool KitaHTMLPart::isMultiPopupMode() +bool HTMLPart::isMultiPopupMode() { if (!m_popup) { m_multiPopup = false; @@ -1331,7 +1331,7 @@ } /* private */ -void KitaHTMLPart::hidePopup() +void HTMLPart::hidePopup() { if (m_popup) { m_popup->hide(); @@ -1340,7 +1340,7 @@ } /* return true if this view is under mouse. */ /* private */ -bool KitaHTMLPart::isUnderMouse(int mrgwd, int mrght) +bool HTMLPart::isUnderMouse(int mrgwd, int mrght) { QPoint pos = QCursor::pos(); int cx = pos.x(), cy = pos.y(); @@ -1358,7 +1358,7 @@ } /* private slot */ -void KitaHTMLPart::slotLeave() +void HTMLPart::slotLeave() { if (isMultiPopupMode()) return ; if (view()->horizontalScrollBar()->isSliderDown()) return; @@ -1373,7 +1373,7 @@ } /* private slot */ -void KitaHTMLPart::slotVSliderReleased() +void HTMLPart::slotVSliderReleased() { QScrollBar * bar = view() ->verticalScrollBar(); QRect rt = bar->style()->subControlRect(QStyle::CC_Slider, new QStyleOptionComplex(), QStyle::SC_SliderHandle); @@ -1389,7 +1389,7 @@ /* private slot */ -void KitaHTMLPart::slotHSliderReleased() +void HTMLPart::slotHSliderReleased() { QScrollBar * bar = view() ->horizontalScrollBar(); QRect rt = bar->style()->subControlRect(QStyle::CC_Slider, new QStyleOptionComplex(), QStyle::SC_SliderHandle); @@ -1406,7 +1406,7 @@ /* private slot */ -void KitaHTMLPart::slotHideChildPopup() +void HTMLPart::slotHideChildPopup() { hidePopup(); @@ -1419,7 +1419,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 */ @@ -1435,7 +1435,7 @@ 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; @@ -1443,14 +1443,14 @@ if (url.at(0) == '#') { refstr = url.mid(1); } else { - datURL = Kita::getDatURL(KUrl(m_datURL, url) , refstr); + datURL = getDatURL(KUrl(m_datURL, url) , refstr); } /*------------------------*/ /* id popup */ if (url.left(6) == "#idpop") { - int num = Kita::DatManager::getNumByID(m_datURL, url.mid(6)); + int num = DatManager::getNumByID(m_datURL, url.mid(6)); QString tmpstr; if (num >= 2) { tmpstr = QString("<DIV>ID:%1:[%2]</DIV>").arg(url.mid(6)).arg(num); @@ -1468,7 +1468,7 @@ if (refstr.left(5) == "write") { int no = refstr.mid(5).toInt(); int num = 0; - Kita::DatManager::getTreeByRes(m_datURL, no, num); + DatManager::getTreeByRes(m_datURL, no, num); QString tmpstr; if (num) { tmpstr = QString("<DIV>No.%1 : [%2]</DIV>").arg(no).arg(num); @@ -1485,7 +1485,7 @@ if (url.left(6) == "#abone") { int no = url.mid(6).toInt(); - QString tmpstr = Kita::DatManager::getHtml(m_datURL, no, no, false); + QString tmpstr = DatManager::getHtml(m_datURL, no, no, false); showPopup(m_datURL, tmpstr); return ; } @@ -1517,15 +1517,15 @@ if (datURL.host() != m_datURL.host() || datURL.path() != m_datURL.path()) { /* get board name */ - QString boardName = Kita::BoardManager::boardName(datURL); + 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); + DatManager::getDatInfoPointer(datURL); /* get thread Name */ - QString subName = Kita::DatManager::threadName(datURL); + QString subName = DatManager::threadName(datURL); if (!subName.isEmpty()) innerHTML += subName + "<br><br>"; if (!refNum) refNum = refNum2 = 1; @@ -1533,7 +1533,7 @@ /* get HTML and show it */ if (!refNum) return ; - innerHTML += Kita::DatManager::getHtml(datURL, refNum, refNum2); + innerHTML += DatManager::getHtml(datURL, refNum, refNum2); if (!innerHTML.isEmpty()) showPopup(datURL, innerHTML); } @@ -1542,7 +1542,7 @@ /* If selected Text is composed of only digits, then show res popup. */ /* private */ -bool KitaHTMLPart::showSelectedDigitPopup() +bool HTMLPart::showSelectedDigitPopup() { if (!hasSelection()) return false; @@ -1552,8 +1552,8 @@ 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 ((refNum = stringToPositiveNum(chpt, length)) != -1) { + QString innerHTML = DatManager::getHtml(m_datURL, refNum, refNum); if (!innerHTML.isEmpty()) { showPopup(m_datURL, innerHTML); startMultiPopup(); Modified: kita/branches/KITA-KDE4/kita/src/htmlpart.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/htmlpart.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/htmlpart.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITAHTMLPART_H #define KITAHTMLPART_H @@ -27,194 +26,181 @@ /* ID of user defined event */ #define EVENT_GotoAnchor (QEvent::User + 100) -class KitaDomTree; 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); - ~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(const 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, const QPoint& point); - bool startMultiPopup(); - bool isMultiPopupMode(); - void hidePopup(); - bool isUnderMouse(int mrgwd, int mrght); - bool showSelectedDigitPopup(); + /* search */ + void findTextInit(); - KitaHTMLPart(const KitaHTMLPart&); - KitaHTMLPart& operator=(const KitaHTMLPart&); + /* 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(); -protected: + HTMLPart(const HTMLPart&); + HTMLPart& operator=(const HTMLPart&); - /* user event */ - virtual void customEvent(QEvent * e); + protected: - /* mouse event */ - virtual void khtmlMousePressEvent(khtml::MousePressEvent* e); + /* user event */ + virtual void customEvent(QEvent * e); + /* mouse event */ + virtual void khtmlMousePressEvent(khtml::MousePressEvent* e); -private slots: - /* click */ - void slotOpenURLRequest(const KUrl&, const KParts::OpenUrlArguments&); + private slots: - /* res popup */ - void slotLeave(); - void slotVSliderReleased(); - void slotHSliderReleased(); - void slotHideChildPopup(); - void slotOnURL(const QString& url); + /* click */ + void slotOpenURLRequest(const KUrl&, const KParts::OpenUrlArguments&); + /* res popup */ + void slotLeave(); + void slotVSliderReleased(); + void slotHSliderReleased(); + void slotHideChildPopup(); + void slotOnURL(const QString& url); -signals: - void mousePressed(); /* to KitaThreadView */ - /* cache */ - void receiveData(); - void finishReload(); + signals: + void mousePressed(); /* to ThreadView */ - /* res popup */ - void hideChildPopup(); -}; + /* 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 QEvent -{ - QString m_anc; - -public: - - GotoAnchorEvent(const QString& anc) - : QEvent(QEvent::Type(EVENT_GotoAnchor)), m_anc(anc) {}; - - const QString& getAnc() const { return m_anc; } -}; - - #endif Modified: kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -12,20 +12,21 @@ #include <khtml_part.h> -KitaHTMLView::KitaHTMLView(KHTMLPart* part, QWidget *parent) - : KHTMLView(part, parent) +using namespace Kita; + +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() == Qt::Key_Space || e->key() == Qt::Key_PageDown || e->key() == Qt::Key_Down || e->key() == Qt::Key_End) { @@ -36,7 +37,7 @@ } /* protected */ -void KitaHTMLView::wheelEvent(QWheelEvent * e) +void HTMLView::wheelEvent(QWheelEvent * e) { if (e->delta() < 0) { /* scroll down */ if (emitPushDown()) return ; @@ -46,12 +47,12 @@ } /* private */ -bool KitaHTMLView::emitPushDown() +bool HTMLView::emitPushDown() { int y = contentsY(); if (y >= contentsHeight() - visibleHeight()) { - emit pushDown(); /* to KitaHTMLPart in order to call slotClickTugi100 */ + emit pushDown(); /* to HTMLPart in order to call slotClickTugi100 */ return true; } Modified: kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -13,26 +13,28 @@ #include <khtmlview.h> -/** - @ author Hideki Ikemoto -*/ -class KDE_EXPORT KitaHTMLView : public KHTMLView -{ - Q_OBJECT -public: - KitaHTMLView(KHTMLPart* part, QWidget *parent); - ~KitaHTMLView(); -protected: - void leaveEvent(QEvent*); - void keyPressEvent(QKeyEvent* e); - void wheelEvent(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/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -21,11 +21,9 @@ #include <kstandardshortcut.h> #include <ktabbar.h> -/*--------------------------------------------------------------*/ +using namespace Kita; - -KitaTabWidgetBase::KitaTabWidgetBase(QWidget* parent) - : KTabWidget(parent) +TabWidgetBase::TabWidgetBase(QWidget* parent) : KTabWidget(parent) { connect(this, SIGNAL(currentChanged (QWidget *)), SLOT(slotCurrentChanged (QWidget *))); @@ -41,7 +39,7 @@ } -KitaTabWidgetBase::~KitaTabWidgetBase() +TabWidgetBase::~TabWidgetBase() { /* romove parts */ if (m_manager && !(m_manager->parts().isEmpty())) { @@ -65,7 +63,7 @@ } /* public slot */ -void KitaTabWidgetBase::slotCurrentChanged(QWidget * w) +void TabWidgetBase::slotCurrentChanged(QWidget * w) { if (m_manager == 0) return ; if (w == 0) return ; @@ -81,7 +79,7 @@ /* 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 @@ -91,7 +89,7 @@ /* 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(QEvent * e) +void TabWidgetBase::customEvent(QEvent * e) { if (e->type() == EVENT_CloseTab) { deleteWidget (widget(static_cast< CloseTabEvent* >(e) ->getIndex())); @@ -100,7 +98,7 @@ /* protected */ /* virtual */ -void KitaTabWidgetBase::deleteWidget(QWidget* w) +void TabWidgetBase::deleteWidget(QWidget* w) { if (w == 0) return ; @@ -112,7 +110,7 @@ /* protected */ -KParts::Part* KitaTabWidgetBase::findPartFromWidget(QWidget* w) +KParts::Part* TabWidgetBase::findPartFromWidget(QWidget* w) { if (w == 0) return 0; if (m_manager == 0) return 0; @@ -133,7 +131,7 @@ /* private */ -void KitaTabWidgetBase::setupActions() +void TabWidgetBase::setupActions() { actionCollection() ->associateWidget(this); @@ -179,7 +177,7 @@ /* public slot */ -void KitaTabWidgetBase::slotConfigureKeys() +void TabWidgetBase::slotConfigureKeys() { QString str = "Tab Actions"; KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this); @@ -189,7 +187,7 @@ /* public slot */ -void KitaTabWidgetBase::slotPrevTab() +void TabWidgetBase::slotPrevTab() { int max = count(); int curpage = currentIndex(); @@ -200,7 +198,7 @@ } /* public slot */ -void KitaTabWidgetBase::slotNextTab() +void TabWidgetBase::slotNextTab() { int max = count(); int curpage = currentIndex(); @@ -212,14 +210,14 @@ /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseCurrentTab() +void TabWidgetBase::slotCloseCurrentTab() { slotCloseTab(currentIndex()); } /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseOtherTab(int idx) +void TabWidgetBase::slotCloseOtherTab(int idx) { int max = count(); if (max == 0) return ; @@ -241,7 +239,7 @@ /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseRightTab(int idx) +void TabWidgetBase::slotCloseRightTab(int idx) { int max = count(); if (max == 0) return ; @@ -258,7 +256,7 @@ /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseLeftTab(int idx) +void TabWidgetBase::slotCloseLeftTab(int idx) { int max = count(); if (max == 0) return ; @@ -274,7 +272,7 @@ /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseAllTab() +void TabWidgetBase::slotCloseAllTab() { int max = count(); if (max == 0) return ; Modified: kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -34,80 +34,75 @@ #define EVENT_FitImageToWinEvent (QEvent::User + 102) #define EVENT_CancelMoszicEvent (QEvent::User + 103) - - -/*-----------------------------------------------*/ - - -class KDE_EXPORT 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: - explicit KitaTabWidgetBase(QWidget* parent = 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(QEvent * 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(); - KitaTabWidgetBase(const KitaTabWidgetBase&); - KitaTabWidgetBase& operator=(const KitaTabWidgetBase&); + 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 QEvent -{ - int m_pageindex; + CloseTabEvent(int idx) + : QEvent(QEvent::Type(EVENT_CloseTab)), m_pageindex(idx) {} -public: + int getIndex() const { return m_pageindex; } + }; - CloseTabEvent(int idx) - : QEvent(QEvent::Type(EVENT_CloseTab)), m_pageindex(idx) {} - 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 QEvent -{ - bool m_activate; - bool m_force; + bool getActivate() const { return m_activate; } + bool getForce() const { return m_force; } + }; +} -public: - ShowDockEvent(bool activate, bool force) : QEvent(QEvent::Type(EVENT_ShowDock)) - , m_activate(activate), m_force(force) {} - - bool getActivate() const { return m_activate; } - bool getForce() const { return m_force; } -}; - #endif Modified: kita/branches/KITA-KDE4/kita/src/libkita/access.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/access.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/access.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -50,7 +50,7 @@ QByteArray orgData; // get cache path. - QString cachePath = Kita::Cache::getPath(m_datURL); + QString cachePath = Cache::getPath(m_datURL); if (cachePath.isEmpty()) { return; } @@ -72,7 +72,7 @@ case Board_MachiBBS: /* Machi BBS's data is already parsed as 2ch dat. */ { - QString tmpData = Kita::qcpToUnicode(orgData); + QString tmpData = qcpToUnicode(orgData); QStringList tmpList = tmpData.split('\n'); emit receiveData(tmpList); } @@ -94,7 +94,7 @@ m_dataSize += m_threadData.length(); - QString cachePath = Kita::Cache::getPath(m_datURL); + QString cachePath = Cache::getPath(m_datURL); if (!cachePath.isEmpty()) { FILE * fs = fopen(QFile::encodeName(cachePath), "a"); if (!fs) return ; @@ -122,13 +122,13 @@ switch (m_bbstype) { case Board_MachiBBS: - getURL = Kita::getThreadURL(m_datURL); + getURL = getThreadURL(m_datURL); if (m_readNum > 0) getURL += "&START=" + QString().setNum(m_readNum + 1); - Kita::InitParseMachiBBS(); + InitParseMachiBBS(); break; case Board_JBBS: - getURL = Kita::getThreadURL(m_datURL); + getURL = getThreadURL(m_datURL); getURL.replace("read.cgi", "rawmode.cgi"); /* adhoc... */ if (m_readNum > 0) getURL += '/' + QString().setNum(m_readNum + 1) + '-'; break; @@ -187,7 +187,7 @@ void Access::slotReceiveThreadData(KIO::Job*, const QByteArray& data) { 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 ] = ' '; @@ -262,25 +262,25 @@ switch (m_bbstype) { case Board_MachiBBS: - line = Kita::qcpToUnicode(lineList[i]); - line2 = Kita::ParseMachiBBSOneLine(line, nextNum); - ba = Kita::unicodeToQcp(line2); + line = qcpToUnicode(lineList[i]); + line2 = ParseMachiBBSOneLine(line, nextNum); + ba = unicodeToQcp(line2); break; case Board_JBBS: - line = Kita::eucToUnicode(lineList[i]); - line2 = Kita::ParseJBBSOneLine(line, nextNum); - ba = Kita::unicodeToEuc(line2); + line = eucToUnicode(lineList[i]); + line2 = ParseJBBSOneLine(line, nextNum); + ba = unicodeToEuc(line2); break; case Board_FlashCGI: - line = Kita::qcpToUnicode(lineList[i]); - line2 = Kita::ParseFlashCGIOneLine(line); - ba = Kita::unicodeToQcp(line2); + line = qcpToUnicode(lineList[i]); + line2 = ParseFlashCGIOneLine(line); + ba = unicodeToQcp(line2); break; default: - line = line2 = Kita::qcpToUnicode(lineList[i]); + line = line2 = qcpToUnicode(lineList[i]); ba = lineList[i]; } @@ -370,7 +370,7 @@ // QString OfflawAccess::get() { - QString getURL = Kita::datToOfflaw(m_datURL.url()); + QString getURL = datToOfflaw(m_datURL.url()); KUrl kgetURL(getURL); kgetURL.addQueryItem("sid", Account::getSessionID()); Modified: kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -297,11 +297,11 @@ /* BoardManager */ -QTextCodec* Kita::BoardManager::m_cp932Codec = 0; -QTextCodec* Kita::BoardManager::m_eucJpCodec = 0; -BoardDataList Kita::BoardManager::m_boardDataList; -BoardData* Kita::BoardManager::m_previousBoardData = 0; -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() @@ -459,7 +459,7 @@ /* make directory */ QString cacheDir = Cache::baseDir() + Cache::serverDir(url) + Cache::boardDir(url); - if (!Kita::mkdir(cacheDir)) return ; + if (!mkdir(cacheDir)) return ; KIO::SlaveConfig::self() ->setConfigData("http", url.host() , @@ -506,10 +506,10 @@ QString datURL = boardURL + "dat/" + (*it); /* read idx file */ - Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + Thread* thread = Thread::getByURLNew(datURL); if (thread == 0) { - thread = Kita::Thread::getByURL(datURL); + thread = Thread::getByURL(datURL); if (thread == 0) continue; ThreadIndex::loadIndex(thread, datURL, false); } @@ -575,7 +575,7 @@ /* get pointer of Thread class */ QString datURL = boardURL(url) + "dat/" + fname; - Kita::Thread* thread = Kita::Thread::getByURL(datURL); + Thread* thread = Thread::getByURL(datURL); if (threadList.indexOf(thread) == -1) { threadList.append(thread); } @@ -595,7 +595,7 @@ int oldNum = thread->resNum(); if (newNum > oldNum) { - Kita::ThreadIndex::setResNum(datURL, newNum); + ThreadIndex::setResNum(datURL, newNum); } } thread->setResNum(newNum); @@ -638,7 +638,7 @@ * @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). * @@ -810,7 +810,7 @@ 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 @@ -917,7 +917,7 @@ /* mkdir new server dir */ QString newCachePath = Cache::baseDir() + Cache::serverDir(bdata->basePath()); - Kita::mkdir(newCachePath); + mkdir(newCachePath); /* backup old dir */ newCachePath += Cache::boardDir(bdata->basePath()); @@ -931,11 +931,11 @@ /* move cache dir */ if (qdir.exists(oldCachePath)) { qdir.rename(oldCachePath, newCachePath); - } else Kita::mkdir(newCachePath); + } else mkdir(newCachePath); /* make old dir */ if (! qdir.exists(oldCachePath)) { - Kita::mkdir(oldCachePath); + mkdir(oldCachePath); /* create BBS_MOVED */ QString movedPath = oldCachePath + "/BBS_MOVED"; QFile file(movedPath); @@ -966,9 +966,9 @@ /*---------------------------*/ /* update other information */ FavoriteThreads::replace(oldURL, newURL); - Kita::Thread::replace(oldURL, newURL); - KitaThreadInfo::replace(oldURL, newURL); - Kita::FavoriteBoards::replace(oldURL, newURL); + Thread::replace(oldURL, newURL); + ThreadInfo::replace(oldURL, newURL); + FavoriteBoards::replace(oldURL, newURL); return true; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITABOARDMANAGER_H #define KITABOARDMANAGER_H Modified: kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -38,14 +38,14 @@ DatInfo::DatInfo(const KUrl& url) : m_access (0), m_access2(0) { QString refstr; - m_datURL = Kita::getDatURL(url, refstr); + m_datURL = getDatURL(url, refstr); /* get the pointer of Thread class */ - m_thread = Kita::Thread::getByURLNew(m_datURL); + m_thread = Thread::getByURLNew(m_datURL); if (m_thread == 0) { /* create Thread */ - m_thread = Kita::Thread::getByURL(m_datURL); + m_thread = Thread::getByURL(m_datURL); if (m_thread == 0) return ; /* read idx file */ @@ -55,14 +55,14 @@ m_thread = Thread::getByURL(m_datURL); /* japanese strings */ - m_spacestr = Kita::utf8ToUnicode(KITAUTF8_ZENSPACE); - m_framestr1 = Kita::utf8ToUnicode(KITAUTF8_FRAME1); /* | */ - m_framestr2 = Kita::utf8ToUnicode(KITAUTF8_FRAME2); /* |- */ - m_framestr3 = Kita::utf8ToUnicode(KITAUTF8_FRAME3); /* L */ + m_spacestr = utf8ToUnicode(KITAUTF8_ZENSPACE); + m_framestr1 = utf8ToUnicode(KITAUTF8_FRAME1); /* | */ + m_framestr2 = utf8ToUnicode(KITAUTF8_FRAME2); /* |- */ + m_framestr3 = utf8ToUnicode(KITAUTF8_FRAME3); /* L */ /* make directory */ QString cacheDir = Cache::baseDir() + Cache::serverDir(m_datURL) + Cache::boardDir(m_datURL); - if (!Kita::mkdir(cacheDir)) return ; + if (!mkdir(cacheDir)) return ; initPrivate( true /* load cache */ @@ -101,7 +101,7 @@ 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&))); @@ -175,10 +175,10 @@ /* 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) @@ -200,7 +200,7 @@ } -/* slot called when Kita::Access +/* slot called when Access received new data */ /* private slot */ void DatInfo::slotReceiveData(const QStringList& lineList) { @@ -243,7 +243,7 @@ if (num == 1) parseDat(num); /* search all responses which are responsed by this line. */ - if (Kita::Config::checkResponsed()) { + if (Config::checkResponsed()) { if (parseDat(num) && !checkAbonePrivate(num)) { /* parse line here to get AncList */ @@ -268,7 +268,7 @@ } -/* slot called when Kita::Access +/* slot called when Access finished loading new dat */ /* private slot */ void DatInfo::slotFinishLoad() { @@ -340,8 +340,8 @@ /* 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. */ + Access::stopJob() calls HTMLPart::slotFinishLoad() back, + then HTMLPart::slotFinishLoad() calls another functions in DatInfo. */ if (m_access == 0) return ; if (! m_nowLoading) return ; @@ -382,10 +382,10 @@ if (!parseDat(num)) return QString(); QString titleHTML; - Kita::createTitleHTML(m_resDatVec[ num ], titleHTML); + createTitleHTML(m_resDatVec[ num ], titleHTML); QString retStr; - Kita::DatToText(titleHTML, retStr); + DatToText(titleHTML, retStr); return retStr; } @@ -397,7 +397,7 @@ if (!parseDat(num)) return QString(); QString retStr; - Kita::DatToText(m_resDatVec[ num ].bodyHTML, retStr); + DatToText(m_resDatVec[ num ].bodyHTML, retStr); return retStr; } @@ -423,15 +423,15 @@ * @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) { - if (!parseDat(num)) return KITA_HTML_NOTPARSED; + if (!parseDat(num)) return HTML_NOTPARSED; bool abone = checkAbone & checkAbonePrivate(num); RESDAT& resdat = m_resDatVec[ num ]; @@ -441,17 +441,17 @@ bodyHTML = "<a href=\"#abone" + QString().setNum(num) + "\">"; bodyHTML += i18n("Abone") + "</a>"; - return KITA_HTML_ABONE; + return HTML_ABONE; } else if (resdat.broken) { titleHTML = QString().setNum(num) + ' ' + i18n("Broken"); bodyHTML = i18n("Broken"); - return KITA_HTML_BROKEN; + return HTML_BROKEN; } else { createTitleHTML(resdat, titleHTML); bodyHTML = resdat.bodyHTML; - return KITA_HTML_NORMAL; + return HTML_NORMAL; } } @@ -509,7 +509,7 @@ { 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"); html += "<div class=\"pop_res_title\">" + titleHTML + "</div>"; @@ -797,10 +797,10 @@ { 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().empty()); + m_aboneByName = (!AboneConfig::aboneNameList().empty()); + m_aboneByBody = (!AboneConfig::aboneWordList().empty()); + m_aboneChain = (m_aboneByID | m_aboneByName | m_aboneByBody) & Config::aboneChain() ; } @@ -824,13 +824,13 @@ bool checktmp = false; if (m_aboneByID) - checktmp = checkAboneCore(m_resDatVec[ num ].id, Kita::AboneConfig::aboneIDList()); + checktmp = checkAboneCore(m_resDatVec[ num ].id, AboneConfig::aboneIDList()); if (!checktmp && m_aboneByName) - checktmp = checkAboneCore(m_resDatVec[ num ].name, Kita::AboneConfig::aboneNameList()); + checktmp = checkAboneCore(m_resDatVec[ num ].name, AboneConfig::aboneNameList()); if (!checktmp && m_aboneByBody) - checktmp = checkAboneCore(m_resDatVec[ num ].bodyHTML, Kita::AboneConfig::aboneWordList()); + checktmp = checkAboneCore(m_resDatVec[ num ].bodyHTML, AboneConfig::aboneWordList()); if (!checktmp && m_aboneChain) { AncList & anclist = m_resDatVec[ num ].anclist; @@ -880,7 +880,7 @@ /* parsing function for ResDat */ -/* This function parses the raw data by Kita::parseResDat() */ /* private */ +/* This function parses the raw data by parseResDat() */ /* private */ bool DatInfo::parseDat(int num) { if (num <= 0 || m_thread->readNum() < num) return false; @@ -889,7 +889,7 @@ // qDebug("parseDat %d",num); QString subject; - Kita::parseResDat(m_resDatVec[ num ], subject); + parseResDat(m_resDatVec[ num ], subject); if (num == 1 && !subject.isEmpty()) m_thread->setThreadName(subject); if (m_resDatVec[ num ].broken) m_broken = true; Modified: kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITADATINFO_H #define KITADATINFO_H @@ -23,10 +22,10 @@ /* 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 }; Modified: kita/branches/KITA-KDE4/kita/src/libkita/datmanager.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/datmanager.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/datmanager.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -86,7 +86,7 @@ without creating instance. */ /* private */ DatInfo* DatManager::searchDatInfo(const KUrl& url) { - KUrl datURL = Kita::getDatURL(url); + KUrl datURL = getDatURL(url); if (datURL.isEmpty()) return 0; /* This url is not enrolled in BoardManager. */ if (m_datInfoList.isEmpty()) return 0; @@ -118,7 +118,7 @@ Note that DatInfo::DatInfo() opens cached data and reads it. */ /* private */ DatInfo* DatManager::enrollDatInfo(const KUrl& url, bool checkCached) { - KUrl datURL = Kita::getDatURL(url); + KUrl datURL = getDatURL(url); if (datURL.isEmpty()) return 0; /* This url is not enrolled in BoardManager. */ /* create DatInfo & read cached data */ @@ -196,8 +196,8 @@ /* public */ bool DatManager::deleteCache(const KUrl& url) { - KUrl datURL = Kita::getDatURL(url); - Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + KUrl datURL = getDatURL(url); + Thread* thread = Thread::getByURLNew(datURL); if (thread == 0) return false; if (thread->readNum() == 0) return false; @@ -212,13 +212,13 @@ thread->setViewPos(0); /* delete cache */ - QString cachePath = Kita::Cache::getPath(datURL); - QString indexPath = Kita::Cache::getIndexPath(datURL); + QString cachePath = Cache::getPath(datURL); + QString indexPath = Cache::getIndexPath(datURL); QFile::remove(indexPath); QFile::remove(cachePath); /* delete log from "cache" */ - KitaThreadInfo::removeThreadInfo(datURL.prettyUrl()); + ThreadInfo::removeThreadInfo(datURL.prettyUrl()); return true; } @@ -300,8 +300,8 @@ /* get name (i.e. subject) of thread from URL of dat file. */ /* public */ const QString DatManager::threadName(const KUrl& url) { - KUrl datURL = Kita::getDatURL(url); - Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + KUrl datURL = getDatURL(url); + Thread* thread = Thread::getByURLNew(datURL); if (thread != 0) return thread->threadName(); return QString(); @@ -311,19 +311,19 @@ /* public */ const QString DatManager::threadID(const KUrl& url) { - KUrl datURL = Kita::getDatURL(url); + KUrl datURL = getDatURL(url); return datURL.fileName().section('.', 0, 0); } const QString DatManager::getCachePath(const KUrl& url) { - return Kita::Cache::getPath(url); + return Cache::getPath(url); } const QString DatManager::getCacheIndexPath(const KUrl& url) { - return Kita::Cache::getIndexPath(url); + return Cache::getIndexPath(url); } /*---------------------------------------*/ @@ -373,8 +373,8 @@ /* public */ int DatManager::getResNum(const KUrl& url) { - KUrl datURL = Kita::getDatURL(url); - Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + KUrl datURL = getDatURL(url); + Thread* thread = Thread::getByURLNew(datURL); if (thread != 0) return thread->resNum(); return 0; @@ -384,8 +384,8 @@ /* public */ int DatManager::getReadNum(const KUrl& url) { - KUrl datURL = Kita::getDatURL(url); - Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + KUrl datURL = getDatURL(url); + Thread* thread = Thread::getByURLNew(datURL); if (thread != 0) return thread->readNum(); return 0; @@ -395,8 +395,8 @@ /* public */ int DatManager::getViewPos(const KUrl& url) { - KUrl datURL = Kita::getDatURL(url); - Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + KUrl datURL = getDatURL(url); + Thread* thread = Thread::getByURLNew(datURL); if (thread != 0) return thread->viewPos(); return 0; @@ -406,15 +406,15 @@ /* public */ void DatManager::setViewPos(const KUrl& url , int num) { - KUrl datURL = Kita::getDatURL(url); - Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + KUrl datURL = getDatURL(url); + Thread* thread = Thread::getByURLNew(datURL); if (thread != 0) thread->setViewPos(num); /* save idx */ - Kita::ThreadIndex::setViewPos(url, num); + ThreadIndex::setViewPos(url, num); /* save "cache" */ - KitaThreadInfo::setReadNum(datURL.prettyUrl(), num); + ThreadInfo::setReadNum(datURL.prettyUrl(), num); } @@ -440,7 +440,7 @@ /* public */ bool DatManager::isThreadEnrolled(const KUrl& url) { - if (Kita::getDatURL(url).isEmpty()) return false; + if (getDatURL(url).isEmpty()) return false; return true; } @@ -450,7 +450,7 @@ bool DatManager::is2chThread(const KUrl& url) { if (BoardManager::type(url) != Board_2ch) return false; - if (Kita::getDatURL(url).isEmpty()) return false; + if (getDatURL(url).isEmpty()) return false; QRegExp url_2ch(".*\\.2ch\\.net"); QRegExp url_bbspink(".*\\.bbspink\\.com"); @@ -518,8 +518,8 @@ /* public */ bool DatManager::isMarked(const KUrl& url, int num) { - KUrl datURL = Kita::getDatURL(url); - Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + KUrl datURL = getDatURL(url); + Thread* thread = Thread::getByURLNew(datURL); if (thread == 0) return false; return thread->isMarked(num); @@ -529,11 +529,11 @@ /* public */ void DatManager::setMark(const KUrl& url, int num, bool mark) { - KUrl datURL = Kita::getDatURL(url); - Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + KUrl datURL = getDatURL(url); + Thread* thread = Thread::getByURLNew(datURL); if (thread == 0) return ; - if (thread->setMark(num, mark)) Kita::ThreadIndex::setMarkList(url, thread->markList()); + if (thread->setMark(num, mark)) ThreadIndex::setMarkList(url, thread->markList()); } @@ -581,6 +581,6 @@ /* public */ const QString DatManager::threadURL(const KUrl& url) { - return Kita::getThreadURL(url); + return getThreadURL(url); } Modified: kita/branches/KITA-KDE4/kita/src/libkita/datmanager.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/datmanager.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/datmanager.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITADATMANAGER_H #define KITADATMANAGER_H Modified: kita/branches/KITA-KDE4/kita/src/libkita/downloadmanager.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/downloadmanager.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/downloadmanager.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITADOWNLOADMANAGER_H #define KITADOWNLOADMANAGER_H Modified: kita/branches/KITA-KDE4/kita/src/libkita/event.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/event.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/event.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITAEVENT_H #define KITAEVENT_H Modified: kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -111,7 +111,7 @@ board.appendChild(urlElement); urlElement.appendChild(document.createTextNode(boardURL)); - QString boardName = Kita::BoardManager::boardName(boardURL); + QString boardName = BoardManager::boardName(boardURL); QDomElement nameElement = document.createElement("name"); board.appendChild(nameElement); nameElement.appendChild(document.createTextNode(boardName)); Modified: kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -19,6 +19,8 @@ #include "thread.h" #include "threadindex.h" +using namespace Kita; + // FavoriteThreadItem FavoriteThreadItem::FavoriteThreadItem() {} @@ -109,9 +111,9 @@ QString name = nameNode.toElement().text(); KUrl datURL = Kita::getDatURL(url); - Kita::Thread* thread = Kita::Thread::getByURL(datURL); + Thread* thread = Thread::getByURL(datURL); thread->setThreadName(name); - Kita::ThreadIndex::loadIndex(thread, datURL); + ThreadIndex::loadIndex(thread, datURL); FavoriteThreads::getInstance() ->insert(datURL.prettyUrl()); } @@ -136,12 +138,12 @@ threadElement.appendChild(datURLElement); datURLElement.appendChild(document.createTextNode(datURL)); - QString threadName = Kita::DatManager::threadName(datURL); + QString threadName = DatManager::threadName(datURL); QDomElement nameElement = document.createElement("name"); threadElement.appendChild(nameElement); nameElement.appendChild(document.createTextNode(threadName)); - QString resNum = QString::number(Kita::DatManager::getResNum(datURL)); + QString resNum = QString::number(DatManager::getResNum(datURL)); QDomElement resNumElement = document.createElement("resnum"); threadElement.appendChild(resNumElement); resNumElement.appendChild(document.createTextNode(resNum)); @@ -150,12 +152,12 @@ QDomElement board = document.createElementNS("http://kita.sourceforge.jp/ns/board", "board"); threadElement.appendChild(board); - QString boardURL = Kita::BoardManager::boardURL(datURL); + QString boardURL = BoardManager::boardURL(datURL); QDomElement boardURLElement = document.createElement("url"); board.appendChild(boardURLElement); boardURLElement.appendChild(document.createTextNode(boardURL)); - QString boardName = Kita::BoardManager::boardName(boardURL); + QString boardName = BoardManager::boardName(boardURL); QDomElement boardNameElement = document.createElement("name"); board.appendChild(boardNameElement); boardNameElement.appendChild(document.createTextNode(boardName)); Modified: kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef FAVORITETHREADS_H #define FAVORITETHREADS_H Modified: kita/branches/KITA-KDE4/kita/src/libkita/flashcgi.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/flashcgi.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/flashcgi.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -13,6 +13,8 @@ #include "kita_misc.h" +using namespace Kita; + FlashCGI::FlashCGI() { } @@ -29,9 +31,9 @@ int mib = codec->mibEnum(); (ret += "submit=") += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ - (ret += "&FROM=") += Kita::encode_string(name, mib); - (ret += "&mail=") += Kita::encode_string(mail, mib); - (ret += "&MESSAGE=") += Kita::encode_string(body, mib); + (ret += "&FROM=") += encode_string(name, mib); + (ret += "&mail=") += encode_string(mail, mib); + (ret += "&MESSAGE=") += encode_string(body, mib); (ret += "&bbs=") += boardID; (ret += "&key=") += threadID; Modified: kita/branches/KITA-KDE4/kita/src/libkita/jbbs.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/jbbs.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/jbbs.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -13,6 +13,8 @@ #include "kita_misc.h" +using namespace Kita; + JBBS::JBBS() { } @@ -29,9 +31,9 @@ int mib = codec->mibEnum(); (ret += "submit=") += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ - (ret += "&NAME=") += Kita::encode_string(name, mib); - (ret += "&MAIL=") += Kita::encode_string(mail, mib); - (ret += "&MESSAGE=") += Kita::encode_string(body, mib).replace(';', "%3B"); + (ret += "&NAME=") += encode_string(name, mib); + (ret += "&MAIL=") += encode_string(mail, mib); + (ret += "&MESSAGE=") += encode_string(body, mib).replace(';', "%3B"); (ret += "&BBS=") += boardID.section('/', 1, 1); (ret += "&DIR=") += boardID.section('/', 0, 0); (ret += "&KEY=") += threadID; Modified: kita/branches/KITA-KDE4/kita/src/libkita/k2ch.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/k2ch.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/k2ch.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -13,6 +13,8 @@ #include "kita_misc.h" +using namespace Kita; + K2ch::K2ch() { } @@ -35,9 +37,9 @@ (ret += "submit=") += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ /* from, mail, message, bbs */ - (ret += "&FROM=") += Kita::encode_string(name, mib); - (ret += "&mail=") += Kita::encode_string(mail, mib); - (ret += "&MESSAGE=") += Kita::encode_string(body, mib); + (ret += "&FROM=") += encode_string(name, mib); + (ret += "&mail=") += encode_string(mail, mib); + (ret += "&MESSAGE=") += encode_string(body, mib); (ret += "&bbs=") += boardID; (ret += "&hana=mogera"); Modified: kita/branches/KITA-KDE4/kita/src/libkita/kita-utf16.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/kita-utf16.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/kita-utf16.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * **************************************************************************/ - #ifndef KITAUTF16_H #define KITAUTF16_H Modified: kita/branches/KITA-KDE4/kita/src/libkita/kita-utf8.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/kita-utf8.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/kita-utf8.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * 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 */ Modified: kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -26,30 +26,28 @@ #define KITA_RESDIGIT 4 -namespace Kita -{ - static QTextCodec* qcpCodec = 0; - static QTextCodec* utf8Codec = 0; - static QTextCodec* eucCodec = 0; +using namespace Kita; - static QString m_weekstr[ 7 ]; - static QString m_colonstr; - static QString m_colonnamestr; +static QTextCodec* qcpCodec = 0; +static QTextCodec* utf8Codec = 0; +static QTextCodec* eucCodec = 0; - /* fro convertURL */ - static int m_prevConvMode; - static QString m_prevConvURL; - static QString m_prevConvNewURL; - static QString m_prevConvRefstr; +static QString m_weekstr[ 7 ]; +static QString m_colonstr; +static QString m_colonnamestr; - /* for ParseMachiBBSOneLine */ - static QString m_machiSubject; - static QString m_machiLine; +/* fro convertURL */ +static int m_prevConvMode; +static QString m_prevConvURL; +static QString m_prevConvNewURL; +static QString m_prevConvRefstr; - static QTextCodec * codecForHint(int encoding_hint /* not 0 ! */); - static QString encode(const QString& segment, int encoding_offset, int encoding_hint, bool isRawURI = false); -} +/* for ParseMachiBBSOneLine */ +static QString m_machiSubject; +static QString m_machiLine; +static QTextCodec * codecForHint(int encoding_hint /* not 0 ! */); +static QString encode(const QString& segment, int encoding_offset, int encoding_hint, bool isRawURI = false); /*---------------------------------------------------*/ @@ -58,38 +56,38 @@ QString Kita::qcpToUnicode(const QByteArray& str) { - if (!Kita::qcpCodec) Kita::qcpCodec = QTextCodec::codecForName("Shift-JIS"); + if (!qcpCodec) qcpCodec = QTextCodec::codecForName("Shift-JIS"); - return Kita::qcpCodec->toUnicode(str); + return qcpCodec->toUnicode(str); } QString Kita::utf8ToUnicode(const QByteArray& str) { - if (!Kita::utf8Codec) Kita::utf8Codec = QTextCodec::codecForName("utf8"); + if (!utf8Codec) utf8Codec = QTextCodec::codecForName("utf8"); - return Kita::utf8Codec->toUnicode(str); + return utf8Codec->toUnicode(str); } QString Kita::eucToUnicode(const QByteArray& str) { - if (!Kita::eucCodec) Kita::eucCodec = QTextCodec::codecForName("eucJP"); + if (!eucCodec) eucCodec = QTextCodec::codecForName("eucJP"); - return Kita::eucCodec->toUnicode(str); + return eucCodec->toUnicode(str); } QByteArray Kita::unicodeToQcp(const QString& str) { - if (!Kita::qcpCodec) Kita::qcpCodec = QTextCodec::codecForName("Shift-JIS"); - return Kita::qcpCodec->fromUnicode(str); + if (!qcpCodec) qcpCodec = QTextCodec::codecForName("Shift-JIS"); + return qcpCodec->fromUnicode(str); } QByteArray Kita::unicodeToEuc(const QString& str) { - if (!Kita::eucCodec) Kita::eucCodec = QTextCodec::codecForName("eucJP"); + if (!eucCodec) eucCodec = QTextCodec::codecForName("eucJP"); - return Kita::eucCodec->fromUnicode(str); + return eucCodec->fromUnicode(str); } /*------------------------------------------------------------*/ @@ -245,7 +243,7 @@ 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); } @@ -256,17 +254,17 @@ return convertURL(URLMODE_THREAD, url, refstr); } -QString Kita::getNewThreadWriteURL(const KUrl& m_datURL) +QString getNewThreadWriteURL(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) { - 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/"; @@ -275,8 +273,8 @@ 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; } @@ -285,7 +283,7 @@ default: - m_bbscgi = Kita::BoardManager::boardRoot(m_datURL) + "/test/bbs.cgi"; + m_bbscgi = BoardManager::boardRoot(m_datURL) + "/test/bbs.cgi"; } return m_bbscgi; @@ -293,25 +291,25 @@ 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) { - 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 += Kita::DatManager::threadID(m_datURL) + '/'; + cgipath += DatManager::threadID(m_datURL) + '/'; 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; } @@ -320,7 +318,7 @@ default: - m_bbscgi = Kita::BoardManager::boardRoot(m_datURL) + "/test/bbs.cgi"; + m_bbscgi = BoardManager::boardRoot(m_datURL) + "/test/bbs.cgi"; } return m_bbscgi; @@ -378,7 +376,7 @@ } /* Is board enrolled ? */ - BoardData* bdata = Kita::BoardManager::getBoardData(url); + BoardData* bdata = BoardManager::getBoardData(url); if (bdata == 0) return QString(); QString urlstr = url.prettyUrl(); @@ -508,7 +506,7 @@ } -QString Kita::unescape(const QString& str) +QString unescape(const QString& str) { QString ret = str; return ret.replace("<", "<").replace(">", ">").replace("&", "&"); @@ -763,7 +761,7 @@ /* struct RESDAT is defined in datinfo.h. - This function is called from Kita::DatToHtml() and DatInfo::parseDat() + This function is called from DatToHtml() and DatInfo::parseDat() input: @@ -1306,8 +1304,8 @@ titleHTML.clear(); if (!resdat.parsed) return ; - bool showMailAddress = Kita::Config::showMailAddress(); - bool useTableTag = Kita::Config::useStyleSheet(); + bool showMailAddress = Config::showMailAddress(); + bool useTableTag = Config::useStyleSheet(); if (m_colonstr.isEmpty()) { m_colonstr = utf8ToUnicode(KITAUTF8_COLON); @@ -1418,7 +1416,7 @@ } // copied from kurl.cpp -static QTextCodec * Kita::codecForHint(int encoding_hint /* not 0 ! */) +static QTextCodec * codecForHint(int encoding_hint /* not 0 ! */) { return QTextCodec::codecForMib(encoding_hint); } @@ -1427,7 +1425,7 @@ // 0 encode both @ and / // 1 encode @ but not / // 2 encode neither @ or / -static QString Kita::encode(const QString& segment, int encoding_offset, int encoding_hint, bool isRawURI) +static QString encode(const QString& segment, int encoding_offset, int encoding_hint, bool isRawURI) { const char *encode_string = "/@<>#\"&?={}|^~[]\'`\\:+%"; encode_string += encoding_offset; Modified: kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * 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 Modified: kita/branches/KITA-KDE4/kita/src/libkita/machibbs.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/machibbs.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/machibbs.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -13,6 +13,8 @@ #include "kita_misc.h" +using namespace Kita; + MachiBBS::MachiBBS() { } @@ -29,9 +31,9 @@ int mib = codec->mibEnum(); (ret += "submit=") += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ - (ret += "&NAME=") += Kita::encode_string(name, mib); - (ret += "&MAIL=") += Kita::encode_string(mail, mib); - (ret += "&MESSAGE=") += Kita::encode_string(body, mib); + (ret += "&NAME=") += encode_string(name, mib); + (ret += "&MAIL=") += encode_string(mail, mib); + (ret += "&MESSAGE=") += encode_string(body, mib); (ret += "&BBS=") += boardID; (ret += "&KEY=") += threadID; (ret += "&TIME=") += QString::number(serverTime); Modified: kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -25,12 +25,13 @@ public: static KUrl parseURL(const KUrl& url , QString& refstr) { - return Kita::getDatURL(url , refstr); + return getDatURL(url , refstr); } - static KUrl parseURLonly(const KUrl& url) { return Kita::getDatURL(url); } + static KUrl parseURLonly(const KUrl& url) { return getDatURL(url); } - static QString utf8ToUnicode(const QByteArray& str) { return Kita::utf8ToUnicode(str); } + static QString utf8ToUnicode(const QByteArray& str) + { return utf8ToUnicode(str); } }; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/thread.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/thread.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/thread.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -155,7 +155,7 @@ while (it.hasNext()) { it.next(); QString url = it.key(); - Kita::Thread* thread = it.value(); + Thread* thread = it.value(); if (url.indexOf(fromURL) == 0) { m_threadDict->remove(url); url = url.replace(0, fromURL.length(), toURL); Modified: kita/branches/KITA-KDE4/kita/src/libkita/thread.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/thread.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/thread.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITATHREAD_H #define KITATHREAD_H Modified: kita/branches/KITA-KDE4/kita/src/libkita/threadindex.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/threadindex.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/threadindex.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -25,63 +25,63 @@ QString ThreadIndex::getSubject(const KUrl& url) { - QString indexPath = Kita::Cache::getIndexPath(url); + QString indexPath = Cache::getIndexPath(url); KConfig config(indexPath); return getSubjectPrivate(config); } void ThreadIndex::setSubject(const KUrl& url, const QString& str) { - QString indexPath = Kita::Cache::getIndexPath(url); + QString indexPath = Cache::getIndexPath(url); KConfig config(indexPath); setSubjectPrivate(str, config); } int ThreadIndex::getResNum(const KUrl& url) { - QString indexPath = Kita::Cache::getIndexPath(url); + QString indexPath = Cache::getIndexPath(url); KConfig config(indexPath); return getResNumPrivate(url, config); } void ThreadIndex::setResNum(const KUrl& url, int resNum) { - QString indexPath = Kita::Cache::getIndexPath(url); + QString indexPath = Cache::getIndexPath(url); KConfig config(indexPath); setResNumPrivate(resNum, config); } int ThreadIndex::getReadNum(const KUrl& url) { - QString indexPath = Kita::Cache::getIndexPath(url); + QString indexPath = Cache::getIndexPath(url); KConfig config(indexPath); return getReadNumPrivate(url, config, true); } void ThreadIndex::setReadNum(const KUrl& url, int readNum) { - QString indexPath = Kita::Cache::getIndexPath(url); + QString indexPath = Cache::getIndexPath(url); KConfig config(indexPath); setReadNumPrivate(readNum, config); } int ThreadIndex::getViewPos(const KUrl& url) { - QString indexPath = Kita::Cache::getIndexPath(url); + QString indexPath = Cache::getIndexPath(url); KConfig config(indexPath); return getViewPosPrivate(config); } void ThreadIndex::setViewPos(const KUrl& url, int viewPos) { - QString indexPath = Kita::Cache::getIndexPath(url); + QString indexPath = Cache::getIndexPath(url); KConfig config(indexPath); setViewPosPrivate(viewPos, config); } void ThreadIndex::setMarkList(const KUrl& url, const QList<int>& markList) { - QString indexPath = Kita::Cache::getIndexPath(url); + QString indexPath = Cache::getIndexPath(url); KConfig config(indexPath); setMarkListPrivate(markList, config); } @@ -91,9 +91,9 @@ /* load thread information */ /* public */ /* static */ -void ThreadIndex::loadIndex(Kita::Thread* thread, const KUrl& url, bool checkCached) +void ThreadIndex::loadIndex(Thread* thread, const KUrl& url, bool checkCached) { - QString indexPath = Kita::Cache::getIndexPath(url); + QString indexPath = Cache::getIndexPath(url); KConfig config(indexPath); /* load read number */ @@ -125,16 +125,16 @@ /* save thread information */ /* public */ /* static */ -void ThreadIndex::saveIndex(const Kita::Thread* thread, const KUrl& url) +void ThreadIndex::saveIndex(const Thread* thread, const KUrl& url) { /* If readNum == 0, delete idx file */ if (thread->readNum() == 0) { - QString indexPath = Kita::DatManager::getCacheIndexPath(url); + QString indexPath = DatManager::getCacheIndexPath(url); QFile::remove(indexPath); } - QString indexPath = Kita::Cache::getIndexPath(url); + QString indexPath = Cache::getIndexPath(url); KConfig config(indexPath); /* save thread name */ @@ -153,9 +153,9 @@ setMarkListPrivate(thread->markList(), config); /* save "cache" */ - KUrl datURL = Kita::getDatURL(url); + KUrl datURL = getDatURL(url); int num = (thread->viewPos() ? thread->viewPos() : thread->readNum()); - KitaThreadInfo::setReadNum(datURL.prettyUrl(), num); + ThreadInfo::setReadNum(datURL.prettyUrl(), num); } @@ -182,8 +182,8 @@ /* use obsoleted "cache" file */ if (!resNum) { - KUrl datURL = Kita::getDatURL(url); - resNum = KitaThreadInfo::readNum(datURL.prettyUrl()); + KUrl datURL = getDatURL(url); + resNum = ThreadInfo::readNum(datURL.prettyUrl()); if (resNum) config.group("").writeEntry("ResNum", resNum); } @@ -204,7 +204,7 @@ /* If cache does not exist, return 0 */ if (checkCached) { - QString path = Kita::DatManager::getCachePath(url); + QString path = DatManager::getCachePath(url); if (! QFile::exists(path)) { return 0; } @@ -219,8 +219,8 @@ /* use obsoleted "cache" file */ if (!readNum) { - KUrl datURL = Kita::getDatURL(url); - readNum = KitaThreadInfo::readNum(datURL.prettyUrl()); + KUrl datURL = getDatURL(url); + readNum = ThreadInfo::readNum(datURL.prettyUrl()); } if (readNum) config.group("").writeEntry("ReadNum", readNum); Modified: kita/branches/KITA-KDE4/kita/src/libkita/threadindex.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/threadindex.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/threadindex.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -46,8 +46,9 @@ /*---------------------------------*/ - static void loadIndex(Kita::Thread* thread, const KUrl& url, bool checkCached = true); - static void saveIndex(const Kita::Thread* thread, const KUrl& url); + static void loadIndex(Thread* thread, const KUrl& url, + bool checkCached = true); + static void saveIndex(const Thread* thread, const KUrl& url); private: Modified: kita/branches/KITA-KDE4/kita/src/libkita/threadinfo.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/threadinfo.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/threadinfo.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -13,25 +13,27 @@ #include <QtCore/QDataStream> #include <QtCore/QMap> -KitaThreadInfo* KitaThreadInfo::instance = 0; +using namespace Kita; -KitaThreadInfo::KitaThreadInfo() : m_readDict() +ThreadInfo* ThreadInfo::instance = 0; + +ThreadInfo::ThreadInfo() : m_readDict() {} -KitaThreadInfo::~KitaThreadInfo() +ThreadInfo::~ThreadInfo() {} -KitaThreadInfo* KitaThreadInfo::getInstance() +ThreadInfo* ThreadInfo::getInstance() { if (instance == 0) { - instance = new KitaThreadInfo(); + instance = new ThreadInfo(); } return instance; } -int KitaThreadInfo::readNum(const QString& url) +int ThreadInfo::readNum(const QString& url) { - KitaThreadInfo * instance = KitaThreadInfo::getInstance(); + ThreadInfo * instance = ThreadInfo::getInstance(); if (instance->m_readDict.contains(url)) { return instance->m_readDict[ url ]; } else { @@ -39,16 +41,16 @@ } } -void KitaThreadInfo::setReadNum(const QString& url, int num) +void ThreadInfo::setReadNum(const QString& url, int num) { - KitaThreadInfo * instance = KitaThreadInfo::getInstance(); + 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(); + ThreadInfo* instance = ThreadInfo::getInstance(); if (instance == 0) return ; for (it = instance->m_readDict.begin(); it != instance->m_readDict.end(); ++it) { @@ -63,20 +65,21 @@ } } -void KitaThreadInfo::removeThreadInfo(const QString& url) +void ThreadInfo::removeThreadInfo(const QString& url) { - KitaThreadInfo * instance = KitaThreadInfo::getInstance(); + 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/branches/KITA-KDE4/kita/src/libkita/threadinfo.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/threadinfo.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/libkita/threadinfo.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITATHREADINFO_H #define KITATHREADINFO_H @@ -15,27 +14,29 @@ #include <kdemacros.h> -/** - * - * Hideki Ikemoto - **/ - -class KDE_EXPORT 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); - KDE_EXPORT friend QDataStream& operator<<(QDataStream& s, KitaThreadInfo& c); - KDE_EXPORT 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 Modified: kita/branches/KITA-KDE4/kita/src/main.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/main.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/main.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -23,6 +23,8 @@ static const char *version = "0.200.0"; // TODO +using namespace Kita; + int main(int argc, char **argv) { // for code page 932 with NEC special characters @@ -45,21 +47,21 @@ // app.dcopClient() ->registerAs(app.name(), FALSE); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); - Kita::Config::setBoardListUrl(QString(args->getOption("boardlist"))); + Config::setBoardListUrl(QString(args->getOption("boardlist"))); // see if we are starting with session management if (app.isSessionRestored()) { - kRestoreMainWindows<KitaMainWindow>(); + kRestoreMainWindows<MainWindow>(); } else { // no session.. just start up normally KCmdLineArgs * args = KCmdLineArgs::parsedArgs(); if (args->count() == 0) { - KitaMainWindow * widget = new KitaMainWindow; + MainWindow * widget = new MainWindow; widget->show(); } else { int i = 0; for (; i < args->count(); i++) { - KitaMainWindow *widget = new KitaMainWindow; + MainWindow *widget = new MainWindow; widget->show(); widget->load(args->url(i)); } Modified: kita/branches/KITA-KDE4/kita/src/mainwindow.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/mainwindow.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/mainwindow.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -47,8 +47,9 @@ #include "libkita/threadinfo.h" #include "prefs/prefs.h" -KitaMainWindow::KitaMainWindow() - : KXmlGuiWindow(0) +using namespace Kita; + +MainWindow::MainWindow() : KXmlGuiWindow(0) { // FIXME: merge *.po KGlobal::locale() ->insertCatalog("kitapart"); @@ -66,22 +67,22 @@ loadCache(); // load ascii art - Kita::AsciiArtConfig::self()->readConfig(); - if (Kita::AsciiArtConfig::self()->asciiArtList().empty()) { + AsciiArtConfig::self()->readConfig(); + if (AsciiArtConfig::self()->asciiArtList().empty()) { loadAsciiArt(); } // load abone lists - Kita::AboneConfig::self()->readConfig(); - if (Kita::AboneConfig::self()->aboneIDList().empty()) { + AboneConfig::self()->readConfig(); + if (AboneConfig::self()->aboneIDList().empty()) { loadAboneIDList(); } - if (Kita::AboneConfig::self()->aboneNameList().empty()) { + if (AboneConfig::self()->aboneNameList().empty()) { loadAboneNameList(); } - if (Kita::AboneConfig::self()->aboneWordList().empty()) { + if (AboneConfig::self()->aboneWordList().empty()) { loadAboneWordList(); } @@ -91,7 +92,7 @@ // for compativility loadCompletion(); - Kita::Config::self()->readConfig(); + Config::self()->readConfig(); // apply the saved mainwindow settings, if any, and ask the mainwindow // to automatically save settings if changed: window size, toolbar @@ -99,7 +100,7 @@ setAutoSaveSettings(); // set list font - setFont(Kita::Config::font()); + setFont(Config::font()); // allow the view to change the statusbar and caption connect(m_urlLine, SIGNAL(returnPressed()), @@ -129,16 +130,16 @@ // update favorite list ViewMediator::getInstance()->updateFavoriteListView(); - if (Kita::Config::autoLogin()) { + if (Config::autoLogin()) { login(); } } -KitaMainWindow::~KitaMainWindow() +MainWindow::~MainWindow() { - Kita::AboneConfig::self()->writeConfig(); + AboneConfig::self()->writeConfig(); - Kita::AsciiArtConfig::self()->writeConfig(); + AsciiArtConfig::self()->writeConfig(); saveFavoriteBoards(); @@ -148,17 +149,17 @@ saveMainWindowSettings(KGlobal::config().data()->group("MainWindow")); - Kita::Config::self()->writeConfig(); + Config::self()->writeConfig(); - Kita::DatManager::deleteAllDatInfo(); + DatManager::deleteAllDatInfo(); } -void KitaMainWindow::load(const KUrl& url) +void MainWindow::load(const KUrl& url) { setCaption(url.url()); } -void KitaMainWindow::bookmark(const QString& datURL, bool on) +void MainWindow::bookmark(const QString& datURL, bool on) { FavoriteThreads * favorite = FavoriteThreads::getInstance(); @@ -171,23 +172,23 @@ ViewMediator::getInstance()->updateFavoriteListView(); } -void KitaMainWindow::login() +void MainWindow::login() { - if (Kita::Account::login(Kita::Config::userID(), Kita::Config::password())) { + if (Account::login(Config::userID(), Config::password())) { setMainStatus(i18n("Login succeeded.")); } else { setMainStatus(i18n("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().data()->group("MainWindow")); } -void KitaMainWindow::optionsShowToolbar() +void MainWindow::optionsShowToolbar() { // this is all very cut and paste code for showing/hiding the // toolbar @@ -198,7 +199,7 @@ } } -void KitaMainWindow::optionsShowStatusbar() +void MainWindow::optionsShowStatusbar() { // this is all very cut and paste code for showing/hiding the // statusbar @@ -209,12 +210,12 @@ } } -void KitaMainWindow::optionsConfigureKeys() +void MainWindow::optionsConfigureKeys() { KShortcutsDialog::configure(actionCollection()); } -void KitaMainWindow::optionsConfigureToolbars() +void MainWindow::optionsConfigureToolbars() { // use the standard toolbar editor KEditToolBar dlg(factory()); @@ -223,14 +224,14 @@ dlg.exec(); } -void KitaMainWindow::optionsPreferences() +void MainWindow::optionsPreferences() { // popup some sort of preference dialog, here if (KConfigDialog::showDialog("Kita Preferences")) { return; } - KitaPreferences* dialog = new KitaPreferences(this); + Preferences* dialog = new Preferences(this); connect(dialog, SIGNAL(fontChanged(const QFont&)), SLOT(setFont(const QFont&))); @@ -238,24 +239,24 @@ dialog->show(); } -void KitaMainWindow::settingsMenuAboutToShow() +void MainWindow::settingsMenuAboutToShow() { 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); } -void KitaMainWindow::setUrl(const KUrl& url) +void MainWindow::setUrl(const KUrl& url) { m_urlLine->setText(url.url()); } -void KitaMainWindow::slotEditCopy() +void MainWindow::slotEditCopy() { QWidget * widget = KApplication::kApplication()->focusWidget(); @@ -265,16 +266,16 @@ } } -void KitaMainWindow::setMainStatus(const QString& statusStr) +void MainWindow::setMainStatus(const QString& statusStr) { // display the text on the statusbar statusBar() ->showMessage(statusStr); } -void KitaMainWindow::slotURLLine() +void MainWindow::slotURLLine() { KUrl url = m_urlLine->text(); - KUrl datURL = Kita::getDatURL(url); + KUrl datURL = getDatURL(url); m_threadTab->slotShowMainThread(datURL); } @@ -282,7 +283,7 @@ // private method // -void KitaMainWindow::setupActions() +void MainWindow::setupActions() { KStandardAction::quit(this, SLOT(close()), actionCollection()); KStandardAction::copy(this, SLOT(slotEditCopy()), actionCollection()); @@ -327,7 +328,7 @@ factory() ->addClient(m_writeTab); } -void KitaMainWindow::setupView() +void MainWindow::setupView() { ViewMediator::getInstance()->setMainWindow(this); @@ -337,14 +338,14 @@ QSplitter* hsplit = new QSplitter(mainWidget); mainLayout->addWidget(hsplit); - m_bbsTab = new KitaBBSTabWidget(hsplit); + m_bbsTab = new BBSTabWidget(hsplit); QSplitter* vsplit = new QSplitter(Qt::Vertical, hsplit); - m_boardTab = new KitaBoardTabWidget(vsplit); + m_boardTab = new BoardTabWidget(vsplit); ViewMediator::getInstance()->setBoardTabWidget(m_boardTab); - m_threadTab = new KitaThreadTabWidget(vsplit); + m_threadTab = new ThreadTabWidget(vsplit); ViewMediator::getInstance()->setThreadTabWidget(m_threadTab); hsplit->setSizes(QList<int>() << 100 << 500); @@ -353,13 +354,13 @@ setCentralWidget(mainWidget); /* write dock */ - m_writeTab = new KitaWriteTabWidget(0); + m_writeTab = new WriteTabWidget(0); ViewMediator::getInstance()->setWriteTabWidget(m_writeTab); } -void KitaMainWindow::loadCache() +void MainWindow::loadCache() { - KitaThreadInfo * cache = KitaThreadInfo::getInstance(); + ThreadInfo * cache = ThreadInfo::getInstance(); QString cacheConfigPath = KStandardDirs::locateLocal("appdata", "cache"); QFile file(cacheConfigPath); if (file.open(QIODevice::ReadOnly)) { @@ -368,9 +369,9 @@ } } -void KitaMainWindow::saveCache() +void MainWindow::saveCache() { - KitaThreadInfo * cache = KitaThreadInfo::getInstance(); + ThreadInfo * cache = ThreadInfo::getInstance(); QString cacheConfigPath = KStandardDirs::locateLocal("appdata", "cache"); QFile file(cacheConfigPath); if (file.open(QIODevice::WriteOnly)) { @@ -379,7 +380,7 @@ } } -void KitaMainWindow::loadFavorites() +void MainWindow::loadFavorites() { QString favoritesConfigPath = KStandardDirs::locateLocal("appdata", "favorites.xml"); QFile file(favoritesConfigPath); @@ -392,7 +393,7 @@ } } -void KitaMainWindow::saveFavorites() +void MainWindow::saveFavorites() { QString favoritesConfigPath = KStandardDirs::locateLocal("appdata", "favorites.xml"); QFile file(favoritesConfigPath); @@ -403,7 +404,7 @@ } } -void KitaMainWindow::loadFavoriteBoards() +void MainWindow::loadFavoriteBoards() { QString configPath = KStandardDirs::locateLocal("appdata", "favorite_boards.xml"); QFile file(configPath); @@ -412,30 +413,30 @@ stream.setCodec("UTF-8"); QString xml = stream.readAll(); - Kita::FavoriteBoards::readFromXML(xml); + FavoriteBoards::readFromXML(xml); } } -void KitaMainWindow::saveFavoriteBoards() +void MainWindow::saveFavoriteBoards() { QString configPath = KStandardDirs::locateLocal("appdata", "favorite_boards.xml"); QFile file(configPath); if (file.open(QIODevice::WriteOnly)) { QTextStream stream(&file); stream.setCodec("UTF-8"); - stream << Kita::FavoriteBoards::toXML(); + stream << FavoriteBoards::toXML(); } } -void KitaMainWindow::loadCompletion() +void MainWindow::loadCompletion() { QString configPath = KStandardDirs::locateLocal("appdata", "completion"); KConfig config(configPath); - Kita::Config::setNameCompletionList(config.group("").readEntry("name", QStringList() )); + Config::setNameCompletionList(config.group("").readEntry("name", QStringList() )); } -void KitaMainWindow::loadAsciiArt() +void MainWindow::loadAsciiArt() { QString configPath = KStandardDirs::locateLocal("appdata", "asciiart"); QFile file(configPath); @@ -451,11 +452,11 @@ list << str; } } - Kita::AsciiArtConfig::setAsciiArtList(list); + AsciiArtConfig::setAsciiArtList(list); } } -void KitaMainWindow::loadAboneIDList() +void MainWindow::loadAboneIDList() { QString configPath = KStandardDirs::locateLocal("appdata", "abone_id"); QFile file(configPath); @@ -471,11 +472,11 @@ list << str; } } - Kita::AboneConfig::setAboneIDList(list); + AboneConfig::setAboneIDList(list); } } -void KitaMainWindow::loadAboneNameList() +void MainWindow::loadAboneNameList() { QString configPath = KStandardDirs::locateLocal("appdata", "abone_name"); QFile file(configPath); @@ -491,11 +492,11 @@ list << str; } } - Kita::AboneConfig::setAboneNameList(list); + AboneConfig::setAboneNameList(list); } } -void KitaMainWindow::loadAboneWordList() +void MainWindow::loadAboneWordList() { QString configPath = KStandardDirs::locateLocal("appdata", "abone_word"); QFile file(configPath); @@ -511,7 +512,7 @@ list << str; } } - Kita::AboneConfig::setAboneWordList(list); + AboneConfig::setAboneWordList(list); } } Modified: kita/branches/KITA-KDE4/kita/src/mainwindow.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/mainwindow.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/mainwindow.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITAMAINWINDOW_H #define KITAMAINWINDOW_H @@ -22,10 +21,6 @@ class KToggleAction; class KUrl; -class KitaBBSTabWidget; -class KitaBoardTabWidget; -class KitaThreadTabWidget; -class KitaWriteTabWidget; namespace KParts { @@ -33,6 +28,12 @@ class Part; } +namespace Kita { + class BBSTabWidget; + class BoardTabWidget; + class ThreadTabWidget; + class WriteTabWidget; + /** * This class serves as the main window for Kita. It handles the * menus, toolbars, and status bars. @@ -42,59 +43,60 @@ * @version $APP_VERSION */ -class KitaMainWindow : public KXmlGuiWindow -{ - 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(); + 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(); - KitaMainWindow(const KitaMainWindow&); - KitaMainWindow& operator=(const KitaMainWindow&); -}; + MainWindow(const MainWindow&); + MainWindow& operator=(const MainWindow&); + }; +} -#endif // KITAMAINWINDOW_H +#endif // MAINWINDOW_H Modified: kita/branches/KITA-KDE4/kita/src/prefs/prefs.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/prefs/prefs.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/prefs/prefs.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -22,8 +22,8 @@ using namespace Kita; -KitaPreferences::KitaPreferences(QWidget* parent) - : KConfigDialog(parent, "Kita Preferences", Kita::Config::self()) +Preferences::Preferences(QWidget* parent) + : KConfigDialog(parent, "Kita Preferences", Config::self()) { enableButtonApply(false); enableButton(Help, false); @@ -31,28 +31,28 @@ // a Treelist dialog.. but there are a number of other // possibilities (including Tab, Swallow, and just Plain) - m_facePage = new Kita::Ui::FacePrefPage(0); + m_facePage = new Ui::FacePrefPage(0); m_facePageItem = addPage(m_facePage, i18n("Face"), "view_detailed"); connect(m_facePage, SIGNAL(fontChanged(const QFont&)), SIGNAL(fontChanged(const QFont&))); - m_asciiArtPage = new Kita::Ui::AsciiArtPrefPage(0); + m_asciiArtPage = new Ui::AsciiArtPrefPage(0); m_asciiArtPageItem = addPage(m_asciiArtPage, i18n("AsciiArt"), "kita"); - m_uiPage = new Kita::Ui::UIPrefPage(0); + m_uiPage = new Ui::UIPrefPage(0); m_uiPageItem = addPage(m_uiPage, i18n("User Interface"), "configure"); - m_abonePage = new Kita::Ui::AbonePrefPage(0); + m_abonePage = new Ui::AbonePrefPage(0); m_abonePageItem = addPage(m_abonePage, i18n("Abone"), "kita"); QWidget* m_loginWidget = new QWidget; - m_loginPage = new Kita::Ui::LoginPrefPage(); + m_loginPage = new Ui::LoginPrefPage(); m_loginPage->setupUi(m_loginWidget); m_loginPageItem = addPage(m_loginWidget, i18n("Login"), "connect_established"); QWidget* m_writeWidget = new QWidget; - m_writePage = new Kita::Ui::WritePrefPage(); + m_writePage = new Ui::WritePrefPage(); m_writePage->setupUi(m_writeWidget); m_writePageItem = addPage(m_writeWidget, i18n("Write"), "edit"); @@ -66,7 +66,7 @@ connect(this, SIGNAL(currentPageChanged(KPageWidgetItem*, KPageWidgetItem*)), SLOT(slotCurrentPageChanged())); } -void KitaPreferences::slotApply() +void Preferences::slotApply() { if (currentPage() == m_facePageItem) { // face @@ -87,7 +87,7 @@ enableButtonApply(false); } -void KitaPreferences::slotDefault() +void Preferences::slotDefault() { if (currentPage() == m_facePageItem) { // face @@ -107,12 +107,12 @@ enableButtonApply(true); } -void KitaPreferences::slotChanged() +void Preferences::slotChanged() { enableButtonApply(true); } -void KitaPreferences::slotOk() +void Preferences::slotOk() { m_facePage->apply(); m_asciiArtPage->apply(); @@ -122,7 +122,7 @@ // KDialogBase::slotOk(); } -void KitaPreferences::slotCurrentPageChanged() +void Preferences::slotCurrentPageChanged() { if (currentPage() == m_asciiArtPageItem) { // ascii art @@ -141,8 +141,8 @@ void Ui::AsciiArtPrefPage::init() { - asciiArtText->setText(Kita::AsciiArtConfig::asciiArtList().join("\n")); - asciiArtText->setFont(Kita::Config::threadFont()); + asciiArtText->setText(AsciiArtConfig::asciiArtList().join("\n")); + asciiArtText->setFont(Config::threadFont()); } void Ui::AsciiArtPrefPage::apply() @@ -150,7 +150,7 @@ QString text = asciiArtText->toPlainText(); QStringList list = text.split('\n'); - Kita::AsciiArtConfig::setAsciiArtList(list); + AsciiArtConfig::setAsciiArtList(list); } void Ui::AsciiArtPrefPage::reset() @@ -174,7 +174,7 @@ kcfg_MarkTime->setValue(24); kcfg_ShowMailAddress->setChecked(false); kcfg_ShowNum->setValue(100); - kcfg_ListSortOrder->setButton(Kita::Config::EnumListSortOrder::Mark); + kcfg_ListSortOrder->setButton(Config::EnumListSortOrder::Mark); kcfg_PartMimeList->setText("image/gif,image/jpeg,image/png,image/x-bmp"); kcfg_UsePart->setChecked(true); } @@ -203,10 +203,10 @@ m_threadColorChanged = false; // color - threadColorButton->setColor(Kita::Config::threadColor()); - threadBackgroundColorButton->setColor(Kita::Config::threadBackground()); - popupColorButton->setColor(Kita::Config::popupColor()); - popupBackgroundColorButton->setColor(Kita::Config::popupBackground()); + threadColorButton->setColor(Config::threadColor()); + threadBackgroundColorButton->setColor(Config::threadBackground()); + popupColorButton->setColor(Config::popupColor()); + popupBackgroundColorButton->setColor(Config::popupBackground()); connect(threadColorButton, SIGNAL(changed(const QColor&)), SIGNAL(changed())); connect(threadBackgroundColorButton, SIGNAL(changed(const QColor&)), SIGNAL(changed())); @@ -220,40 +220,40 @@ { // font QFont font = listFontButton->font(); - Kita::Config::setFont(font); + Config::setFont(font); emit fontChanged(font); if (m_threadFontchanged) { QFont threadFont = threadFontButton->font(); - Kita::Config::setThreadFont(threadFont); + Config::setThreadFont(threadFont); } m_threadFontchanged = false; QFont popupFont = popupFontButton->font(); - Kita::Config::setPopupFont(popupFont); + Config::setPopupFont(popupFont); // color if (m_threadColorChanged) { - Kita::Config::setThreadColor(threadColorButton->color()); - Kita::Config::setThreadBackground(threadBackgroundColorButton->color()); + Config::setThreadColor(threadColorButton->color()); + Config::setThreadBackground(threadBackgroundColorButton->color()); } m_threadColorChanged = false; - Kita::Config::setPopupColor(popupColorButton->color()); - Kita::Config::setPopupBackground(popupBackgroundColorButton->color()); + Config::setPopupColor(popupColorButton->color()); + Config::setPopupBackground(popupBackgroundColorButton->color()); } void Ui::FacePrefPage::reset() { // font QFont font; - listFontButton->setText(Kita::fontToString(font)); + listFontButton->setText(fontToString(font)); listFontButton->setFont(font); - threadFontButton->setText(Kita::fontToString(font)); + threadFontButton->setText(fontToString(font)); threadFontButton->setFont(font); m_threadFontchanged = true; - popupFontButton->setText(Kita::fontToString(font)); + popupFontButton->setText(fontToString(font)); popupFontButton->setFont(font); // color @@ -266,16 +266,16 @@ void Ui::FacePrefPage::updateButtons() { - QFont font = Kita::Config::font(); - listFontButton->setText(Kita::fontToString(font)); + QFont font = Config::font(); + listFontButton->setText(fontToString(font)); listFontButton->setFont(font); - QFont threadFont = Kita::Config::threadFont(); - threadFontButton->setText(Kita::fontToString(threadFont)); + QFont threadFont = Config::threadFont(); + threadFontButton->setText(fontToString(threadFont)); threadFontButton->setFont(threadFont); - QFont popupFont = Kita::Config::popupFont(); - popupFontButton->setText(Kita::fontToString(popupFont)); + QFont popupFont = Config::popupFont(); + popupFontButton->setText(fontToString(popupFont)); popupFontButton->setFont(popupFont); } @@ -284,7 +284,7 @@ QFont threadFont = threadFontButton->font(); if (KFontDialog::getFont(threadFont, false, this) == QDialog::Accepted) { - threadFontButton->setText(Kita::fontToString(threadFont)); + threadFontButton->setText(fontToString(threadFont)); threadFontButton->setFont(threadFont); emit changed(); m_threadFontchanged = true; @@ -296,7 +296,7 @@ QFont font = listFontButton->font(); if (KFontDialog::getFont(font, false, this) == QDialog::Accepted) { - listFontButton->setText(Kita::fontToString(font)); + listFontButton->setText(fontToString(font)); listFontButton->setFont(font); emit changed(); } @@ -307,7 +307,7 @@ QFont font = popupFontButton->font(); if (KFontDialog::getFont(font, false, this) == QDialog::Accepted) { - popupFontButton->setText(Kita::fontToString(font)); + popupFontButton->setText(fontToString(font)); popupFontButton->setFont(font); emit changed(); } Modified: kita/branches/KITA-KDE4/kita/src/prefs/prefs.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/prefs/prefs.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/prefs/prefs.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -21,55 +21,54 @@ namespace Kita { -namespace Ui -{ + namespace Ui + { - class AsciiArtPrefPage; - class UIPrefPage; - class AbonePrefPage; - class LoginPrefPage; - class FacePrefPage; - class WritePrefPage; -} -} + class AsciiArtPrefPage; + class UIPrefPage; + class AbonePrefPage; + class LoginPrefPage; + class FacePrefPage; + class WritePrefPage; + } -class KDE_EXPORT KitaPreferences : public KConfigDialog -{ - Q_OBJECT + class KDE_EXPORT Preferences : public KConfigDialog + { + Q_OBJECT -public: - KitaPreferences(QWidget* parent); + public: + Preferences(QWidget* parent); -protected: - virtual void slotApply(); + protected: + virtual void slotApply(); -private: - KitaPreferences(const KitaPreferences&); - KitaPreferences& operator=(const KitaPreferences&); - Kita::Ui::FacePrefPage* m_facePage; - Kita::Ui::AsciiArtPrefPage* m_asciiArtPage; - Kita::Ui::UIPrefPage* m_uiPage; - Kita::Ui::AbonePrefPage* m_abonePage; - Kita::Ui::LoginPrefPage* m_loginPage; - Kita::Ui::WritePrefPage* m_writePage; + private: + Preferences(const Preferences&); + Preferences& operator=(const Preferences&); + Ui::FacePrefPage* m_facePage; + Ui::AsciiArtPrefPage* m_asciiArtPage; + Ui::UIPrefPage* m_uiPage; + Ui::AbonePrefPage* m_abonePage; + Ui::LoginPrefPage* m_loginPage; + Ui::WritePrefPage* m_writePage; - KPageWidgetItem* m_facePageItem; - KPageWidgetItem* m_asciiArtPageItem; - KPageWidgetItem* m_uiPageItem; - KPageWidgetItem* m_abonePageItem; - KPageWidgetItem* m_loginPageItem; - KPageWidgetItem* m_writePageItem; + KPageWidgetItem* m_facePageItem; + KPageWidgetItem* m_asciiArtPageItem; + KPageWidgetItem* m_uiPageItem; + KPageWidgetItem* m_abonePageItem; + KPageWidgetItem* m_loginPageItem; + KPageWidgetItem* m_writePageItem; + + private slots: + void slotChanged(); + virtual void slotOk(); + virtual void slotDefault(); + void slotCurrentPageChanged(); -private slots: - void slotChanged(); - virtual void slotOk(); - virtual void slotDefault(); - void slotCurrentPageChanged(); + signals: + void fontChanged(const QFont&); + }; -signals: - void fontChanged(const QFont&); -}; - /*class DebugPrefPage : public DebugPrefBase { Q_OBJECT @@ -81,8 +80,6 @@ void replace(); };*/ -namespace Kita -{ class Ui::AsciiArtPrefPage : public QWidget, public Ui::AsciiArtPrefBase { Q_OBJECT Modified: kita/branches/KITA-KDE4/kita/src/respopup.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/respopup.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/respopup.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -22,276 +22,275 @@ #include "kitaui/htmlview.h" #include "libkita/config_xt.h" -namespace Kita +using 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, - Qt::FramelessWindowHint - | Qt::Tool - | Qt::Window - | Qt::X11BypassWindowManagerHint - ) - { - m_url = url; - m_htmlPart = 0; + 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->setup(HTMLPART_MODE_POPUP , url); + connect(m_htmlPart, SIGNAL(hideChildPopup()), SIGNAL(hideChildPopup())); +} - ResPopup::~ResPopup() - { - 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(Config::popupFont().pointSize()) + .arg(Config::popupFont().family()) + .arg(Config::popupColor().name()) + .arg(Config::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(KUrl("file:/dummy.htm")); - m_htmlPart->write(text); - m_htmlPart->end(); - m_htmlPart->view() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - } + if (m_htmlPart) { + m_htmlPart->view() ->resize(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); } +} - /* public */ - void ResPopup::adjustSize() - { - 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; + int wd = maxwidth + mrg; + int ht = maxheight + mrg; - m_htmlPart->view() ->resize(wd, ht); - QFrame::adjustSize(); - } + 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 - }; +/* public */ +void ResPopup::adjustPos(const QPoint& point) +{ + QPoint pos = point; + enum{ + POS_LeftUp, + POS_RightUp, + POS_LeftDown, + POS_RightDown + }; - /* config */ + /* config */ - const int mrg = 16; + const int mrg = 16; - /*----------------------------*/ + /*----------------------------*/ - if (!m_htmlPart) return ; + 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; + 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 ((x + mrg) + wd < sw - && (y - mrg) - ht >= 0) idx = POS_RightUp; + if ((x + mrg) + wd < sw + && (y - mrg) - ht >= 0) idx = POS_RightUp; - else if ((x - mrg) - wd >= 0 - && y - (ht + mrg) >= 0) idx = POS_LeftUp; + else if ((x - mrg) - wd >= 0 + && y - (ht + mrg) >= 0) idx = POS_LeftUp; - else if ((x + mrg) + wd < sw - && (y + mrg) + ht < sh) idx = POS_RightDown; + else if ((x + mrg) + wd < sw + && (y + mrg) + ht < sh) idx = POS_RightDown; - else if ((x - mrg) - wd >= 0 - && (y + mrg) + ht < sh) idx = POS_LeftDown; + else if ((x - mrg) - wd >= 0 + && (y + mrg) + ht < sh) idx = POS_LeftDown; - 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 { + int area[ 4 ]; + area[ 0 ] = (sw - x) * y; + area[ 1 ] = x * y; + area[ 2 ] = (sw - x) * (sh - y); + area[ 3 ] = x * (sh - y); - idx = 0; - for (int i = 1; i < 4; ++i) if (area[ i ] > area[ idx ]) idx = i; - } + idx = 0; + for (int i = 1; i < 4; ++i) if (area[ i ] > area[ idx ]) idx = i; + } - switch (idx) { + switch (idx) { - case POS_RightUp: - x = x + mrg; - y = (y - mrg) - ht; - break; + case POS_RightUp: + x = x + mrg; + y = (y - mrg) - ht; + break; - case POS_LeftUp: - x = (x - mrg) - wd; - y = (y - mrg) - ht; - break; + case POS_LeftUp: + x = (x - mrg) - wd; + y = (y - mrg) - ht; + break; - case POS_RightDown: - x = x + mrg; - y = y + mrg; - break; + case POS_RightDown: + x = x + mrg; + y = y + mrg; + break; - case POS_LeftDown: - x = (x - mrg) - wd; - y = y + mrg; - break; - } + case POS_LeftDown: + x = (x - mrg) - wd; + y = y + mrg; + break; + } - if (x < 0) { + if (x < 0) { - x = ht % 16; - } - if (x + wd >= sw) { + x = ht % 16; + } + if (x + wd >= sw) { - x = sw - wd - (ht % 16); + x = sw - wd - (ht % 16); - if (x < 0) { - if (m_htmlPart) m_htmlPart->view() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - x = 0; - wd = sw; - } + if (x < 0) { + if (m_htmlPart) m_htmlPart->view() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + 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 < 0) { + if (x <= pos.x() && pos.x() < x + wd) { + if (m_htmlPart) m_htmlPart->view() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + ht += y; } - if (y + ht >= sh) { + 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() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + ht = sh - y; + } else { + y = sh - ht; - if (y < 0) { - if (m_htmlPart) m_htmlPart->view() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - 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/branches/KITA-KDE4/kita/src/respopup.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/respopup.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/respopup.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,25 +7,25 @@ * 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 <kurl.h> class KHTMLView; -class KitaHTMLPart; namespace Kita { + class HTMLPart; + class ResPopup : public QFrame { Q_OBJECT - KitaHTMLPart* m_htmlPart; + HTMLPart* m_htmlPart; KUrl m_url; Modified: kita/branches/KITA-KDE4/kita/src/threadlistview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadlistview.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/threadlistview.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -76,7 +76,7 @@ void ThreadListView::slotSearchButton() { insertSearchCombo(); - QStringList list = Kita::parseSearchQuery(SearchCombo->currentText()); + QStringList list = parseSearchQuery(SearchCombo->currentText()); if (list.isEmpty()) { clearSearch(); Modified: kita/branches/KITA-KDE4/kita/src/threadlistview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadlistview.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/threadlistview.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -29,7 +29,7 @@ /** @author Hideki Ikemoto */ - class ThreadListView : public QWidget, public Kita::Ui::ThreadListViewBase + class ThreadListView : public QWidget, public Ui::ThreadListViewBase { Q_OBJECT Modified: kita/branches/KITA-KDE4/kita/src/threadlistviewitem.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadlistviewitem.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/threadlistviewitem.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITATHREADLISTVIEWITEM_H #define KITATHREADLISTVIEWITEM_H @@ -34,7 +33,7 @@ namespace Kita { - /* for KitaBoardView */ + /* for BoardView */ class ThreadListViewItem : public QTableWidgetItem { public: Modified: kita/branches/KITA-KDE4/kita/src/threadproperty.ui =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadproperty.ui 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/threadproperty.ui 2009-07-18 07:11:43 UTC (rev 2424) @@ -561,5 +561,4 @@ </widget> </widget> <layoutdefault spacing="6" margin="11" /> - <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> </ui> Modified: kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -24,11 +24,9 @@ #include "libkita/datmanager.h" #include "libkita/parsemisc.h" -/*--------------------------------------------------------------------------------*/ +using namespace Kita; - -KitaThreadTabWidget::KitaThreadTabWidget(QWidget* parent) - : KitaTabWidgetBase(parent) +ThreadTabWidget::ThreadTabWidget(QWidget* parent) : TabWidgetBase(parent) { setXMLFile("threadtabwidgetui.rc"); @@ -39,18 +37,18 @@ } -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 = ParseMisc::parseURL(url, refstr); + QString threadName = DatManager::threadName(datURL); int jumpNum = 0; int viewMode = VIEWMODE_MAINVIEW; - KitaThreadView* currentView = isThreadView(currentWidget()); + ThreadView* currentView = isThreadView(currentWidget()); if (currentView) viewMode = currentView->getViewMode(); if (!refstr.isEmpty()) { @@ -59,7 +57,7 @@ else jumpNum = refstr.toInt(); } - KitaThreadView* view = findMainView(datURL); + ThreadView* view = findMainView(datURL); if (view) { @@ -76,7 +74,7 @@ } } else { - KitaThreadView * newView = createView(threadName); + ThreadView * newView = createView(threadName); if (newView) { newView->showThread(datURL, jumpNum); @@ -88,16 +86,16 @@ } /* 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); + KUrl datURL = ParseMisc::parseURLonly(url); int i, i2; i = i2 = 0; while (i < max) { - KitaThreadView * view = isThreadView(widget(i)); + ThreadView * view = isThreadView(widget(i)); if (view) { if (view->datURL() == datURL) { slotCloseTab(i2); @@ -110,10 +108,10 @@ -/* create KitaThreadView */ /* private */ -KitaThreadView* KitaThreadTabWidget::createView(const QString& label) +/* create ThreadView */ /* private */ +ThreadView* ThreadTabWidget::createView(const QString& label) { - KitaThreadView * view = new KitaThreadView(this); + ThreadView * view = new ThreadView(this); if (view) { addTab(view, label); } @@ -122,16 +120,16 @@ } /* private */ -KitaThreadView* KitaThreadTabWidget::findMainView(const KUrl& url) +ThreadView* ThreadTabWidget::findMainView(const KUrl& url) { - KUrl datURL = Kita::ParseMisc::parseURLonly(url); + KUrl datURL = ParseMisc::parseURLonly(url); int max = count(); if (max == 0) return 0; int i = 0; while (i < max) { - KitaThreadView * view = isThreadView(widget(i)); + ThreadView * view = isThreadView(widget(i)); if (view) { if (view->getViewMode() == VIEWMODE_MAINVIEW) { @@ -148,11 +146,11 @@ /* private */ -KitaThreadView* KitaThreadTabWidget::isThreadView(QWidget* w) +ThreadView* ThreadTabWidget::isThreadView(QWidget* w) { - KitaThreadView * view = 0; + ThreadView * view = 0; if (w) { - if (w->inherits("KitaThreadView")) view = static_cast< KitaThreadView* >(w); + if (w->inherits("ThreadView")) view = static_cast< ThreadView* >(w); } return view; @@ -160,29 +158,29 @@ /* private slots */ -void KitaThreadTabWidget::slotUpdateThreadTab(const KUrl& url) +void ThreadTabWidget::slotUpdateThreadTab(const KUrl& url) { - KUrl datURL = Kita::ParseMisc::parseURLonly(url); + KUrl datURL = ParseMisc::parseURLonly(url); - KitaThreadView * view = findMainView(datURL); + ThreadView * view = findMainView(datURL); if (view) { - QString threadName = Kita::DatManager::threadName(datURL); + QString threadName = DatManager::threadName(datURL); setTabText(indexOf(view), threadName); setTabToolTip(indexOf(view), threadName); } } -void KitaThreadTabWidget::slotFontChanged() +void ThreadTabWidget::slotFontChanged() { - QFont font = Kita::Config::threadFont(); + QFont font = Config::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()); @@ -190,7 +188,7 @@ ViewMediator::getInstance()->setMainURLLine(KUrl()); /* default view */ - KitaThreadView * threadView = createView("thread"); + ThreadView * threadView = createView("thread"); if (threadView) { setCurrentWidget(threadView); @@ -201,11 +199,11 @@ /*--------------------------------*/ -/* KitaThreadView actions */ +/* ThreadView actions */ /* private */ -void KitaThreadTabWidget::setupActions() +void ThreadTabWidget::setupActions() { KStandardAction::copy(this, SLOT(slotCopyText()), actionCollection()); @@ -254,13 +252,13 @@ -/* KitaThreadView actions */ +/* ThreadView actions */ /* copy selected text (Ctrl+C) */ /* public slot */ -void KitaThreadTabWidget::slotCopyText() +void ThreadTabWidget::slotCopyText() { QWidget * w = currentWidget(); - KitaThreadView * view = isThreadView(w); + ThreadView * view = isThreadView(w); if (view) { QClipboard * clipboard = QApplication::clipboard(); QString text = view->selectedText(); @@ -269,72 +267,72 @@ } /* public slot */ -void KitaThreadTabWidget::slotFocusSearchCombo() +void ThreadTabWidget::slotFocusSearchCombo() { - KitaThreadView * view = isThreadView(currentWidget()); + ThreadView * view = isThreadView(currentWidget()); if (view) view->focusSearchCombo(); } /* public slot */ -void KitaThreadTabWidget::slotSearchNext() +void ThreadTabWidget::slotSearchNext() { - KitaThreadView * view = isThreadView(currentWidget()); + ThreadView * view = isThreadView(currentWidget()); if (view) view->slotSearchNext(); } /* public slot */ -void KitaThreadTabWidget::slotSearchPrev() +void ThreadTabWidget::slotSearchPrev() { - KitaThreadView * view = isThreadView(currentWidget()); + ThreadView * view = isThreadView(currentWidget()); if (view) view->slotSearchPrev(); } /* public slot */ -void KitaThreadTabWidget::slotGobackAnchor() +void ThreadTabWidget::slotGobackAnchor() { - KitaThreadView * view = isThreadView(currentWidget()); + ThreadView * view = isThreadView(currentWidget()); if (view) view->slotGobackAnchor(); } /* public slot */ -void KitaThreadTabWidget::slotGotoHeader() +void ThreadTabWidget::slotGotoHeader() { - KitaThreadView * view = isThreadView(currentWidget()); + ThreadView * view = isThreadView(currentWidget()); if (view) view->slotGotoHeader(); } /* public slot */ -void KitaThreadTabWidget::slotGotoFooter() +void ThreadTabWidget::slotGotoFooter() { - KitaThreadView * view = isThreadView(currentWidget()); + ThreadView * view = isThreadView(currentWidget()); if (view) view->slotGotoFooter(); } /* public slot */ -void KitaThreadTabWidget::slotReloadButton() +void ThreadTabWidget::slotReloadButton() { - KitaThreadView * view = isThreadView(currentWidget()); + ThreadView * view = isThreadView(currentWidget()); if (view) view->slotReloadButton(); } /* public slot */ -void KitaThreadTabWidget::slotStopLoading() +void ThreadTabWidget::slotStopLoading() { - KitaThreadView * view = isThreadView(currentWidget()); + ThreadView * view = isThreadView(currentWidget()); if (view) view->slotStopLoading(); } /* public slot */ -void KitaThreadTabWidget::slotDeleteButtonClicked() +void ThreadTabWidget::slotDeleteButtonClicked() { - KitaThreadView * view = isThreadView(currentWidget()); + ThreadView * view = isThreadView(currentWidget()); if (view) view->slotDeleteButtonClicked(); } Modified: kita/branches/KITA-KDE4/kita/src/threadtabwidget.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadtabwidget.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/threadtabwidget.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,60 +7,58 @@ * 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: - explicit KitaThreadTabWidget(QWidget* parent = 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(const 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(); - /*------------------------------------*/ - /* KitaThreadView actions */ + public slots: + void slotCopyText(); + void slotFocusSearchCombo(); + void slotSearchNext(); + void slotSearchPrev(); + void slotGobackAnchor(); + void slotGotoHeader(); + void slotGotoFooter(); + void slotReloadButton(); + void slotStopLoading(); + void slotDeleteButtonClicked(); + }; +} -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(); -}; - #endif Modified: kita/branches/KITA-KDE4/kita/src/threadview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadview.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/threadview.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -34,14 +34,15 @@ #define MAX_LABEL_LENGTH 60 +using namespace Kita; -KitaThreadView::KitaThreadView(KitaThreadTabWidget* parent) +ThreadView::ThreadView(ThreadTabWidget* parent) { m_parent = parent; /* copied from Base class */ setFocusPolicy(Qt::ClickFocus); - KitaThreadViewBaseLayout = new QVBoxLayout(this); + ThreadViewBaseLayout = new QVBoxLayout(this); layout2 = new QHBoxLayout(0); layout2->setSpacing(6); @@ -85,17 +86,17 @@ closeButton = new QToolButton(this); closeButton->setEnabled(false); layout2->addWidget(closeButton); - KitaThreadViewBaseLayout->addLayout(layout2); + ThreadViewBaseLayout->addLayout(layout2); threadFrame = new QFrame(this); threadFrame->setFrameShape(QFrame::StyledPanel); threadFrame->setFrameShadow(QFrame::Raised); - KitaThreadViewBaseLayout->addWidget(threadFrame); + ThreadViewBaseLayout->addWidget(threadFrame); resize(QSize(870, 480).expandedTo(minimumSizeHint())); setAttribute(Qt::WA_WState_Polished); /* copy end */ - m_threadPart = new KitaHTMLPart(threadFrame); + m_threadPart = new HTMLPart(threadFrame); QHBoxLayout* aLayout = new QHBoxLayout(threadFrame); aLayout->addWidget(m_threadPart->view()); @@ -108,7 +109,7 @@ 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"). + 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. @@ -143,7 +144,7 @@ } -KitaThreadView::~KitaThreadView() +ThreadView::~ThreadView() { if (m_threadPart) { @@ -152,17 +153,17 @@ } } -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; } -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; @@ -173,7 +174,7 @@ } // 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()) { @@ -185,7 +186,7 @@ //disp.truncate(MAX_LABEL_LENGTH); } -void KitaThreadView::updateButton() +void ThreadView::updateButton() { writeButton->setEnabled(true); BookmarkButton->setEnabled(true); @@ -211,13 +212,13 @@ /*--------------------*/ /* write response */ /*--------------------*/ /* private slots */ -void KitaThreadView::slotWriteButtonClicked(const QString& resStr) +void ThreadView::slotWriteButtonClicked(const QString& resStr) { ViewMediator::getInstance()->showWriteView(m_datURL, resStr); } -void KitaThreadView::insertSearchCombo() +void ThreadView::insertSearchCombo() { for (int count = 0; count < SearchCombo->count(); ++count) { if (SearchCombo->itemText(count) == SearchCombo->currentText()) { @@ -228,7 +229,7 @@ SearchCombo->addItem(SearchCombo->currentText()); } -void KitaThreadView::slotPopupMenu(KXMLGUIClient* client, const QPoint& global, const KUrl& url, const QString& mimeType, mode_t mode) +void ThreadView::slotPopupMenu(KXMLGUIClient* client, const QPoint& global, const KUrl& url, const QString& mimeType, mode_t mode) { /* KActionCollection * collection = client->actionCollection(); KAction* action; @@ -236,7 +237,7 @@ emit popupMenu(client, global, url, mimeType, mode);*/ // TODO } -void KitaThreadView::setFont(const QFont& font) +void ThreadView::setFont(const QFont& font) { // m_threadPart->setStandardFont(font.family()); SearchCombo->setFont(font); @@ -247,13 +248,13 @@ } -void KitaThreadView::slotBookmarkButtonClicked(bool on) +void ThreadView::slotBookmarkButtonClicked(bool on) { ViewMediator::getInstance()->bookmark(m_datURL.prettyUrl(), on); } -void KitaThreadView::focusSearchCombo() +void ThreadView::focusSearchCombo() { if (! SearchCombo->hasFocus()) { SearchCombo->setFocus(); @@ -264,7 +265,7 @@ /* public slot */ /* virtual */ -void KitaThreadView::setFocus() +void ThreadView::setFocus() { ViewMediator::getInstance()->changeWriteTab(m_datURL); showStatusBar(QString()); @@ -279,20 +280,20 @@ /*-------*/ /* 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); - /* mode. Mode is defined in kitathreadview.h */ + /* mode. Mode is defined in threadview.h */ m_viewmode = mode; /* reset search direction */ @@ -302,14 +303,14 @@ /*--------------------------------------------------------*/ /* 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 (num == 0) num = Kita::DatManager::getViewPos(datURL); + if (num == 0) num = DatManager::getViewPos(datURL); if (topLevelWidget() ->isMinimized()) topLevelWidget() ->showNormal(); topLevelWidget() ->raise(); @@ -332,20 +333,20 @@ /*---------*/ /* reload */ /*---------*/ /* public slot */ -void KitaThreadView::slotReloadButton(int jumpNum) +void ThreadView::slotReloadButton(int jumpNum) { topLevelWidget() ->raise(); activateWindow(); if (m_threadPart->reload(jumpNum)) { - showStatusBar(Kita::utf8ToUnicode(KITAUTF8_NOWRENEW)); + showStatusBar(utf8ToUnicode(KITAUTF8_NOWRENEW)); } } /*-----------------------------------*/ /* stop loading the thread */ /* public slot */ -void KitaThreadView::slotStopLoading() +void ThreadView::slotStopLoading() { /* hide popup */ if (m_threadPart->isPopupVisible()) { @@ -359,24 +360,24 @@ return ; } - Kita::DatManager::stopLoading(m_datURL); + DatManager::stopLoading(m_datURL); } /*-----------------------------------------*/ /* show the information at the statusbar. */ /*-----------------------------------------*/ -void KitaThreadView::showStatusBar(const QString &information) +void ThreadView::showStatusBar(const QString &information) { if (m_datURL.isEmpty()) return ; QString info = information; QString captionStr; QString infostr; QString errstr; - 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); + int viewPos = DatManager::getViewPos(m_datURL); + int resNum = DatManager::getResNum(m_datURL); + bool broken = DatManager::isBroken(m_datURL); + int datSize = DatManager::getDatSize(m_datURL); switch (m_viewmode) { @@ -388,15 +389,15 @@ if (broken) info += " This thread is broken."; /* show status bar,caption, url */ - infostr = Kita::DatManager::threadName(m_datURL) + + infostr = DatManager::threadName(m_datURL) + 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(m_datURL) + QString(" (%1)").arg(viewPos); ViewMediator::getInstance()->setMainCaption(captionStr); ViewMediator::getInstance()->setMainStatus(infostr); - ViewMediator::getInstance()->setMainURLLine(Kita::getThreadURL(m_datURL)); + ViewMediator::getInstance()->setMainURLLine(getThreadURL(m_datURL)); return ; break; @@ -412,26 +413,26 @@ /*--------------------*/ /* update information */ /* public */ -void KitaThreadView::slotUpdateInfo() +void ThreadView::slotUpdateInfo() { - m_rescode = Kita::DatManager::getResponseCode(m_datURL); - m_serverTime = Kita::DatManager::getServerTime(m_datURL); + m_rescode = DatManager::getResponseCode(m_datURL); + m_serverTime = DatManager::getServerTime(m_datURL); /* uptate information */ - setSubjectLabel(Kita::BoardManager::boardName(m_datURL), - Kita::DatManager::threadName(m_datURL) + setSubjectLabel(BoardManager::boardName(m_datURL), + DatManager::threadName(m_datURL) + QString(" (%1)") - .arg(Kita::DatManager::getReadNum(m_datURL)), - Kita::BoardManager::boardURL(m_datURL)); + .arg(DatManager::getReadNum(m_datURL)), + BoardManager::boardURL(m_datURL)); updateButton(); gotoCombo->clear(); - gotoCombo->addItem(Kita::utf8ToUnicode(KITAUTF8_GOTO)); - gotoCombo->addItem(Kita::utf8ToUnicode(KITAUTF8_KOKOYON)); - for (int i = 1; i < Kita::DatManager::getReadNum(m_datURL); i += 100) { + gotoCombo->addItem(utf8ToUnicode(KITAUTF8_GOTO)); + gotoCombo->addItem(utf8ToUnicode(KITAUTF8_KOKOYON)); + for (int i = 1; i < DatManager::getReadNum(m_datURL); i += 100) { gotoCombo->addItem(QString().setNum(i) + '-'); } - gotoCombo->addItem(Kita::utf8ToUnicode(KITAUTF8_SAIGO)); + gotoCombo->addItem(utf8ToUnicode(KITAUTF8_SAIGO)); gotoCombo->adjustSize(); ViewMediator::getInstance()->updateBoardView(m_datURL); @@ -439,7 +440,7 @@ showStatusBar(""); - emit showThreadCompleted(); /* to KitaThreadPart */ + emit showThreadCompleted(); /* to ThreadPart */ } @@ -448,7 +449,7 @@ /*------------------------*/ /* search function */ /*------------------------*/ /* private slots */ -void KitaThreadView::slotSearchButton() +void ThreadView::slotSearchButton() { if (m_datURL.isEmpty()) return ; /* Nothing is shown on the screen.*/ @@ -481,11 +482,11 @@ } /* 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.*/ @@ -498,16 +499,16 @@ QStringList query; query += SearchCombo->currentText(); - int ResNum = Kita::DatManager::getResNum(m_datURL); + int ResNum = DatManager::getResNum(m_datURL); for (int i = 1; i <= ResNum; i++) { - if (Kita::DatManager::checkWord(m_datURL, query, i, false)) { + if (DatManager::checkWord(m_datURL, query, i, false)) { /* if this is parent, then show all responses, and search */ if (m_viewmode == VIEWMODE_MAINVIEW) m_threadPart->showAll(); insertSearchCombo(); - QStringList list = Kita::parseSearchQuery(SearchCombo->currentText()); + QStringList list = parseSearchQuery(SearchCombo->currentText()); m_threadPart->findText(SearchCombo->currentText(), rev); SearchCombo->setFocus(); @@ -519,13 +520,13 @@ } /* 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) { // last @@ -540,11 +541,11 @@ } } -void KitaThreadView::slotDeleteButtonClicked() +void ThreadView::slotDeleteButtonClicked() { if (m_datURL.isEmpty()) return ; - int rescode = Kita::DatManager::getResponseCode(m_datURL); + int rescode = DatManager::getResponseCode(m_datURL); if ((rescode != 200 && rescode != 206) || FavoriteThreads::getInstance() ->contains(m_datURL.prettyUrl())) { if (QMessageBox::warning(this, @@ -554,18 +555,18 @@ != QMessageBox::Ok) return ; } - if (Kita::DatManager::deleteCache(m_datURL)) { + if (DatManager::deleteCache(m_datURL)) { 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/branches/KITA-KDE4/kita/src/threadview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadview.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/threadview.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITATHREADVIEW_H #define KITATHREADVIEW_H @@ -25,14 +24,6 @@ class KComboBox; class KXMLGUIClient; -class KitaHTMLPart; -class KitaThreadTabWidget; - -namespace Kita -{ - class KitaSubjectLabel; -} - /* mode , m_viewmode uses them. */ enum { VIEWMODE_MAINVIEW, @@ -43,88 +34,98 @@ 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); - ~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(const QString& information); - 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: - void insertSearchCombo(); - void setSubjectLabel(const QString& boardName, const QString& threadName, const QString& boardURL); - void updateButton(); + protected slots: + void slotDOMNodeActivated(const DOM::Node& node); + void slotPopupMenu(KXMLGUIClient*, const QPoint&, const KUrl&, + const QString&, mode_t); - KitaThreadView(const KitaThreadView&); - KitaThreadView& operator=(const KitaThreadView&); + private: + void insertSearchCombo(); + void setSubjectLabel(const QString& boardName, + const QString& threadName, const QString& boardURL); + void updateButton(); - int m_serverTime; - KUrl m_datURL; - KitaHTMLPart* m_threadPart; + ThreadView(const ThreadView&); + ThreadView& operator=(const ThreadView&); - bool m_revsearch; - int m_viewmode; - int m_rescode; + int m_serverTime; + KUrl m_datURL; + HTMLPart* m_threadPart; - QToolButton* writeButton; - KComboBox* SearchCombo; - QToolButton* HighLightButton; - QToolButton* BookmarkButton; - QToolButton* ReloadButton; - KComboBox* gotoCombo; - QToolButton* deleteButton; - QToolButton* closeButton; - QFrame* threadFrame; - QVBoxLayout* KitaThreadViewBaseLayout; - QHBoxLayout* layout2; - QSpacerItem* spacer2; + bool m_revsearch; + int m_viewmode; + int m_rescode; -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(); + QToolButton* writeButton; + KComboBox* SearchCombo; + QToolButton* HighLightButton; + QToolButton* BookmarkButton; + QToolButton* ReloadButton; + KComboBox* gotoCombo; + QToolButton* deleteButton; + QToolButton* closeButton; + QFrame* threadFrame; + QVBoxLayout* ThreadViewBaseLayout; + QHBoxLayout* layout2; + QSpacerItem* spacer2; -signals: - void popupMenu(KXMLGUIClient*, const QPoint&, const KUrl&, const QString&, mode_t); - void showThreadCompleted(); /* to KitaThreadPart */ -}; + 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 popupMenu(KXMLGUIClient*, const QPoint&, const KUrl&, + const QString&, mode_t); + void showThreadCompleted(); /* to ThreadPart */ + }; +} + #endif Modified: kita/branches/KITA-KDE4/kita/src/viewmediator.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/viewmediator.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/viewmediator.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -19,6 +19,8 @@ #include "writetabwidget.h" #include "libkita/datmanager.h" +using namespace Kita; + ViewMediator* ViewMediator::instance = 0; ViewMediator::ViewMediator() @@ -95,7 +97,7 @@ m_mainWindow->bookmark(datURL, on); } -bool ViewMediator::isKitaActive() +bool ViewMediator::isActive() { Q_ASSERT(m_mainWindow); @@ -135,7 +137,7 @@ void ViewMediator::openURL(const KUrl& url) { // open thread. - if (Kita::DatManager::isThreadEnrolled(url)) { + if (DatManager::isThreadEnrolled(url)) { m_threadTabWidget->slotShowMainThread(url); return; } Modified: kita/branches/KITA-KDE4/kita/src/viewmediator.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/viewmediator.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/viewmediator.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,60 +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 class QString; class KUrl; -class KitaBoardTabWidget; -class KitaMainWindow; -class KitaThreadTabWidget; -class KitaWriteTabWidget; -class FavoriteListView; +namespace Kita { + class BoardTabWidget; + class MainWindow; + class ThreadTabWidget; + class WriteTabWidget; + class FavoriteListView; -/** - * @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; + /** + * @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; - ViewMediator(); - ~ViewMediator(); + ViewMediator(); + ~ViewMediator(); -public: - static ViewMediator* getInstance(); + public: + static ViewMediator* getInstance(); - 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; } + 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 isKitaActive(); - void updateBoardView(const KUrl& datURL); - void updateThreadView(const KUrl& datURL); - void changeWriteTab(const KUrl& datURL); - void updateFavoriteListView(); - void openURL(const KUrl& url); + 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&); -}; + private: + ViewMediator(const ViewMediator&); + ViewMediator& operator=(const ViewMediator&); + }; +} #endif Modified: kita/branches/KITA-KDE4/kita/src/writedialogbase.ui =================================================================== --- kita/branches/KITA-KDE4/kita/src/writedialogbase.ui 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/writedialogbase.ui 2009-07-18 07:11:43 UTC (rev 2424) @@ -2,8 +2,8 @@ <author></author> <comment></comment> <exportmacro></exportmacro> - <class>KitaWriteDialogBase</class> - <widget class="QWidget" name="KitaWriteDialogBase" > + <class>WriteDialogBase</class> + <widget class="QWidget" name="WriteDialogBase" > <property name="geometry" > <rect> <x>0</x> @@ -199,7 +199,6 @@ </layout> </widget> <layoutdefault spacing="6" margin="11" /> - <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> <includes> <include location="local" >ksqueezedtextlabel.h</include> <include location="local" >klineedit.h</include> @@ -210,7 +209,7 @@ <connection> <sender>sageBox</sender> <signal>toggled(bool)</signal> - <receiver>KitaWriteDialogBase</receiver> + <receiver>WriteDialogBase</receiver> <slot>sageBoxToggled(bool)</slot> </connection> </connections> Modified: kita/branches/KITA-KDE4/kita/src/writetabwidget.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/writetabwidget.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/writetabwidget.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -21,11 +21,9 @@ #include "libkita/datmanager.h" #include "libkita/kita_misc.h" -/*--------------------------------------------------------------------------------*/ +using namespace Kita; - -KitaWriteTabWidget::KitaWriteTabWidget(QWidget* parent) - : KitaTabWidgetBase(parent) +WriteTabWidget::WriteTabWidget(QWidget* parent) : TabWidgetBase(parent) { setXMLFile("writetabwidgetui.rc"); @@ -33,11 +31,11 @@ } -KitaWriteTabWidget::~KitaWriteTabWidget() {} +WriteTabWidget::~WriteTabWidget() {} /* public slot */ -void KitaWriteTabWidget::slotShowWriteView(const KUrl& url, +void WriteTabWidget::slotShowWriteView(const KUrl& url, const QString& resStr) { openWriteView(url, resStr, QString()); @@ -45,11 +43,11 @@ /* private */ -void KitaWriteTabWidget::openWriteView(const KUrl& url, +void WriteTabWidget::openWriteView(const KUrl& url, const QString& resStr, const QString& subject) { // TODO: machiBBS kakiko support. - if (Kita::BoardManager::type(url) == Kita::Board_MachiBBS) { + if (BoardManager::type(url) == Board_MachiBBS) { // KMessageBox::sorry(this, // i18n("Can't write to machi BBS in this version."), // "<(_ _)>"); @@ -57,7 +55,7 @@ } /* view exists */ - KitaWriteView* view = findWriteView(url); + WriteView* view = findWriteView(url); if (view) { if (view->body().length()) { if (KMessageBox::warningYesNo(this, @@ -76,25 +74,25 @@ QString threadName; /* write res */ - KitaWriteView* new_dlg; - threadName = Kita::DatManager::threadName(url); - new_dlg = new KitaWriteView(this, url); + WriteView* new_dlg; + threadName = DatManager::threadName(url); + 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); + KUrl datURL = getDatURL(url); if (datURL.isEmpty()) return 0; int max = count(); if (max == 0) return 0; for(int i=0; i < max; i++) { - KitaWriteView * view = isWriteView(widget (i)); + WriteView * view = isWriteView(widget (i)); if (view) { if (view->datURL() == datURL) return view; } @@ -105,11 +103,11 @@ /* private */ -KitaWriteView* KitaWriteTabWidget::isWriteView(QWidget* w) +WriteView* WriteTabWidget::isWriteView(QWidget* w) { - KitaWriteView * view = 0; + WriteView * view = 0; if (w) { - if (w->inherits("KitaWriteView")) view = static_cast< KitaWriteView* >(w); + if (w->inherits("WriteView")) view = static_cast< WriteView* >(w); } return view; @@ -118,10 +116,10 @@ /* 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 ; @@ -141,9 +139,9 @@ /* protected */ /* virtual */ -void KitaWriteTabWidget::deleteWidget(QWidget* w) +void WriteTabWidget::deleteWidget(QWidget* w) { - KitaWriteView * view = isWriteView(w); + WriteView * view = isWriteView(w); if (view == 0) return ; @@ -153,16 +151,16 @@ "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() { KAction* quoteclip_action = actionCollection()->addAction("writeview_quoteclip"); quoteclip_action->setText(i18n("quote clipboard")); @@ -172,9 +170,9 @@ /* public slot */ -void KitaWriteTabWidget::slotQuoteClipboard() +void WriteTabWidget::slotQuoteClipboard() { - KitaWriteView * view = isWriteView(currentWidget()); + WriteView * view = isWriteView(currentWidget()); if (view) { QClipboard * clipboard = QApplication::clipboard(); QString str = clipboard->text(QClipboard::Selection); Modified: kita/branches/KITA-KDE4/kita/src/writetabwidget.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/writetabwidget.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/writetabwidget.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -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: - explicit KitaWriteTabWidget(QWidget* parent = 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(), const QString& subject = QString()); - 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 Modified: kita/branches/KITA-KDE4/kita/src/writeview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/writeview.cpp 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/writeview.cpp 2009-07-18 07:11:43 UTC (rev 2424) @@ -31,29 +31,29 @@ #include "libkita/k2ch.h" #include "libkita/machibbs.h" -/*--------------------------------------------------------------------*/ +using namespace Kita; /* 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) +WriteView::WriteView(WriteTabWidget* parent, const KUrl& url) : QWidget(parent) { setupUi(this); - m_datURL = Kita::getDatURL(url); - m_bbstype = Kita::BoardManager::type(m_datURL); - m_bbscgi = Kita::getWriteURL(m_datURL); + 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()), @@ -72,57 +72,57 @@ qtw->setCurrentIndex(0); /* setup labels and edit lines */ - QFont font = Kita::Config::threadFont(); + QFont font = Config::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->setText(Config::defaultName()); + QStringList compList = Config::self()->nameCompletionList(); nameLine->completionObject()->setItems(compList); // setup mail field & 'sage' checkbox - if (Kita::Config::defaultSage()) { + if (Config::defaultSage()) { mailLine->setText("sage"); sageBox->setChecked(true); } else { - mailLine->setText(Kita::Config::defaultMail()); + mailLine->setText(Config::defaultMail()); } m_mailswap = ""; // setup 'be' checkbox QRegExp host_2ch(".+\\.2ch\\.net"); if (host_2ch.indexIn(m_bbscgi.host()) != -1 - && Kita::Config::beMailAddress().length() > 0 - && Kita::Config::beAuthCode().length() > 0) { + && Config::beMailAddress().length() > 0 + && Config::beAuthCode().length() > 0) { beBox->setChecked(true); } /* setup AA */ faceCombo->clear(); - faceCombo->setFont(Kita::Config::threadFont()); + faceCombo->setFont(Config::threadFont()); faceCombo->addItem(""); - QStringList list = Kita::AsciiArtConfig::asciiArtList(); + QStringList list = AsciiArtConfig::asciiArtList(); QStringList::iterator it; for (it = list.begin(); it != list.end(); ++it) { faceCombo->addItem(*it); } // init thread name field. - threadNameLine->setText(Kita::DatManager::threadName(m_datURL)); + threadNameLine->setText(DatManager::threadName(m_datURL)); 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->insertPlainText(bodyStr); @@ -131,7 +131,7 @@ /* public */ -void KitaWriteView::insertMessage(const QString& str) +void WriteView::insertMessage(const QString& str) { bodyText->insertPlainText(str); bodyText->setFocus(); @@ -139,32 +139,32 @@ /* public information */ -const KUrl KitaWriteView::datURL() const +const KUrl WriteView::datURL() const { 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; @@ -173,16 +173,16 @@ } } -QString KitaWriteView::buildPostMessage() +QString WriteView::buildPostMessage() { QString postStr; switch (m_bbstype) { - case Kita::Board_JBBS: postStr = getJBBSPostStr(); break; + case Board_JBBS: postStr = getJBBSPostStr(); break; - case Kita::Board_FlashCGI: postStr = getFlashCGIPostStr(); break; + case Board_FlashCGI: postStr = getFlashCGIPostStr(); break; - case Kita::Board_MachiBBS: postStr = getMachiBBSPostStr(); break; + case Board_MachiBBS: postStr = getMachiBBSPostStr(); break; default: postStr = getPostStr(); break; } @@ -191,20 +191,20 @@ } /* call this slot to post the message. */ /* public slot */ -void KitaWriteView::slotPostMessage() +void WriteView::slotPostMessage() { if (!checkFields()) return; QString name = nameLine->text(); - QStringList list = Kita::Config::nameCompletionList(); + QStringList list = Config::nameCompletionList(); list.append(name); - Kita::Config::setNameCompletionList(list); + Config::setNameCompletionList(list); /* build post message */ QString postStr = buildPostMessage(); /* referrer */ - QString refStr = Kita::BoardManager::boardURL(m_datURL); + QString refStr = BoardManager::boardURL(m_datURL); m_array.clear(); @@ -213,10 +213,10 @@ 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(); + QString BeMailAddress = Config::beMailAddress(); + QString BeAuthCode = Config::beAuthCode(); if (BeMailAddress.length() > 0 && BeAuthCode.length() > 0) { cookie += "DMDM=" + BeMailAddress + "; "; cookie += "MDMD=" + BeAuthCode + "; "; @@ -235,7 +235,7 @@ /* public slot */ -void KitaWriteView::slotCancel() +void WriteView::slotCancel() { if (body().length() == 0) { m_parent->slotCloseCurrentTab(); @@ -251,19 +251,19 @@ /* public slot */ -void KitaWriteView::slotEnableWriting(bool enable) +void WriteView::slotEnableWriting(bool 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()); } -void KitaWriteView::processPostFinished() +void WriteView::processPostFinished() { QString response; QString ckstr = QTextCodec::codecForName("utf8") ->toUnicode(KITAUTF8_WRITECOOKIE); @@ -321,18 +321,18 @@ /* This slot is called when posting is done. */ /* see also slotPostMessage() */ /* private slot */ -void KitaWriteView::slotPostFinished(KIO::Job*) +void WriteView::slotPostFinished(KIO::Job*) { processPostFinished(); } -int KitaWriteView::getWriteResNum() +int WriteView::getWriteResNum() { - return Kita::DatManager::getReadNum(m_datURL) + 1; + return DatManager::getReadNum(m_datURL) + 1; } /* private slot */ -bool KitaWriteView::slotBodyTextChanged() +bool WriteView::slotBodyTextChanged() { QString text = bodyText->toPlainText(); int lines = text.count('\n') + 1; @@ -354,15 +354,15 @@ } /* create posting message for 2ch */ /* private */ -QString KitaWriteView::getPostStr() +QString WriteView::getPostStr() { QString sessionID; - QString threadID = Kita::DatManager::threadID(m_datURL); - int serverTime = Kita::DatManager::getServerTime(m_datURL); + QString threadID = DatManager::threadID(m_datURL); + int serverTime = DatManager::getServerTime(m_datURL); /* login */ - if (Kita::DatManager::is2chThread(m_datURL) && Kita::Account::isLogged()) { - sessionID = KUrl::toPercentEncoding(Kita::Account::getSessionID()); + if (DatManager::is2chThread(m_datURL) && Account::isLogged()) { + sessionID = KUrl::toPercentEncoding(Account::getSessionID()); } return K2ch::buildPostStr(name(), mail(), @@ -371,10 +371,10 @@ sessionID); } -QString KitaWriteView::getMachiBBSPostStr() +QString WriteView::getMachiBBSPostStr() { - QString threadID = Kita::DatManager::threadID(m_datURL); - int serverTime = Kita::DatManager::getServerTime(m_datURL); + QString threadID = DatManager::threadID(m_datURL); + int serverTime = DatManager::getServerTime(m_datURL); return MachiBBS::buildPostStr(name(), mail(), body(), boardID(), @@ -383,10 +383,10 @@ /* create posting message for JBBS */ /* private */ /* private */ -QString KitaWriteView::getJBBSPostStr() +QString WriteView::getJBBSPostStr() { - QString threadID = Kita::DatManager::threadID(m_datURL); - int serverTime = Kita::DatManager::getServerTime(m_datURL); + QString threadID = DatManager::threadID(m_datURL); + int serverTime = DatManager::getServerTime(m_datURL); return JBBS::buildPostStr(name(), mail(), body(), boardID(), @@ -395,9 +395,9 @@ /* create posting message for Flash CGI */ /* private */ /* private */ -QString KitaWriteView::getFlashCGIPostStr() +QString WriteView::getFlashCGIPostStr() { - QString threadID = Kita::DatManager::threadID(m_datURL); + QString threadID = DatManager::threadID(m_datURL); QString ret; @@ -408,9 +408,9 @@ /* save post log */ /* private */ -void KitaWriteView::logPostMessage() +void WriteView::logPostMessage() { - QString threadURL = Kita::DatManager::threadURL(m_datURL); + QString threadURL = DatManager::threadURL(m_datURL); QDateTime now = QDateTime::currentDateTime(); QString logPath = KStandardDirs::locateLocal("appdata", "log.txt"); @@ -435,7 +435,7 @@ /* 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); @@ -466,7 +466,7 @@ if (title.contains(ckstr)) return K2ch_Cookie; /* for Flash CGI */ - if (m_bbstype == Kita::Board_FlashCGI) { + if (m_bbstype == Board_FlashCGI) { if (title.contains("ERROR!!")) { return K2ch_Error; } else { @@ -475,7 +475,7 @@ } /* for JBBS. adhoc... */ - if (m_bbstype == Kita::Board_JBBS) { + if (m_bbstype == Board_JBBS) { // x-euc-jp & euc-jp if (response.contains("euc-jp")) { @@ -491,11 +491,11 @@ /* private */ -QString KitaWriteView::resultMessage(const QString& response) const +QString WriteView::resultMessage(const QString& response) const { QRegExp tags("(<[^<]+>|</[^<]+>)"); - if (m_bbstype == Kita::Board_FlashCGI) { + if (m_bbstype == Board_FlashCGI) { QRegExp regexp("<blockquote>(.*)</blockquote>"); int pos = regexp.indexIn(response); @@ -531,7 +531,7 @@ /* private */ -QString KitaWriteView::resultTitle(const QString& response) const +QString WriteView::resultTitle(const QString& response) const { QRegExp regexp("<title>(.*)</title>"); int pos = regexp.indexIn(response, Qt::CaseInsensitive); Modified: kita/branches/KITA-KDE4/kita/src/writeview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/writeview.h 2009-07-17 21:52:00 UTC (rev 2423) +++ kita/branches/KITA-KDE4/kita/src/writeview.h 2009-07-18 07:11:43 UTC (rev 2424) @@ -7,7 +7,6 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ - #ifndef KITAWRITEVIEW_H #define KITAWRITEVIEW_H @@ -18,9 +17,6 @@ #include "ui_writedialogbase.h" -class KitaPreviewPart; -class KitaWriteTabWidget; - /* result code */ enum{ K2ch_Unknown, @@ -31,93 +27,97 @@ K2ch_Cookie }; +namespace Kita { + class PreviewPart; + class WriteTabWidget; -/** - * - * Hideki Ikemoto - **/ -class KitaWriteView : public QWidget, public Ui::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(); + QString getPostStr(); + QString getMachiBBSPostStr(); + QString getJBBSPostStr(); + QString getFlashCGIPostStr(); - KitaWriteView(const KitaWriteView&); - KitaWriteView& operator=(const KitaWriteView&); + WriteView(const WriteView&); + WriteView& operator=(const WriteView&); -protected: + protected: - QByteArray m_array; - KUrl m_bbscgi; - int m_bbstype; - KUrl m_datURL; - QString m_mailswap; + 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 QString name() const - { - return nameLine->text(); - } + const KUrl datURL() const; + const QString threadName() const; + const QString boardName() const; + const QString boardID() const; + const QString name() const + { + return nameLine->text(); + } - const QString mail() const - { - return mailLine->text(); - } + const QString mail() const + { + return mailLine->text(); + } - const QString body() const - { - return bodyText->toPlainText(); - } + const QString body() const + { + return bodyText->toPlainText(); + } -public slots: + public slots: - 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); - } - } + 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); + } + } -private slots: + private slots: - void slotRecieveData(KIO::Job*, const QByteArray&); - void slotPostFinished(KIO::Job*); + void slotRecieveData(KIO::Job*, const QByteArray&); + void slotPostFinished(KIO::Job*); -protected slots: - bool slotBodyTextChanged(); + protected slots: + bool slotBodyTextChanged(); -}; + }; +} #endif