svnno****@sourc*****
svnno****@sourc*****
2009年 7月 11日 (土) 06:05:53 JST
Revision: 2384 http://sourceforge.jp/projects/kita/svn/view?view=rev&revision=2384 Author: nogu Date: 2009-07-11 06:05:53 +0900 (Sat, 11 Jul 2009) Log Message: ----------- Qt Reference Documentation for Qt3 adopts the following style: foo( bar ); while that for Qt4 does the following one: foo(bar); adopt the latter style 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/listviewitem.cpp kita/branches/KITA-KDE4/kita/src/kitaui/listviewitem.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/access.h kita/branches/KITA-KDE4/kita/src/libkita/account.cpp kita/branches/KITA-KDE4/kita/src/libkita/account.h 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/cache.cpp kita/branches/KITA-KDE4/kita/src/libkita/cache.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/event.h kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.cpp kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.h 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/flashcgi.h kita/branches/KITA-KDE4/kita/src/libkita/jbbs.cpp kita/branches/KITA-KDE4/kita/src/libkita/jbbs.h kita/branches/KITA-KDE4/kita/src/libkita/k2ch.cpp kita/branches/KITA-KDE4/kita/src/libkita/k2ch.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/machibbs.h 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/aboneprefpage.cpp kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.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/prefs/write_page.ui.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.cpp kita/branches/KITA-KDE4/kita/src/threadlistviewitem.h 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.h 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-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/bbstabwidget.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -17,11 +17,11 @@ /*--------------------------------------------------------------*/ -KitaBBSTabWidget::KitaBBSTabWidget( QWidget* parent, Qt::WFlags fl ) - : KitaTabWidgetBase( parent, fl ) +KitaBBSTabWidget::KitaBBSTabWidget(QWidget* parent, Qt::WFlags fl) + : KitaTabWidgetBase(parent, fl) { - KitaBBSView * view = new KitaBBSView( this ); - addTab( view, i18n( "board name" ) ); + KitaBBSView * view = new KitaBBSView(this); + addTab(view, i18n("board name")); } @@ -31,26 +31,26 @@ /* public slot */ void KitaBBSTabWidget::showBoardList() { - static_cast < KitaBBSView* > ( widget( 0 ) ) ->showBoardList(); + static_cast < KitaBBSView* > (widget(0)) ->showBoardList(); } void KitaBBSTabWidget::updateBoardList() { - static_cast < KitaBBSView* > ( widget( 0 ) ) ->updateBoardList(); + static_cast < KitaBBSView* > (widget(0)) ->updateBoardList(); } /* public slot */ -void KitaBBSTabWidget::setFont( const QFont& font ) +void KitaBBSTabWidget::setFont(const QFont& font) { - KTabWidget::setFont( font ); - static_cast < KitaBBSView* > ( widget( 0 ) ) ->setFont( font ); + KTabWidget::setFont(font); + static_cast < KitaBBSView* > (widget(0)) ->setFont(font); } void KitaBBSTabWidget::loadOpened() { - static_cast < KitaBBSView* > ( widget( 0 ) ) ->loadOpened(); + static_cast < KitaBBSView* > (widget(0)) ->loadOpened(); } /* protected */ /* virtual */ -void KitaBBSTabWidget::deleteWidget( QWidget* w ) {} +void KitaBBSTabWidget::deleteWidget(QWidget* w) {} Modified: kita/branches/KITA-KDE4/kita/src/bbstabwidget.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/bbstabwidget.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/bbstabwidget.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -23,17 +23,17 @@ Q_OBJECT public: - explicit KitaBBSTabWidget( QWidget* parent, Qt::WFlags fl = 0 ); + explicit KitaBBSTabWidget(QWidget* parent, Qt::WFlags fl = 0); ~KitaBBSTabWidget(); public slots: void showBoardList(); void updateBoardList(); - void setFont( const QFont& font ); + void setFont(const QFont& font); void loadOpened(); protected: - virtual void deleteWidget( QWidget* w ); + virtual void deleteWidget(QWidget* w); }; #endif Modified: kita/branches/KITA-KDE4/kita/src/bbsview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/bbsview.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/bbsview.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -55,41 +55,41 @@ /*--------------------------------------*/ -KitaBBSView::KitaBBSView( QWidget *, const char *name ) - : m_favorites( 0 ) +KitaBBSView::KitaBBSView(QWidget *, const char *name) + : m_favorites(0) { /* copied from Base class */ - if ( !name ) - setObjectName( "KitaBBSViewBase" ); - KitaBBSViewBaseLayout = new QVBoxLayout( this ); + if (!name) + setObjectName("KitaBBSViewBase"); + KitaBBSViewBaseLayout = new QVBoxLayout(this); - layout10 = new QHBoxLayout( 0 ); + layout10 = new QHBoxLayout(0); - SearchCombo = new KComboBox( this ); - QSizePolicy sizePolicy( static_cast<QSizePolicy::Policy>(1), static_cast<QSizePolicy::Policy>(4) ); - sizePolicy.setHorizontalStretch( 0 ); - sizePolicy.setVerticalStretch( 0 ); - sizePolicy.setHeightForWidth( SearchCombo->sizePolicy().hasHeightForWidth() ); - SearchCombo->setSizePolicy( sizePolicy ); - SearchCombo->setEditable( true ); - SearchCombo->setMaxCount( 10 ); - layout10->addWidget( SearchCombo ); - spacer2 = new QSpacerItem( 467, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - layout10->addItem( spacer2 ); - KitaBBSViewBaseLayout->addLayout( layout10 ); + SearchCombo = new KComboBox(this); + QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(1), static_cast<QSizePolicy::Policy>(4)); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(SearchCombo->sizePolicy().hasHeightForWidth()); + SearchCombo->setSizePolicy(sizePolicy); + SearchCombo->setEditable(true); + SearchCombo->setMaxCount(10); + layout10->addWidget(SearchCombo); + spacer2 = new QSpacerItem(467, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + layout10->addItem(spacer2); + KitaBBSViewBaseLayout->addLayout(layout10); - m_boardList = new K3ListView( this ); - m_boardList->setRootIsDecorated( true ); - m_boardList->setTreeStepSize( 10 ); - m_boardList->setFullWidth( true ); - KitaBBSViewBaseLayout->addWidget( m_boardList ); - resize( QSize(600, 482).expandedTo(minimumSizeHint()) ); - setAttribute( Qt::WA_WState_Polished ); + m_boardList = new K3ListView(this); + m_boardList->setRootIsDecorated(true); + m_boardList->setTreeStepSize(10); + m_boardList->setFullWidth(true); + KitaBBSViewBaseLayout->addWidget(m_boardList); + resize(QSize(600, 482).expandedTo(minimumSizeHint())); + setAttribute(Qt::WA_WState_Polished); /* copy end */ - m_boardList->setSorting( -1 ); - m_boardList->addColumn( i18n( "board name" ) ); - m_boardList->header() ->setClickEnabled( false ); + m_boardList->setSorting(-1); + m_boardList->addColumn(i18n("board name")); + m_boardList->header() ->setClickEnabled(false); /* default colors */ QPalette palette = m_boardList->viewport() ->palette(); @@ -98,14 +98,14 @@ // m_backColor = m_boardList->viewport() ->paletteBackgroundColor(); // TODO // m_altColor = m_boardList->alternateBackground(); - connect( m_boardList, SIGNAL( mouseButtonClicked( int, Q3ListViewItem*, const QPoint&, int ) ), - SLOT( slotMouseButtonClicked( int, Q3ListViewItem* ) ) ); - connect( m_boardList, SIGNAL( returnPressed( Q3ListViewItem* ) ), SLOT( loadBoard( Q3ListViewItem* ) ) ); - connect( m_boardList, SIGNAL( contextMenuRequested( Q3ListViewItem*, const QPoint&, int ) ), - SLOT( slotContextMenuRequested( Q3ListViewItem*, const QPoint&, int ) ) ); - connect( Kita::FavoriteBoards::getInstance(), SIGNAL( changed() ), SLOT( refreshFavoriteBoards() ) ); - connect( SearchCombo, SIGNAL( textChanged( const QString& ) ), - SLOT( filter( const QString& ) ) ); + connect(m_boardList, SIGNAL(mouseButtonClicked(int, Q3ListViewItem*, const QPoint&, int)), + SLOT(slotMouseButtonClicked(int, Q3ListViewItem*))); + connect(m_boardList, SIGNAL(returnPressed(Q3ListViewItem*)), SLOT(loadBoard(Q3ListViewItem*))); + connect(m_boardList, SIGNAL(contextMenuRequested(Q3ListViewItem*, const QPoint&, int)), + SLOT(slotContextMenuRequested(Q3ListViewItem*, const QPoint&, int))); + connect(Kita::FavoriteBoards::getInstance(), SIGNAL(changed()), SLOT(refreshFavoriteBoards())); + connect(SearchCombo, SIGNAL(textChanged(const QString&)), + SLOT(filter(const QString&))); } KitaBBSView::~KitaBBSView() @@ -127,47 +127,47 @@ QString tmpFile; QString url = Kita::Config::boardListUrl(); - if ( ! KIO::NetAccess::download( url, tmpFile, 0 ) ) { + if (! KIO::NetAccess::download(url, tmpFile, 0)) { return false; } - QFile file( tmpFile ); - if ( ! file.open( QIODevice::ReadOnly ) ) { + QFile file(tmpFile); + if (! file.open(QIODevice::ReadOnly)) { return false; } - QTextStream stream( &file ); + QTextStream stream(&file); QTextCodec* codec = QTextCodec::codecForName("Shift-JIS"); - stream.setCodec( codec ); + stream.setCodec(codec); QString html = stream.readAll(); // parse QStringList list; - Q3ValueList<Kita::Category> categoryList = getCategoryList( html ); + Q3ValueList<Kita::Category> categoryList = getCategoryList(html); Q3ValueList<Kita::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 ); + for (it = categoryList.begin(); it != categoryList.end(); ++it) { + Kita::Category category = (*it); Q3ValueList<QString> board_url_list = category.boardURLList; - if ( board_url_list.isEmpty() ) continue; + if (board_url_list.isEmpty()) continue; int count = 0; - for ( Q3ValueList<QString>::iterator it2 = board_url_list.begin(); - it2 != board_url_list.end(); ++it2 ) { + for (Q3ValueList<QString>::iterator it2 = board_url_list.begin(); + it2 != board_url_list.end(); ++it2) { QString boardURL = *it2; QString boardName = category.boardNameList[ count ]; QString oldURL; - int ret = Kita::BoardManager::enrollBoard( boardURL, boardName, oldURL, Kita::Board_Unknown, + int ret = Kita::BoardManager::enrollBoard(boardURL, boardName, oldURL, Kita::Board_Unknown, true /* test only */ - ); - if ( ret == Kita::Board_enrollNew ) { + ); + if (ret == Kita::Board_enrollNew) { newBoards += boardName + " ( " + category.category_name + " ) " + boardURL + '\n'; } - if ( ret == Kita::Board_enrollMoved ) { + if (ret == Kita::Board_enrollMoved) { oldBoards += boardName + " ( " + category.category_name + " ) " + oldURL + " -> " + boardURL + '\n'; } count++; @@ -179,100 +179,100 @@ const int maxNewBoard = 64; /* show new board names */ - if ( !newBoards.isEmpty() && newBoards.count( "\n" ) < maxNewBoard ) { + if (!newBoards.isEmpty() && newBoards.count("\n") < maxNewBoard) { - QStringList boardList = newBoards.split( '\n' ); - KMessageBox::informationList( this, - i18n( "New boards:\n\n" ), - boardList, "Kita" ); + QStringList boardList = newBoards.split('\n'); + KMessageBox::informationList(this, + i18n("New boards:\n\n"), + boardList, "Kita"); } /* show moved board names */ - if ( !oldBoards.isEmpty() ) { + if (!oldBoards.isEmpty()) { - QStringList boardList = oldBoards.split( '\n' ); - KMessageBox::informationList( this, - i18n( "These boards were moved:\n\n" ) - + i18n( "\nPlease create the backup of those caches.\n" ), - boardList, "Kita" ); + QStringList boardList = oldBoards.split('\n'); + KMessageBox::informationList(this, + i18n("These boards were moved:\n\n") + + i18n("\nPlease create the backup of those caches.\n"), + boardList, "Kita"); } - if ( ( !newBoards.isEmpty() && newBoards.count( "\n" ) < maxNewBoard ) - || !oldBoards.isEmpty() ) { + if ((!newBoards.isEmpty() && newBoards.count("\n") < maxNewBoard) + || !oldBoards.isEmpty()) { - QMessageBox mb( "kita", i18n( "Do you really want to update board list?" ), + QMessageBox mb("kita", i18n("Do you really want to update board list?"), QMessageBox::Information, QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default | QMessageBox::Escape, - QMessageBox::No, this ); + QMessageBox::No, this); - mb.setButtonText( QMessageBox::No, i18n( "Copy" ) ); + mb.setButtonText(QMessageBox::No, i18n("Copy")); int ret; - while ( ( ret = mb.exec() ) == QMessageBox::No ) { - QString str = i18n( "New boards:\n\n" ) + newBoards + '\n' - + i18n( "These boards were moved:\n\n" ) + oldBoards; - QApplication::clipboard() ->setText( str , QClipboard::Clipboard ); - QApplication::clipboard() ->setText( str , QClipboard::Selection ); + while ((ret = mb.exec()) == QMessageBox::No) { + QString str = i18n("New boards:\n\n") + newBoards + '\n' + + i18n("These boards were moved:\n\n") + oldBoards; + QApplication::clipboard() ->setText(str , QClipboard::Clipboard); + QApplication::clipboard() ->setText(str , QClipboard::Selection); } - if ( ret == QMessageBox::Cancel ) return false; - } else if ( newBoards.isEmpty() && oldBoards.isEmpty() ) { + if (ret == QMessageBox::Cancel) return false; + } else if (newBoards.isEmpty() && oldBoards.isEmpty()) { - QMessageBox::information( this, "Kita", i18n( "no new boards" ) ); + QMessageBox::information(this, "Kita", i18n("no new boards")); return false; } // if moved URL exists. move files. - for( int i=0; i<oldURLs.count(); i++ ) { + for(int i=0; i<oldURLs.count(); i++) { QString oldURL = oldURLs[ i ]; QString newURL = newURLs[ i ]; // qDebug("move %s -> %s", oldURL.latin1(), newURL.latin1()); - Kita::BoardManager::moveBoard( oldURL, newURL ); + Kita::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 ); + QString configPath = KStandardDirs::locateLocal("appdata", "board_list"); + KConfig config(configPath); + for (it = categoryList.begin(); it != categoryList.end(); ++it) { + Kita::Category category = (*it); Q3ValueList<QString> board_url_list = category.boardURLList; - if ( board_url_list.isEmpty() ) { + if (board_url_list.isEmpty()) { continue; } list << category.category_name; - KConfigGroup group = config.group( category.category_name ); + KConfigGroup group = config.group(category.category_name); Q3ValueList<QString>::iterator it2; int count = 0; - for ( it2 = board_url_list.begin(); it2 != board_url_list.end(); ++it2 ) { - QString key = QString( "item%1" ).arg( count ); + for (it2 = board_url_list.begin(); it2 != board_url_list.end(); ++it2) { + QString key = QString("item%1").arg(count); QString boardURL = *it2; QString boardName = category.boardNameList[ count ]; QStringList tmpList; tmpList << boardURL; tmpList << boardName; - group.writeEntry( key, tmpList ); + group.writeEntry(key, tmpList); count++; } } - KConfigGroup group2 = config.group( "" ); - group2.writeEntry( "Categories", list ); + KConfigGroup group2 = config.group(""); + group2.writeEntry("Categories", list); QDateTime now = QDateTime::currentDateTime(); - QString logPath = KStandardDirs::locateLocal( "appdata", "board_log.txt" ); + QString logPath = KStandardDirs::locateLocal("appdata", "board_log.txt"); - QFile logfile( logPath ); - if ( logfile.open( QIODevice::WriteOnly | QIODevice::Append ) ) { - QTextStream stream( &logfile ); - stream.setCodec( "UTF-8" ); + QFile logfile(logPath); + if (logfile.open(QIODevice::WriteOnly | QIODevice::Append)) { + QTextStream stream(&logfile); + stream.setCodec("UTF-8"); - stream << "Date: " << now.toString( "yyyy/MM/dd hh:mm:ss" ) << endl; - stream << i18n( "New boards:\n\n" ) + newBoards + '\n'; - stream << i18n( "These boards were moved:\n\n" ) + oldBoards; + stream << "Date: " << now.toString("yyyy/MM/dd hh:mm:ss") << endl; + stream << i18n("New boards:\n\n") + newBoards + '\n'; + stream << i18n("These boards were moved:\n\n") + oldBoards; stream << "----------------------------------------" << endl; logfile.close(); } @@ -282,7 +282,7 @@ void KitaBBSView::updateBoardList() { - if ( downloadBoardList() ) showBoardList(); + if (downloadBoardList()) showBoardList(); } /** @@ -295,63 +295,63 @@ { /* color setting */ /* - m_textColor = QColor( "white" ); - m_baseColor = QColor( "red" ); - m_backColor = QColor( "yellow" ); - m_altColor = QColor( "blue" ); + m_textColor = QColor("white"); + m_baseColor = QColor("red"); + m_backColor = QColor("yellow"); + m_altColor = QColor("blue"); */ /*-------------------------------------------------*/ /* set background color */ -// m_boardList->viewport() ->setPaletteBackgroundColor( m_backColor ); // TODO -// m_boardList->setAlternateBackground( m_altColor ); // TODO +// m_boardList->viewport() ->setPaletteBackgroundColor(m_backColor); // TODO +// m_boardList->setAlternateBackground(m_altColor); // TODO // clear list m_boardList->clear(); m_favorites = 0; - QString configPath = KStandardDirs::locateLocal( "appdata", "board_list" ); - KConfig config( configPath ); - QStringList category_list = config.group("").readEntry( "Categories", QStringList() ); + QString configPath = KStandardDirs::locateLocal("appdata", "board_list"); + KConfig config(configPath); + QStringList category_list = config.group("").readEntry("Categories", QStringList()); Kita::ListViewItem* previous = 0; QStringList::iterator it; - for ( it = category_list.begin(); it != category_list.end(); ++it ) { - QString category = ( *it ); + for (it = category_list.begin(); it != category_list.end(); ++it) { + QString category = (*it); - KConfigGroup group = config.group( category ); - Kita::ListViewItem* categoryItem = new Kita::ListViewItem( m_boardList, previous, category ); -// categoryItem->setColor( m_textColor, m_baseColor ); // TODO + KConfigGroup group = config.group(category); + Kita::ListViewItem* categoryItem = new Kita::ListViewItem(m_boardList, previous, category); +// categoryItem->setColor(m_textColor, m_baseColor); // TODO Kita::ListViewItem* previousBoard = 0; - for ( int count = 0; ; count++ ) { - QString key = QString( "item%1" ).arg( count ); - QStringList value = group.readEntry( key, QStringList() ); - if ( value.count() != 2 ) { + for (int count = 0; ; count++) { + QString key = QString("item%1").arg(count); + QStringList value = group.readEntry(key, QStringList()); + if (value.count() != 2) { break; } QString boardURL = value[ 0 ]; QString boardName = value[ 1 ]; - if ( boardURL.contains( '/' ) != 4 || boardURL.right( 1 ) != "/" ) { + if (boardURL.contains('/') != 4 || boardURL.right(1) != "/") { // OK: http://pc8.2ch.net/linux/ // NG: http://www.machi.to/ // NG: http://find.2ch.net/enq/board.php continue; } QString oldURL; - Kita::BoardManager::enrollBoard( boardURL, boardName, oldURL ); - Kita::BoardManager::loadBBSHistory( boardURL ); - previousBoard = new Kita::ListViewItem( categoryItem, previousBoard, boardName, boardURL ); -// previousBoard->setColor( m_textColor, m_baseColor ); // TODO + Kita::BoardManager::enrollBoard(boardURL, boardName, oldURL); + Kita::BoardManager::loadBBSHistory(boardURL); + previousBoard = new Kita::ListViewItem(categoryItem, previousBoard, boardName, boardURL); +// previousBoard->setColor(m_textColor, m_baseColor); // TODO } previous = categoryItem; } QString boardURL = "http://jbbs.livedoor.jp/computer/18420/" ; - QString boardName = i18n( "Kita Board" ); + QString boardName = i18n("Kita Board"); QString oldURL; - new Kita::ListViewItem( m_boardList, 0, boardName, boardURL ); - Kita::BoardManager::enrollBoard( boardURL, boardName, oldURL ); + new Kita::ListViewItem(m_boardList, 0, boardName, boardURL); + Kita::BoardManager::enrollBoard(boardURL, boardName, oldURL); loadExtBoard(); refreshFavoriteBoards(); @@ -361,33 +361,33 @@ /* private */ void KitaBBSView::loadExtBoard() { - QString configPath = KStandardDirs::locateLocal( "appdata", "extbrd.conf" ); - QFile file( configPath ); - if ( file.open( QIODevice::ReadOnly ) ) { + QString configPath = KStandardDirs::locateLocal("appdata", "extbrd.conf"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { - QTextStream stream( &file ); - stream.setCodec( "UTF-8" ); + QTextStream stream(&file); + stream.setCodec("UTF-8"); QStringList list; QString str; - Kita::ListViewItem* categoryItem = new Kita::ListViewItem( m_boardList, "extboard" ); -// categoryItem->setColor( m_textColor, m_baseColor ); // TODO + Kita::ListViewItem* categoryItem = new Kita::ListViewItem(m_boardList, "extboard"); +// categoryItem->setColor(m_textColor, m_baseColor); // TODO - while ( !( str = stream.readLine() ).isEmpty() ) { - if ( ! str.isEmpty() ) { - QStringList list = str.split( "<>" ); + while (!(str = stream.readLine()).isEmpty()) { + if (! str.isEmpty()) { + QStringList list = str.split("<>"); - if ( list.size() == 2 || list.size() == 3 ) { + if (list.size() == 2 || list.size() == 3) { QString board_title = list[ 0 ]; QString board_url = list[ 1 ]; - Kita::ListViewItem* tmpitem = new Kita::ListViewItem( categoryItem, board_title, board_url ); -// tmpitem->setColor( m_textColor, m_baseColor ); // TODO + Kita::ListViewItem* tmpitem = new Kita::ListViewItem(categoryItem, board_title, board_url); +// tmpitem->setColor(m_textColor, m_baseColor); // TODO QString oldURL; int type = Kita::Board_Unknown; - if ( list.size() == 3 ) type = list[ 2 ].toInt(); - Kita::BoardManager::enrollBoard( board_url, board_title, oldURL, type ); + if (list.size() == 3) type = list[ 2 ].toInt(); + Kita::BoardManager::enrollBoard(board_url, board_title, oldURL, type); } } } @@ -396,34 +396,34 @@ } } -Q3ValueList<Kita::Category> KitaBBSView::getCategoryList( const QString& html ) const +Q3ValueList<Kita::Category> KitaBBSView::getCategoryList(const QString& html) const { Q3ValueList<Kita::Category> result; - QStringList lines = html.split( '\n' ); + QStringList lines = html.split('\n'); QStringList::iterator it; Kita::Category current_category; current_category.category_name.clear(); current_category.boardNameList.clear(); current_category.boardURLList.clear(); - for ( it = lines.begin(); it != lines.end(); ++it ) { - QString category_name = Kita::getCategory( *it ); - if ( !category_name.isEmpty() ) { - if ( !current_category.category_name.isEmpty() ) { - result.append( current_category ); + for (it = lines.begin(); it != lines.end(); ++it) { + QString category_name = Kita::getCategory(*it); + if (!category_name.isEmpty()) { + if (!current_category.category_name.isEmpty()) { + result.append(current_category); } current_category.category_name = category_name; current_category.boardNameList.clear(); current_category.boardURLList.clear(); } else { - QRegExp regexp( "<A HREF=([^ ]*).*>(.*)</A>", Qt::CaseInsensitive ); - if ( regexp.indexIn( ( *it ) ) != -1 ) { - QString url = regexp.cap( 1 ); - QString title = regexp.cap( 2 ); - if ( Kita::isBoardURL( url ) && !current_category.category_name.isEmpty() ) { - current_category.boardNameList.append( title ); - current_category.boardURLList.append( url ); + QRegExp regexp("<A HREF=([^ ]*).*>(.*)</A>", Qt::CaseInsensitive); + if (regexp.indexIn((*it)) != -1) { + QString url = regexp.cap(1); + QString title = regexp.cap(2); + if (Kita::isBoardURL(url) && !current_category.category_name.isEmpty()) { + current_category.boardNameList.append(title); + current_category.boardURLList.append(url); } } } @@ -433,48 +433,48 @@ void KitaBBSView::refreshFavoriteBoards() { - if ( ! m_favorites ) { - m_favorites = new Kita::ListViewItem( m_boardList, 0, i18n( "Favorites" ) ); + if (! m_favorites) { + m_favorites = new Kita::ListViewItem(m_boardList, 0, i18n("Favorites")); } -// m_favorites->setColor( m_textColor, m_baseColor ); // TODO +// m_favorites->setColor(m_textColor, m_baseColor); // TODO // remove all items. do { Q3ListViewItem* child = m_favorites->firstChild(); delete child; - } while ( m_favorites->childCount() != 0 ); + } while (m_favorites->childCount() != 0); // insert items. Q3ValueList<KUrl> boards = Kita::FavoriteBoards::boards(); Q3ValueList<KUrl>::iterator it; - for ( it = boards.begin(); it != boards.end(); ++it ) { - QString boardURL = ( *it ).prettyUrl(); - QString boardName = Kita::BoardManager::boardName( boardURL ); + for (it = boards.begin(); it != boards.end(); ++it) { + QString boardURL = (*it).prettyUrl(); + QString boardName = Kita::BoardManager::boardName(boardURL); - Kita::ListViewItem* item = new Kita::ListViewItem( m_favorites, 0, boardName, boardURL ); -// item->setColor( m_textColor, m_baseColor ); // TODO + Kita::ListViewItem* item = new Kita::ListViewItem(m_favorites, 0, boardName, boardURL); +// item->setColor(m_textColor, m_baseColor); // TODO } } -void KitaBBSView::loadBoard( Q3ListViewItem* item ) +void KitaBBSView::loadBoard(Q3ListViewItem* item) { - if ( ! item ) return ; + if (! item) return ; - QString boardName = item->text( 0 ); - QString boardURL = Kita::BoardManager::boardURL( item->text( 1 ) ); + QString boardName = item->text(0); + QString boardURL = Kita::BoardManager::boardURL(item->text(1)); - if ( boardURL.isEmpty() ) { + if (boardURL.isEmpty()) { return ; } - ViewMediator::getInstance()->openBoard( boardURL ); + ViewMediator::getInstance()->openBoard(boardURL); } -void KitaBBSView::setFont( const QFont& font ) +void KitaBBSView::setFont(const QFont& font) { - m_boardList->setFont( font ); - SearchCombo->setFont( font ); + m_boardList->setFont(font); + SearchCombo->setFont(font); } /* public slot :*/ /* virtual */ @@ -486,95 +486,95 @@ void KitaBBSView::slotMenuOpenWithBrowser() { Q3ListViewItem* item = m_boardList->currentItem(); - QString boardName = item->text( 0 ); - KUrl boardURL = item->text( 1 ); - KRun::runUrl( boardURL, "text/html", 0 ); + QString boardName = item->text(0); + KUrl boardURL = item->text(1); + KRun::runUrl(boardURL, "text/html", 0); } -void KitaBBSView::slotContextMenuRequested( Q3ListViewItem* item, const QPoint& point, int ) +void KitaBBSView::slotContextMenuRequested(Q3ListViewItem* item, const QPoint& point, int) { - if ( item == 0 ) { + if (item == 0) { return ; } - KMenu popup( 0 ); + KMenu popup(0); - KAction* openWithBrowserAct = new KAction( i18n( "Open with Web Browser" ), this ); - popup.addAction( openWithBrowserAct ); + KAction* openWithBrowserAct = new KAction(i18n("Open with Web Browser"), this); + popup.addAction(openWithBrowserAct); - KAction* copyURLAct = new KAction( i18n( "Copy URL" ), this ); - popup.addAction( copyURLAct ); + KAction* copyURLAct = new KAction(i18n("Copy URL"), this); + popup.addAction(copyURLAct); - KAction* copyTitleAndURLAct = new KAction( i18n( "Copy title and URL" ), this ); - popup.addAction( copyTitleAndURLAct ); + KAction* copyTitleAndURLAct = new KAction(i18n("Copy title and URL"), this); + popup.addAction(copyTitleAndURLAct); KAction* removeFromFavoritesAct = 0; KAction* addToFavoritesAct = 0; - if ( item->parent() == m_favorites ) { - removeFromFavoritesAct = new KAction( i18n( "Remove from Favorites" ), this ); - popup.addAction( removeFromFavoritesAct ); + if (item->parent() == m_favorites) { + removeFromFavoritesAct = new KAction(i18n("Remove from Favorites"), this); + popup.addAction(removeFromFavoritesAct); } else { - addToFavoritesAct = new KAction( i18n( "Add to Favorites" ), this ); - popup.addAction( addToFavoritesAct ); + addToFavoritesAct = new KAction(i18n("Add to Favorites"), this); + popup.addAction(addToFavoritesAct); } - QString boardName = item->text( 0 ); - KUrl boardURL = item->text( 1 ); - KUrl boardURL_upToDate = Kita::BoardManager::boardURL( boardURL ); + QString boardName = item->text(0); + KUrl boardURL = item->text(1); + KUrl boardURL_upToDate = Kita::BoardManager::boardURL(boardURL); QClipboard* clipboard = QApplication::clipboard(); - QAction *action = popup.exec( point ); - if ( !action ) { + QAction *action = popup.exec(point); + if (!action) { return; } - if ( action == openWithBrowserAct ) { - KRun::runUrl( boardURL, "text/html", this ); - } else if ( action == copyURLAct ) { - clipboard->setText( boardURL_upToDate.prettyUrl(), QClipboard::Clipboard ); - clipboard->setText( boardURL_upToDate.prettyUrl(), QClipboard::Selection ); - } else if ( action == copyTitleAndURLAct ) { - clipboard->setText( boardName + '\n' + boardURL_upToDate.prettyUrl(), QClipboard::Clipboard ); - clipboard->setText( boardName + '\n' + boardURL_upToDate.prettyUrl(), QClipboard::Selection ); - } else if ( action == addToFavoritesAct ) { - Kita::FavoriteBoards::append( boardURL_upToDate ); - } else if ( action == removeFromFavoritesAct ) { - Kita::FavoriteBoards::remove( boardURL ); + if (action == openWithBrowserAct) { + KRun::runUrl(boardURL, "text/html", this); + } else if (action == copyURLAct) { + clipboard->setText(boardURL_upToDate.prettyUrl(), QClipboard::Clipboard); + clipboard->setText(boardURL_upToDate.prettyUrl(), QClipboard::Selection); + } else if (action == copyTitleAndURLAct) { + clipboard->setText(boardName + '\n' + boardURL_upToDate.prettyUrl(), QClipboard::Clipboard); + clipboard->setText(boardName + '\n' + boardURL_upToDate.prettyUrl(), QClipboard::Selection); + } else if (action == addToFavoritesAct) { + Kita::FavoriteBoards::append(boardURL_upToDate); + } else if (action == removeFromFavoritesAct) { + Kita::FavoriteBoards::remove(boardURL); } } -void KitaBBSView::slotMouseButtonClicked( int button, Q3ListViewItem* item ) +void KitaBBSView::slotMouseButtonClicked(int button, Q3ListViewItem* item) { - if ( ! item ) return ; + if (! item) return ; - QString boardName = item->text( 0 ); - QString boardURL = Kita::BoardManager::boardURL( item->text( 1 ) ); - if ( boardURL.isEmpty() ) { - m_boardList->setOpen( item, !item->isOpen() ); + QString boardName = item->text(0); + QString boardURL = Kita::BoardManager::boardURL(item->text(1)); + if (boardURL.isEmpty()) { + m_boardList->setOpen(item, !item->isOpen()); return ; } - switch ( button ) { + switch (button) { case Qt::MidButton: - ViewMediator::getInstance()->openBoard( boardURL ); + ViewMediator::getInstance()->openBoard(boardURL); break; case Qt::LeftButton: - ViewMediator::getInstance()->openBoard( boardURL ); + ViewMediator::getInstance()->openBoard(boardURL); break; } } void KitaBBSView::loadOpened() { - QString configPath = KStandardDirs::locateLocal( "appdata", "board_state.conf" ); - KConfig config( configPath ); + QString configPath = KStandardDirs::locateLocal("appdata", "board_state.conf"); + KConfig config(configPath); - QStringList openedList = config.group("").readEntry( "Opened", QStringList() ); + QStringList openedList = config.group("").readEntry("Opened", QStringList()); Q3ListViewItem* item; - for ( item = m_boardList->firstChild(); item; item = item->nextSibling() ) { - QString categoryName = item->text( 0 ); - if ( openedList.indexOf( categoryName ) != -1 ) { - item->setOpen( true ); + for (item = m_boardList->firstChild(); item; item = item->nextSibling()) { + QString categoryName = item->text(0); + if (openedList.indexOf(categoryName) != -1) { + item->setOpen(true); } } } @@ -584,17 +584,17 @@ QStringList openedList; Q3ListViewItem* item; - for ( item = m_boardList->firstChild(); item; item = item->nextSibling() ) { - QString categoryName = item->text( 0 ); - if ( item->isOpen() ) { + for (item = m_boardList->firstChild(); item; item = item->nextSibling()) { + QString categoryName = item->text(0); + if (item->isOpen()) { openedList << categoryName; } } - QString configPath = KStandardDirs::locateLocal( "appdata", "board_state.conf" ); - KConfig config( configPath ); + QString configPath = KStandardDirs::locateLocal("appdata", "board_state.conf"); + KConfig config(configPath); - config.group("").writeEntry( "Opened", openedList ); + config.group("").writeEntry("Opened", openedList); } /** @@ -602,24 +602,24 @@ * * @param str string to search. */ -void KitaBBSView::filter( const QString& str ) +void KitaBBSView::filter(const QString& str) { Q3ListViewItem* categoryItem; Q3ListViewItem* boardItem; - for ( categoryItem = m_boardList->firstChild(); categoryItem; categoryItem = categoryItem->nextSibling() ) { + for (categoryItem = m_boardList->firstChild(); categoryItem; categoryItem = categoryItem->nextSibling()) { bool matched = false; - for ( boardItem = categoryItem->firstChild(); boardItem; boardItem = boardItem->nextSibling() ) { - QString boardName = boardItem->text( 0 ); - if ( boardName.contains( str ) ) { - boardItem->setVisible( true ); + for (boardItem = categoryItem->firstChild(); boardItem; boardItem = boardItem->nextSibling()) { + QString boardName = boardItem->text(0); + if (boardName.contains(str)) { + boardItem->setVisible(true); matched = true; } else { - boardItem->setVisible( false ); + boardItem->setVisible(false); } } - categoryItem->setVisible( matched ); + categoryItem->setVisible(matched); } } Modified: kita/branches/KITA-KDE4/kita/src/bbsview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/bbsview.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/bbsview.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -47,7 +47,7 @@ QColor m_backColor; QColor m_altColor; - Q3ValueList<Kita::Category> getCategoryList( const QString& html ) const; + Q3ValueList<Kita::Category> getCategoryList(const QString& html) const; void saveOpened(); KComboBox* SearchCombo; @@ -59,15 +59,15 @@ QSpacerItem* spacer2; private slots: - void loadBoard( Q3ListViewItem* item ); - void slotContextMenuRequested( Q3ListViewItem*, const QPoint&, int ); - void slotMouseButtonClicked( int, Q3ListViewItem* ); + void loadBoard(Q3ListViewItem* item); + void slotContextMenuRequested(Q3ListViewItem*, const QPoint&, int); + void slotMouseButtonClicked(int, Q3ListViewItem*); void refreshFavoriteBoards(); - void filter( const QString& str ); + void filter(const QString& str); void slotMenuOpenWithBrowser(); public: - explicit KitaBBSView( QWidget *parent, const char *name = 0 ); + explicit KitaBBSView(QWidget *parent, const char *name = 0); ~KitaBBSView(); void loadOpened(); @@ -75,7 +75,7 @@ public slots: void updateBoardList(); void showBoardList(); - void setFont( const QFont& font ); + void setFont(const QFont& font); virtual void setFocus(); private: Modified: kita/branches/KITA-KDE4/kita/src/boardtabwidget.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/boardtabwidget.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/boardtabwidget.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -24,17 +24,17 @@ #include "viewmediator.h" #include "libkita/boardmanager.h" -KitaBoardTabWidget::KitaBoardTabWidget( QWidget* parent, Qt::WFlags f ) - : KitaTabWidgetBase( parent, f ) +KitaBoardTabWidget::KitaBoardTabWidget(QWidget* parent, Qt::WFlags f) + : KitaTabWidgetBase(parent, f) { - setXMLFile( "boardtabwidgetui.rc" ); + setXMLFile("boardtabwidgetui.rc"); - setTabBar( new SubjectTabBar( this ) ); + setTabBar(new SubjectTabBar(this)); - FavoriteListView* favoriteList = new FavoriteListView( this ); - favoriteList->setObjectName( "favoriteTab" ); - ViewMediator::getInstance()->setFavoriteListView( favoriteList ); - addTab( favoriteList, i18n( "Favorite" ) ); + FavoriteListView* favoriteList = new FavoriteListView(this); + favoriteList->setObjectName("favoriteTab"); + ViewMediator::getInstance()->setFavoriteListView(favoriteList); + addTab(favoriteList, i18n("Favorite")); setupActions(); } @@ -42,52 +42,52 @@ KitaBoardTabWidget::~KitaBoardTabWidget() {} -void KitaBoardTabWidget::updateBoardView( const KUrl& datURL ) +void KitaBoardTabWidget::updateBoardView(const KUrl& datURL) { - for( int i=0; i<count(); i++) { - KitaBoardView* view = isSubjectView( widget( i ) ); - if( view ) { - view->slotUpdateSubject( datURL ); + for(int i=0; i<count(); i++) { + KitaBoardView* view = isSubjectView(widget(i)); + if(view) { + view->slotUpdateSubject(datURL); } } } /* public slots */ -void KitaBoardTabWidget::loadBoard( const KUrl& boardURL ) +void KitaBoardTabWidget::loadBoard(const KUrl& boardURL) { - KitaBoardView * view = findView( boardURL ); - QString boardName = Kita::BoardManager::boardName( boardURL ); - if ( !view ) { - view = createView( boardName ); + KitaBoardView * view = findView(boardURL); + QString boardName = Kita::BoardManager::boardName(boardURL); + if (!view) { + view = createView(boardName); } - if ( view ) { - setCurrentWidget( view ); - view->loadBoard( boardURL ); + if (view) { + setCurrentWidget(view); + view->loadBoard(boardURL); } } /* create KitaBoardView */ /* private */ -KitaBoardView* KitaBoardTabWidget::createView( QString label ) +KitaBoardView* KitaBoardTabWidget::createView(QString label) { - KitaBoardView * view = new KitaBoardView( this ); - if ( view ) { - insertTab( count() - 1, view, label ); + KitaBoardView * view = new KitaBoardView(this); + if (view) { + insertTab(count() - 1, view, label); } return view; } /* private */ -KitaBoardView* KitaBoardTabWidget::findView( const KUrl& boardURL ) +KitaBoardView* KitaBoardTabWidget::findView(const KUrl& boardURL) { int max = count() - 1; - if ( max <= 0 ) return 0; + if (max <= 0) return 0; int i = 0; - while ( i < max ) { - KitaBoardView * view = isSubjectView( widget( i ) ); - if ( view && view->boardURL() == boardURL ) return view; + while (i < max) { + KitaBoardView * view = isSubjectView(widget(i)); + if (view && view->boardURL() == boardURL) return view; i++; } @@ -96,21 +96,21 @@ /* protected */ /* virtual */ -void KitaBoardTabWidget::deleteWidget( QWidget* w ) +void KitaBoardTabWidget::deleteWidget(QWidget* w) { - KitaBoardView * view = isSubjectView( w ); - if ( !view ) return ; - removePage( view ); + KitaBoardView * view = isSubjectView(w); + if (!view) return ; + removePage(view); delete view; } /* private */ -KitaBoardView* KitaBoardTabWidget::isSubjectView( QWidget* w ) +KitaBoardView* KitaBoardTabWidget::isSubjectView(QWidget* w) { KitaBoardView * view = 0; - if ( w ) { - if ( w->inherits( "KitaBoardView" ) ) view = static_cast< KitaBoardView* >( w ); + if (w) { + if (w->inherits("KitaBoardView")) view = static_cast< KitaBoardView* >(w); } return view; @@ -123,41 +123,41 @@ void KitaBoardTabWidget::setupActions() { KAction* find_action = actionCollection()->addAction("subjectview_find"); - find_action->setText( i18n( "Find" ) ); + find_action->setText(i18n("Find")); find_action->setShortcut(KStandardShortcut::find()); connect(find_action, SIGNAL(triggered()), this, SLOT(slotFocusSearchCombo())); KAction* reload_action = actionCollection()->addAction("subjectview_reload"); - reload_action->setText( i18n( "Reload" ) ); + reload_action->setText(i18n("Reload")); reload_action->setShortcut(KStandardShortcut::reload()); connect(reload_action, SIGNAL(triggered()), this, SLOT(slotReloadButton())); KAction* showoldlogs_action = actionCollection()->addAction("subjectview_showoldlogs"); - showoldlogs_action->setText( i18n( "Show Old Logs" ) ); + showoldlogs_action->setText(i18n("Show Old Logs")); connect(showoldlogs_action, SIGNAL(triggered()), this, SLOT(slotShowOldLogs())); } /* public slot */ void KitaBoardTabWidget::slotReloadButton() { - KitaBoardView * view = isSubjectView( currentWidget() ); - if ( view ) view->reloadSubject(); + KitaBoardView * view = isSubjectView(currentWidget()); + if (view) view->reloadSubject(); } /* public slot */ void KitaBoardTabWidget::slotFocusSearchCombo() { - KitaBoardView * view = isSubjectView( currentWidget() ); - if ( view ) view->slotFocusSearchCombo(); + KitaBoardView * view = isSubjectView(currentWidget()); + if (view) view->slotFocusSearchCombo(); } /* public slot */ -void KitaBoardTabWidget::slotShowOldLogs( int idx ) +void KitaBoardTabWidget::slotShowOldLogs(int idx) { KitaBoardView * view; - if ( idx == -1 ) view = isSubjectView( currentWidget() ); - else view = isSubjectView( widget( idx ) ); - if ( view ) view->toggleShowOldLogs(); + if (idx == -1) view = isSubjectView(currentWidget()); + else view = isSubjectView(widget(idx)); + if (view) view->toggleShowOldLogs(); } /*---------------------------------------------------------------------*/ @@ -166,11 +166,11 @@ -SubjectTabBar::SubjectTabBar( QWidget* parent ) - : KTabBar( parent ) +SubjectTabBar::SubjectTabBar(QWidget* parent) + : KTabBar(parent) { - connect( this, SIGNAL( contextMenu( int, const QPoint& ) ), - SLOT( showPopupMenu( int, const QPoint& ) ) ); + connect(this, SIGNAL(contextMenu(int, const QPoint&)), + SLOT(showPopupMenu(int, const QPoint&))); } SubjectTabBar::~SubjectTabBar() @@ -178,67 +178,67 @@ /* private */ /* virtual */ -void SubjectTabBar::showPopupMenu( int idx, const QPoint& global ) +void SubjectTabBar::showPopupMenu(int idx, const QPoint& global) { - KitaBoardTabWidget* tabwidget = static_cast<KitaBoardTabWidget*>( parentWidget() ); + KitaBoardTabWidget* tabwidget = static_cast<KitaBoardTabWidget*>(parentWidget()); KActionCollection * collection = tabwidget->actionCollection(); - if ( QString::compare( tabwidget->widget( idx ) ->objectName(), "favoriteTab" ) == 0 ) return ; - KMenu popup( this ); + if (QString::compare(tabwidget->widget(idx) ->objectName(), "favoriteTab") == 0) return ; + KMenu popup(this); - KAction* closeAct = new KAction( i18n( "Close this tab" ), this ); - popup.addAction( closeAct ); + KAction* closeAct = new KAction(i18n("Close this tab"), this); + popup.addAction(closeAct); - popup.addAction( collection->action( "tab_prevtab" ) ); - popup.addAction( collection->action( "tab_nexttab" ) ); + popup.addAction(collection->action("tab_prevtab")); + popup.addAction(collection->action("tab_nexttab")); popup.addSeparator(); - KAction* closeOtherAct = new KAction( i18n( "Close Other Tabs" ), this ); - popup.addAction( closeOtherAct ); + KAction* closeOtherAct = new KAction(i18n("Close Other Tabs"), this); + popup.addAction(closeOtherAct); - KAction* closeRightAct = new KAction( i18n( "Close right tabs" ), this ); - popup.addAction( closeRightAct ); + KAction* closeRightAct = new KAction(i18n("Close right tabs"), this); + popup.addAction(closeRightAct); - KAction* closeLeftAct = new KAction( i18n( "Close left tabs" ), this ); - popup.addAction( closeLeftAct ); + KAction* closeLeftAct = new KAction(i18n("Close left tabs"), this); + popup.addAction(closeLeftAct); - popup.addAction( collection->action( "tab_closealltab" ) ); + popup.addAction(collection->action("tab_closealltab")); popup.addSeparator(); - KAction* showOldLogsAct = new KAction( i18n( "Show Old Logs" ), this ); - popup.addAction( showOldLogsAct ); + KAction* showOldLogsAct = new KAction(i18n("Show Old Logs"), this); + popup.addAction(showOldLogsAct); - KAction* openBrowserAct = new KAction( i18n( "Open with Web Browser" ), this ); - popup.addAction( openBrowserAct ); + KAction* openBrowserAct = new KAction(i18n("Open with Web Browser"), this); + popup.addAction(openBrowserAct); - KAction* copyTitleAct = new KAction( i18n( "Copy title and URL" ), this ); - popup.addAction( copyTitleAct ); + KAction* copyTitleAct = new KAction(i18n("Copy title and URL"), this); + popup.addAction(copyTitleAct); popup.addSeparator(); - popup.addAction( collection->action( "tab_configkeys" ) ); + popup.addAction(collection->action("tab_configkeys")); - KitaBoardView* subjectView = static_cast<KitaBoardView *>( tabwidget->widget( idx ) ); + KitaBoardView* subjectView = static_cast<KitaBoardView *>(tabwidget->widget(idx)); QClipboard* clipboard = QApplication::clipboard(); - QAction* action = popup.exec( global ); - if ( !action ) { + QAction* action = popup.exec(global); + if (!action) { return; } - if ( action == closeAct ) { - tabwidget->slotCloseTab( idx ); - } else if ( action == closeOtherAct ) { - tabwidget->slotCloseOtherTab( idx ); - } else if ( action == closeRightAct ) { - tabwidget->slotCloseRightTab( idx ); - } else if ( action == closeLeftAct ) { - tabwidget->slotCloseLeftTab( idx ); - } else if ( action == showOldLogsAct ) { - tabwidget->slotShowOldLogs( idx ); - } 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(); - clipboard->setText( cliptxt , QClipboard::Clipboard ); - clipboard->setText( cliptxt , QClipboard::Selection ); + if (action == closeAct) { + tabwidget->slotCloseTab(idx); + } else if (action == closeOtherAct) { + tabwidget->slotCloseOtherTab(idx); + } else if (action == closeRightAct) { + tabwidget->slotCloseRightTab(idx); + } else if (action == closeLeftAct) { + tabwidget->slotCloseLeftTab(idx); + } else if (action == showOldLogsAct) { + tabwidget->slotShowOldLogs(idx); + } 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(); + 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-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/boardtabwidget.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -23,20 +23,20 @@ Q_OBJECT public: - explicit KitaBoardTabWidget( QWidget* parent = 0, Qt::WFlags f = 0 ); + explicit KitaBoardTabWidget(QWidget* parent = 0, Qt::WFlags f = 0); ~KitaBoardTabWidget(); - void updateBoardView( const KUrl& datURL ); + void updateBoardView(const KUrl& datURL); public slots: - void loadBoard( const KUrl& ); + void loadBoard(const KUrl&); private: - KitaBoardView* createView( QString label ); - KitaBoardView* findView( const KUrl& boardURL ); - KitaBoardView* isSubjectView( QWidget* w ); + KitaBoardView* createView(QString label); + KitaBoardView* findView(const KUrl& boardURL); + KitaBoardView* isSubjectView(QWidget* w); protected: - virtual void deleteWidget( QWidget* w ); + virtual void deleteWidget(QWidget* w); /* tab actions */ @@ -47,7 +47,7 @@ public slots: void slotReloadButton(); void slotFocusSearchCombo(); - void slotShowOldLogs( int idx = -1 ); + void slotShowOldLogs(int idx = -1); }; /*--------------------------------------------------*/ @@ -57,11 +57,11 @@ Q_OBJECT public: - SubjectTabBar( QWidget* parent = 0 ); + SubjectTabBar(QWidget* parent = 0); ~SubjectTabBar(); public slots: - virtual void showPopupMenu( int idx, const QPoint& global ); + virtual void showPopupMenu(int idx, const QPoint& global); }; Modified: kita/branches/KITA-KDE4/kita/src/boardview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/boardview.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/boardview.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -50,28 +50,28 @@ #include "libkita/threadindex.h" #include "libkita/threadinfo.h" -KitaBoardView::KitaBoardView( KitaBoardTabWidget* parent ) - : Kita::ThreadListView( parent ) +KitaBoardView::KitaBoardView(KitaBoardTabWidget* parent) + : Kita::ThreadListView(parent) { init(); m_parent = parent; - closeButton->setEnabled( true ); + closeButton->setEnabled(true); - connect( subjectList, SIGNAL( contextMenuRequested( Q3ListViewItem*, const QPoint&, int ) ), - SLOT( slotContextMenuRequested( Q3ListViewItem*, const QPoint&, int ) ) ); - connect( subjectList, SIGNAL( returnPressed( Q3ListViewItem* ) ), - SLOT( loadThread( Q3ListViewItem* ) ) ); - connect( ReloadButton, SIGNAL( clicked() ), - SLOT( reloadSubject() ) ); + connect(subjectList, SIGNAL(contextMenuRequested(Q3ListViewItem*, const QPoint&, int)), + SLOT(slotContextMenuRequested(Q3ListViewItem*, const QPoint&, int))); + connect(subjectList, SIGNAL(returnPressed(Q3ListViewItem*)), + SLOT(loadThread(Q3ListViewItem*))); + connect(ReloadButton, SIGNAL(clicked()), + SLOT(reloadSubject())); - connect( closeButton, SIGNAL( clicked() ), - SLOT( slotCloseButton() ) ); + connect(closeButton, SIGNAL(clicked()), + SLOT(slotCloseButton())); Q3Header* header = subjectList->header(); - connect( header, SIGNAL( sizeChange( int, int, int ) ), - SLOT( slotSizeChange( int, int, int ) ) ); + connect(header, SIGNAL(sizeChange(int, int, int)), + SLOT(slotSizeChange(int, int, int))); - header->installEventFilter( this ); + header->installEventFilter(this); loadLayout(); loadHeaderOnOff(); } @@ -92,8 +92,8 @@ void KitaBoardView::reloadSubject() { - if ( ! m_boardURL.isEmpty() ) { - loadBoard( m_boardURL ); + if (! m_boardURL.isEmpty()) { + loadBoard(m_boardURL); } } @@ -113,16 +113,16 @@ void KitaBoardView::toggleShowOldLogs() { m_showOldLogs = !m_showOldLogs; - loadBoard( m_boardURL, false ); + loadBoard(m_boardURL, false); } -void KitaBoardView::loadThread( Q3ListViewItem* item ) +void KitaBoardView::loadThread(Q3ListViewItem* item) { - if ( ! item ) return ; + if (! item) return ; - KUrl datURL = item->text( Col_DatURL ); + KUrl datURL = item->text(Col_DatURL); - ViewMediator::getInstance()->openThread( datURL ); + ViewMediator::getInstance()->openThread(datURL); } enum { @@ -134,7 +134,7 @@ Thread_HasUnread }; -void KitaBoardView::loadBoard( const KUrl& url, bool online ) +void KitaBoardView::loadBoard(const KUrl& url, bool online) { activateWindow(); topLevelWidget() ->raise(); @@ -156,7 +156,7 @@ /* get list of pointers of Thread classes */ Q3PtrList<Kita::Thread> oldLogList; Q3PtrList<Kita::Thread> threadList; - Kita::BoardManager::getThreadList( m_boardURL, m_showOldLogs, online, threadList, oldLogList ); + Kita::BoardManager::getThreadList(m_boardURL, m_showOldLogs, online, threadList, oldLogList); // reset list subjectList->clear(); @@ -164,34 +164,34 @@ QDateTime current = QDateTime::currentDateTime(); unsigned int countNew = threadList.count(); unsigned int countOld = oldLogList.count(); - for ( unsigned i = 0; i < countNew + countOld; i++ ) { + for (unsigned i = 0; i < countNew + countOld; i++) { - Kita::Thread* thread = i < countNew ? threadList.at( i ) : oldLogList.at( i - countNew ); + Kita::Thread* thread = i < countNew ? threadList.at(i) : oldLogList.at(i - countNew); KUrl datURL = thread->datURL(); - Kita::ThreadListViewItem* item = new Kita::ThreadListViewItem( subjectList ); - int id = ( i < countNew ? i + 1 : 0 ); + Kita::ThreadListViewItem* item = new Kita::ThreadListViewItem(subjectList); + int id = (i < countNew ? i + 1 : 0); int order = i + 1; - updateListViewItem( item, datURL, current, id, order ); + updateListViewItem(item, datURL, current, id, order); } - if ( HideButton->isChecked() ) { + if (HideButton->isChecked()) { HideButton->toggle(); } - ViewMediator::getInstance()->setMainURLLine( m_boardURL ); + ViewMediator::getInstance()->setMainURLLine(m_boardURL); - switch ( Kita::Config::listSortOrder() ) { + switch (Kita::Config::listSortOrder()) { case Kita::Config::EnumListSortOrder::Mark: - subjectList->setSorting( Col_Mark ); + subjectList->setSorting(Col_Mark); break; case Kita::Config::EnumListSortOrder::ID: - subjectList->setSorting( Col_ID ); + subjectList->setSorting(Col_ID); break; default: // do nothing break; } - subjectList->setSelected( subjectList->firstChild(), true ); + subjectList->setSelected(subjectList->firstChild(), true); subjectList->setFocus(); UpdateKindLabel(); @@ -210,7 +210,7 @@ /* public slot */ void KitaBoardView::slotFocusSearchCombo() { - if ( ! SearchCombo->hasFocus() ) { + if (! SearchCombo->hasFocus()) { SearchCombo->setFocus(); } else { setFocus(); @@ -220,38 +220,38 @@ void KitaBoardView::UpdateKindLabel() { QString fmtstr; - fmtstr += QString( "<font color=#C50000>%1</font>" ).arg( m_unreadNum ); - fmtstr += QString( "/<font color=#00C200>%1</font>" ).arg( m_readNum ); - fmtstr += QString( "/<font color=#5AAAFF>%1</font>" ).arg( m_newNum ); - KindLabel->setText( fmtstr ); + fmtstr += QString("<font color=#C50000>%1</font>").arg(m_unreadNum); + fmtstr += QString("/<font color=#00C200>%1</font>").arg(m_readNum); + fmtstr += QString("/<font color=#5AAAFF>%1</font>").arg(m_newNum); + KindLabel->setText(fmtstr); } -void KitaBoardView::setFont( const QFont& font ) +void KitaBoardView::setFont(const QFont& font) { - subjectList->setFont( font ); - SearchCombo->setFont( font ); + subjectList->setFont(font); + SearchCombo->setFont(font); } -void KitaBoardView::slotUpdateSubject( const KUrl& url ) +void KitaBoardView::slotUpdateSubject(const KUrl& url) { QDateTime current = QDateTime::currentDateTime(); - KUrl datURL = Kita::getDatURL( url ); - for ( Q3ListViewItem * item = subjectList->firstChild(); item; item = item->nextSibling() ) { - if ( item->text( Col_DatURL ) == datURL.prettyUrl() ) { + KUrl datURL = Kita::getDatURL(url); + for (Q3ListViewItem * item = subjectList->firstChild(); item; item = item->nextSibling()) { + if (item->text(Col_DatURL) == datURL.prettyUrl()) { - switch ( item->text( Col_MarkOrder ).toInt() ) { + switch (item->text(Col_MarkOrder).toInt()) { case Thread_Readed : case Thread_Read : m_readNum--; break; case Thread_New : m_newNum--; break; case Thread_HasUnread : m_unreadNum--; break; } - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread == 0 ) return ; - int id = item->text( Col_ID ).toInt(); - int order = item->text( Col_IDOrder ).toInt(); - updateListViewItem( item, datURL, current, id, order ); + Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + if (thread == 0) return ; + int id = item->text(Col_ID).toInt(); + int order = item->text(Col_IDOrder).toInt(); + updateListViewItem(item, datURL, current, id, order); UpdateKindLabel(); @@ -264,208 +264,208 @@ /* if id == 0, this thread is old thread. */ /* private */ -void KitaBoardView::updateListViewItem( Q3ListViewItem* item, const KUrl& datURL, const QDateTime& current, int id, int order ) +void KitaBoardView::updateListViewItem(Q3ListViewItem* item, const KUrl& datURL, const QDateTime& current, int id, int order) { QDateTime since; - since.setTime_t( Kita::datToSince( datURL ) ); - QString threadName = Kita::DatManager::threadName( datURL ); - int resNum = Kita::DatManager::getResNum( datURL ); - int readNum = Kita::DatManager::getReadNum( datURL ); - int viewPos = Kita::DatManager::getViewPos( datURL ); - double speed = resNum / ( since.secsTo( current ) / ( 60.0 * 60.0 * 24.0 ) ); + since.setTime_t(Kita::datToSince(datURL)); + QString threadName = Kita::DatManager::threadName(datURL); + int resNum = Kita::DatManager::getResNum(datURL); + int readNum = Kita::DatManager::getReadNum(datURL); + int viewPos = Kita::DatManager::getViewPos(datURL); + double speed = resNum / (since.secsTo(current) / (60.0 * 60.0 * 24.0)); - if ( id ) item->setText( Col_ID, QString().setNum( id ) ); - item->setText( Col_IDOrder, QString().setNum( order ) ); - item->setText( Col_Subject, threadName ); - item->setText( Col_ResNum, QString( "%1" ).arg( resNum, 4 ) ); - item->setText( Col_ReadNum, ( viewPos > 0 ) ? QString( "%1" ).arg( viewPos, 4 ) : QString( "" ) ); - item->setText( Col_Unread, ( viewPos > 0 && resNum > viewPos ) ? QString( "%1" ).arg( resNum - viewPos, 4 ) : QString( "" ) ); - item->setText( Col_Since, since.toString( "yy/MM/dd hh:mm" ) ); - item->setText( Col_DatURL, datURL.prettyUrl() ); - item->setText( Col_Speed, QString( " %1 " ).arg( speed, 0, 'f', 2 ) ); + if (id) item->setText(Col_ID, QString().setNum(id)); + item->setText(Col_IDOrder, QString().setNum(order)); + item->setText(Col_Subject, threadName); + item->setText(Col_ResNum, QString("%1").arg(resNum, 4)); + item->setText(Col_ReadNum, (viewPos > 0) ? QString("%1").arg(viewPos, 4) : QString("")); + item->setText(Col_Unread, (viewPos > 0 && resNum > viewPos) ? QString("%1").arg(resNum - viewPos, 4) : QString("")); + item->setText(Col_Since, since.toString("yy/MM/dd hh:mm")); + item->setText(Col_DatURL, datURL.prettyUrl()); + item->setText(Col_Speed, QString(" %1 ").arg(speed, 0, 'f', 2)); /* set mark order */ - if ( !id ) { /* old thread */ + if (!id) { /* old thread */ - item->setText( Col_MarkOrder, QString::number( Thread_Old ) ); - } else if ( readNum > 0 && ( resNum > readNum || resNum > viewPos ) ) { /* There are new responses. */ + item->setText(Col_MarkOrder, QString::number(Thread_Old)); + } else if (readNum > 0 && (resNum > readNum || resNum > viewPos)) { /* There are new responses. */ - item->setPixmap( Col_Mark, SmallIcon( "unread" ) ); + item->setPixmap(Col_Mark, SmallIcon("unread")); m_unreadNum++; - item->setText( Col_MarkOrder, QString::number( Thread_HasUnread ) ); + item->setText(Col_MarkOrder, QString::number(Thread_HasUnread)); - } else if ( readNum > 0 ) { /* Cache exists */ + } else if (readNum > 0) { /* Cache exists */ - item->setPixmap( Col_Mark, SmallIcon( "read" ) ); + item->setPixmap(Col_Mark, SmallIcon("read")); m_readNum++; - item->setText( Col_MarkOrder, QString::number( ( viewPos > 1000 ) ? Thread_Readed : Thread_Read ) ); + item->setText(Col_MarkOrder, QString::number((viewPos > 1000) ? Thread_Readed : Thread_Read)); - } else if ( since.secsTo( current ) < 3600 * Kita::Config::markTime() ) { /* new thread */ + } else if (since.secsTo(current) < 3600 * Kita::Config::markTime()) { /* new thread */ - item->setPixmap( Col_Mark, SmallIcon( "newthread" ) ); + item->setPixmap(Col_Mark, SmallIcon("newthread")); m_newNum++; - item->setText( Col_MarkOrder, QString::number( Thread_New ) ); + item->setText(Col_MarkOrder, QString::number(Thread_New)); } else { /* normal */ - item->setText( Col_MarkOrder, QString::number( Thread_Normal ) ); - item->setPixmap( Col_Mark, 0 ); + item->setText(Col_MarkOrder, QString::number(Thread_Normal)); + item->setPixmap(Col_Mark, 0); } // no effect: m_unreadNum, m_readNum, m_newNum, markOrder - if ( Kita::DatManager::isMainThreadOpened( datURL ) && resNum == readNum ) { /* opened */ - item->setPixmap( Col_Mark, SmallIcon( "open" ) ); + if (Kita::DatManager::isMainThreadOpened(datURL) && resNum == readNum) { /* opened */ + item->setPixmap(Col_Mark, SmallIcon("open")); } } -void KitaBoardView::slotContextMenuRequested( Q3ListViewItem* item, const QPoint& point, int ) +void KitaBoardView::slotContextMenuRequested(Q3ListViewItem* item, const QPoint& point, int) { - if ( item == 0 ) { + if (item == 0) { return ; } - QString datURL = item->text( Col_DatURL ); - QString threadURL = Kita::DatManager::threadURL( datURL ); - bool isFavorites = FavoriteThreads::getInstance() ->contains( datURL ); + QString datURL = item->text(Col_DatURL); + QString threadURL = Kita::DatManager::threadURL(datURL); + bool isFavorites = FavoriteThreads::getInstance() ->contains(datURL); // create popup menu. - KMenu popup( 0 ); + KMenu popup(0); - KAction* openWithBrowserAct = new KAction( i18n( "Open with Web Browser" ) , this); - popup.addAction( openWithBrowserAct ); + KAction* openWithBrowserAct = new KAction(i18n("Open with Web Browser") , this); + popup.addAction(openWithBrowserAct); - KAction* copyURLAct = new KAction( i18n( "Copy URL" ), this ); - popup.addAction( copyURLAct ); + KAction* copyURLAct = new KAction(i18n("Copy URL"), this); + popup.addAction(copyURLAct); - KAction* copyTitleAndURLAct = new KAction( i18n( "Copy title and URL" ), this ); - popup.addAction( copyTitleAndURLAct ); + KAction* copyTitleAndURLAct = new KAction(i18n("Copy title and URL"), this); + popup.addAction(copyTitleAndURLAct); KAction* favoritesAct; - if ( isFavorites ) { - favoritesAct = new KAction( i18n( "Remove from Favorites" ), this ); + if (isFavorites) { + favoritesAct = new KAction(i18n("Remove from Favorites"), this); } else { - favoritesAct = new KAction( i18n( "Add to Favorites" ), this ); + favoritesAct = new KAction(i18n("Add to Favorites"), this); } - popup.addAction( favoritesAct ); + popup.addAction(favoritesAct); KAction* deleteLogAct = 0; - if ( Kita::DatManager::getReadNum( datURL ) ) { + if (Kita::DatManager::getReadNum(datURL)) { popup.addSeparator(); - deleteLogAct = new KAction( i18n( "Delete Log" ), this ); - popup.addAction( deleteLogAct ); + deleteLogAct = new KAction(i18n("Delete Log"), this); + popup.addAction(deleteLogAct); } popup.addSeparator(); - KAction* propertyAct = new KAction( i18n( "Property" ), this ); - popup.addAction( propertyAct ); + KAction* propertyAct = new KAction(i18n("Property"), this); + popup.addAction(propertyAct); // exec popup menu. QClipboard* clipboard = QApplication::clipboard(); QString cliptxt; - QAction* action = popup.exec( QCursor::pos() ); - if ( !action ) { + QAction* action = popup.exec(QCursor::pos()); + if (!action) { return; } - if ( action == openWithBrowserAct ) { - KRun::runUrl( threadURL, "text/html", this ); - } else if ( action == copyURLAct ) { - clipboard->setText( threadURL, QClipboard::Clipboard ); - clipboard->setText( threadURL, QClipboard::Selection ); - } else if ( action == copyTitleAndURLAct ) { - cliptxt = Kita::DatManager::threadName( datURL ) + '\n' + threadURL; - clipboard->setText( cliptxt , QClipboard::Clipboard ); - clipboard->setText( cliptxt , QClipboard::Selection ); - } else if ( action == favoritesAct ) { - ViewMediator::getInstance()->bookmark( datURL, !isFavorites ); - } else if ( action == deleteLogAct ) { - deleteLog( threadURL ); - } else if ( action == propertyAct ) { + if (action == openWithBrowserAct) { + KRun::runUrl(threadURL, "text/html", this); + } else if (action == copyURLAct) { + clipboard->setText(threadURL, QClipboard::Clipboard); + clipboard->setText(threadURL, QClipboard::Selection); + } else if (action == copyTitleAndURLAct) { + cliptxt = Kita::DatManager::threadName(datURL) + '\n' + threadURL; + clipboard->setText(cliptxt , QClipboard::Clipboard); + clipboard->setText(cliptxt , QClipboard::Selection); + } else if (action == favoritesAct) { + ViewMediator::getInstance()->bookmark(datURL, !isFavorites); + } else if (action == deleteLogAct) { + deleteLog(threadURL); + } else if (action == propertyAct) { // FIXME: memory leak Kita::Ui::ThreadProperty* propertyWidget = new Kita::Ui::ThreadProperty; - propertyWidget->threadURLLabel->setText( threadURL ); - propertyWidget->datURLLabel->setText( datURL ); + propertyWidget->threadURLLabel->setText(threadURL); + propertyWidget->datURLLabel->setText(datURL); - propertyWidget->threadNameLabel->setText( Kita::DatManager::threadName( datURL ) ); - propertyWidget->cachePathLabel->setText( Kita::DatManager::getCachePath( datURL ) ); - propertyWidget->indexPathLabel->setText( Kita::DatManager::getCacheIndexPath( datURL ) ); - propertyWidget->resNumLabel->setText( QString( "%1" ).arg( Kita::DatManager::getResNum( datURL ) ) ); - propertyWidget->readNumLabel->setText( QString( "%1" ).arg( Kita::DatManager::getReadNum( datURL ) ) ); - propertyWidget->viewPosLabel->setText( QString( "%1" ).arg( Kita::DatManager::getViewPos( datURL ) ) ); + propertyWidget->threadNameLabel->setText(Kita::DatManager::threadName(datURL)); + propertyWidget->cachePathLabel->setText(Kita::DatManager::getCachePath(datURL)); + propertyWidget->indexPathLabel->setText(Kita::DatManager::getCacheIndexPath(datURL)); + propertyWidget->resNumLabel->setText(QString("%1").arg(Kita::DatManager::getResNum(datURL))); + propertyWidget->readNumLabel->setText(QString("%1").arg(Kita::DatManager::getReadNum(datURL))); + propertyWidget->viewPosLabel->setText(QString("%1").arg(Kita::DatManager::getViewPos(datURL))); - propertyWidget->idx_threadNameWithIndexLabel->setText( Kita::ThreadIndex::getSubject( datURL ) ); - propertyWidget->idx_resNumLabel->setText( QString( "%1" ).arg( Kita::ThreadIndex::getResNum( datURL ) ) ); - propertyWidget->idx_readNumLabel->setText( QString( "%1" ).arg( Kita::ThreadIndex::getReadNum( datURL ) ) ); - propertyWidget->idx_viewPosLabel->setText( QString( "%1" ).arg( Kita::ThreadIndex::getViewPos( datURL ) ) ); + propertyWidget->idx_threadNameWithIndexLabel->setText(Kita::ThreadIndex::getSubject(datURL)); + propertyWidget->idx_resNumLabel->setText(QString("%1").arg(Kita::ThreadIndex::getResNum(datURL))); + propertyWidget->idx_readNumLabel->setText(QString("%1").arg(Kita::ThreadIndex::getReadNum(datURL))); + propertyWidget->idx_viewPosLabel->setText(QString("%1").arg(Kita::ThreadIndex::getViewPos(datURL))); - propertyWidget->cache_readNumLabel->setText( QString( "%1" ).arg( KitaThreadInfo::readNum( datURL ) ) ); + propertyWidget->cache_readNumLabel->setText(QString("%1").arg(KitaThreadInfo::readNum(datURL))); } } -void KitaBoardView::deleteLog( const KUrl& url ) +void KitaBoardView::deleteLog(const KUrl& url) { - if ( QMessageBox::warning( this, + if (QMessageBox::warning(this, "Kita", - i18n( "Do you want to delete Log ?" ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - == QMessageBox::Ok ) { - if ( Kita::DatManager::deleteCache( url ) ) { - ViewMediator::getInstance()->closeThreadTab( url ); - slotUpdateSubject( url ); + i18n("Do you want to delete Log ?"), + QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default) + == QMessageBox::Ok) { + if (Kita::DatManager::deleteCache(url)) { + ViewMediator::getInstance()->closeThreadTab(url); + slotUpdateSubject(url); } } } -void KitaBoardView::slotSizeChange( int section, int oldSize, int newSize ) +void KitaBoardView::slotSizeChange(int section, int oldSize, int newSize) { - if ( ! m_enableSizeChange ) return ; - if ( autoResize() ) return ; + if (! m_enableSizeChange) return ; + if (autoResize()) return ; - QString configPath = KStandardDirs::locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); - subjectList->saveLayout( &config, "Layout" ); + QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + KConfig config(configPath); + subjectList->saveLayout(&config, "Layout"); } void KitaBoardView::loadLayout() { - if ( autoResize() ) return ; - QString configPath = KStandardDirs::locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); - subjectList->restoreLayout( &config, "Layout" ); + if (autoResize()) return ; + QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + KConfig config(configPath); + subjectList->restoreLayout(&config, "Layout"); } -bool KitaBoardView::eventFilter( QObject* watched, QEvent* e ) +bool KitaBoardView::eventFilter(QObject* watched, QEvent* e) { - if ( e->type() == QEvent::MouseButtonPress ) { - QMouseEvent * mouseEvent = static_cast<QMouseEvent *>( e ); - if ( mouseEvent->button() == Qt::RightButton ) { + if (e->type() == QEvent::MouseButtonPress) { + QMouseEvent * mouseEvent = static_cast<QMouseEvent *>(e); + if (mouseEvent->button() == Qt::RightButton) { KMenu popup; - for ( int i = Col_Begin; i <= Col_End; i++ ) { - if ( i != Col_Subject && i != Col_MarkOrder && i != Col_IDOrder ) { - KAction* action = new KAction( s_colAttr[ i ].itemName, this ); - action->setCheckable( true ); - action->setChecked( subjectList->columnWidth( i ) != 0 ); - action->setData( QVariant( i ) ); - popup.addAction( action ); + for (int i = Col_Begin; i <= Col_End; i++) { + if (i != Col_Subject && i != Col_MarkOrder && i != Col_IDOrder) { + KAction* action = new KAction(s_colAttr[ i ].itemName, this); + action->setCheckable(true); + action->setChecked(subjectList->columnWidth(i) != 0); + action->setData(QVariant(i)); + popup.addAction(action); } } - KAction* autoResizeAct = new KAction( i18n( "Auto Resize" ), this ); - autoResizeAct->setCheckable( true ); - autoResizeAct->setChecked( autoResize() ); - popup.addAction( autoResizeAct ); + KAction* autoResizeAct = new KAction(i18n("Auto Resize"), this); + autoResizeAct->setCheckable(true); + autoResizeAct->setChecked(autoResize()); + popup.addAction(autoResizeAct); - QAction* action = popup.exec( mouseEvent->globalPos() ); - if ( !action ) { + QAction* action = popup.exec(mouseEvent->globalPos()); + if (!action) { return true; } - if ( action == autoResizeAct ) { - setAutoResize( !action->isChecked() ); - } else if ( action->isChecked() ) { - hideColumn( action->data().toInt() ); + if (action == autoResizeAct) { + setAutoResize(!action->isChecked()); + } else if (action->isChecked()) { + hideColumn(action->data().toInt()); } else { - showColumn( action->data().toInt() ); + showColumn(action->data().toInt()); } saveHeaderOnOff(); return true; @@ -473,54 +473,54 @@ return false; } } else { - return subjectList->header() ->eventFilter( watched, e ); + return subjectList->header() ->eventFilter(watched, e); } } void KitaBoardView::saveHeaderOnOff() { - QString configPath = KStandardDirs::locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); + QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + KConfig config(configPath); - KConfigGroup group = config.group( "Column" ); - for ( int i = Col_Begin; i <= Col_End; i++ ) { - if ( subjectList->columnWidth( i ) != 0 ) { - group.writeEntry( s_colAttr[ i ].keyName, true ); + KConfigGroup group = config.group("Column"); + for (int i = Col_Begin; i <= Col_End; i++) { + if (subjectList->columnWidth(i) != 0) { + group.writeEntry(s_colAttr[ i ].keyName, true); } else { - group.writeEntry( s_colAttr[ i ].keyName, false ); + group.writeEntry(s_colAttr[ i ].keyName, false); } } } void KitaBoardView::loadHeaderOnOff() { - QString configPath = KStandardDirs::locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); + QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + KConfig config(configPath); - KConfigGroup group = config.group( "Column" ); - for ( int i = Col_Begin; i <= Col_End; i++ ) { - bool isShown = group.readEntry( s_colAttr[ i ].keyName, s_colAttr[ i ].showDefault ); -// qDebug("%s: isShown %d", s_colAttr[i].keyName.latin1(), isShown ); - if ( isShown ) { - showColumn( i ); + KConfigGroup group = config.group("Column"); + for (int i = Col_Begin; i <= Col_End; i++) { + bool isShown = group.readEntry(s_colAttr[ i ].keyName, s_colAttr[ i ].showDefault); +// qDebug("%s: isShown %d", s_colAttr[i].keyName.latin1(), isShown); + if (isShown) { + showColumn(i); } else { - hideColumn( i ); + hideColumn(i); } } } bool KitaBoardView::autoResize() { - QString configPath = KStandardDirs::locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); + QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + KConfig config(configPath); - return config.group( "Column" ).readEntry( "AutoResize", true ); + return config.group("Column").readEntry("AutoResize", true); } -void KitaBoardView::setAutoResize( bool flag ) +void KitaBoardView::setAutoResize(bool flag) { - QString configPath = KStandardDirs::locateLocal( "appdata", "subjectview.conf" ); - KConfig config( configPath ); + QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + KConfig config(configPath); - config.group( "Column" ).writeEntry( "AutoResize", flag ); + config.group("Column").writeEntry("AutoResize", flag); } Modified: kita/branches/KITA-KDE4/kita/src/boardview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/boardview.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/boardview.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -30,7 +30,7 @@ KitaBoardTabWidget* m_parent; public: - KitaBoardView( KitaBoardTabWidget* parent ); + KitaBoardView(KitaBoardTabWidget* parent); ~KitaBoardView(); void init(); const KUrl boardURL(); @@ -40,9 +40,9 @@ 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 loadBoard(const KUrl& url, bool online = true); + void setFont(const QFont& font); + void slotUpdateSubject(const KUrl& url); private: KUrl m_boardURL; @@ -51,25 +51,25 @@ bool m_enableSizeChange; void UpdateKindLabel(); - void deleteLog( const KUrl& url ); + void deleteLog(const KUrl& url); void loadLayout(); - void updateListViewItem( Q3ListViewItem* item, const KUrl& datURL, const QDateTime& current, int id, int order ); - bool eventFilter( QObject* watched, QEvent* e ); + void updateListViewItem(Q3ListViewItem* 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 ); + void setAutoResize(bool flag); KitaBoardView(const KitaBoardView&); KitaBoardView& operator=(const KitaBoardView&); private slots: - void loadThread( Q3ListViewItem* item ); - void slotContextMenuRequested( Q3ListViewItem*, const QPoint&, int ); + void loadThread(Q3ListViewItem* item); + void slotContextMenuRequested(Q3ListViewItem*, const QPoint&, int); void slotCloseButton(); - void slotSizeChange( int section, int oldSize, int newSize ); + void slotSizeChange(int section, int oldSize, int newSize); signals: - void loadBoardCompleted( const KUrl& ); + void loadBoardCompleted(const KUrl&); }; #endif Modified: kita/branches/KITA-KDE4/kita/src/domtree.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/domtree.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/domtree.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -20,7 +20,7 @@ #include "libkita/kita_misc.h" #include "libkita/kita-utf8.h" -KitaDomTree::KitaDomTree( const DOM::HTMLDocument& hdoc, const KUrl& datURL ) +KitaDomTree::KitaDomTree(const DOM::HTMLDocument& hdoc, const KUrl& datURL) { m_hdoc = hdoc; m_bufSize = 0; @@ -33,7 +33,7 @@ /* get pointer of DatInfo */ /* Note that m_datURL is already locked in the KitaHTMLPart. */ - m_datInfo = Kita::DatManager::getDatInfoPointer( datURL ); + m_datInfo = Kita::DatManager::getDatInfoPointer(datURL); } KitaDomTree::~KitaDomTree() {} @@ -42,44 +42,44 @@ * This function creates DOM elements of both title and body. * To show the res, call appendRes() */ -bool KitaDomTree::createResElement( int num ) +bool KitaDomTree::createResElement(int num) { - Q_ASSERT( num > 0 ); - Q_ASSERT( m_datInfo != 0 ); + 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 ] != KITA_HTML_NOTPARSED) { /* already parsed */ return true; } - if ( num >= m_bufSize ) { + if (num >= m_bufSize) { /* resize buffer size */ - if ( m_bufSize == 0 ) m_bufSize = 100; - while ( num >= m_bufSize ) m_bufSize += 500; + if (m_bufSize == 0) m_bufSize = 100; + while (num >= m_bufSize) m_bufSize += 500; - m_titleElm.resize( m_bufSize ); - m_bodyElm.resize( m_bufSize ); - m_resStatus.resize( m_bufSize, false ); - m_coloredNum.resize( m_bufSize, false ); + m_titleElm.resize(m_bufSize); + m_bodyElm.resize(m_bufSize); + m_resStatus.resize(m_bufSize, false); + m_coloredNum.resize(m_bufSize, false); } /* cleate elements */ QString titleHTML, bodyHTML; - m_resStatus[ num ] = m_datInfo->getHTML( num, true, titleHTML, bodyHTML ); + m_resStatus[ num ] = m_datInfo->getHTML(num, true, titleHTML, bodyHTML); - if ( m_resStatus[ num ] == KITA_HTML_NOTPARSED ) { + if (m_resStatus[ num ] == KITA_HTML_NOTPARSED) { return false; } - m_titleElm[ num ] = m_hdoc.createElement( "DIV" ); - m_titleElm[ num ].setAttribute( "class", "res_title" ); - m_titleElm[ num ].setAttribute( "id", QString().setNum( num ) ); - m_titleElm[ num ].setInnerHTML( titleHTML ); + m_titleElm[ num ] = m_hdoc.createElement("DIV"); + m_titleElm[ num ].setAttribute("class", "res_title"); + m_titleElm[ num ].setAttribute("id", QString().setNum(num)); + m_titleElm[ num ].setInnerHTML(titleHTML); - m_bodyElm[ num ] = m_hdoc.createElement( "DIV" ); - m_bodyElm[ num ].setAttribute( "class", "res_body" ); - m_bodyElm[ num ].setAttribute( "id", QString().setNum( num ) ); - m_bodyElm[ num ].setInnerHTML( bodyHTML ); + m_bodyElm[ num ] = m_hdoc.createElement("DIV"); + m_bodyElm[ num ].setAttribute("class", "res_body"); + m_bodyElm[ num ].setAttribute("id", QString().setNum(num)); + m_bodyElm[ num ].setInnerHTML(bodyHTML); return true; } @@ -87,14 +87,14 @@ /* * append the response */ -bool KitaDomTree::appendRes( int num ) +bool KitaDomTree::appendRes(int num) { - if ( !createResElement( num ) ) return false; + if (!createResElement(num)) return false; - m_hdoc.body().appendChild( m_titleElm[ num ] ); - m_hdoc.body().appendChild( m_bodyElm[ num ] ); + m_hdoc.body().appendChild(m_titleElm[ num ]); + m_hdoc.body().appendChild(m_bodyElm[ num ]); - if ( num > m_bottomNum ) m_bottomNum = num; + if (num > m_bottomNum) m_bottomNum = num; return true; } @@ -102,24 +102,24 @@ /* * redraw all */ -void KitaDomTree::redraw( bool force ) +void KitaDomTree::redraw(bool force) { - Q_ASSERT( m_datInfo != 0 ); + Q_ASSERT(m_datInfo != 0); int readNum = m_datInfo->getReadNum(); /* don't forget to reset abone here... */ m_datInfo->resetAbone(); - for ( int i = 1; i <= readNum; i++ ) { + for (int i = 1; i <= readNum; i++) { QString titleHTML, bodyHTML; int oldStatus = m_resStatus[ i ]; - m_resStatus[ i ] = m_datInfo->getHTML( i , true, titleHTML, bodyHTML ); + m_resStatus[ i ] = m_datInfo->getHTML(i , true, titleHTML, bodyHTML); - if ( force || oldStatus != m_resStatus[ i ] ) { - m_titleElm[ i ].setInnerHTML( titleHTML ); - m_bodyElm[ i ].setInnerHTML( bodyHTML ); + if (force || oldStatus != m_resStatus[ i ]) { + m_titleElm[ i ].setInnerHTML(titleHTML); + m_bodyElm[ i ].setInnerHTML(bodyHTML); } } } @@ -134,9 +134,9 @@ */ void KitaDomTree::changeColorOfAllResponsedNumber() { - for ( int i = 1; i <= m_bottomNum; ++i ) { - if ( m_datInfo->isResponsed( i ) ) { - changeColorOfNumber( i ); + for (int i = 1; i <= m_bottomNum; ++i) { + if (m_datInfo->isResponsed(i)) { + changeColorOfNumber(i); } } } @@ -151,16 +151,16 @@ */ void KitaDomTree::appendFooterAndHeader() { - Q_ASSERT( m_datInfo != 0 ); + Q_ASSERT(m_datInfo != 0); int readNum = m_datInfo->getReadNum(); - if ( !readNum ) return ; + if (!readNum) return ; - updateHeader( m_header ); - updateFooter( m_footer ); + updateHeader(m_header); + updateFooter(m_footer); - m_hdoc.body().insertBefore( m_header, m_hdoc.body().firstChild() ); - m_hdoc.body().appendChild( m_footer ); + m_hdoc.body().insertBefore(m_header, m_hdoc.body().firstChild()); + m_hdoc.body().appendChild(m_footer); } /* @@ -168,18 +168,18 @@ */ void KitaDomTree::appendKokoyon() { - Q_ASSERT( m_datInfo != 0 ); + Q_ASSERT(m_datInfo != 0); int readNum = m_datInfo->getReadNum(); - if ( !readNum ) return ; + if (!readNum) return ; int viewPos = m_datInfo->getViewPos(); - if ( viewPos == 0 ) return ; + if (viewPos == 0) return ; int i = viewPos + 1; - if ( i <= readNum ) m_hdoc.body().insertBefore( m_kokoyon, m_titleElm[ i ] ); - else m_hdoc.body().appendChild( m_kokoyon ); + if (i <= readNum) m_hdoc.body().insertBefore(m_kokoyon, m_titleElm[ i ]); + else m_hdoc.body().appendChild(m_kokoyon); } /* @@ -189,14 +189,14 @@ /* * append "A" Node to rootnode */ -void KitaDomTree::appendAnchorNode( DOM::Element rootnode, const QString& href, const QString& linkstr ) +void KitaDomTree::appendAnchorNode(DOM::Element rootnode, const QString& href, const QString& linkstr) { DOM::Element element; - element = rootnode.appendChild( m_hdoc.createElement( "A" ) ); + element = rootnode.appendChild(m_hdoc.createElement("A")); { - element.setAttribute( "href", href ); - element.appendChild( m_hdoc.createTextNode( linkstr ) ); + element.setAttribute("href", href); + element.appendChild(m_hdoc.createTextNode(linkstr)); } } @@ -208,42 +208,42 @@ * before: #KokomadeYonda 1- 101- 201- #ToSaigo<br><br> * after : #KokomadeYonda 1- 101- 201- 301- 401- #ToSaigo<br><br> */ -void KitaDomTree::updateHeader( DOM::Element& headerElement ) +void KitaDomTree::updateHeader(DOM::Element& headerElement) { - if ( ! m_datInfo ) return ; + if (! m_datInfo) return ; DOM::Element backupElement1, backupElement2, backupElement3; int readNum = m_datInfo->getReadNum(); /* remove <a href="#tosaigo"> and <BR> */ - backupElement1 = headerElement.removeChild( headerElement.lastChild() ); /* BR */ - backupElement2 = headerElement.removeChild( headerElement.lastChild() ); /* BR */ - backupElement3 = headerElement.removeChild( headerElement.lastChild() ); /* "#tosaigo" */ + backupElement1 = headerElement.removeChild(headerElement.lastChild()); /* BR */ + backupElement2 = headerElement.removeChild(headerElement.lastChild()); /* BR */ + backupElement3 = headerElement.removeChild(headerElement.lastChild()); /* "#tosaigo" */ DOM::Node node = headerElement.firstChild(); /* node is now "#kokomade_yonda" */ node = node.nextSibling(); /* " " */ node = node.nextSibling(); /* '1-', '101-' などのリンクを作成 */ - for ( int num = 1; num < readNum ; num += 100 ) { - if ( node == 0 ) { - QString href = QString( "#%1" ).arg( num ); - QString linkStr = QString( "%1-" ).arg( num ); + for (int num = 1; num < readNum ; num += 100) { + if (node == 0) { + QString href = QString("#%1").arg(num); + QString linkStr = QString("%1-").arg(num); - appendAnchorNode( headerElement, href, linkStr ); - node = headerElement.appendChild( m_hdoc.createTextNode( " " ) ); + appendAnchorNode(headerElement, href, linkStr); + node = headerElement.appendChild(m_hdoc.createTextNode(" ")); node = node.nextSibling(); } else { // 既にリンクが作られている場合は飛ばす node = node.nextSibling(); - if ( node != 0 ) node = node.nextSibling(); + if (node != 0) node = node.nextSibling(); } } /* restore <a href="#tosaigo"> and <BR> */ - headerElement.appendChild( backupElement3 ); /* "#tosaigo" */ - headerElement.appendChild( backupElement2 ); /* BR */ - headerElement.appendChild( backupElement1 ); /* BR */ + headerElement.appendChild(backupElement3); /* "#tosaigo" */ + headerElement.appendChild(backupElement2); /* BR */ + headerElement.appendChild(backupElement1); /* BR */ } /* @@ -253,36 +253,36 @@ * before: #KokomadeYonda 1- 101- 201- #ToSaigo * after : #KokomadeYonda 1- 101- 201- 301- 401- #ToSaigo */ -void KitaDomTree::updateFooter( DOM::Element& footerElement ) +void KitaDomTree::updateFooter(DOM::Element& footerElement) { - Q_ASSERT( m_datInfo != 0 ); + Q_ASSERT(m_datInfo != 0); DOM::Element backupElement; int readNum = m_datInfo->getReadNum(); - backupElement = footerElement.removeChild( footerElement.lastChild() ); /* "#tosaigo" */ + backupElement = footerElement.removeChild(footerElement.lastChild()); /* "#tosaigo" */ DOM::Node node = footerElement.firstChild(); /* node is now "#kokomade_yonda" */ node = node.nextSibling(); /* " " */ node = node.nextSibling(); /* '1-', '101-' などのリンクを作成 */ - for ( int num = 1; num < readNum ; num += 100 ) { - if ( node == 0 ) { - QString href = QString( "#%1" ).arg( num ); - QString linkStr = QString( "%1-" ).arg( num ); + for (int num = 1; num < readNum ; num += 100) { + if (node == 0) { + QString href = QString("#%1").arg(num); + QString linkStr = QString("%1-").arg(num); - appendAnchorNode( footerElement, href, linkStr ); - node = footerElement.appendChild( m_hdoc.createTextNode( " " ) ); + appendAnchorNode(footerElement, href, linkStr); + node = footerElement.appendChild(m_hdoc.createTextNode(" ")); node = node.nextSibling(); } else { // 既にリンクが作られている場合は飛ばす node = node.nextSibling(); - if ( node != 0 ) node = node.nextSibling(); + if (node != 0) node = node.nextSibling(); } } - footerElement.appendChild( backupElement ); /* "#tosaigo" */ + footerElement.appendChild(backupElement); /* "#tosaigo" */ } /* @@ -293,20 +293,20 @@ QString str; DOM::Element rootnode; - rootnode = m_hdoc.createElement( "DIV" ); + rootnode = m_hdoc.createElement("DIV"); { - rootnode.setAttribute( "kita_type", "header" ); - rootnode.setAttribute( "id", "header" ); + rootnode.setAttribute("kita_type", "header"); + rootnode.setAttribute("id", "header"); - str = Kita::utf8ToUnicode( KITAUTF8_KOKOYON ); - appendAnchorNode( rootnode, "#kokomade_yonda", str ); - rootnode.appendChild( m_hdoc.createTextNode( " " ) ); + str = Kita::utf8ToUnicode(KITAUTF8_KOKOYON); + appendAnchorNode(rootnode, "#kokomade_yonda", str); + rootnode.appendChild(m_hdoc.createTextNode(" ")); - str = Kita::utf8ToUnicode( KITAUTF8_SAIGO ); - appendAnchorNode( rootnode, "#tosaigo", str ); + str = Kita::utf8ToUnicode(KITAUTF8_SAIGO); + appendAnchorNode(rootnode, "#tosaigo", str); - rootnode.appendChild( m_hdoc.createElement( "BR" ) ); - rootnode.appendChild( m_hdoc.createElement( "BR" ) ); + rootnode.appendChild(m_hdoc.createElement("BR")); + rootnode.appendChild(m_hdoc.createElement("BR")); } m_header = rootnode; @@ -321,17 +321,17 @@ QString str; DOM::Element rootnode; - rootnode = m_hdoc.createElement( "DIV" ); + rootnode = m_hdoc.createElement("DIV"); { - rootnode.setAttribute( "kita_type", "footer" ); - rootnode.setAttribute( "id", "footer" ); + rootnode.setAttribute("kita_type", "footer"); + rootnode.setAttribute("id", "footer"); - str = Kita::utf8ToUnicode( KITAUTF8_KOKOYON ); - appendAnchorNode( rootnode, "#kokomade_yonda", str ); - rootnode.appendChild( m_hdoc.createTextNode( " " ) ); + str = Kita::utf8ToUnicode(KITAUTF8_KOKOYON); + appendAnchorNode(rootnode, "#kokomade_yonda", str); + rootnode.appendChild(m_hdoc.createTextNode(" ")); - str = Kita::utf8ToUnicode( KITAUTF8_SAIGO ); - appendAnchorNode( rootnode, "#tosaigo", str ); + str = Kita::utf8ToUnicode(KITAUTF8_SAIGO); + appendAnchorNode(rootnode, "#tosaigo", str); } m_footer = rootnode; @@ -345,14 +345,14 @@ QString str, style; DOM::Element rootnode; - str = Kita::utf8ToUnicode( KITAUTF8_KOKOYON2 ); + str = Kita::utf8ToUnicode(KITAUTF8_KOKOYON2); - rootnode = m_hdoc.createElement( "DIV" ); + rootnode = m_hdoc.createElement("DIV"); { - rootnode.setAttribute( "class", "kokoyon" ); - rootnode.setAttribute( "kita_type", "kokoyon" ); - rootnode.setAttribute( "id", "kokomade_yonda" ); - rootnode.appendChild( m_hdoc.createTextNode( str ) ); + rootnode.setAttribute("class", "kokoyon"); + rootnode.setAttribute("kita_type", "kokoyon"); + rootnode.setAttribute("id", "kokomade_yonda"); + rootnode.appendChild(m_hdoc.createTextNode(str)); } m_kokoyon = rootnode; @@ -362,14 +362,14 @@ * change color of number * specify color like this: "a.coloredLink:link{ color: red; }" */ -void KitaDomTree::changeColorOfNumber( int num ) +void KitaDomTree::changeColorOfNumber(int num) { - if ( m_coloredNum[ num ] ) return ; + if (m_coloredNum[ num ]) return ; m_coloredNum[ num ] = true; DOM::Node node = m_titleElm[ num ]; node = node.firstChild(); - static_cast<DOM::HTMLElement>( node ).setAttribute( "class", "coloredLink" ); + static_cast<DOM::HTMLElement>(node).setAttribute("class", "coloredLink"); } Modified: kita/branches/KITA-KDE4/kita/src/domtree.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/domtree.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/domtree.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -45,14 +45,14 @@ DOM::Element m_kokoyon; public: - KitaDomTree( const DOM::HTMLDocument& hdoc, const KUrl& datURL ); + KitaDomTree(const DOM::HTMLDocument& hdoc, const KUrl& datURL); ~KitaDomTree(); /* rendering functions */ - bool createResElement( int num ); - bool appendRes( int num ); - void redraw( bool force ); + bool createResElement(int num); + bool appendRes(int num); + void redraw(bool force); void changeColorOfAllResponsedNumber(); /* information */ @@ -65,13 +65,13 @@ void appendKokoyon(); private: - void appendAnchorNode( DOM::Element rootnode, const QString& linkstr, const QString& comment ); - void updateHeader( DOM::Element& targetelm ); - void updateFooter( DOM::Element& targetelm ); + void appendAnchorNode(DOM::Element rootnode, const QString& linkstr, const QString& comment); + void updateHeader(DOM::Element& targetelm); + void updateFooter(DOM::Element& targetelm); void createHeader(); void createFooter(); void createKokoyon(); - void changeColorOfNumber( int num ); + void changeColorOfNumber(int num); }; #endif Modified: kita/branches/KITA-KDE4/kita/src/favoritelistview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/favoritelistview.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/favoritelistview.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -32,19 +32,19 @@ /** * */ -FavoriteListView::FavoriteListView( QWidget* parent ) - : Kita::ThreadListView( parent ) +FavoriteListView::FavoriteListView(QWidget* parent) + : Kita::ThreadListView(parent) { KindLabel->hide(); - connect( subjectList, SIGNAL( returnPressed( Q3ListViewItem* ) ), - SLOT( loadThread( Q3ListViewItem* ) ) ); - connect( subjectList, SIGNAL( contextMenuRequested( Q3ListViewItem*, const QPoint&, int ) ), - SLOT( slotContextMenuRequested( Q3ListViewItem*, const QPoint&, int ) ) ); - connect( ReloadButton, SIGNAL( clicked() ), - SLOT( reload() ) ); + connect(subjectList, SIGNAL(returnPressed(Q3ListViewItem*)), + SLOT(loadThread(Q3ListViewItem*))); + connect(subjectList, SIGNAL(contextMenuRequested(Q3ListViewItem*, const QPoint&, int)), + SLOT(slotContextMenuRequested(Q3ListViewItem*, const QPoint&, int))); + connect(ReloadButton, SIGNAL(clicked()), + SLOT(reload())); - showColumn( Col_Board ); + showColumn(Col_Board); } /** @@ -66,45 +66,45 @@ subjectList->clear(); // insert item. - for ( int i = 0; FavoriteThreads::count() > i; i++ ) { - QString datURL = FavoriteThreads::getDatURL( i ); + for (int i = 0; FavoriteThreads::count() > i; i++) { + QString datURL = FavoriteThreads::getDatURL(i); QDateTime since; - since.setTime_t( Kita::datToSince( datURL ) ); + since.setTime_t(Kita::datToSince(datURL)); - int viewPos = Kita::DatManager::getViewPos( datURL ); - int resNum = Kita::DatManager::getResNum( datURL ); + int viewPos = Kita::DatManager::getViewPos(datURL); + int resNum = Kita::DatManager::getResNum(datURL); - K3ListViewItem* item = new K3ListViewItem( subjectList ); - item->setText( Col_Board, Kita::BoardManager::boardName( datURL ) ); - item->setText( Col_Subject, Kita::DatManager::threadName( datURL ) ); - item->setText( Col_ReadNum, QString( "%1" ).arg( viewPos, 4 ) ); - if ( resNum > 0 ) { - item->setText( Col_ResNum, QString( "%1" ).arg( resNum, 4 ) ); + K3ListViewItem* item = new K3ListViewItem(subjectList); + item->setText(Col_Board, Kita::BoardManager::boardName(datURL)); + item->setText(Col_Subject, Kita::DatManager::threadName(datURL)); + item->setText(Col_ReadNum, QString("%1").arg(viewPos, 4)); + if (resNum > 0) { + item->setText(Col_ResNum, QString("%1").arg(resNum, 4)); } - if ( resNum != 0 && resNum != viewPos ) { - item->setText( Col_Unread, QString( "%1" ).arg( resNum - viewPos, 4 ) ); + if (resNum != 0 && resNum != viewPos) { + item->setText(Col_Unread, QString("%1").arg(resNum - viewPos, 4)); } - item->setText( Col_Since, since.toString( "yy/MM/dd hh:mm" ) ); - item->setText( Col_DatURL, datURL ); + item->setText(Col_Since, since.toString("yy/MM/dd hh:mm")); + item->setText(Col_DatURL, datURL); } - subjectList->setSorting( Col_Board ); + subjectList->setSorting(Col_Board); } /** * */ -void FavoriteListView::loadThread( Q3ListViewItem* item ) +void FavoriteListView::loadThread(Q3ListViewItem* item) { - if ( ! item ) return ; + if (! item) return ; - QString itemURL = item->text( Col_DatURL ); + QString itemURL = item->text(Col_DatURL); - for ( int i = 0; FavoriteThreads::count() > i; i++ ) { - QString datURL = FavoriteThreads::getDatURL( i ); + for (int i = 0; FavoriteThreads::count() > i; i++) { + QString datURL = FavoriteThreads::getDatURL(i); - if ( datURL == itemURL ) { - ViewMediator::getInstance()->openThread( datURL ); + if (datURL == itemURL) { + ViewMediator::getInstance()->openThread(datURL); } } } @@ -112,46 +112,46 @@ /** * show and exec popup menu. */ -void FavoriteListView::slotContextMenuRequested( Q3ListViewItem* item, const QPoint& point, int ) +void FavoriteListView::slotContextMenuRequested(Q3ListViewItem* item, const QPoint& point, int) { - if ( ! item ) { + if (! item) { return; } - KMenu popup( 0 ); + KMenu popup(0); - KAction* openWithBrowserAct = new KAction( i18n( "Open with Web Browser" ), this ); - popup.addAction( openWithBrowserAct ); + KAction* openWithBrowserAct = new KAction(i18n("Open with Web Browser"), this); + popup.addAction(openWithBrowserAct); - KAction* copyURLAct = new KAction( i18n( "Copy URL" ), this ); - popup.addAction( copyURLAct ); + KAction* copyURLAct = new KAction(i18n("Copy URL"), this); + popup.addAction(copyURLAct); - KAction* copyTitleAndURLAct = new KAction( i18n( "Copy title and URL" ), this ); - popup.addAction( copyTitleAndURLAct ); + KAction* copyTitleAndURLAct = new KAction(i18n("Copy title and URL"), this); + popup.addAction(copyTitleAndURLAct); - KAction* removeFromFavoritesAct = new KAction( i18n( "Remove from Favorites" ), this ); - popup.addAction( removeFromFavoritesAct ); + KAction* removeFromFavoritesAct = new KAction(i18n("Remove from Favorites"), this); + popup.addAction(removeFromFavoritesAct); - QString datURL = item->text( Col_DatURL ); - QString threadURL = Kita::DatManager::threadURL( datURL ); + QString datURL = item->text(Col_DatURL); + QString threadURL = Kita::DatManager::threadURL(datURL); QClipboard* clipboard = QApplication::clipboard(); QString clipText; - QAction* action = popup.exec( point ); - if ( !action ) { + QAction* action = popup.exec(point); + if (!action) { return; } - if ( action == openWithBrowserAct ) { - KRun::runUrl( Kita::DatManager::threadURL( datURL ), "text/html", this ); - } else if ( action == copyURLAct ) { - clipboard->setText( threadURL ); - } else if ( action == copyTitleAndURLAct ) { - clipText = Kita::DatManager::threadName( datURL ) + '\n' + threadURL; - clipboard->setText( clipText , QClipboard::Clipboard ); - clipboard->setText( clipText , QClipboard::Selection ); - } else if ( action == removeFromFavoritesAct ) { - ViewMediator::getInstance()->bookmark( datURL, false ); + if (action == openWithBrowserAct) { + KRun::runUrl(Kita::DatManager::threadURL(datURL), "text/html", this); + } else if (action == copyURLAct) { + clipboard->setText(threadURL); + } else if (action == copyTitleAndURLAct) { + clipText = Kita::DatManager::threadName(datURL) + '\n' + threadURL; + clipboard->setText(clipText , QClipboard::Clipboard); + clipboard->setText(clipText , QClipboard::Selection); + } else if (action == removeFromFavoritesAct) { + ViewMediator::getInstance()->bookmark(datURL, false); } } @@ -162,19 +162,19 @@ { Q3ValueList<QString> boardList; - for ( int i = 0; FavoriteThreads::count() > i; i++ ) { - QString datURL = FavoriteThreads::getDatURL( i ); - QString boardURL = Kita::BoardManager::boardURL( datURL ); - if ( boardList.contains( boardURL ) == 0 ) { - boardList.append( boardURL ); + for (int i = 0; FavoriteThreads::count() > i; i++) { + QString datURL = FavoriteThreads::getDatURL(i); + QString boardURL = Kita::BoardManager::boardURL(datURL); + if (boardList.contains(boardURL) == 0) { + boardList.append(boardURL); } } Q3ValueList<QString>::const_iterator it; - for ( it = boardList.begin(); it != boardList.end(); ++it ) { + for (it = boardList.begin(); it != boardList.end(); ++it) { bool online = true; Q3PtrList<Kita::Thread> threadList; Q3PtrList<Kita::Thread> tmpList; - Kita::BoardManager::getThreadList( ( *it ), false, online, threadList, tmpList ); + Kita::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-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/favoritelistview.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -23,14 +23,14 @@ Q_OBJECT public: - FavoriteListView( QWidget* parent = 0 ); + FavoriteListView(QWidget* parent = 0); ~FavoriteListView(); void refresh(); private slots: - void loadThread( Q3ListViewItem* item ); - void slotContextMenuRequested( Q3ListViewItem*, const QPoint&, int ); + void loadThread(Q3ListViewItem* item); + void slotContextMenuRequested(Q3ListViewItem*, const QPoint&, int); void reload(); }; Modified: kita/branches/KITA-KDE4/kita/src/htmlpart.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/htmlpart.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/htmlpart.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -43,8 +43,8 @@ /*-------------------------------------*/ /* Don't forget to call setup() later. */ -KitaHTMLPart::KitaHTMLPart( QWidget* parent ) - : KHTMLPart( new KitaHTMLView( this, parent ) ) +KitaHTMLPart::KitaHTMLPart(QWidget* parent) + : KHTMLPart(new KitaHTMLView(this, parent)) { m_mode = HTMLPART_MODE_MAINPART; m_popup = 0; @@ -74,10 +74,10 @@ m_domtree = 0; /* update ViewPos */ - if ( m_mode == HTMLPART_MODE_MAINPART && !m_updatedKokoyon && !m_datURL.isEmpty() ) { - int readNum = Kita::DatManager::getReadNum( m_datURL ); - if ( readNum ) { - Kita::DatManager::setViewPos( m_datURL, readNum ); + if (m_mode == HTMLPART_MODE_MAINPART && !m_updatedKokoyon && !m_datURL.isEmpty()) { + int readNum = Kita::DatManager::getReadNum(m_datURL); + if (readNum) { + Kita::DatManager::setViewPos(m_datURL, readNum); } } m_updatedKokoyon = false; @@ -88,16 +88,16 @@ m_jumpNumAfterLoading = 0; findTextInit(); - if ( !m_datURL.isEmpty() ) { /* This part is opened. */ + if (!m_datURL.isEmpty()) { /* This part is opened. */ - if ( m_mode == HTMLPART_MODE_MAINPART ) { /* This part is on the main thread view. */ + if (m_mode == HTMLPART_MODE_MAINPART) { /* This part is on the main thread view. */ /* tell Thread class that "thread is closed" */ - Kita::DatManager::setMainThreadOpened( m_datURL, false ); + Kita::DatManager::setMainThreadOpened(m_datURL, false); /* emit "deactivated all thread view" SIGNAL */ KUrl nullUrl(""); - ViewMediator::getInstance()->changeWriteTab( nullUrl ); + ViewMediator::getInstance()->changeWriteTab(nullUrl); /* update subject tab. */ } @@ -110,36 +110,36 @@ /* public */ -bool KitaHTMLPart::setup( int mode, const KUrl& url ) +bool KitaHTMLPart::setup(int mode, const KUrl& url) { - Q_ASSERT( !url.isEmpty() ); + Q_ASSERT(!url.isEmpty()); clearPart(); - m_datURL = Kita::getDatURL( url ); + m_datURL = Kita::getDatURL(url); m_mode = mode; - if ( m_mode == HTMLPART_MODE_MAINPART ) { /* This part is on the main thread view. */ + if (m_mode == HTMLPART_MODE_MAINPART) { /* This part is on the main thread view. */ /* create DatInfo explicitly to open new thread. */ /* Usually, DatInfo is NOT created if ReadNum == 0.*/ /* See also DatManager::createDatInfo() and */ /* DatManager::getDatInfo(). */ - Kita::DatManager::createDatInfo( m_datURL ); + Kita::DatManager::createDatInfo(m_datURL); /* tell Thread class that "thread is opened" */ - Kita::DatManager::setMainThreadOpened( m_datURL, true ); + Kita::DatManager::setMainThreadOpened(m_datURL, true); /* reset abone */ - Kita::DatManager::resetAbone( m_datURL ); + Kita::DatManager::resetAbone(m_datURL); } /* create HTML Document */ createHTMLDocument(); /* create DOM manager */ - if ( m_mode == HTMLPART_MODE_MAINPART ) { - m_domtree = new KitaDomTree( htmlDocument(), m_datURL ); + if (m_mode == HTMLPART_MODE_MAINPART) { + m_domtree = new KitaDomTree(htmlDocument(), m_datURL); } return true; @@ -150,11 +150,11 @@ void KitaHTMLPart::connectSignals() { /* popup */ - connect( this, SIGNAL( onURL( const QString& ) ), SLOT( slotOnURL( const QString& ) ) ); + connect(this, SIGNAL(onURL(const QString&)), SLOT(slotOnURL(const QString&))); - connect( view(), SIGNAL( leave() ), SLOT( slotLeave() ) ); - connect( view()->verticalScrollBar(), SIGNAL( sliderReleased() ), SLOT( slotVSliderReleased() ) ); - connect( view()->horizontalScrollBar(), SIGNAL( sliderReleased() ), SLOT( slotHSliderReleased() ) ); + connect(view(), SIGNAL(leave()), SLOT(slotLeave())); + connect(view()->verticalScrollBar(), SIGNAL(sliderReleased()), SLOT(slotVSliderReleased())); + connect(view()->horizontalScrollBar(), SIGNAL(sliderReleased()), SLOT(slotHSliderReleased())); } @@ -163,26 +163,26 @@ void KitaHTMLPart::createHTMLDocument() { /* style */ - QString style = QString( "body { font-size: %1pt; font-family: \"%2\"; color: %3; background-color: %4; }" ) - .arg( Kita::Config::threadFont().pointSize() ) - .arg( Kita::Config::threadFont().family() ) - .arg( Kita::Config::threadColor().name() ) - .arg( Kita::Config::threadBackground().name() ); + QString style = QString("body { font-size: %1pt; font-family: \"%2\"; color: %3; background-color: %4; }") + .arg(Kita::Config::threadFont().pointSize()) + .arg(Kita::Config::threadFont().family()) + .arg(Kita::Config::threadColor().name()) + .arg(Kita::Config::threadBackground().name()); QString text = "<html><head><style>"; text += DEFAULT_STYLESHEET; text += style; text += "</style></head><body></body></html>"; - setJScriptEnabled( false ); - setJavaEnabled( false ); + setJScriptEnabled(false); + setJavaEnabled(false); /* Use dummy URL here, and protocol should be "file:". If protocol is "http:", local image files are not shown (for security reasons ?). */ - begin( KUrl("file:/dummy.htm") ); - write( text ); + begin(KUrl("file:/dummy.htm")); + write(text); end(); } @@ -194,21 +194,21 @@ * show responses. * @warning don't forget to call updateScreen() later. */ -void KitaHTMLPart::showResponses( int startnum, int endnum ) +void KitaHTMLPart::showResponses(int startnum, int endnum) { - if ( !m_domtree ) return ; + if (!m_domtree) return ; - for ( int i = startnum ; i <= endnum; i++ ) m_domtree->appendRes( i ); + for (int i = startnum ; i <= endnum; i++) m_domtree->appendRes(i); } /* do parsing only. */ /* call showResponses() later */ /* public */ -void KitaHTMLPart::parseResponses( int startnum, int endnum ) +void KitaHTMLPart::parseResponses(int startnum, int endnum) { - if ( !m_domtree ) return ; + if (!m_domtree) return ; - for ( int i = startnum ; i <= endnum; i++ ) m_domtree->createResElement( i ); + for (int i = startnum ; i <= endnum; i++) m_domtree->createResElement(i); } @@ -220,17 +220,17 @@ /* So, you need not call it later. */ /* public slot */ void KitaHTMLPart::showAll() { - if ( !m_domtree ) return ; + if (!m_domtree) return ; int bottom = m_domtree->getBottomResNumber(); - int readNum = Kita::DatManager::getReadNum( m_datURL ); - if ( bottom != readNum ) { + int readNum = Kita::DatManager::getReadNum(m_datURL); + if (bottom != readNum) { - QCursor qc; qc.setShape( Qt::WaitCursor ); - QApplication::setOverrideCursor( qc ); + QCursor qc; qc.setShape(Qt::WaitCursor); + QApplication::setOverrideCursor(qc); - showResponses( 1, readNum ); - updateScreen( true, false ); + showResponses(1, readNum); + updateScreen(true, false); QApplication::restoreOverrideCursor(); } @@ -239,29 +239,29 @@ /* * update screen */ -void KitaHTMLPart::updateScreen( bool showHeaderEtc, bool clock ) +void KitaHTMLPart::updateScreen(bool showHeaderEtc, bool clock) { - if ( !m_domtree ) { + if (!m_domtree) { view()->setFocus(); return ; } /* show clock cursor */ - if ( clock ) { - QCursor qc; qc.setShape( Qt::WaitCursor ); - QApplication::setOverrideCursor( qc ); + if (clock) { + QCursor qc; qc.setShape(Qt::WaitCursor); + QApplication::setOverrideCursor(qc); } /* show header, footer, and kokomadeyonda, etc. */ - if ( showHeaderEtc ) { + if (showHeaderEtc) { m_domtree->appendKokoyon(); m_domtree->appendFooterAndHeader(); } /* change color of number of the res which is responsed. */ - if ( m_mode == HTMLPART_MODE_MAINPART ) { + if (m_mode == HTMLPART_MODE_MAINPART) { - if ( Kita::Config::checkResponsed() ) { + if (Kita::Config::checkResponsed()) { m_domtree->changeColorOfAllResponsedNumber(); } } @@ -269,32 +269,32 @@ /* update display */ htmlDocument().applyChanges(); view()->layout(); - view()->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); + view()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); view()->setFocus(); /* restore cursor */ - if ( clock ) { + if (clock) { QApplication::restoreOverrideCursor(); } } /* public */ -void KitaHTMLPart::setInnerHTML( const QString& innerHTML ) +void KitaHTMLPart::setInnerHTML(const QString& innerHTML) { createHTMLDocument(); - htmlDocument().body().setInnerHTML( innerHTML ); + htmlDocument().body().setInnerHTML(innerHTML); } /* redraw screen */ -void KitaHTMLPart::redrawHTMLPart( const KUrl& datURL, bool force ) +void KitaHTMLPart::redrawHTMLPart(const KUrl& datURL, bool force) { - if ( m_domtree == 0 ) return ; - if ( m_datURL != datURL ) return ; + if (m_domtree == 0) return ; + if (m_datURL != datURL) return ; - m_domtree->redraw( force ); + m_domtree->redraw(force); } /* public slot */ @@ -303,10 +303,10 @@ QFont font = Kita::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("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(), ""); htmlDocument().applyChanges(); } @@ -324,19 +324,19 @@ No.1 <- show -> No.20 <- not show -> No.(top) <- show -> No.(bottom) <- not show -> No.(readNum) */ -bool KitaHTMLPart::load( int centerNum ) +bool KitaHTMLPart::load(int centerNum) { m_centerNum = centerNum; m_jumpNumAfterLoading = 0; - if ( m_mode != HTMLPART_MODE_MAINPART ) return false; - if ( !m_domtree ) return false; - if ( Kita::DatManager::getReadNum( m_datURL ) == 0 ) return false; + if (m_mode != HTMLPART_MODE_MAINPART) return false; + if (!m_domtree) return false; + if (Kita::DatManager::getReadNum(m_datURL) == 0) return false; - int endNum = Kita::DatManager::getReadNum( m_datURL ); - showResponses( 1, endNum ); - updateScreen( true , false ); - gotoAnchor( QString().setNum( m_centerNum ), false ); + int endNum = Kita::DatManager::getReadNum(m_datURL); + showResponses(1, endNum); + updateScreen(true , false); + gotoAnchor(QString().setNum(m_centerNum), false); view() ->setFocus(); return true; @@ -349,21 +349,21 @@ /* see also slotReceiveData() and slotFinishLoad(). */ /* public */ -bool KitaHTMLPart::reload( int jumpNum ) +bool KitaHTMLPart::reload(int jumpNum) { - if ( !m_domtree ) return false; - if ( m_mode != HTMLPART_MODE_MAINPART ) { + if (!m_domtree) return false; + if (m_mode != HTMLPART_MODE_MAINPART) { /* If this is not MainPart, then open MainPart. */ - ViewMediator::getInstance()->openURL( m_datURL ); + ViewMediator::getInstance()->openURL(m_datURL); return false; } m_firstReceive = true; - if ( m_centerNum == 0 ) m_centerNum = m_domtree->getBottomResNumber(); + if (m_centerNum == 0) m_centerNum = m_domtree->getBottomResNumber(); m_jumpNumAfterLoading = jumpNum; /* DatManager will call back slotReceiveData and slotFinishLoad. */ - Kita::DatManager::updateCache( m_datURL , this ); + Kita::DatManager::updateCache(m_datURL , this); view() ->setFocus(); return true; @@ -378,23 +378,23 @@ { const int delta = 20; - if ( m_mode != HTMLPART_MODE_MAINPART ) return ; - if ( !m_domtree ) return ; + if (m_mode != HTMLPART_MODE_MAINPART) return ; + if (!m_domtree) return ; - int readNum = Kita::DatManager::getReadNum( m_datURL ); + int readNum = Kita::DatManager::getReadNum(m_datURL); int bottom = m_domtree->getBottomResNumber(); /* parsing */ - parseResponses( bottom + 1, readNum ); + parseResponses(bottom + 1, readNum); /* rendering */ - if ( m_firstReceive || bottom + delta < readNum ) { - showResponses( bottom + 1, readNum ); - updateScreen( true, false ); + if (m_firstReceive || bottom + delta < readNum) { + showResponses(bottom + 1, readNum); + updateScreen(true, false); } - if ( m_firstReceive && m_centerNum < readNum ) { - gotoAnchor( QString().setNum( m_centerNum ), false ); + if (m_firstReceive && m_centerNum < readNum) { + gotoAnchor(QString().setNum(m_centerNum), false); m_firstReceive = false; } @@ -408,18 +408,18 @@ and emits finishReload() */ /* !!! "public" slot !!! */ void KitaHTMLPart::slotFinishLoad() { - if ( m_mode != HTMLPART_MODE_MAINPART ) return ; - if ( !m_domtree ) return ; + if (m_mode != HTMLPART_MODE_MAINPART) return ; + if (!m_domtree) return ; int bottom = m_domtree->getBottomResNumber(); int shownNum = m_centerNum + 5000; - showResponses( bottom + 1, shownNum ); - updateScreen( true, false ); + showResponses(bottom + 1, shownNum); + updateScreen(true, false); // m_domtree->parseAllRes(); m_centerNum = 0; - if ( m_jumpNumAfterLoading ) gotoAnchor( QString().setNum( m_jumpNumAfterLoading ), false ); + if (m_jumpNumAfterLoading) gotoAnchor(QString().setNum(m_jumpNumAfterLoading), false); m_jumpNumAfterLoading = 0; emit finishReload(); @@ -434,33 +434,33 @@ /* public */ -bool KitaHTMLPart::gotoAnchor( const QString& anc, bool pushPosition ) +bool KitaHTMLPart::gotoAnchor(const QString& anc, bool pushPosition) { - if ( anc.isEmpty() ) return false; - if ( !m_domtree || m_mode == HTMLPART_MODE_POPUP ) - return KHTMLPart::gotoAnchor( anc ); + if (anc.isEmpty()) return false; + if (!m_domtree || m_mode == HTMLPART_MODE_POPUP) + return KHTMLPart::gotoAnchor(anc); hidePopup(); QString ancstr = anc; int res = ancstr.toInt(); - if ( res > 1 ) { + if (res > 1) { /* is target valid ? */ - if ( !Kita::DatManager::isResValid( m_datURL, res ) ) return false; + if (!Kita::DatManager::isResValid(m_datURL, res)) return false; - ancstr = QString().setNum( res ); + ancstr = QString().setNum(res); } - if ( res == 1 ) ancstr = "header"; - if ( pushPosition ) pushCurrentPosition(); + if (res == 1) ancstr = "header"; + if (pushPosition) pushCurrentPosition(); /* KHTMLPart::gotoAnchor() will fail if the thread is not shown. */ /* So KHTMLPart::gotoAnchor() should be called via custom event. */ /* See also KitaHTMLPart::customEvent() */ - GotoAnchorEvent * e = new GotoAnchorEvent( ancstr ); - QApplication::postEvent( this, e ); // Qt will delete it when done + GotoAnchorEvent * e = new GotoAnchorEvent(ancstr); + QApplication::postEvent(this, e); // Qt will delete it when done return true; } @@ -470,11 +470,11 @@ /* jump to kokomade yonda */ /* public slot */ void KitaHTMLPart::slotGotoKokoyon() { - if ( !m_domtree ) return ; - if ( m_mode != HTMLPART_MODE_MAINPART ) return ; + if (!m_domtree) return ; + if (m_mode != HTMLPART_MODE_MAINPART) return ; - int kokoyon = Kita::DatManager::getViewPos( m_datURL ); - gotoAnchor( QString().setNum( kokoyon ), false ); + int kokoyon = Kita::DatManager::getViewPos(m_datURL); + gotoAnchor(QString().setNum(kokoyon), false); } @@ -482,11 +482,11 @@ /* public slot */ void KitaHTMLPart::slotGobackAnchor() { - if ( m_anchorStack.empty() ) return ; + if (m_anchorStack.empty()) return ; QString anc = m_anchorStack.last(); m_anchorStack.pop_back(); - gotoAnchor( anc , false ); + gotoAnchor(anc , false); } @@ -504,29 +504,29 @@ { DOM::Node node; node = nodeUnderMouse(); - while ( node != 0 && node.nodeName().string() != "div" ) node = node.parentNode(); - if ( node == 0 ) return QString(); + while (node != 0 && node.nodeName().string() != "div") node = node.parentNode(); + if (node == 0) return QString(); - return static_cast<DOM::Element>( node ).getAttribute( "id" ).string(); + return static_cast<DOM::Element>(node).getAttribute("id").string(); } /* public slot */ void KitaHTMLPart::slotClickGotoFooter() { - if ( !m_domtree || m_mode != HTMLPART_MODE_MAINPART ) { - gotoAnchor( "footer", false ); + if (!m_domtree || m_mode != HTMLPART_MODE_MAINPART) { + gotoAnchor("footer", false); return ; } int bottom = m_domtree->getBottomResNumber(); - int readNum = Kita::DatManager::getReadNum( m_datURL ); + int readNum = Kita::DatManager::getReadNum(m_datURL); - if ( readNum != bottom ) { - showResponses( bottom + 1, readNum ); - updateScreen( true, true ); + if (readNum != bottom) { + showResponses(bottom + 1, readNum); + updateScreen(true, true); } - gotoAnchor( "footer", false ); + gotoAnchor("footer", false); } @@ -546,75 +546,75 @@ /* public */ -bool KitaHTMLPart::findText( const QString &query, bool reverse ) +bool KitaHTMLPart::findText(const QString &query, bool reverse) { - if ( m_mode != HTMLPART_MODE_MAINPART ) return false; + if (m_mode != HTMLPART_MODE_MAINPART) return false; - QRegExp regexp( query ); - regexp.setCaseSensitivity( Qt::CaseInsensitive ); + QRegExp regexp(query); + regexp.setCaseSensitivity(Qt::CaseInsensitive); /* init */ - if ( m_findNode.isNull() ) { + if (m_findNode.isNull()) { m_findNode = htmlDocument().body(); m_find_y = 0; /* move to the last child node */ - if ( reverse ) { - while ( !m_findNode.lastChild().isNull() ) m_findNode = m_findNode.lastChild(); + if (reverse) { + while (!m_findNode.lastChild().isNull()) m_findNode = m_findNode.lastChild(); m_find_y = view() ->contentsHeight(); } } - while ( 1 ) { + while (1) { - if ( m_findNode.nodeType() == DOM::Node::TEXT_NODE - || m_findNode.nodeType() == DOM::Node::CDATA_SECTION_NODE ) { + if (m_findNode.nodeType() == DOM::Node::TEXT_NODE + || m_findNode.nodeType() == DOM::Node::CDATA_SECTION_NODE) { /* find the word in the current node */ DOM::DOMString nodeText = m_findNode.nodeValue(); QString nodestr = nodeText.string(); - if ( reverse && m_findPos != -1 ) nodestr.resize( m_findPos ); + if (reverse && m_findPos != -1) nodestr.resize(m_findPos); - if ( reverse ) m_findPos = nodestr.lastIndexOf( regexp, m_findPos ); - else m_findPos = nodestr.indexOf( regexp, m_findPos + 1 ); + if (reverse) m_findPos = nodestr.lastIndexOf(regexp, m_findPos); + else m_findPos = nodestr.indexOf(regexp, m_findPos + 1); /* scroll & select & return */ - if ( m_findPos != -1 ) { + if (m_findPos != -1) { int matchLen = regexp.matchedLength(); QRect qr = m_findNode.getRect(); - view() ->setContentsPos( qr.left() - 50, m_find_y - 100 ); - DOM::Range rg( m_findNode, m_findPos, m_findNode, m_findPos + matchLen ); - setSelection( rg ); + view() ->setContentsPos(qr.left() - 50, m_find_y - 100); + DOM::Range rg(m_findNode, m_findPos, m_findNode, m_findPos + matchLen); + setSelection(rg); return true; } - } else if ( m_findNode.nodeName().string() == "table" ) { + } else if (m_findNode.nodeName().string() == "table") { QRect qr = m_findNode.getRect(); m_find_y = qr.bottom(); - } else if ( m_findNode.nodeName().string() == "div" ) { + } else if (m_findNode.nodeName().string() == "div") { QRect qr = m_findNode.getRect(); - if ( reverse ) { + if (reverse) { m_find_y = qr.bottom(); } else { m_find_y = qr.top(); } - } else if ( m_findNode.nodeName().string() == "br" ) { + } else if (m_findNode.nodeName().string() == "br") { DOM::Node tmpnode = m_findNode.previousSibling(); - if ( tmpnode != 0 ) { + if (tmpnode != 0) { QRect qr = tmpnode.getRect(); - if ( reverse ) m_find_y -= qr.bottom() - qr.top(); + if (reverse) m_find_y -= qr.bottom() - qr.top(); else m_find_y += qr.bottom() - qr.top(); } } @@ -625,14 +625,14 @@ DOM::Node next; /* move to the next node */ - if ( !reverse ) { + if (!reverse) { next = m_findNode.firstChild(); - if ( next.isNull() ) next = m_findNode.nextSibling(); + if (next.isNull()) next = m_findNode.nextSibling(); - while ( !m_findNode.isNull() && next.isNull() ) { + while (!m_findNode.isNull() && next.isNull()) { m_findNode = m_findNode.parentNode(); - if ( !m_findNode.isNull() ) { + if (!m_findNode.isNull()) { next = m_findNode.nextSibling(); } } @@ -641,18 +641,18 @@ else { next = m_findNode.lastChild(); - if ( next.isNull() ) next = m_findNode.previousSibling(); + if (next.isNull()) next = m_findNode.previousSibling(); - while ( !m_findNode.isNull() && next.isNull() ) { + while (!m_findNode.isNull() && next.isNull()) { m_findNode = m_findNode.parentNode(); - if ( !m_findNode.isNull() ) { + if (!m_findNode.isNull()) { next = m_findNode.previousSibling(); } } } m_findNode = next; - if ( m_findNode.isNull() ) { + if (m_findNode.isNull()) { m_findNode = 0; return false; } @@ -672,7 +672,7 @@ /* private */ -void KitaHTMLPart::showPopupMenu( const KUrl& kurl ) +void KitaHTMLPart::showPopupMenu(const KUrl& kurl) { QString url = kurl.prettyUrl(); bool showppm = false; @@ -680,12 +680,12 @@ QString str; /* If selected Text is composed of only digits, then show res popup. */ - if ( !m_pushctrl && showSelectedDigitPopup() ) return ; + if (!m_pushctrl && showSelectedDigitPopup()) return ; /*-----------------------------------*/ /* create menu items */ - KMenu popupMenu( view() ); + KMenu popupMenu(view()); KMenu* backSubMenu = 0; KMenu* markSubMenu = 0; @@ -694,143 +694,143 @@ KAction* homeLinkAct = 0; KAction* kokoLinkAct = 0; KAction* endLinkAct = 0; - if ( m_domtree && - ( m_mode == HTMLPART_MODE_MAINPART ) ) { + if (m_domtree && + (m_mode == HTMLPART_MODE_MAINPART)) { showppm = true; // back - if ( !m_anchorStack.empty() ) { - backSubMenu = new KMenu( view() ); + if (!m_anchorStack.empty()) { + backSubMenu = new KMenu(view()); int i = m_anchorStack.size(); QStringList::iterator it; - for ( it = m_anchorStack.begin(); it != m_anchorStack.end(); it++, i-- ) { - str = ( *it ) + " " + Kita::DatManager::getPlainBody( m_datURL, ( *it ).toInt() ).left( 10 ); - KAction* backLink = new KAction( str, this ); - backSubMenu->addAction( backLink ); + for (it = m_anchorStack.begin(); it != m_anchorStack.end(); it++, i--) { + str = (*it) + " " + Kita::DatManager::getPlainBody(m_datURL, (*it).toInt()).left(10); + KAction* backLink = new KAction(str, this); + backSubMenu->addAction(backLink); } - backSubMenu->setTitle( i18n( "Back" ) ); - popupMenu.addMenu( backSubMenu ); + backSubMenu->setTitle(i18n("Back")); + popupMenu.addMenu(backSubMenu); popupMenu.addSeparator(); } // mark - int readNum = Kita::DatManager::getReadNum( m_datURL ); - for ( int i = 1; i <= readNum ; i++ ) { - if ( Kita::DatManager::isMarked( m_datURL, i ) ) { - if ( !markSubMenu ) { - markSubMenu = new KMenu( view() ); - markSubMenu->setTitle( i18n( "Mark" ) ); - popupMenu.addMenu( markSubMenu ); + int readNum = Kita::DatManager::getReadNum(m_datURL); + for (int i = 1; i <= readNum ; i++) { + if (Kita::DatManager::isMarked(m_datURL, i)) { + if (!markSubMenu) { + markSubMenu = new KMenu(view()); + markSubMenu->setTitle(i18n("Mark")); + popupMenu.addMenu(markSubMenu); popupMenu.addSeparator(); } - str = QString().setNum( i ) + " " + Kita::DatManager::getPlainBody( m_datURL, i ).left( 10 ); - KAction *gotoMarkAct = new KAction( str, this ); - markSubMenu->addAction( gotoMarkAct ); + str = QString().setNum(i) + " " + Kita::DatManager::getPlainBody(m_datURL, i).left(10); + KAction *gotoMarkAct = new KAction(str, this); + markSubMenu->addAction(gotoMarkAct); } } // home - homeLinkAct = new KAction( i18n( "Start" ), this ); + homeLinkAct = new KAction(i18n("Start"), this); popupMenu.addAction(homeLinkAct); // template - if ( m_mode == HTMLPART_MODE_MAINPART ) { - int kokoyon = Kita::DatManager::getViewPos( m_datURL ); - if ( kokoyon ) { - str = i18n( "Kokomade Yonda (%1)" ).arg( kokoyon ); - kokoLinkAct = new KAction( str, this ); - popupMenu.addAction( kokoLinkAct ); + if (m_mode == HTMLPART_MODE_MAINPART) { + int kokoyon = Kita::DatManager::getViewPos(m_datURL); + if (kokoyon) { + str = i18n("Kokomade Yonda (%1)").arg(kokoyon); + kokoLinkAct = new KAction(str, this); + popupMenu.addAction(kokoLinkAct); } } // end - endLinkAct = new KAction( i18n( "End" ), this ); - popupMenu.addAction( endLinkAct ); + endLinkAct = new KAction(i18n("End"), this); + popupMenu.addAction(endLinkAct); } // copy & abone KAction* copyStrAct = 0; KAction* aboneWordAct = 0; - if ( hasSelection() ) { - if ( showppm ) popupMenu.addSeparator(); + if (hasSelection()) { + if (showppm) popupMenu.addSeparator(); showppm = true; - copyStrAct = new KAction( i18n( "Copy" ), this ); + copyStrAct = new KAction(i18n("Copy"), this); popupMenu.addAction(copyStrAct); // truncated QString selectedStr = selectedText(); - if ( selectedStr.length() > 20 ) { - selectedStr.truncate( 20 ); - selectedStr.append( "..." ); + if (selectedStr.length() > 20) { + selectedStr.truncate(20); + selectedStr.append("..."); } - aboneWordAct = new KAction( i18n( "Add '%1' to abone list" ).arg( selectedStr ), this ); - popupMenu.addAction( aboneWordAct ); + aboneWordAct = new KAction(i18n("Add '%1' to abone list").arg(selectedStr), this); + popupMenu.addAction(aboneWordAct); } // copy link KAction* openBrowserAct = 0; KAction* copyLinkAct = 0; - if ( !url.isEmpty() ) { - if ( showppm ) popupMenu.addSeparator(); + if (!url.isEmpty()) { + if (showppm) popupMenu.addSeparator(); showppm = true; - openBrowserAct = new KAction( i18n( "Open with Web Browser" ), this ); - popupMenu.addAction( openBrowserAct ); + openBrowserAct = new KAction(i18n("Open with Web Browser"), this); + popupMenu.addAction(openBrowserAct); popupMenu.addSeparator(); - copyLinkAct = new KAction( i18n( "Copy Link Location" ), this ); - popupMenu.addAction( copyLinkAct ); + copyLinkAct = new KAction(i18n("Copy Link Location"), this); + popupMenu.addAction(copyLinkAct); } // show menu - if ( showppm ) { + if (showppm) { QClipboard * clipboard = QApplication::clipboard(); - QAction* action = popupMenu.exec( QCursor::pos() ); - if ( !action ) { + QAction* action = popupMenu.exec(QCursor::pos()); + if (!action) { delete backSubMenu; delete markSubMenu; return; } - if ( action == copyLinkAct ) { - clipboard->setText( url , QClipboard::Clipboard ); - clipboard->setText( url , QClipboard::Selection ); - } else if ( action == openBrowserAct ) { - KRun::runUrl( kurl, "text/html", view() ); - } else if ( action == homeLinkAct ) { - gotoAnchor( "header", false ); - } else if ( action == kokoLinkAct ) { + if (action == copyLinkAct) { + clipboard->setText(url , QClipboard::Clipboard); + clipboard->setText(url , QClipboard::Selection); + } else if (action == openBrowserAct) { + KRun::runUrl(kurl, "text/html", view()); + } else if (action == homeLinkAct) { + gotoAnchor("header", false); + } else if (action == kokoLinkAct) { slotGotoKokoyon(); - } else if ( action == endLinkAct ) { + } else if (action == endLinkAct) { slotClickGotoFooter(); - } else if ( action == copyStrAct ) { - clipboard->setText( selectedText(), QClipboard::Clipboard ); - } else if ( action == aboneWordAct ) { - if ( QMessageBox::information( view(), "Kita", - i18n( "Do you want to add '%1' to abone list ?" ).arg( selectedText() ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - == QMessageBox::Ok ) { + } else if (action == copyStrAct) { + clipboard->setText(selectedText(), QClipboard::Clipboard); + } else if (action == aboneWordAct) { + if (QMessageBox::information(view(), "Kita", + i18n("Do you want to add '%1' to abone list ?").arg(selectedText()), + QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default) + == QMessageBox::Ok) { - Kita::AboneConfig::aboneWordList().append( selectedText() ); - redrawHTMLPart( m_datURL, false ); + Kita::AboneConfig::aboneWordList().append(selectedText()); + redrawHTMLPart(m_datURL, false); } } else { QMenu* menu = action->menu(); - if ( !menu ) { + if (!menu) { delete backSubMenu; delete markSubMenu; return; } - if ( menu == markSubMenu ) { - gotoAnchor( QString().setNum( menu->actions().indexOf( action ) ), false ); - } else if ( menu == backSubMenu ) { - for ( int i = 0; i < menu->actions().indexOf( action ); i++ ) + if (menu == markSubMenu) { + gotoAnchor(QString().setNum(menu->actions().indexOf(action)), false); + } else if (menu == backSubMenu) { + for (int i = 0; i < menu->actions().indexOf(action); i++) m_anchorStack.pop_back(); slotGobackAnchor(); } @@ -846,14 +846,14 @@ /* protected */ /* virtual */ -void KitaHTMLPart::customEvent( QEvent * e ) +void KitaHTMLPart::customEvent(QEvent * e) { - if ( e->type() == EVENT_GotoAnchor ) { - KHTMLPart::gotoAnchor( static_cast< GotoAnchorEvent* >( e ) ->getAnc() ); + if (e->type() == EVENT_GotoAnchor) { + KHTMLPart::gotoAnchor(static_cast< GotoAnchorEvent* >(e) ->getAnc()); return ; } - KHTMLPart::customEvent( e ); + KHTMLPart::customEvent(e); } @@ -863,39 +863,39 @@ /* protected */ -void KitaHTMLPart::khtmlMousePressEvent( khtml::MousePressEvent* e ) +void KitaHTMLPart::khtmlMousePressEvent(khtml::MousePressEvent* e) { emit mousePressed(); /* to KitaThreadView to focus this view. */ KUrl kurl; - if ( !e->url().string().isEmpty() ) - kurl = KUrl( Kita::BoardManager::boardURL( m_datURL ), e->url().string() ); + if (!e->url().string().isEmpty()) + kurl = KUrl(Kita::BoardManager::boardURL(m_datURL), e->url().string()); m_pushctrl = m_pushmidbt = m_pushrightbt = false; - if ( e->qmouseEvent() ->button() & Qt::RightButton ) m_pushrightbt = true; - if ( e->qmouseEvent() ->modifiers() & Qt::ControlModifier ) m_pushctrl = true; - if ( e->qmouseEvent() ->button() & Qt::MidButton ) m_pushmidbt = true; + if (e->qmouseEvent() ->button() & Qt::RightButton) m_pushrightbt = true; + if (e->qmouseEvent() ->modifiers() & Qt::ControlModifier) m_pushctrl = true; + if (e->qmouseEvent() ->button() & Qt::MidButton) m_pushmidbt = true; - if ( e->url() != 0 ) { + if (e->url() != 0) { - if ( e->url().string().at( 0 ) == '#' ) { /* anchor */ + if (e->url().string().at(0) == '#') { /* anchor */ kurl = m_datURL; - kurl.setRef( e->url().string().mid( 1 ) ) ; + kurl.setRef(e->url().string().mid(1)) ; } - clickAnchor( kurl ); + clickAnchor(kurl); m_pushctrl = m_pushmidbt = m_pushrightbt = false; return ; } /* popup menu */ - if ( m_pushrightbt ) { - showPopupMenu( kurl ); + if (m_pushrightbt) { + showPopupMenu(kurl); m_pushctrl = m_pushmidbt = m_pushrightbt = false; return ; } - KHTMLPart::khtmlMousePressEvent( e ); + KHTMLPart::khtmlMousePressEvent(e); } @@ -909,23 +909,23 @@ /* private slot */ -void KitaHTMLPart::slotOpenURLRequest( const KUrl& urlin, const KParts::OpenUrlArguments& ) +void KitaHTMLPart::slotOpenURLRequest(const KUrl& urlin, const KParts::OpenUrlArguments&) { - clickAnchor( urlin ); + clickAnchor(urlin); } /*------------------------------------------------------*/ /* This function is called when user clicked res anchor */ /* private */ -void KitaHTMLPart::clickAnchor( const KUrl& urlin ) +void KitaHTMLPart::clickAnchor(const KUrl& urlin) { QString refstr; - KUrl datURL = Kita::getDatURL( urlin , refstr ); + KUrl datURL = Kita::getDatURL(urlin , refstr); /*--------------------*/ /* Ctrl + right click */ - if ( m_pushctrl && m_pushrightbt ) { - showPopupMenu( urlin ); + if (m_pushctrl && m_pushrightbt) { + showPopupMenu(urlin); return ; } @@ -933,57 +933,57 @@ /* If this is not anchor, then */ /* emit openURLRequest and return */ - if ( datURL.host() != m_datURL.host() || datURL.path() != m_datURL.path() ) { + if (datURL.host() != m_datURL.host() || datURL.path() != m_datURL.path()) { /* right click */ - if ( m_pushrightbt ) { + if (m_pushrightbt) { /* start multi-popup mode or show popup menu */ - if ( !startMultiPopup() ) showPopupMenu( urlin ); + if (!startMultiPopup()) showPopupMenu(urlin); return ; } /* right click */ - ViewMediator::getInstance()->openURL( urlin ); + ViewMediator::getInstance()->openURL(urlin); return ; } - if ( refstr.isEmpty() ) return ; + if (refstr.isEmpty()) return ; /*---------------------------*/ /* show popupmenu for #write */ - if ( refstr.left( 5 ) == "write" ) { - showWritePopupMenu( refstr ); + if (refstr.left(5) == "write") { + showWritePopupMenu(refstr); return ; } /*----------------------------*/ /* extract responses by ID */ - if ( refstr.left( 5 ) == "idpop" ) { - showIDPopup( refstr ); + if (refstr.left(5) == "idpop") { + showIDPopup(refstr); return ; } /*---------------------------*/ /* show popupmenu for #bepop */ - if ( refstr.left( 5 ) == "bepop" ) { - showBePopupMenu( refstr ); + if (refstr.left(5) == "bepop") { + showBePopupMenu(refstr); return ; } /*-------------------------*/ /* start multi-popup mdde */ - if ( m_pushrightbt && startMultiPopup() ) return ; + if (m_pushrightbt && startMultiPopup()) return ; /*----------------------------*/ /* next 100 ,before 100 ,etc. */ - if ( m_mode == HTMLPART_MODE_MAINPART ) { - if ( refstr.left( 7 ) == "tosaigo" ) { + if (m_mode == HTMLPART_MODE_MAINPART) { + if (refstr.left(7) == "tosaigo") { slotClickGotoFooter(); return; } @@ -994,23 +994,23 @@ int refNum, refNum2; - int i = refstr.indexOf( "-" ); - if ( i != -1 ) { - refNum = refstr.left( i ).toInt(); - refNum2 = refstr.mid( i + 1 ).toInt(); - if ( refNum2 < refNum ) { + int i = refstr.indexOf("-"); + if (i != -1) { + refNum = refstr.left(i).toInt(); + refNum2 = refstr.mid(i + 1).toInt(); + if (refNum2 < refNum) { refNum2 = refNum; } } else { refNum = refNum2 = refstr.toInt(); } - if ( !refNum ) return ; + if (!refNum) return ; - if ( m_mode == HTMLPART_MODE_POPUP ) { - ViewMediator::getInstance()->openURL( urlin ); + if (m_mode == HTMLPART_MODE_POPUP) { + ViewMediator::getInstance()->openURL(urlin); } else { - gotoAnchor( QString().setNum( refNum ), true ); + gotoAnchor(QString().setNum(refNum), true); } } @@ -1019,21 +1019,21 @@ /*---------------------------------------------------------*/ /* 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 KitaHTMLPart::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 ); + int resNum = refstr.mid(5).toInt(); + QString namestr = Kita::DatManager::getPlainName(m_datURL, resNum); /* show res tree */ - if ( m_pushrightbt ) { + if (m_pushrightbt) { int num; - QString htmlstr = Kita::DatManager::getTreeByRes( m_datURL, resNum, num ); - if ( !num ) return ; - QString tmpstr = QString( "<DIV>No.%1 : [%2]<BR>" ).arg( resNum ).arg( num ); + QString htmlstr = Kita::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>"; - showPopup( m_datURL, tmpstr ); + showPopup(m_datURL, tmpstr); startMultiPopup(); return ; } @@ -1042,129 +1042,129 @@ /* create popup menu */ QString plainStr; - KMenu popupMenu( view() ); + KMenu popupMenu(view()); KAction* resAct = 0; KAction* quoteAct = 0; - if ( m_mode == HTMLPART_MODE_MAINPART ) { - resAct = new KAction( i18n( "write response" ), this ); - popupMenu.addAction( resAct ); + if (m_mode == HTMLPART_MODE_MAINPART) { + resAct = new KAction(i18n("write response"), this); + popupMenu.addAction(resAct); - quoteAct = new KAction( i18n( "quote this" ), this ); - popupMenu.addAction( quoteAct ); + quoteAct = new KAction(i18n("quote this"), this); + popupMenu.addAction(quoteAct); popupMenu.addSeparator(); } // mark - KAction* markAct = new KAction( i18n( "Mark" ), this ); - markAct->setCheckable( true ); - markAct->setChecked( Kita::DatManager::isMarked( m_datURL, resNum ) ); - popupMenu.addAction( markAct ); + KAction* markAct = new KAction(i18n("Mark"), this); + markAct->setCheckable(true); + markAct->setChecked(Kita::DatManager::isMarked(m_datURL, resNum)); + popupMenu.addAction(markAct); popupMenu.addSeparator(); // open - KAction* showBrowserAct = new KAction( i18n( "Open with Web Browser" ), this ); - popupMenu.addAction( showBrowserAct ); + KAction* showBrowserAct = new KAction(i18n("Open with Web Browser"), this); + popupMenu.addAction(showBrowserAct); popupMenu.addSeparator(); // util - KAction* resTreeAct = new KAction( i18n( "res tree" ), this ); - popupMenu.addAction( resTreeAct ); + KAction* resTreeAct = new KAction(i18n("res tree"), this); + popupMenu.addAction(resTreeAct); - KAction* reverseResTreeAct = new KAction( i18n( "reverse res tree" ), this ); - popupMenu.addAction( reverseResTreeAct ); + KAction* reverseResTreeAct = new KAction(i18n("reverse res tree"), this); + popupMenu.addAction(reverseResTreeAct); - KAction* extractNameAct = new KAction( i18n( "extract by name" ), this ); - popupMenu.addAction( extractNameAct ); + KAction* extractNameAct = new KAction(i18n("extract by name"), this); + popupMenu.addAction(extractNameAct); popupMenu.addSeparator(); // copy - KAction* copyUrlAct = new KAction( i18n( "copy URL" ), this ); - popupMenu.addAction( copyUrlAct ); + KAction* copyUrlAct = new KAction(i18n("copy URL"), this); + popupMenu.addAction(copyUrlAct); - KAction* copyThreadNameAct = new KAction( i18n( "Copy title and URL" ), this ); - popupMenu.addAction( copyThreadNameAct ); + KAction* copyThreadNameAct = new KAction(i18n("Copy title and URL"), this); + popupMenu.addAction(copyThreadNameAct); - KAction* copyAct = new KAction( i18n( "copy" ), this ); - popupMenu.addAction( copyAct ); + KAction* copyAct = new KAction(i18n("copy"), this); + popupMenu.addAction(copyAct); // kokkoma de yonda KAction* setKokoYonAct = 0; - if ( m_domtree && m_mode == HTMLPART_MODE_MAINPART ) { + if (m_domtree && m_mode == HTMLPART_MODE_MAINPART) { popupMenu.addSeparator(); - setKokoYonAct = new KAction( i18n( "set Kokomade Yonda" ), this ); - popupMenu.addAction( setKokoYonAct ); + setKokoYonAct = new KAction(i18n("set Kokomade Yonda"), this); + popupMenu.addAction(setKokoYonAct); } // abone popupMenu.addSeparator(); - KAction* aboneNameAct = new KAction( i18n( "add name to abone list" ), this ); - popupMenu.addAction( aboneNameAct ); + KAction* aboneNameAct = new KAction(i18n("add name to abone list"), this); + popupMenu.addAction(aboneNameAct); // show popup menu - QAction* action = popupMenu.exec( QCursor::pos() ); - if ( !action ) { + QAction* action = popupMenu.exec(QCursor::pos()); + if (!action) { return; } - if ( action == resAct ) { - resstr = ">>" + QString().setNum( resNum ) + '\n'; - 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'; - ViewMediator::getInstance()->showWriteView( m_datURL, resstr ); - } else if ( action == markAct ) { - Kita::DatManager::setMark( m_datURL, resNum, ! Kita::DatManager::isMarked( m_datURL, resNum ) ); - } else if ( action == copyAct || action == copyUrlAct || action == copyThreadNameAct ) { + if (action == resAct) { + resstr = ">>" + QString().setNum(resNum) + '\n'; + 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'; + ViewMediator::getInstance()->showWriteView(m_datURL, resstr); + } else if (action == markAct) { + Kita::DatManager::setMark(m_datURL, resNum, ! Kita::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 ); + if (action == copyThreadNameAct || action == copyAct) { + str = Kita::DatManager::threadName(m_datURL); } // url - if ( !str.isEmpty() ) str += '\n'; - str += Kita::DatManager::threadURL( m_datURL ) + '/' + QString().setNum( resNum ) + '\n'; + if (!str.isEmpty()) str += '\n'; + str += Kita::DatManager::threadURL(m_datURL) + '/' + QString().setNum(resNum) + '\n'; // body - if ( action == copyAct ) { + if (action == copyAct) { str += '\n' - + Kita::DatManager::getPlainTitle( m_datURL, resNum ) + '\n' - + Kita::DatManager::getPlainBody( m_datURL, resNum ) + '\n'; + + Kita::DatManager::getPlainTitle(m_datURL, resNum) + '\n' + + Kita::DatManager::getPlainBody(m_datURL, resNum) + '\n'; } // copy - clipboard->setText( str , QClipboard::Clipboard ); - clipboard->setText( str , QClipboard::Selection ); + clipboard->setText(str , QClipboard::Clipboard); + clipboard->setText(str , QClipboard::Selection); - } else if ( action == setKokoYonAct ) { - Kita::DatManager::setViewPos( m_datURL, resNum ); - ViewMediator::getInstance()->updateBoardView( m_datURL ); + } else if (action == setKokoYonAct) { + Kita::DatManager::setViewPos(m_datURL, resNum); + ViewMediator::getInstance()->updateBoardView(m_datURL); m_updatedKokoyon = true; - updateScreen( true, true ); - gotoAnchor( QString().setNum( resNum ), false ); + updateScreen(true, true); + gotoAnchor(QString().setNum(resNum), false); - } else if ( action == showBrowserAct ) { - str = Kita::DatManager::threadURL( m_datURL ) + '/' + QString().setNum( resNum ); + } else if (action == showBrowserAct) { + str = Kita::DatManager::threadURL(m_datURL) + '/' + QString().setNum(resNum); - KRun::runUrl( str, "text/html", view() ); - } else if ( action == aboneNameAct ) { - if ( QMessageBox::information( view(), "Kita", - i18n( "Do you want to add '%1' to abone list ?" ).arg( namestr ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - == QMessageBox::Ok ) { + KRun::runUrl(str, "text/html", view()); + } else if (action == aboneNameAct) { + if (QMessageBox::information(view(), "Kita", + i18n("Do you want to add '%1' to abone list ?").arg(namestr), + QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default) + == QMessageBox::Ok) { - Kita::AboneConfig::aboneNameList().append( namestr ); - redrawHTMLPart( m_datURL, false ); + Kita::AboneConfig::aboneNameList().append(namestr); + redrawHTMLPart(m_datURL, false); } } } @@ -1174,43 +1174,43 @@ /*--------------------------------------------------*/ /* popup that is opened when user clicked ID */ /* This funtcion is called in only clickAnchor(). */ /* private */ -void KitaHTMLPart::showIDPopup( const QString& refstr ) +void KitaHTMLPart::showIDPopup(const QString& refstr) { - QString strid = refstr.mid( 5 ) - .replace( "%2B", "+" ) - .replace( "%2F", "/" ); + QString strid = refstr.mid(5) + .replace("%2B", "+") + .replace("%2F", "/"); /* popup */ - if ( m_pushrightbt ) { + if (m_pushrightbt) { int num; QString htmlstr - = Kita::DatManager::getHtmlByID( m_datURL, strid, num ); - if ( num <= 1 ) return ; - QString tmpstr = QString( "<DIV>ID:%1:[%2]<BR>" ).arg( strid ).arg( num ); + = Kita::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>"; - showPopup( m_datURL, tmpstr ); + showPopup(m_datURL, tmpstr); startMultiPopup(); } else { - KMenu popupMenu( view() ); + KMenu popupMenu(view()); - KAction* aboneAct = new KAction( i18n( "add id to abone list" ), this ); - popupMenu.addAction( aboneAct ); + KAction* aboneAct = new KAction(i18n("add id to abone list"), this); + popupMenu.addAction(aboneAct); - QAction* action = popupMenu.exec( QCursor::pos() ); - if ( !action ) { + QAction* action = popupMenu.exec(QCursor::pos()); + if (!action) { return; } - if ( action == aboneAct ) { + if (action == aboneAct) { // add ID to abone list - if ( QMessageBox::information( view(), "Kita", - i18n( "Do you want to add '%1' to abone list ?" ).arg( strid ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - == QMessageBox::Ok ) { + if (QMessageBox::information(view(), "Kita", + i18n("Do you want to add '%1' to abone list ?").arg(strid), + QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default) + == QMessageBox::Ok) { - Kita::AboneConfig::aboneIDList().append( strid ); - redrawHTMLPart( m_datURL, false ); + Kita::AboneConfig::aboneIDList().append(strid); + redrawHTMLPart(m_datURL, false); } } } @@ -1221,36 +1221,36 @@ /*---------------------------------------------------------*/ /* 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 KitaHTMLPart::showBePopupMenu(const QString& refstr) { - QString strURL = "http://be.2ch.net/test/p.php?i=" + refstr.mid( 5 ) - + "&u=d:" + Kita::DatManager::threadURL( m_datURL ) + "/l50"; + QString strURL = "http://be.2ch.net/test/p.php?i=" + refstr.mid(5) + + "&u=d:" + Kita::DatManager::threadURL(m_datURL) + "/l50"; - if ( m_pushrightbt ) { + if (m_pushrightbt) { // create popup menu - KMenu popupMenu( view() ); + KMenu popupMenu(view()); QClipboard * clipboard = QApplication::clipboard(); - KAction* copyUrlAct = new KAction( i18n( "copy URL" ), this ); - popupMenu.addAction( copyUrlAct ); + KAction* copyUrlAct = new KAction(i18n("copy URL"), this); + popupMenu.addAction(copyUrlAct); - KAction* showBrowserAct = new KAction( i18n( "Open with Web Browser" ), this ); + KAction* showBrowserAct = new KAction(i18n("Open with Web Browser"), this); // show popup menu - QAction* action = popupMenu.exec( QCursor::pos() ); - if ( !action ) { + QAction* action = popupMenu.exec(QCursor::pos()); + if (!action) { return; } - if ( action == copyUrlAct ) { + if (action == copyUrlAct) { // copy - clipboard->setText( strURL, QClipboard::Clipboard ); - clipboard->setText( strURL, QClipboard::Selection ); - } else if ( action == showBrowserAct ) { - KRun::runUrl( strURL, "text/html", view() ); + clipboard->setText(strURL, QClipboard::Clipboard); + clipboard->setText(strURL, QClipboard::Selection); + } else if (action == showBrowserAct) { + KRun::runUrl(strURL, "text/html", view()); } } else { - KRun::runUrl( strURL, "text/html", 0 ); + KRun::runUrl(strURL, "text/html", 0); } } @@ -1262,7 +1262,7 @@ /* public */ bool KitaHTMLPart::isPopupVisible() { - if ( !m_popup ) return false; + if (!m_popup) return false; return m_popup->isVisible(); } @@ -1277,35 +1277,35 @@ /* for convenience */ /* public slot */ -void KitaHTMLPart::slotShowResPopup( QPoint point, int refNum, int refNum2 ) +void KitaHTMLPart::slotShowResPopup(QPoint point, int refNum, int refNum2) { - QString innerHTML = Kita::DatManager::getHtml( m_datURL, refNum, refNum2 ); - if ( innerHTML.isEmpty() ) return ; + QString innerHTML = Kita::DatManager::getHtml(m_datURL, refNum, refNum2); + if (innerHTML.isEmpty()) return ; - showPopupCore( m_datURL, innerHTML, point ); + showPopupCore(m_datURL, innerHTML, point); } /* for convenience */ /* private */ -void KitaHTMLPart::showPopup( const KUrl& url, const QString& innerHTML ) +void KitaHTMLPart::showPopup(const KUrl& url, const QString& innerHTML) { - showPopupCore( url, innerHTML, QCursor::pos() ); + showPopupCore(url, innerHTML, QCursor::pos()); } /* show popup window */ /* private */ -void KitaHTMLPart::showPopupCore( const KUrl& url, const QString& innerHTML, QPoint point ) +void KitaHTMLPart::showPopupCore(const KUrl& url, const QString& innerHTML, QPoint point) { slotDeletePopup(); m_multiPopup = false; - m_popup = new Kita::ResPopup( view() , url ); + m_popup = new Kita::ResPopup(view() , url); - connect( m_popup, SIGNAL( hideChildPopup() ), SLOT( slotHideChildPopup() ) ); + connect(m_popup, SIGNAL(hideChildPopup()), SLOT(slotHideChildPopup())); - m_popup->setText( innerHTML ); + m_popup->setText(innerHTML); m_popup->adjustSize(); - m_popup->adjustPos( point ); + m_popup->adjustPos(point); m_popup->show(); } @@ -1315,7 +1315,7 @@ bool KitaHTMLPart::startMultiPopup() { - if ( m_popup && m_popup->isVisible() ) { + if (m_popup && m_popup->isVisible()) { m_multiPopup = true; m_popup->moveMouseAbove(); } else { @@ -1329,9 +1329,9 @@ /* Is it multi-popup mode now ? */ /* private */ bool KitaHTMLPart::isMultiPopupMode() { - if ( !m_popup ) { + if (!m_popup) { m_multiPopup = false; - } else if ( m_popup->isHidden() ) { + } else if (m_popup->isHidden()) { m_multiPopup = false; } @@ -1341,24 +1341,24 @@ /* private */ void KitaHTMLPart::hidePopup() { - if ( m_popup ) { + if (m_popup) { m_popup->hide(); } m_multiPopup = false; } /* return true if this view is under mouse. */ /* private */ -bool KitaHTMLPart::isUnderMouse( int mrgwd, int mrght ) +bool KitaHTMLPart::isUnderMouse(int mrgwd, int mrght) { QPoint pos = QCursor::pos(); int cx = pos.x(), cy = pos.y(); - QPoint viewpos = view() ->mapToGlobal( QPoint( 0, 0 ) ); + QPoint viewpos = view() ->mapToGlobal(QPoint(0, 0)); int px = viewpos.x(), py = viewpos.y(); int wd = view() ->visibleWidth(), ht = view() ->visibleHeight(); - if ( ( px < cx && cx < px + wd + mrgwd ) - && ( py < cy && cy < py + ht + mrght ) ) { + if ((px < cx && cx < px + wd + mrgwd) + && (py < cy && cy < py + ht + mrght)) { return true; } @@ -1368,14 +1368,14 @@ /* private slot */ void KitaHTMLPart::slotLeave() { - if ( isMultiPopupMode() ) return ; -// if ( view() ->isHorizontalSliderPressed() ) return ;// TODO -// if ( view() ->isVerticalSliderPressed () ) return ; // TODO + if (isMultiPopupMode()) return ; +// if (view() ->isHorizontalSliderPressed()) return ;// TODO +// if (view() ->isVerticalSliderPressed ()) return ; // TODO hidePopup(); /* emit signal to have parent hide this if this is popup . */ - if ( m_mode == HTMLPART_MODE_POPUP && !isUnderMouse( 0, 0 ) ) { + if (m_mode == HTMLPART_MODE_POPUP && !isUnderMouse(0, 0)) { emit hideChildPopup(); } } @@ -1390,7 +1390,7 @@ hidePopup(); /* emit signal to have parent hide this if this is popup . */ - if ( m_mode == HTMLPART_MODE_POPUP && !isUnderMouse( mrg, 0 ) ) { + if (m_mode == HTMLPART_MODE_POPUP && !isUnderMouse(mrg, 0)) { emit hideChildPopup(); } } @@ -1406,7 +1406,7 @@ hidePopup(); /* emit signal to have parent hide this if this is popup . */ - if ( m_mode == HTMLPART_MODE_POPUP && !isUnderMouse( 0, mrg ) ) { + if (m_mode == HTMLPART_MODE_POPUP && !isUnderMouse(0, mrg)) { emit hideChildPopup(); } } @@ -1419,7 +1419,7 @@ hidePopup(); /* emit signal to have parent hide this if this is popup . */ - if ( m_mode == HTMLPART_MODE_POPUP && !isUnderMouse( 0, 0 ) ) { + if (m_mode == HTMLPART_MODE_POPUP && !isUnderMouse(0, 0)) { emit hideChildPopup(); } } @@ -1427,7 +1427,7 @@ /*---------------------------------------------------*/ /* This slot is called when mouse moves onto the URL */ /* private slot */ -void KitaHTMLPart::slotOnURL( const QString& url ) +void KitaHTMLPart::slotOnURL(const QString& url) { /* config */ @@ -1435,37 +1435,37 @@ /*----------------------------*/ - if ( isMultiPopupMode() ) return ; + if (isMultiPopupMode()) return ; slotDeletePopup(); - if ( url.isEmpty() ) return ; - if ( url.left( 7 ) == "mailto:" ) return ; + if (url.isEmpty()) return ; + if (url.left(7) == "mailto:") return ; /* Is Kita active now ? */ - if( ViewMediator::getInstance()->isKitaActive() == false ) return; + if(ViewMediator::getInstance()->isKitaActive() == false) return; /* get reference */ QString refstr; KUrl datURL = m_datURL; - if ( url.at( 0 ) == '#' ) { - refstr = url.mid( 1 ); + if (url.at(0) == '#') { + refstr = url.mid(1); } else { - datURL = Kita::getDatURL( KUrl( m_datURL, url ) , refstr ); + datURL = Kita::getDatURL(KUrl(m_datURL, url) , refstr); } /*------------------------*/ /* id popup */ - if ( url.left( 6 ) == "#idpop" ) { - int num = Kita::DatManager::getNumByID( m_datURL, url.mid( 6 ) ); + if (url.left(6) == "#idpop") { + int num = Kita::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 ); + if (num >= 2) { + tmpstr = QString("<DIV>ID:%1:[%2]</DIV>").arg(url.mid(6)).arg(num); } else { - tmpstr = "<DIV>" + i18n( "None" ) + "</DIV>"; + tmpstr = "<DIV>" + i18n("None") + "</DIV>"; } - showPopup( m_datURL, tmpstr ); + showPopup(m_datURL, tmpstr); return ; } @@ -1473,17 +1473,17 @@ /*------------------------*/ /* show reffered num */ - if ( refstr.left( 5 ) == "write" ) { - int no = refstr.mid( 5 ).toInt(); + if (refstr.left(5) == "write") { + int no = refstr.mid(5).toInt(); int num = 0; - Kita::DatManager::getTreeByRes( m_datURL, no, num ); + Kita::DatManager::getTreeByRes(m_datURL, no, num); QString tmpstr; - if ( num ) { - tmpstr = QString( "<DIV>No.%1 : [%2]</DIV>" ).arg( no ).arg( num ); + if (num) { + tmpstr = QString("<DIV>No.%1 : [%2]</DIV>").arg(no).arg(num); } else { - tmpstr = "<DIV>" + i18n( "None" ) + "</DIV>"; + tmpstr = "<DIV>" + i18n("None") + "</DIV>"; } - showPopup( m_datURL, tmpstr ); + showPopup(m_datURL, tmpstr); return ; } @@ -1491,10 +1491,10 @@ /*------------------------*/ /* abone */ - if ( url.left( 6 ) == "#abone" ) { - int no = url.mid( 6 ).toInt(); - QString tmpstr = Kita::DatManager::getHtml( m_datURL, no, no, false ); - showPopup( m_datURL, tmpstr ); + if (url.left(6) == "#abone") { + int no = url.mid(6).toInt(); + QString tmpstr = Kita::DatManager::getHtml(m_datURL, no, no, false); + showPopup(m_datURL, tmpstr); return ; } @@ -1505,15 +1505,15 @@ int refNum; int refNum2; - int i = refstr.indexOf( "-" ); - if ( i != -1 ) { /* >>refNum-refNum2 */ + int i = refstr.indexOf("-"); + if (i != -1) { /* >>refNum-refNum2 */ - refNum = refstr.left( i ).toInt(); - refNum2 = refstr.mid( i + 1 ).toInt(); + refNum = refstr.left(i).toInt(); + refNum2 = refstr.mid(i + 1).toInt(); - if ( refNum ) { - if ( refNum2 < refNum ) refNum2 = refNum; - if ( refNum2 - refNum > maxpopup - 1 ) refNum2 = refNum + maxpopup - 1; + if (refNum) { + if (refNum2 < refNum) refNum2 = refNum; + if (refNum2 - refNum > maxpopup - 1) refNum2 = refNum + maxpopup - 1; } } else { /* >>refNum */ @@ -1522,28 +1522,28 @@ } /* another thread ? */ - if ( datURL.host() != m_datURL.host() || datURL.path() != m_datURL.path() ) { + if (datURL.host() != m_datURL.host() || datURL.path() != m_datURL.path()) { /* get board name */ - QString boardName = Kita::BoardManager::boardName( datURL ); - if ( !boardName.isEmpty() ) innerHTML += '[' + boardName + "] "; + QString boardName = Kita::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 ); + Kita::DatManager::getDatInfoPointer(datURL); /* get thread Name */ - QString subName = Kita::DatManager::threadName( datURL ); - if ( !subName.isEmpty() ) innerHTML += subName + "<br><br>"; + QString subName = Kita::DatManager::threadName(datURL); + if (!subName.isEmpty()) innerHTML += subName + "<br><br>"; - if ( !refNum ) refNum = refNum2 = 1; + if (!refNum) refNum = refNum2 = 1; } /* get HTML and show it */ - if ( !refNum ) return ; - innerHTML += Kita::DatManager::getHtml( datURL, refNum, refNum2 ); + if (!refNum) return ; + innerHTML += Kita::DatManager::getHtml(datURL, refNum, refNum2); - if ( !innerHTML.isEmpty() ) showPopup( datURL, innerHTML ); + if (!innerHTML.isEmpty()) showPopup(datURL, innerHTML); } @@ -1552,7 +1552,7 @@ then show res popup. */ /* private */ bool KitaHTMLPart::showSelectedDigitPopup() { - if ( !hasSelection() ) return false; + if (!hasSelection()) return false; QString linkstr; int refNum; @@ -1560,10 +1560,10 @@ const QChar *chpt = selectText.unicode(); unsigned int length = selectText.length(); - if ( ( refNum = Kita::stringToPositiveNum( chpt, length ) ) != -1 ) { - QString innerHTML = Kita::DatManager::getHtml( m_datURL, refNum, refNum ); - if ( !innerHTML.isEmpty() ) { - showPopup( m_datURL, innerHTML ); + if ((refNum = Kita::stringToPositiveNum(chpt, length)) != -1) { + QString innerHTML = Kita::DatManager::getHtml(m_datURL, refNum, refNum); + if (!innerHTML.isEmpty()) { + showPopup(m_datURL, innerHTML); startMultiPopup(); return true; } Modified: kita/branches/KITA-KDE4/kita/src/htmlpart.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/htmlpart.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/htmlpart.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -26,7 +26,7 @@ }; /* ID of user defined event */ -#define EVENT_GotoAnchor ( QEvent::User + 100 ) +#define EVENT_GotoAnchor (QEvent::User + 100) class KitaDomTree; class KUrl; @@ -80,26 +80,26 @@ public: - KitaHTMLPart( QWidget* parent ); + KitaHTMLPart(QWidget* parent); ~KitaHTMLPart(); - bool setup( int mode , const KUrl& url ); + bool setup(int mode , const KUrl& url); /* rendering */ - void showResponses( int startnum, int endnum ); - void parseResponses( int startnum, int endnum ); + 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 ); + void updateScreen(bool showHeaderEtc, bool clock); + void setInnerHTML(const QString& innerHTML); /* cache */ - bool load( int centerNum ); - bool reload( int jumpNum ); + bool load(int centerNum); + bool reload(int jumpNum); /* goto anchor */ - bool gotoAnchor( const QString& anc, bool pushPosition ); + bool gotoAnchor(const QString& anc, bool pushPosition); /* search */ - bool findText( const QString &query, bool reverse ); + bool findText(const QString &query, bool reverse); /* popup */ bool isPopupVisible(); @@ -122,12 +122,12 @@ /* res popup */ void slotDeletePopup(); - void slotShowResPopup( QPoint point, int refNum, int refNum2 ); + void slotShowResPopup(QPoint point, int refNum, int refNum2); private: void clearPart(); - void redrawHTMLPart( const KUrl& datURL, bool force ); + void redrawHTMLPart(const KUrl& datURL, bool force); /* setup */ void connectSignals(); @@ -138,24 +138,24 @@ QString getCurrentIDofNode(); /* popup menu */ - void showPopupMenu( const KUrl& kurl ); + void showPopupMenu(const KUrl& kurl); /* click */ - void clickAnchor( const KUrl& urlin ); - void showWritePopupMenu( const QString& refstr ); - void showIDPopup( const QString& refstr ); - void showBePopupMenu( const QString& refstr ); + void clickAnchor(const KUrl& urlin); + void showWritePopupMenu(const QString& refstr); + void showIDPopup(const QString& refstr); + void showBePopupMenu(const QString& refstr); /* search */ void findTextInit(); /* res popup */ - void showPopup( const KUrl& url, const QString& innerHTML ); - void showPopupCore( const KUrl& url, const QString& innerHTML, QPoint point ); + void showPopup(const KUrl& url, const QString& innerHTML); + void showPopupCore(const KUrl& url, const QString& innerHTML, QPoint point); bool startMultiPopup(); bool isMultiPopupMode(); void hidePopup(); - bool isUnderMouse( int mrgwd, int mrght ); + bool isUnderMouse(int mrgwd, int mrght); bool showSelectedDigitPopup(); KitaHTMLPart(const KitaHTMLPart&); @@ -164,23 +164,23 @@ protected: /* user event */ - virtual void customEvent( QEvent * e ); + virtual void customEvent(QEvent * e); /* mouse event */ - virtual void khtmlMousePressEvent( khtml::MousePressEvent* e ); + virtual void khtmlMousePressEvent(khtml::MousePressEvent* e); private slots: /* click */ - void slotOpenURLRequest( const KUrl&, const KParts::OpenUrlArguments& ); + void slotOpenURLRequest(const KUrl&, const KParts::OpenUrlArguments&); /* res popup */ void slotLeave(); void slotVSliderReleased(); void slotHSliderReleased(); void slotHideChildPopup(); - void slotOnURL( const QString& url ); + void slotOnURL(const QString& url); signals: @@ -211,8 +211,8 @@ public: - GotoAnchorEvent( const QString& anc ) - : QEvent( QEvent::Type( EVENT_GotoAnchor ) ), m_anc( anc ) {}; + GotoAnchorEvent(const QString& anc) + : QEvent(QEvent::Type(EVENT_GotoAnchor)), m_anc(anc) {}; const QString& getAnc() const { return m_anc; } }; Modified: kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -15,37 +15,37 @@ #include <khtml_part.h> -KitaHTMLView::KitaHTMLView( KHTMLPart* part, QWidget *parent ) - : KHTMLView( part, parent ) +KitaHTMLView::KitaHTMLView(KHTMLPart* part, QWidget *parent) + : KHTMLView(part, parent) {} KitaHTMLView::~KitaHTMLView() {} -void KitaHTMLView::leaveEvent( QEvent* ) +void KitaHTMLView::leaveEvent(QEvent*) { emit leave(); } /* protected */ -void KitaHTMLView::keyPressEvent( QKeyEvent* e ) +void KitaHTMLView::keyPressEvent(QKeyEvent* e) { - if ( e->key() == Qt::Key_Space || e->key() == Qt::Key_PageDown - || e->key() == Qt::Key_Down || e->key() == Qt::Key_End ) { - if ( emitPushDown() ) return ; + if (e->key() == Qt::Key_Space || e->key() == Qt::Key_PageDown + || e->key() == Qt::Key_Down || e->key() == Qt::Key_End) { + if (emitPushDown()) return ; } - KHTMLView::keyPressEvent( e ); + KHTMLView::keyPressEvent(e); } /* protected */ -void KitaHTMLView::wheelEvent( QWheelEvent * e ) +void KitaHTMLView::wheelEvent(QWheelEvent * e) { - if ( e->delta() < 0 ) { /* scroll down */ - if ( emitPushDown() ) return ; + if (e->delta() < 0) { /* scroll down */ + if (emitPushDown()) return ; } - KHTMLView::wheelEvent( e ); + KHTMLView::wheelEvent(e); } /* private */ @@ -53,7 +53,7 @@ { int y = contentsY(); - if ( y >= contentsHeight() - visibleHeight() ) { + if (y >= contentsHeight() - visibleHeight()) { emit pushDown(); /* to KitaHTMLPart 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-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/kitaui/htmlview.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -20,12 +20,12 @@ { Q_OBJECT public: - KitaHTMLView( KHTMLPart* part, QWidget *parent ); + KitaHTMLView(KHTMLPart* part, QWidget *parent); ~KitaHTMLView(); protected: - void leaveEvent( QEvent* ); - void keyPressEvent( QKeyEvent* e ); - void wheelEvent( QWheelEvent * e ); + void leaveEvent(QEvent*); + void keyPressEvent(QKeyEvent* e); + void wheelEvent(QWheelEvent * e); private: bool emitPushDown(); Modified: kita/branches/KITA-KDE4/kita/src/kitaui/listviewitem.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/kitaui/listviewitem.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/kitaui/listviewitem.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -12,30 +12,30 @@ using namespace Kita; -ListViewItem::ListViewItem( Q3ListView *parent, Q3ListViewItem *after, +ListViewItem::ListViewItem(Q3ListView *parent, Q3ListViewItem *after, QString label1, QString label2, QString label3, QString label4, - QString label5, QString label6, QString label7, QString label8 ) - : K3ListViewItem( parent, after, label1, label2, label3, label4, label5, label6, label7, label8 ) + QString label5, QString label6, QString label7, QString label8) + : K3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } -ListViewItem::ListViewItem( Q3ListViewItem *parent, Q3ListViewItem *after, +ListViewItem::ListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after, QString label1, QString label2, QString label3, QString label4, - QString label5, QString label6, QString label7, QString label8 ) - : K3ListViewItem( parent, after, label1, label2, label3, label4, label5, label6, label7, label8 ) + QString label5, QString label6, QString label7, QString label8) + : K3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } -ListViewItem::ListViewItem( Q3ListView* parent, QString label1, QString label2 ) - : K3ListViewItem( parent, label1, label2 ) +ListViewItem::ListViewItem(Q3ListView* parent, QString label1, QString label2) + : K3ListViewItem(parent, label1, label2) { init(); } -ListViewItem::ListViewItem( Q3ListViewItem* parent, QString label1, QString label2 ) - : K3ListViewItem( parent, label1, label2 ) +ListViewItem::ListViewItem(Q3ListViewItem* parent, QString label1, QString label2) + : K3ListViewItem(parent, label1, label2) { init(); } @@ -52,18 +52,18 @@ } /* public */ -void ListViewItem::setColor( QColor textColor, QColor baseColor ) +void ListViewItem::setColor(QColor textColor, QColor baseColor) { m_textPalette = textColor; m_basePalette = baseColor; } /* public */ /* virtual */ -void ListViewItem::paintCell( QPainter *p, const QColorGroup &cg, - int column, int width, int align ) +void ListViewItem::paintCell(QPainter *p, const QColorGroup &cg, + int column, int width, int align) { -/* QColorGroup colorGroup( cg ); - colorGroup.setColor( QColorGroup::Text, m_textPalette ); - colorGroup.setColor( QColorGroup::Base, m_basePalette );*/ // TODO - K3ListViewItem::paintCell( p, cg, column, width, align ); +/* QColorGroup colorGroup(cg); + colorGroup.setColor(QColorGroup::Text, m_textPalette); + colorGroup.setColor(QColorGroup::Base, m_basePalette);*/ // TODO + K3ListViewItem::paintCell(p, cg, column, width, align); } Modified: kita/branches/KITA-KDE4/kita/src/kitaui/listviewitem.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/kitaui/listviewitem.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/kitaui/listviewitem.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -22,26 +22,26 @@ public: - ListViewItem( Q3ListView *parent, Q3ListViewItem *after, + ListViewItem(Q3ListView *parent, Q3ListViewItem *after, QString, QString = QString(), QString = QString(), QString = QString(), QString = QString(), QString = QString(), - QString = QString(), QString = QString() ); + QString = QString(), QString = QString()); - ListViewItem( Q3ListViewItem *parent, Q3ListViewItem *after, + ListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after, QString, QString = QString(), QString = QString(), QString = QString(), QString = QString(), QString = QString(), - QString = QString(), QString = QString() ); + QString = QString(), QString = QString()); - explicit ListViewItem( Q3ListView* parent, QString = QString(), QString = QString() ); + explicit ListViewItem(Q3ListView* parent, QString = QString(), QString = QString()); - explicit ListViewItem( Q3ListViewItem* parent, QString = QString(), QString = QString() ); + explicit ListViewItem(Q3ListViewItem* parent, QString = QString(), QString = QString()); ~ListViewItem(); - void setColor( QColor textColor, QColor baseColor ); - virtual void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ); + void setColor(QColor textColor, QColor baseColor); + virtual void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align); private: void init(); Modified: kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -40,17 +40,17 @@ /*--------------------------------------------------------------*/ -KitaTabWidgetBase::KitaTabWidgetBase( QWidget* parent, Qt::WFlags f ) - : KTabWidget( parent, f ) +KitaTabWidgetBase::KitaTabWidgetBase(QWidget* parent, Qt::WFlags f) + : KTabWidget(parent, f) { - connect( this, SIGNAL( currentChanged ( QWidget * ) ), - SLOT( slotCurrentChanged ( QWidget * ) ) ); + connect(this, SIGNAL(currentChanged (QWidget *)), + SLOT(slotCurrentChanged (QWidget *))); setupActions(); - if ( parent ) { + if (parent) { /* setup part manager */ - m_manager = new KParts::PartManager( parent, this ); - m_manager->addManagedTopLevelWidget( parent ); + m_manager = new KParts::PartManager(parent, this); + m_manager->addManagedTopLevelWidget(parent); } else { m_manager = 0; } @@ -60,11 +60,11 @@ KitaTabWidgetBase::~KitaTabWidgetBase() { /* romove parts */ - if ( m_manager && !( m_manager->parts().isEmpty() ) ) { + if (m_manager && !(m_manager->parts().isEmpty())) { KParts::Part * part; - while ( ( part = m_manager->parts().first() ) != 0 ) { - m_manager->removePart( part ); - removePage( part->widget() ); + while ((part = m_manager->parts().first()) != 0) { + m_manager->removePart(part); + removePage(part->widget()); delete part; } } @@ -73,71 +73,71 @@ /* remove widgets which don't belong to parts */ QWidget* view = currentWidget(); - while ( count() > 0 && view ) { - removePage( view ); + while (count() > 0 && view) { + removePage(view); delete view; view = currentWidget(); } } /* public slot */ -void KitaTabWidgetBase::slotCurrentChanged( QWidget * w ) +void KitaTabWidgetBase::slotCurrentChanged(QWidget * w) { - if ( m_manager == 0 ) return ; - if ( w == 0 ) return ; + if (m_manager == 0) return ; + if (w == 0) return ; w->activateWindow(); w->setFocus(); - KParts::Part* part = findPartFromWidget( w ); - if ( part ) { - m_manager->setActivePart( part ); + KParts::Part* part = findPartFromWidget(w); + if (part) { + m_manager->setActivePart(part); } } /* close num-th tab */ /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseTab( int num ) +void KitaTabWidgetBase::slotCloseTab(int num) { - CloseTabEvent * e = new CloseTabEvent( num ); - QApplication::postEvent( this, e ); // Qt will delete it when done + CloseTabEvent * e = new CloseTabEvent(num); + QApplication::postEvent(this, e); // Qt will delete it when done } /* Calling deleteWidget in the child part will be the cause of crash. So you need to call deleteWidget via custom event. */ /* protected */ /* virtual */ -void KitaTabWidgetBase::customEvent( QEvent * e ) +void KitaTabWidgetBase::customEvent(QEvent * e) { - if ( e->type() == EVENT_CloseTab ) { - deleteWidget ( widget( static_cast< CloseTabEvent* >( e ) ->getIndex() ) ); + if (e->type() == EVENT_CloseTab) { + deleteWidget (widget(static_cast< CloseTabEvent* >(e) ->getIndex())); } } /* protected */ /* virtual */ -void KitaTabWidgetBase::deleteWidget( QWidget* w ) +void KitaTabWidgetBase::deleteWidget(QWidget* w) { - if ( w == 0 ) return ; + if (w == 0) return ; - removePage( w ); - KParts::Part* part = findPartFromWidget( w ); - if ( part ) m_manager->removePart( part ); + removePage(w); + KParts::Part* part = findPartFromWidget(w); + if (part) m_manager->removePart(part); delete w; } /* protected */ -KParts::Part* KitaTabWidgetBase::findPartFromWidget( QWidget* w ) +KParts::Part* KitaTabWidgetBase::findPartFromWidget(QWidget* w) { - if ( w == 0 ) return 0; - if ( m_manager == 0 ) return 0; - if ( m_manager->parts().isEmpty() ) return 0; + if (w == 0) return 0; + if (m_manager == 0) return 0; + if (m_manager->parts().isEmpty()) return 0; KParts::Part *part; QList<KParts::Part*>::const_iterator it = m_manager->parts().begin(); - while ( ( part = ( *it ) ) != 0 ) { - if ( part->widget() == w ) return part; + while ((part = (*it)) != 0) { + if (part->widget() == w) return part; ++it; } @@ -151,10 +151,10 @@ /* private */ void KitaTabWidgetBase::setupActions() { - actionCollection() ->associateWidget( this ); + actionCollection() ->associateWidget(this); - QString str = i18n( "Configure S&hortcuts..." ); + QString str = i18n("Configure S&hortcuts..."); KAction* tab_configkeys_action = actionCollection()->addAction("tab_configkeys"); tab_configkeys_action->setText(str); connect(tab_configkeys_action, SIGNAL(triggered()), this, SLOT(slotConfigureKeys())); @@ -198,8 +198,8 @@ void KitaTabWidgetBase::slotConfigureKeys() { QString str = "Tab Actions"; - KShortcutsDialog dlg( KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this ); - dlg.addCollection( actionCollection(), str ); + KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this); + dlg.addCollection(actionCollection(), str); dlg.configure(); } @@ -209,10 +209,10 @@ { int max = count(); int curpage = currentIndex(); - if ( max <= 1 ) return ; + if (max <= 1) return ; - if ( curpage == 0 ) setCurrentIndex( max - 1 ); - else setCurrentIndex( curpage - 1 ); + if (curpage == 0) setCurrentIndex(max - 1); + else setCurrentIndex(curpage - 1); } /* public slot */ @@ -220,70 +220,70 @@ { int max = count(); int curpage = currentIndex(); - if ( max <= 1 ) return ; + if (max <= 1) return ; - if ( curpage == max - 1 ) setCurrentIndex( 0 ); - else setCurrentIndex( curpage + 1 ); + if (curpage == max - 1) setCurrentIndex(0); + else setCurrentIndex(curpage + 1); } /* see also customEvent */ /* public slot */ void KitaTabWidgetBase::slotCloseCurrentTab() { - slotCloseTab( currentIndex() ); + slotCloseTab(currentIndex()); } /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseOtherTab( int idx ) +void KitaTabWidgetBase::slotCloseOtherTab(int idx) { int max = count(); - if ( max == 0 ) return ; - if ( idx == -1 ) idx = currentIndex(); + if (max == 0) return ; + if (idx == -1) idx = currentIndex(); int i = 0; - while ( i < max && i != idx ) { - slotCloseTab( 0 ); + while (i < max && i != idx) { + slotCloseTab(0); i++; } i++; - while ( i < max ) { - slotCloseTab( 1 ); + while (i < max) { + slotCloseTab(1); i++; } } /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseRightTab( int idx ) +void KitaTabWidgetBase::slotCloseRightTab(int idx) { int max = count(); - if ( max == 0 ) return ; - if ( idx == -1 ) idx = currentIndex(); + if (max == 0) return ; + if (idx == -1) idx = currentIndex(); int i, i2; i = i2 = idx + 1; - while ( i < max ) { - slotCloseTab( i2 ); + while (i < max) { + slotCloseTab(i2); i++; } } /* see also customEvent */ /* public slot */ -void KitaTabWidgetBase::slotCloseLeftTab( int idx ) +void KitaTabWidgetBase::slotCloseLeftTab(int idx) { int max = count(); - if ( max == 0 ) return ; - if ( idx == -1 ) idx = currentIndex(); + if (max == 0) return ; + if (idx == -1) idx = currentIndex(); int i = 0; - while ( i < max && i != idx ) { - slotCloseTab( 0 ); + while (i < max && i != idx) { + slotCloseTab(0); i++; } } @@ -293,12 +293,12 @@ void KitaTabWidgetBase::slotCloseAllTab() { int max = count(); - if ( max == 0 ) return ; + if (max == 0) return ; int i = 0; - while ( i < max ) { - slotCloseTab( 0 ); + while (i < max) { + slotCloseTab(0); i++; } } Modified: kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/kitaui/tabwidgetbase.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -32,10 +32,10 @@ } /* ID of user defined event */ -#define EVENT_CloseTab ( QEvent::User + 100 ) -#define EVENT_ShowDock ( QEvent::User + 101 ) -#define EVENT_FitImageToWinEvent ( QEvent::User + 102 ) -#define EVENT_CancelMoszicEvent ( QEvent::User + 103 ) +#define EVENT_CloseTab (QEvent::User + 100) +#define EVENT_ShowDock (QEvent::User + 101) +#define EVENT_FitImageToWinEvent (QEvent::User + 102) +#define EVENT_CancelMoszicEvent (QEvent::User + 103) @@ -51,18 +51,18 @@ public: - explicit KitaTabWidgetBase( QWidget* parent = 0, Qt::WFlags f = 0 ); + explicit KitaTabWidgetBase(QWidget* parent = 0, Qt::WFlags f = 0); virtual ~KitaTabWidgetBase(); public slots: - void slotCurrentChanged( QWidget* w ); - void slotCloseTab( int num ); + void slotCurrentChanged(QWidget* w); + void slotCloseTab(int num); protected: - virtual void customEvent( QEvent * e ); - virtual void deleteWidget( QWidget* w ); - KParts::Part* findPartFromWidget( QWidget* w ); + virtual void customEvent(QEvent * e); + virtual void deleteWidget(QWidget* w); + KParts::Part* findPartFromWidget(QWidget* w); /*------------------------------------*/ /* common tab actions */ @@ -77,9 +77,9 @@ void slotPrevTab(); void slotNextTab(); void slotCloseCurrentTab(); - void slotCloseOtherTab( int idx = -1 ); - void slotCloseRightTab( int idx = -1 ); - void slotCloseLeftTab( int idx = -1 ); + void slotCloseOtherTab(int idx = -1); + void slotCloseRightTab(int idx = -1); + void slotCloseLeftTab(int idx = -1); void slotCloseAllTab(); }; @@ -93,8 +93,8 @@ public: - CloseTabEvent( int idx ) - : QEvent( QEvent::Type(EVENT_CloseTab) ), m_pageindex( idx ) {} + CloseTabEvent(int idx) + : QEvent(QEvent::Type(EVENT_CloseTab)), m_pageindex(idx) {} int getIndex() const { return m_pageindex; } }; @@ -106,8 +106,8 @@ bool m_force; public: - ShowDockEvent( bool activate, bool force ) : QEvent( QEvent::Type(EVENT_ShowDock) ) - , m_activate( activate ), m_force( force ) {} + 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; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/access.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/access.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/access.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -27,7 +27,7 @@ using namespace Kita; -Access::Access( const KUrl& datURL ) : m_datURL( datURL ), m_currentJob( 0 ) +Access::Access(const KUrl& datURL) : m_datURL(datURL), m_currentJob(0) { init(); } @@ -37,7 +37,7 @@ { m_readNum = 0; m_lastLine.clear(); - m_bbstype = BoardManager::type( m_datURL ); + m_bbstype = BoardManager::type(m_datURL); m_header = "HTTP/1.1 200 "; /* dummy header */ m_dataSize = 0; m_threadData.clear(); @@ -49,38 +49,38 @@ QByteArray orgData; // get cache path. - QString cachePath = Kita::Cache::getPath( m_datURL ); - if ( cachePath.isEmpty() ) { + QString cachePath = Kita::Cache::getPath(m_datURL); + if (cachePath.isEmpty()) { return; } // read cache file. - QFile file( cachePath ); - if ( file.open( QIODevice::ReadOnly ) ) { + QFile file(cachePath); + if (file.open(QIODevice::ReadOnly)) { orgData += file.readAll(); file.close(); } // set data size. - if ( orgData.isEmpty() ) return ; + if (orgData.isEmpty()) return ; m_dataSize = orgData.length(); - switch ( m_bbstype ) { + switch (m_bbstype) { case Board_2ch: case Board_MachiBBS: /* Machi BBS's data is already parsed as 2ch dat. */ { - QString tmpData = Kita::qcpToUnicode( orgData ); - QStringList tmpList = tmpData.split( '\n' ); - emit receiveData( tmpList ); + QString tmpData = Kita::qcpToUnicode(orgData); + QStringList tmpList = tmpData.split('\n'); + emit receiveData(tmpList); } break; default: /* convert data stream into 2ch dat. and emit receiveData SIGNAL. */ - emitDatLineList( orgData ); + emitDatLineList(orgData); break; } } @@ -88,18 +88,18 @@ /* write data to cache */ /* protected */ void Access::writeCacheData() { - if ( m_invalidDataReceived ) return ; - if ( m_threadData.isEmpty() ) return ; + if (m_invalidDataReceived) return ; + if (m_threadData.isEmpty()) return ; m_dataSize += m_threadData.length(); - QString cachePath = Kita::Cache::getPath( m_datURL ); - if ( !cachePath.isEmpty() ) { - FILE * fs = fopen( QFile::encodeName( cachePath ), "a" ); - if ( !fs ) return ; + QString cachePath = Kita::Cache::getPath(m_datURL); + if (!cachePath.isEmpty()) { + FILE * fs = fopen(QFile::encodeName(cachePath), "a"); + if (!fs) return ; - fwrite( m_threadData.data(), m_threadData.length(), 1, fs ); - fclose( fs ); + fwrite(m_threadData.data(), m_threadData.length(), 1, fs); + fclose(fs); } m_threadData.clear(); /* clear baffer */ @@ -107,7 +107,7 @@ } /* update cache file */ /* public */ -bool Access::getupdate( int readNum ) +bool Access::getupdate(int readNum) { /* init */ m_readNum = readNum; @@ -118,18 +118,18 @@ /* set URL of data */ QString getURL; - switch ( m_bbstype ) { + switch (m_bbstype) { case Board_MachiBBS: - getURL = Kita::getThreadURL( m_datURL ); - if ( m_readNum > 0 ) getURL += "&START=" + QString().setNum( m_readNum + 1 ); + getURL = Kita::getThreadURL(m_datURL); + if (m_readNum > 0) getURL += "&START=" + QString().setNum(m_readNum + 1); Kita::InitParseMachiBBS(); break; case Board_JBBS: - getURL = Kita::getThreadURL( m_datURL ); - getURL.replace( "read.cgi", "rawmode.cgi" ); /* adhoc... */ - if ( m_readNum > 0 ) getURL += '/' + QString().setNum( m_readNum + 1 ) + '-'; + getURL = Kita::getThreadURL(m_datURL); + getURL.replace("read.cgi", "rawmode.cgi"); /* adhoc... */ + if (m_readNum > 0) getURL += '/' + QString().setNum(m_readNum + 1) + '-'; break; default: @@ -137,110 +137,110 @@ } /* set UserAgent */ - const QString useragent = QString( "Monazilla/1.00 (Kita/%1)" ).arg( "0.200.0" ); // TODO - KIO::SlaveConfig::self() ->setConfigData( "http", - KUrl( getURL ).host(), - "UserAgent", useragent ); + const QString useragent = QString("Monazilla/1.00 (Kita/%1)").arg("0.200.0"); // TODO + KIO::SlaveConfig::self() ->setConfigData("http", + KUrl(getURL).host(), + "UserAgent", useragent); /* create new job */ - KIO::TransferJob* job = KIO::get( getURL ); + KIO::TransferJob* job = KIO::get(getURL); m_currentJob = job; - connect( job, SIGNAL( data( KIO::Job*, const QByteArray& ) ), - SLOT( slotReceiveThreadData( KIO::Job*, const QByteArray& ) ) ); - connect( job, SIGNAL( result( KJob* ) ), SLOT( slotThreadResult( KJob* ) ) ); + connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), + SLOT(slotReceiveThreadData(KIO::Job*, const QByteArray&))); + connect(job, SIGNAL(result(KJob*)), SLOT(slotThreadResult(KJob*))); // use 'HTTP-Headers' metadata. - job->addMetaData( "PropagateHttpHeader", "true" ); + job->addMetaData("PropagateHttpHeader", "true"); /* resume */ - if ( m_bbstype != Board_MachiBBS + if (m_bbstype != Board_MachiBBS && m_bbstype != Board_JBBS - && m_dataSize > 0 ) { + && m_dataSize > 0) { m_firstReceive = true; /* remove first char (i.e. \n). see also slotReceiveThreadData() */ - job->addMetaData( "resume", QString::number( m_dataSize - 1 ) ); - job->addMetaData( "AllowCompressedPage", "false" ); + job->addMetaData("resume", QString::number(m_dataSize - 1)); + job->addMetaData("AllowCompressedPage", "false"); } return true; } -void Access::slotThreadResult( KJob* job ) +void Access::slotThreadResult(KJob* job) { - KIO::TransferJob *tjob = qobject_cast<KIO::TransferJob *>( job ); - if ( !tjob ) { + KIO::TransferJob *tjob = qobject_cast<KIO::TransferJob *>(job); + if (!tjob) { return; } m_currentJob = 0; - if ( tjob->error() ) { + if (tjob->error()) { tjob->ui()->setWindow(0); tjob->ui()->showErrorMessage(); } else { - m_header = tjob->queryMetaData( "HTTP-Headers" ); + m_header = tjob->queryMetaData("HTTP-Headers"); } writeCacheData(); emit finishLoad(); } -void Access::slotReceiveThreadData( KIO::Job*, const QByteArray& data ) +void Access::slotReceiveThreadData(KIO::Job*, const QByteArray& data) { QByteArray data_tmp(data); // HACK: crash when data contains '\0'. - for ( int i=0; i< data_tmp.size(); i++ ) { - if ( data_tmp[ i ] == '\0' ) data_tmp[ i ] = ' '; + for (int i=0; i< data_tmp.size(); i++) { + if (data_tmp[ i ] == '\0') data_tmp[ i ] = ' '; } - if ( m_bbstype == Board_MachiBBS - || m_bbstype == Board_JBBS ) { + if (m_bbstype == Board_MachiBBS + || m_bbstype == Board_JBBS) { - emitDatLineList( data_tmp ); + emitDatLineList(data_tmp); return ; } - /* check if received data is invalid ( or broken ). */ - if ( ( m_dataSize > 0 && responseCode() != 206 ) - || ( m_firstReceive && data_tmp[ 0 ] != '\n' ) - || ( m_dataSize == 0 && responseCode() != 200 ) - ) m_invalidDataReceived = true; + /* check if received data is invalid (or broken). */ + if ((m_dataSize > 0 && responseCode() != 206) + || (m_firstReceive && data_tmp[ 0 ] != '\n') + || (m_dataSize == 0 && responseCode() != 200) + ) m_invalidDataReceived = true; - if ( m_invalidDataReceived ) return ; + if (m_invalidDataReceived) return ; /* If this is the first call at resumption, remove LF(\n) at head. */ - if ( m_firstReceive ) { - data_tmp = data_tmp.mid( 1 ); + if (m_firstReceive) { + data_tmp = data_tmp.mid(1); } m_firstReceive = false; - emitDatLineList( data_tmp ); + emitDatLineList(data_tmp); } /* convert data stream into 2ch dat. and emit receiveData SIGNAL. */ /* private */ -void Access::emitDatLineList( const QByteArray& dataStream ) +void Access::emitDatLineList(const QByteArray& dataStream) { QList<QByteArray> lineList; QStringList datLineList; - if ( dataStream.isEmpty() ) return ; + if (dataStream.isEmpty()) return ; bool endIsLF = false; - if ( dataStream.at( dataStream.length() - 1 ) == '\n' ) endIsLF = true; + if (dataStream.at(dataStream.length() - 1) == '\n') endIsLF = true; /* split the stream */ m_lastLine += dataStream; - lineList = m_lastLine.split( '\n' ); + lineList = m_lastLine.split('\n'); m_lastLine.clear(); /* save the last line */ - if ( !endIsLF ) { + if (!endIsLF) { QList<QByteArray>::iterator lastit = lineList.end(); lastit--; - if ( lastit != lineList.end() ) { + if (lastit != lineList.end()) { - m_lastLine = ( *lastit ); + m_lastLine = (*lastit); lineList.removeLast(); } } @@ -249,52 +249,52 @@ /* convert lines into 2ch dat */ int count = lineList.count(); - for ( int i = 0; i < count ; ++i ) { + for (int i = 0; i < count ; ++i) { - if ( ! lineList[ i ].isEmpty() ) { + if (! lineList[ i ].isEmpty()) { QString line, line2; QByteArray ba; int nextNum = m_readNum + 1; /* convert line */ - switch ( m_bbstype ) { + switch (m_bbstype) { case Board_MachiBBS: - line = Kita::qcpToUnicode( lineList[i] ); - line2 = Kita::ParseMachiBBSOneLine( line, nextNum ); - ba = Kita::unicodeToQcp( line2 ); + line = Kita::qcpToUnicode(lineList[i]); + line2 = Kita::ParseMachiBBSOneLine(line, nextNum); + ba = Kita::unicodeToQcp(line2); break; case Board_JBBS: - line = Kita::eucToUnicode( lineList[i] ); - line2 = Kita::ParseJBBSOneLine( line, nextNum ); - ba = Kita::unicodeToEuc( line2 ); + line = Kita::eucToUnicode(lineList[i]); + line2 = Kita::ParseJBBSOneLine(line, nextNum); + ba = Kita::unicodeToEuc(line2); break; case Board_FlashCGI: - line = Kita::qcpToUnicode( lineList[i] ); - line2 = Kita::ParseFlashCGIOneLine( line ); - ba = Kita::unicodeToQcp( line2 ); + line = Kita::qcpToUnicode(lineList[i]); + line2 = Kita::ParseFlashCGIOneLine(line); + ba = Kita::unicodeToQcp(line2); break; default: - line = line2 = Kita::qcpToUnicode( lineList[i] ); + line = line2 = Kita::qcpToUnicode(lineList[i]); ba = lineList[i]; } - if ( line2.isEmpty() ) continue; + if (line2.isEmpty()) continue; /* add abone lines */ const char aboneStr[] = "abone<><><>abone<>"; - while ( nextNum > m_readNum + 1 ) { + while (nextNum > m_readNum + 1) { datLineList += aboneStr; m_threadData += aboneStr + '\n'; ++m_readNum; } /* save line */ - if ( m_bbstype == Board_MachiBBS ) m_threadData += ba + '\n'; + if (m_bbstype == Board_MachiBBS) m_threadData += ba + '\n'; else m_threadData += lineList[ i ] + '\n'; ++m_readNum; @@ -303,51 +303,51 @@ } /* call DatInfo::slotReceiveData() */ - emit receiveData( datLineList ); + emit receiveData(datLineList); } void Access::killJob() { - if ( m_currentJob ) m_currentJob->kill(); + if (m_currentJob) m_currentJob->kill(); } void Access::stopJob() { - if ( m_currentJob ) m_currentJob->kill(); /* emit result signal */ + if (m_currentJob) m_currentJob->kill(); /* emit result signal */ } int Access::serverTime() { - if ( m_currentJob ) m_header = m_currentJob->queryMetaData( "HTTP-Headers" ); - //if ( m_header.isEmpty() ) return QDateTime::currentDateTime().toTime_t(); + if (m_currentJob) m_header = m_currentJob->queryMetaData("HTTP-Headers"); + //if (m_header.isEmpty()) return QDateTime::currentDateTime().toTime_t(); // parse HTTP headers - QStringList headerList = m_header.split( '\n' ); - QRegExp regexp( "Date: (.*)" ); - QStringList dateStrList = headerList.filter( regexp ); - if ( dateStrList.isEmpty() || regexp.indexIn( dateStrList[0] ) == -1 ) { + QStringList headerList = m_header.split('\n'); + QRegExp regexp("Date: (.*)"); + QStringList dateStrList = headerList.filter(regexp); + if (dateStrList.isEmpty() || regexp.indexIn(dateStrList[0]) == -1) { // 'Date' header is not found. use current time. return QDateTime::currentDateTime().toTime_t(); } else { - return K3RFCDate::parseDate( regexp.cap( 1 ) ); + return K3RFCDate::parseDate(regexp.cap(1)); } } int Access::responseCode() { - if ( m_currentJob ) m_header = m_currentJob->queryMetaData( "HTTP-Headers" ); - //if ( m_header.isEmpty() ) return 200; + if (m_currentJob) m_header = m_currentJob->queryMetaData("HTTP-Headers"); + //if (m_header.isEmpty()) return 200; // parse HTTP headers - QStringList headerList = m_header.split( '\n' ); - QRegExp regexp( "HTTP/1\\.[01] ([0-9]+) .*" ); - QStringList dateStrList = headerList.filter( regexp ); - if ( dateStrList.isEmpty() || regexp.indexIn( dateStrList[0] ) == -1 ) { + QStringList headerList = m_header.split('\n'); + QRegExp regexp("HTTP/1\\.[01] ([0-9]+) .*"); + QStringList dateStrList = headerList.filter(regexp); + if (dateStrList.isEmpty() || regexp.indexIn(dateStrList[0]) == -1) { // invalid response - if ( m_bbstype == Board_JBBS ) return 200; /* adhoc... */ + if (m_bbstype == Board_JBBS) return 200; /* adhoc... */ return 0; } else { - return regexp.cap( 1 ).toInt(); + return regexp.cap(1).toInt(); } } @@ -368,66 +368,66 @@ // QString OfflawAccess::get() { - QString getURL = Kita::datToOfflaw( m_datURL.url() ); - KUrl kgetURL( getURL ); - kgetURL.addQueryItem( "sid", Account::getSessionID() ); + QString getURL = Kita::datToOfflaw(m_datURL.url()); + KUrl kgetURL(getURL); + kgetURL.addQueryItem("sid", Account::getSessionID()); m_threadData.clear(); m_invalidDataReceived = false; - KIO::SlaveConfig::self() ->setConfigData( "http", - KUrl( getURL ).host(), + KIO::SlaveConfig::self() ->setConfigData("http", + KUrl(getURL).host(), "UserAgent", - QString( "Monazilla/1.00 (Kita/%1)" ).arg( "0.200.0" ) ); // TODO + QString("Monazilla/1.00 (Kita/%1)").arg("0.200.0")); // TODO - KIO::TransferJob* job = KIO::get( kgetURL, KIO::Reload, KIO::HideProgressInfo ); + KIO::TransferJob* job = KIO::get(kgetURL, KIO::Reload, KIO::HideProgressInfo); m_currentJob = job; - connect( job, SIGNAL( data( KIO::Job*, const QByteArray& ) ), - SLOT( slotReceiveThreadData( KIO::Job*, const QByteArray& ) ) ); - connect( job, SIGNAL( result( KJob* ) ), SLOT( slotThreadResult( KJob* ) ) ); + connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), + SLOT(slotReceiveThreadData(KIO::Job*, const QByteArray&))); + connect(job, SIGNAL(result(KJob*)), SLOT(slotThreadResult(KJob*))); // use 'HTTP-Headers' metadata. - job->addMetaData( "PropagateHttpHeader", "true" ); + job->addMetaData("PropagateHttpHeader", "true"); return QString(); /* dummy */ } -void OfflawAccess::slotThreadResult( KIO::Job* job ) +void OfflawAccess::slotThreadResult(KIO::Job* job) { m_currentJob = 0; - if ( job->error() ) { + if (job->error()) { job->ui()->setWindow(0); job->ui()->showErrorMessage(); } else { - m_header = job->queryMetaData( "HTTP-Headers" ); + m_header = job->queryMetaData("HTTP-Headers"); } - if ( !m_invalidDataReceived && !m_threadData.isEmpty() ) { + if (!m_invalidDataReceived && !m_threadData.isEmpty()) { KUrl url = m_datURL; writeCacheData(); } emit finishLoad(); } -void OfflawAccess::slotReceiveThreadData( KIO::Job*, const QByteArray& data ) +void OfflawAccess::slotReceiveThreadData(KIO::Job*, const QByteArray& data) { - Q3CString cstr( data ); + Q3CString cstr(data); - if ( ( m_dataSize > 0 && responseCode() != 206 ) - || ( m_dataSize == 0 && responseCode() != 200 ) ) { + if ((m_dataSize > 0 && responseCode() != 206) + || (m_dataSize == 0 && responseCode() != 200)) { m_invalidDataReceived = true; } - if ( m_invalidDataReceived ) return ; + if (m_invalidDataReceived) return ; // "+OK ....../1024K\tLocation:temp/\n" - if ( m_threadData.isEmpty() && cstr[ 0 ] == '+' ) { + if (m_threadData.isEmpty() && cstr[ 0 ] == '+') { // skip first line. - int index = cstr.indexOf( '\n' ); - cstr = cstr.mid( index + 1 ); + int index = cstr.indexOf('\n'); + cstr = cstr.mid(index + 1); } - emitDatLineList( cstr ); + emitDatLineList(cstr); } #include "access.moc" Modified: kita/branches/KITA-KDE4/kita/src/libkita/access.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/access.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/access.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -32,7 +32,7 @@ Q_OBJECT public: - Access( const KUrl& datURL ); + Access(const KUrl& datURL); virtual ~Access() {}; void init(); @@ -41,14 +41,14 @@ void stopJob(); int serverTime(); void getcache(); - bool getupdate( int readNum ); + bool getupdate(int readNum); int responseCode(); int dataSize() const; bool invalidDataReceived() const; protected: void writeCacheData(); - void emitDatLineList( const QByteArray& dataStream ); + void emitDatLineList(const QByteArray& dataStream); const KUrl m_datURL; KIO::Job* m_currentJob; @@ -62,12 +62,12 @@ QByteArray m_lastLine; private slots: - void slotReceiveThreadData( KIO::Job* job, const QByteArray& data ); - void slotThreadResult( KJob* job ); + void slotReceiveThreadData(KIO::Job* job, const QByteArray& data); + void slotThreadResult(KJob* job); signals: - void redirection( const QString& ); - void receiveData( const QStringList& ); + void redirection(const QString&); + void receiveData(const QStringList&); void finishLoad(); private: Access(const Access&); @@ -79,14 +79,14 @@ Q_OBJECT public: - OfflawAccess( const KUrl& datURL ) : Access( datURL ) {}; + OfflawAccess(const KUrl& datURL) : Access(datURL) {}; virtual ~OfflawAccess() {}; QString get(); private slots: - void slotReceiveThreadData( KIO::Job* job, const QByteArray& data ); - void slotThreadResult( KIO::Job* job ); + void slotReceiveThreadData(KIO::Job* job, const QByteArray& data); + void slotThreadResult(KIO::Job* job); }; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/account.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/account.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/account.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -26,44 +26,44 @@ Account* Account::getInstance() { - if ( instance == 0 ) { + if (instance == 0) { instance = new Account(); } return instance; } Account::Account() - : m_isLogged( false ) + : m_isLogged(false) {} Account::~Account() {} -bool Account::login( const QString& userID, const QString& password ) +bool Account::login(const QString& userID, const QString& password) { - return getInstance() ->loginInternal( userID, password ); + return getInstance() ->loginInternal(userID, password); } -bool Account::loginInternal( const QString& userID, const QString& password ) +bool Account::loginInternal(const QString& userID, const QString& password) { - m_data.resize( 0 ); + m_data.resize(0); - KUrl url( "https://2chv.tora3.net/futen.cgi" ); - QString postData = QString( "ID=" ) + userID + QString( "&PW=" ) + password; + KUrl url("https://2chv.tora3.net/futen.cgi"); + QString postData = QString("ID=") + userID + QString("&PW=") + password; - KIO::SlaveConfig::self() ->setConfigData( "https", + KIO::SlaveConfig::self() ->setConfigData("https", url.host(), "UserAgent", - "DOLIB/1.00" ); - m_job = KIO::http_post( url, postData.toUtf8(), false ); + "DOLIB/1.00"); + m_job = KIO::http_post(url, postData.toUtf8(), false); - connect( m_job, SIGNAL( data( KIO::Job*, const QByteArray& ) ), - SLOT( slotReceiveData( KIO::Job*, const QByteArray& ) ) ); - connect( m_job, SIGNAL( result( KIO::Job* ) ), SLOT( slotResult( KIO::Job* ) ) ); - m_job->addMetaData( "customHTTPHeader", - QString( "X-2ch-UA: Kita/%1" ).arg( "0.200.0" ) ); - m_job->addMetaData( "content-type", - "Content-Type: application/x-www-form-urlencoded" ); + connect(m_job, SIGNAL(data(KIO::Job*, const QByteArray&)), + SLOT(slotReceiveData(KIO::Job*, const QByteArray&))); + connect(m_job, SIGNAL(result(KIO::Job*)), SLOT(slotResult(KIO::Job*))); + m_job->addMetaData("customHTTPHeader", + QString("X-2ch-UA: Kita/%1").arg("0.200.0")); + m_job->addMetaData("content-type", + "Content-Type: application/x-www-form-urlencoded"); QEventLoop m_eventLoop; m_eventLoop.exec(); @@ -71,30 +71,30 @@ return m_isLogged; } -void Account::slotReceiveData( KIO::Job*, const QByteArray& data ) +void Account::slotReceiveData(KIO::Job*, const QByteArray& data) { - Q3CString str( data, data.size() ); + Q3CString str(data, data.size()); m_data += str; } -void Account::slotResult( KIO::Job* job ) +void Account::slotResult(KIO::Job* job) { m_job = 0; - if ( job->error() ) { + if (job->error()) { job->ui()->setWindow(0); job->ui()->showErrorMessage(); } - QString str( m_data ); - QRegExp regexp( "SESSION-ID=(.*)" ); - if ( regexp.indexIn( str ) == -1 ) { + QString str(m_data); + QRegExp regexp("SESSION-ID=(.*)"); + if (regexp.indexIn(str) == -1) { m_sessionID.clear(); m_isLogged = false; } else { - QString value = regexp.cap( 1 ); + QString value = regexp.cap(1); - QRegExp error( "^ERROR:p+$" ); - if ( error.indexIn( value ) == -1 ) { + QRegExp error("^ERROR:p+$"); + if (error.indexIn(value) == -1) { m_isLogged = true; m_sessionID = value; } else { Modified: kita/branches/KITA-KDE4/kita/src/libkita/account.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/account.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/account.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -41,18 +41,18 @@ Account(); ~Account(); void enter_loop(); - bool loginInternal( const QString& userID, const QString& password ); + bool loginInternal(const QString& userID, const QString& password); static Account* getInstance(); private slots: - void slotReceiveData( KIO::Job* job, const QByteArray& data ); - void slotResult( KIO::Job* job ); + void slotReceiveData(KIO::Job* job, const QByteArray& data); + void slotResult(KIO::Job* job); private: Account(const Account&); Account& operator=(const Account&); public: static const QString& getSessionID() { return getInstance() ->m_sessionID; } static bool isLogged() { return getInstance() ->m_isLogged; } - static bool login( const QString& userID, const QString& password ); + static bool login(const QString& userID, const QString& password); }; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -40,13 +40,13 @@ /* BoardData */ -BoardData::BoardData( const QString& boardName, +BoardData::BoardData(const QString& boardName, const QString& hostname, const QString& rootPath, const QString& delimiter, const QString& bbsPath, const QString& ext, - int boardtype ) + int boardtype) { m_readIdx = false; m_boardName = boardName; @@ -57,14 +57,14 @@ m_type = boardtype; /* set hostname and create URL of board */ - setHostName( hostname ); + setHostName(hostname); /* create default key */ - QStringList keyHosts( m_hostname ); - createKeys( keyHosts ); + QStringList keyHosts(m_hostname); + createKeys(keyHosts); /* reset SETTING.TXT */ - setSettingLoaded( false ); + setSettingLoaded(false); } BoardData::~BoardData() @@ -72,17 +72,17 @@ /* public */ -void BoardData::setHostName( const QString& hostName ) +void BoardData::setHostName(const QString& hostName) { m_hostname = hostName; /* m_basePath = (hostname)/(rootPath)/(bbsPath)/ */ m_basePath = m_hostname + m_rootPath + m_bbsPath + '/'; - switch ( m_type ) { + switch (m_type) { case Board_MachiBBS: /* m_cgiBasePath = (hostname)/(rootPath)/(delimiter)?BBS=(bbsPath) */ - m_cgiBasePath = m_hostname + m_rootPath + m_delimiter + "?BBS=" + m_bbsPath.mid( 1 ); + m_cgiBasePath = m_hostname + m_rootPath + m_delimiter + "?BBS=" + m_bbsPath.mid(1); break; /* m_cgiBasePath = (hostname)/(rootPath)/(delimiter)/(bbsPath)/ */ @@ -103,7 +103,7 @@ } /* public */ -void BoardData::setReadIdx( bool idx ) +void BoardData::setReadIdx(bool idx) { m_readIdx = idx; } @@ -203,10 +203,10 @@ } /* public */ -void BoardData::setSettingLoaded( bool set ) +void BoardData::setSettingLoaded(bool set) { m_settingLoaded = set; - if ( ! set ) { + if (! set) { m_defaultName.clear(); m_linenum = 0; m_msgCount = 0; @@ -215,25 +215,25 @@ } /* public */ -void BoardData::setDefaultName( const QString& newName ) +void BoardData::setDefaultName(const QString& newName) { m_defaultName = newName; } /* public */ -void BoardData::setLineNum( int newLine ) +void BoardData::setLineNum(int newLine) { m_linenum = newLine; } /* public */ -void BoardData::setMsgCount( int msgCount ) +void BoardData::setMsgCount(int msgCount) { m_msgCount = msgCount; } /* public */ -void BoardData::setTitleImgURL( const KUrl& url ) +void BoardData::setTitleImgURL(const KUrl& url) { m_titleImgURL = url; } @@ -243,7 +243,7 @@ /* keys */ /* create keys of DB */ /* public */ -void BoardData::createKeys( const QStringList& keyHostList ) +void BoardData::createKeys(const QStringList& keyHostList) { /* reset keys */ m_keyBasePathList.clear(); @@ -253,22 +253,22 @@ m_keyHostList = keyHostList; /* m_basePath = (hostname)/(rootPath)/(bbsPath)/ */ - for ( int i = 0; i < m_keyHostList.count(); ++i ) { - if ( m_keyHostList[ i ].length() > 0 ) + for (int i = 0; i < m_keyHostList.count(); ++i) { + if (m_keyHostList[ i ].length() > 0) m_keyBasePathList += m_keyHostList[ i ] + m_rootPath + m_bbsPath + '/'; } - switch ( m_type ) { + switch (m_type) { case Board_MachiBBS: /* m_cgiBasePath = (hostname)/(rootPath)/(delimiter)?BBS=(bbsPath) */ - for ( int i = 0; i < m_keyHostList.count(); ++i ) + for (int i = 0; i < m_keyHostList.count(); ++i) m_keyCgiBasePathList += m_keyHostList[ i ] + m_rootPath + m_delimiter - + "?BBS=" + m_bbsPath.mid( 1 ); + + "?BBS=" + m_bbsPath.mid(1); break; /* m_cgiBasePath = (hostname)/(rootPath)/(delimiter)/(bbsPath)/ */ default: - for ( int i = 0; i < m_keyHostList.count(); ++i ) + for (int i = 0; i < m_keyHostList.count(); ++i) m_keyCgiBasePathList += m_keyHostList[ i ] + m_rootPath + m_delimiter + m_bbsPath + '/'; break; } @@ -320,10 +320,10 @@ } /* (hostname)/(rootPath)/(bbsPath)/ */ /* public */ /* static */ -const QString BoardManager::boardURL( const KUrl& url ) +const QString BoardManager::boardURL(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == 0 ) return QString(); + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->basePath(); } @@ -334,74 +334,74 @@ QStringList urlList; urlList.clear(); - for ( BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it ) - urlList += ( *it ) ->basePath(); + for (BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it) + urlList += (*it) ->basePath(); return urlList; } /* (hostname)/(rootPath) */ /* public */ /* static */ -const QString BoardManager::boardRoot( const KUrl& url ) +const QString BoardManager::boardRoot(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == 0 ) return QString(); + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->hostName() + bdata->rootPath(); } /* (bbspath) */ /* public */ /* static */ -const QString BoardManager::boardPath( const KUrl& url ) +const QString BoardManager::boardPath(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == 0 ) return QString(); + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->bbsPath(); } /* (ext) */ /* public */ /* static */ -const QString BoardManager::ext( const KUrl& url ) +const QString BoardManager::ext(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == 0 ) return QString(); + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->ext(); } /* ID of board for writing */ /* public */ /* static */ -const QString BoardManager::boardID( const KUrl& url ) +const QString BoardManager::boardID(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == 0 ) return QString(); + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); - return bdata->bbsPath().mid( 1 ); /* remove "/" */ + return bdata->bbsPath().mid(1); /* remove "/" */ } /* (hostname)/(rootPath)/(bbsPath)/subject.txt */ /* public */ /* static */ -const QString BoardManager::subjectURL( const KUrl& url ) +const QString BoardManager::subjectURL(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == 0 ) return QString(); + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->basePath() + "subject.txt"; } /* public */ /* static */ -const QString BoardManager::boardName( const KUrl& url ) +const QString BoardManager::boardName(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == 0 ) return QString(); + BoardData * bdata = getBoardData(url); + if (bdata == 0) return QString(); return bdata->boardName(); } /* public */ /* static */ -int BoardManager::type( const KUrl& url ) +int BoardManager::type(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == 0 ) return Board_Unknown; + BoardData * bdata = getBoardData(url); + if (bdata == 0) return Board_Unknown; return bdata->type(); } @@ -434,20 +434,20 @@ /* output */ Q3PtrList< Thread >& threadList, - Q3PtrList< Thread >& oldLogList ) + Q3PtrList< Thread >& oldLogList) { threadList.clear(); oldLogList.clear(); /* get all obtained threads list from cache */ - if ( url.prettyUrl() == "http://virtual/obtained/" ) { + if (url.prettyUrl() == "http://virtual/obtained/") { QStringList bbslist = allBoardURLList(); /* search all cache dirs */ - for ( QStringList::iterator it = bbslist.begin() ; it != bbslist.end(); ++it ) { + for (QStringList::iterator it = bbslist.begin() ; it != bbslist.end(); ++it) { - getCachedThreadList( ( *it ), threadList ); + getCachedThreadList((*it), threadList); } return ; @@ -455,70 +455,70 @@ /*-------------------------*/ - BoardData* bdata = getBoardData( url ); - if ( bdata == 0 ) return ; + BoardData* bdata = getBoardData(url); + if (bdata == 0) return ; /* download subject.txt */ - if ( online ) { + if (online) { /* make directory */ - QString cacheDir = Cache::baseDir() + Cache::serverDir( url ) + Cache::boardDir( url ); - if ( !Kita::mkdir( cacheDir ) ) return ; + QString cacheDir = Cache::baseDir() + Cache::serverDir(url) + Cache::boardDir(url); + if (!Kita::mkdir(cacheDir)) return ; - KIO::SlaveConfig::self() ->setConfigData( "http", + KIO::SlaveConfig::self() ->setConfigData("http", url.host() , "UserAgent", - QString( "Monazilla/1.00 (Kita/%1)" ).arg( "0.200.0" ) ); - QString subjectPath = Cache::getSubjectPath( url ); - KIO::NetAccess::download( subjectURL( url ), subjectPath, 0 ); + QString("Monazilla/1.00 (Kita/%1)").arg("0.200.0")); + QString subjectPath = Cache::getSubjectPath(url); + KIO::NetAccess::download(subjectURL(url), subjectPath, 0); } /* open and read subject.txt */ - readSubjectTxt( bdata, url, threadList ); + readSubjectTxt(bdata, url, threadList); /* get old logs */ - if ( oldLogs ) { + if (oldLogs) { Q3PtrList< Thread > tmpList; tmpList.clear(); - getCachedThreadList( url, tmpList ); + getCachedThreadList(url, tmpList); - for ( unsigned i = 0; i < tmpList.count(); i++ ) { + for (unsigned i = 0; i < tmpList.count(); i++) { - if ( threadList.contains( tmpList.at( i ) ) == 0 ) oldLogList.append( tmpList.at( i ) ); + if (threadList.contains(tmpList.at(i)) == 0) oldLogList.append(tmpList.at(i)); } } } /* read the cache dir & get the list of all threads. */ /* private */ /* static */ -void BoardManager::getCachedThreadList( const KUrl& url, Q3PtrList< Thread >& threadList ) +void BoardManager::getCachedThreadList(const KUrl& url, Q3PtrList< Thread >& threadList) { - QString cacheDir = Cache::baseDir() + Cache::serverDir( url ) + Cache::boardDir( url ); - QDir d( cacheDir ); - if ( d.exists() ) { + QString cacheDir = Cache::baseDir() + Cache::serverDir(url) + Cache::boardDir(url); + QDir d(cacheDir); + if (d.exists()) { /* get all file names */ - QString ext = BoardManager::getBoardData( url ) ->ext(); - QString boardURL = BoardManager::getBoardData( url ) ->basePath(); + QString ext = BoardManager::getBoardData(url) ->ext(); + QString boardURL = BoardManager::getBoardData(url) ->basePath(); QStringList filter('*' + ext); QStringList flist = d.entryList(filter); - for ( QStringList::iterator it = flist.begin(); it != flist.end(); ++it ) { - if ( ( *it ).isEmpty() ) continue; + for (QStringList::iterator it = flist.begin(); it != flist.end(); ++it) { + if ((*it).isEmpty()) continue; - QString datURL = boardURL + "dat/" + ( *it ); + QString datURL = boardURL + "dat/" + (*it); /* read idx file */ - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread == 0 ) { + Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + if (thread == 0) { - thread = Kita::Thread::getByURL( datURL ); - if ( thread == 0 ) continue; - ThreadIndex::loadIndex( thread, datURL, false ); + thread = Kita::Thread::getByURL(datURL); + if (thread == 0) continue; + ThreadIndex::loadIndex(thread, datURL, false); } - if ( thread != 0 ) threadList.append( thread ); + if (thread != 0) threadList.append(thread); } } } @@ -526,88 +526,88 @@ /* open subject.txt and get list of Thread classes */ /* private */ /* static */ -bool BoardManager::readSubjectTxt( BoardData* bdata, const KUrl& url, Q3PtrList< Thread >& threadList ) +bool BoardManager::readSubjectTxt(BoardData* bdata, const KUrl& url, Q3PtrList< Thread >& threadList) { /* get all names of cached files to read idx. */ QStringList cacheList; - if ( !bdata->readIdx() ) { + if (!bdata->readIdx()) { - QString cacheDir = Cache::baseDir() + Cache::serverDir( url ) + Cache::boardDir( url ); - QDir d( cacheDir ); - if ( d.exists() ) { - QString ext = BoardManager::getBoardData( url ) ->ext(); + QString cacheDir = Cache::baseDir() + Cache::serverDir(url) + Cache::boardDir(url); + QDir d(cacheDir); + if (d.exists()) { + QString ext = BoardManager::getBoardData(url) ->ext(); QStringList filter('*' + ext); - cacheList = d.entryList( filter ); + cacheList = d.entryList(filter); } } /* open subject.txt */ - QString subjectPath = Cache::getSubjectPath( url ); - QIODevice * device = KFilterDev::deviceForFile( subjectPath, "application/x-gzip" ); - if ( !device->open( QIODevice::ReadOnly ) ) return false; + QString subjectPath = Cache::getSubjectPath(url); + QIODevice * device = KFilterDev::deviceForFile(subjectPath, "application/x-gzip"); + if (!device->open(QIODevice::ReadOnly)) return false; - Q3TextStream stream( device ); + Q3TextStream stream(device); - if ( BoardManager::type( url ) == Board_JBBS ) { - if ( !m_eucJpCodec ) m_eucJpCodec = QTextCodec::codecForName("eucJP"); - stream.setCodec( m_eucJpCodec ); + if (BoardManager::type(url) == Board_JBBS) { + if (!m_eucJpCodec) m_eucJpCodec = QTextCodec::codecForName("eucJP"); + stream.setCodec(m_eucJpCodec); } else { - if ( !m_cp932Codec ) m_cp932Codec = QTextCodec::codecForName("Shift-JIS"); // FIXME - stream.setCodec( m_cp932Codec ); + if (!m_cp932Codec) m_cp932Codec = QTextCodec::codecForName("Shift-JIS"); // FIXME + stream.setCodec(m_cp932Codec); } QRegExp regexp; - switch ( BoardManager::type( url ) ) { + switch (BoardManager::type(url)) { case Board_MachiBBS: case Board_JBBS: - regexp.setPattern( "(\\d+\\.cgi),(.*)\\((\\d+)\\)" ); + regexp.setPattern("(\\d+\\.cgi),(.*)\\((\\d+)\\)"); break; default: - regexp.setPattern( "(\\d+\\.dat)<>(.*)\\((\\d+)\\)" ); + regexp.setPattern("(\\d+\\.dat)<>(.*)\\((\\d+)\\)"); break; } QString line; - while ( !( line = stream.readLine() ).isEmpty() ) { - int pos = regexp.indexIn( line ); - if ( pos != -1 ) { - QString fname = regexp.cap( 1 ); - QString subject = regexp.cap( 2 ); - QString num = regexp.cap( 3 ); + while (!(line = stream.readLine()).isEmpty()) { + int pos = regexp.indexIn(line); + if (pos != -1) { + QString fname = regexp.cap(1); + QString subject = regexp.cap(2); + QString num = regexp.cap(3); /* get pointer of Thread class */ - QString datURL = boardURL( url ) + "dat/" + fname; - Kita::Thread* thread = Kita::Thread::getByURL( datURL ); - if ( threadList.find( thread ) == -1 ) { - threadList.append( thread ); + QString datURL = boardURL(url) + "dat/" + fname; + Kita::Thread* thread = Kita::Thread::getByURL(datURL); + if (threadList.find(thread) == -1) { + threadList.append(thread); } /* set thread name */ - thread->setThreadName( subject ); + thread->setThreadName(subject); /* load index file */ - if ( !bdata->readIdx() ) { + if (!bdata->readIdx()) { - if ( cacheList.contains( fname ) ) ThreadIndex::loadIndex( thread, datURL, false ); + if (cacheList.contains(fname)) ThreadIndex::loadIndex(thread, datURL, false); } /* update res num */ int newNum = num.toInt(); - if ( thread->readNum() ) { /* cache exists */ + if (thread->readNum()) { /* cache exists */ int oldNum = thread->resNum(); - if ( newNum > oldNum ) { - Kita::ThreadIndex::setResNum( datURL, newNum ); + if (newNum > oldNum) { + Kita::ThreadIndex::setResNum(datURL, newNum); } } - thread->setResNum( newNum ); + thread->setResNum(newNum); } } device->close(); - bdata->setReadIdx( true ); /* never read idx files again */ + bdata->setReadIdx(true); /* never read idx files again */ return true; } @@ -618,8 +618,8 @@ /* reset all BoardData */ /* public */ /* static */ void BoardManager::clearBoardData() { - for ( BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it ) - delete( *it ); + for (BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it) + delete(*it); m_boardDataList.clear(); m_previousBoardData = 0; @@ -648,41 +648,41 @@ * */ /* public */ /* static */ -int BoardManager::enrollBoard( const KUrl& url, const QString& boardName, QString& oldURL, int type, bool test ) +int BoardManager::enrollBoard(const KUrl& url, const QString& boardName, QString& oldURL, int type, bool test) { QString hostname; QString rootPath; QString delimiter; QString bbsPath; QString ext; - type = parseBoardURL( url, type, hostname, rootPath, delimiter, bbsPath, ext ); + type = parseBoardURL(url, type, hostname, rootPath, delimiter, bbsPath, ext); oldURL.clear(); - if ( type == Board_Unknown ) return Board_enrollFailed; + if (type == Board_Unknown) return Board_enrollFailed; /* check if the board is enrolled or moved. */ - for ( BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it ) { + for (BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it) { - if ( ( *it ) ->boardName() == boardName - && ( *it ) ->type() == type - && ( *it ) ->bbsPath() == bbsPath ) { + if ((*it) ->boardName() == boardName + && (*it) ->type() == type + && (*it) ->bbsPath() == bbsPath) { - if ( ( *it ) ->hostName() == hostname - && ( *it ) ->rootPath() == rootPath ) { /* enrolled */ + if ((*it) ->hostName() == hostname + && (*it) ->rootPath() == rootPath) { /* enrolled */ return Board_enrollEnrolled; } else { /* moved */ - oldURL = ( *it ) ->basePath(); + oldURL = (*it) ->basePath(); return Board_enrollMoved; } } } /* test only */ - if ( test ) return Board_enrollNew; + if (test) return Board_enrollNew; /* enroll new board */ - BoardData* bdata = new BoardData( boardName, hostname, rootPath, delimiter, bbsPath, ext, type ); - m_boardDataList.append( bdata ); + BoardData* bdata = new BoardData(boardName, hostname, rootPath, delimiter, bbsPath, ext, type); + m_boardDataList.append(bdata); return Board_enrollNew; } @@ -701,7 +701,7 @@ QString& rootPath, QString& delimiter, QString& bbsPath, - QString& ext ) + QString& ext) { hostname = url.protocol() + "://" + url.host(); rootPath.clear(); @@ -710,15 +710,15 @@ ext.clear(); /* decide type */ - if ( type == Board_Unknown ) { + if (type == Board_Unknown) { - if ( url.host().contains( "machi.to" ) ) type = Board_MachiBBS; - else if ( url.host().contains( "jbbs.livedoor.jp" ) ) type = Board_JBBS; + if (url.host().contains("machi.to")) type = Board_MachiBBS; + else if (url.host().contains("jbbs.livedoor.jp")) type = Board_JBBS; else type = Board_2ch; } /* parse */ - switch ( type ) { + switch (type) { case Board_MachiBBS: /* MACHI : http:// *.machi.to/(bbsPath)/ */ @@ -730,7 +730,7 @@ case Board_JBBS: /* JBBS : http://jbbs.livedoor.jp/(bbsPath)/ */ delimiter = "/bbs/read.cgi"; - bbsPath = url.prettyUrl().remove( hostname ); + bbsPath = url.prettyUrl().remove(hostname); type = Board_JBBS; ext = ".cgi"; break; @@ -739,8 +739,8 @@ delimiter = "/test/read.cgi"; bbsPath = url.fileName(); - rootPath = url.prettyUrl().remove( hostname + '/' ).remove( bbsPath + '/' ); - if ( rootPath.length() == 0 ) rootPath.clear(); + rootPath = url.prettyUrl().remove(hostname + '/').remove(bbsPath + '/'); + if (rootPath.length() == 0) rootPath.clear(); ext = ".dat"; break; @@ -748,53 +748,53 @@ delimiter = "/test/read.cgi"; bbsPath = url.fileName(); - rootPath = url.prettyUrl().remove( hostname + '/' ).remove( bbsPath + '/' ); - if ( rootPath.length() == 0 ) rootPath.clear(); + rootPath = url.prettyUrl().remove(hostname + '/').remove(bbsPath + '/'); + if (rootPath.length() == 0) rootPath.clear(); ext = ".dat"; type = Board_2ch; break; } /* For example, if bbsPath = "linux/", then m_bbsPath = "/linux" */ - const QRegExp exp( "/$" ); - rootPath.remove( exp ); - bbsPath.remove( exp ); - if ( !rootPath.isEmpty() && rootPath.at( 0 ) != '/' ) rootPath = '/' + rootPath; - if ( !bbsPath.isEmpty() && bbsPath.at( 0 ) != '/' ) bbsPath = '/' + bbsPath; + const QRegExp exp("/$"); + rootPath.remove(exp); + bbsPath.remove(exp); + if (!rootPath.isEmpty() && rootPath.at(0) != '/') rootPath = '/' + rootPath; + if (!bbsPath.isEmpty() && bbsPath.at(0) != '/') bbsPath = '/' + bbsPath; return type; } /* public */ /* static */ -bool BoardManager::isEnrolled( const KUrl& url ) +bool BoardManager::isEnrolled(const KUrl& url) { - if ( getBoardData( url ) == 0 ) return false; + if (getBoardData(url) == 0) return false; return true; } /* public */ /* static */ -BoardData* BoardManager::getBoardData( const KUrl& url ) +BoardData* BoardManager::getBoardData(const KUrl& url) { - if ( url.isEmpty() ) return 0; + if (url.isEmpty()) return 0; QString urlstr = url.prettyUrl(); /* cache */ - if ( m_previousBoardData != 0 && m_previousBoardURL == urlstr ) return m_previousBoardData; + if (m_previousBoardData != 0 && m_previousBoardURL == urlstr) return m_previousBoardData; - for ( BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it ) { + for (BoardDataList::Iterator it = m_boardDataList.begin(); it != m_boardDataList.end(); ++it) { - int count = ( *it ) ->keyBasePathList().count(); - for ( int i = 0; i < count ; ++i ) { - if ( urlstr.contains( ( *it ) ->keyBasePathList() [ i ] ) - || urlstr.contains( ( *it ) ->keyCgiBasePathList() [ i ] ) ) { + int count = (*it) ->keyBasePathList().count(); + for (int i = 0; i < count ; ++i) { + if (urlstr.contains((*it) ->keyBasePathList() [ i ]) + || urlstr.contains((*it) ->keyCgiBasePathList() [ i ])) { /* cache */ - m_previousBoardData = ( *it ); + m_previousBoardData = (*it); m_previousBoardURL = urlstr; - return ( *it ); + return (*it); } } } @@ -808,7 +808,7 @@ /* BBSHISTORY */ -/* load the bbs history file ( BBSHISTORY ), and create keys of Data Base. */ +/* load the bbs history file (BBSHISTORY), and create keys of Data Base. */ /* Before calling this, enroll the board by enrollBoard(). */ /* ex) If the host of board moved like : @@ -822,26 +822,26 @@ http://aaa.com */ /* public */ /* static */ -bool BoardManager::loadBBSHistory( const KUrl& url ) +bool BoardManager::loadBBSHistory(const KUrl& url) { - BoardData * bdata = getBoardData( url ); - if ( bdata == 0 ) return false; + BoardData * bdata = getBoardData(url); + if (bdata == 0) return false; QStringList keyHosts(bdata->hostName()); - QFile file( Cache::getBBSHistoryPath( url ) ); - if ( file.open( QIODevice::ReadOnly ) ) { + QFile file(Cache::getBBSHistoryPath(url)); + if (file.open(QIODevice::ReadOnly)) { - Q3TextStream ts( &file ); + Q3TextStream ts(&file); QString line; - while ( !ts.eof() ) { + while (!ts.eof()) { line = ts.readLine(); keyHosts += line; } - bdata->createKeys( keyHosts ); + bdata->createKeys(keyHosts); file.close(); return true; @@ -852,28 +852,28 @@ /* public */ /* static */ -bool BoardManager::moveBoard( const KUrl& fromURL, const KUrl& toURL ) +bool BoardManager::moveBoard(const KUrl& fromURL, const KUrl& toURL) { QString oldhost = fromURL.protocol() + "://" + fromURL.host(); QString newhost = toURL.protocol() + "://" + toURL.host(); - const QRegExp exp( "/$" ); + const QRegExp exp("/$"); QString oldURL = fromURL.prettyUrl(); QString newURL = toURL.prettyUrl(); - oldURL.remove( exp ); - newURL.remove( exp ); + oldURL.remove(exp); + newURL.remove(exp); oldURL += '/'; newURL += '/'; - if ( oldURL == newURL ) return false; + if (oldURL == newURL) return false; /* Is oldURL enrolled? */ - BoardData* bdata = getBoardData( oldURL ); - if ( bdata == 0 ) { + BoardData* bdata = getBoardData(oldURL); + if (bdata == 0) { /* Is newURL enrolled? */ - bdata = getBoardData( newURL ); - if ( bdata == 0 ) return false; + bdata = getBoardData(newURL); + if (bdata == 0) return false; } @@ -881,16 +881,16 @@ /* update BoardData */ /* get the path of old cache */ - bdata->setHostName( oldhost ); + bdata->setHostName(oldhost); QStringList keyHosts = bdata->keyHostList(); - keyHosts.removeOne( oldhost ); - keyHosts.prepend( oldhost ); - bdata->createKeys( keyHosts ); - QString oldCachePath = Cache::baseDir() + Cache::serverDir( bdata->basePath() ) - + Cache::boardDir( bdata->basePath() ); + keyHosts.removeOne(oldhost); + keyHosts.prepend(oldhost); + bdata->createKeys(keyHosts); + QString oldCachePath = Cache::baseDir() + Cache::serverDir(bdata->basePath()) + + Cache::boardDir(bdata->basePath()); /* update URL */ - bdata->setHostName( newhost ); + bdata->setHostName(newhost); /* update keys */ /* The order of keyHosts will be like this: @@ -902,49 +902,49 @@ */ keyHosts = bdata->keyHostList(); - keyHosts.removeOne( oldhost ); - keyHosts.prepend( oldhost ); - keyHosts.removeOne( newhost ); - keyHosts.prepend( newhost ); - bdata->createKeys( keyHosts ); + keyHosts.removeOne(oldhost); + keyHosts.prepend(oldhost); + keyHosts.removeOne(newhost); + keyHosts.prepend(newhost); + bdata->createKeys(keyHosts); /* reset BoardData */ - bdata->setReadIdx( false ); - bdata->setSettingLoaded( false ); + bdata->setReadIdx(false); + bdata->setSettingLoaded(false); /*---------------------------*/ /* move cache dir */ QDir qdir; - if ( ! qdir.exists( oldCachePath ) ) return true; + if (! qdir.exists(oldCachePath)) return true; /* mkdir new server dir */ - QString newCachePath = Cache::baseDir() + Cache::serverDir( bdata->basePath() ); - Kita::mkdir( newCachePath ); + QString newCachePath = Cache::baseDir() + Cache::serverDir(bdata->basePath()); + Kita::mkdir(newCachePath); /* backup old dir */ - newCachePath += Cache::boardDir( bdata->basePath() ); - if ( qdir.exists ( newCachePath ) ) { + newCachePath += Cache::boardDir(bdata->basePath()); + if (qdir.exists (newCachePath)) { QString bkupPath = newCachePath; - bkupPath.truncate( bkupPath.length() - 1 ); /* remove '/' */ - bkupPath += '.' + QString().setNum( QDateTime::currentDateTime().toTime_t() ); - qdir.rename( newCachePath, bkupPath ); + bkupPath.truncate(bkupPath.length() - 1); /* remove '/' */ + bkupPath += '.' + QString().setNum(QDateTime::currentDateTime().toTime_t()); + qdir.rename(newCachePath, bkupPath); } /* move cache dir */ - if ( qdir.exists( oldCachePath ) ) { - qdir.rename( oldCachePath, newCachePath ); - } else Kita::mkdir( newCachePath ); + if (qdir.exists(oldCachePath)) { + qdir.rename(oldCachePath, newCachePath); + } else Kita::mkdir(newCachePath); /* make old dir */ - if ( ! qdir.exists( oldCachePath ) ) { - Kita::mkdir( oldCachePath ); + if (! qdir.exists(oldCachePath)) { + Kita::mkdir(oldCachePath); /* create BBS_MOVED */ QString movedPath = oldCachePath + "/BBS_MOVED"; - QFile file( movedPath ); - if ( file.open( QIODevice::WriteOnly ) ) { - Q3TextStream stream( &file ); + QFile file(movedPath); + if (file.open(QIODevice::WriteOnly)) { + Q3TextStream stream(&file); stream << newURL << endl; } file.close(); @@ -953,14 +953,14 @@ /*---------------------------*/ /* update BBSHISTRY */ - QFile file( Cache::getBBSHistoryPath( bdata->basePath() ) ); - if ( file.open( QIODevice::WriteOnly ) ) { + QFile file(Cache::getBBSHistoryPath(bdata->basePath())); + if (file.open(QIODevice::WriteOnly)) { - Q3TextStream ts( &file ); + Q3TextStream ts(&file); - keyHosts.removeOne( newhost ); - for ( QStringList::iterator it = keyHosts.begin() ; it != keyHosts.end(); ++it ) { - ts << ( *it ) << endl; + keyHosts.removeOne(newhost); + for (QStringList::iterator it = keyHosts.begin() ; it != keyHosts.end(); ++it) { + ts << (*it) << endl; } file.close(); @@ -969,10 +969,10 @@ /*---------------------------*/ /* update other information */ - FavoriteThreads::replace( oldURL, newURL ); - Kita::Thread::replace( oldURL, newURL ); - KitaThreadInfo::replace( oldURL, newURL ); - Kita::FavoriteBoards::replace( oldURL, newURL ); + FavoriteThreads::replace(oldURL, newURL); + Kita::Thread::replace(oldURL, newURL); + KitaThreadInfo::replace(oldURL, newURL); + Kita::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-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -74,16 +74,16 @@ QStringList m_keyCgiBasePathList; public: - BoardData( const QString& boardName, const QString& hostname, + BoardData(const QString& boardName, const QString& hostname, const QString& rootPath, const QString& delimiter, - const QString& bbsPath, const QString& ext, int boardtype ); + const QString& bbsPath, const QString& ext, int boardtype); ~BoardData(); - void setHostName( const QString& hostname ); + void setHostName(const QString& hostname); /* information */ bool readIdx() const; - void setReadIdx( bool idx ); + void setReadIdx(bool idx); const QString& boardName() const; const QString& hostName() const; const QString& rootPath() const; @@ -102,14 +102,14 @@ int lineNum() const; int msgCount() const; const KUrl& titleImgURL() const; - void setSettingLoaded( bool set ); - void setDefaultName( const QString& newName ); - void setLineNum( int newLine ); - void setMsgCount( int msgCount ); - void setTitleImgURL( const KUrl& url ); + void setSettingLoaded(bool set); + void setDefaultName(const QString& newName); + void setLineNum(int newLine); + void setMsgCount(int msgCount); + void setTitleImgURL(const KUrl& url); /* keys */ - void createKeys( const QStringList& keyHostList ); + void createKeys(const QStringList& keyHostList); const QStringList& keyHostList() const; const QStringList& keyBasePathList() const; const QStringList& keyCgiBasePathList() const; @@ -135,46 +135,46 @@ BoardManager(); ~BoardManager(); - static const QString boardURL( const KUrl& url ); + static const QString boardURL(const KUrl& url); static const QStringList allBoardURLList(); - static const QString boardRoot( const KUrl& url ); - static const QString boardPath( const KUrl& url ); - static const QString ext( const KUrl& url ); - static const QString boardID( const KUrl& url ); - static const QString subjectURL( const KUrl& url ); - static const QString boardName( const KUrl& url ); - static int type( const KUrl& url ); + static const QString boardRoot(const KUrl& url); + static const QString boardPath(const KUrl& url); + static const QString ext(const KUrl& url); + static const QString boardID(const KUrl& url); + static const QString subjectURL(const KUrl& url); + static const QString boardName(const KUrl& url); + static int type(const KUrl& url); /* ThreadList */ - static void getThreadList( const KUrl& url, bool oldLogs, bool online, - Q3PtrList< Thread >& threadList, Q3PtrList< Thread >& oldLogList ); + static void getThreadList(const KUrl& url, bool oldLogs, bool online, + Q3PtrList< Thread >& threadList, Q3PtrList< Thread >& oldLogList); /* BoardData */ static void clearBoardData(); - static int enrollBoard( const KUrl& url, const QString& boardName, QString& oldURL, - int type = Board_Unknown, bool test = false ); - static bool isEnrolled( const KUrl& url ); - static BoardData* getBoardData( const KUrl& url ); + static int enrollBoard(const KUrl& url, const QString& boardName, QString& oldURL, + int type = Board_Unknown, bool test = false); + static bool isEnrolled(const KUrl& url); + static BoardData* getBoardData(const KUrl& url); /* BBSHISTORY */ - static bool loadBBSHistory( const KUrl& url ); - static bool moveBoard( const KUrl& fromURL, const KUrl& toURL ); + static bool loadBBSHistory(const KUrl& url); + static bool moveBoard(const KUrl& fromURL, const KUrl& toURL); private: /* BoardData */ - static int parseBoardURL( const KUrl& url, int type, QString& hostname, + static int parseBoardURL(const KUrl& url, int type, QString& hostname, QString& rootPath, QString& delimiter, - QString& bbsPath, QString& ext ); + QString& bbsPath, QString& ext); /* ThreadList */ - static void getCachedThreadList( const KUrl& url, Q3PtrList< Thread >& threadList ); - static bool readSubjectTxt( BoardData* bdata, const KUrl& url, Q3PtrList< Thread >& threadList ); + static void getCachedThreadList(const KUrl& url, Q3PtrList< Thread >& threadList); + static bool readSubjectTxt(BoardData* bdata, const KUrl& url, Q3PtrList< Thread >& threadList); /* SETTING.TXT */ - static BoardData* openSettingTxt( const KUrl& url ); + static BoardData* openSettingTxt(const KUrl& url); }; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/cache.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/cache.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/cache.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -20,52 +20,52 @@ QString Cache::baseDir() { - QString dir = KGlobal::dirs() ->saveLocation( "cache", "kita" ); - if ( dir[ dir.length() - 1 ] != '/' ) + QString dir = KGlobal::dirs() ->saveLocation("cache", "kita"); + if (dir[ dir.length() - 1 ] != '/') dir += '/'; return dir; } -QString Cache::serverDir( const KUrl& url ) +QString Cache::serverDir(const KUrl& url) { /* Is board enrolled ? */ - BoardData * bdata = BoardManager::getBoardData( url ); - if ( bdata == 0 ) return QString(); + BoardData * bdata = BoardManager::getBoardData(url); + if (bdata == 0) return QString(); QString root = bdata->hostName() + bdata->rootPath(); - return root.remove( "http://" ).replace( '/', '_' ) + '/'; + return root.remove("http://").replace('/', '_') + '/'; } -QString Cache::boardDir( const KUrl& url ) +QString Cache::boardDir(const KUrl& url) { /* Is board enrolled ? */ - BoardData * bdata = BoardManager::getBoardData( url ); - if ( bdata == 0 ) return QString(); + BoardData * bdata = BoardManager::getBoardData(url); + if (bdata == 0) return QString(); QString bbs = bdata->bbsPath(); - return bbs.mid( 1 ).replace( '/', '_' ) + '/'; + return bbs.mid(1).replace('/', '_') + '/'; } -QString Cache::getPath( const KUrl& url ) +QString Cache::getPath(const KUrl& url) { - QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path.isEmpty() ) return QString(); + QString path = baseDir() + serverDir(url) + boardDir(url); + if (path.isEmpty()) return QString(); - // qDebug( "%s -> %s",url.prettyUrl().ascii(),path.ascii()); + // qDebug("%s -> %s",url.prettyUrl().ascii(),path.ascii()); return path + url.fileName(); } -QString Cache::getIndexPath( const KUrl& url ) +QString Cache::getIndexPath(const KUrl& url) { - QString path = getPath( url ); - if ( path.isEmpty() ) { + QString path = getPath(url); + if (path.isEmpty()) { return QString(); } else { return path + ".idx"; @@ -78,28 +78,28 @@ /* public */ -QString Cache::getSettingPath( const KUrl& url ) +QString Cache::getSettingPath(const KUrl& url) { - QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path.isEmpty() ) return QString(); + QString path = baseDir() + serverDir(url) + boardDir(url); + if (path.isEmpty()) return QString(); return path + "SETTING.TXT"; } /* public */ -QString Cache::getBBSHistoryPath( const KUrl& url ) +QString Cache::getBBSHistoryPath(const KUrl& url) { - QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path.isEmpty() ) return QString(); + QString path = baseDir() + serverDir(url) + boardDir(url); + if (path.isEmpty()) return QString(); return path + "BBSHISTORY"; } /* public */ -QString Cache::getSubjectPath( const KUrl& url ) +QString Cache::getSubjectPath(const KUrl& url) { - QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path.isEmpty() ) return QString(); + QString path = baseDir() + serverDir(url) + boardDir(url); + if (path.isEmpty()) return QString(); return path + "subject.txt"; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/cache.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/cache.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/cache.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -24,14 +24,14 @@ { public: static QString baseDir(); - static QString serverDir( const KUrl& url ); - static QString boardDir( const KUrl& url ); + static QString serverDir(const KUrl& url); + static QString boardDir(const KUrl& url); - static QString getPath( const KUrl& url ); - static QString getIndexPath( const KUrl& url ); - static QString getSettingPath( const KUrl& url ); - static QString getBBSHistoryPath( const KUrl& url ); - static QString getSubjectPath( const KUrl& url ); + static QString getPath(const KUrl& url); + static QString getIndexPath(const KUrl& url); + static QString getSettingPath(const KUrl& url); + static QString getBBSHistoryPath(const KUrl& url); + static QString getSubjectPath(const KUrl& url); }; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -36,47 +36,47 @@ /*------------------------------------------------------*/ /* DatInfo stores & handles all information about *.dat */ -DatInfo::DatInfo( const KUrl& url ) : m_access ( 0 ), m_access2( 0 ) +DatInfo::DatInfo(const KUrl& url) : m_access (0), m_access2(0) { QString refstr; - m_datURL = Kita::getDatURL( url, refstr ); + m_datURL = Kita::getDatURL(url, refstr); /* get the pointer of Thread class */ - m_thread = Kita::Thread::getByURLNew( m_datURL ); - if ( m_thread == 0 ) { + m_thread = Kita::Thread::getByURLNew(m_datURL); + if (m_thread == 0) { /* create Thread */ - m_thread = Kita::Thread::getByURL( m_datURL ); - if ( m_thread == 0 ) return ; + m_thread = Kita::Thread::getByURL(m_datURL); + if (m_thread == 0) return ; /* read idx file */ - ThreadIndex::loadIndex( m_thread, m_datURL ); + ThreadIndex::loadIndex(m_thread, m_datURL); } - m_thread = Thread::getByURL( m_datURL ); + m_thread = Thread::getByURL(m_datURL); /* japanese strings */ -#if KDE_IS_VERSION( 3, 3, 0 ) - m_spacestr = Kita::utf8ToUnicode( KITAUTF8_ZENSPACE ); +#if KDE_IS_VERSION(3, 3, 0) + m_spacestr = Kita::utf8ToUnicode(KITAUTF8_ZENSPACE); #else m_spacestr = ". "; #endif - m_framestr1 = Kita::utf8ToUnicode( KITAUTF8_FRAME1 ); /* | */ - m_framestr2 = Kita::utf8ToUnicode( KITAUTF8_FRAME2 ); /* |- */ - m_framestr3 = Kita::utf8ToUnicode( KITAUTF8_FRAME3 ); /* L */ + m_framestr1 = Kita::utf8ToUnicode(KITAUTF8_FRAME1); /* | */ + m_framestr2 = Kita::utf8ToUnicode(KITAUTF8_FRAME2); /* |- */ + m_framestr3 = Kita::utf8ToUnicode(KITAUTF8_FRAME3); /* L */ /* make directory */ - QString cacheDir = Cache::baseDir() + Cache::serverDir( m_datURL ) + Cache::boardDir( m_datURL ); - if ( !Kita::mkdir( cacheDir ) ) return ; + QString cacheDir = Cache::baseDir() + Cache::serverDir(m_datURL) + Cache::boardDir(m_datURL); + if (!Kita::mkdir(cacheDir)) return ; initPrivate( true /* load cache */ - ); + ); } DatInfo::~DatInfo() { - initPrivate( false ); + initPrivate(false); } @@ -84,11 +84,11 @@ /* Usually, don't call this. */ /* public */ void DatInfo::init() { - return initPrivate( true ); + return initPrivate(true); } /* Init. If loadCache = true, load data from cache. */ /* private */ -void DatInfo::initPrivate( bool loadCache ) +void DatInfo::initPrivate(bool loadCache) { /* stop & delete dat loader */ deleteAccessJob(); @@ -100,35 +100,35 @@ /* clear ResDatVec */ m_resDatVec.clear(); - increaseResDatVec( RESDAT_DEFAULTSIZE ); + increaseResDatVec(RESDAT_DEFAULTSIZE); /* reset Abone */ resetAbonePrivate(); /* create dat loader */ - m_access = new Kita::Access( m_datURL ); + m_access = new Kita::Access(m_datURL); - connect( m_access, SIGNAL( receiveData( const QStringList& ) ), - SLOT( slotReceiveData( const QStringList& ) ) ); - connect( m_access, SIGNAL( finishLoad() ), SLOT( slotFinishLoad() ) ); + connect(m_access, SIGNAL(receiveData(const QStringList&)), + SLOT(slotReceiveData(const QStringList&))); + connect(m_access, SIGNAL(finishLoad()), SLOT(slotFinishLoad())); - if ( !loadCache ) return ; + if (!loadCache) return ; /* reset ReadNum before loading cache. */ /* ReadNum & subject are updated by Access::getcache() */ - m_thread->setReadNum( 0 ); + m_thread->setReadNum(0); /* get dat from cahce */ /* slotReceiveData() is called from Access::getcache() */ m_access->getcache(); /* save up-to-date thread information */ - ThreadIndex::saveIndex( m_thread, m_datURL ); + ThreadIndex::saveIndex(m_thread, m_datURL); } /* private */ -void DatInfo::resetResDat( RESDAT& resdat ) +void DatInfo::resetResDat(RESDAT& resdat) { resdat.num = 0; resdat.parsed = false; @@ -141,24 +141,24 @@ /* private */ -void DatInfo::increaseResDatVec( int delta ) +void DatInfo::increaseResDatVec(int delta) { int size = m_resDatVec.size(); RESDAT resdat; - resetResDat( resdat ); - m_resDatVec.resize( size + delta, resdat ); + resetResDat(resdat); + m_resDatVec.resize(size + delta, resdat); } /* delete dat loader */ /* private */ void DatInfo::deleteAccessJob() { - if ( m_access ) { + if (m_access) { m_access->killJob(); delete m_access; m_access = 0; } - if ( m_access2 ) { + if (m_access2) { m_access2->killJob(); delete m_access2; m_access2 = 0; @@ -184,20 +184,20 @@ /* When Kita::Access fineshed loading, slotFinishLoad is called, and DatInfo emits the finishLoad signal to the parent object */ /* public */ -bool DatInfo::updateCache( const QObject* parent ) +bool DatInfo::updateCache(const QObject* parent) { - if ( m_access == 0 ) return false; - if ( m_nowLoading ) return false; + if (m_access == 0) return false; + if (m_nowLoading) return false; m_nowLoading = true; - connect( this, SIGNAL( receiveData() ), - parent, SLOT( slotReceiveData() ) ); + connect(this, SIGNAL(receiveData()), + parent, SLOT(slotReceiveData())); - connect( this, SIGNAL( finishLoad() ), - parent, SLOT( slotFinishLoad() ) ); + connect(this, SIGNAL(finishLoad()), + parent, SLOT(slotFinishLoad())); - m_access->getupdate( m_thread->readNum() ); + m_access->getupdate(m_thread->readNum()); return true; } @@ -205,18 +205,18 @@ /* slot called when Kita::Access received new data */ /* private slot */ -void DatInfo::slotReceiveData( const QStringList& lineList ) +void DatInfo::slotReceiveData(const QStringList& lineList) { int rescode = m_access->responseCode(); - if ( m_access2 ) { + if (m_access2) { rescode = m_access2->responseCode(); } - if ( rescode != 200 && rescode != 206 ) return ; + if (rescode != 200 && rescode != 206) return ; /* copy lines to buffer */ int count = lineList.count(); - for ( int i = 0; i < count ; ++i ) copyOneLineToResDat( lineList[ i ] ); + for (int i = 0; i < count ; ++i) copyOneLineToResDat(lineList[ i ]); emit receiveData(); } @@ -224,44 +224,44 @@ /* copy one line to resdat. See also DatInfo::slotReceiveData() */ /* private */ -bool DatInfo::copyOneLineToResDat( const QString& line ) +bool DatInfo::copyOneLineToResDat(const QString& line) { - if ( line.isEmpty() ) return false; + if (line.isEmpty()) return false; /* update ReadNum */ const int num = m_thread->readNum() + 1; - m_thread->setReadNum( num ); + m_thread->setReadNum(num); /* If resdat vector is short, then resize the vector. */ - while ( ( int ) m_resDatVec.size() <= num ) increaseResDatVec( RESDAT_DELTA ); + while ((int) m_resDatVec.size() <= num) increaseResDatVec(RESDAT_DELTA); /* reset ResDat */ RESDAT& resdat = m_resDatVec[ num ]; - resetResDat( resdat ); + resetResDat(resdat); resdat.num = num; resdat.linestr = line; /* get subject */ - if ( num == 1 ) parseDat( num ); + if (num == 1) parseDat(num); /* search all responses which are responsed by this line. */ - if ( Kita::Config::checkResponsed() ) { + if (Kita::Config::checkResponsed()) { - if ( parseDat( num ) && !checkAbonePrivate( num ) ) { /* parse line here to get AncList */ + if (parseDat(num) && !checkAbonePrivate(num)) { /* parse line here to get AncList */ const int maxRange = 10; AncList& anclist = m_resDatVec[ num ].anclist; - for ( AncList::iterator it = anclist.begin(); it != anclist.end(); ++it ) { + for (AncList::iterator it = anclist.begin(); it != anclist.end(); ++it) { - int fromNum = ( *it ).from; - int toNum = qMin( num - 1, ( *it ).to ); - if ( toNum - fromNum + 1 > maxRange ) continue; + int fromNum = (*it).from; + int toNum = qMin(num - 1, (*it).to); + if (toNum - fromNum + 1 > maxRange) continue; - for ( int i = fromNum; i <= toNum; ++i ) { + for (int i = fromNum; i <= toNum; ++i) { - if ( !checkAbonePrivate( i ) ) m_resDatVec[ i ].isResponsed = true; + if (!checkAbonePrivate(i)) m_resDatVec[ i ].isResponsed = true; } } } @@ -276,16 +276,16 @@ void DatInfo::slotFinishLoad() { /* save thread information */ - ThreadIndex::saveIndex( m_thread, m_datURL ); + ThreadIndex::saveIndex(m_thread, m_datURL); /* re-try by offlaw.cgi */ - if ( m_thread->readNum() == 0 && m_access2 == 0 && DatManager::is2chThread( m_datURL ) ) { - if ( Account::isLogged() ) { - initPrivate( true ); - m_access2 = new OfflawAccess( m_datURL ); - connect( m_access2, SIGNAL( receiveData( const QStringList& ) ), - SLOT( slotReceiveData( const QStringList& ) ) ); - connect( m_access2, SIGNAL( finishLoad() ), SLOT( slotFinishLoad() ) ); + if (m_thread->readNum() == 0 && m_access2 == 0 && DatManager::is2chThread(m_datURL)) { + if (Account::isLogged()) { + initPrivate(true); + m_access2 = new OfflawAccess(m_datURL); + connect(m_access2, SIGNAL(receiveData(const QStringList&)), + SLOT(slotReceiveData(const QStringList&))); + connect(m_access2, SIGNAL(finishLoad()), SLOT(slotFinishLoad())); m_access2->get(); return ; } @@ -295,15 +295,15 @@ emit finishLoad(); /* disconnect signals */ - disconnect( SIGNAL( receiveData() ) ); - disconnect( SIGNAL( finishLoad() ) ); + disconnect(SIGNAL(receiveData())); + disconnect(SIGNAL(finishLoad())); } /* public */ int DatInfo::getResponseCode() { - if ( m_access == 0 ) return 0; + if (m_access == 0) return 0; return m_access->responseCode(); } @@ -312,7 +312,7 @@ /* public */ int DatInfo::getServerTime() { - if ( m_access == 0 ) return 0; + if (m_access == 0) return 0; return m_access->serverTime(); } @@ -321,9 +321,9 @@ /* public */ bool DatInfo::deleteCache() { - if ( m_nowLoading ) return false; + if (m_nowLoading) return false; - initPrivate( false ); + initPrivate(false); return true; } @@ -345,8 +345,8 @@ It will cause deadlock , because Kita::Access::stopJob() calls KitaHTMLPart::slotFinishLoad() back, then KitaHTMLPart::slotFinishLoad() calls another functions in DatInfo. */ - if ( m_access == 0 ) return ; - if ( ! m_nowLoading ) return ; + if (m_access == 0) return ; + if (! m_nowLoading) return ; m_access->stopJob(); } @@ -356,51 +356,51 @@ /* They are public */ -QString DatInfo::getDat( int num ) +QString DatInfo::getDat(int num) { - if ( !parseDat( num ) ) return QString(); + if (!parseDat(num)) return QString(); return m_resDatVec[ num ].linestr; } -QString DatInfo::getId( int num ) +QString DatInfo::getId(int num) { - if ( !parseDat( num ) ) return QString(); + if (!parseDat(num)) return QString(); return m_resDatVec[ num ].id; } /* plain strings of name */ -QString DatInfo::getPlainName( int num ) +QString DatInfo::getPlainName(int num) { - if ( !parseDat( num ) ) return QString(); + if (!parseDat(num)) return QString(); return m_resDatVec[ num ].name; } /* plain strings of title */ -QString DatInfo::getPlainTitle( int num ) +QString DatInfo::getPlainTitle(int num) { - if ( !parseDat( num ) ) return QString(); + if (!parseDat(num)) return QString(); QString titleHTML; - Kita::createTitleHTML( m_resDatVec[ num ], titleHTML ); + Kita::createTitleHTML(m_resDatVec[ num ], titleHTML); QString retStr; - Kita::DatToText( titleHTML, retStr ); + Kita::DatToText(titleHTML, retStr); return retStr; } /* plain strings of body */ -QString DatInfo::getPlainBody( int num ) +QString DatInfo::getPlainBody(int num) { - if ( !parseDat( num ) ) return QString(); + if (!parseDat(num)) return QString(); QString retStr; - Kita::DatToText( m_resDatVec[ num ].bodyHTML, retStr ); + Kita::DatToText(m_resDatVec[ num ].bodyHTML, retStr); return retStr; } @@ -414,9 +414,9 @@ return values are defined in datinfo.h. */ /* public */ -int DatInfo::getHTML( int num, bool checkAbone, QString& titleHTML, QString& bodyHTML ) +int DatInfo::getHTML(int num, bool checkAbone, QString& titleHTML, QString& bodyHTML) { - return getHTMLPrivate( num, checkAbone, titleHTML, bodyHTML ); + return getHTMLPrivate(num, checkAbone, titleHTML, bodyHTML); } /** @@ -432,26 +432,26 @@ * @retval KITA_HTML_NORMAL The res dat is normal. * */ -int DatInfo::getHTMLPrivate( int num, bool checkAbone, QString& titleHTML, QString& bodyHTML ) +int DatInfo::getHTMLPrivate(int num, bool checkAbone, QString& titleHTML, QString& bodyHTML) { - if ( !parseDat( num ) ) return KITA_HTML_NOTPARSED; + if (!parseDat(num)) return KITA_HTML_NOTPARSED; - bool abone = checkAbone & checkAbonePrivate( num ); + bool abone = checkAbone & checkAbonePrivate(num); RESDAT& resdat = m_resDatVec[ num ]; - if ( abone ) { - titleHTML = QString().setNum( num ) + ' ' + i18n( "Abone" ); - bodyHTML = "<a href=\"#abone" + QString().setNum( num ) + "\">"; - bodyHTML += i18n( "Abone" ) + "</a>"; + if (abone) { + titleHTML = QString().setNum(num) + ' ' + i18n("Abone"); + bodyHTML = "<a href=\"#abone" + QString().setNum(num) + "\">"; + bodyHTML += i18n("Abone") + "</a>"; return KITA_HTML_ABONE; - } else if ( resdat.broken ) { - titleHTML = QString().setNum( num ) + ' ' + i18n( "Broken" ); - bodyHTML = i18n( "Broken" ); + } else if (resdat.broken) { + titleHTML = QString().setNum(num) + ' ' + i18n("Broken"); + bodyHTML = i18n("Broken"); return KITA_HTML_BROKEN; } else { - createTitleHTML( resdat, titleHTML ); + createTitleHTML(resdat, titleHTML); bodyHTML = resdat.bodyHTML; return KITA_HTML_NORMAL; @@ -461,14 +461,14 @@ /* get HTML strings from startnum to endnum. return value is HTML strings */ /* public */ -QString DatInfo::getHTMLString( int startnum, int endnum, bool checkAbone ) +QString DatInfo::getHTMLString(int startnum, int endnum, bool checkAbone) { QString retHTML; - for ( int num = startnum; num <= endnum; num++ ) { + for (int num = startnum; num <= endnum; num++) { QString html; - getHTMLofOneRes( num, checkAbone, html ); + getHTMLofOneRes(num, checkAbone, html); retHTML += html; } @@ -477,20 +477,20 @@ /* return HTML strings that have ID = strid. */ /* public */ -QString DatInfo::getHtmlByID( const QString& strid, int &count ) +QString DatInfo::getHtmlByID(const QString& strid, int &count) { QString retHTML; count = 0; - for ( int i = 1; i <= m_thread->readNum(); i++ ) { + for (int i = 1; i <= m_thread->readNum(); i++) { - if ( !parseDat( i ) ) continue; + if (!parseDat(i)) continue; - if ( m_resDatVec[ i ].id == strid ) { + if (m_resDatVec[ i ].id == strid) { count ++; QString html; - getHTMLofOneRes( i, true, html ); + getHTMLofOneRes(i, true, html); retHTML += html; } } @@ -508,13 +508,13 @@ * @param[out] html * */ -void DatInfo::getHTMLofOneRes( int num, bool checkAbone, QString& html ) +void DatInfo::getHTMLofOneRes(int num, bool checkAbone, QString& html) { html.clear(); QString titleHTML, bodyHTML; - if ( getHTMLPrivate( num, checkAbone, titleHTML, bodyHTML ) == KITA_HTML_NOTPARSED ) return ; + if (getHTMLPrivate(num, checkAbone, titleHTML, bodyHTML) == KITA_HTML_NOTPARSED) return ; - if ( m_resDatVec[ num ].isResponsed ) titleHTML.replace( "<a href=\"#write", "<a class=\"coloredLink\" href=\"#write" ); + if (m_resDatVec[ num ].isResponsed) titleHTML.replace("<a href=\"#write", "<a class=\"coloredLink\" href=\"#write"); html += "<div class=\"pop_res_title\">" + titleHTML + "</div>"; html += "<div class=\"pop_res_body\">" + bodyHTML + "</div>"; } @@ -532,9 +532,9 @@ |-->>20, and return count = 3. */ /* Note that this function checks Abone internally. */ /* public */ -QString DatInfo::getTreeByRes( const int rootnum, int& count ) +QString DatInfo::getTreeByRes(const int rootnum, int& count) { - return getTreeByResPrivate( rootnum, false, count ); + return getTreeByResPrivate(rootnum, false, count); } /*---------------------------------------*/ @@ -548,9 +548,9 @@ |-->>6, and returns count = 3. */ /* Note that this function checks Abone internally. */ /* public */ -QString DatInfo::getTreeByResReverse( const int rootnum, int& count ) +QString DatInfo::getTreeByResReverse(const int rootnum, int& count) { - return getTreeByResPrivate( rootnum, true, count ); + return getTreeByResPrivate(rootnum, true, count); } @@ -558,13 +558,13 @@ QString DatInfo::getTreeByResPrivate( const int rootnum, bool reverse, /* reverse search */ - int& count ) + int& count) { - QString tmp = QString().setNum( rootnum ); + QString tmp = QString().setNum(rootnum); QString retstr = "<a href=\"#" + tmp + "\">>>" + tmp + "</a><br>"; - retstr += getTreeByResCore( rootnum, reverse, count, "" ); + retstr += getTreeByResCore(rootnum, reverse, count, ""); return retstr; } @@ -573,54 +573,54 @@ QString DatInfo::getTreeByResCore( const int rootnum, bool reverse, /* reverse search */ - int& count, QString prestr ) + int& count, QString prestr) { - if ( !parseDat( rootnum ) ) return QString(); - if ( checkAbonePrivate( rootnum ) ) return QString(); + if (!parseDat(rootnum)) return QString(); + if (checkAbonePrivate(rootnum)) return QString(); QString retstr; count = 0; QStringList strlists; - if ( !reverse ) { + if (!reverse) { /* collect responses that have anchor to rootnum */ - for ( int i = rootnum + 1; i <= m_thread->readNum(); i++ ) { - if ( checkAbonePrivate( i ) ) continue; - if ( checkRes( i, rootnum ) ) { + for (int i = rootnum + 1; i <= m_thread->readNum(); i++) { + if (checkAbonePrivate(i)) continue; + if (checkRes(i, rootnum)) { count ++; - strlists += QString().setNum( i ); + strlists += QString().setNum(i); } } } else { /* collect responses for which rootnum has anchors */ AncList& anclist = m_resDatVec[ rootnum ].anclist; - for ( AncList::iterator it = anclist.begin(); it != anclist.end(); ++it ) { - for ( int i = ( *it ).from; i <= qMin( rootnum - 1, ( *it ).to ) ; i++ ) { - if ( checkAbonePrivate( i ) ) continue; + for (AncList::iterator it = anclist.begin(); it != anclist.end(); ++it) { + for (int i = (*it).from; i <= qMin(rootnum - 1, (*it).to) ; i++) { + if (checkAbonePrivate(i)) continue; count ++; - strlists += QString().setNum( i ); + strlists += QString().setNum(i); } } } /* make HTML document */ - if ( count ) { + if (count) { - for ( QStringList::iterator it = strlists.begin(); it != strlists.end(); ++it ) { + for (QStringList::iterator it = strlists.begin(); it != strlists.end(); ++it) { QString tmpstr; - if ( ( *it ) == strlists.last() ) tmpstr = m_framestr3; /* 'L' */ + if ((*it) == strlists.last()) tmpstr = m_framestr3; /* 'L' */ else tmpstr = m_framestr2; /* '|-' */ - retstr += prestr + tmpstr + "<a href=\"#" + ( *it ) + "\">>>" + ( *it ) + "</a><br>"; + retstr += prestr + tmpstr + "<a href=\"#" + (*it) + "\">>>" + (*it) + "</a><br>"; /* call myself recursively */ int tmpnum; tmpstr = prestr; - if ( ( *it ) == strlists.last() ) tmpstr += m_spacestr + m_spacestr + m_spacestr; /* " " */ + if ((*it) == strlists.last()) tmpstr += m_spacestr + m_spacestr + m_spacestr; /* " " */ else tmpstr += m_framestr1 + m_spacestr; /* "| " */ - retstr += getTreeByResCore( ( *it ).toInt(), reverse, tmpnum, tmpstr ); + retstr += getTreeByResCore((*it).toInt(), reverse, tmpnum, tmpstr); count += tmpnum; } } @@ -635,16 +635,16 @@ /* For exsample, if target = 4, and No.num have an anchor >>4, or >>2-6, etc., then return true. */ /* private */ -bool DatInfo::checkRes( const int num, const int target ) +bool DatInfo::checkRes(const int num, const int target) { const int range = 20; - if ( !parseDat( num ) ) return false; + if (!parseDat(num)) return false; AncList& anclist = m_resDatVec[ num ].anclist; - for ( AncList::iterator it = anclist.begin(); it != anclist.end(); ++it ) { - if ( ( *it ).to - ( *it ).from > range ) continue; - if ( target >= ( *it ).from && target <= ( *it ).to ) return true; + for (AncList::iterator it = anclist.begin(); it != anclist.end(); ++it) { + if ((*it).to - (*it).from > range) continue; + if (target >= (*it).from && target <= (*it).to) return true; } return false; @@ -675,16 +675,16 @@ /* return number of responses that have ID = strid. */ /* Note that this function checks Abone internally. */ /* public */ -int DatInfo::getNumByID( const QString& strid ) +int DatInfo::getNumByID(const QString& strid) { int count = 0; - for ( int i = 1; i <= m_thread->readNum(); i++ ) { + for (int i = 1; i <= m_thread->readNum(); i++) { - if ( !parseDat( i ) ) continue; - if ( checkAbonePrivate( i ) ) continue; + if (!parseDat(i)) continue; + if (checkAbonePrivate(i)) continue; - if ( m_resDatVec[ i ].id == strid ) count++; + if (m_resDatVec[ i ].id == strid) count++; } return count; @@ -694,86 +694,86 @@ /* public */ int DatInfo::getDatSize() { - if ( m_access == 0 ) return 0; + if (m_access == 0) return 0; return m_access->dataSize(); } /* public */ -bool DatInfo::isResponsed( int num ) const +bool DatInfo::isResponsed(int num) const { return m_resDatVec[ num ].isResponsed; } /* public */ -bool DatInfo::isResValid( int num ) +bool DatInfo::isResValid(int num) { - return parseDat( num ); + return parseDat(num); } /* public */ bool DatInfo::isBroken() { - if ( m_broken ) return m_broken; + if (m_broken) return m_broken; - if ( m_access == 0 ) return false; + if (m_access == 0) return false; int rescode = m_access->responseCode(); bool invalid = m_access->invalidDataReceived(); /* see also Access::slotReceiveThreadData() */ - if ( invalid && ( rescode == 200 || rescode == 206 ) ) return true; + if (invalid && (rescode == 200 || rescode == 206)) return true; /* maybe "Dat Ochi" */ return false; } /* public */ -bool DatInfo::isResBroken( int num ) +bool DatInfo::isResBroken(int num) { - if ( !parseDat( num ) ) return false; + if (!parseDat(num)) return false; return m_resDatVec[ num ].broken; } /* ID = strid ? */ /* public */ -bool DatInfo::checkID( const QString& strid, int num ) +bool DatInfo::checkID(const QString& strid, int num) { - if ( !parseDat( num ) ) return false; + if (!parseDat(num)) return false; - if ( m_resDatVec[ num ].id == strid ) return true; + if (m_resDatVec[ num ].id == strid) return true; return false; } /* Are keywords included ? */ /* public */ -bool DatInfo::checkWord( QStringList& stlist, /* list of keywords */ +bool DatInfo::checkWord(QStringList& stlist, /* list of keywords */ int num, bool checkOR /* AND or OR search */ - ) + ) { - if ( !parseDat( num ) ) return false; + if (!parseDat(num)) return false; QString str_text = m_resDatVec[ num ].bodyHTML; - for ( QStringList::iterator it = stlist.begin(); it != stlist.end(); ++it ) { + for (QStringList::iterator it = stlist.begin(); it != stlist.end(); ++it) { - QRegExp regexp( ( *it ) ); -// regexp.setCaseSensitive( false ); // TODO + QRegExp regexp((*it)); +// regexp.setCaseSensitive(false); // TODO - if ( checkOR ) { /* OR */ - if ( str_text.indexOf( regexp, 0 ) != -1 ) { + if (checkOR) { /* OR */ + if (str_text.indexOf(regexp, 0) != -1) { return true; } } else { /* AND */ - if ( str_text.indexOf( regexp, 0 ) == -1 ) return false; + if (str_text.indexOf(regexp, 0) == -1) return false; } } - if ( checkOR ) return false; + if (checkOR) return false; return true; } @@ -798,58 +798,58 @@ /* private */ void DatInfo::resetAbonePrivate() { - for ( int i = 1; i < ( int ) m_resDatVec.size(); i++ ) m_resDatVec[ i ].checkAbone = false; + for (int i = 1; i < (int) m_resDatVec.size(); i++) m_resDatVec[ i ].checkAbone = false; - m_aboneByID = ( ! Kita::AboneConfig::aboneIDList().empty() ); - m_aboneByName = ( ! Kita::AboneConfig::aboneNameList().empty() ); - m_aboneByBody = ( ! Kita::AboneConfig::aboneWordList().empty() ); - m_aboneChain = ( m_aboneByID | m_aboneByName | m_aboneByBody ) & Kita::Config::aboneChain() ; + m_aboneByID = (! 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() ; } /*--------------*/ /* check abone */ /* public */ -bool DatInfo::checkAbone( int num ) +bool DatInfo::checkAbone(int num) { - return checkAbonePrivate( num ); + return checkAbonePrivate(num); } /* private */ -bool DatInfo::checkAbonePrivate( int num ) +bool DatInfo::checkAbonePrivate(int num) { - if ( !parseDat( num ) ) return false; + if (!parseDat(num)) return false; - if ( m_resDatVec[ num ].checkAbone ) return m_resDatVec[ num ].abone; + if (m_resDatVec[ num ].checkAbone) return m_resDatVec[ num ].abone; m_resDatVec[ num ].checkAbone = true; bool checktmp = false; - if ( m_aboneByID ) - checktmp = checkAboneCore( m_resDatVec[ num ].id, Kita::AboneConfig::aboneIDList() ); + if (m_aboneByID) + checktmp = checkAboneCore(m_resDatVec[ num ].id, Kita::AboneConfig::aboneIDList()); - if ( !checktmp && m_aboneByName ) - checktmp = checkAboneCore( m_resDatVec[ num ].name, Kita::AboneConfig::aboneNameList() ); + if (!checktmp && m_aboneByName) + checktmp = checkAboneCore(m_resDatVec[ num ].name, Kita::AboneConfig::aboneNameList()); - if ( !checktmp && m_aboneByBody ) - checktmp = checkAboneCore( m_resDatVec[ num ].bodyHTML, Kita::AboneConfig::aboneWordList() ); + if (!checktmp && m_aboneByBody) + checktmp = checkAboneCore(m_resDatVec[ num ].bodyHTML, Kita::AboneConfig::aboneWordList()); - if ( !checktmp && m_aboneChain ) { + if (!checktmp && m_aboneChain) { AncList & anclist = m_resDatVec[ num ].anclist; - for ( AncList::iterator it = anclist.begin(); - it != anclist.end() && !checktmp ; ++it ) { + for (AncList::iterator it = anclist.begin(); + it != anclist.end() && !checktmp ; ++it) { - int refNum = ( *it ).from; - int refNum2 = ( *it ).to; + int refNum = (*it).from; + int refNum2 = (*it).to; /* I don't want to enter loop... */ - if ( refNum >= num ) continue; - if ( refNum2 >= num ) refNum2 = num - 1; + if (refNum >= num) continue; + if (refNum2 >= num) refNum2 = num - 1; - for ( int i = refNum; i <= refNum2; i++ ) { - if ( checkAbonePrivate( i ) ) { + for (int i = refNum; i <= refNum2; i++) { + if (checkAbonePrivate(i)) { checktmp = true; break; } @@ -863,15 +863,15 @@ } /* private */ -bool DatInfo::checkAboneCore( const QString& str, QStringList strlist ) +bool DatInfo::checkAboneCore(const QString& str, QStringList strlist) { - if ( strlist.count() ) { + if (strlist.count()) { int i; - for ( QStringList::iterator it = strlist.begin(); - it != strlist.end(); ++it ) { - i = str.indexOf( ( *it ) ); - if ( i != -1 ) { + for (QStringList::iterator it = strlist.begin(); + it != strlist.end(); ++it) { + i = str.indexOf((*it)); + if (i != -1) { return true; } } @@ -884,17 +884,17 @@ /* parsing function for ResDat */ /* This function parses the raw data by Kita::parseResDat() */ /* private */ -bool DatInfo::parseDat( int num ) +bool DatInfo::parseDat(int num) { - if ( num <= 0 || m_thread->readNum() < num ) return false; - if ( m_resDatVec[ num ].parsed ) return true; + if (num <= 0 || m_thread->readNum() < num) return false; + if (m_resDatVec[ num ].parsed) return true; // qDebug("parseDat %d",num); QString subject; - Kita::parseResDat( m_resDatVec[ num ], subject ); - if ( num == 1 && !subject.isEmpty() ) m_thread->setThreadName( subject ); - if ( m_resDatVec[ num ].broken ) m_broken = true; + Kita::parseResDat(m_resDatVec[ num ], subject); + if (num == 1 && !subject.isEmpty()) m_thread->setThreadName(subject); + if (m_resDatVec[ num ].broken) m_broken = true; return true; } @@ -904,7 +904,7 @@ return m_isOpened; } -void DatInfo::setIsOpened( bool isOpened ) +void DatInfo::setIsOpened(bool isOpened) { m_isOpened = isOpened; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/datinfo.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -137,13 +137,13 @@ public: DatInfo(); - DatInfo( const KUrl& url ); + DatInfo(const KUrl& url); ~DatInfo(); void init(); const KUrl& url(); /* for caching */ - bool updateCache( const QObject* parent ); + bool updateCache(const QObject* parent); int getResponseCode(); int getServerTime(); bool deleteCache(); @@ -151,66 +151,66 @@ void stopLoading(); /* string data */ - QString getDat( int num ); - QString getId( int num ); - QString getPlainName( int num ); - QString getPlainTitle( int num ); - QString getPlainBody( int num ); + QString getDat(int num); + QString getId(int num); + QString getPlainName(int num); + QString getPlainTitle(int num); + QString getPlainBody(int num); /* HTML data */ - int getHTML( int num, bool checkAbone, QString& titleHTML, QString& bodyHTML ); - QString getHTMLString( int startnum, int endnum, bool checkAbone = true ); - QString getHtmlByID( const QString& strid, int &count ); - QString getTreeByRes( const int rootnum, int& count ); - QString getTreeByResReverse( const int rootnum, int& count ); + int getHTML(int num, bool checkAbone, QString& titleHTML, QString& bodyHTML); + QString getHTMLString(int startnum, int endnum, bool checkAbone = true); + QString getHtmlByID(const QString& strid, int &count); + QString getTreeByRes(const int rootnum, int& count); + QString getTreeByResReverse(const int rootnum, int& count); /* numerical data */ int getResNum(); int getReadNum(); int getViewPos(); - int getNumByID( const QString& strid ); + int getNumByID(const QString& strid); int getDatSize(); /* several information */ - bool isResponsed ( int num ) const; - bool isResValid( int num ); + bool isResponsed (int num) const; + bool isResValid(int num); bool isBroken(); - bool isResBroken( int num ); - bool checkID( const QString& strid, int num ); - bool checkWord( QStringList& stlist, int num, bool checkOR ); + bool isResBroken(int num); + bool checkID(const QString& strid, int num); + bool checkWord(QStringList& stlist, int num, bool checkOR); bool isOpened(); - void setIsOpened( bool isOpened ); + void setIsOpened(bool isOpened); /* abone check */ - bool checkAbone( int num ); + bool checkAbone(int num); void resetAbone(); /*-------------------------*/ private: - void initPrivate( bool loadCache = true ); - void resetResDat( RESDAT& resdat ); - void increaseResDatVec( int delta ); + void initPrivate(bool loadCache = true); + void resetResDat(RESDAT& resdat); + void increaseResDatVec(int delta); void deleteAccessJob(); /* copy data */ - bool copyOneLineToResDat( const QString& line ); + bool copyOneLineToResDat(const QString& line); /* HTML data */ - int getHTMLPrivate( int num, bool checkAbone, QString& titleHTML, QString& bodyHTML ); - void getHTMLofOneRes( int num, bool checkAbone, QString& html ); - QString getTreeByResPrivate( const int rootnum, bool reverse, int& count ); - QString getTreeByResCore( const int rootnum, bool reverse, int& count, QString prestr ); - bool checkRes( const int num, const int target ); + int getHTMLPrivate(int num, bool checkAbone, QString& titleHTML, QString& bodyHTML); + void getHTMLofOneRes(int num, bool checkAbone, QString& html); + QString getTreeByResPrivate(const int rootnum, bool reverse, int& count); + QString getTreeByResCore(const int rootnum, bool reverse, int& count, QString prestr); + bool checkRes(const int num, const int target); /* for abone */ void resetAbonePrivate(); - bool checkAbonePrivate( int num ); - bool checkAboneCore( const QString& str, QStringList strlist ); + bool checkAbonePrivate(int num); + bool checkAboneCore(const QString& str, QStringList strlist); /* parsing functions */ - bool parseDat( int num ); + bool parseDat(int num); DatInfo(const DatInfo&); DatInfo& operator=(const DatInfo&); @@ -218,7 +218,7 @@ private slots: - void slotReceiveData( const QStringList& lineList ); + void slotReceiveData(const QStringList& lineList); void slotFinishLoad(); signals: Modified: kita/branches/KITA-KDE4/kita/src/libkita/datmanager.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/datmanager.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/datmanager.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -39,12 +39,12 @@ /* create DatInfo explicitly. */ /* Usually, DatInfo is NOT created - if cache does not exist( i.e. ReadNum == 0 ). */ /* public */ -bool DatManager::createDatInfo( const KUrl& url ) + if cache does not exist(i.e. ReadNum == 0). */ /* public */ +bool DatManager::createDatInfo(const KUrl& url) { - if ( getDatInfo( url, + if (getDatInfo(url, false /* don't check the existence of cache */ - ) == 0 ) return false; + ) == 0) return false; return true; } @@ -54,9 +54,9 @@ /* !!! NOTICE !!! */ /* It is very dangerous to access to DatInfo directly. */ /* Usually, access to it through DatManager. */ /* public */ -DatInfo * DatManager::getDatInfoPointer( const KUrl& url ) +DatInfo * DatManager::getDatInfoPointer(const KUrl& url) { - return getDatInfo( url ); + return getDatInfo(url); } @@ -74,39 +74,39 @@ see also DatManager::searchDatInfo() and DatManager::createDatInfo() */ /* private */ -DatInfo* DatManager::getDatInfo( const KUrl& url, bool checkCached ) +DatInfo* DatManager::getDatInfo(const KUrl& url, bool checkCached) { /* search */ - DatInfo * datInfo = searchDatInfo( url ); - if ( datInfo != 0 ) return datInfo; + DatInfo * datInfo = searchDatInfo(url); + if (datInfo != 0) return datInfo; /* create and enroll instance */ - return enrollDatInfo( url, checkCached ); + return enrollDatInfo(url, checkCached); } /* This function just searches instance of DatInfo specified by datURL without creating instance. */ /* private */ -DatInfo* DatManager::searchDatInfo( const KUrl& url ) +DatInfo* DatManager::searchDatInfo(const KUrl& url) { - KUrl datURL = Kita::getDatURL( url ); - if ( datURL.isEmpty() ) return 0; /* This url is not enrolled in BoardManager. */ - if ( m_datInfoList.isEmpty() ) return 0; + KUrl datURL = Kita::getDatURL(url); + if (datURL.isEmpty()) return 0; /* This url is not enrolled in BoardManager. */ + if (m_datInfoList.isEmpty()) return 0; int i = 0; DatInfoList::Iterator it; DatInfo* datInfo; - for ( it = m_datInfoList.begin(); it != m_datInfoList.end(); ++it, i++ ) { + for (it = m_datInfoList.begin(); it != m_datInfoList.end(); ++it, i++) { - datInfo = ( *it ); + datInfo = (*it); - if ( datURL == datInfo->url() ) { + if (datURL == datInfo->url()) { /* LRU */ - if ( i ) { - m_datInfoList.remove( it ); - m_datInfoList.prepend( datInfo ); + if (i) { + m_datInfoList.remove(it); + m_datInfoList.prepend(datInfo); } return datInfo; @@ -119,31 +119,31 @@ /* create and enroll the instance of DatInfo and delete old instances. Note that DatInfo::DatInfo() opens cached data and reads it. */ /* private */ -DatInfo* DatManager::enrollDatInfo( const KUrl& url, bool checkCached ) +DatInfo* DatManager::enrollDatInfo(const KUrl& url, bool checkCached) { - KUrl datURL = Kita::getDatURL( url ); - if ( datURL.isEmpty() ) return 0; /* This url is not enrolled in BoardManager. */ + KUrl datURL = Kita::getDatURL(url); + if (datURL.isEmpty()) return 0; /* This url is not enrolled in BoardManager. */ /* create DatInfo & read cached data */ - DatInfo* datInfo = new DatInfo( datURL ); + DatInfo* datInfo = new DatInfo(datURL); /* Does cache exist ? */ /* If cache does not exist, delete DatInfo here. */ - if ( checkCached && datInfo->getReadNum() == 0 ) { + if (checkCached && datInfo->getReadNum() == 0) { delete datInfo; return 0; } - m_datInfoList.prepend( datInfo ); + m_datInfoList.prepend(datInfo); - /* delete the all old instances ( LRU algorithm )*/ - if ( m_datInfoList.count() > DMANAGER_MAXQUEUE ) { + /* delete the all old instances (LRU algorithm)*/ + if (m_datInfoList.count() > DMANAGER_MAXQUEUE) { DatInfoList::Iterator it; - for ( it = m_datInfoList.at( DMANAGER_MAXQUEUE ); it != m_datInfoList.end(); ++it ) { + for (it = m_datInfoList.at(DMANAGER_MAXQUEUE); it != m_datInfoList.end(); ++it) { - if ( ( *it ) == 0 ) continue; - DatInfo* deleteInfo = ( *it ); + if ((*it) == 0) continue; + DatInfo* deleteInfo = (*it); } } @@ -165,79 +165,79 @@ /* update cache */ /* public */ -bool DatManager::updateCache( const KUrl& url , const QObject* parent ) +bool DatManager::updateCache(const KUrl& url , const QObject* parent) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return false; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return false; - return datInfo->updateCache( parent ); + return datInfo->updateCache(parent); } /* public */ -int DatManager::getResponseCode( const KUrl& url ) +int DatManager::getResponseCode(const KUrl& url) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return 0; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return 0; return datInfo->getResponseCode(); } /* public */ -int DatManager::getServerTime( const KUrl& url ) +int DatManager::getServerTime(const KUrl& url) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return 0; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return 0; return datInfo->getServerTime(); } /* public */ -bool DatManager::deleteCache( const KUrl& url ) +bool DatManager::deleteCache(const KUrl& url) { - KUrl datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread == 0 ) return false; - if ( thread->readNum() == 0 ) return false; + KUrl datURL = Kita::getDatURL(url); + Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + if (thread == 0) return false; + if (thread->readNum() == 0) return false; /* init DatInfo */ - DatInfo * datInfo = searchDatInfo( datURL ); - if ( datInfo ) { - if ( !datInfo->deleteCache() ) return false; + DatInfo * datInfo = searchDatInfo(datURL); + if (datInfo) { + if (!datInfo->deleteCache()) return false; } /* reset readNum & veiwPos */ - thread->setReadNum( 0 ); - thread->setViewPos( 0 ); + thread->setReadNum(0); + thread->setViewPos(0); /* delete cache */ - QString cachePath = Kita::Cache::getPath( datURL ); - QString indexPath = Kita::Cache::getIndexPath( datURL ); - QFile::remove( indexPath ); - QFile::remove( cachePath ); + QString cachePath = Kita::Cache::getPath(datURL); + QString indexPath = Kita::Cache::getIndexPath(datURL); + QFile::remove(indexPath); + QFile::remove(cachePath); /* delete log from "cache" */ - KitaThreadInfo::removeThreadInfo( datURL.prettyUrl() ); + KitaThreadInfo::removeThreadInfo(datURL.prettyUrl()); return true; } /* public */ -bool DatManager::isLoadingNow( const KUrl& url ) +bool DatManager::isLoadingNow(const KUrl& url) { - DatInfo * datInfo = searchDatInfo( url ); - if ( datInfo == 0 ) return false; + DatInfo * datInfo = searchDatInfo(url); + if (datInfo == 0) return false; return datInfo->isLoadingNow(); } /* public */ -void DatManager::stopLoading( const KUrl& url ) +void DatManager::stopLoading(const KUrl& url) { - DatInfo * datInfo = searchDatInfo( url ); - if ( datInfo == 0 ) return ; + DatInfo * datInfo = searchDatInfo(url); + if (datInfo == 0) return ; return datInfo->stopLoading(); } @@ -247,331 +247,331 @@ /* public */ -QString DatManager::getDat( const KUrl& url, int num ) +QString DatManager::getDat(const KUrl& url, int num) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return QString(); + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return QString(); - return datInfo->getDat( num ); + return datInfo->getDat(num); } /* public */ -QString DatManager::getId( const KUrl& url, int num ) +QString DatManager::getId(const KUrl& url, int num) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return QString(); + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return QString(); - return datInfo->getId( num ); + return datInfo->getId(num); } /* public */ -QString DatManager::getPlainName( const KUrl& url, int num ) +QString DatManager::getPlainName(const KUrl& url, int num) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return QString(); + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return QString(); - return datInfo->getPlainName( num ); + return datInfo->getPlainName(num); } /* public */ -QString DatManager::getPlainBody( const KUrl& url, int num ) +QString DatManager::getPlainBody(const KUrl& url, int num) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return QString(); + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return QString(); - return datInfo->getPlainBody( num ); + return datInfo->getPlainBody(num); } /* public */ -QString DatManager::getPlainTitle( const KUrl& url, int num ) +QString DatManager::getPlainTitle(const KUrl& url, int num) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return QString(); + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return QString(); - return datInfo->getPlainTitle( num ); + return datInfo->getPlainTitle(num); } -/* get name (i.e. subject ) of thread from URL of dat file. */ /* public */ -const QString DatManager::threadName( const KUrl& url ) +/* get name (i.e. subject) of thread from URL of dat file. */ /* public */ +const QString DatManager::threadName(const KUrl& url) { - KUrl datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread != 0 ) return thread->threadName(); + KUrl datURL = Kita::getDatURL(url); + Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + if (thread != 0) return thread->threadName(); return QString(); } /* public */ -const QString DatManager::threadID( const KUrl& url ) +const QString DatManager::threadID(const KUrl& url) { - KUrl datURL = Kita::getDatURL( url ); - return datURL.fileName().section( '.', 0, 0 ); + KUrl datURL = Kita::getDatURL(url); + return datURL.fileName().section('.', 0, 0); } -const QString DatManager::getCachePath( const KUrl& url ) +const QString DatManager::getCachePath(const KUrl& url) { - return Kita::Cache::getPath( url ); + return Kita::Cache::getPath(url); } -const QString DatManager::getCacheIndexPath( const KUrl& url ) +const QString DatManager::getCacheIndexPath(const KUrl& url) { - return Kita::Cache::getIndexPath( url ); + return Kita::Cache::getIndexPath(url); } /*---------------------------------------*/ /* HTML data */ /* public */ -QString DatManager::getHtml( const KUrl& url, int startnum, int endnum, bool checkAbone ) +QString DatManager::getHtml(const KUrl& url, int startnum, int endnum, bool checkAbone) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return QString(); + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return QString(); - return datInfo->getHTMLString( startnum, endnum, checkAbone ); + return datInfo->getHTMLString(startnum, endnum, checkAbone); } /* public */ -QString DatManager::getHtmlByID( const KUrl& url, const QString& strid, int &count ) +QString DatManager::getHtmlByID(const KUrl& url, const QString& strid, int &count) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return QString(); + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return QString(); - return datInfo->getHtmlByID( strid, count ); + return datInfo->getHtmlByID(strid, count); } /* Get HTML document of res tree.*/ /* public */ -QString DatManager::getTreeByRes( const KUrl& url, const int rootnum, int &count ) +QString DatManager::getTreeByRes(const KUrl& url, const int rootnum, int &count) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return QString(); + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return QString(); - return datInfo->getTreeByRes( rootnum, count ); + return datInfo->getTreeByRes(rootnum, count); } /* Get HTML document of reverse res tree.*/ /* public */ -QString DatManager::getTreeByResReverse( const KUrl& url, const int rootnum, int &count ) +QString DatManager::getTreeByResReverse(const KUrl& url, const int rootnum, int &count) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return QString(); + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return QString(); - return datInfo->getTreeByResReverse( rootnum, count ); + return datInfo->getTreeByResReverse(rootnum, count); } /* public */ -int DatManager::getResNum( const KUrl& url ) +int DatManager::getResNum(const KUrl& url) { - KUrl datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread != 0 ) return thread->resNum(); + KUrl datURL = Kita::getDatURL(url); + Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + if (thread != 0) return thread->resNum(); return 0; } /* public */ -int DatManager::getReadNum( const KUrl& url ) +int DatManager::getReadNum(const KUrl& url) { - KUrl datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread != 0 ) return thread->readNum(); + KUrl datURL = Kita::getDatURL(url); + Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + if (thread != 0) return thread->readNum(); return 0; } /* public */ -int DatManager::getViewPos( const KUrl& url ) +int DatManager::getViewPos(const KUrl& url) { - KUrl datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread != 0 ) return thread->viewPos(); + KUrl datURL = Kita::getDatURL(url); + Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + if (thread != 0) return thread->viewPos(); return 0; } /* public */ -void DatManager::setViewPos( const KUrl& url , int num ) +void DatManager::setViewPos(const KUrl& url , int num) { - KUrl datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread != 0 ) thread->setViewPos( num ); + KUrl datURL = Kita::getDatURL(url); + Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + if (thread != 0) thread->setViewPos(num); /* save idx */ - Kita::ThreadIndex::setViewPos( url, num ); + Kita::ThreadIndex::setViewPos(url, num); /* save "cache" */ - KitaThreadInfo::setReadNum( datURL.prettyUrl(), num ); + KitaThreadInfo::setReadNum(datURL.prettyUrl(), num); } /* public */ -int DatManager::getDatSize( const KUrl& url ) +int DatManager::getDatSize(const KUrl& url) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return 0; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return 0; return datInfo->getDatSize(); } /* get number of responses which have same ID. */ /* public */ -int DatManager::getNumByID( const KUrl& url, const QString& strid ) +int DatManager::getNumByID(const KUrl& url, const QString& strid) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return 0; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return 0; - return datInfo->getNumByID( strid ); + return datInfo->getNumByID(strid); } /* public */ -bool DatManager::isThreadEnrolled( const KUrl& url ) +bool DatManager::isThreadEnrolled(const KUrl& url) { - if ( Kita::getDatURL( url ).isEmpty() ) return false; + if (Kita::getDatURL(url).isEmpty()) return false; return true; } /* public */ -bool DatManager::is2chThread( const KUrl& url ) +bool DatManager::is2chThread(const KUrl& url) { - if ( BoardManager::type( url ) != Board_2ch ) return false; - if ( Kita::getDatURL( url ).isEmpty() ) return false; + if (BoardManager::type(url) != Board_2ch) return false; + if (Kita::getDatURL(url).isEmpty()) return false; - QRegExp url_2ch( ".*\\.2ch\\.net" ); - QRegExp url_bbspink( ".*\\.bbspink\\.com" ); + QRegExp url_2ch(".*\\.2ch\\.net"); + QRegExp url_bbspink(".*\\.bbspink\\.com"); - if ( url_2ch.indexIn( url.host() ) != -1 - || url_bbspink.indexIn( url.host() ) != -1 ) return true; + if (url_2ch.indexIn(url.host()) != -1 + || url_bbspink.indexIn(url.host()) != -1) return true; return false; } /* public */ -bool DatManager::isResValid( const KUrl& url, int num ) +bool DatManager::isResValid(const KUrl& url, int num) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return false; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return false; - return datInfo->isResValid( num ); + return datInfo->isResValid(num); } /* public */ -bool DatManager::isBroken( const KUrl& url ) +bool DatManager::isBroken(const KUrl& url) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return false; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return false; return datInfo->isBroken(); } /* public */ -bool DatManager::isResBroken( const KUrl& url, int num ) +bool DatManager::isResBroken(const KUrl& url, int num) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return false; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return false; - return datInfo->isResBroken( num ); + return datInfo->isResBroken(num); } /* check if ID == strid */ /* public */ -bool DatManager::checkID( const KUrl& url, const QString& strid, int num ) +bool DatManager::checkID(const KUrl& url, const QString& strid, int num) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return false; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return false; - return datInfo->checkID( strid, num ); + return datInfo->checkID(strid, num); } /* check if keywords are included */ /* public */ -bool DatManager::checkWord( const KUrl& url, +bool DatManager::checkWord(const KUrl& url, QStringList& strlist, int num, bool checkOR /* AND or OR search */ - ) + ) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return false; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return false; - return datInfo->checkWord( strlist, num, checkOR ); + return datInfo->checkWord(strlist, num, checkOR); } /* public */ -bool DatManager::isMarked( const KUrl& url, int num ) +bool DatManager::isMarked(const KUrl& url, int num) { - KUrl datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread == 0 ) return false; + KUrl datURL = Kita::getDatURL(url); + Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + if (thread == 0) return false; - return thread->isMarked( num ); + return thread->isMarked(num); } /* public */ -void DatManager::setMark( const KUrl& url, int num, bool mark ) +void DatManager::setMark(const KUrl& url, int num, bool mark) { - KUrl datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURLNew( datURL ); - if ( thread == 0 ) return ; + KUrl datURL = Kita::getDatURL(url); + Kita::Thread* thread = Kita::Thread::getByURLNew(datURL); + if (thread == 0) return ; - if ( thread->setMark( num, mark ) ) Kita::ThreadIndex::setMarkList( url, thread->markList() ); + if (thread->setMark(num, mark)) Kita::ThreadIndex::setMarkList(url, thread->markList()); } /* public */ -bool DatManager::checkAbone( const KUrl& url, int num ) +bool DatManager::checkAbone(const KUrl& url, int num) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return false; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return false; - return datInfo->checkAbone( num ); + return datInfo->checkAbone(num); } /* public */ -void DatManager::resetAbone( const KUrl& url ) +void DatManager::resetAbone(const KUrl& url) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return ; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return ; datInfo->resetAbone(); } /* check if the thread is shown on the main thread tab. */ /* public */ -bool DatManager::isMainThreadOpened( const KUrl& url ) +bool DatManager::isMainThreadOpened(const KUrl& url) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return false; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return false; return datInfo->isOpened(); } -void DatManager::setMainThreadOpened( const KUrl& url, bool isOpened ) +void DatManager::setMainThreadOpened(const KUrl& url, bool isOpened) { - DatInfo * datInfo = getDatInfo( url ); - if ( datInfo == 0 ) return; + DatInfo * datInfo = getDatInfo(url); + if (datInfo == 0) return; - datInfo->setIsOpened( isOpened ); + datInfo->setIsOpened(isOpened); } @@ -579,8 +579,8 @@ /* obsolete */ /* public */ -const QString DatManager::threadURL( const KUrl& url ) +const QString DatManager::threadURL(const KUrl& url) { - return Kita::getThreadURL( url ); + return Kita::getThreadURL(url); } Modified: kita/branches/KITA-KDE4/kita/src/libkita/datmanager.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/datmanager.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/datmanager.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -31,75 +31,75 @@ public: - static bool createDatInfo( const KUrl& url ); - static DatInfo* getDatInfoPointer( const KUrl& url ); + static bool createDatInfo(const KUrl& url); + static DatInfo* getDatInfoPointer(const KUrl& url); static void deleteAllDatInfo(); /* caching */ - static bool updateCache( const KUrl& url , const QObject* parent ); - static int getResponseCode( const KUrl& url ); - static int getServerTime( const KUrl& url ); - static bool deleteCache( const KUrl& url ); - static bool isLoadingNow( const KUrl& url ); - static void stopLoading( const KUrl& url ); + static bool updateCache(const KUrl& url , const QObject* parent); + static int getResponseCode(const KUrl& url); + static int getServerTime(const KUrl& url); + static bool deleteCache(const KUrl& url); + static bool isLoadingNow(const KUrl& url); + static void stopLoading(const KUrl& url); /* string data */ - static QString getDat( const KUrl& url, int num ); - static QString getId( const KUrl& url, int num ); - static QString getPlainName( const KUrl& url, int num ); - static QString getPlainBody( const KUrl& url, int num ); - static QString getPlainTitle( const KUrl& url, int num ); + static QString getDat(const KUrl& url, int num); + static QString getId(const KUrl& url, int num); + static QString getPlainName(const KUrl& url, int num); + static QString getPlainBody(const KUrl& url, int num); + static QString getPlainTitle(const KUrl& url, int num); - static const QString threadName( const KUrl& url ); /* = subject of thread */ - static const QString threadID( const KUrl& url ); + static const QString threadName(const KUrl& url); /* = subject of thread */ + static const QString threadID(const KUrl& url); - static const QString getCachePath( const KUrl& url ); - static const QString getCacheIndexPath( const KUrl& url ); + static const QString getCachePath(const KUrl& url); + static const QString getCacheIndexPath(const KUrl& url); /* HTML data */ - static QString getHtml( const KUrl& url, int startnum, int endnum, bool checkAbone = true ); - static QString getHtmlByID( const KUrl& url, const QString& strid, int &count ); - static QString getTreeByRes( const KUrl& url, const int rootnum, int &count ); - static QString getTreeByResReverse( const KUrl& url, const int rootnum, int &count ); + static QString getHtml(const KUrl& url, int startnum, int endnum, bool checkAbone = true); + static QString getHtmlByID(const KUrl& url, const QString& strid, int &count); + static QString getTreeByRes(const KUrl& url, const int rootnum, int &count); + static QString getTreeByResReverse(const KUrl& url, const int rootnum, int &count); /* numerical data */ - static int getResNum( const KUrl& url ); - static int getReadNum( const KUrl& url ); - static int getViewPos( const KUrl& url ); - static void setViewPos( const KUrl& url, int num ); - static int getDatSize( const KUrl& url ); - static int getNumByID( const KUrl& url, const QString& strid ); + static int getResNum(const KUrl& url); + static int getReadNum(const KUrl& url); + static int getViewPos(const KUrl& url); + static void setViewPos(const KUrl& url, int num); + static int getDatSize(const KUrl& url); + static int getNumByID(const KUrl& url, const QString& strid); /* another information */ - static bool isThreadEnrolled( const KUrl& url ); - static bool is2chThread( const KUrl& url ); - static bool isResValid( const KUrl& url , int num ); - static bool isBroken( const KUrl& url ); - static bool isResBroken( const KUrl& url , int num ); - static bool checkID( const KUrl& url, const QString& strid, int num ); - static bool checkWord( const KUrl& url, QStringList& stlist, int num, bool checkOR ); - static bool isMarked( const KUrl& url, int num ); - static void setMark( const KUrl& url, int num, bool mark ); + static bool isThreadEnrolled(const KUrl& url); + static bool is2chThread(const KUrl& url); + static bool isResValid(const KUrl& url , int num); + static bool isBroken(const KUrl& url); + static bool isResBroken(const KUrl& url , int num); + static bool checkID(const KUrl& url, const QString& strid, int num); + static bool checkWord(const KUrl& url, QStringList& stlist, int num, bool checkOR); + static bool isMarked(const KUrl& url, int num); + static void setMark(const KUrl& url, int num, bool mark); /* abone check */ - static bool checkAbone( const KUrl& url, int num ); - static void resetAbone( const KUrl& url ); + static bool checkAbone(const KUrl& url, int num); + static void resetAbone(const KUrl& url); /* check if the thread is shown on the main thread tab. */ - static bool isMainThreadOpened( const KUrl& url ); - static void setMainThreadOpened( const KUrl& url, bool isOpened ); + static bool isMainThreadOpened(const KUrl& url); + static void setMainThreadOpened(const KUrl& url, bool isOpened); /* obsolete. Don't use them. */ - static const QString threadURL( const KUrl& url ); + static const QString threadURL(const KUrl& url); private: - static DatInfo* getDatInfo( const KUrl& url, bool checkCached = true ); - static DatInfo* searchDatInfo( const KUrl& url ); - static DatInfo* enrollDatInfo( const KUrl& url, bool checkCached ); + static DatInfo* getDatInfo(const KUrl& url, bool checkCached = true); + static DatInfo* searchDatInfo(const KUrl& url); + static DatInfo* enrollDatInfo(const KUrl& url, bool checkCached); }; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/event.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/event.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/event.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -11,7 +11,7 @@ #ifndef KITAEVENT_H #define KITAEVENT_H -#define EVENT_EmitFinigh ( QEvent::User + 200 ) -#define EVENT_DeleteLoader ( QEvent::User + 201 ) +#define EVENT_EmitFinigh (QEvent::User + 200) +#define EVENT_DeleteLoader (QEvent::User + 201) #endif Modified: kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -26,24 +26,24 @@ FavoriteBoards* FavoriteBoards::getInstance() { - if ( ! instance ) { + if (! instance) { instance = new FavoriteBoards(); } return instance; } -void FavoriteBoards::append( KUrl& url ) +void FavoriteBoards::append(KUrl& url) { - if ( ! getInstance() ->m_list.contains( url ) ) { - getInstance() ->m_list.append( url ); + if (! getInstance() ->m_list.contains(url)) { + getInstance() ->m_list.append(url); getInstance() ->notifyChange(); } } -void FavoriteBoards::remove( KUrl& url ) +void FavoriteBoards::remove(KUrl& url) { - if ( getInstance() ->m_list.contains( url ) ) { - getInstance() ->m_list.remove( url ); + if (getInstance() ->m_list.contains(url)) { + getInstance() ->m_list.remove(url); getInstance() ->notifyChange(); } } @@ -53,41 +53,41 @@ return getInstance() ->m_list; } -bool FavoriteBoards::readFromXML( QString& xml ) +bool FavoriteBoards::readFromXML(QString& xml) { FavoriteBoards * instance = FavoriteBoards::getInstance(); instance->m_list.clear(); QDomDocument document; - if ( ! document.setContent( xml, true ) ) { + if (! document.setContent(xml, true)) { return false; } QDomElement root = document.documentElement(); QDomNode node = root.firstChild(); - while ( ! node.isNull() ) { - if ( node.isElement() && - node.nodeName() == QString( "board" ) && - node.namespaceURI() == QString( "http://kita.sourceforge.jp/ns/board" ) ) { - processChildNode( node ); + while (! node.isNull()) { + if (node.isElement() && + node.nodeName() == QString("board") && + node.namespaceURI() == QString("http://kita.sourceforge.jp/ns/board")) { + processChildNode(node); } node = node.nextSibling(); } return true; } -void FavoriteBoards::processChildNode( QDomNode& node ) +void FavoriteBoards::processChildNode(QDomNode& node) { - QDomNode urlNode = node.namedItem( "url" ); - if ( ! urlNode.isElement() ) return ; + QDomNode urlNode = node.namedItem("url"); + if (! urlNode.isElement()) return ; QString urlText = urlNode.toElement().text(); - KUrl url = KUrl( urlText ); - if ( url.isValid() ) { - //FavoriteBoards::append( url ); - if ( !getInstance() ->m_list.contains( url ) ) - getInstance() ->m_list.append( url ); + KUrl url = KUrl(urlText); + if (url.isValid()) { + //FavoriteBoards::append(url); + if (!getInstance() ->m_list.contains(url)) + getInstance() ->m_list.append(url); } } @@ -95,39 +95,39 @@ { QDomDocument document; - QDomProcessingInstruction pi = document.createProcessingInstruction( "xml", "version=\"1.0\"" ); - document.appendChild( pi ); + QDomProcessingInstruction pi = document.createProcessingInstruction("xml", "version=\"1.0\""); + document.appendChild(pi); - QDomElement root = document.createElementNS( "http://kita.sourceforge.jp/ns/boardlist", "boardlist" ); - document.appendChild( root ); + QDomElement root = document.createElementNS("http://kita.sourceforge.jp/ns/boardlist", "boardlist"); + document.appendChild(root); Q3ValueList<KUrl> boards = FavoriteBoards::boards(); Q3ValueList<KUrl>::iterator it; - for ( it = boards.begin(); it != boards.end(); ++it ) { - QDomElement board = document.createElementNS( "http://kita.sourceforge.jp/ns/board", "board" ); - root.appendChild( board ); + for (it = boards.begin(); it != boards.end(); ++it) { + QDomElement board = document.createElementNS("http://kita.sourceforge.jp/ns/board", "board"); + root.appendChild(board); - QString boardURL = ( *it ).url(); - QDomElement urlElement = document.createElement( "url" ); - board.appendChild( urlElement ); - urlElement.appendChild( document.createTextNode( boardURL ) ); + QString boardURL = (*it).url(); + QDomElement urlElement = document.createElement("url"); + board.appendChild(urlElement); + urlElement.appendChild(document.createTextNode(boardURL)); - QString boardName = Kita::BoardManager::boardName( boardURL ); - QDomElement nameElement = document.createElement( "name" ); - board.appendChild( nameElement ); - nameElement.appendChild( document.createTextNode( boardName ) ); + QString boardName = Kita::BoardManager::boardName(boardURL); + QDomElement nameElement = document.createElement("name"); + board.appendChild(nameElement); + nameElement.appendChild(document.createTextNode(boardName)); } - return document.toString( 0 ); + return document.toString(0); } -void FavoriteBoards::replace( QString fromURL, QString toURL ) +void FavoriteBoards::replace(QString fromURL, QString toURL) { - if ( FavoriteBoards::getInstance() == 0 ) return ; + if (FavoriteBoards::getInstance() == 0) return ; Q3ValueList<KUrl>& boardList = FavoriteBoards::getInstance() ->m_list; - for ( Q3ValueList<KUrl>::iterator it = boardList.begin(); it != boardList.end(); ++it ) { - QString url = ( *it ).url(); - if ( url.startsWith( fromURL ) ) { - url = url.replace( 0, fromURL.length(), toURL ); + for (Q3ValueList<KUrl>::iterator it = boardList.begin(); it != boardList.end(); ++it) { + QString url = (*it).url(); + if (url.startsWith(fromURL)) { + url = url.replace(0, fromURL.length(), toURL); *it = url; } } Modified: kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/favoriteboards.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -32,17 +32,17 @@ FavoriteBoards(); ~FavoriteBoards(); - static void processChildNode( QDomNode& node ); + static void processChildNode(QDomNode& node); private: void notifyChange(); public: static FavoriteBoards* getInstance(); - static void append( KUrl& url ); - static void remove( KUrl& url ); + static void append(KUrl& url); + static void remove(KUrl& url); static const Q3ValueList<KUrl>& boards(); - static bool readFromXML( QString& xml ); + static bool readFromXML(QString& xml); static QString toXML(); - static void replace( QString fromURL, QString toURL ); + static void replace(QString fromURL, QString toURL); signals: void changed(); }; Modified: kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -29,9 +29,9 @@ FavoriteThreadItem::~ FavoriteThreadItem() {} -bool FavoriteThreadItem::operator==( const FavoriteThreadItem& item ) const +bool FavoriteThreadItem::operator==(const FavoriteThreadItem& item) const { - return ( m_datURL == item.m_datURL ); + return (m_datURL == item.m_datURL); } // FavoriteThreads @@ -45,27 +45,27 @@ FavoriteThreads* FavoriteThreads::getInstance() { - if ( ! instance ) { + if (! instance) { instance = new FavoriteThreads(); } return instance; } -void FavoriteThreads::insert( const QString& datURL ) +void FavoriteThreads::insert(const QString& datURL) { - if ( ! m_threadList.contains( datURL ) ) { - m_threadList.append( datURL ); + if (! m_threadList.contains(datURL)) { + m_threadList.append(datURL); } } -void FavoriteThreads::remove( const QString& datURL ) +void FavoriteThreads::remove(const QString& datURL) { - m_threadList.remove( datURL ); + m_threadList.remove(datURL); } -bool FavoriteThreads::contains( const QString& datURL ) +bool FavoriteThreads::contains(const QString& datURL) { - if ( m_threadList.contains( datURL ) ) { + if (m_threadList.contains(datURL)) { return true; } else { return false; @@ -77,114 +77,114 @@ return m_threadList; } -bool FavoriteThreads::readFromXML( const QString& xml ) +bool FavoriteThreads::readFromXML(const QString& xml) { FavoriteThreads * instance = FavoriteThreads::getInstance(); instance->m_threadList.clear(); QDomDocument document; - if ( ! document.setContent( xml, true ) ) { + if (! document.setContent(xml, true)) { return false; } QDomElement root = document.documentElement(); QDomNode node = root.firstChild(); - while ( !node.isNull() ) { - if ( node.isElement() && - node.nodeName() == QString( "thread" ) && - node.namespaceURI() == QString( "http://kita.sourceforge.jp/ns/thread" ) ) { - processThreadNode( node ); + while (!node.isNull()) { + if (node.isElement() && + node.nodeName() == QString("thread") && + node.namespaceURI() == QString("http://kita.sourceforge.jp/ns/thread")) { + processThreadNode(node); } node = node.nextSibling(); } return true; } -void FavoriteThreads::processThreadNode( QDomNode& node ) +void FavoriteThreads::processThreadNode(QDomNode& node) { - QDomNode datURLNode = node.namedItem( "daturl" ); - QDomNode nameNode = node.namedItem( "name" ); + QDomNode datURLNode = node.namedItem("daturl"); + QDomNode nameNode = node.namedItem("name"); - if ( !datURLNode.isElement() || !nameNode.isElement() ) return ; + if (!datURLNode.isElement() || !nameNode.isElement()) return ; QString url = datURLNode.toElement().text(); QString name = nameNode.toElement().text(); - KUrl datURL = Kita::getDatURL( url ); - Kita::Thread* thread = Kita::Thread::getByURL( datURL ); - thread->setThreadName( name ); - Kita::ThreadIndex::loadIndex( thread, datURL ); + KUrl datURL = Kita::getDatURL(url); + Kita::Thread* thread = Kita::Thread::getByURL(datURL); + thread->setThreadName(name); + Kita::ThreadIndex::loadIndex(thread, datURL); - FavoriteThreads::getInstance() ->insert( datURL.prettyUrl() ); + FavoriteThreads::getInstance() ->insert(datURL.prettyUrl()); } const QString FavoriteThreads::toXML() const { QDomDocument document; - // QDomProcessingInstruction pi = document.createProcessingInstruction( "xml", "version=\"1.0\"" ); - // document.appendChild( pi ); + // QDomProcessingInstruction pi = document.createProcessingInstruction("xml", "version=\"1.0\""); + // document.appendChild(pi); - QDomElement root = document.createElementNS( "http://kita.sourceforge.jp/ns/favorites", "favorites" ); - document.appendChild( root ); + QDomElement root = document.createElementNS("http://kita.sourceforge.jp/ns/favorites", "favorites"); + document.appendChild(root); Q3ValueList<FavoriteThreadItem>::const_iterator it; - for ( it = threadList().begin(); it != threadList().end(); ++it ) { - QString datURL = ( *it ).m_datURL; - QDomElement threadElement = document.createElementNS( "http://kita.sourceforge.jp/ns/thread", "thread" ); - root.appendChild( threadElement ); + for (it = threadList().begin(); it != threadList().end(); ++it) { + QString datURL = (*it).m_datURL; + QDomElement threadElement = document.createElementNS("http://kita.sourceforge.jp/ns/thread", "thread"); + root.appendChild(threadElement); - QDomElement datURLElement = document.createElement( "daturl" ); - threadElement.appendChild( datURLElement ); - datURLElement.appendChild( document.createTextNode( datURL ) ); + QDomElement datURLElement = document.createElement("daturl"); + threadElement.appendChild(datURLElement); + datURLElement.appendChild(document.createTextNode(datURL)); - QString threadName = Kita::DatManager::threadName( datURL ); - QDomElement nameElement = document.createElement( "name" ); - threadElement.appendChild( nameElement ); - nameElement.appendChild( document.createTextNode( threadName ) ); + QString threadName = Kita::DatManager::threadName(datURL); + QDomElement nameElement = document.createElement("name"); + threadElement.appendChild(nameElement); + nameElement.appendChild(document.createTextNode(threadName)); - QString resNum = QString::number( Kita::DatManager::getResNum( datURL ) ); - QDomElement resNumElement = document.createElement( "resnum" ); - threadElement.appendChild( resNumElement ); - resNumElement.appendChild( document.createTextNode( resNum ) ); + QString resNum = QString::number(Kita::DatManager::getResNum(datURL)); + QDomElement resNumElement = document.createElement("resnum"); + threadElement.appendChild(resNumElement); + resNumElement.appendChild(document.createTextNode(resNum)); // board - QDomElement board = document.createElementNS( "http://kita.sourceforge.jp/ns/board", "board" ); - threadElement.appendChild( board ); + QDomElement board = document.createElementNS("http://kita.sourceforge.jp/ns/board", "board"); + threadElement.appendChild(board); - QString boardURL = Kita::BoardManager::boardURL( datURL ); - QDomElement boardURLElement = document.createElement( "url" ); - board.appendChild( boardURLElement ); - boardURLElement.appendChild( document.createTextNode( boardURL ) ); + QString boardURL = Kita::BoardManager::boardURL(datURL); + QDomElement boardURLElement = document.createElement("url"); + board.appendChild(boardURLElement); + boardURLElement.appendChild(document.createTextNode(boardURL)); - QString boardName = Kita::BoardManager::boardName( boardURL ); - QDomElement boardNameElement = document.createElement( "name" ); - board.appendChild( boardNameElement ); - boardNameElement.appendChild( document.createTextNode( boardName ) ); + QString boardName = Kita::BoardManager::boardName(boardURL); + QDomElement boardNameElement = document.createElement("name"); + board.appendChild(boardNameElement); + boardNameElement.appendChild(document.createTextNode(boardName)); } - return document.toString( 0 ); + return document.toString(0); } -void FavoriteThreads::replace( QString fromURL, QString toURL ) +void FavoriteThreads::replace(QString fromURL, QString toURL) { - if ( FavoriteThreads::getInstance() == 0 ) return ; + if (FavoriteThreads::getInstance() == 0) return ; Q3ValueList<FavoriteThreadItem>& threadList = FavoriteThreads::getInstance() ->m_threadList; Q3ValueList<FavoriteThreadItem>::iterator it; - for ( it = threadList.begin(); it != threadList.end(); ++it ) { - QString url = ( *it ).m_datURL; - if ( url.indexOf( fromURL ) == 0 ) { - url = url.replace( 0, fromURL.length(), toURL ); - threadList.remove( it ); - threadList.prepend( url ); + for (it = threadList.begin(); it != threadList.end(); ++it) { + QString url = (*it).m_datURL; + if (url.indexOf(fromURL) == 0) { + url = url.replace(0, fromURL.length(), toURL); + threadList.remove(it); + threadList.prepend(url); it = threadList.begin(); } } } -QString FavoriteThreads::getDatURL( int i ) +QString FavoriteThreads::getDatURL(int i) { - if ( getInstance() ->m_threadList.count() > i ) { + if (getInstance() ->m_threadList.count() > i) { return getInstance() ->m_threadList[ i ].m_datURL; } else { return QString(); Modified: kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/favoritethreads.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -28,10 +28,10 @@ public: QString m_datURL; FavoriteThreadItem(); - FavoriteThreadItem( const QString& datURL ) { m_datURL = datURL; } + FavoriteThreadItem(const QString& datURL) { m_datURL = datURL; } ~FavoriteThreadItem(); - bool operator==( const FavoriteThreadItem& item ) const; + bool operator==(const FavoriteThreadItem& item) const; }; class KDE_EXPORT FavoriteThreads @@ -43,18 +43,18 @@ ~FavoriteThreads(); const Q3ValueList<FavoriteThreadItem> threadList() const; - static void processThreadNode( QDomNode& node ); + static void processThreadNode(QDomNode& node); public: static FavoriteThreads* getInstance(); - void insert( const QString& datURL ); - void remove( const QString& datURL ); - bool contains( const QString& datURL ); + void insert(const QString& datURL); + void remove(const QString& datURL); + bool contains(const QString& datURL); const QString toXML() const; - static bool readFromXML( const QString& xml ); - static void replace( QString fromURL, QString toURL ); - static QString getDatURL( int i ); + static bool readFromXML(const QString& xml); + static void replace(QString fromURL, QString toURL); + static QString getDatURL(int i); static int count() { return getInstance() ->m_threadList.count(); } }; Modified: kita/branches/KITA-KDE4/kita/src/libkita/flashcgi.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/flashcgi.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/flashcgi.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -24,18 +24,18 @@ { } -QString FlashCGI::buildPostStr( const QString & name, const QString & mail, const QString & body, const QString & boardID, const QString & threadID ) +QString FlashCGI::buildPostStr(const QString & name, const QString & mail, const QString & body, const QString & boardID, const QString & threadID) { QString ret; QTextCodec* codec = QTextCodec::codecForName("Shift-JIS"); 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 += "&bbs=" ) += boardID; - ( ret += "&key=" ) += threadID; + (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 += "&bbs=") += boardID; + (ret += "&key=") += threadID; return ret; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/flashcgi.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/flashcgi.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/flashcgi.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -19,7 +19,7 @@ */ class KDE_EXPORT FlashCGI { public: - static QString buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID ); + static QString buildPostStr(const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID); private: FlashCGI(); Modified: kita/branches/KITA-KDE4/kita/src/libkita/jbbs.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/jbbs.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/jbbs.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -24,20 +24,20 @@ { } -QString JBBS::buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime ) +QString JBBS::buildPostStr(const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime) { QString ret; QTextCodec* codec = QTextCodec::codecForName("Shift-JIS"); 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 += "&BBS=" ) += boardID.section( '/', 1, 1 ); - ( ret += "&DIR=" ) += boardID.section( '/', 0, 0 ); - ( ret += "&KEY=" ) += threadID; - ( ret += "&TIME=" ) += QString::number( serverTime ); + (ret += "submit=") += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ + (ret += "&NAME=") += Kita::encode_string(name, mib); + (ret += "&MAIL=") += Kita::encode_string(mail, mib); + (ret += "&MESSAGE=") += Kita::encode_string(body, mib).replace(';', "%3B"); + (ret += "&BBS=") += boardID.section('/', 1, 1); + (ret += "&DIR=") += boardID.section('/', 0, 0); + (ret += "&KEY=") += threadID; + (ret += "&TIME=") += QString::number(serverTime); return ret; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/jbbs.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/jbbs.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/jbbs.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -19,7 +19,7 @@ */ class KDE_EXPORT JBBS { public: - static QString buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime ); + static QString buildPostStr(const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime); private: JBBS(); Modified: kita/branches/KITA-KDE4/kita/src/libkita/k2ch.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/k2ch.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/k2ch.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -24,34 +24,34 @@ { } -QString K2ch::buildPostStr( const QString& name, const QString& mail, +QString K2ch::buildPostStr(const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime, - const QString& sessionID ) + const QString& sessionID) { QString ret; QTextCodec* codec = QTextCodec::codecForName("Shift-JIS"); int mib = codec->mibEnum(); - ( ret += "submit=" ) += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ + (ret += "submit=") += "%8f%91%82%ab%8d%9e%82%de"; /* kakikomu */ /* from, mail, message, bbs */ - ( ret += "&FROM=" ) += Kita::encode_string( name, mib ); - ( ret += "&mail=" ) += Kita::encode_string( mail, mib ); - ( ret += "&MESSAGE=" ) += Kita::encode_string( body, mib ); - ( ret += "&bbs=" ) += boardID; - ( ret += "&hana=mogera" ); + (ret += "&FROM=") += Kita::encode_string(name, mib); + (ret += "&mail=") += Kita::encode_string(mail, mib); + (ret += "&MESSAGE=") += Kita::encode_string(body, mib); + (ret += "&bbs=") += boardID; + (ret += "&hana=mogera"); /* key */ - ( ret += "&key=" ) += threadID; + (ret += "&key=") += threadID; /* time */ - ( ret += "&time=" ) += QString::number( serverTime ); + (ret += "&time=") += QString::number(serverTime); /* login */ - if ( ! sessionID.isEmpty() ) { - ( ret += "&sid=" ) += sessionID; + if (! sessionID.isEmpty()) { + (ret += "&sid=") += sessionID; } return ret; Modified: kita/branches/KITA-KDE4/kita/src/libkita/k2ch.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/k2ch.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/k2ch.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -19,7 +19,7 @@ */ class KDE_EXPORT K2ch { public: - static QString buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime, const QString& sessionID ); + static QString buildPostStr(const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime, const QString& sessionID); private: K2ch(); Modified: kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -50,8 +50,8 @@ 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 ); + static QTextCodec * codecForHint(int encoding_hint /* not 0 ! */); + static QString encode(const QString& segment, int encoding_offset, int encoding_hint, bool isRawURI = false); } @@ -60,40 +60,40 @@ /* Text codecs */ -QString Kita::qcpToUnicode( const QByteArray& str ) +QString Kita::qcpToUnicode(const QByteArray& str) { - if ( !Kita::qcpCodec ) Kita::qcpCodec = QTextCodec::codecForName("Shift-JIS"); + if (!Kita::qcpCodec) Kita::qcpCodec = QTextCodec::codecForName("Shift-JIS"); - return Kita::qcpCodec->toUnicode( str ); + return Kita::qcpCodec->toUnicode(str); } -QString Kita::utf8ToUnicode( const QByteArray& str ) +QString Kita::utf8ToUnicode(const QByteArray& str) { - if ( !Kita::utf8Codec ) Kita::utf8Codec = QTextCodec::codecForName( "utf8" ); + if (!Kita::utf8Codec) Kita::utf8Codec = QTextCodec::codecForName("utf8"); - return Kita::utf8Codec->toUnicode( str ); + return Kita::utf8Codec->toUnicode(str); } -QString Kita::eucToUnicode( const QByteArray& str ) +QString Kita::eucToUnicode(const QByteArray& str) { - if ( !Kita::eucCodec ) Kita::eucCodec = QTextCodec::codecForName( "eucJP" ); + if (!Kita::eucCodec) Kita::eucCodec = QTextCodec::codecForName("eucJP"); - return Kita::eucCodec->toUnicode( str ); + return Kita::eucCodec->toUnicode(str); } -QByteArray Kita::unicodeToQcp( const QString& str ) +QByteArray Kita::unicodeToQcp(const QString& str) { - if ( !Kita::qcpCodec ) Kita::qcpCodec = QTextCodec::codecForName("Shift-JIS"); - return Kita::qcpCodec->fromUnicode( str ); + if (!Kita::qcpCodec) Kita::qcpCodec = QTextCodec::codecForName("Shift-JIS"); + return Kita::qcpCodec->fromUnicode(str); } -QByteArray Kita::unicodeToEuc( const QString& str ) +QByteArray Kita::unicodeToEuc(const QString& str) { - if ( !Kita::eucCodec ) Kita::eucCodec = QTextCodec::codecForName( "eucJP" ); + if (!Kita::eucCodec) Kita::eucCodec = QTextCodec::codecForName("eucJP"); - return Kita::eucCodec->fromUnicode( str ); + return Kita::eucCodec->fromUnicode(str); } /*------------------------------------------------------------*/ @@ -103,7 +103,7 @@ /* get HTML from raw data */ -QString Kita::datToHtml( const QString& rawData, int num ) +QString Kita::datToHtml(const QString& rawData, int num) { QString retHTML, subject, titleHTML; RESDAT resdat; @@ -111,8 +111,8 @@ resdat.num = num; resdat.linestr = rawData; resdat.parsed = false; - parseResDat( resdat, subject ); - createTitleHTML( resdat, titleHTML ); + parseResDat(resdat, subject); + createTitleHTML(resdat, titleHTML); retHTML = "<div class=\"res_title\">" + titleHTML + "</div>"; retHTML += "<div class=\"res_body\">" + resdat.bodyHTML + "</div>"; @@ -141,20 +141,20 @@ const QChar *chpt = rawData.unicode(); unsigned int length = rawData.length(); - for ( unsigned int i = startPos = 0 ; i < length ; i++ ) { + for (unsigned int i = startPos = 0 ; i < length ; i++) { - switch ( chpt[ i ].unicode() ) { + switch (chpt[ i ].unicode()) { case '<': /* " <br> " */ - if ( chpt[ i + 1 ] == 'b' && chpt[ i + 2 ] == 'r' && chpt[ i + 3 ] == '>' ) { + if (chpt[ i + 1 ] == 'b' && chpt[ i + 2 ] == 'r' && chpt[ i + 3 ] == '>') { unsigned int i2 = i - startPos; - if ( i > 0 && chpt[ i - 1 ] == ' ' ) i2--; /* remove space before <br> */ - text += rawData.mid( startPos, i2 ) + '\n'; + if (i > 0 && chpt[ i - 1 ] == ' ') i2--; /* remove space before <br> */ + text += rawData.mid(startPos, i2) + '\n'; startPos = i + 4; - if ( chpt[ startPos ] == ' ' ) startPos++; /* remove space after <br> */ + if (chpt[ startPos ] == ' ') startPos++; /* remove space after <br> */ i = startPos - 1; } @@ -163,8 +163,8 @@ /* remove HTML tags <[^>]*> */ else { - if ( i - startPos ) text += rawData.mid( startPos, i - startPos ); - while ( chpt[ i ] != '>' && i < length ) i++; + if (i - startPos) text += rawData.mid(startPos, i - startPos); + while (chpt[ i ] != '>' && i < length) i++; startPos = i + 1; } @@ -178,10 +178,10 @@ /* special char */ { QString tmpstr; - tmpstr = parseSpecialChar( chpt + i, pos ); + tmpstr = parseSpecialChar(chpt + i, pos); - if ( !tmpstr.isEmpty() ) { - text += rawData.mid( startPos, i - startPos ) + tmpstr; + if (!tmpstr.isEmpty()) { + text += rawData.mid(startPos, i - startPos) + tmpstr; startPos = i + pos; i = startPos - 1; } @@ -191,7 +191,7 @@ } } - text += rawData.mid( startPos ); + text += rawData.mid(startPos); } @@ -207,27 +207,27 @@ const QChar *cdat, /* output */ - unsigned int& pos ) + unsigned int& pos) { QString retstr; - if ( ( pos = isEqual( cdat , ">" ) ) ) retstr = '>'; - else if ( ( pos = isEqual( cdat , "<" ) ) ) retstr = '<'; - else if ( ( pos = isEqual( cdat , " " ) ) ) retstr = ' '; - else if ( ( pos = isEqual( cdat , "&" ) ) ) retstr = '&'; - else if ( ( pos = isEqual( cdat , """ ) ) ) retstr = '"'; + if ((pos = isEqual(cdat , ">"))) retstr = '>'; + else if ((pos = isEqual(cdat , "<"))) retstr = '<'; + else if ((pos = isEqual(cdat , " "))) retstr = ' '; + else if ((pos = isEqual(cdat , "&"))) retstr = '&'; + else if ((pos = isEqual(cdat , """))) retstr = '"'; - else if ( ( pos = isEqual( cdat , "♥" ) ) ) - retstr = utf8ToUnicode( KITAUTF8_HEART ); + else if ((pos = isEqual(cdat , "♥"))) + retstr = utf8ToUnicode(KITAUTF8_HEART); - else if ( ( pos = isEqual( cdat , "♦" ) ) ) - retstr = utf8ToUnicode( KITAUTF8_DIA ); + else if ((pos = isEqual(cdat , "♦"))) + retstr = utf8ToUnicode(KITAUTF8_DIA); - else if ( ( pos = isEqual( cdat , "♣" ) ) ) - retstr = utf8ToUnicode( KITAUTF8_CLUB ); + else if ((pos = isEqual(cdat , "♣"))) + retstr = utf8ToUnicode(KITAUTF8_CLUB); - else if ( ( pos = isEqual( cdat , "♠" ) ) ) - retstr = utf8ToUnicode( KITAUTF8_SPADE ); + else if ((pos = isEqual(cdat , "♠"))) + retstr = utf8ToUnicode(KITAUTF8_SPADE); return retstr; } @@ -238,39 +238,39 @@ /* conversion of URL */ -KUrl Kita::getDatURL( const KUrl& url , QString& refstr ) +KUrl Kita::getDatURL(const KUrl& url , QString& refstr) { - return convertURL( URLMODE_DAT, url, refstr ); + return convertURL(URLMODE_DAT, url, refstr); } -KUrl Kita::getDatURL( const KUrl& url ) +KUrl Kita::getDatURL(const KUrl& url) { QString refstr; - return convertURL( URLMODE_DAT, url, refstr ); + return convertURL(URLMODE_DAT, url, refstr); } -QString Kita::getThreadURL( const KUrl& url, QString& refstr ) +QString Kita::getThreadURL(const KUrl& url, QString& refstr) { - return convertURL( URLMODE_THREAD, url, refstr ); + return convertURL(URLMODE_THREAD, url, refstr); } -QString Kita::getThreadURL( const KUrl& url ) +QString Kita::getThreadURL(const KUrl& url) { QString refstr; - return convertURL( URLMODE_THREAD, url, refstr ); + return convertURL(URLMODE_THREAD, url, refstr); } -QString Kita::getNewThreadWriteURL( const KUrl& m_datURL ) +QString Kita::getNewThreadWriteURL(const KUrl& m_datURL) { - int m_bbstype = Kita::BoardManager::type( m_datURL ); + int m_bbstype = Kita::BoardManager::type(m_datURL); QString m_bbscgi; /* set path of bbs.cgi */ - switch ( m_bbstype ) { + switch (m_bbstype) { case Kita::Board_JBBS: { - QString cgipath = Kita::BoardManager::boardRoot( m_datURL ) - + "/bbs/write.cgi/" + Kita::BoardManager::boardID( m_datURL ) + '/'; + QString cgipath = Kita::BoardManager::boardRoot(m_datURL) + + "/bbs/write.cgi/" + Kita::BoardManager::boardID(m_datURL) + '/'; cgipath += "new/"; @@ -280,7 +280,7 @@ break; case Kita::Board_MachiBBS: { - QString cgipath = Kita::BoardManager::boardRoot( m_datURL ) + QString cgipath = Kita::BoardManager::boardRoot(m_datURL) + "/bbs/write.cgi"; m_bbscgi = cgipath; } @@ -289,25 +289,25 @@ default: - m_bbscgi = Kita::BoardManager::boardRoot( m_datURL ) + "/test/bbs.cgi"; + m_bbscgi = Kita::BoardManager::boardRoot(m_datURL) + "/test/bbs.cgi"; } return m_bbscgi; } -QString Kita::getWriteURL( const KUrl& m_datURL ) +QString Kita::getWriteURL(const KUrl& m_datURL) { - int m_bbstype = Kita::BoardManager::type( m_datURL ); + int m_bbstype = Kita::BoardManager::type(m_datURL); QString m_bbscgi; /* set path of bbs.cgi */ - switch ( m_bbstype ) { + switch (m_bbstype) { case Kita::Board_JBBS: { - QString cgipath = Kita::BoardManager::boardRoot( m_datURL ) - + "/bbs/write.cgi/" + Kita::BoardManager::boardID( m_datURL ) + '/'; + QString cgipath = Kita::BoardManager::boardRoot(m_datURL) + + "/bbs/write.cgi/" + Kita::BoardManager::boardID(m_datURL) + '/'; - cgipath += Kita::DatManager::threadID( m_datURL ) + '/'; + cgipath += Kita::DatManager::threadID(m_datURL) + '/'; m_bbscgi = cgipath; } @@ -315,7 +315,7 @@ break; case Kita::Board_MachiBBS: { - QString cgipath = Kita::BoardManager::boardRoot( m_datURL ) + QString cgipath = Kita::BoardManager::boardRoot(m_datURL) + "/bbs/write.cgi"; m_bbscgi = cgipath; } @@ -324,7 +324,7 @@ default: - m_bbscgi = Kita::BoardManager::boardRoot( m_datURL ) + "/test/bbs.cgi"; + m_bbscgi = Kita::BoardManager::boardRoot(m_datURL) + "/test/bbs.cgi"; } return m_bbscgi; @@ -368,22 +368,22 @@ const KUrl& url , /* output */ - QString& refstr ) + QString& refstr) { refstr.clear(); - if ( url.isEmpty() ) return QString(); + if (url.isEmpty()) return QString(); /* cache */ - if ( m_prevConvMode == mode && m_prevConvURL == url.prettyUrl() ) { + if (m_prevConvMode == mode && m_prevConvURL == url.prettyUrl()) { refstr = m_prevConvRefstr; return m_prevConvNewURL; } /* Is board enrolled ? */ - BoardData* bdata = Kita::BoardManager::getBoardData( url ); - if ( bdata == 0 ) return QString(); + BoardData* bdata = Kita::BoardManager::getBoardData(url); + if (bdata == 0) return QString(); QString urlstr = url.prettyUrl(); @@ -391,48 +391,48 @@ QString thread; QString refBase; - if ( urlstr.contains( "/dat/" ) ) { + if (urlstr.contains("/dat/")) { /* url = (hostname)/(rootPath)/(bbsPath)/dat/(thread_ID).(ext)#(refBase) */ - thread = url.fileName().remove( bdata->ext() ); + thread = url.fileName().remove(bdata->ext()); refBase = url.ref(); - } else if ( urlstr.contains( bdata->delimiter() ) ) { + } else if (urlstr.contains(bdata->delimiter())) { QString tmpstr; - switch ( bdata->type() ) { + switch (bdata->type()) { /* machi BBS */ /* ex.) If url = http://kanto.machi.to/bbs/read.pl?BBS=kana&KEY=1096716679 , then, thread = 1096716679 */ case Board_MachiBBS: - thread = url.queryItem( "KEY" ); + thread = url.queryItem("KEY"); refBase.clear(); break; /* url = (hostname)/(rootPath)/(delimiter)/(bbsPath)/(thread_ID)/(refBase) */ default: - tmpstr = urlstr.section( bdata->delimiter() + bdata->bbsPath(), 1, 1 ); - thread = tmpstr.section( '/', 1, 1 ); - refBase = tmpstr.section( '/', 2, 2 ); + tmpstr = urlstr.section(bdata->delimiter() + bdata->bbsPath(), 1, 1); + thread = tmpstr.section('/', 1, 1); + refBase = tmpstr.section('/', 2, 2); break; } } - if ( thread.isEmpty() ) return QString(); + if (thread.isEmpty()) return QString(); - if ( !refBase.isEmpty() ) { + if (!refBase.isEmpty()) { - if ( refBase.at( 0 ) == '-' ) refstr = '1' + refBase; + if (refBase.at(0) == '-') refstr = '1' + refBase; else refstr = refBase; } /* create new URL */ QString newURL; - if ( mode == URLMODE_DAT ) newURL = bdata->basePath() + "dat/" + thread + bdata->ext(); + if (mode == URLMODE_DAT) newURL = bdata->basePath() + "dat/" + thread + bdata->ext(); else { newURL = bdata->cgiBasePath(); - switch ( bdata->type() ) { + switch (bdata->type()) { case Board_MachiBBS: newURL += "&KEY=" + thread; @@ -459,27 +459,27 @@ * http://pc5.2ch.net/linux/dat/1089905503.dat * -> http://pc5.2ch.net/test/offlaw.cgi?bbs=linux&key=1089905503 */ -QString Kita::datToOfflaw( const KUrl& datURL ) +QString Kita::datToOfflaw(const KUrl& datURL) { /* TODO: not tested. */ - KUrl url( datURL ); + KUrl url(datURL); QString root = url.host(); - QStringList list = url.fileName().split( '.' ); - if ( list.size() != 2 ) { + QStringList list = url.fileName().split('.'); + if (list.size() != 2) { return QString(); } QString datName = list[ 0 ]; - url.cd( ".." ); - if ( url.fileName() != "dat" ) { + url.cd(".."); + if (url.fileName() != "dat") { return QString(); } - url.cd( ".." ); + url.cd(".."); QString board = url.fileName(); - return QString( "http://%1/test/offlaw.cgi?raw=0.0&bbs=%2&key=%3" ).arg( root ).arg( board ).arg( datName ); + return QString("http://%1/test/offlaw.cgi?raw=0.0&bbs=%2&key=%3").arg(root).arg(board).arg(datName); } @@ -489,21 +489,21 @@ /* utilities */ /* create directory recursively */ -bool Kita::mkdir( const QString& targetPath ) +bool Kita::mkdir(const QString& targetPath) { - QDir qdir( targetPath ); - if ( !qdir.exists() ) { + QDir qdir(targetPath); + if (!qdir.exists()) { - QStringList pathList = targetPath.split( '/' ); + QStringList pathList = targetPath.split('/'); QString path; - for ( int i = 0; i < pathList.count(); ++i ) { + for (int i = 0; i < pathList.count(); ++i) { path += '/' + pathList[ i ]; qdir = path; - if ( !qdir.exists() ) { - if ( !qdir.mkdir( path ) ) return false; + if (!qdir.exists()) { + if (!qdir.mkdir(path)) return false; } } } @@ -512,26 +512,26 @@ } -QString Kita::unescape( const QString& str ) +QString Kita::unescape(const QString& str) { QString ret = str; - return ret.replace( "<", "<" ).replace( ">", ">" ).replace( "&", "&" ); + return ret.replace("<", "<").replace(">", ">").replace("&", "&"); } -uint Kita::datToSince( const KUrl& datURL ) +uint Kita::datToSince(const KUrl& datURL) { - return KUrl( datURL ).fileName().section( '.', 0, 0 ).toInt(); + return KUrl(datURL).fileName().section('.', 0, 0).toInt(); } /* if cdat == str, return str.length() */ -int Kita::isEqual( const QChar *cdat, const QString& str ) +int Kita::isEqual(const QChar *cdat, const QString& str) { int i = 0; const int size = str.size(); - while ( i < size && str.at( i ) != '\0' ) { - if ( *cdat != str.at( i ) ) return 0; + while (i < size && str.at(i) != '\0') { + if (*cdat != str.at(i)) return 0; cdat++;i++; } return i; @@ -544,18 +544,18 @@ /* For example, if cdat = "1234", then ret = 1234. If cdat = "abcd", then ret = -1. */ -int Kita::stringToPositiveNum( const QChar *cdat, const unsigned int length ) +int Kita::stringToPositiveNum(const QChar *cdat, const unsigned int length) { int ret = 0; - for ( unsigned int i = 0 ; i < length ; i++ ) { + for (unsigned int i = 0 ; i < length ; i++) { unsigned short c = cdat[ i ].unicode(); - if ( ( c < UTF16_0 || c > UTF16_9 ) && ( c < '0' || c > '9' ) ) return -1; + if ((c < UTF16_0 || c > UTF16_9) && (c < '0' || c > '9')) return -1; ret *= 10; - if ( c >= UTF16_0 ) ret += c - UTF16_0; + if (c >= UTF16_0) ret += c - UTF16_0; else ret += c - '0'; } @@ -569,14 +569,14 @@ /* internal parsing functions */ -QStringList Kita::parseSearchQuery( const QString& input ) +QStringList Kita::parseSearchQuery(const QString& input) { - QStringList tmp = input.split( ' ' ); + QStringList tmp = input.split(' '); QStringList ret_list; - QRegExp truncSpace( "\\s*$" ); + QRegExp truncSpace("\\s*$"); QStringList::iterator it = tmp.begin(); - for ( ; it != tmp.end(); ++it ) - ret_list += ( *it ).remove( truncSpace ); + for (; it != tmp.end(); ++it) + ret_list += (*it).remove(truncSpace); return ret_list; } @@ -591,7 +591,7 @@ m_machiLine.clear(); } -QString Kita::ParseMachiBBSOneLine( const QString& inputLine, int& nextNum ) +QString Kita::ParseMachiBBSOneLine(const QString& inputLine, int& nextNum) { QString ret; m_machiLine += inputLine; @@ -606,80 +606,80 @@ QString message; // Subject - QRegExp title_regexp( "<title>(.*)</title>" ); + QRegExp title_regexp("<title>(.*)</title>"); // pattern 1 (tokyo,kanagawa,...) - QRegExp regexp ( "<dt>(\\d*) .*<font color=\"#......\"><b> (.*) </b></font> .* (..../../..).* (..:..:..) ID:([^<]*)<br><dd>(.*)" ); - QRegExp regexp2( "<dt>(\\d*) .*<a href=\"mailto:(.*)\"><b> (.*) </B></a> .* (..../../..).* (..:..:..) ID:([^<]*)<br><dd>(.*)" ); + QRegExp regexp ("<dt>(\\d*) .*<font color=\"#......\"><b> (.*) </b></font> .* (..../../..).* (..:..:..) ID:([^<]*)<br><dd>(.*)"); + QRegExp regexp2("<dt>(\\d*) .*<a href=\"mailto:(.*)\"><b> (.*) </B></a> .* (..../../..).* (..:..:..) ID:([^<]*)<br><dd>(.*)"); // pattern 2 (hokkaido,...) - QRegExp regexp3( "<dt>(\\d*) .*<font color=\"#......\"><b> (.*) </b></font> .* (..../../..).* (..:..:..) ID:([^<]*) <font size=.>\\[ ([^ ]*) \\]</font><br><dd>(.*)" ); - QRegExp regexp4( "<dt>(\\d*) .*<a href=\"mailto:(.*)\"><b> (.*) </B></a> .* (..../../..).* (..:..:..) ID:([^<]*) <font size=.>\\[ ([^ ]*) \\]</font><br><dd>(.*)" ); + QRegExp regexp3("<dt>(\\d*) .*<font color=\"#......\"><b> (.*) </b></font> .* (..../../..).* (..:..:..) ID:([^<]*) <font size=.>\\[ ([^ ]*) \\]</font><br><dd>(.*)"); + QRegExp regexp4("<dt>(\\d*) .*<a href=\"mailto:(.*)\"><b> (.*) </B></a> .* (..../../..).* (..:..:..) ID:([^<]*) <font size=.>\\[ ([^ ]*) \\]</font><br><dd>(.*)"); /* abone */ - QRegExp regexp5( "<dt>(\\d*) .*<br><dd>.*" ); + QRegExp regexp5("<dt>(\\d*) .*<br><dd>.*"); - if ( regexp.indexIn( m_machiLine ) != -1 ) { + if (regexp.indexIn(m_machiLine) != -1) { - num = regexp.cap( 1 ).toInt(); - name = regexp.cap( 2 ); - date = regexp.cap( 3 ); - time = regexp.cap( 4 ); - id = regexp.cap( 5 ); - message = regexp.cap( 6 ); + num = regexp.cap(1).toInt(); + name = regexp.cap(2); + date = regexp.cap(3); + time = regexp.cap(4); + id = regexp.cap(5); + message = regexp.cap(6); - } else if ( regexp2.indexIn( m_machiLine ) != -1 ) { + } else if (regexp2.indexIn(m_machiLine) != -1) { - num = regexp2.cap( 1 ).toInt(); - mail = regexp2.cap( 2 ); - name = regexp2.cap( 3 ); - date = regexp2.cap( 4 ); - time = regexp2.cap( 5 ); - id = regexp2.cap( 6 ); - message = regexp2.cap( 7 ); + num = regexp2.cap(1).toInt(); + mail = regexp2.cap(2); + name = regexp2.cap(3); + date = regexp2.cap(4); + time = regexp2.cap(5); + id = regexp2.cap(6); + message = regexp2.cap(7); - } else if ( regexp3.indexIn( m_machiLine ) != -1 ) { + } else if (regexp3.indexIn(m_machiLine) != -1) { - num = regexp3.cap( 1 ).toInt(); - name = regexp3.cap( 2 ); - date = regexp3.cap( 3 ); - time = regexp3.cap( 4 ); - id = regexp3.cap( 5 ); - host = regexp3.cap( 6 ); - message = regexp3.cap( 7 ); + num = regexp3.cap(1).toInt(); + name = regexp3.cap(2); + date = regexp3.cap(3); + time = regexp3.cap(4); + id = regexp3.cap(5); + host = regexp3.cap(6); + message = regexp3.cap(7); - } else if ( regexp4.indexIn( m_machiLine ) != -1 ) { + } else if (regexp4.indexIn(m_machiLine) != -1) { - num = regexp4.cap( 1 ).toInt(); - mail = regexp4.cap( 2 ); - name = regexp4.cap( 3 ); - date = regexp4.cap( 4 ); - time = regexp4.cap( 5 ); - id = regexp4.cap( 6 ); - host = regexp4.cap( 7 ); - message = regexp4.cap( 8 ); + num = regexp4.cap(1).toInt(); + mail = regexp4.cap(2); + name = regexp4.cap(3); + date = regexp4.cap(4); + time = regexp4.cap(5); + id = regexp4.cap(6); + host = regexp4.cap(7); + message = regexp4.cap(8); - } else if ( regexp5.indexIn( m_machiLine ) != -1 ) { /* abone */ + } else if (regexp5.indexIn(m_machiLine) != -1) { /* abone */ - num = regexp5.cap( 1 ).toInt(); + num = regexp5.cap(1).toInt(); m_machiLine.clear(); - if ( num == nextNum ) return "abone<><><>abone<>"; + if (num == nextNum) return "abone<><><>abone<>"; else return QString(); - } else if ( title_regexp.indexIn( m_machiLine ) != -1 ) { /* get title */ + } else if (title_regexp.indexIn(m_machiLine) != -1) { /* get title */ - m_machiSubject = title_regexp.cap( 1 ); + m_machiSubject = title_regexp.cap(1); m_machiLine.clear(); return QString(); } else return QString(); - if ( num >= nextNum ) { + if (num >= nextNum) { - if ( num != 1 ) m_machiSubject.clear(); + if (num != 1) m_machiSubject.clear(); ret += name + "<><>" + date + ' ' + time + " ID:" + id; - if ( !host.isEmpty() ) ret += " HOST:" + host; + if (!host.isEmpty()) ret += " HOST:" + host; ret += "<>" + message + "<>" + m_machiSubject; nextNum = num; } @@ -693,11 +693,11 @@ /* for JBBS */ -QString Kita::ParseJBBSOneLine( const QString& line, int& nextNum ) +QString Kita::ParseJBBSOneLine(const QString& line, int& nextNum) { QString ret; - QStringList list = line.split( "<>" ); - if ( list.size() != 7 ) return QString(); + QStringList list = line.split("<>"); + if (list.size() != 7) return QString(); int num = list[ 0 ].toInt(); QString name = list[ 1 ]; @@ -707,15 +707,15 @@ QString subject = list[ 5 ]; QString id = list[ 6 ]; - if ( num < nextNum ) return QString(); + if (num < nextNum) return QString(); /* remove tag */ - QRegExp rex( "<[^<]*>" ); - name.remove( rex ); + QRegExp rex("<[^<]*>"); + name.remove(rex); /* remove week */ - rex = QRegExp( "\\(.*\\)" ); - date.remove( rex ); + rex = QRegExp("\\(.*\\)"); + date.remove(rex); ret += name + "<>" + mail + "<>" + date + " ID:" + id + "<>" + body + "<>" + subject; nextNum = num; @@ -728,11 +728,11 @@ /* for Flash CGI/Mini Thread */ -QString Kita::ParseFlashCGIOneLine( const QString& line ) +QString Kita::ParseFlashCGIOneLine(const QString& line) { QString ret; - QStringList list = line.split( "<>" ); - if ( list.size() != 13 ) return QString(); + QStringList list = line.split("<>"); + if (list.size() != 13) return QString(); QString name = list[ 0 ]; QString mail = list[ 1 ]; @@ -743,11 +743,11 @@ QString host = list[ 7 ]; /* remove tag */ - QRegExp rex( "<[^<]*>" ); - name.remove( rex ); + QRegExp rex("<[^<]*>"); + name.remove(rex); ret += name + "<>" + mail + "<>" + date + " ID:" + id; - if ( !host.isEmpty() ) ret += " HOST:" + host; + if (!host.isEmpty()) ret += " HOST:" + host; ret += "<>" + body + "<>" + subject; return ret; @@ -779,9 +779,9 @@ resdat.* subject */ -bool Kita::parseResDat( RESDAT& resdat, QString& subject ) +bool Kita::parseResDat(RESDAT& resdat, QString& subject) { - if ( resdat.parsed ) return true; + if (resdat.parsed) return true; resdat.parsed = true; resdat.broken = false; @@ -792,14 +792,14 @@ unsigned int length = resdat.linestr.length(); unsigned int section = 0; unsigned int sectionPos[ 5 ]; - for ( unsigned int i = 0 ; i < length ; i++ ) { + for (unsigned int i = 0 ; i < length ; i++) { /* sections are splitted by "<>" */ - if ( chpt[ i ] == '<' && chpt[ i + 1 ] == '>' ) { + if (chpt[ i ] == '<' && chpt[ i + 1 ] == '>') { section++; - if ( section >= 5 ) { + if (section >= 5) { resdat.broken = true; return true; } @@ -810,31 +810,31 @@ } /* broken data */ - if ( section != 4 ) { + if (section != 4) { resdat.broken = true; return true; } - // qDebug("[%d] %d %d %d %d",section, sectionPos[1],sectionPos[2],sectionPos[3],sectionPos[4] ); + // qDebug("[%d] %d %d %d %d",section, sectionPos[1],sectionPos[2],sectionPos[3],sectionPos[4]); /* name */ length = sectionPos[ 1 ] - 2 ; - parseName( resdat.linestr.mid( 0, length ), resdat ); + parseName(resdat.linestr.mid(0, length), resdat); /* mail */ length = sectionPos[ 2 ] - 2 - sectionPos[ 1 ]; - DatToText( resdat.linestr.mid( sectionPos[ 1 ], length ), resdat.address ); + DatToText(resdat.linestr.mid(sectionPos[ 1 ], length), resdat.address); /* date, ID, host */ length = sectionPos[ 3 ] - 2 - sectionPos[ 2 ]; - parseDateId( resdat.linestr.mid( sectionPos[ 2 ], length ), resdat ); + parseDateId(resdat.linestr.mid(sectionPos[ 2 ], length), resdat); /* body */ length = sectionPos[ 4 ] - 2 - sectionPos[ 3 ]; - parseBody( resdat.linestr.mid( sectionPos[ 3 ], length ), resdat ); + parseBody(resdat.linestr.mid(sectionPos[ 3 ], length), resdat); /* subject */ - subject = resdat.linestr.mid( sectionPos[ 4 ] ); + subject = resdat.linestr.mid(sectionPos[ 4 ]); return true; } @@ -848,30 +848,30 @@ resdat.nameHTML */ -void Kita::parseName( const QString& rawStr, RESDAT& resdat ) +void Kita::parseName(const QString& rawStr, RESDAT& resdat) { unsigned int i = 0, pos; int refNum[ 2 ]; QString linkurl, linkstr; - DatToText( rawStr, resdat.name ); + DatToText(rawStr, resdat.name); const QChar * chpt = resdat.name.unicode(); unsigned int length = resdat.name.length(); resdat.nameHTML.clear(); /* anchor */ - while ( parseResAnchor( chpt + i, length - i, linkstr, refNum, pos ) ) { + while (parseResAnchor(chpt + i, length - i, linkstr, refNum, pos)) { - linkurl = QString( "#%1" ).arg( refNum[ 0 ] ); - if ( refNum[ 1 ] ) linkurl += QString( "-%1" ).arg( refNum[ 1 ] ); + linkurl = QString("#%1").arg(refNum[ 0 ]); + if (refNum[ 1 ]) linkurl += QString("-%1").arg(refNum[ 1 ]); resdat.nameHTML += "<a href=\"" + linkurl + "\">"; resdat.nameHTML += linkstr; resdat.nameHTML += "</a>"; ANCNUM anctmp; - if ( refNum[ 1 ] < refNum[ 0 ] ) refNum[ 1 ] = refNum[ 0 ]; + if (refNum[ 1 ] < refNum[ 0 ]) refNum[ 1 ] = refNum[ 0 ]; anctmp.from = refNum[ 0 ]; anctmp.to = refNum[ 1 ]; resdat.anclist += anctmp; @@ -880,10 +880,10 @@ } /* non-digits strings */ - if ( i < length ) { + if (i < length) { resdat.nameHTML += "<span class=\"name_noaddr\">"; - resdat.nameHTML += resdat.name.mid( i ); + resdat.nameHTML += resdat.name.mid(i); resdat.nameHTML += "</span>"; } @@ -900,7 +900,7 @@ resdat.host */ -void Kita::parseDateId( const QString& rawStr, RESDAT& resdat ) +void Kita::parseDateId(const QString& rawStr, RESDAT& resdat) { resdat.date = rawStr; resdat.id.clear(); @@ -912,48 +912,48 @@ unsigned int pos = 0, startpos = 0; unsigned int length = rawStr.length(); - while ( chpt[ pos ] != '\0' && - !( chpt[ pos ] == 'I' && chpt[ pos + 1 ] == 'D' ) && - !( chpt[ pos ] == 'B' && chpt[ pos + 1 ] == 'E' ) ) { + while (chpt[ pos ] != '\0' && + !(chpt[ pos ] == 'I' && chpt[ pos + 1 ] == 'D') && + !(chpt[ pos ] == 'B' && chpt[ pos + 1 ] == 'E')) { pos++; } - resdat.date = rawStr.left( pos ); + resdat.date = rawStr.left(pos); /* id */ - if ( chpt[ pos ] == 'I' && chpt[ pos + 1 ] == 'D' ) { + if (chpt[ pos ] == 'I' && chpt[ pos + 1 ] == 'D') { pos += 3; startpos = pos; - while ( chpt[ pos ] != ' ' && pos++ < length ) {}; - resdat.id = rawStr.mid( startpos, pos - startpos ); + while (chpt[ pos ] != ' ' && pos++ < length) {}; + resdat.id = rawStr.mid(startpos, pos - startpos); pos++; } - // qDebug("date %s, ID %s", (const char*)resdat.date.local8Bit(), resdat.id.ascii() ); + // qDebug("date %s, ID %s", (const char*)resdat.date.local8Bit(), resdat.id.ascii()); - if ( pos >= length ) return ; + if (pos >= length) return ; /* be */ - if ( chpt[ pos ] == 'B' && chpt[ pos + 1 ] == 'E' ) { + if (chpt[ pos ] == 'B' && chpt[ pos + 1 ] == 'E') { pos += 3; startpos = pos; - while ( chpt[ pos ] != '-' && pos++ < length ) {}; - resdat.be = rawStr.mid( startpos, pos - startpos ); + while (chpt[ pos ] != '-' && pos++ < length) {}; + resdat.be = rawStr.mid(startpos, pos - startpos); pos++; - if ( pos < length && chpt[ pos ] == '#') { + if (pos < length && chpt[ pos ] == '#') { startpos = pos; - while ( chpt[ pos ] == '#' && pos++ < length ) {}; - resdat.bepointmark = rawStr.mid( startpos, pos - startpos ); + while (chpt[ pos ] == '#' && pos++ < length) {}; + resdat.bepointmark = rawStr.mid(startpos, pos - startpos); } } - if ( pos >= length ) return ; + if (pos >= length) return ; /* host */ - if ( chpt[ pos ] == 'H' && chpt[ pos + 1 ] == 'O' ) { + if (chpt[ pos ] == 'H' && chpt[ pos + 1 ] == 'O') { pos += 5; startpos = pos; - while ( chpt[ pos ] != ' ' && pos++ < length ) {}; - resdat.host = rawStr.mid( startpos, pos - startpos ); + while (chpt[ pos ] != ' ' && pos++ < length) {}; + resdat.host = rawStr.mid(startpos, pos - startpos); pos++; // qDebug("host %s", resdat.host.ascii()); } @@ -968,7 +968,7 @@ resdat.bodyHTML */ -void Kita::parseBody( const QString &rawStr, RESDAT& resdat ) +void Kita::parseBody(const QString &rawStr, RESDAT& resdat) { resdat.bodyHTML.clear(); @@ -988,27 +988,27 @@ */ int offset = 0; - if ( chpt[ 0 ] == ' ' ) offset = 1; /* remove one space after <> */ - for ( unsigned int i = startPos = offset ; i < length ; i++ ) { + if (chpt[ 0 ] == ' ') offset = 1; /* remove one space after <> */ + for (unsigned int i = startPos = offset ; i < length ; i++) { - switch ( chpt[ i ].unicode() ) { + switch (chpt[ i ].unicode()) { case '<': /* " <br> " */ - if ( chpt[ i + 1 ] == 'b' && chpt[ i + 2 ] == 'r' && chpt[ i + 3 ] == '>' ) { + if (chpt[ i + 1 ] == 'b' && chpt[ i + 2 ] == 'r' && chpt[ i + 3 ] == '>') { /* reset anchor chain */ ancChain = false; unsigned int i2 = i - startPos; - if ( i > 0 && chpt[ i - 1 ] == ' ' ) i2--; /* remove space before <br> */ - resdat.bodyHTML += rawStr.mid( startPos, i2 ); + if (i > 0 && chpt[ i - 1 ] == ' ') i2--; /* remove space before <br> */ + resdat.bodyHTML += rawStr.mid(startPos, i2); resdat.bodyHTML += "<br>"; startPos = i + 4; - if ( chpt[ startPos ] == ' ' ) startPos++; /* remove space after <br> */ + if (chpt[ startPos ] == ' ') startPos++; /* remove space after <br> */ i = startPos - 1; } @@ -1017,8 +1017,8 @@ /* remove HTML tags <[^>]*> */ else { - if ( i - startPos ) resdat.bodyHTML += rawStr.mid( startPos, i - startPos ); - while ( chpt[ i ] != '>' && i < length ) i++; + if (i - startPos) resdat.bodyHTML += rawStr.mid(startPos, i - startPos); + while (chpt[ i ] != '>' && i < length) i++; startPos = i + 1; } @@ -1029,9 +1029,9 @@ case 'h': /* "http://" or "ttp://" or "tp:" */ case 't': - if ( parseLink( chpt + i, length - i, linkstr, linkurl, pos ) ) { + if (parseLink(chpt + i, length - i, linkstr, linkurl, pos)) { - resdat.bodyHTML += rawStr.mid( startPos, i - startPos ); + resdat.bodyHTML += rawStr.mid(startPos, i - startPos); resdat.bodyHTML += "<a href=\"" + linkurl + "\">"; resdat.bodyHTML += linkstr; resdat.bodyHTML += "</a>"; @@ -1047,8 +1047,8 @@ case '&': /* > */ - if ( chpt[ i + 1 ] == 'g' && chpt[ i + 2 ] == 't' && chpt[ i + 3 ] == ';' ) - ancChain = createResAnchor( rawStr, resdat, chpt, i, startPos ); + if (chpt[ i + 1 ] == 'g' && chpt[ i + 2 ] == 't' && chpt[ i + 3 ] == ';') + ancChain = createResAnchor(rawStr, resdat, chpt, i, startPos); break; @@ -1057,18 +1057,18 @@ /* unicode '>' */ case UTF16_BRACKET: - ancChain = createResAnchor( rawStr, resdat, chpt, i, startPos ); + ancChain = createResAnchor(rawStr, resdat, chpt, i, startPos); break; /*----------------------------------*/ default: - if ( ancChain ) ancChain = createResAnchor( rawStr, resdat, chpt, i, startPos ); + if (ancChain) ancChain = createResAnchor(rawStr, resdat, chpt, i, startPos); } } - resdat.bodyHTML += rawStr.mid( startPos ); + resdat.bodyHTML += rawStr.mid(startPos); } @@ -1106,22 +1106,22 @@ QString prefix; QString scheme; - if ( isEqual( cdat , "http://" ) ) { + if (isEqual(cdat , "http://")) { prefix = "http://"; scheme = "http://"; - } else if ( isEqual( cdat , "ttp://" ) ) { + } else if (isEqual(cdat , "ttp://")) { prefix = "ttp://"; scheme = "http://"; - } else if ( isEqual( cdat , "tp://" ) ) { + } else if (isEqual(cdat , "tp://")) { prefix = "tp://"; scheme = "http://"; - } else if ( isEqual( cdat , "https://" ) ) { + } else if (isEqual(cdat , "https://")) { prefix = "https://"; scheme = "https://"; - } else if ( isEqual( cdat , "ttps://" ) ) { + } else if (isEqual(cdat , "ttps://")) { prefix = "ttps://"; scheme = "https://"; - } else if ( isEqual( cdat , "tps://" ) ) { + } else if (isEqual(cdat , "tps://")) { prefix = "tps://"; scheme = "https://"; } else { @@ -1129,14 +1129,14 @@ } pos = prefix.length(); - while ( cdat[ pos ] >= '!' && cdat[ pos ] <= '~' && + while (cdat[ pos ] >= '!' && cdat[ pos ] <= '~' && cdat[ pos ] != ' ' && cdat[ pos ] != '<' && cdat[ pos ] != '>' - && pos < length ) { + && pos < length) { retlinkstr += cdat[ pos++ ]; } - if ( pos > length ) return false; + if (pos > length) return false; - if ( !retlinkstr.isEmpty() ) DatToText( retlinkstr, linkstr ); + if (!retlinkstr.isEmpty()) DatToText(retlinkstr, linkstr); linkurl = scheme + linkstr; linkstr = prefix + linkstr; @@ -1155,7 +1155,7 @@ linkstr = ">12-20", refNum[0] = 12, refNum[1] = 20, - pos (= length of cdat ) = 9, + pos (= length of cdat) = 9, ret = true; */ @@ -1165,19 +1165,19 @@ const QChar *cdat, const unsigned int length, /* output */ - QString& linkstr, int* refNum, unsigned int& pos ) + QString& linkstr, int* refNum, unsigned int& pos) { struct LocalFunc { - static bool isHYPHEN( unsigned short c ) + static bool isHYPHEN(unsigned short c) { /* UTF-16 */ - if ( c == '-' - || ( c >= 0x2010 && c <= 0x2015 ) - || ( c == 0x2212 ) - || ( c == 0xFF0D ) /* UTF8: 0xEFBC8D */ - ) { + if (c == '-' + || (c >= 0x2010 && c <= 0x2015) + || (c == 0x2212) + || (c == 0xFF0D) /* UTF8: 0xEFBC8D */ + ) { return true; } @@ -1188,7 +1188,7 @@ bool ret = false; int i; - if ( length == 0 ) return false; + if (length == 0) return false; linkstr.clear(); refNum[ 0 ] = 0; @@ -1196,13 +1196,13 @@ pos = 0; /* check '>' twice */ - for ( i = 0;i < 2;i++ ) { + for (i = 0;i < 2;i++) { - if ( cdat[ pos ].unicode() == UTF16_BRACKET ) { + if (cdat[ pos ].unicode() == UTF16_BRACKET) { linkstr += cdat[ pos ]; pos++; - } else if ( cdat[ pos ] == '&' && cdat[ pos + 1 ] == 'g' /* > */ - && cdat[ pos + 2 ] == 't' && cdat[ pos + 3 ] == ';' ) { + } else if (cdat[ pos ] == '&' && cdat[ pos + 1 ] == 'g' /* > */ + && cdat[ pos + 2 ] == 't' && cdat[ pos + 3 ] == ';') { linkstr += '>'; pos += 4; } @@ -1210,16 +1210,16 @@ } /* check ',' */ - if ( !pos ) { - if ( cdat[ pos ] == ',' || cdat[ pos ].unicode() == UTF16_COMMA ) { + if (!pos) { + if (cdat[ pos ] == ',' || cdat[ pos ].unicode() == UTF16_COMMA) { linkstr += ','; pos ++; } } /* check '=' */ - if ( !pos ) { - if ( cdat[ pos ] == '=' || cdat[ pos ].unicode() == UTF16_EQ ) { + if (!pos) { + if (cdat[ pos ] == '=' || cdat[ pos ].unicode() == UTF16_EQ) { linkstr += '='; pos ++; } @@ -1228,24 +1228,24 @@ /* check digits */ int hyphen = 0; - for ( i = 0 ; i < KITA_RESDIGIT + 1 && pos < length ; i++, pos++ ) { + for (i = 0 ; i < KITA_RESDIGIT + 1 && pos < length ; i++, pos++) { unsigned short c = cdat[ pos ].unicode(); - if ( ( c < UTF16_0 || c > UTF16_9 ) - && ( c < '0' || c > '9' ) - && ( !LocalFunc::isHYPHEN( c ) - || ( i == 0 && LocalFunc::isHYPHEN( c ) ) - || ( hyphen && LocalFunc::isHYPHEN( c ) ) ) - ) break; + if ((c < UTF16_0 || c > UTF16_9) + && (c < '0' || c > '9') + && (!LocalFunc::isHYPHEN(c) + || (i == 0 && LocalFunc::isHYPHEN(c)) + || (hyphen && LocalFunc::isHYPHEN(c))) + ) break; linkstr += cdat[ pos ]; - if ( LocalFunc::isHYPHEN( c ) ) { + if (LocalFunc::isHYPHEN(c)) { hyphen = 1; i = -1; } else { - if ( c >= UTF16_0 ) c = '0' + cdat[ pos ].unicode() - UTF16_0; + if (c >= UTF16_0) c = '0' + cdat[ pos ].unicode() - UTF16_0; refNum[ hyphen ] *= 10; refNum[ hyphen ] += c - '0'; } @@ -1261,8 +1261,8 @@ /* create res anchor */ /* This function is called from parseBody internally. See also parseBody. */ -bool Kita::createResAnchor( const QString &rawStr, RESDAT& resdat, - const QChar *chpt, unsigned int &i, unsigned int &startPos ) +bool Kita::createResAnchor(const QString &rawStr, RESDAT& resdat, + const QChar *chpt, unsigned int &i, unsigned int &startPos) { QString linkstr, linkurl; int refNum[ 2 ]; @@ -1270,16 +1270,16 @@ unsigned int length = rawStr.length(); /* parse anchor */ - if ( !parseResAnchor( chpt + i, length - i, linkstr, refNum, pos ) ) { + if (!parseResAnchor(chpt + i, length - i, linkstr, refNum, pos)) { i += pos - 1; return false; } /* create anchor */ - resdat.bodyHTML += rawStr.mid( startPos, i - startPos ); - linkurl = QString( "#%1" ).arg( refNum[ 0 ] ); - if ( refNum[ 1 ] ) linkurl += QString( "-%1" ).arg( refNum[ 1 ] ); + resdat.bodyHTML += rawStr.mid(startPos, i - startPos); + linkurl = QString("#%1").arg(refNum[ 0 ]); + if (refNum[ 1 ]) linkurl += QString("-%1").arg(refNum[ 1 ]); resdat.bodyHTML += "<a href=\"" + linkurl + "\">"; resdat.bodyHTML += linkstr; @@ -1287,7 +1287,7 @@ /* add anchor to ancList */ ANCNUM anctmp; - if ( refNum[ 1 ] < refNum[ 0 ] ) refNum[ 1 ] = refNum[ 0 ]; + if (refNum[ 1 ] < refNum[ 0 ]) refNum[ 1 ] = refNum[ 0 ]; anctmp.from = refNum[ 0 ]; anctmp.to = refNum[ 1 ]; resdat.anclist += anctmp; @@ -1306,41 +1306,41 @@ output: titleHTML */ -void Kita::createTitleHTML( RESDAT& resdat, QString& titleHTML ) +void Kita::createTitleHTML(RESDAT& resdat, QString& titleHTML) { titleHTML.clear(); - if ( !resdat.parsed ) return ; + if (!resdat.parsed) return ; bool showMailAddress = Kita::Config::showMailAddress(); bool useTableTag = Kita::Config::useStyleSheet(); - if ( m_colonstr.isEmpty() ) { - m_colonstr = utf8ToUnicode( KITAUTF8_COLON ); - m_colonnamestr = utf8ToUnicode( KITAUTF8_NAME ); + if (m_colonstr.isEmpty()) { + m_colonstr = utf8ToUnicode(KITAUTF8_COLON); + m_colonnamestr = utf8ToUnicode(KITAUTF8_NAME); } - if ( useTableTag ) titleHTML += "<table class=\"res_title\"><tr>"; + if (useTableTag) titleHTML += "<table class=\"res_title\"><tr>"; /* res number */ - if ( useTableTag ) titleHTML += "<td class=\"res_title_number\">"; - titleHTML += "<a href=\"#write" + QString().setNum( resdat.num ) + "\">"; - titleHTML += QString().setNum( resdat.num ); + if (useTableTag) titleHTML += "<td class=\"res_title_number\">"; + titleHTML += "<a href=\"#write" + QString().setNum(resdat.num) + "\">"; + titleHTML += QString().setNum(resdat.num); titleHTML += "</a> "; /* name & mail address */ - if ( useTableTag ) titleHTML += "<td class=\"res_title_name\">"; + if (useTableTag) titleHTML += "<td class=\"res_title_name\">"; titleHTML += "<b>" + m_colonnamestr; /* show name with mail address */ - if ( showMailAddress ) { + if (showMailAddress) { titleHTML += resdat.nameHTML; - if ( !resdat.address.isEmpty() ) titleHTML += " [" + resdat.address + ']'; + if (!resdat.address.isEmpty()) titleHTML += " [" + resdat.address + ']'; } else { /* don't show mail address */ - if ( resdat.address.isEmpty() ) { + if (resdat.address.isEmpty()) { titleHTML += "<span class=\"name_noaddr\">"; titleHTML += resdat.name; @@ -1358,81 +1358,81 @@ titleHTML += "</b> "; /* date */ - if ( useTableTag ) titleHTML += "<td class=\"res_title_date\">"; + if (useTableTag) titleHTML += "<td class=\"res_title_date\">"; titleHTML += m_colonstr + resdat.date; - if ( useTableTag ) titleHTML += "</td>"; + if (useTableTag) titleHTML += "</td>"; /* ID */ - if ( !resdat.id.isEmpty() ) { + if (!resdat.id.isEmpty()) { - if ( useTableTag ) titleHTML += "<td class=\"res_title_id\">"; - if ( resdat.id.count( "???" ) >= 1 ) titleHTML += " ID:" + resdat.id; + if (useTableTag) titleHTML += "<td class=\"res_title_id\">"; + if (resdat.id.count("???") >= 1) titleHTML += " ID:" + resdat.id; else titleHTML += " <a href=\"#idpop" + resdat.id + "\">ID</a>" + ":" + resdat.id; - if ( useTableTag ) titleHTML += "</td>"; + if (useTableTag) titleHTML += "</td>"; } /* BE */ - if ( !resdat.be.isEmpty() ) { + if (!resdat.be.isEmpty()) { - if ( useTableTag ) titleHTML += "<td class=\"res_title_be\">"; + if (useTableTag) titleHTML += "<td class=\"res_title_be\">"; titleHTML += " <a href=\"#bepop" + resdat.be + "\">?" + resdat.bepointmark + "</a>"; - if ( useTableTag ) titleHTML += "</td>"; + if (useTableTag) titleHTML += "</td>"; } /* host */ - if ( !resdat.host.isEmpty() ) { + if (!resdat.host.isEmpty()) { - if ( useTableTag ) titleHTML += "<td class=\"res_title_host\">"; + if (useTableTag) titleHTML += "<td class=\"res_title_host\">"; titleHTML += " HOST:" + resdat.host; - if ( useTableTag ) titleHTML += "</td>"; + if (useTableTag) titleHTML += "</td>"; } - if ( useTableTag ) titleHTML += "</tr></table>"; + if (useTableTag) titleHTML += "</tr></table>"; } -QString Kita::getCategory( const QString& line ) +QString Kita::getCategory(const QString& line) { - QRegExp regexp( "<BR><BR><B>(.*)</B><BR>" ); - if ( regexp.indexIn( line ) != -1 ) { - return regexp.cap( 1 ); + QRegExp regexp("<BR><BR><B>(.*)</B><BR>"); + if (regexp.indexIn(line) != -1) { + return regexp.cap(1); } else { return QString(); } } -bool Kita::isBoardURL( const QString& url ) +bool Kita::isBoardURL(const QString& url) { - QRegExp url_2ch( "http://.*\\.2ch\\.net/.*" ); - QRegExp url_bbspink( "http://.*\\.bbspink\\.com/.*" ); - QRegExp url_www_2ch( "http://www\\.2ch\\.net/.*" ); - QRegExp url_machibbs( "http://.*\\.machi\\.to/.*" ); + QRegExp url_2ch("http://.*\\.2ch\\.net/.*"); + QRegExp url_bbspink("http://.*\\.bbspink\\.com/.*"); + QRegExp url_www_2ch("http://www\\.2ch\\.net/.*"); + QRegExp url_machibbs("http://.*\\.machi\\.to/.*"); - if ( url.isEmpty() ) return false; + if (url.isEmpty()) return false; - if ( url_2ch.indexIn( url ) == -1 && url_bbspink.indexIn( url ) == -1 - && url_machibbs.indexIn( url ) == -1 ) return false; - if ( url_www_2ch.indexIn( url ) != -1 ) return false; + if (url_2ch.indexIn(url) == -1 && url_bbspink.indexIn(url) == -1 + && url_machibbs.indexIn(url) == -1) return false; + if (url_www_2ch.indexIn(url) != -1) return false; return true; } -QString Kita::fontToString( const QFont& font ) +QString Kita::fontToString(const QFont& font) { - return font.family() + ' ' + QString::number( font.pointSize() ); + return font.family() + ' ' + QString::number(font.pointSize()); } // copied from kurl.cpp -static QTextCodec * Kita::codecForHint( int encoding_hint /* not 0 ! */ ) +static QTextCodec * Kita::codecForHint(int encoding_hint /* not 0 ! */) { - return QTextCodec::codecForMib( encoding_hint ); + return QTextCodec::codecForMib(encoding_hint); } // encoding_offset: // 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 Kita::encode(const QString& segment, int encoding_offset, int encoding_hint, bool isRawURI) { const char *encode_string = "/@<>#\"&?={}|^~[]\'`\\:+%"; encode_string += encoding_offset; @@ -1442,31 +1442,31 @@ local = segment.toLocal8Bit(); else { - QTextCodec * textCodec = codecForHint( encoding_hint ); + QTextCodec * textCodec = codecForHint(encoding_hint); if (!textCodec) local = segment.toLocal8Bit(); else - local = textCodec->fromUnicode( segment ); + local = textCodec->fromUnicode(segment); } int old_length = isRawURI ? local.size() - 1 : local.length(); - if ( !old_length ) + if (!old_length) return segment.isEmpty() ? QString() : QString(""); // differentiate null and empty // a worst case approximation QChar *new_segment = new QChar[ old_length * 3 + 1 ]; int new_length = 0; - for ( int i = 0; i < old_length; i++ ) + for (int i = 0; i < old_length; i++) { // 'unsave' and 'reserved' characters // according to RFC 1738, // 2.2. URL Character Encoding Issues (pp. 3-4) // WABA: Added non-ascii unsigned char character = local[i]; - if ( (character <= 32) || (character >= 127) || - strchr(encode_string, character) ) + if ((character <= 32) || (character >= 127) || + strchr(encode_string, character)) { new_segment[ new_length++ ] = '%'; Modified: kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -35,79 +35,79 @@ /*------------------------------*/ /* text codecs */ - QString qcpToUnicode( const QByteArray& str ); - KDE_EXPORT QString utf8ToUnicode( const QByteArray& str ); - QString eucToUnicode( const QByteArray& str ); - QByteArray unicodeToQcp( const QString& str ); - QByteArray unicodeToEuc( const QString& str ); + QString qcpToUnicode(const QByteArray& str); + KDE_EXPORT QString utf8ToUnicode(const QByteArray& str); + QString eucToUnicode(const QByteArray& str); + QByteArray unicodeToQcp(const QString& str); + QByteArray unicodeToEuc(const QString& str); QString encode_string(const QString &str, int encoding_hint); /*------------------------------*/ /* conversion of DAT */ - QString datToHtml( const QString& rawData, int num ); - void DatToText( const QString &rawData, QString& text ); - QString parseSpecialChar( const QChar *cdat, unsigned int& pos ); + QString datToHtml(const QString& rawData, int num); + void DatToText(const QString &rawData, QString& text); + QString parseSpecialChar(const QChar *cdat, unsigned int& pos); /*------------------------------*/ /* conversion of URL */ - KDE_EXPORT KUrl getDatURL( const KUrl& url , QString& refstr ); - KDE_EXPORT KUrl getDatURL( const KUrl& url ); + KDE_EXPORT KUrl getDatURL(const KUrl& url , QString& refstr); + KDE_EXPORT KUrl getDatURL(const KUrl& url); - QString getThreadURL( const KUrl& url, QString& refstr ); - KDE_EXPORT QString getThreadURL( const KUrl& url ); - KDE_EXPORT QString getWriteURL( const KUrl& datURL ); - QString getNewThreadWriteURL( const KUrl& datURL ); + QString getThreadURL(const KUrl& url, QString& refstr); + KDE_EXPORT QString getThreadURL(const KUrl& url); + KDE_EXPORT QString getWriteURL(const KUrl& datURL); + QString getNewThreadWriteURL(const KUrl& datURL); - QString convertURL( int mode, const KUrl& url , QString& refstr ); + QString convertURL(int mode, const KUrl& url , QString& refstr); - QString datToOfflaw( const KUrl& datURL ); + QString datToOfflaw(const KUrl& datURL); /*------------------------------*/ /* utilities */ - bool mkdir( const QString& path ); - QString unescape( const QString& str ); - KDE_EXPORT uint datToSince( const KUrl& datURL ); - int isEqual( const QChar *cdat, const QString& str ); - KDE_EXPORT int stringToPositiveNum( const QChar *cdat, const unsigned int length ); - KDE_EXPORT QString getCategory( const QString& line ); - KDE_EXPORT bool isBoardURL( const QString& url ); - KDE_EXPORT QString fontToString( const QFont& font ); + bool mkdir(const QString& path); + QString unescape(const QString& str); + KDE_EXPORT uint datToSince(const KUrl& datURL); + int isEqual(const QChar *cdat, const QString& str); + KDE_EXPORT int stringToPositiveNum(const QChar *cdat, const unsigned int length); + KDE_EXPORT QString getCategory(const QString& line); + KDE_EXPORT bool isBoardURL(const QString& url); + KDE_EXPORT QString fontToString(const QFont& font); /*------------------------------*/ /* internal parsing functions */ - KDE_EXPORT QStringList parseSearchQuery( const QString& input ); + KDE_EXPORT QStringList parseSearchQuery(const QString& input); /* for MACHI BBS */ void InitParseMachiBBS(); - QString ParseMachiBBSOneLine( const QString& inputLine, int& nextNum ); + QString ParseMachiBBSOneLine(const QString& inputLine, int& nextNum); /* for JBBS */ - QString ParseJBBSOneLine( const QString& line, int& nextNum ); + QString ParseJBBSOneLine(const QString& line, int& nextNum); /* for Flash CGI/Mini Thread */ - QString ParseFlashCGIOneLine( const QString& line ); + QString ParseFlashCGIOneLine(const QString& line); /* for 2ch */ - bool parseResDat( RESDAT& resdat, QString& subject ); + bool parseResDat(RESDAT& resdat, QString& subject); - void parseName( const QString& rawStr, RESDAT& resdat ); - void parseDateId( const QString& rawStr, RESDAT& resdat ); - void parseBody( const QString &rawStr, RESDAT& resdat ); + void parseName(const QString& rawStr, RESDAT& resdat); + void parseDateId(const QString& rawStr, RESDAT& resdat); + void parseBody(const QString &rawStr, RESDAT& resdat); - bool parseLink( const QChar *cdat, const unsigned int length, - QString& linkstr, QString& linkurl, unsigned int& pos ); - bool parseResAnchor( const QChar *cdat, const unsigned int length, - QString& linkstr, int* refNum, unsigned int& pos ); - bool createResAnchor( const QString &rawStr, RESDAT& resdat, - const QChar *chpt, unsigned int &i, unsigned int &index ); + bool parseLink(const QChar *cdat, const unsigned int length, + QString& linkstr, QString& linkurl, unsigned int& pos); + bool parseResAnchor(const QChar *cdat, const unsigned int length, + QString& linkstr, int* refNum, unsigned int& pos); + bool createResAnchor(const QString &rawStr, RESDAT& resdat, + const QChar *chpt, unsigned int &i, unsigned int &index); - void createTitleHTML( RESDAT& resdat, QString& titletext ); + void createTitleHTML(RESDAT& resdat, QString& titletext); } #endif Modified: kita/branches/KITA-KDE4/kita/src/libkita/machibbs.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/machibbs.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/machibbs.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -24,19 +24,19 @@ { } -QString MachiBBS::buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime ) +QString MachiBBS::buildPostStr(const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime) { QString ret; QTextCodec* codec = QTextCodec::codecForName("Shift-JIS"); 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 += "&BBS=" ) += boardID; - ( ret += "&KEY=" ) += threadID; - ( ret += "&TIME=" ) += QString::number( serverTime ); + (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 += "&BBS=") += boardID; + (ret += "&KEY=") += threadID; + (ret += "&TIME=") += QString::number(serverTime); return ret; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/machibbs.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/machibbs.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/machibbs.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -19,7 +19,7 @@ */ class KDE_EXPORT MachiBBS { public: - static QString buildPostStr( const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime ); + static QString buildPostStr(const QString& name, const QString& mail, const QString& body, const QString& boardID, const QString& threadID, int serverTime); private: MachiBBS(); Modified: kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/parsemisc.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -23,14 +23,14 @@ class ParseMisc { public: - static KUrl parseURL( const KUrl& url , QString& refstr ) + static KUrl parseURL(const KUrl& url , QString& refstr) { - return Kita::getDatURL( url , refstr ); + return Kita::getDatURL(url , refstr); } - static KUrl parseURLonly( const KUrl& url ) { return Kita::getDatURL( url ); } + static KUrl parseURLonly(const KUrl& url) { return Kita::getDatURL(url); } - static QString utf8ToUnicode( const QByteArray& str ) { return Kita::utf8ToUnicode( str ); } + static QString utf8ToUnicode(const QByteArray& str) { return Kita::utf8ToUnicode(str); } }; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/thread.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/thread.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/thread.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -17,8 +17,8 @@ Q3Dict<Thread>* Thread::m_threadDict = 0; -Thread::Thread( const KUrl& datURL ) - : m_datURL( datURL ), m_threadName( 0 ) , m_resNum( 0 ), m_readNum( 0 ), m_viewPos( 0 ) +Thread::Thread(const KUrl& datURL) + : m_datURL(datURL), m_threadName(0) , m_resNum(0), m_readNum(0), m_viewPos(0) {} Thread::~Thread() @@ -36,14 +36,14 @@ } /* public */ -void Thread::setThreadName( QString threadName ) +void Thread::setThreadName(QString threadName) { /* remove space */ - QRegExp qrx( " +$" ); - threadName.remove( qrx ); + QRegExp qrx(" +$"); + threadName.remove(qrx); /* unescape */ - threadName.replace( "<", "<" ).replace( ">", ">" ).replace( "&", "&" ); + threadName.replace("<", "<").replace(">", ">").replace("&", "&"); m_threadName = threadName; } @@ -55,7 +55,7 @@ } /* public */ -void Thread::setResNum( int num ) +void Thread::setResNum(int num) { m_resNum = num; } @@ -67,10 +67,10 @@ } /* public */ -void Thread::setReadNum( int num ) +void Thread::setReadNum(int num) { m_readNum = num; - if ( m_resNum < m_readNum ) setResNum( m_readNum ); + if (m_resNum < m_readNum) setResNum(m_readNum); } /* public */ @@ -80,7 +80,7 @@ } /* public */ -void Thread::setViewPos( int num ) +void Thread::setViewPos(int num) { m_viewPos = num; } @@ -92,30 +92,30 @@ } /* public */ -void Thread::setMarkList( const Q3ValueList< int >& markList ) +void Thread::setMarkList(const Q3ValueList< int >& markList) { m_markList = markList; } /* public */ -bool Thread::isMarked( int num ) +bool Thread::isMarked(int num) { Q3ValueList< int >::iterator it; - for ( it = m_markList.begin(); it != m_markList.end(); ++it ) { - if ( ( *it ) == num ) return true; + for (it = m_markList.begin(); it != m_markList.end(); ++it) { + if ((*it) == num) return true; } return false; } /* public */ -bool Thread::setMark( int num, bool newStatus ) +bool Thread::setMark(int num, bool newStatus) { - bool status = isMarked( num ); - if ( status == newStatus ) return false; + bool status = isMarked(num); + if (status == newStatus) return false; - if ( newStatus ) m_markList += num; - else m_markList.remove( num ); + if (newStatus) m_markList += num; + else m_markList.remove(num); return true; } @@ -125,41 +125,41 @@ /* static functions */ -Thread* Thread::getByURL( const KUrl& datURL ) +Thread* Thread::getByURL(const KUrl& datURL) { - if ( m_threadDict == 0 ) { + if (m_threadDict == 0) { m_threadDict = new Q3Dict<Thread>(); } - Thread* thread = m_threadDict->find( datURL.prettyUrl() ); - if ( thread ) return thread; + Thread* thread = m_threadDict->find(datURL.prettyUrl()); + if (thread) return thread; - Thread* newThread = new Thread( datURL ); - m_threadDict->insert( datURL.prettyUrl(), newThread ); + Thread* newThread = new Thread(datURL); + m_threadDict->insert(datURL.prettyUrl(), newThread); return newThread; } /* static & public */ -Thread* Thread::getByURLNew( const KUrl& datURL ) +Thread* Thread::getByURLNew(const KUrl& datURL) { - if ( m_threadDict == 0 ) return 0; + if (m_threadDict == 0) return 0; - return m_threadDict->find( datURL.prettyUrl() ); + return m_threadDict->find(datURL.prettyUrl()); } -void Thread::replace( const QString& fromURL, const QString& toURL ) +void Thread::replace(const QString& fromURL, const QString& toURL) { - if ( m_threadDict == 0 ) return ; - Q3DictIterator<Kita::Thread> it( *m_threadDict ); - for ( ; it.current(); ++it ) { + if (m_threadDict == 0) return ; + Q3DictIterator<Kita::Thread> it(*m_threadDict); + for (; it.current(); ++it) { QString url = it.currentKey(); Kita::Thread* thread = it.current(); - if ( url.indexOf( fromURL ) == 0 ) { - m_threadDict->remove( url ); - url = url.replace( 0, fromURL.length(), toURL ); + if (url.indexOf(fromURL) == 0) { + m_threadDict->remove(url); + url = url.replace(0, fromURL.length(), toURL); thread->m_datURL = url; - m_threadDict->insert( url, thread ); + m_threadDict->insert(url, thread); it.toFirst(); } } Modified: kita/branches/KITA-KDE4/kita/src/libkita/thread.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/thread.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/thread.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -33,33 +33,33 @@ Q3ValueList< int > m_markList; public: - Thread( const KUrl& datURL ); + Thread(const KUrl& datURL); ~Thread(); const KUrl& datURL() const; const QString& threadName() const; - void setThreadName( QString threadName ); + void setThreadName(QString threadName); int resNum() const; - void setResNum( int num ); + void setResNum(int num); int readNum() const; - void setReadNum( int num ); + void setReadNum(int num); int viewPos() const; - void setViewPos( int viewPos ); + void setViewPos(int viewPos); const Q3ValueList< int >& markList() const; - void setMarkList( const Q3ValueList< int >& markList ); - bool isMarked( int num ); - bool setMark( int num, bool newStatus ); + void setMarkList(const Q3ValueList< int >& markList); + bool isMarked(int num); + bool setMark(int num, bool newStatus); /*----------------------*/ - static Thread* getByURL( const KUrl& datURL ); - static Thread* getByURLNew( const KUrl& datURL ); - static void replace( const QString& fromURL, const QString& toURL ); + static Thread* getByURL(const KUrl& datURL); + static Thread* getByURLNew(const KUrl& datURL); + static void replace(const QString& fromURL, const QString& toURL); }; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/threadindex.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/threadindex.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/threadindex.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -24,67 +24,67 @@ using namespace Kita; -QString ThreadIndex::getSubject( const KUrl& url ) +QString ThreadIndex::getSubject(const KUrl& url) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - return getSubjectPrivate( config ); + QString indexPath = Kita::Cache::getIndexPath(url); + KConfig config(indexPath); + return getSubjectPrivate(config); } -void ThreadIndex::setSubject( const KUrl& url, const QString& str ) +void ThreadIndex::setSubject(const KUrl& url, const QString& str) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - setSubjectPrivate( str, config ); + QString indexPath = Kita::Cache::getIndexPath(url); + KConfig config(indexPath); + setSubjectPrivate(str, config); } -int ThreadIndex::getResNum( const KUrl& url ) +int ThreadIndex::getResNum(const KUrl& url) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - return getResNumPrivate( url, config ); + QString indexPath = Kita::Cache::getIndexPath(url); + KConfig config(indexPath); + return getResNumPrivate(url, config); } -void ThreadIndex::setResNum( const KUrl& url, int resNum ) +void ThreadIndex::setResNum(const KUrl& url, int resNum) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - setResNumPrivate( resNum, config ); + QString indexPath = Kita::Cache::getIndexPath(url); + KConfig config(indexPath); + setResNumPrivate(resNum, config); } -int ThreadIndex::getReadNum( const KUrl& url ) +int ThreadIndex::getReadNum(const KUrl& url) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - return getReadNumPrivate( url, config, true ); + QString indexPath = Kita::Cache::getIndexPath(url); + KConfig config(indexPath); + return getReadNumPrivate(url, config, true); } -void ThreadIndex::setReadNum( const KUrl& url, int readNum ) +void ThreadIndex::setReadNum(const KUrl& url, int readNum) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - setReadNumPrivate( readNum, config ); + QString indexPath = Kita::Cache::getIndexPath(url); + KConfig config(indexPath); + setReadNumPrivate(readNum, config); } -int ThreadIndex::getViewPos( const KUrl& url ) +int ThreadIndex::getViewPos(const KUrl& url) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - return getViewPosPrivate( config ); + QString indexPath = Kita::Cache::getIndexPath(url); + KConfig config(indexPath); + return getViewPosPrivate(config); } -void ThreadIndex::setViewPos( const KUrl& url, int viewPos ) +void ThreadIndex::setViewPos(const KUrl& url, int viewPos) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - setViewPosPrivate( viewPos, config ); + QString indexPath = Kita::Cache::getIndexPath(url); + KConfig config(indexPath); + setViewPosPrivate(viewPos, config); } -void ThreadIndex::setMarkList( const KUrl& url, const Q3ValueList< int >& markList ) +void ThreadIndex::setMarkList(const KUrl& url, const Q3ValueList< int >& markList) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); - setMarkListPrivate( markList, config ); + QString indexPath = Kita::Cache::getIndexPath(url); + KConfig config(indexPath); + setMarkListPrivate(markList, config); } @@ -92,175 +92,175 @@ /* load thread information */ /* public */ /* static */ -void ThreadIndex::loadIndex( Kita::Thread* thread, const KUrl& url, bool checkCached ) +void ThreadIndex::loadIndex(Kita::Thread* thread, const KUrl& url, bool checkCached) { - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); + QString indexPath = Kita::Cache::getIndexPath(url); + KConfig config(indexPath); /* load read number */ - int readNum = getReadNumPrivate( url, config, checkCached ); - if ( readNum == 0 ) return ; /* cache does not exist. */ - thread->setReadNum( readNum ); + int readNum = getReadNumPrivate(url, config, checkCached); + if (readNum == 0) return ; /* cache does not exist. */ + thread->setReadNum(readNum); /* load thread name */ - QString subject = getSubjectPrivate( config ); - if ( subject.isEmpty() && !thread->threadName().isEmpty() ) { + QString subject = getSubjectPrivate(config); + if (subject.isEmpty() && !thread->threadName().isEmpty()) { subject = thread->threadName(); KConfigGroup group = config.group(""); - group.writeEntry( "Subject", subject ); + group.writeEntry("Subject", subject); } - if ( subject.isEmpty() ) thread->setThreadName( "?" ); - else thread->setThreadName( subject ); + if (subject.isEmpty()) thread->setThreadName("?"); + else thread->setThreadName(subject); /* load res number */ - thread->setResNum( getResNumPrivate( url, config ) ); + thread->setResNum(getResNumPrivate(url, config)); /* load view pos */ - thread->setViewPos( getViewPosPrivate( config ) ); - if ( thread->viewPos() > thread->readNum() ) thread->setReadNum( thread->viewPos() ); + thread->setViewPos(getViewPosPrivate(config)); + if (thread->viewPos() > thread->readNum()) thread->setReadNum(thread->viewPos()); /* load mark */ - thread->setMarkList( getMarkListPrivate( config ) ); + thread->setMarkList(getMarkListPrivate(config)); } /* save thread information */ /* public */ /* static */ -void ThreadIndex::saveIndex( const Kita::Thread* thread, const KUrl& url ) +void ThreadIndex::saveIndex(const Kita::Thread* thread, const KUrl& url) { /* If readNum == 0, delete idx file */ - if ( thread->readNum() == 0 ) { + if (thread->readNum() == 0) { - QString indexPath = Kita::DatManager::getCacheIndexPath( url ); - QFile::remove( indexPath ); + QString indexPath = Kita::DatManager::getCacheIndexPath(url); + QFile::remove(indexPath); } - QString indexPath = Kita::Cache::getIndexPath( url ); - KConfig config( indexPath ); + QString indexPath = Kita::Cache::getIndexPath(url); + KConfig config(indexPath); /* save thread name */ - setSubjectPrivate( thread->threadName(), config ); + setSubjectPrivate(thread->threadName(), config); /* save res number */ - setResNumPrivate( thread->resNum(), config ); + setResNumPrivate(thread->resNum(), config); /* save read number */ - setReadNumPrivate( thread->readNum(), config ); + setReadNumPrivate(thread->readNum(), config); /* save view pos */ - setViewPosPrivate( thread->viewPos(), config ); + setViewPosPrivate(thread->viewPos(), config); /* save mark */ - setMarkListPrivate( thread->markList(), config ); + setMarkListPrivate(thread->markList(), config); /* save "cache" */ - KUrl datURL = Kita::getDatURL( url ); - int num = ( thread->viewPos() ? thread->viewPos() : thread->readNum() ); - KitaThreadInfo::setReadNum( datURL.prettyUrl(), num ); + KUrl datURL = Kita::getDatURL(url); + int num = (thread->viewPos() ? thread->viewPos() : thread->readNum()); + KitaThreadInfo::setReadNum(datURL.prettyUrl(), num); } /*------------------------------------------------------------------*/ /* private */ /* static */ -QString ThreadIndex::getSubjectPrivate( KConfig& config ) +QString ThreadIndex::getSubjectPrivate(KConfig& config) { - return config.group("").readEntry( "Subject" ); + return config.group("").readEntry("Subject"); } /* private */ /* static */ -void ThreadIndex::setSubjectPrivate( const QString& str, KConfig& config ) +void ThreadIndex::setSubjectPrivate(const QString& str, KConfig& config) { - config.group("").writeEntry( "Subject", str ); + config.group("").writeEntry("Subject", str); } /*-------*/ /* private */ /* static */ -int ThreadIndex::getResNumPrivate( const KUrl& url, KConfig& config ) +int ThreadIndex::getResNumPrivate(const KUrl& url, KConfig& config) { - int resNum = config.group("").readEntry( "ResNum", 0 ); + int resNum = config.group("").readEntry("ResNum", 0); /* use obsoleted "cache" file */ - if ( !resNum ) { - KUrl datURL = Kita::getDatURL( url ); - resNum = KitaThreadInfo::readNum( datURL.prettyUrl() ); - if ( resNum ) config.group("").writeEntry( "ResNum", resNum ); + if (!resNum) { + KUrl datURL = Kita::getDatURL(url); + resNum = KitaThreadInfo::readNum(datURL.prettyUrl()); + if (resNum) config.group("").writeEntry("ResNum", resNum); } return resNum; } /* private */ /* static */ -void ThreadIndex::setResNumPrivate( int resNum, KConfig& config ) +void ThreadIndex::setResNumPrivate(int resNum, KConfig& config) { - config.group("").writeEntry( "ResNum", resNum ); + config.group("").writeEntry("ResNum", resNum); } /*-------*/ /* private */ /* static */ -int ThreadIndex::getReadNumPrivate( const KUrl& url, KConfig& config, bool checkCached ) +int ThreadIndex::getReadNumPrivate(const KUrl& url, KConfig& config, bool checkCached) { /* If cache does not exist, return 0 */ - if ( checkCached ) { + if (checkCached) { - QString path = Kita::DatManager::getCachePath( url ); - if ( ! QFile::exists( path ) ) { + QString path = Kita::DatManager::getCachePath(url); + if (! QFile::exists(path)) { return 0; } } - int readNum = config.group("").readEntry( "ReadNum", 0 ); + int readNum = config.group("").readEntry("ReadNum", 0); - if ( !readNum ) { + if (!readNum) { /* use ViewPos instead of ReadNum. */ - readNum = config.group("").readEntry( "ViewPos", 0 ); + readNum = config.group("").readEntry("ViewPos", 0); /* use obsoleted "cache" file */ - if ( !readNum ) { - KUrl datURL = Kita::getDatURL( url ); - readNum = KitaThreadInfo::readNum( datURL.prettyUrl() ); + if (!readNum) { + KUrl datURL = Kita::getDatURL(url); + readNum = KitaThreadInfo::readNum(datURL.prettyUrl()); } - if ( readNum ) config.group("").writeEntry( "ReadNum", readNum ); + if (readNum) config.group("").writeEntry("ReadNum", readNum); } return readNum; } /* private */ /* static */ -void ThreadIndex::setReadNumPrivate( int readNum, KConfig& config ) +void ThreadIndex::setReadNumPrivate(int readNum, KConfig& config) { - config.group("").writeEntry( "ReadNum", readNum ); + config.group("").writeEntry("ReadNum", readNum); } /*-------*/ /* private */ /* static */ -int ThreadIndex::getViewPosPrivate( KConfig& config ) +int ThreadIndex::getViewPosPrivate(KConfig& config) { - return config.group("").readEntry( "ViewPos", 0 ); + return config.group("").readEntry("ViewPos", 0); } /* private */ /* static */ -void ThreadIndex::setViewPosPrivate( int viewPos, KConfig& config ) +void ThreadIndex::setViewPosPrivate(int viewPos, KConfig& config) { - config.group("").writeEntry( "ViewPos", viewPos ); + config.group("").writeEntry("ViewPos", viewPos); } /*-------*/ /* private */ /* static */ -QList< int > ThreadIndex::getMarkListPrivate( KConfig& config ) +QList< int > ThreadIndex::getMarkListPrivate(KConfig& config) { QList<int> default_value; - return config.group("").readEntry( "Mark", default_value ); + return config.group("").readEntry("Mark", default_value); } /* private */ /* static */ -void ThreadIndex::setMarkListPrivate( const QList< int >& markList, KConfig& config ) +void ThreadIndex::setMarkListPrivate(const QList< int >& markList, KConfig& config) { - config.group("").writeEntry( "Mark", markList ); + config.group("").writeEntry("Mark", markList); } Modified: kita/branches/KITA-KDE4/kita/src/libkita/threadindex.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/threadindex.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/threadindex.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -30,41 +30,41 @@ class KDE_EXPORT ThreadIndex { public: - static QString getSubject( const KUrl& url ); - static void setSubject( const KUrl& url, const QString& str ); + static QString getSubject(const KUrl& url); + static void setSubject(const KUrl& url, const QString& str); - static int getResNum( const KUrl& url ); - static void setResNum( const KUrl& url, int resNum ); + static int getResNum(const KUrl& url); + static void setResNum(const KUrl& url, int resNum); - static int getReadNum( const KUrl& url ); - static void setReadNum( const KUrl& url, int readNum ); + static int getReadNum(const KUrl& url); + static void setReadNum(const KUrl& url, int readNum); - static int getViewPos( const KUrl& url ); - static void setViewPos( const KUrl& url, int viewPos ); + static int getViewPos(const KUrl& url); + static void setViewPos(const KUrl& url, int viewPos); - static void setMarkList( const KUrl& url, const Q3ValueList< int >& markList ); + static void setMarkList(const KUrl& url, const Q3ValueList< int >& markList); /*---------------------------------*/ - 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(Kita::Thread* thread, const KUrl& url, bool checkCached = true); + static void saveIndex(const Kita::Thread* thread, const KUrl& url); private: - static QString getSubjectPrivate( KConfig& config ); - static void setSubjectPrivate( const QString& str, KConfig& config ); + static QString getSubjectPrivate(KConfig& config); + static void setSubjectPrivate(const QString& str, KConfig& config); - static int getResNumPrivate( const KUrl& url, KConfig& config ); - static void setResNumPrivate( int resNum, KConfig& config ); + static int getResNumPrivate(const KUrl& url, KConfig& config); + static void setResNumPrivate(int resNum, KConfig& config); - static int getReadNumPrivate( const KUrl& url, KConfig& config, bool checkCached ); - static void setReadNumPrivate( int readNum, KConfig& config ); + static int getReadNumPrivate(const KUrl& url, KConfig& config, bool checkCached); + static void setReadNumPrivate(int readNum, KConfig& config); - static int getViewPosPrivate( KConfig& config ); - static void setViewPosPrivate( int viewPos, KConfig& config ); + static int getViewPosPrivate(KConfig& config); + static void setViewPosPrivate(int viewPos, KConfig& config); - static QList< int > getMarkListPrivate( KConfig& config ); - static void setMarkListPrivate( const QList< int >& markList, KConfig& config ); + static QList< int > getMarkListPrivate(KConfig& config); + static void setMarkListPrivate(const QList< int >& markList, KConfig& config); }; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/threadinfo.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/threadinfo.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/threadinfo.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -25,59 +25,59 @@ KitaThreadInfo* KitaThreadInfo::getInstance() { - if ( instance == 0 ) { + if (instance == 0) { instance = new KitaThreadInfo(); } return instance; } -int KitaThreadInfo::readNum( const QString& url ) +int KitaThreadInfo::readNum(const QString& url) { KitaThreadInfo * instance = KitaThreadInfo::getInstance(); - if ( instance->m_readDict.contains( url ) ) { + if (instance->m_readDict.contains(url)) { return instance->m_readDict[ url ]; } else { return 0; } } -void KitaThreadInfo::setReadNum( const QString& url, int num ) +void KitaThreadInfo::setReadNum(const QString& url, int num) { KitaThreadInfo * instance = KitaThreadInfo::getInstance(); - instance->m_readDict.insert( url, num ); + instance->m_readDict.insert(url, num); } -void KitaThreadInfo::replace( const QString fromURL, const QString toURL ) +void KitaThreadInfo::replace(const QString fromURL, const QString toURL) { QMap<QString, int>::Iterator it; KitaThreadInfo* instance = KitaThreadInfo::getInstance(); - if ( instance == 0 ) return ; + if (instance == 0) return ; - for ( it = instance->m_readDict.begin(); it != instance->m_readDict.end(); ++it ) { + for (it = instance->m_readDict.begin(); it != instance->m_readDict.end(); ++it) { QString url = it.key(); int num = it.value(); - if ( url.indexOf( fromURL ) == 0 ) { - url = url.replace( 0, fromURL.length(), toURL ); - instance->m_readDict.erase( it ); - instance->m_readDict.insert( url, num ); + if (url.indexOf(fromURL) == 0) { + url = url.replace(0, fromURL.length(), toURL); + instance->m_readDict.erase(it); + instance->m_readDict.insert(url, num); it = instance->m_readDict.begin(); // TODO もっと早い方法は? } } } -void KitaThreadInfo::removeThreadInfo( const QString& url ) +void KitaThreadInfo::removeThreadInfo(const QString& url) { KitaThreadInfo * instance = KitaThreadInfo::getInstance(); - instance->m_readDict.remove( url ); + instance->m_readDict.remove(url); } -QDataStream& operator<<( QDataStream& s, KitaThreadInfo& c ) +QDataStream& operator<<(QDataStream& s, KitaThreadInfo& c) { s << c.m_readDict; return s; } -QDataStream& operator>>( QDataStream& s, KitaThreadInfo& c ) +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-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/libkita/threadinfo.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -24,12 +24,12 @@ { 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 ); + 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(); Modified: kita/branches/KITA-KDE4/kita/src/main.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/main.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/main.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -20,49 +20,49 @@ #include "libkita/config_xt.h" static const char *description = - I18N_NOOP( "Kita - 2ch client for KDE" ); + I18N_NOOP("Kita - 2ch client for KDE"); static const char *version = "0.200.0"; // TODO -int main( int argc, char **argv ) +int main(int argc, char **argv) { // for code page 932 with NEC special characters setenv("UNICODEMAP_JP", "cp932,nec-vdc", 1); - KAboutData about( "kita", "Kita", ki18n( "Kita" ), version, ki18n( description ), - KAboutData::License_GPL, ki18n( "(C) 2003-2009 Kita Developers" ), KLocalizedString(), QByteArray(), "ikemo****@users*****" ); - about.addAuthor( ki18n( "Hideki Ikemoto" ), ki18n( "maintainer, initial code" ), "ikemo****@users*****" ); - about.addAuthor( ki18n( "konqueror plugin no hito" ), ki18n( "konqueror plugin, KDE part" ), "ogiri****@users*****" ); - about.addAuthor( ki18n( "421" ), ki18n( "kitanavi, threadview's improvement" ) ); - about.addAuthor( ki18n( "Toshihiko Okada" ), ki18n( "improvements" ), "tossi****@users*****" ); - about.addAuthor( ki18n( "75" ), ki18n( "stylesheet support" ) ); - KCmdLineArgs::init( argc, argv, &about ); + KAboutData about("kita", "Kita", ki18n("Kita"), version, ki18n(description), + KAboutData::License_GPL, ki18n("(C) 2003-2009 Kita Developers"), KLocalizedString(), QByteArray(), "ikemo****@users*****"); + about.addAuthor(ki18n("Hideki Ikemoto"), ki18n("maintainer, initial code"), "ikemo****@users*****"); + about.addAuthor(ki18n("konqueror plugin no hito"), ki18n("konqueror plugin, KDE part"), "ogiri****@users*****"); + about.addAuthor(ki18n("421"), ki18n("kitanavi, threadview's improvement")); + about.addAuthor(ki18n("Toshihiko Okada"), ki18n("improvements"), "tossi****@users*****"); + about.addAuthor(ki18n("75"), ki18n("stylesheet support")); + KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions options; - options.add("+[URL]", ki18n( "Document to open." )); - options.add("boardlist <boardlist>", ki18n( "board list's URL." ), "http://menu.2ch.net/bbsmenu.html"); - KCmdLineArgs::addCmdLineOptions( options ); + options.add("+[URL]", ki18n("Document to open.")); + options.add("boardlist <boardlist>", ki18n("board list's URL."), "http://menu.2ch.net/bbsmenu.html"); + KCmdLineArgs::addCmdLineOptions(options); KUniqueApplication app; // register ourselves as a dcop client -// app.dcopClient() ->registerAs( app.name(), FALSE ); +// app.dcopClient() ->registerAs(app.name(), FALSE); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); - Kita::Config::setBoardListUrl( QString( args->getOption( "boardlist" ) ) ); + Kita::Config::setBoardListUrl(QString(args->getOption("boardlist"))); // see if we are starting with session management - if ( app.isSessionRestored() ) { -// RESTORE( KitaMainWindow ) // TODO + if (app.isSessionRestored()) { +// RESTORE(KitaMainWindow) // TODO } else { // no session.. just start up normally KCmdLineArgs * args = KCmdLineArgs::parsedArgs(); - if ( args->count() == 0 ) { + if (args->count() == 0) { KitaMainWindow * widget = new KitaMainWindow; widget->show(); } else { int i = 0; - for ( ; i < args->count(); i++ ) { + for (; i < args->count(); i++) { KitaMainWindow *widget = new KitaMainWindow; widget->show(); - widget->load( args->url( i ) ); + widget->load(args->url(i)); } } args->clear(); Modified: kita/branches/KITA-KDE4/kita/src/mainwindow.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/mainwindow.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/mainwindow.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -69,13 +69,13 @@ #include "prefs/prefs.h" KitaMainWindow::KitaMainWindow() - : KXmlGuiWindow( 0 ) + : KXmlGuiWindow(0) { // FIXME: merge *.po - KGlobal::locale() ->insertCatalog( "kitapart" ); + KGlobal::locale() ->insertCatalog("kitapart"); // accept dnd - setAcceptDrops( true ); + setAcceptDrops(true); // setup view, dock setupView(); @@ -88,21 +88,21 @@ // load ascii art Kita::AsciiArtConfig::self()->readConfig(); - if ( Kita::AsciiArtConfig::self()->asciiArtList().empty() ) { + if (Kita::AsciiArtConfig::self()->asciiArtList().empty()) { loadAsciiArt(); } // load abone lists Kita::AboneConfig::self()->readConfig(); - if ( Kita::AboneConfig::self()->aboneIDList().empty() ) { + if (Kita::AboneConfig::self()->aboneIDList().empty()) { loadAboneIDList(); } - if ( Kita::AboneConfig::self()->aboneNameList().empty() ) { + if (Kita::AboneConfig::self()->aboneNameList().empty()) { loadAboneNameList(); } - if ( Kita::AboneConfig::self()->aboneWordList().empty() ) { + if (Kita::AboneConfig::self()->aboneWordList().empty()) { loadAboneWordList(); } @@ -120,23 +120,23 @@ setAutoSaveSettings(); // set list font - setFont( Kita::Config::font() ); + setFont(Kita::Config::font()); // allow the view to change the statusbar and caption - connect( m_urlLine, SIGNAL( returnPressed() ), - SLOT( slotURLLine() ) ); + connect(m_urlLine, SIGNAL(returnPressed()), + SLOT(slotURLLine())); - QMenu* settingsPopup = static_cast<QMenu *>( factory() ->container( "settings", this ) ); - connect( settingsPopup, SIGNAL( aboutToShow() ), - SLOT( settingsMenuAboutToShow() ) ); + QMenu* settingsPopup = static_cast<QMenu *>(factory() ->container("settings", this)); + connect(settingsPopup, SIGNAL(aboutToShow()), + SLOT(settingsMenuAboutToShow())); // load favorite boards; loadFavoriteBoards(); // load boad list { - QString configPath = KStandardDirs::locateLocal( "appdata", "board_list" ); - if ( QFile::exists( configPath ) ) { + QString configPath = KStandardDirs::locateLocal("appdata", "board_list"); + if (QFile::exists(configPath)) { m_bbsTab->showBoardList(); m_bbsTab->loadOpened(); } else { @@ -150,7 +150,7 @@ // update favorite list ViewMediator::getInstance()->updateFavoriteListView(); - if ( Kita::Config::autoLogin() ) { + if (Kita::Config::autoLogin()) { login(); } } @@ -167,26 +167,26 @@ saveCache(); - saveMainWindowSettings( KGlobal::config().data()->group("MainWindow") ); + saveMainWindowSettings(KGlobal::config().data()->group("MainWindow")); Kita::Config::self()->writeConfig(); Kita::DatManager::deleteAllDatInfo(); } -void KitaMainWindow::load( const KUrl& url ) +void KitaMainWindow::load(const KUrl& url) { - setCaption( url.url() ); + setCaption(url.url()); } -void KitaMainWindow::bookmark( const QString& datURL, bool on ) +void KitaMainWindow::bookmark(const QString& datURL, bool on) { FavoriteThreads * favorite = FavoriteThreads::getInstance(); - if ( on ) { - favorite->insert( datURL ); + if (on) { + favorite->insert(datURL); } else { - favorite->remove( datURL ); + favorite->remove(datURL); } saveFavorites(); ViewMediator::getInstance()->updateFavoriteListView(); @@ -194,10 +194,10 @@ void KitaMainWindow::login() { - if ( Kita::Account::login( Kita::Config::userID(), Kita::Config::password() ) ) { - setMainStatus( i18n( "Login succeeded." ) ); + if (Kita::Account::login(Kita::Config::userID(), Kita::Config::password())) { + setMainStatus(i18n("Login succeeded.")); } else { - setMainStatus( i18n( "Login failed." ) ); + setMainStatus(i18n("Login failed.")); } } @@ -205,14 +205,14 @@ { // 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" ) ); + applyMainWindowSettings(KGlobal::config().data()->group("MainWindow")); } void KitaMainWindow::optionsShowToolbar() { // this is all very cut and paste code for showing/hiding the // toolbar - if ( m_toolbarAction->isChecked() ) { + if (m_toolbarAction->isChecked()) { toolBar() ->show(); } else { toolBar() ->hide(); @@ -223,7 +223,7 @@ { // this is all very cut and paste code for showing/hiding the // statusbar - if ( m_statusbarAction->isChecked() ) { + if (m_statusbarAction->isChecked()) { statusBar() ->show(); } else { statusBar() ->hide(); @@ -232,71 +232,71 @@ void KitaMainWindow::optionsConfigureKeys() { - KShortcutsDialog::configure( actionCollection() ); + KShortcutsDialog::configure(actionCollection()); } void KitaMainWindow::optionsConfigureToolbars() { // use the standard toolbar editor - KEditToolBar dlg( factory() ); - connect( &dlg, SIGNAL( newToolbarConfig() ), - SLOT( newToolbarConfig() ) ); + KEditToolBar dlg(factory()); + connect(&dlg, SIGNAL(newToolbarConfig()), + SLOT(newToolbarConfig())); dlg.exec(); } void KitaMainWindow::optionsPreferences() { // popup some sort of preference dialog, here - if ( KConfigDialog::showDialog( "Kita Preferences" ) ) { + if (KConfigDialog::showDialog("Kita Preferences")) { return; } - KitaPreferences* dialog = new KitaPreferences( this ); + KitaPreferences* dialog = new KitaPreferences(this); - connect( dialog, SIGNAL( fontChanged( const QFont& ) ), - SLOT( setFont( const QFont& ) ) ); + connect(dialog, SIGNAL(fontChanged(const QFont&)), + SLOT(setFont(const QFont&))); dialog->show(); } void KitaMainWindow::settingsMenuAboutToShow() { - m_toolbarAction->setChecked( toolBar() ->isVisible() ); - m_statusbarAction->setChecked( statusBar() ->isVisible() ); + m_toolbarAction->setChecked(toolBar() ->isVisible()); + m_statusbarAction->setChecked(statusBar() ->isVisible()); } -void KitaMainWindow::setFont( const QFont& font ) +void KitaMainWindow::setFont(const QFont& font) { - m_boardTab->setFont( font ); - m_bbsTab->setFont( font ); + m_boardTab->setFont(font); + m_bbsTab->setFont(font); } -void KitaMainWindow::setUrl( const KUrl& url ) +void KitaMainWindow::setUrl(const KUrl& url) { - m_urlLine->setText( url.url() ); + m_urlLine->setText(url.url()); } void KitaMainWindow::slotEditCopy() { QWidget * widget = kapp->focusWidget(); - if ( widget ) { - QKeyEvent e( QEvent::KeyPress, Qt::Key_C, Qt::ControlModifier ); - QApplication::sendEvent( widget, &e ); + if (widget) { + QKeyEvent e(QEvent::KeyPress, Qt::Key_C, Qt::ControlModifier); + QApplication::sendEvent(widget, &e); } } -void KitaMainWindow::setMainStatus( const QString& statusStr ) +void KitaMainWindow::setMainStatus(const QString& statusStr) { // display the text on the statusbar - statusBar() ->showMessage( statusStr ); + statusBar() ->showMessage(statusStr); } void KitaMainWindow::slotURLLine() { KUrl url = m_urlLine->text(); - KUrl datURL = Kita::getDatURL( url ); - m_threadTab->slotShowMainThread( datURL ); + KUrl datURL = Kita::getDatURL(url); + m_threadTab->slotShowMainThread(datURL); } // @@ -305,86 +305,86 @@ void KitaMainWindow::setupActions() { - KStandardAction::quit( this, SLOT( close() ), actionCollection() ); - KStandardAction::copy( this, SLOT( slotEditCopy() ), actionCollection() ); + KStandardAction::quit(this, SLOT(close()), actionCollection()); + KStandardAction::copy(this, SLOT(slotEditCopy()), actionCollection()); setStandardToolBarMenuEnabled(true); - m_toolbarAction = new KToggleAction( i18n( "&Show Toolbar" ), this ); - actionCollection()->addAction( "toolBar", m_toolbarAction ); - connect( m_toolbarAction, SIGNAL( toggled( bool ) ), - SLOT( optionsShowToolbar() ) ); + m_toolbarAction = new KToggleAction(i18n("&Show Toolbar"), this); + actionCollection()->addAction("toolBar", m_toolbarAction); + connect(m_toolbarAction, SIGNAL(toggled(bool)), + SLOT(optionsShowToolbar())); - m_statusbarAction = KStandardAction::showStatusbar( this, - SLOT( optionsShowStatusbar() ), - actionCollection() ); + m_statusbarAction = KStandardAction::showStatusbar(this, + SLOT(optionsShowStatusbar()), + actionCollection()); - m_urlLine = new KLineEdit( "", 0 ); + m_urlLine = new KLineEdit("", 0); -/* new KWidgetAction( m_urlLine, - i18n( "URL Line" ), +/* new KWidgetAction(m_urlLine, + i18n("URL Line"), 0, this, - SLOT( slotURLLine() ), - actionCollection(), "url_line_action" );*/ // TODO + SLOT(slotURLLine()), + actionCollection(), "url_line_action");*/ // TODO - KStandardAction::keyBindings( this, SLOT( optionsConfigureKeys() ), actionCollection() ); - KStandardAction::configureToolbars( this, SLOT( optionsConfigureToolbars() ), actionCollection() ); - KStandardAction::preferences( this, SLOT( optionsPreferences() ), actionCollection() ); + KStandardAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection()); + KStandardAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection()); + KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); - KAction* load_board_action = actionCollection()->addAction( "load_board_list" ); - load_board_action->setText( i18n( "Load board list" ) ); - connect( load_board_action, SIGNAL(triggered()), m_bbsTab, SLOT( updateBoardList() ) ); + KAction* load_board_action = actionCollection()->addAction("load_board_list"); + load_board_action->setText(i18n("Load board list")); + connect(load_board_action, SIGNAL(triggered()), m_bbsTab, SLOT(updateBoardList())); - KAction* login_action = actionCollection()->addAction( "login" ); - load_board_action->setText( i18n( "Login" ) ); - connect( login_action, SIGNAL(triggered()), m_bbsTab, SLOT( login() ) ); + KAction* login_action = actionCollection()->addAction("login"); + load_board_action->setText(i18n("Login")); + connect(login_action, SIGNAL(triggered()), m_bbsTab, SLOT(login())); - setXMLFile( "kitaui.rc" ); + setXMLFile("kitaui.rc"); KXmlGuiWindow::createGUI(); - factory() ->addClient( m_bbsTab ); - factory() ->addClient( m_boardTab ); - factory() ->addClient( m_threadTab ); - factory() ->addClient( m_writeTab ); + factory() ->addClient(m_bbsTab); + factory() ->addClient(m_boardTab); + factory() ->addClient(m_threadTab); + factory() ->addClient(m_writeTab); } void KitaMainWindow::setupView() { - ViewMediator::getInstance()->setMainWindow( this ); + ViewMediator::getInstance()->setMainWindow(this); - QWidget* mainWidget = new QWidget( this ); + QWidget* mainWidget = new QWidget(this); - QBoxLayout* mainLayout = new QVBoxLayout( mainWidget ); - QSplitter* hsplit = new QSplitter( mainWidget ); - mainLayout->addWidget( hsplit ); + QBoxLayout* mainLayout = new QVBoxLayout(mainWidget); + QSplitter* hsplit = new QSplitter(mainWidget); + mainLayout->addWidget(hsplit); - m_bbsTab = new KitaBBSTabWidget( hsplit ); + m_bbsTab = new KitaBBSTabWidget(hsplit); - QSplitter* vsplit = new QSplitter( Qt::Vertical, hsplit ); + QSplitter* vsplit = new QSplitter(Qt::Vertical, hsplit); - m_boardTab = new KitaBoardTabWidget( vsplit ); - ViewMediator::getInstance()->setBoardTabWidget( m_boardTab ); + m_boardTab = new KitaBoardTabWidget(vsplit); + ViewMediator::getInstance()->setBoardTabWidget(m_boardTab); - m_threadTab = new KitaThreadTabWidget( vsplit ); - ViewMediator::getInstance()->setThreadTabWidget( m_threadTab ); + m_threadTab = new KitaThreadTabWidget(vsplit); + ViewMediator::getInstance()->setThreadTabWidget(m_threadTab); - hsplit->setSizes( Q3ValueList<int>() << 100 << 500 ); - vsplit->setSizes( Q3ValueList<int>() << 200 << 300 ); + hsplit->setSizes(Q3ValueList<int>() << 100 << 500); + vsplit->setSizes(Q3ValueList<int>() << 200 << 300); - setCentralWidget( mainWidget ); + setCentralWidget(mainWidget); /* write dock */ - m_writeTab = new KitaWriteTabWidget( 0 ); - ViewMediator::getInstance()->setWriteTabWidget( m_writeTab ); + m_writeTab = new KitaWriteTabWidget(0); + ViewMediator::getInstance()->setWriteTabWidget(m_writeTab); } void KitaMainWindow::loadCache() { KitaThreadInfo * cache = KitaThreadInfo::getInstance(); - QString cacheConfigPath = KStandardDirs::locateLocal( "appdata", "cache" ); - QFile file( cacheConfigPath ); - if ( file.open( QIODevice::ReadOnly ) ) { - QDataStream stream( &file ); + QString cacheConfigPath = KStandardDirs::locateLocal("appdata", "cache"); + QFile file(cacheConfigPath); + if (file.open(QIODevice::ReadOnly)) { + QDataStream stream(&file); stream >> *cache; } } @@ -392,147 +392,147 @@ void KitaMainWindow::saveCache() { KitaThreadInfo * cache = KitaThreadInfo::getInstance(); - QString cacheConfigPath = KStandardDirs::locateLocal( "appdata", "cache" ); - QFile file( cacheConfigPath ); - if ( file.open( QIODevice::WriteOnly ) ) { - QDataStream stream( &file ); + QString cacheConfigPath = KStandardDirs::locateLocal("appdata", "cache"); + QFile file(cacheConfigPath); + if (file.open(QIODevice::WriteOnly)) { + QDataStream stream(&file); stream << *cache; } } void KitaMainWindow::loadFavorites() { - QString favoritesConfigPath = KStandardDirs::locateLocal( "appdata", "favorites.xml" ); - QFile file( favoritesConfigPath ); - if ( file.open( QIODevice::ReadOnly ) ) { - QTextStream stream( &file ); - stream.setCodec( "UTF-8" ); + QString favoritesConfigPath = KStandardDirs::locateLocal("appdata", "favorites.xml"); + QFile file(favoritesConfigPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); QString xml = stream.readAll(); - FavoriteThreads::readFromXML( xml ); + FavoriteThreads::readFromXML(xml); } } void KitaMainWindow::saveFavorites() { - QString favoritesConfigPath = KStandardDirs::locateLocal( "appdata", "favorites.xml" ); - QFile file( favoritesConfigPath ); - if ( file.open( QIODevice::WriteOnly ) ) { - QTextStream stream( &file ); - stream.setCodec( "UTF-8" ); + QString favoritesConfigPath = KStandardDirs::locateLocal("appdata", "favorites.xml"); + QFile file(favoritesConfigPath); + if (file.open(QIODevice::WriteOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); stream << FavoriteThreads::getInstance() ->toXML(); } } void KitaMainWindow::loadFavoriteBoards() { - QString configPath = KStandardDirs::locateLocal( "appdata", "favorite_boards.xml" ); - QFile file( configPath ); - if ( file.open( QIODevice::ReadOnly ) ) { - QTextStream stream( &file ); - stream.setCodec( "UTF-8" ); + QString configPath = KStandardDirs::locateLocal("appdata", "favorite_boards.xml"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); QString xml = stream.readAll(); - Kita::FavoriteBoards::readFromXML( xml ); + Kita::FavoriteBoards::readFromXML(xml); } } void KitaMainWindow::saveFavoriteBoards() { - QString configPath = KStandardDirs::locateLocal( "appdata", "favorite_boards.xml" ); - QFile file( configPath ); - if ( file.open( QIODevice::WriteOnly ) ) { - QTextStream stream( &file ); - stream.setCodec( "UTF-8" ); + 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(); } } void KitaMainWindow::loadCompletion() { - QString configPath = KStandardDirs::locateLocal( "appdata", "completion" ); - KConfig config( configPath ); + QString configPath = KStandardDirs::locateLocal("appdata", "completion"); + KConfig config(configPath); - Kita::Config::setNameCompletionList( config.group("").readEntry( "name", QStringList() ) ); + Kita::Config::setNameCompletionList(config.group("").readEntry("name", QStringList() )); } void KitaMainWindow::loadAsciiArt() { - QString configPath = KStandardDirs::locateLocal( "appdata", "asciiart" ); - QFile file( configPath ); - if ( file.open( QIODevice::ReadOnly ) ) { - QTextStream stream( &file ); - stream.setCodec( "UTF-8" ); + QString configPath = KStandardDirs::locateLocal("appdata", "asciiart"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); QStringList list; QString str; - while ( !( str = stream.readLine() ).isEmpty() ) { - if ( ! str.isEmpty() ) { + while (!(str = stream.readLine()).isEmpty()) { + if (! str.isEmpty()) { list << str; } } - Kita::AsciiArtConfig::setAsciiArtList( list ); + Kita::AsciiArtConfig::setAsciiArtList(list); } } void KitaMainWindow::loadAboneIDList() { - QString configPath = KStandardDirs::locateLocal( "appdata", "abone_id" ); - QFile file( configPath ); - if ( file.open( QIODevice::ReadOnly ) ) { - QTextStream stream( &file ); - stream.setCodec( "UTF-8" ); + QString configPath = KStandardDirs::locateLocal("appdata", "abone_id"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); QStringList list; QString str; - while ( !( str = stream.readLine() ).isEmpty() ) { - if ( ! str.isEmpty() ) { + while (!(str = stream.readLine()).isEmpty()) { + if (! str.isEmpty()) { list << str; } } - Kita::AboneConfig::setAboneIDList( list ); + Kita::AboneConfig::setAboneIDList(list); } } void KitaMainWindow::loadAboneNameList() { - QString configPath = KStandardDirs::locateLocal( "appdata", "abone_name" ); - QFile file( configPath ); - if ( file.open( QIODevice::ReadOnly ) ) { - QTextStream stream( &file ); - stream.setCodec( "UTF-8" ); + QString configPath = KStandardDirs::locateLocal("appdata", "abone_name"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); QStringList list; QString str; - while ( !( str = stream.readLine() ).isEmpty() ) { - if ( ! str.isEmpty() ) { + while (!(str = stream.readLine()).isEmpty()) { + if (! str.isEmpty()) { list << str; } } - Kita::AboneConfig::setAboneNameList( list ); + Kita::AboneConfig::setAboneNameList(list); } } void KitaMainWindow::loadAboneWordList() { - QString configPath = KStandardDirs::locateLocal( "appdata", "abone_word" ); - QFile file( configPath ); - if ( file.open( QIODevice::ReadOnly ) ) { - QTextStream stream( &file ); - stream.setCodec( "UTF-8" ); + QString configPath = KStandardDirs::locateLocal("appdata", "abone_word"); + QFile file(configPath); + if (file.open(QIODevice::ReadOnly)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); QStringList list; QString str; - while ( !( str = stream.readLine() ).isEmpty() ) { - if ( ! str.isEmpty() ) { + while (!(str = stream.readLine()).isEmpty()) { + if (! str.isEmpty()) { list << str; } } - Kita::AboneConfig::setAboneWordList( list ); + Kita::AboneConfig::setAboneWordList(list); } } Modified: kita/branches/KITA-KDE4/kita/src/mainwindow.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/mainwindow.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/mainwindow.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -50,10 +50,10 @@ KitaMainWindow(); virtual ~KitaMainWindow(); - 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(); @@ -64,7 +64,7 @@ void optionsConfigureToolbars(); void optionsPreferences(); void settingsMenuAboutToShow(); - void setFont( const QFont& font ); + void setFont(const QFont& font); void slotEditCopy(); void slotURLLine(); Modified: kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -16,18 +16,18 @@ using namespace Kita::Ui; -AbonePrefPage::AbonePrefPage( QWidget *parent ) - : QWidget( parent ) +AbonePrefPage::AbonePrefPage(QWidget *parent) + : QWidget(parent) { setupUi(this); - idAboneText->setText( Kita::AboneConfig::aboneIDList().join( "\n" ) ); - nameAboneText->setText( Kita::AboneConfig::aboneNameList().join( "\n" ) ); - wordAboneText->setText( Kita::AboneConfig::aboneWordList().join( "\n" ) ); + idAboneText->setText(Kita::AboneConfig::aboneIDList().join("\n")); + nameAboneText->setText(Kita::AboneConfig::aboneNameList().join("\n")); + wordAboneText->setText(Kita::AboneConfig::aboneWordList().join("\n")); - connect( idAboneText, SIGNAL( textChanged() ), SLOT( slotTextChanged() ) ); - connect( nameAboneText, SIGNAL( textChanged() ), SLOT( slotTextChanged() ) ); - connect( wordAboneText, SIGNAL( textChanged() ), SLOT( slotTextChanged() ) ); + connect(idAboneText, SIGNAL(textChanged()), SLOT(slotTextChanged())); + connect(nameAboneText, SIGNAL(textChanged()), SLOT(slotTextChanged())); + connect(wordAboneText, SIGNAL(textChanged()), SLOT(slotTextChanged())); m_changed = false; } @@ -43,18 +43,18 @@ void AbonePrefPage::apply() { - if ( m_changed ) { + if (m_changed) { QString idText = idAboneText->toPlainText(); - QStringList idList = idText.split( '\n' ); - Kita::AboneConfig::setAboneIDList( idList ); + QStringList idList = idText.split('\n'); + Kita::AboneConfig::setAboneIDList(idList); QString nameText = nameAboneText->toPlainText(); - QStringList nameList = nameText.split( '\n' ); - Kita::AboneConfig::setAboneNameList( nameList ); + QStringList nameList = nameText.split('\n'); + Kita::AboneConfig::setAboneNameList(nameList); QString wordText = wordAboneText->toPlainText(); - QStringList wordList = wordText.split( '\n' ); - Kita::AboneConfig::setAboneWordList( wordList ); + QStringList wordList = wordText.split('\n'); + Kita::AboneConfig::setAboneWordList(wordList); } m_changed = false; Modified: kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -24,7 +24,7 @@ Q_OBJECT bool m_changed; public: - AbonePrefPage( QWidget *parent = 0 ); + AbonePrefPage(QWidget *parent = 0); ~AbonePrefPage(); public slots: void apply(); Modified: kita/branches/KITA-KDE4/kita/src/prefs/prefs.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/prefs/prefs.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/prefs/prefs.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -42,80 +42,80 @@ using namespace Kita; -KitaPreferences::KitaPreferences( QWidget* parent ) - : KConfigDialog( parent, "Kita Preferences", Kita::Config::self() ) +KitaPreferences::KitaPreferences(QWidget* parent) + : KConfigDialog(parent, "Kita Preferences", Kita::Config::self()) { - enableButtonApply( false ); - enableButton( Help, false ); + enableButtonApply(false); + enableButton(Help, false); // this is the base class for your preferences dialog. it is now // a Treelist dialog.. but there are a number of other // possibilities (including Tab, Swallow, and just Plain) - m_facePage = new Kita::Ui::FacePrefPage( 0 ); - m_facePageItem = addPage( m_facePage, i18n( "Face" ), "view_detailed" ); + m_facePage = new Kita::Ui::FacePrefPage(0); + m_facePageItem = addPage(m_facePage, i18n("Face"), "view_detailed"); - connect( m_facePage, SIGNAL( fontChanged( const QFont& ) ), - SIGNAL( fontChanged( const QFont& ) ) ); + connect(m_facePage, SIGNAL(fontChanged(const QFont&)), + SIGNAL(fontChanged(const QFont&))); - m_asciiArtPage = new Kita::Ui::AsciiArtPrefPage( 0 ); - m_asciiArtPageItem = addPage( m_asciiArtPage, i18n( "AsciiArt" ), "kita" ); + m_asciiArtPage = new Kita::Ui::AsciiArtPrefPage(0); + m_asciiArtPageItem = addPage(m_asciiArtPage, i18n("AsciiArt"), "kita"); - m_uiPage = new Kita::Ui::UIPrefPage( 0 ); - m_uiPageItem = addPage( m_uiPage, i18n( "User Interface" ), "configure" ); + m_uiPage = new Kita::Ui::UIPrefPage(0); + m_uiPageItem = addPage(m_uiPage, i18n("User Interface"), "configure"); - m_abonePage = new Kita::Ui::AbonePrefPage( 0 ); - m_abonePageItem = addPage( m_abonePage, i18n( "Abone" ), "kita" ); + m_abonePage = new Kita::Ui::AbonePrefPage(0); + m_abonePageItem = addPage(m_abonePage, i18n("Abone"), "kita"); QWidget* m_loginWidget = new QWidget; m_loginPage = new Kita::Ui::LoginPrefPage(); m_loginPage->setupUi(m_loginWidget); - m_loginPageItem = addPage( m_loginWidget, i18n( "Login" ), "connect_established" ); + m_loginPageItem = addPage(m_loginWidget, i18n("Login"), "connect_established"); QWidget* m_writeWidget = new QWidget; m_writePage = new Kita::Ui::WritePrefPage(); m_writePage->setupUi(m_writeWidget); - m_writePageItem = addPage( m_writeWidget, i18n( "Write" ), "edit" ); + m_writePageItem = addPage(m_writeWidget, i18n("Write"), "edit"); - connect( m_facePage, SIGNAL( changed() ), SLOT( slotChanged() ) ); - connect( m_asciiArtPage, SIGNAL( changed() ), SLOT( slotChanged() ) ); - connect( m_uiPage, SIGNAL( changed() ), SLOT( slotChanged() ) ); - connect( m_abonePage, SIGNAL( changed() ), SLOT( slotChanged() ) ); -// connect( m_loginPage, SIGNAL( changed() ), SLOT( slotChanged() ) ); // TODO -// connect( m_writePage, SIGNAL( changed() ), SLOT( slotChanged() ) ); // TODO + connect(m_facePage, SIGNAL(changed()), SLOT(slotChanged())); + connect(m_asciiArtPage, SIGNAL(changed()), SLOT(slotChanged())); + connect(m_uiPage, SIGNAL(changed()), SLOT(slotChanged())); + connect(m_abonePage, SIGNAL(changed()), SLOT(slotChanged())); +// connect(m_loginPage, SIGNAL(changed()), SLOT(slotChanged())); // TODO +// connect(m_writePage, SIGNAL(changed()), SLOT(slotChanged())); // TODO - connect( this, SIGNAL( currentPageChanged( KPageWidgetItem*, KPageWidgetItem* ) ), SLOT( slotCurrentPageChanged() ) ); + connect(this, SIGNAL(currentPageChanged(KPageWidgetItem*, KPageWidgetItem*)), SLOT(slotCurrentPageChanged())); } void KitaPreferences::slotApply() { - if ( currentPage() == m_facePageItem ) { + if (currentPage() == m_facePageItem) { // face m_facePage->apply(); - } else if ( currentPage() == m_asciiArtPageItem ) { + } else if (currentPage() == m_asciiArtPageItem) { // asciiart m_asciiArtPage->apply(); - } else if ( currentPage() == m_uiPageItem ) { + } else if (currentPage() == m_uiPageItem) { // user interface m_uiPage->apply(); - } else if ( currentPage() == m_abonePageItem ) { + } else if (currentPage() == m_abonePageItem) { // abone m_abonePage->apply(); } else { // login // write } - enableButtonApply( false ); + enableButtonApply(false); } void KitaPreferences::slotDefault() { - if ( currentPage() == m_facePageItem ) { + if (currentPage() == m_facePageItem) { // face m_facePage->reset(); - } else if ( currentPage() == m_asciiArtPageItem ) { + } else if (currentPage() == m_asciiArtPageItem) { // asciiart m_asciiArtPage->reset(); - } else if ( currentPage() == m_uiPageItem ) { + } else if (currentPage() == m_uiPageItem) { // user m_uiPage->reset(); } else { @@ -124,12 +124,12 @@ // write // debug } - enableButtonApply( true ); + enableButtonApply(true); } void KitaPreferences::slotChanged() { - enableButtonApply( true ); + enableButtonApply(true); } void KitaPreferences::slotOk() @@ -144,44 +144,44 @@ void KitaPreferences::slotCurrentPageChanged() { - if ( currentPage() == m_asciiArtPageItem ) { + if (currentPage() == m_asciiArtPageItem) { // ascii art m_asciiArtPage->init(); } } -Ui::AsciiArtPrefPage::AsciiArtPrefPage( QWidget* parent ) - : QWidget( parent ) +Ui::AsciiArtPrefPage::AsciiArtPrefPage(QWidget* parent) + : QWidget(parent) { - setupUi( this ); + setupUi(this); init(); - connect( asciiArtText, SIGNAL( textChanged() ), SIGNAL( changed() ) ); + connect(asciiArtText, SIGNAL(textChanged()), SIGNAL(changed())); } void Ui::AsciiArtPrefPage::init() { - asciiArtText->setText( Kita::AsciiArtConfig::asciiArtList().join( "\n" ) ); - asciiArtText->setFont( Kita::Config::threadFont() ); + asciiArtText->setText(Kita::AsciiArtConfig::asciiArtList().join("\n")); + asciiArtText->setFont(Kita::Config::threadFont()); } void Ui::AsciiArtPrefPage::apply() { QString text = asciiArtText->toPlainText(); - QStringList list = text.split( '\n' ); + QStringList list = text.split('\n'); - Kita::AsciiArtConfig::setAsciiArtList( list ); + Kita::AsciiArtConfig::setAsciiArtList(list); } void Ui::AsciiArtPrefPage::reset() { } -Ui::UIPrefPage::UIPrefPage( QWidget* parent ) - : QWidget( parent ) +Ui::UIPrefPage::UIPrefPage(QWidget* parent) + : QWidget(parent) { - setupUi( this ); - connect( editFileAssociation, SIGNAL( leftClickedUrl() ), SLOT( slotEditFileAssociation() ) ); + setupUi(this); + connect(editFileAssociation, SIGNAL(leftClickedUrl()), SLOT(slotEditFileAssociation())); } void Ui::UIPrefPage::apply() @@ -190,32 +190,32 @@ void Ui::UIPrefPage::reset() { - kcfg_AlwaysUseTab->setChecked( true ); - kcfg_MarkTime->setValue( 24 ); - kcfg_ShowMailAddress->setChecked( false ); - kcfg_ShowNum->setValue( 100 ); - kcfg_ListSortOrder->setButton( Kita::Config::EnumListSortOrder::Mark ); - kcfg_PartMimeList->setText( "image/gif,image/jpeg,image/png,image/x-bmp" ); - kcfg_UsePart->setChecked( true ); + kcfg_AlwaysUseTab->setChecked(true); + kcfg_MarkTime->setValue(24); + kcfg_ShowMailAddress->setChecked(false); + kcfg_ShowNum->setValue(100); + kcfg_ListSortOrder->setButton(Kita::Config::EnumListSortOrder::Mark); + kcfg_PartMimeList->setText("image/gif,image/jpeg,image/png,image/x-bmp"); + kcfg_UsePart->setChecked(true); } void Ui::UIPrefPage::slotEditFileAssociation() { - KToolInvocation::kdeinitExec( "kcmshell", QStringList( "filetypes" ) ); + KToolInvocation::kdeinitExec("kcmshell", QStringList("filetypes")); } -Ui::FacePrefPage::FacePrefPage( QWidget* parent ) - : QWidget( parent ) +Ui::FacePrefPage::FacePrefPage(QWidget* parent) + : QWidget(parent) { - setupUi( this ); + setupUi(this); // font - connect( listFontButton, SIGNAL( clicked() ), SLOT( slotFontButtonClicked() ) ); + connect(listFontButton, SIGNAL(clicked()), SLOT(slotFontButtonClicked())); - connect( threadFontButton, SIGNAL( clicked() ), - SLOT( slotThreadFontButtonClicked() ) ); + connect(threadFontButton, SIGNAL(clicked()), + SLOT(slotThreadFontButtonClicked())); - connect( popupFontButton, SIGNAL( clicked() ), - SLOT( slotPopupFontButtonClicked() ) ); + connect(popupFontButton, SIGNAL(clicked()), + SLOT(slotPopupFontButtonClicked())); updateButtons(); @@ -223,89 +223,89 @@ 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(Kita::Config::threadColor()); + threadBackgroundColorButton->setColor(Kita::Config::threadBackground()); + popupColorButton->setColor(Kita::Config::popupColor()); + popupBackgroundColorButton->setColor(Kita::Config::popupBackground()); - connect( threadColorButton, SIGNAL( changed( const QColor& ) ), SIGNAL( changed() ) ); - connect( threadBackgroundColorButton, SIGNAL( changed( const QColor& ) ), SIGNAL( changed() ) ); - connect( threadColorButton, SIGNAL( changed( const QColor& ) ), SLOT( slotColorChanged() ) ); - connect( threadBackgroundColorButton, SIGNAL( changed( const QColor& ) ), SLOT( slotColorChanged() ) ); - connect( popupColorButton, SIGNAL( changed( const QColor& ) ), SIGNAL( changed() ) ); - connect( popupBackgroundColorButton, SIGNAL( changed( const QColor& ) ), SIGNAL( changed() ) ); + connect(threadColorButton, SIGNAL(changed(const QColor&)), SIGNAL(changed())); + connect(threadBackgroundColorButton, SIGNAL(changed(const QColor&)), SIGNAL(changed())); + connect(threadColorButton, SIGNAL(changed(const QColor&)), SLOT(slotColorChanged())); + connect(threadBackgroundColorButton, SIGNAL(changed(const QColor&)), SLOT(slotColorChanged())); + connect(popupColorButton, SIGNAL(changed(const QColor&)), SIGNAL(changed())); + connect(popupBackgroundColorButton, SIGNAL(changed(const QColor&)), SIGNAL(changed())); } void Ui::FacePrefPage::apply() { // font QFont font = listFontButton->font(); - Kita::Config::setFont( font ); - emit fontChanged( font ); + Kita::Config::setFont(font); + emit fontChanged(font); - if ( m_threadFontchanged ) { + if (m_threadFontchanged) { QFont threadFont = threadFontButton->font(); - Kita::Config::setThreadFont( threadFont ); + Kita::Config::setThreadFont(threadFont); } m_threadFontchanged = false; QFont popupFont = popupFontButton->font(); - Kita::Config::setPopupFont( popupFont ); + Kita::Config::setPopupFont(popupFont); // color - if ( m_threadColorChanged ) { - Kita::Config::setThreadColor( threadColorButton->color() ); - Kita::Config::setThreadBackground( threadBackgroundColorButton->color() ); + if (m_threadColorChanged) { + Kita::Config::setThreadColor(threadColorButton->color()); + Kita::Config::setThreadBackground(threadBackgroundColorButton->color()); } m_threadColorChanged = false; - Kita::Config::setPopupColor( popupColorButton->color() ); - Kita::Config::setPopupBackground( popupBackgroundColorButton->color() ); + Kita::Config::setPopupColor(popupColorButton->color()); + Kita::Config::setPopupBackground(popupBackgroundColorButton->color()); } void Ui::FacePrefPage::reset() { // font QFont font; - listFontButton->setText( Kita::fontToString( font ) ); - listFontButton->setFont( font ); + listFontButton->setText(Kita::fontToString(font)); + listFontButton->setFont(font); - threadFontButton->setText( Kita::fontToString( font ) ); - threadFontButton->setFont( font ); + threadFontButton->setText(Kita::fontToString(font)); + threadFontButton->setFont(font); m_threadFontchanged = true; - popupFontButton->setText( Kita::fontToString( font ) ); - popupFontButton->setFont( font ); + popupFontButton->setText(Kita::fontToString(font)); + popupFontButton->setFont(font); // color - threadColorButton->setColor( Qt::black ); - threadBackgroundColorButton->setColor( Qt::white ); - popupColorButton->setColor( Qt::black ); - popupBackgroundColorButton->setColor( Qt::yellow ); + threadColorButton->setColor(Qt::black); + threadBackgroundColorButton->setColor(Qt::white); + popupColorButton->setColor(Qt::black); + popupBackgroundColorButton->setColor(Qt::yellow); m_threadColorChanged = true; } void Ui::FacePrefPage::updateButtons() { QFont font = Kita::Config::font(); - listFontButton->setText( Kita::fontToString( font ) ); - listFontButton->setFont( font ); + listFontButton->setText(Kita::fontToString(font)); + listFontButton->setFont(font); QFont threadFont = Kita::Config::threadFont(); - threadFontButton->setText( Kita::fontToString( threadFont ) ); - threadFontButton->setFont( threadFont ); + threadFontButton->setText(Kita::fontToString(threadFont)); + threadFontButton->setFont(threadFont); QFont popupFont = Kita::Config::popupFont(); - popupFontButton->setText( Kita::fontToString( popupFont ) ); - popupFontButton->setFont( popupFont ); + popupFontButton->setText(Kita::fontToString(popupFont)); + popupFontButton->setFont(popupFont); } void Ui::FacePrefPage::slotThreadFontButtonClicked() { QFont threadFont = threadFontButton->font(); - if ( KFontDialog::getFont( threadFont, false, this ) == QDialog::Accepted ) { - threadFontButton->setText( Kita::fontToString( threadFont ) ); - threadFontButton->setFont( threadFont ); + if (KFontDialog::getFont(threadFont, false, this) == QDialog::Accepted) { + threadFontButton->setText(Kita::fontToString(threadFont)); + threadFontButton->setFont(threadFont); emit changed(); m_threadFontchanged = true; } @@ -315,9 +315,9 @@ { QFont font = listFontButton->font(); - if ( KFontDialog::getFont( font, false, this ) == QDialog::Accepted ) { - listFontButton->setText( Kita::fontToString( font ) ); - listFontButton->setFont( font ); + if (KFontDialog::getFont(font, false, this) == QDialog::Accepted) { + listFontButton->setText(Kita::fontToString(font)); + listFontButton->setFont(font); emit changed(); } } @@ -326,9 +326,9 @@ { QFont font = popupFontButton->font(); - if ( KFontDialog::getFont( font, false, this ) == QDialog::Accepted ) { - popupFontButton->setText( Kita::fontToString( font ) ); - popupFontButton->setFont( font ); + if (KFontDialog::getFont(font, false, this) == QDialog::Accepted) { + popupFontButton->setText(Kita::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-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/prefs/prefs.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -43,7 +43,7 @@ Q_OBJECT public: - KitaPreferences( QWidget* parent ); + KitaPreferences(QWidget* parent); protected: virtual void slotApply(); @@ -72,7 +72,7 @@ void slotCurrentPageChanged(); signals: - void fontChanged( const QFont& ); + void fontChanged(const QFont&); }; /*class DebugPrefPage : public DebugPrefBase @@ -80,7 +80,7 @@ Q_OBJECT public: - DebugPrefPage( QWidget* parent = 0 ); + DebugPrefPage(QWidget* parent = 0); public slots: void replace(); @@ -92,7 +92,7 @@ { Q_OBJECT public: - AsciiArtPrefPage( QWidget* parent = 0 ); + AsciiArtPrefPage(QWidget* parent = 0); public slots: void init(); void apply(); @@ -106,7 +106,7 @@ { Q_OBJECT public: - UIPrefPage( QWidget* parent = 0 ); + UIPrefPage(QWidget* parent = 0); void apply(); void reset(); @@ -126,7 +126,7 @@ bool m_threadColorChanged; public: - FacePrefPage( QWidget* parent = 0 ); + FacePrefPage(QWidget* parent = 0); void apply(); void reset(); @@ -140,7 +140,7 @@ void updateButtons(); signals: - void fontChanged( const QFont& ); + void fontChanged(const QFont&); void changed(); }; } Modified: kita/branches/KITA-KDE4/kita/src/prefs/write_page.ui.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/prefs/write_page.ui.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/prefs/write_page.ui.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -10,12 +10,12 @@ #ifndef KITAWRITEPAGEUI_H #define KITAWRITEPAGEUI_H -void Kita::WritePrefPage::DefaultSageCheckBoxToggled( bool on ) +void Kita::WritePrefPage::DefaultSageCheckBoxToggled(bool on) { - if ( on ) { - kcfg_DefaultMail->setReadOnly( true ); + if (on) { + kcfg_DefaultMail->setReadOnly(true); } else { - kcfg_DefaultMail->setReadOnly( false ); + kcfg_DefaultMail->setReadOnly(false); } } Modified: kita/branches/KITA-KDE4/kita/src/respopup.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/respopup.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/respopup.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -23,20 +23,20 @@ namespace Kita { - ResPopup::ResPopup( KHTMLView* view, const KUrl& url ) - : QFrame( view, + ResPopup::ResPopup(KHTMLView* view, const KUrl& url) + : QFrame(view, Qt::FramelessWindowHint | Qt::Tool | Qt::Window | Qt::X11BypassWindowManagerHint - ) + ) { 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 KitaHTMLPart(this); + m_htmlPart->setup(HTMLPART_MODE_POPUP , url); + connect(m_htmlPart, SIGNAL(hideChildPopup()), SIGNAL(hideChildPopup())); } @@ -48,22 +48,22 @@ /* public */ - void ResPopup::setText( const QString& str ) + void ResPopup::setText(const QString& str) { const int maxwd = 1600; const int maxht = 1200; - QString style = QString( "body.pop {" + 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() ); + "}") + .arg(Kita::Config::popupFont().pointSize()) + .arg(Kita::Config::popupFont().family()) + .arg(Kita::Config::popupColor().name()) + .arg(Kita::Config::popupBackground().name()); QString text = "<html><head><style>"; text += DEFAULT_STYLESHEET; @@ -72,14 +72,14 @@ 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 ); + 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 ); + m_htmlPart->view() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); } } @@ -87,35 +87,35 @@ /* public */ void ResPopup::adjustSize() { - if ( !m_htmlPart ) return ; + if (!m_htmlPart) return ; 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(); /*----------------------------------*/ - if ( curnode.nodeType() == DOM::Node::TEXT_NODE ) { - if ( xx == 0 ) xx = qr.left(); + 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(); + else if (curnode.nodeName().string() == "div") { + if (leftmrg == 0) leftmrg = qr.left(); width = 0; xx = 0; } /*----------------------------------*/ - else if ( curnode.nodeName().string() == "br" ) { + else if (curnode.nodeName().string() == "br") { width = 0; xx = 0; } @@ -123,22 +123,22 @@ /*----------------------------------*/ - 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(); - if ( next.isNull() ) next = curnode.nextSibling(); + if (next.isNull()) next = curnode.nextSibling(); - while ( !curnode.isNull() && next.isNull() ) { + while (!curnode.isNull() && next.isNull()) { curnode = curnode.parentNode(); - if ( !curnode.isNull() ) next = curnode.nextSibling(); + if (!curnode.isNull()) next = curnode.nextSibling(); } curnode = next; - if ( curnode.isNull() ) break; + if (curnode.isNull()) break; } const int mrg = 32; @@ -146,13 +146,13 @@ int wd = maxwidth + mrg; int ht = maxheight + mrg; - m_htmlPart->view() ->resize( wd, ht ); + m_htmlPart->view() ->resize(wd, ht); QFrame::adjustSize(); } /* public */ - void ResPopup::adjustPos( QPoint pos ) + void ResPopup::adjustPos(QPoint pos) { enum{ POS_LeftUp, @@ -167,7 +167,7 @@ /*----------------------------*/ - if ( !m_htmlPart ) return ; + if (!m_htmlPart) return ; QRect qr = QApplication::desktop() ->rect(); int sw = qr.width(), sh = qr.height(); @@ -175,39 +175,39 @@ 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[ 0 ] = (sw - x) * y; area[ 1 ] = x * y; - area[ 2 ] = ( sw - x ) * ( sh - y ); - area[ 3 ] = x * ( sh - 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; + 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; + y = (y - mrg) - ht; break; case POS_LeftUp: - x = ( x - mrg ) - wd; - y = ( y - mrg ) - ht; + x = (x - mrg) - wd; + y = (y - mrg) - ht; break; case POS_RightDown: @@ -216,55 +216,55 @@ break; case POS_LeftDown: - x = ( x - mrg ) - wd; + x = (x - mrg) - wd; y = y + mrg; break; } - if ( x < 0 ) { + if (x < 0) { x = ht % 16; } - if ( x + wd >= sw ) { + 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 ); + 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 ); + if (y < 0) { + if (x <= pos.x() && pos.x() < x + wd) { + if (m_htmlPart) m_htmlPart->view() ->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); ht += y; } y = 0; } - if ( y + ht >= sh ) { + if (y + ht >= sh) { - if ( x <= pos.x() && pos.x() < x + wd ) { - if ( m_htmlPart ) m_htmlPart->view() ->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); + 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 ); + 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); } @@ -284,12 +284,12 @@ 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-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/respopup.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -26,15 +26,15 @@ public: - ResPopup( KHTMLView* view, const KUrl& datURL ); + ResPopup(KHTMLView* view, const KUrl& datURL); ~ResPopup(); - void setText( const QString& str ); + void setText(const QString& str); void adjustSize(); - void adjustPos( QPoint pos ); + void adjustPos(QPoint pos); void moveMouseAbove(); private: - void showImage( const KUrl& url ); + void showImage(const KUrl& url); ResPopup(const ResPopup&); ResPopup& operator=(const ResPopup&); Modified: kita/branches/KITA-KDE4/kita/src/threadlistview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadlistview.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/threadlistview.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -30,48 +30,48 @@ struct Col_Attr ThreadListView::s_colAttr[] = { // labelName, itemName, keyName, showDefault - { " ", I18N_NOOP( "Mark" ), "Col_Mark", true }, - { "No.", I18N_NOOP( "ID" ), "Col_ID", true }, - { " ", I18N_NOOP( "Icon" ), "Col_Icon", true }, - { "Title", I18N_NOOP( "Subject" ), "Col_Subject", true }, - { "ResNum", I18N_NOOP( "ResNum" ), "Col_ResNum", true }, - { "ReadNum", I18N_NOOP( "ReadNum" ), "Col_ReadNum", true }, - { "ViewPos", I18N_NOOP( "ViewPos" ), "Col_ViewPos", false }, - { "Unread", I18N_NOOP( "Unread" ), "Col_Unread", true }, - { "Since", I18N_NOOP( "Since" ), "Col_Since", true }, - { "Thread's speed", I18N_NOOP( "Speed" ), "Col_Speed", true }, - { "Board", I18N_NOOP( "Board" ), "Col_Board", false }, - { "Dat URL", I18N_NOOP( "DatURL" ), "Col_DatURL", false }, - { "Mark Order", I18N_NOOP( "MarkOrder" ), "Col_MarkOrder", false }, - { "ID Order", I18N_NOOP( "IDOrder" ), "Col_IDOrder", false } + { " ", I18N_NOOP("Mark"), "Col_Mark", true }, + { "No.", I18N_NOOP("ID"), "Col_ID", true }, + { " ", I18N_NOOP("Icon"), "Col_Icon", true }, + { "Title", I18N_NOOP("Subject"), "Col_Subject", true }, + { "ResNum", I18N_NOOP("ResNum"), "Col_ResNum", true }, + { "ReadNum", I18N_NOOP("ReadNum"), "Col_ReadNum", true }, + { "ViewPos", I18N_NOOP("ViewPos"), "Col_ViewPos", false }, + { "Unread", I18N_NOOP("Unread"), "Col_Unread", true }, + { "Since", I18N_NOOP("Since"), "Col_Since", true }, + { "Thread's speed", I18N_NOOP("Speed"), "Col_Speed", true }, + { "Board", I18N_NOOP("Board"), "Col_Board", false }, + { "Dat URL", I18N_NOOP("DatURL"), "Col_DatURL", false }, + { "Mark Order", I18N_NOOP("MarkOrder"), "Col_MarkOrder", false }, + { "ID Order", I18N_NOOP("IDOrder"), "Col_IDOrder", false } }; -ThreadListView::ThreadListView( QWidget* parent ) - : QWidget( parent ) +ThreadListView::ThreadListView(QWidget* parent) + : QWidget(parent) { - setupUi( this ); - HideButton->setIcon( SmallIcon( "view-filter" ) ); - ReloadButton->setIcon( SmallIcon( "view-refresh" ) ); - closeButton->setIcon( SmallIcon( "tab-close" ) ); + setupUi(this); + HideButton->setIcon(SmallIcon("view-filter")); + ReloadButton->setIcon(SmallIcon("view-refresh")); + closeButton->setIcon(SmallIcon("tab-close")); Q3Header* header = subjectList->header(); - for ( int i = Col_Begin; i <= Col_End; i++ ) { - subjectList->addColumn( i18n( s_colAttr[ i ].labelName ) ); + for (int i = Col_Begin; i <= Col_End; i++) { + subjectList->addColumn(i18n(s_colAttr[ i ].labelName)); - if ( s_colAttr[ i ].showDefault != true ) { - hideColumn( i ); + if (s_colAttr[ i ].showDefault != true) { + hideColumn(i); } } - header->setStretchEnabled( true, Col_Subject ); + header->setStretchEnabled(true, Col_Subject); - connect( SearchCombo, SIGNAL( activated( int ) ), - SLOT( slotSearchButton() ) ); - connect( SearchCombo, SIGNAL( textChanged( const QString& ) ), - SLOT( slotSearchButton() ) ); - connect( HideButton, SIGNAL( toggled( bool ) ), - SLOT( slotHideButton( bool ) ) ); - connect( subjectList, SIGNAL( mouseButtonClicked( int, Q3ListViewItem*, const QPoint&, int ) ), - SLOT( slotMouseButtonClicked( int, Q3ListViewItem* ) ) ); + connect(SearchCombo, SIGNAL(activated(int)), + SLOT(slotSearchButton())); + connect(SearchCombo, SIGNAL(textChanged(const QString&)), + SLOT(slotSearchButton())); + connect(HideButton, SIGNAL(toggled(bool)), + SLOT(slotHideButton(bool))); + connect(subjectList, SIGNAL(mouseButtonClicked(int, Q3ListViewItem*, const QPoint&, int)), + SLOT(slotMouseButtonClicked(int, Q3ListViewItem*))); } ThreadListView::~ThreadListView() @@ -80,58 +80,58 @@ void ThreadListView::slotSearchButton() { insertSearchCombo(); - QStringList list = Kita::parseSearchQuery( SearchCombo->currentText() ); + QStringList list = Kita::parseSearchQuery(SearchCombo->currentText()); - if ( list.isEmpty() ) { + if (list.isEmpty()) { clearSearch(); - } else if ( list != m_prevquery ) { - searchNew( list ); - HideButton->setDown( true ); + } else if (list != m_prevquery) { + searchNew(list); + HideButton->setDown(true); } else { - searchNext( list ); + searchNext(list); } } void ThreadListView::insertSearchCombo() { - for ( int count = 0; count < SearchCombo->count(); ++count ) { - if ( SearchCombo->itemText( count ) == SearchCombo->currentText() ) { + for (int count = 0; count < SearchCombo->count(); ++count) { + if (SearchCombo->itemText(count) == SearchCombo->currentText()) { return; } } - SearchCombo->addItem( SearchCombo->currentText() ); + SearchCombo->addItem(SearchCombo->currentText()); } -void ThreadListView::searchNext( const QStringList &query ) +void ThreadListView::searchNext(const QStringList &query) { - Q_ASSERT( query == m_prevquery ); - Q_ASSERT( m_nextHitIndex < static_cast<unsigned>( m_hitList.size() ) ); + Q_ASSERT(query == m_prevquery); + Q_ASSERT(m_nextHitIndex < static_cast<unsigned>(m_hitList.size())); K3ListViewItem* item = m_hitList[ m_nextHitIndex ]; - subjectList->ensureItemVisible( item ); - subjectList->setSelected( item, true ); + subjectList->ensureItemVisible(item); + subjectList->setSelected(item, true); m_nextHitIndex++; - if ( m_nextHitIndex >= static_cast<unsigned>( m_hitList.size() ) ) + if (m_nextHitIndex >= static_cast<unsigned>(m_hitList.size())) m_nextHitIndex = 0; } -void ThreadListView::searchNew( const QStringList &query ) +void ThreadListView::searchNew(const QStringList &query) { m_hitList.clear(); m_nextHitIndex = 0; m_prevquery = query; - Q3ListViewItemIterator listIt( subjectList ); - while ( listIt.current() != 0 ) { - K3ListViewItem * item = static_cast<K3ListViewItem*>( listIt.current() ); - item->setPixmap( Col_Icon, 0 ); + Q3ListViewItemIterator listIt(subjectList); + while (listIt.current() != 0) { + K3ListViewItem * item = static_cast<K3ListViewItem*>(listIt.current()); + item->setPixmap(Col_Icon, 0); QStringList::const_iterator queryIt = query.begin(); - for ( ; queryIt != query.end(); ++queryIt ) { - if ( item->text( Col_Subject ).contains( *queryIt, Qt::CaseInsensitive ) ) { - item->setPixmap( Col_Icon, SmallIcon( "edit-find" ) ); - m_hitList.append( item ); + for (; queryIt != query.end(); ++queryIt) { + if (item->text(Col_Subject).contains(*queryIt, Qt::CaseInsensitive)) { + item->setPixmap(Col_Icon, SmallIcon("edit-find")); + m_hitList.append(item); break; } } @@ -141,54 +141,54 @@ void ThreadListView::clearSearch() { - Q3ListViewItemIterator listIt( subjectList ); - while ( listIt.current() != 0 ) { - K3ListViewItem * item = static_cast<K3ListViewItem *>( listIt.current() ); - item->setPixmap( Col_Icon, 0 ); - item->setVisible( true ); + Q3ListViewItemIterator listIt(subjectList); + while (listIt.current() != 0) { + K3ListViewItem * item = static_cast<K3ListViewItem *>(listIt.current()); + item->setPixmap(Col_Icon, 0); + item->setVisible(true); ++listIt; } } -void ThreadListView::slotHideButton( bool on ) +void ThreadListView::slotHideButton(bool on) { - Q3ListViewItemIterator listIt( subjectList ); - while ( listIt.current() != 0 ) { - K3ListViewItem * item = static_cast<K3ListViewItem *>( listIt.current() ); - if ( on && ! item->pixmap( Col_Icon ) ) { - item->setVisible( false ); + Q3ListViewItemIterator listIt(subjectList); + while (listIt.current() != 0) { + K3ListViewItem * item = static_cast<K3ListViewItem *>(listIt.current()); + if (on && ! item->pixmap(Col_Icon)) { + item->setVisible(false); } else { - item->setVisible( true ); + item->setVisible(true); } ++listIt; } } -void ThreadListView::slotMouseButtonClicked( int button, Q3ListViewItem* item ) +void ThreadListView::slotMouseButtonClicked(int button, Q3ListViewItem* item) { - if ( ! item ) return ; + if (! item) return ; - KUrl datURL = item->text( Col_DatURL ); + KUrl datURL = item->text(Col_DatURL); - if ( button == Qt::LeftButton ) { - ViewMediator::getInstance()->openThread( datURL ); + if (button == Qt::LeftButton) { + ViewMediator::getInstance()->openThread(datURL); } } -void ThreadListView::hideColumn( int col ) +void ThreadListView::hideColumn(int col) { Q3Header* header = subjectList->header(); - subjectList->setColumnWidthMode( col, Q3ListView::Manual ); - header->setResizeEnabled( false, col ); - subjectList->setColumnWidth( col, 0 ); + subjectList->setColumnWidthMode(col, Q3ListView::Manual); + header->setResizeEnabled(false, col); + subjectList->setColumnWidth(col, 0); } -void ThreadListView::showColumn( int col ) +void ThreadListView::showColumn(int col) { Q3Header* header = subjectList->header(); - subjectList->setColumnWidthMode( col, Q3ListView::Maximum ); - header->setResizeEnabled( true, col ); - subjectList->adjustColumn( col ); + subjectList->setColumnWidthMode(col, Q3ListView::Maximum); + header->setResizeEnabled(true, col); + subjectList->adjustColumn(col); } #include "threadlistview.moc" Modified: kita/branches/KITA-KDE4/kita/src/threadlistview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadlistview.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/threadlistview.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -37,7 +37,7 @@ Q_OBJECT public: - ThreadListView( QWidget* parent = 0 ); + ThreadListView(QWidget* parent = 0); ~ThreadListView(); protected: @@ -47,15 +47,15 @@ Q3ValueList<K3ListViewItem *> m_hitList; void insertSearchCombo(); - void searchNext( const QStringList& input ); - void searchNew( const QStringList& query ); + void searchNext(const QStringList& input); + void searchNew(const QStringList& query); void clearSearch(); - void hideColumn( int col ); - void showColumn( int col ); + void hideColumn(int col); + void showColumn(int col); protected slots: - void slotHideButton( bool on ); - void slotMouseButtonClicked( int, Q3ListViewItem* ); + void slotHideButton(bool on); + void slotMouseButtonClicked(int, Q3ListViewItem*); private slots: void slotSearchButton(); Modified: kita/branches/KITA-KDE4/kita/src/threadlistviewitem.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadlistviewitem.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/threadlistviewitem.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -12,30 +12,30 @@ using namespace Kita; -ThreadListViewItem::ThreadListViewItem( Q3ListView* parent ) - : Kita::ListViewItem( parent ) +ThreadListViewItem::ThreadListViewItem(Q3ListView* parent) + : Kita::ListViewItem(parent) {} ThreadListViewItem::~ThreadListViewItem() {} /* public */ /* virtual */ -int ThreadListViewItem::compare( Q3ListViewItem* i, int col, bool ascending ) const +int ThreadListViewItem::compare(Q3ListViewItem* i, int col, bool ascending) const { - switch ( col ) { + switch (col) { case Col_ResNum: case Col_ReadNum: case Col_Unread: - return i->key( col, ascending ).toInt() - key( col, ascending ).toInt(); + return i->key(col, ascending).toInt() - key(col, ascending).toInt(); case Col_ID: - return key( Col_IDOrder, ascending ).toInt() - i->key( Col_IDOrder, ascending ).toInt(); + return key(Col_IDOrder, ascending).toInt() - i->key(Col_IDOrder, ascending).toInt(); case Col_Mark: - return QString::localeAwareCompare( i->key( Col_MarkOrder, ascending ), key( Col_MarkOrder, ascending ) ); + return QString::localeAwareCompare(i->key(Col_MarkOrder, ascending), key(Col_MarkOrder, ascending)); case Col_Since: - return QString::localeAwareCompare( i->key( col, ascending ), key( col, ascending ) ); + return QString::localeAwareCompare(i->key(col, ascending), key(col, ascending)); case Col_Speed: - return static_cast<int>( i->key( col, ascending ).toDouble() * 1000 - key( col, ascending ).toDouble() * 1000 ); + return static_cast<int>(i->key(col, ascending).toDouble() * 1000 - key(col, ascending).toDouble() * 1000); default: - return QString::localeAwareCompare( key( col, ascending ), i->key( col, ascending ) ); + return QString::localeAwareCompare(key(col, ascending), i->key(col, ascending)); } } Modified: kita/branches/KITA-KDE4/kita/src/threadlistviewitem.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadlistviewitem.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/threadlistviewitem.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -38,10 +38,10 @@ class ThreadListViewItem : public Kita::ListViewItem { public: - ThreadListViewItem( Q3ListView* parent ); + ThreadListViewItem(Q3ListView* parent); ~ThreadListViewItem(); - virtual int compare( Q3ListViewItem* i, int col, bool ascending ) const; + virtual int compare(Q3ListViewItem* i, int col, bool ascending) const; }; } Modified: kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -36,80 +36,80 @@ /*--------------------------------------------------------------------------------*/ -KitaThreadTabWidget::KitaThreadTabWidget( QWidget* parent, Qt::WFlags f ) - : KitaTabWidgetBase( parent, f ) +KitaThreadTabWidget::KitaThreadTabWidget(QWidget* parent, Qt::WFlags f) + : KitaTabWidgetBase(parent, f) { - setXMLFile( "threadtabwidgetui.rc" ); + setXMLFile("threadtabwidgetui.rc"); setupActions(); /* default view */ - createView( "thread" ); + createView("thread"); } KitaThreadTabWidget::~KitaThreadTabWidget() {} /* show "Main thread" view */ /* public slots */ -void KitaThreadTabWidget::slotShowMainThread( const KUrl& url ) +void KitaThreadTabWidget::slotShowMainThread(const KUrl& url) { QString refstr; - KUrl datURL = Kita::ParseMisc::parseURL( url, refstr ); - QString threadName = Kita::DatManager::threadName( datURL ); + KUrl datURL = Kita::ParseMisc::parseURL(url, refstr); + QString threadName = Kita::DatManager::threadName(datURL); int jumpNum = 0; int viewMode = VIEWMODE_MAINVIEW; - KitaThreadView* currentView = isThreadView( currentWidget() ); - if ( currentView ) viewMode = currentView->getViewMode(); + KitaThreadView* currentView = isThreadView(currentWidget()); + if (currentView) viewMode = currentView->getViewMode(); - if ( !refstr.isEmpty() ) { - int i = refstr.indexOf( "-" ); - if ( i != -1 ) jumpNum = refstr.left( i ).toInt(); + if (!refstr.isEmpty()) { + int i = refstr.indexOf("-"); + if (i != -1) jumpNum = refstr.left(i).toInt(); else jumpNum = refstr.toInt(); } - KitaThreadView* view = findMainView( datURL ); + KitaThreadView* view = findMainView(datURL); - if ( view ) { + if (view) { - setCurrentWidget( view ); + setCurrentWidget(view); - if ( view->threadURL().isEmpty() ) { + if (view->threadURL().isEmpty()) { /* Show on the default view */ - view->showThread( datURL, jumpNum ); + view->showThread(datURL, jumpNum); } else { /* The view is already shown */ /* TODO: jump to jumpNum after reloading */ - view->slotReloadButton( jumpNum ); + view->slotReloadButton(jumpNum); } } else { - KitaThreadView * newView = createView( threadName ); + KitaThreadView * newView = createView(threadName); - if ( newView ) { - newView->showThread( datURL, jumpNum ); - setCurrentWidget( newView ); + if (newView) { + newView->showThread(datURL, jumpNum); + setCurrentWidget(newView); } } - slotUpdateThreadTab( datURL ); + slotUpdateThreadTab(datURL); } /* close "all" views which URL is url. */ /* public slot */ -void KitaThreadTabWidget::slotCloseThreadTab( const KUrl& url ) +void KitaThreadTabWidget::slotCloseThreadTab(const KUrl& url) { int max = count(); - if ( max == 0 ) return ; - KUrl datURL = Kita::ParseMisc::parseURLonly( url ); + if (max == 0) return ; + KUrl datURL = Kita::ParseMisc::parseURLonly(url); int i, i2; i = i2 = 0; - while ( i < max ) { - KitaThreadView * view = isThreadView( widget( i ) ); - if ( view ) { - if ( view->datURL() == datURL ) { - slotCloseTab( i2 ); + while (i < max) { + KitaThreadView * view = isThreadView(widget(i)); + if (view) { + if (view->datURL() == datURL) { + slotCloseTab(i2); i2--; } } @@ -120,33 +120,33 @@ /* create KitaThreadView */ /* private */ -KitaThreadView* KitaThreadTabWidget::createView( QString label ) +KitaThreadView* KitaThreadTabWidget::createView(QString label) { - KitaThreadView * view = new KitaThreadView( this ); - if ( view ) { - addTab( view, label ); + KitaThreadView * view = new KitaThreadView(this); + if (view) { + addTab(view, label); } return view; } /* private */ -KitaThreadView* KitaThreadTabWidget::findMainView( const KUrl& url ) +KitaThreadView* KitaThreadTabWidget::findMainView(const KUrl& url) { - KUrl datURL = Kita::ParseMisc::parseURLonly( url ); + KUrl datURL = Kita::ParseMisc::parseURLonly(url); int max = count(); - if ( max == 0 ) return 0; + if (max == 0) return 0; int i = 0; - while ( i < max ) { - KitaThreadView * view = isThreadView( widget( i ) ); - if ( view ) { - if ( view->getViewMode() == VIEWMODE_MAINVIEW ) { + while (i < max) { + KitaThreadView * view = isThreadView(widget(i)); + if (view) { + if (view->getViewMode() == VIEWMODE_MAINVIEW) { - if ( view->datURL() == datURL + if (view->datURL() == datURL || view->datURL().isEmpty() /* default view */ - ) return view; + ) return view; } } i++; @@ -157,11 +157,11 @@ /* private */ -KitaThreadView* KitaThreadTabWidget::isThreadView( QWidget* w ) +KitaThreadView* KitaThreadTabWidget::isThreadView(QWidget* w) { KitaThreadView * view = 0; - if ( w ) { - if ( w->inherits( "KitaThreadView" ) ) view = static_cast< KitaThreadView* >( w ); + if (w) { + if (w->inherits("KitaThreadView")) view = static_cast< KitaThreadView* >(w); } return view; @@ -169,40 +169,40 @@ /* private slots */ -void KitaThreadTabWidget::slotUpdateThreadTab( const KUrl& url ) +void KitaThreadTabWidget::slotUpdateThreadTab(const KUrl& url) { - KUrl datURL = Kita::ParseMisc::parseURLonly( url ); + KUrl datURL = Kita::ParseMisc::parseURLonly(url); - KitaThreadView * view = findMainView( datURL ); - if ( view ) { - QString threadName = Kita::DatManager::threadName( datURL ); + KitaThreadView * view = findMainView(datURL); + if (view) { + QString threadName = Kita::DatManager::threadName(datURL); - setTabText( indexOf(view), threadName ); - setTabToolTip( indexOf(view), threadName ); + setTabText(indexOf(view), threadName); + setTabToolTip(indexOf(view), threadName); } } void KitaThreadTabWidget::slotFontChanged() { QFont font = Kita::Config::threadFont(); - setFont( font ); + setFont(font); } /* protected */ /* virtual */ -void KitaThreadTabWidget::deleteWidget( QWidget* w ) +void KitaThreadTabWidget::deleteWidget(QWidget* w) { - KitaTabWidgetBase::deleteWidget( w ); + KitaTabWidgetBase::deleteWidget(w); - if ( count() == 0 ) { - ViewMediator::getInstance()->setMainCaption( QString() ); - ViewMediator::getInstance()->setMainStatus( QString() ); - ViewMediator::getInstance()->setMainURLLine( KUrl() ); + if (count() == 0) { + ViewMediator::getInstance()->setMainCaption(QString()); + ViewMediator::getInstance()->setMainStatus(QString()); + ViewMediator::getInstance()->setMainURLLine(KUrl()); /* default view */ - KitaThreadView * threadView = createView( "thread" ); + KitaThreadView * threadView = createView("thread"); - if ( threadView ) { - setCurrentWidget( threadView ); + if (threadView) { + setCurrentWidget(threadView); } } } @@ -216,13 +216,13 @@ /* private */ void KitaThreadTabWidget::setupActions() { - KStandardAction::copy( this, SLOT( slotCopyText() ), actionCollection() ); + KStandardAction::copy(this, SLOT(slotCopyText()), actionCollection()); - KStandardAction::find( this, SLOT( slotFocusSearchCombo() ), actionCollection() ); + KStandardAction::find(this, SLOT(slotFocusSearchCombo()), actionCollection()); - KStandardAction::findNext( this, SLOT( slotSearchNext() ), actionCollection() ); + KStandardAction::findNext(this, SLOT(slotSearchNext()), actionCollection()); - KStandardAction::findPrev( this, SLOT( slotSearchPrev() ), actionCollection() ); + KStandardAction::findPrev(this, SLOT(slotSearchPrev()), actionCollection()); KAction* goback_action = actionCollection()->addAction("threadview_goback"); goback_action->setText("go back anchor"); @@ -269,81 +269,81 @@ void KitaThreadTabWidget::slotCopyText() { QWidget * w = currentWidget(); - KitaThreadView * view = isThreadView( w ); - if ( view ) { + KitaThreadView * view = isThreadView(w); + if (view) { QClipboard * clipboard = QApplication::clipboard(); QString text = view->selectedText(); - clipboard->setText( text, QClipboard::Clipboard ); + clipboard->setText(text, QClipboard::Clipboard); } } /* public slot */ void KitaThreadTabWidget::slotFocusSearchCombo() { - KitaThreadView * view = isThreadView( currentWidget() ); - if ( view ) view->focusSearchCombo(); + KitaThreadView * view = isThreadView(currentWidget()); + if (view) view->focusSearchCombo(); } /* public slot */ void KitaThreadTabWidget::slotSearchNext() { - KitaThreadView * view = isThreadView( currentWidget() ); - if ( view ) view->slotSearchNext(); + KitaThreadView * view = isThreadView(currentWidget()); + if (view) view->slotSearchNext(); } /* public slot */ void KitaThreadTabWidget::slotSearchPrev() { - KitaThreadView * view = isThreadView( currentWidget() ); - if ( view ) view->slotSearchPrev(); + KitaThreadView * view = isThreadView(currentWidget()); + if (view) view->slotSearchPrev(); } /* public slot */ void KitaThreadTabWidget::slotGobackAnchor() { - KitaThreadView * view = isThreadView( currentWidget() ); - if ( view ) view->slotGobackAnchor(); + KitaThreadView * view = isThreadView(currentWidget()); + if (view) view->slotGobackAnchor(); } /* public slot */ void KitaThreadTabWidget::slotGotoHeader() { - KitaThreadView * view = isThreadView( currentWidget() ); - if ( view ) view->slotGotoHeader(); + KitaThreadView * view = isThreadView(currentWidget()); + if (view) view->slotGotoHeader(); } /* public slot */ void KitaThreadTabWidget::slotGotoFooter() { - KitaThreadView * view = isThreadView( currentWidget() ); - if ( view ) view->slotGotoFooter(); + KitaThreadView * view = isThreadView(currentWidget()); + if (view) view->slotGotoFooter(); } /* public slot */ void KitaThreadTabWidget::slotReloadButton() { - KitaThreadView * view = isThreadView( currentWidget() ); - if ( view ) view->slotReloadButton(); + KitaThreadView * view = isThreadView(currentWidget()); + if (view) view->slotReloadButton(); } /* public slot */ void KitaThreadTabWidget::slotStopLoading() { - KitaThreadView * view = isThreadView( currentWidget() ); - if ( view ) view->slotStopLoading(); + KitaThreadView * view = isThreadView(currentWidget()); + if (view) view->slotStopLoading(); } /* public slot */ void KitaThreadTabWidget::slotDeleteButtonClicked() { - KitaThreadView * view = isThreadView( currentWidget() ); - if ( view ) view->slotDeleteButtonClicked(); + KitaThreadView * 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-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/threadtabwidget.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -23,25 +23,25 @@ Q_OBJECT public: - explicit KitaThreadTabWidget( QWidget* parent = 0, Qt::WFlags f = 0 ); + explicit KitaThreadTabWidget(QWidget* parent = 0, Qt::WFlags f = 0); ~KitaThreadTabWidget(); public slots: - void slotShowMainThread( const KUrl& datURL ); - void slotCloseThreadTab( const KUrl& url ); - void slotUpdateThreadTab( const KUrl& url ); + void slotShowMainThread(const KUrl& datURL); + void slotCloseThreadTab(const KUrl& url); + void slotUpdateThreadTab(const KUrl& url); private: - KitaThreadView* createView( QString label ); - KitaThreadView* findMainView( const KUrl& url ); - KitaThreadView* isThreadView( QWidget* w ); + KitaThreadView* createView(QString label); + KitaThreadView* findMainView(const KUrl& url); + KitaThreadView* isThreadView(QWidget* w); private slots: void slotFontChanged(); protected: - virtual void deleteWidget( QWidget* w ); + virtual void deleteWidget(QWidget* w); /*------------------------------------*/ Modified: kita/branches/KITA-KDE4/kita/src/threadview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadview.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/threadview.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -50,106 +50,106 @@ #define MAX_LABEL_LENGTH 60 -KitaThreadView::KitaThreadView( KitaThreadTabWidget* parent ) +KitaThreadView::KitaThreadView(KitaThreadTabWidget* parent) { m_parent = parent; /* copied from Base class */ - setFocusPolicy( Qt::ClickFocus ); - KitaThreadViewBaseLayout = new QVBoxLayout( this ); + setFocusPolicy(Qt::ClickFocus); + KitaThreadViewBaseLayout = new QVBoxLayout(this); - layout2 = new QHBoxLayout( 0 ); - layout2->setSpacing( 6 ); + layout2 = new QHBoxLayout(0); + layout2->setSpacing(6); - writeButton = new QToolButton( this ); - writeButton->setEnabled( false ); - layout2->addWidget( writeButton ); + writeButton = new QToolButton(this); + writeButton->setEnabled(false); + layout2->addWidget(writeButton); - SearchCombo = new KComboBox( this ); - SearchCombo->setMinimumSize( QSize( 200, 0 ) ); - SearchCombo->setEditable( true ); - SearchCombo->setMaxVisibleItems( 10 ); - SearchCombo->setMaxCount( 15 ); - SearchCombo->setInsertPolicy( KComboBox::InsertAtTop ); - SearchCombo->setDuplicatesEnabled( false ); - layout2->addWidget( SearchCombo ); + SearchCombo = new KComboBox(this); + SearchCombo->setMinimumSize(QSize(200, 0)); + SearchCombo->setEditable(true); + SearchCombo->setMaxVisibleItems(10); + SearchCombo->setMaxCount(15); + SearchCombo->setInsertPolicy(KComboBox::InsertAtTop); + SearchCombo->setDuplicatesEnabled(false); + layout2->addWidget(SearchCombo); - HighLightButton = new QToolButton( this ); - HighLightButton->setCheckable( true ); - layout2->addWidget( HighLightButton ); + HighLightButton = new QToolButton(this); + HighLightButton->setCheckable(true); + layout2->addWidget(HighLightButton); - BookmarkButton = new QToolButton( this ); - BookmarkButton->setEnabled( false ); - BookmarkButton->setCheckable( true ); - layout2->addWidget( BookmarkButton ); + BookmarkButton = new QToolButton(this); + BookmarkButton->setEnabled(false); + BookmarkButton->setCheckable(true); + layout2->addWidget(BookmarkButton); - ReloadButton = new QToolButton( this ); - ReloadButton->setEnabled( false ); - layout2->addWidget( ReloadButton ); + ReloadButton = new QToolButton(this); + ReloadButton->setEnabled(false); + layout2->addWidget(ReloadButton); - gotoCombo = new KComboBox( this ); - gotoCombo->setMinimumSize( QSize( 200, 0 ) ); - layout2->addWidget( gotoCombo ); + gotoCombo = new KComboBox(this); + gotoCombo->setMinimumSize(QSize(200, 0)); + layout2->addWidget(gotoCombo); - deleteButton = new QToolButton( this ); - deleteButton->setEnabled( false ); - layout2->addWidget( deleteButton ); - spacer2 = new QSpacerItem( 30, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - layout2->addItem( spacer2 ); + deleteButton = new QToolButton(this); + deleteButton->setEnabled(false); + layout2->addWidget(deleteButton); + spacer2 = new QSpacerItem(30, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + layout2->addItem(spacer2); - closeButton = new QToolButton( this ); - closeButton->setEnabled( false ); - layout2->addWidget( closeButton ); - KitaThreadViewBaseLayout->addLayout( layout2 ); + closeButton = new QToolButton(this); + closeButton->setEnabled(false); + layout2->addWidget(closeButton); + KitaThreadViewBaseLayout->addLayout(layout2); - threadFrame = new QFrame( this ); - threadFrame->setFrameShape( QFrame::StyledPanel ); - threadFrame->setFrameShadow( QFrame::Raised ); - KitaThreadViewBaseLayout->addWidget( threadFrame ); - resize( QSize(870, 480).expandedTo(minimumSizeHint()) ); - setAttribute( Qt::WA_WState_Polished ); + threadFrame = new QFrame(this); + threadFrame->setFrameShape(QFrame::StyledPanel); + threadFrame->setFrameShadow(QFrame::Raised); + KitaThreadViewBaseLayout->addWidget(threadFrame); + resize(QSize(870, 480).expandedTo(minimumSizeHint())); + setAttribute(Qt::WA_WState_Polished); /* copy end */ - m_threadPart = new KitaHTMLPart( threadFrame ); - QHBoxLayout* aLayout = new QHBoxLayout( threadFrame ); - aLayout->addWidget( m_threadPart->view() ); + m_threadPart = new KitaHTMLPart(threadFrame); + QHBoxLayout* aLayout = new QHBoxLayout(threadFrame); + aLayout->addWidget(m_threadPart->view()); { - HighLightButton->setIcon( SmallIcon( "help-hint" ) ); - ReloadButton->setIcon( SmallIcon( "view-refresh" ) ); - BookmarkButton->setIcon( SmallIcon( "bookmark-new" ) ); - writeButton->setIcon( SmallIcon( "draw-freehand" ) ); - deleteButton->setIcon( SmallIcon( "trash-empty" ) ); - closeButton->setIcon( SmallIcon( "tab-close" ) ); + HighLightButton->setIcon(SmallIcon("help-hint")); + ReloadButton->setIcon(SmallIcon("view-refresh")); + BookmarkButton->setIcon(SmallIcon("bookmark-new")); + writeButton->setIcon(SmallIcon("draw-freehand")); + deleteButton->setIcon(SmallIcon("trash-empty")); + closeButton->setIcon(SmallIcon("tab-close")); } - setAcceptDrops( true ); // DND Drop eneble: 2nd stage. - enable on "KitaThreadView" widget and disable on the others(child widgets of "KitaThreadView"). - threadFrame->setAcceptDrops( false ); // don't treat Drop event on child. - m_threadPart->view() ->setAcceptDrops( false ); // don't treat Drop event on child. + setAcceptDrops(true); // DND Drop eneble: 2nd stage. - enable on "KitaThreadView" widget and disable on the others(child widgets of "KitaThreadView"). + threadFrame->setAcceptDrops(false); // don't treat Drop event on child. + m_threadPart->view() ->setAcceptDrops(false); // don't treat Drop event on child. -// m_threadPart->enableMetaRefresh( false ); //disable <meta refresh="..."> // TODO +// m_threadPart->enableMetaRefresh(false); //disable <meta refresh="..."> // TODO - connect( deleteButton, SIGNAL( clicked() ), - SLOT( slotDeleteButtonClicked() ) ); - connect( writeButton, SIGNAL( clicked() ), - SLOT( slotWriteButtonClicked() ) ); - connect( m_threadPart, SIGNAL( finishReload() ), - SLOT( slotUpdateInfo() ) ); - connect( m_threadPart, SIGNAL( nodeActivated( const DOM::Node& ) ), - SLOT( slotDOMNodeActivated( const DOM::Node& ) ) ); - connect( m_threadPart, SIGNAL( mousePressed() ), - SLOT( setFocus() ) ); + connect(deleteButton, SIGNAL(clicked()), + SLOT(slotDeleteButtonClicked())); + connect(writeButton, SIGNAL(clicked()), + SLOT(slotWriteButtonClicked())); + connect(m_threadPart, SIGNAL(finishReload()), + SLOT(slotUpdateInfo())); + connect(m_threadPart, SIGNAL(nodeActivated(const DOM::Node&)), + SLOT(slotDOMNodeActivated(const DOM::Node&))); + connect(m_threadPart, SIGNAL(mousePressed()), + SLOT(setFocus())); - connect( BookmarkButton, SIGNAL( toggled( bool ) ), - SLOT( slotBookmarkButtonClicked( bool ) ) ); - connect( SearchCombo, SIGNAL( activated( int ) ), - SLOT( slotSearchButton() ) ); - connect( ReloadButton, SIGNAL( clicked() ), - SLOT( slotReloadButton() ) ); - connect( gotoCombo, SIGNAL( activated( int ) ), - SLOT( slotComboActivated( int ) ) ); - connect( closeButton, SIGNAL( clicked() ), - SLOT( slotCloseButton() ) ); + connect(BookmarkButton, SIGNAL(toggled(bool)), + SLOT(slotBookmarkButtonClicked(bool))); + connect(SearchCombo, SIGNAL(activated(int)), + SLOT(slotSearchButton())); + connect(ReloadButton, SIGNAL(clicked()), + SLOT(slotReloadButton())); + connect(gotoCombo, SIGNAL(activated(int)), + SLOT(slotComboActivated(int))); + connect(closeButton, SIGNAL(clicked()), + SLOT(slotCloseButton())); m_viewmode = VIEWMODE_MAINVIEW; m_rescode = 200; @@ -161,7 +161,7 @@ KitaThreadView::~KitaThreadView() { - if ( m_threadPart ) { + if (m_threadPart) { delete m_threadPart; m_threadPart = 0; } @@ -169,7 +169,7 @@ const KUrl KitaThreadView::threadURL() const { - return Kita::getThreadURL( m_datURL ); + return Kita::getThreadURL(m_datURL); } const KUrl KitaThreadView::datURL() const @@ -177,100 +177,100 @@ return m_datURL; } -void KitaThreadView::slotDOMNodeActivated( const DOM::Node& node ) +void KitaThreadView::slotDOMNodeActivated(const DOM::Node& node) { { //process Anchor tags. Anchor tags not proccessed here cause 'emit KParts::BrowserExtention::openURLRequest()' DOM::HTMLAnchorElement anchor = node; - if ( ! anchor.href().isEmpty() ) { + if (! anchor.href().isEmpty()) { // kdDebug() << "AnchorNodeActivated::" << endl; } // end: anchor.href().isEmpty() } // end of Anchor tags. } -void KitaThreadView::setSubjectLabel( const QString& boardName, const QString& threadName, const QString boardURL ) +void KitaThreadView::setSubjectLabel(const QString& boardName, const QString& threadName, const QString boardURL) { QString disp; - if ( boardName.isEmpty() ) { + if (boardName.isEmpty()) { disp = threadName; } else { - disp = QString( "<a href=\"%1\">[%2]</a> %3" ).arg( boardURL ).arg( boardName ).arg( threadName ); + disp = QString("<a href=\"%1\">[%2]</a> %3").arg(boardURL).arg(boardName).arg(threadName); } - //disp.truncate( MAX_LABEL_LENGTH ); + //disp.truncate(MAX_LABEL_LENGTH); } void KitaThreadView::updateButton() { - writeButton->setEnabled( true ); - BookmarkButton->setEnabled( true ); - ReloadButton->setEnabled( true ); - deleteButton->setEnabled( true ); - closeButton->setEnabled( true ); + writeButton->setEnabled(true); + BookmarkButton->setEnabled(true); + ReloadButton->setEnabled(true); + deleteButton->setEnabled(true); + closeButton->setEnabled(true); - if ( HighLightButton->isChecked() ) { + if (HighLightButton->isChecked()) { HighLightButton->toggle(); } - // don't emit SIGNAL( toggled() ) - disconnect( BookmarkButton, SIGNAL( toggled( bool ) ), this, SLOT( slotBookmarkButtonClicked( bool ) ) ); - if ( FavoriteThreads::getInstance() ->contains( m_datURL.prettyUrl() ) ) { - BookmarkButton->setChecked( true ); + // don't emit SIGNAL(toggled()) + disconnect(BookmarkButton, SIGNAL(toggled(bool)), this, SLOT(slotBookmarkButtonClicked(bool))); + if (FavoriteThreads::getInstance() ->contains(m_datURL.prettyUrl())) { + BookmarkButton->setChecked(true); } else { - BookmarkButton->setChecked( false ); + BookmarkButton->setChecked(false); } - connect( BookmarkButton, SIGNAL( toggled( bool ) ), SLOT( slotBookmarkButtonClicked( bool ) ) ); + connect(BookmarkButton, SIGNAL(toggled(bool)), SLOT(slotBookmarkButtonClicked(bool))); } /*--------------------*/ /* write response */ /*--------------------*/ /* private slots */ -void KitaThreadView::slotWriteButtonClicked( QString resStr ) +void KitaThreadView::slotWriteButtonClicked(QString resStr) { - ViewMediator::getInstance()->showWriteView( m_datURL, resStr ); + ViewMediator::getInstance()->showWriteView(m_datURL, resStr); } void KitaThreadView::insertSearchCombo() { - for ( int count = 0; count < SearchCombo->count(); ++count ) { - if ( SearchCombo->itemText( count ) == SearchCombo->currentText() ) { + for (int count = 0; count < SearchCombo->count(); ++count) { + if (SearchCombo->itemText(count) == SearchCombo->currentText()) { // found return ; } } - SearchCombo->addItem( SearchCombo->currentText() ); + SearchCombo->addItem(SearchCombo->currentText()); } -void KitaThreadView::slotPopupMenu( KXMLGUIClient* client, const QPoint& global, const KUrl& url, const QString& mimeType, mode_t mode ) +void KitaThreadView::slotPopupMenu(KXMLGUIClient* client, const QPoint& global, const KUrl& url, const QString& mimeType, mode_t mode) { /* KActionCollection * collection = client->actionCollection(); KAction* action; - action = new KAction( i18n( "goback anchor" ), SmallIcon( "idea" ), KShortcut(), m_threadPart, SLOT( gobackAnchor() ), collection, "goback_anchor" ); - emit popupMenu( client, global, url, mimeType, mode );*/ // TODO + action = new KAction(i18n("goback anchor"), SmallIcon("idea"), KShortcut(), m_threadPart, SLOT(gobackAnchor()), collection, "goback_anchor"); + emit popupMenu(client, global, url, mimeType, mode);*/ // TODO } -void KitaThreadView::setFont( const QFont& font ) +void KitaThreadView::setFont(const QFont& font) { // m_threadPart->setStandardFont(font.family()); - SearchCombo->setFont( font ); + SearchCombo->setFont(font); DOM::CSSStyleDeclaration style = m_threadPart->htmlDocument().body().style(); - style.setProperty( "font-family", font.family(), "" ); - style.setProperty( "font-size", QString( "%1pt" ).arg( font.pointSize() ), "" ); + style.setProperty("font-family", font.family(), ""); + style.setProperty("font-size", QString("%1pt").arg(font.pointSize()), ""); } -void KitaThreadView::slotBookmarkButtonClicked( bool on ) +void KitaThreadView::slotBookmarkButtonClicked(bool on) { - ViewMediator::getInstance()->bookmark( m_datURL.prettyUrl(), on ); + ViewMediator::getInstance()->bookmark(m_datURL.prettyUrl(), on); } void KitaThreadView::focusSearchCombo() { - if ( ! SearchCombo->hasFocus() ) { + if (! SearchCombo->hasFocus()) { SearchCombo->setFocus(); } else { setFocus(); @@ -281,8 +281,8 @@ /* public slot */ /* virtual */ void KitaThreadView::setFocus() { - ViewMediator::getInstance()->changeWriteTab( m_datURL ); - showStatusBar( QString() ); + ViewMediator::getInstance()->changeWriteTab(m_datURL); + showStatusBar(QString()); m_threadPart->view() ->setFocus(); } @@ -294,18 +294,18 @@ /*-------*/ /* setup */ /*-------*/ -void KitaThreadView::setup( const KUrl& datURL, int mode ) +void KitaThreadView::setup(const KUrl& datURL, int mode) { /* config. */ /*---------------------------------------*/ /* setup */ - m_datURL = Kita::getDatURL( datURL ); + m_datURL = Kita::getDatURL(datURL); /* setup HTMLPart */ int partMode = HTMLPART_MODE_MAINPART; - m_threadPart->setup( partMode, m_datURL ); + m_threadPart->setup(partMode, m_datURL); /* mode. Mode is defined in kitathreadview.h */ m_viewmode = mode; @@ -319,23 +319,23 @@ /* Show thread */ /* This function is called from KitaThreadTabWidget class */ /*--------------------------------------------------------*/ -void KitaThreadView::showThread( const KUrl& datURL, int num ) +void KitaThreadView::showThread(const KUrl& datURL, int num) { /* If this widget is not parent, then do nothing. */ - if ( m_viewmode != VIEWMODE_MAINVIEW ) return ; + if (m_viewmode != VIEWMODE_MAINVIEW) return ; - if ( num == 0 ) num = Kita::DatManager::getViewPos( datURL ); + if (num == 0) num = Kita::DatManager::getViewPos(datURL); - if ( topLevelWidget() ->isMinimized() ) topLevelWidget() ->showNormal(); + if (topLevelWidget() ->isMinimized()) topLevelWidget() ->showNormal(); topLevelWidget() ->raise(); activateWindow(); /* setup */ - setup( datURL, VIEWMODE_MAINVIEW ); + setup(datURL, VIEWMODE_MAINVIEW); /* get log from cahce */ m_rescode = 200; - if ( !m_threadPart->load( num ) ) showStatusBar( "" ); + if (!m_threadPart->load(num)) showStatusBar(""); /* update data */ slotUpdateInfo(); @@ -347,13 +347,13 @@ /*---------*/ /* reload */ /*---------*/ /* public slot */ -void KitaThreadView::slotReloadButton( int jumpNum ) +void KitaThreadView::slotReloadButton(int jumpNum) { topLevelWidget() ->raise(); activateWindow(); - if ( m_threadPart->reload( jumpNum ) ) { - showStatusBar( Kita::utf8ToUnicode( KITAUTF8_NOWRENEW ) ); + if (m_threadPart->reload(jumpNum)) { + showStatusBar(Kita::utf8ToUnicode(KITAUTF8_NOWRENEW)); } } @@ -363,54 +363,54 @@ void KitaThreadView::slotStopLoading() { /* hide popup */ - if ( m_threadPart->isPopupVisible() ) { + if (m_threadPart->isPopupVisible()) { m_threadPart->slotDeletePopup(); return ; } /* unforcus search combo */ - if ( SearchCombo->hasFocus() ) { + if (SearchCombo->hasFocus()) { setFocus(); return ; } - Kita::DatManager::stopLoading( m_datURL ); + Kita::DatManager::stopLoading(m_datURL); } /*-----------------------------------------*/ /* show the information at the statusbar. */ /*-----------------------------------------*/ -void KitaThreadView::showStatusBar( QString info ) +void KitaThreadView::showStatusBar(QString info) { - if ( m_datURL.isEmpty() ) return ; + if (m_datURL.isEmpty()) return ; 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 = 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); - switch ( m_viewmode ) { + switch (m_viewmode) { case VIEWMODE_MAINVIEW: errstr.clear(); - if ( m_rescode != 200 && m_rescode != 206 && m_rescode != 0 ) - errstr = QString( "Error %1" ).arg( m_rescode ); - if ( broken ) info += " This thread is broken."; + if (m_rescode != 200 && m_rescode != 206 && m_rescode != 0) + errstr = QString("Error %1").arg(m_rescode); + if (broken) info += " This thread is broken."; /* show status bar,caption, url */ - infostr = Kita::DatManager::threadName( m_datURL ) + - QString( " [Total: %1 New: %2] %3 k" ).arg( resNum ).arg( resNum - viewPos ).arg( datSize / 1024 ) + infostr = Kita::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 = Kita::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()->setMainCaption(captionStr); + ViewMediator::getInstance()->setMainStatus(infostr); + ViewMediator::getInstance()->setMainURLLine(Kita::getThreadURL(m_datURL)); return ; break; @@ -428,30 +428,30 @@ /* update information */ /* public */ void KitaThreadView::slotUpdateInfo() { - m_rescode = Kita::DatManager::getResponseCode( m_datURL ); - m_serverTime = Kita::DatManager::getServerTime( m_datURL ); + m_rescode = Kita::DatManager::getResponseCode(m_datURL); + m_serverTime = Kita::DatManager::getServerTime(m_datURL); /* uptate information */ - setSubjectLabel( Kita::BoardManager::boardName( m_datURL ), - Kita::DatManager::threadName( m_datURL ) - + QString( " (%1)" ) - .arg( Kita::DatManager::getReadNum( m_datURL ) ), - Kita::BoardManager::boardURL( m_datURL ) ); + setSubjectLabel(Kita::BoardManager::boardName(m_datURL), + Kita::DatManager::threadName(m_datURL) + + QString(" (%1)") + .arg(Kita::DatManager::getReadNum(m_datURL)), + Kita::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( QString().setNum( i ) + '-' ); + 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(QString().setNum(i) + '-'); } - gotoCombo->addItem( Kita::utf8ToUnicode( KITAUTF8_SAIGO ) ); + gotoCombo->addItem(Kita::utf8ToUnicode(KITAUTF8_SAIGO)); gotoCombo->adjustSize(); - ViewMediator::getInstance()->updateBoardView( m_datURL ); - ViewMediator::getInstance()->updateThreadView( m_datURL ); + ViewMediator::getInstance()->updateBoardView(m_datURL); + ViewMediator::getInstance()->updateThreadView(m_datURL); - showStatusBar( "" ); + showStatusBar(""); emit showThreadCompleted(); /* to KitaThreadPart */ } @@ -464,113 +464,113 @@ /*------------------------*/ /* private slots */ void KitaThreadView::slotSearchButton() { - if ( m_datURL.isEmpty() ) return ; /* Nothing is shown on the screen.*/ + if (m_datURL.isEmpty()) return ; /* Nothing is shown on the screen.*/ QString str = SearchCombo->currentText(); - if ( str.at( 0 ) == ':' ) { + if (str.at(0) == ':') { /* show res popup */ - if ( str.at( 1 ) == 'p' ) { - int refNum = str.mid( 2 ).toInt(); - QPoint pos = mapToGlobal( SearchCombo->pos() ); - pos.setY( pos.y() + SearchCombo->height() / 2 ); - m_threadPart->slotShowResPopup( pos , refNum, refNum ); + if (str.at(1) == 'p') { + int refNum = str.mid(2).toInt(); + QPoint pos = mapToGlobal(SearchCombo->pos()); + pos.setY(pos.y() + SearchCombo->height() / 2); + m_threadPart->slotShowResPopup(pos , refNum, refNum); return ; } /* find by find dialog */ - else if ( str.at( 1 ) == 'f' ) { - KAction * act = static_cast< KAction* >( m_threadPart->action( "find" ) ); - if ( act ) act->trigger(); + else if (str.at(1) == 'f') { + KAction * act = static_cast< KAction* >(m_threadPart->action("find")); + if (act) act->trigger(); return ; } /* jump */ - QString anc = str.mid( 1 ); - m_threadPart->gotoAnchor( anc, false ); + QString anc = str.mid(1); + m_threadPart->gotoAnchor(anc, false); SearchCombo->setFocus(); return ; } - slotSearchPrivate( false ); + slotSearchPrivate(false); } /* public slot */ -void KitaThreadView::slotSearchNext() { slotSearchPrivate( false ); } -void KitaThreadView::slotSearchPrev() { slotSearchPrivate( true ); } +void KitaThreadView::slotSearchNext() { slotSearchPrivate(false); } +void KitaThreadView::slotSearchPrev() { slotSearchPrivate(true); } /* private */ -void KitaThreadView::slotSearchPrivate( bool rev ) +void KitaThreadView::slotSearchPrivate(bool rev) { - if ( m_datURL.isEmpty() ) return ; /* Nothing is shown on the screen.*/ + if (m_datURL.isEmpty()) return ; /* Nothing is shown on the screen.*/ /* jump */ QString str = SearchCombo->currentText(); - if ( str.isEmpty() ) return ; - if ( str.isEmpty() ) return ; - if ( str.at( 0 ) == ':' ) return ; - if ( str.at( 0 ) == '?' ) return ; + if (str.isEmpty()) return ; + if (str.isEmpty()) return ; + if (str.at(0) == ':') return ; + if (str.at(0) == '?') return ; QStringList query; query += SearchCombo->currentText(); - int ResNum = Kita::DatManager::getResNum( m_datURL ); - for ( int i = 1; i <= ResNum; i++ ) { + int ResNum = Kita::DatManager::getResNum(m_datURL); + for (int i = 1; i <= ResNum; i++) { - if ( Kita::DatManager::checkWord( m_datURL, query, i, false ) ) { + if (Kita::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(); + if (m_viewmode == VIEWMODE_MAINVIEW) m_threadPart->showAll(); insertSearchCombo(); - QStringList list = Kita::parseSearchQuery( SearchCombo->currentText() ); - m_threadPart->findText( SearchCombo->currentText(), rev ); + QStringList list = Kita::parseSearchQuery(SearchCombo->currentText()); + m_threadPart->findText(SearchCombo->currentText(), rev); SearchCombo->setFocus(); return ; } } - QMessageBox::information( this, i18n( "kita" ), i18n( "Not Found" ) ); + QMessageBox::information(this, i18n("kita"), i18n("Not Found")); } /* public slot */ void KitaThreadView::slotGobackAnchor() { m_threadPart->slotGobackAnchor(); } -void KitaThreadView::slotGotoHeader() { m_threadPart->gotoAnchor( "header", false );} +void KitaThreadView::slotGotoHeader() { m_threadPart->gotoAnchor("header", false);} void KitaThreadView::slotGotoFooter() { m_threadPart->slotClickGotoFooter(); } // vim:sw=2: -void KitaThreadView::slotComboActivated( int index ) +void KitaThreadView::slotComboActivated(int index) { - if ( index == gotoCombo->count() - 1 ) { + if (index == gotoCombo->count() - 1) { // last - m_threadPart->gotoAnchor( "footer", false ); - } else if ( index == 1 ) { + m_threadPart->gotoAnchor("footer", false); + } else if (index == 1) { // kokomade yonda - m_threadPart->gotoAnchor( "kokomade_yonda", false ); - } else if ( index != 0 ) { - QString numText = gotoCombo->itemText( index ); - numText.truncate( numText.length() - 1 ); - m_threadPart->gotoAnchor( numText, false ); + m_threadPart->gotoAnchor("kokomade_yonda", false); + } else if (index != 0) { + QString numText = gotoCombo->itemText(index); + numText.truncate(numText.length() - 1); + m_threadPart->gotoAnchor(numText, false); } } void KitaThreadView::slotDeleteButtonClicked() { - if ( m_datURL.isEmpty() ) return ; + if (m_datURL.isEmpty()) return ; - int rescode = Kita::DatManager::getResponseCode( m_datURL ); - if ( ( rescode != 200 && rescode != 206 ) - || FavoriteThreads::getInstance() ->contains( m_datURL.prettyUrl() ) ) { - if ( QMessageBox::warning( this, + int rescode = Kita::DatManager::getResponseCode(m_datURL); + if ((rescode != 200 && rescode != 206) + || FavoriteThreads::getInstance() ->contains(m_datURL.prettyUrl())) { + if (QMessageBox::warning(this, "Kita", - i18n( "Do you want to delete Log ?" ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - != QMessageBox::Ok ) return ; + i18n("Do you want to delete Log ?"), + QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default) + != QMessageBox::Ok) return ; } - if ( Kita::DatManager::deleteCache( m_datURL ) ) { - m_parent->slotCloseThreadTab( m_datURL ); - ViewMediator::getInstance()->updateBoardView( m_datURL ); + if (Kita::DatManager::deleteCache(m_datURL)) { + m_parent->slotCloseThreadTab(m_datURL); + ViewMediator::getInstance()->updateBoardView(m_datURL); } } Modified: kita/branches/KITA-KDE4/kita/src/threadview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadview.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/threadview.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -54,22 +54,22 @@ KitaThreadTabWidget* m_parent; public: - KitaThreadView( KitaThreadTabWidget* parent ); + KitaThreadView(KitaThreadTabWidget* parent); ~KitaThreadView(); const KUrl threadURL() const; const KUrl datURL() const; const QString selectedText() const; - void setup( const KUrl& datURL, int mode ); - void showStatusBar( QString info ); + void setup(const KUrl& datURL, int mode); + void showStatusBar(QString info); int getViewMode() { return m_viewmode; } public slots: virtual void setFocus(); - void showThread( const KUrl& datURL, int num ); - void setFont( const QFont& font ); - void slotReloadButton( int jumpNum = 0 ); + void showThread(const KUrl& datURL, int num); + void setFont(const QFont& font); + void slotReloadButton(int jumpNum = 0); void slotStopLoading(); void focusSearchCombo(); void slotDeleteButtonClicked(); @@ -80,12 +80,12 @@ void slotGotoFooter(); protected slots: - void slotDOMNodeActivated( const DOM::Node& node ); - void slotPopupMenu( KXMLGUIClient*, const QPoint&, const KUrl&, const QString&, mode_t ); + void slotDOMNodeActivated(const DOM::Node& node); + void slotPopupMenu(KXMLGUIClient*, const QPoint&, const KUrl&, const QString&, mode_t); private: void insertSearchCombo(); - void setSubjectLabel( const QString& boardName, const QString& threadName, const QString boardURL ); + void setSubjectLabel(const QString& boardName, const QString& threadName, const QString boardURL); void updateButton(); KitaThreadView(const KitaThreadView&); @@ -114,15 +114,15 @@ private slots: void slotSearchButton(); - void slotBookmarkButtonClicked( bool on ); - void slotWriteButtonClicked( QString resstr = QString() ); - void slotComboActivated( int index ); + void slotBookmarkButtonClicked(bool on); + void slotWriteButtonClicked(QString resstr = QString()); + void slotComboActivated(int index); void slotUpdateInfo(); - void slotSearchPrivate( bool rev ); + void slotSearchPrivate(bool rev); void slotCloseButton(); signals: - void popupMenu( KXMLGUIClient*, const QPoint&, const KUrl&, const QString&, mode_t ); + void popupMenu(KXMLGUIClient*, const QPoint&, const KUrl&, const QString&, mode_t); void showThreadCompleted(); /* to KitaThreadPart */ }; Modified: kita/branches/KITA-KDE4/kita/src/viewmediator.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/viewmediator.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/viewmediator.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -26,115 +26,115 @@ ViewMediator* ViewMediator::getInstance() { - if( instance == 0 ) { + if(instance == 0) { instance = new ViewMediator(); } return instance; } -void ViewMediator::closeThreadTab( const KUrl& url ) +void ViewMediator::closeThreadTab(const KUrl& url) { - Q_ASSERT( m_threadTabWidget ); + Q_ASSERT(m_threadTabWidget); - m_threadTabWidget->slotCloseThreadTab( url ); + m_threadTabWidget->slotCloseThreadTab(url); } -void ViewMediator::showWriteView( const KUrl& url, const QString& resStr ) +void ViewMediator::showWriteView(const KUrl& url, const QString& resStr) { - Q_ASSERT( m_writeTabWidget ); + Q_ASSERT(m_writeTabWidget); - m_writeTabWidget->resize( 500, 400 ); + m_writeTabWidget->resize(500, 400); m_writeTabWidget->show(); - m_writeTabWidget->slotShowWriteView( url, resStr ); + m_writeTabWidget->slotShowWriteView(url, resStr); } -void ViewMediator::openBoard( const KUrl& url ) +void ViewMediator::openBoard(const KUrl& url) { - Q_ASSERT( m_boardTabWidget ); + Q_ASSERT(m_boardTabWidget); - m_boardTabWidget->loadBoard( url ); + m_boardTabWidget->loadBoard(url); } -void ViewMediator::openThread( const KUrl& url ) +void ViewMediator::openThread(const KUrl& url) { - Q_ASSERT( m_threadTabWidget ); + Q_ASSERT(m_threadTabWidget); - m_threadTabWidget->slotShowMainThread( url ); + m_threadTabWidget->slotShowMainThread(url); } -void ViewMediator::setMainStatus( const QString& statusStr ) +void ViewMediator::setMainStatus(const QString& statusStr) { - Q_ASSERT( m_mainWindow ); + Q_ASSERT(m_mainWindow); - m_mainWindow->setMainStatus( statusStr ); + m_mainWindow->setMainStatus(statusStr); } -void ViewMediator::setMainURLLine( const KUrl& url ) +void ViewMediator::setMainURLLine(const KUrl& url) { - Q_ASSERT( m_mainWindow ); + Q_ASSERT(m_mainWindow); - m_mainWindow->setUrl( url ); + m_mainWindow->setUrl(url); } -void ViewMediator::setMainCaption( const QString& str ) +void ViewMediator::setMainCaption(const QString& str) { - Q_ASSERT( m_mainWindow ); + Q_ASSERT(m_mainWindow); - m_mainWindow->setCaption( str ); + m_mainWindow->setCaption(str); } -void ViewMediator::bookmark( const QString& datURL, bool on ) +void ViewMediator::bookmark(const QString& datURL, bool on) { - Q_ASSERT( m_mainWindow ); + Q_ASSERT(m_mainWindow); - m_mainWindow->bookmark( datURL, on ); + m_mainWindow->bookmark(datURL, on); } bool ViewMediator::isKitaActive() { - Q_ASSERT( m_mainWindow ); + Q_ASSERT(m_mainWindow); - if( m_mainWindow->isActiveWindow() ) return true; + if(m_mainWindow->isActiveWindow()) return true; return false; } -void ViewMediator::updateBoardView( const KUrl& datURL ) +void ViewMediator::updateBoardView(const KUrl& datURL) { - Q_ASSERT( m_boardTabWidget ); + Q_ASSERT(m_boardTabWidget); - m_boardTabWidget->updateBoardView( datURL ); + m_boardTabWidget->updateBoardView(datURL); } -void ViewMediator::updateThreadView( const KUrl& datURL ) +void ViewMediator::updateThreadView(const KUrl& datURL) { - Q_ASSERT( m_threadTabWidget ); + Q_ASSERT(m_threadTabWidget); - m_threadTabWidget->slotUpdateThreadTab( datURL ); + m_threadTabWidget->slotUpdateThreadTab(datURL); } -void ViewMediator::changeWriteTab( const KUrl& datURL ) +void ViewMediator::changeWriteTab(const KUrl& datURL) { - Q_ASSERT( m_writeTabWidget ); + Q_ASSERT(m_writeTabWidget); - m_writeTabWidget->slotChangeWriteTab( datURL ); + m_writeTabWidget->slotChangeWriteTab(datURL); } void ViewMediator::updateFavoriteListView() { - Q_ASSERT( m_favoriteListView ); + Q_ASSERT(m_favoriteListView); m_favoriteListView->refresh(); } -void ViewMediator::openURL( const KUrl& url ) +void ViewMediator::openURL(const KUrl& url) { // open thread. - if ( Kita::DatManager::isThreadEnrolled( url ) ) { - m_threadTabWidget->slotShowMainThread( url ); + if (Kita::DatManager::isThreadEnrolled(url)) { + m_threadTabWidget->slotShowMainThread(url); return; } - QString mimetype = KIO::NetAccess::mimetype( url , m_threadTabWidget ); - KRun::runUrl( url, mimetype, 0 ); + QString mimetype = KIO::NetAccess::mimetype(url , m_threadTabWidget); + KRun::runUrl(url, mimetype, 0); } Modified: kita/branches/KITA-KDE4/kita/src/viewmediator.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/viewmediator.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/viewmediator.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -33,26 +33,26 @@ 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(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 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 ); + 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 updateBoardView(const KUrl& datURL); + void updateThreadView(const KUrl& datURL); + void changeWriteTab(const KUrl& datURL); void updateFavoriteListView(); - void openURL( const KUrl& url ); + void openURL(const KUrl& url); private: ViewMediator(const ViewMediator&); Modified: kita/branches/KITA-KDE4/kita/src/writedialogbase.ui.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/writedialogbase.ui.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/writedialogbase.ui.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -10,15 +10,15 @@ #ifndef KITAWRITEDIALOGBASEUI_H #define KITAWRITEDIALOGBASEUI_H -void KitaWriteDialogBase::sageBoxToggled( bool on ) +void KitaWriteDialogBase::sageBoxToggled(bool on) { - if ( on ) { + if (on) { m_mailswap = mailLine->text(); - mailLine->setText( "sage" ); - mailLine->setReadOnly( true ); + mailLine->setText("sage"); + mailLine->setReadOnly(true); } else { - mailLine->setReadOnly( false ); - mailLine->setText( m_mailswap ); + mailLine->setReadOnly(false); + mailLine->setText(m_mailswap); } } Modified: kita/branches/KITA-KDE4/kita/src/writetabwidget.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/writetabwidget.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/writetabwidget.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -28,10 +28,10 @@ /*--------------------------------------------------------------------------------*/ -KitaWriteTabWidget::KitaWriteTabWidget( QWidget* parent, Qt::WFlags f ) - : KitaTabWidgetBase( parent, f ) +KitaWriteTabWidget::KitaWriteTabWidget(QWidget* parent, Qt::WFlags f) + : KitaTabWidgetBase(parent, f) { - setXMLFile( "writetabwidgetui.rc" ); + setXMLFile("writetabwidgetui.rc"); setupActions(); } @@ -41,39 +41,39 @@ /* public slot */ -void KitaWriteTabWidget::slotShowWriteView( const KUrl& url, - const QString& resStr ) +void KitaWriteTabWidget::slotShowWriteView(const KUrl& url, + const QString& resStr) { - openWriteView( url, resStr, QString() ); + openWriteView(url, resStr, QString()); } /* private */ -void KitaWriteTabWidget::openWriteView( const KUrl& url, - const QString& resStr, const QString& subject ) +void KitaWriteTabWidget::openWriteView(const KUrl& url, + const QString& resStr, const QString& subject) { // TODO: machiBBS kakiko support. - if ( Kita::BoardManager::type( url ) == Kita::Board_MachiBBS ) { -// QMessageBox::warning( this, QString( "<(_ _)>" ), -// i18n( "Can't write to machi BBS in this version." ) ); + if (Kita::BoardManager::type(url) == Kita::Board_MachiBBS) { +// QMessageBox::warning(this, QString("<(_ _)>"), +// i18n("Can't write to machi BBS in this version.")); // return ; } /* view exists */ - KitaWriteView* view = findWriteView( url ); - if ( view ) { + KitaWriteView* view = findWriteView(url); + if (view) { - if ( view->body().length() ) { + if (view->body().length()) { - if ( QMessageBox::warning( this, "Kita", - i18n( "Do you want to clear the text?" ), + if (QMessageBox::warning(this, "Kita", + i18n("Do you want to clear the text?"), QMessageBox::Ok, - QMessageBox::Cancel | QMessageBox::Default ) == QMessageBox::Cancel ) return ; + QMessageBox::Cancel | QMessageBox::Default) == QMessageBox::Cancel) return ; } /* clear */ - view->setMessage( resStr ); - setCurrentWidget( view ); + view->setMessage(resStr); + setCurrentWidget(view); return ; } @@ -83,26 +83,26 @@ /* write res */ KitaWriteView* new_dlg; - threadName = Kita::DatManager::threadName( url ); - new_dlg = new KitaWriteView( this, url ); - new_dlg->setMessage( resStr ); - addTab( new_dlg, threadName ); - setCurrentWidget( new_dlg ); + threadName = Kita::DatManager::threadName(url); + new_dlg = new KitaWriteView(this, url); + new_dlg->setMessage(resStr); + addTab(new_dlg, threadName); + setCurrentWidget(new_dlg); } /* private */ -KitaWriteView* KitaWriteTabWidget::findWriteView( const KUrl& url ) +KitaWriteView* KitaWriteTabWidget::findWriteView(const KUrl& url) { - KUrl datURL = Kita::getDatURL( url ); - if ( datURL.isEmpty() ) return 0; + KUrl datURL = Kita::getDatURL(url); + if (datURL.isEmpty()) return 0; int max = count(); - if ( max == 0 ) return 0; + if (max == 0) return 0; - for( int i=0; i < max; i++ ) { - KitaWriteView * view = isWriteView( widget ( i ) ); - if ( view ) { - if ( view->datURL() == datURL ) return view; + for(int i=0; i < max; i++) { + KitaWriteView * view = isWriteView(widget (i)); + if (view) { + if (view->datURL() == datURL) return view; } } @@ -111,11 +111,11 @@ /* private */ -KitaWriteView* KitaWriteTabWidget::isWriteView( QWidget* w ) +KitaWriteView* KitaWriteTabWidget::isWriteView(QWidget* w) { KitaWriteView * view = 0; - if ( w ) { - if ( w->inherits( "KitaWriteView" ) ) view = static_cast< KitaWriteView* >( w ); + if (w) { + if (w->inherits("KitaWriteView")) view = static_cast< KitaWriteView* >(w); } return view; @@ -125,43 +125,43 @@ /* when thread view is focused, this slot is called */ /* See also KitaThreadView::setFocus. */ /* private slot */ -void KitaWriteTabWidget::slotChangeWriteTab( const KUrl& url ) +void KitaWriteTabWidget::slotChangeWriteTab(const KUrl& url) { KitaWriteView * view; int max = count(); - if ( max == 0 ) return ; + if (max == 0) return ; /* disable all ok buttons. */ - for( int i=0; i < max ; i++ ) { - view = isWriteView( widget( i ) ); - if ( view ) view->slotEnableWriting( false ); + for(int i=0; i < max ; i++) { + view = isWriteView(widget(i)); + if (view) view->slotEnableWriting(false); } /* show current url page. */ - view = findWriteView( url ); - if ( view ) { - if ( currentWidget() != view ) setCurrentWidget( view ); - view->slotEnableWriting( true ); + view = findWriteView(url); + if (view) { + if (currentWidget() != view) setCurrentWidget(view); + view->slotEnableWriting(true); } } /* protected */ /* virtual */ -void KitaWriteTabWidget::deleteWidget( QWidget* w ) +void KitaWriteTabWidget::deleteWidget(QWidget* w) { - KitaWriteView * view = isWriteView( w ); + KitaWriteView * view = isWriteView(w); - if ( view == 0 ) return ; + if (view == 0) return ; - if ( view->body().length() ) { - if ( QMessageBox::warning( this, "Kita", - i18n( "If you close this dialog, you will lose text.\n" - "Do you want to close?" ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) - == QMessageBox::Cancel ) return ; + if (view->body().length()) { + if (QMessageBox::warning(this, "Kita", + i18n("If you close this dialog, you will lose text.\n" + "Do you want to close?"), + QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default) + == QMessageBox::Cancel) return ; } - KitaTabWidgetBase::deleteWidget( w ); + KitaTabWidgetBase::deleteWidget(w); } @@ -173,24 +173,24 @@ void KitaWriteTabWidget::setupActions() { KAction* quoteclip_action = actionCollection()->addAction("writeview_quoteclip"); - quoteclip_action->setText( i18n( "quote clipboard" ) ); - quoteclip_action->setShortcut( Qt::Key_F2 ); - connect( quoteclip_action, SIGNAL(triggered()), this, SLOT( slotQuoteClipboard() ) ); + quoteclip_action->setText(i18n("quote clipboard")); + quoteclip_action->setShortcut(Qt::Key_F2); + connect(quoteclip_action, SIGNAL(triggered()), this, SLOT(slotQuoteClipboard())); } /* public slot */ void KitaWriteTabWidget::slotQuoteClipboard() { - KitaWriteView * view = isWriteView( currentWidget() ); - if ( view ) { + KitaWriteView * view = isWriteView(currentWidget()); + if (view) { QClipboard * clipboard = QApplication::clipboard(); - QString str = clipboard->text( QClipboard::Selection ); - if ( str.isEmpty() ) str = clipboard->text( QClipboard::Clipboard ); - if ( !str.isEmpty() ) { + QString str = clipboard->text(QClipboard::Selection); + if (str.isEmpty()) str = clipboard->text(QClipboard::Clipboard); + if (!str.isEmpty()) { - QString msg = "\n> " + str.replace( '\n', "\n> " ) + '\n'; - view->insertMessage( msg ); + QString msg = "\n> " + str.replace('\n', "\n> ") + '\n'; + view->insertMessage(msg); } } } Modified: kita/branches/KITA-KDE4/kita/src/writetabwidget.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/writetabwidget.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/writetabwidget.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -23,20 +23,20 @@ Q_OBJECT public: - explicit KitaWriteTabWidget( QWidget* parent = 0, Qt::WFlags f = 0 ); + explicit KitaWriteTabWidget(QWidget* parent = 0, Qt::WFlags f = 0); ~KitaWriteTabWidget(); - void slotShowWriteView( const KUrl& url, const QString& resStr ); + void slotShowWriteView(const KUrl& url, const QString& resStr); private: - void openWriteView( const KUrl& url, const QString& resStr = QString(), const QString& subject = QString() ); - KitaWriteView* findWriteView( const KUrl& url ); - KitaWriteView* isWriteView( QWidget* w ); + void openWriteView(const KUrl& url, const QString& resStr = QString(), const QString& subject = QString()); + KitaWriteView* findWriteView(const KUrl& url); + KitaWriteView* isWriteView(QWidget* w); public: - void slotChangeWriteTab( const KUrl& url ); + void slotChangeWriteTab(const KUrl& url); protected: - virtual void deleteWidget( QWidget* w ); + virtual void deleteWidget(QWidget* w); /*------------------------------------*/ Modified: kita/branches/KITA-KDE4/kita/src/writeview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/writeview.cpp 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/writeview.cpp 2009-07-10 21:05:53 UTC (rev 2384) @@ -57,13 +57,13 @@ Call slotPostMessage() to post the message. */ -KitaWriteView::KitaWriteView( KitaWriteTabWidget* parent, const KUrl& url ) - : QWidget( parent ) +KitaWriteView::KitaWriteView(KitaWriteTabWidget* 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 = Kita::getDatURL(url); + m_bbstype = Kita::BoardManager::type(m_datURL); + m_bbscgi = Kita::getWriteURL(m_datURL); m_parent = parent; initUI(); @@ -72,65 +72,65 @@ void KitaWriteView::initUI() { /* connect signals */ - connect( buttonOk, SIGNAL( clicked() ), - SLOT( slotPostMessage() ) ); + connect(buttonOk, SIGNAL(clicked()), + SLOT(slotPostMessage())); - connect( buttonCancel, SIGNAL( clicked() ), - SLOT( slotCancel() ) ); + connect(buttonCancel, SIGNAL(clicked()), + SLOT(slotCancel())); - connect( faceCombo, SIGNAL( activated( const QString& ) ), - bodyText, SLOT( insert( const QString& ) ) ); + connect(faceCombo, SIGNAL(activated(const QString&)), + bodyText, SLOT(insert(const QString&))); - connect( bodyText, SIGNAL( textChanged() ), - SLOT( slotBodyTextChanged() ) ); + connect(bodyText, SIGNAL(textChanged()), + SLOT(slotBodyTextChanged())); /* setup preview view */ - qtw->setCurrentIndex( 0 ); + qtw->setCurrentIndex(0); /* setup labels and edit lines */ QFont font = Kita::Config::threadFont(); - bodyText->setFont( font ); - bodyText->setTabChangesFocus( true ); + bodyText->setFont(font); + bodyText->setTabChangesFocus(true); - boardNameLabel->setText( Kita::BoardManager::boardName( m_datURL ) ); + boardNameLabel->setText(Kita::BoardManager::boardName(m_datURL)); // setup name field. - nameLine->setText( Kita::Config::defaultName() ); + nameLine->setText(Kita::Config::defaultName()); QStringList compList = Kita::Config::self()->nameCompletionList(); - nameLine->completionObject()->setItems( compList ); + nameLine->completionObject()->setItems(compList); // setup mail field & 'sage' checkbox - if ( Kita::Config::defaultSage() ) { - mailLine->setText( "sage" ); - sageBox->setChecked( true ); + if (Kita::Config::defaultSage()) { + mailLine->setText("sage"); + sageBox->setChecked(true); } else { - mailLine->setText( Kita::Config::defaultMail() ); + mailLine->setText(Kita::Config::defaultMail()); } m_mailswap = ""; // setup 'be' checkbox - QRegExp host_2ch( ".+\\.2ch\\.net" ); - if ( host_2ch.indexIn( m_bbscgi.host() ) != -1 + QRegExp host_2ch(".+\\.2ch\\.net"); + if (host_2ch.indexIn(m_bbscgi.host()) != -1 && Kita::Config::beMailAddress().length() > 0 - && Kita::Config::beAuthCode().length() > 0 ) { - beBox->setChecked( true ); + && Kita::Config::beAuthCode().length() > 0) { + beBox->setChecked(true); } /* setup AA */ faceCombo->clear(); - faceCombo->setFont( Kita::Config::threadFont() ); - faceCombo->addItem( "" ); + faceCombo->setFont(Kita::Config::threadFont()); + faceCombo->addItem(""); QStringList list = Kita::AsciiArtConfig::asciiArtList(); QStringList::iterator it; - for ( it = list.begin(); it != list.end(); ++it ) { - faceCombo->addItem( *it ); + for (it = list.begin(); it != list.end(); ++it) { + faceCombo->addItem(*it); } // init thread name field. - threadNameLine->setText( Kita::DatManager::threadName( m_datURL ) ); - threadNameLine->setReadOnly( true ); - threadNameLine->setFrame( false ); - threadNameLine->setFocusPolicy( Qt::NoFocus ); + threadNameLine->setText(Kita::DatManager::threadName(m_datURL)); + threadNameLine->setReadOnly(true); + threadNameLine->setFrame(false); + threadNameLine->setFocusPolicy(Qt::NoFocus); } KitaWriteView::~KitaWriteView() @@ -138,18 +138,18 @@ } /* public */ -void KitaWriteView::setMessage( const QString& bodyStr ) +void KitaWriteView::setMessage(const QString& bodyStr) { bodyText->clear(); - bodyText->insert( bodyStr ); + bodyText->insert(bodyStr); bodyText->setFocus(); } /* public */ -void KitaWriteView::insertMessage( const QString& str ) +void KitaWriteView::insertMessage(const QString& str) { - bodyText->insert( str ); + bodyText->insert(str); bodyText->setFocus(); } @@ -167,12 +167,12 @@ const QString KitaWriteView::boardID() const { - return Kita::BoardManager::boardID( m_datURL ); + return Kita::BoardManager::boardID(m_datURL); } const QString KitaWriteView::boardName() const { - return Kita::BoardManager::boardName( m_datURL ); + return Kita::BoardManager::boardName(m_datURL); } /* public slot */ /* virtual */ void KitaWriteView::setFocus() @@ -182,7 +182,7 @@ bool KitaWriteView::checkFields() { - if ( body().length() == 0 ) { + if (body().length() == 0) { return false; } else { return true; @@ -192,7 +192,7 @@ QString KitaWriteView::buildPostMessage() { QString postStr; - switch ( m_bbstype ) { + switch (m_bbstype) { case Kita::Board_JBBS: postStr = getJBBSPostStr(); break; @@ -209,43 +209,43 @@ /* call this slot to post the message. */ /* public slot */ void KitaWriteView::slotPostMessage() { - if ( !checkFields() ) return; + if (!checkFields()) return; QString name = nameLine->text(); QStringList list = Kita::Config::nameCompletionList(); - list.append( name ); - Kita::Config::setNameCompletionList( list ); + list.append(name); + Kita::Config::setNameCompletionList(list); /* build post message */ QString postStr = buildPostMessage(); /* referrer */ - QString refStr = Kita::BoardManager::boardURL( m_datURL ); + QString refStr = Kita::BoardManager::boardURL(m_datURL); - m_array.resize( 0 ); + m_array.resize(0); - KIO::TransferJob* job = KIO::http_post( m_bbscgi, postStr.toUtf8() ); - job->addMetaData( "content-type", "Content-type: application/x-www-form-urlencoded" ); - job->addMetaData( "referrer", refStr ); + KIO::TransferJob* job = KIO::http_post(m_bbscgi, postStr.toUtf8()); + job->addMetaData("content-type", "Content-type: application/x-www-form-urlencoded"); + job->addMetaData("referrer", refStr); /* 2ch.net cookie modify */ - if ( m_bbstype == Kita::Board_2ch && beBox->isChecked() ) { + if (m_bbstype == Kita::Board_2ch && beBox->isChecked()) { QString cookie = "Cookie: "; QString BeMailAddress = Kita::Config::beMailAddress(); QString BeAuthCode = Kita::Config::beAuthCode(); - if ( BeMailAddress.length() > 0 && BeAuthCode.length() > 0 ) { + if (BeMailAddress.length() > 0 && BeAuthCode.length() > 0) { cookie += "DMDM=" + BeMailAddress + "; "; cookie += "MDMD=" + BeAuthCode + "; "; } - job->addMetaData( "customHTTPHeader", cookie ); + job->addMetaData("customHTTPHeader", cookie); } - connect( job, SIGNAL( data( KIO::Job*, const QByteArray& ) ), - this, SLOT( slotRecieveData( KIO::Job*, const QByteArray& ) ) ); + connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), + this, SLOT(slotRecieveData(KIO::Job*, const QByteArray&))); /* slotPostFinished() is called when done. */ - connect( job, SIGNAL( result( KIO::Job* ) ), - this, SLOT( slotPostFinished( KIO::Job* ) ) ); + connect(job, SIGNAL(result(KIO::Job*)), + this, SLOT(slotPostFinished(KIO::Job*))); } @@ -253,17 +253,17 @@ /* public slot */ void KitaWriteView::slotCancel() { - if ( body().length() == 0 ) { + if (body().length() == 0) { m_parent->slotCloseCurrentTab(); return ; } - switch ( QMessageBox::warning( this, "Kita", - i18n( "If you close this dialog, you will lose text.\n" - "Do you want to close?" ), - QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default ) ) { + switch (QMessageBox::warning(this, "Kita", + i18n("If you close this dialog, you will lose text.\n" + "Do you want to close?"), + QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default)) { case QMessageBox::Ok: - setMessage( QString() ); + setMessage(QString()); m_parent->slotCloseCurrentTab(); break; case QMessageBox::Cancel: @@ -274,32 +274,32 @@ /* public slot */ -void KitaWriteView::slotEnableWriting( bool enable ) +void KitaWriteView::slotEnableWriting(bool enable) { - buttonOk->setEnabled( enable ); + buttonOk->setEnabled(enable); } /* see also slotPostMessage() */ /* private slot */ -void KitaWriteView::slotRecieveData( KIO::Job*, const QByteArray& data ) +void KitaWriteView::slotRecieveData(KIO::Job*, const QByteArray& data) { - m_array.append( data.data() ); + m_array.append(data.data()); } void KitaWriteView::processPostFinished() { QString response; - QString ckstr = QTextCodec::codecForName( "utf8" ) ->toUnicode( KITAUTF8_WRITECOOKIE ); + QString ckstr = QTextCodec::codecForName("utf8") ->toUnicode(KITAUTF8_WRITECOOKIE); // x-euc-jp & euc-jp - if ( m_array.contains( "euc-jp" ) ) { - response = QTextCodec::codecForName( "eucJP" ) ->toUnicode( m_array ); + if (m_array.contains("euc-jp")) { + response = QTextCodec::codecForName("eucJP") ->toUnicode(m_array); } else { - response = QTextCodec::codecForName( "sjis" ) ->toUnicode( m_array ); + response = QTextCodec::codecForName("sjis") ->toUnicode(m_array); } - int retcode = resultCode( response ); - switch ( retcode ) { + int retcode = resultCode(response); + switch (retcode) { case K2ch_True: @@ -307,10 +307,10 @@ logPostMessage(); /* clear message */ - setMessage( QString() ); + setMessage(QString()); /* reload thread */ - ViewMediator::getInstance()->openThread( m_datURL ); + ViewMediator::getInstance()->openThread(m_datURL); m_parent->slotCloseCurrentTab(); @@ -321,17 +321,17 @@ case K2ch_Check: case K2ch_Error: - KMessageBox::error( 0, resultMessage( response ), resultTitle( response ) ); + KMessageBox::error(0, resultMessage(response), resultTitle(response)); break; /* eat cookie, then re-post message */ case K2ch_Cookie: - if ( KMessageBox::questionYesNo( 0, - QTextCodec::codecForName( "utf8" ) ->toUnicode( KITAUTF8_WRITECOOKIEMSG ), - resultTitle( response ) ) - == KMessageBox::Yes ) { + if (KMessageBox::questionYesNo(0, + QTextCodec::codecForName("utf8") ->toUnicode(KITAUTF8_WRITECOOKIEMSG), + resultTitle(response)) + == KMessageBox::Yes) { slotPostMessage(); } @@ -344,14 +344,14 @@ /* This slot is called when posting is done. */ /* see also slotPostMessage() */ /* private slot */ -void KitaWriteView::slotPostFinished( KIO::Job* ) +void KitaWriteView::slotPostFinished(KIO::Job*) { processPostFinished(); } int KitaWriteView::getWriteResNum() { - return Kita::DatManager::getReadNum( m_datURL ) + 1; + return Kita::DatManager::getReadNum(m_datURL) + 1; } /* private slot */ @@ -359,18 +359,18 @@ { int lines = bodyText->lines(); int tmpln = bodyText->length(); - int length = QTextCodec::codecForName("Shift_JIS")->fromUnicode( body() ).length(); + int length = QTextCodec::codecForName("Shift_JIS")->fromUnicode(body()).length(); /* replace '\n' -> " <br> ", '>' -> "<", and etc. */ - length += ( ( body().count( '\n' ) ) * 5 - + ( body().count( '>' ) ) * 3 - + ( body().count( '<' ) ) * 3 - ); + length += ((body().count('\n')) * 5 + + (body().count('>')) * 3 + + (body().count('<')) * 3 + ); QString str; - str = QString().setNum( lines ); - str += " | " + QString().setNum( length ); - lengthLabel->setText( str ); + str = QString().setNum(lines); + str += " | " + QString().setNum(length); + lengthLabel->setText(str); return true; } @@ -379,70 +379,70 @@ QString KitaWriteView::getPostStr() { QString sessionID; - QString threadID = Kita::DatManager::threadID( m_datURL ); - int serverTime = Kita::DatManager::getServerTime( m_datURL ); + QString threadID = Kita::DatManager::threadID(m_datURL); + int serverTime = Kita::DatManager::getServerTime(m_datURL); /* login */ - if ( Kita::DatManager::is2chThread( m_datURL ) && Kita::Account::isLogged() ) { - sessionID = KUrl::toPercentEncoding( Kita::Account::getSessionID() ); + if (Kita::DatManager::is2chThread(m_datURL) && Kita::Account::isLogged()) { + sessionID = KUrl::toPercentEncoding(Kita::Account::getSessionID()); } - return K2ch::buildPostStr( name(), mail(), + return K2ch::buildPostStr(name(), mail(), body(), boardID(), threadID, serverTime, - sessionID ); + sessionID); } QString KitaWriteView::getMachiBBSPostStr() { - QString threadID = Kita::DatManager::threadID( m_datURL ); - int serverTime = Kita::DatManager::getServerTime( m_datURL ); + QString threadID = Kita::DatManager::threadID(m_datURL); + int serverTime = Kita::DatManager::getServerTime(m_datURL); - return MachiBBS::buildPostStr( name(), mail(), + return MachiBBS::buildPostStr(name(), mail(), body(), boardID(), - threadID, serverTime ); + threadID, serverTime); } /* create posting message for JBBS */ /* private */ /* private */ QString KitaWriteView::getJBBSPostStr() { - QString threadID = Kita::DatManager::threadID( m_datURL ); - int serverTime = Kita::DatManager::getServerTime( m_datURL ); + QString threadID = Kita::DatManager::threadID(m_datURL); + int serverTime = Kita::DatManager::getServerTime(m_datURL); - return JBBS::buildPostStr( name(), mail(), + return JBBS::buildPostStr(name(), mail(), body(), boardID(), - threadID, serverTime ); + threadID, serverTime); } /* create posting message for Flash CGI */ /* private */ /* private */ QString KitaWriteView::getFlashCGIPostStr() { - QString threadID = Kita::DatManager::threadID( m_datURL ); + QString threadID = Kita::DatManager::threadID(m_datURL); QString ret; - return FlashCGI::buildPostStr( name(), mail(), + return FlashCGI::buildPostStr(name(), mail(), body(), boardID(), - threadID ); + threadID); } /* save post log */ /* private */ void KitaWriteView::logPostMessage() { - QString threadURL = Kita::DatManager::threadURL( m_datURL ); + QString threadURL = Kita::DatManager::threadURL(m_datURL); QDateTime now = QDateTime::currentDateTime(); - QString logPath = KStandardDirs::locateLocal( "appdata", "log.txt" ); + QString logPath = KStandardDirs::locateLocal("appdata", "log.txt"); - QFile file( logPath ); - if ( file.open( QIODevice::WriteOnly | QIODevice::Append ) ) { - QTextStream stream( &file ); - stream.setCodec( "UTF-8" ); + QFile file(logPath); + if (file.open(QIODevice::WriteOnly | QIODevice::Append)) { + QTextStream stream(&file); + stream.setCodec("UTF-8"); - stream << "Date : " << now.toString( "yyyy/MM/dd hh:mm:ss" ) << endl; // current time + stream << "Date : " << now.toString("yyyy/MM/dd hh:mm:ss") << endl; // current time stream << "Board : " << boardName() << endl; stream << "Thread : " << threadName() << endl; stream << "URL : " << threadURL << endl; @@ -457,39 +457,39 @@ /* get result code from 2ch tag or title. */ /* private */ -int KitaWriteView::resultCode( const QString& response ) const +int KitaWriteView::resultCode(const QString& response) const { /* see also libkita/kita-utf8.h */ - QString errstr = QTextCodec::codecForName( "utf8" ) ->toUnicode( KITAUTF8_WRITEERROR ); - QString truestr = QTextCodec::codecForName( "utf8" ) ->toUnicode( KITAUTF8_WRITETRUE ); - QString ckstr = QTextCodec::codecForName( "utf8" ) ->toUnicode( KITAUTF8_WRITECOOKIE ); + QString errstr = QTextCodec::codecForName("utf8") ->toUnicode(KITAUTF8_WRITEERROR); + QString truestr = QTextCodec::codecForName("utf8") ->toUnicode(KITAUTF8_WRITETRUE); + QString ckstr = QTextCodec::codecForName("utf8") ->toUnicode(KITAUTF8_WRITECOOKIE); - QRegExp regexp( "<!-- 2ch_X:(.*) -->" ); - int pos = regexp.indexIn( response ); + QRegExp regexp("<!-- 2ch_X:(.*) -->"); + int pos = regexp.indexIn(response); - if ( pos != -1 ) { + if (pos != -1) { /* get code from 2ch tag */ - QString k2ch_X = regexp.cap( 1 ); + QString k2ch_X = regexp.cap(1); - if ( k2ch_X == "true" ) return K2ch_True; - if ( k2ch_X == "false" ) return K2ch_False; - if ( k2ch_X == "error" ) return K2ch_Error; - if ( k2ch_X == "check" ) return K2ch_Check; - if ( k2ch_X == "cookie" ) return K2ch_Cookie; + if (k2ch_X == "true") return K2ch_True; + if (k2ch_X == "false") return K2ch_False; + if (k2ch_X == "error") return K2ch_Error; + if (k2ch_X == "check") return K2ch_Check; + if (k2ch_X == "cookie") return K2ch_Cookie; return K2ch_Unknown; } else { /* get code from title */ - QString title = resultTitle( response ); - if ( title.isEmpty() ) return K2ch_Unknown; + QString title = resultTitle(response); + if (title.isEmpty()) return K2ch_Unknown; - if ( title.contains( errstr ) ) return K2ch_Error; - if ( title.contains( truestr ) ) return K2ch_True; - if ( title.contains( ckstr ) ) return K2ch_Cookie; + if (title.contains(errstr)) return K2ch_Error; + if (title.contains(truestr)) return K2ch_True; + if (title.contains(ckstr)) return K2ch_Cookie; /* for Flash CGI */ - if ( m_bbstype == Kita::Board_FlashCGI ) { - if ( title.contains( "ERROR!!" ) ) { + if (m_bbstype == Kita::Board_FlashCGI) { + if (title.contains("ERROR!!")) { return K2ch_Error; } else { return K2ch_True; @@ -497,10 +497,10 @@ } /* for JBBS. adhoc... */ - if ( m_bbstype == Kita::Board_JBBS ) { + if (m_bbstype == Kita::Board_JBBS) { // x-euc-jp & euc-jp - if ( response.contains( "euc-jp" ) ) { + if (response.contains("euc-jp")) { return K2ch_True; } else { return K2ch_Error; @@ -513,39 +513,39 @@ /* private */ -QString KitaWriteView::resultMessage( const QString& response ) const +QString KitaWriteView::resultMessage(const QString& response) const { - QRegExp tags( "(<[^<]+>|</[^<]+>)" ); + QRegExp tags("(<[^<]+>|</[^<]+>)"); - if ( m_bbstype == Kita::Board_FlashCGI ) { + if (m_bbstype == Kita::Board_FlashCGI) { - QRegExp regexp( "<blockquote>(.*)</blockquote>" ); - int pos = regexp.indexIn( response ); - if ( pos != -1 ) { - return regexp.cap( 1 ).replace( "<br>", "\n" ); + QRegExp regexp("<blockquote>(.*)</blockquote>"); + int pos = regexp.indexIn(response); + if (pos != -1) { + return regexp.cap(1).replace("<br>", "\n"); } return QString(); } { - QRegExp bold_start( "<b>" ); - QRegExp bold_end( "</b>" ); - int startPos = bold_start.indexIn( response ); - if ( startPos != -1 ) { + QRegExp bold_start("<b>"); + QRegExp bold_end("</b>"); + int startPos = bold_start.indexIn(response); + if (startPos != -1) { startPos += 3; - int endPos = bold_end.indexIn( response ); - if ( endPos != -1 && startPos < endPos ) { - QString message = response.mid( startPos, endPos - startPos ); - message.remove( tags ); + int endPos = bold_end.indexIn(response); + if (endPos != -1 && startPos < endPos) { + QString message = response.mid(startPos, endPos - startPos); + message.remove(tags); return message; } } } - QRegExp body_regexp( "<body>([^<]*)</body>" ); - if ( body_regexp.indexIn( response ) != -1 ) { - return body_regexp.cap( 1 ); + QRegExp body_regexp("<body>([^<]*)</body>"); + if (body_regexp.indexIn(response) != -1) { + return body_regexp.cap(1); } return QString(); @@ -553,12 +553,12 @@ /* private */ -QString KitaWriteView::resultTitle( const QString& response ) const +QString KitaWriteView::resultTitle(const QString& response) const { - QRegExp regexp( "<title>(.*)</title>" ); - int pos = regexp.indexIn( response, Qt::CaseInsensitive ); - if ( pos != -1 ) { - return regexp.cap( 1 ); + QRegExp regexp("<title>(.*)</title>"); + int pos = regexp.indexIn(response, Qt::CaseInsensitive); + if (pos != -1) { + return regexp.cap(1); } else { return QString(); } Modified: kita/branches/KITA-KDE4/kita/src/writeview.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/writeview.h 2009-07-09 15:42:11 UTC (rev 2383) +++ kita/branches/KITA-KDE4/kita/src/writeview.h 2009-07-10 21:05:53 UTC (rev 2384) @@ -67,15 +67,15 @@ int getWriteResNum(); void processPostFinished(); void logPostMessage(); - int resultCode( const QString& response ) const; - QString resultMessage( const QString& response ) const; - QString resultTitle( const QString& response ) const; + 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 ); + KitaWriteView(KitaWriteTabWidget* parent, const KUrl& url); virtual ~KitaWriteView(); - void setMessage( const QString& bodyStr ); - void insertMessage( const QString& str ); + void setMessage(const QString& bodyStr); + void insertMessage(const QString& str); const KUrl datURL() const; const QString threadName() const; @@ -101,23 +101,23 @@ virtual void setFocus(); void slotPostMessage(); void slotCancel(); - void slotEnableWriting( bool enable ); - void sageBoxToggled( bool on ) + void slotEnableWriting(bool enable); + void sageBoxToggled(bool on) { - if ( on ) { + if (on) { m_mailswap = mailLine->text(); - mailLine->setText( "sage" ); - mailLine->setReadOnly( true ); + mailLine->setText("sage"); + mailLine->setReadOnly(true); } else { - mailLine->setReadOnly( false ); - mailLine->setText( m_mailswap ); + mailLine->setReadOnly(false); + mailLine->setText(m_mailswap); } } 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();