#include "libkita/category.h"
-KitaBoardView::KitaBoardView(QWidget *parent, const char *name)
+KitaBoardView::KitaBoardView( QWidget *parent, const char *name )
: KitaBoardViewBase(parent, name)
{
- m_boardList->setSorting(-1);
- m_boardList->addColumn("name");
- connect(m_boardList, SIGNAL(executed(QListViewItem*)), SLOT( loadBoard(QListViewItem*) ));
+ m_boardList->setSorting( -1 );
+ m_boardList->addColumn( "name" );
+ connect( m_boardList, SIGNAL( executed( QListViewItem* ) ), SLOT( loadBoard( QListViewItem* ) ) );
connect( m_boardList, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ),
SLOT( slotContextMenuRequested( QListViewItem*, const QPoint&, int ) ) );
}
KitaBoardView::~KitaBoardView()
{}
-QString KitaBoardView::getCategory(const QString& line) const
+QString KitaBoardView::getCategory( const QString& line ) const
{
- QRegExp regexp("<BR><BR><B>(.*)</B><BR>", false);
- if(regexp.search(line) != -1) {
+ QRegExp regexp( "<BR><BR><B>(.*)</B><BR>", false );
+ if(regexp.search( line ) != -1) {
return regexp.cap(1);
} else {
return QString::null;
}
}
-Kita::Board* KitaBoardView::getBoard(const QString& line) const
+Kita::Board* KitaBoardView::getBoard( const QString& line ) const
{
- QRegExp regexp("<A HREF=(.*)>(.*)</A>", false);
+ QRegExp regexp( "<A HREF=(.*)>(.*)</A>", false );
if( regexp.search(line) != -1 ) {
QString board_url = regexp.cap(1);
QString board_title = regexp.cap(2);
Kita::Board::setName( board_url, board_title );
- return new Kita::Board(board_url, board_title);
+ return new Kita::Board( board_url, board_title );
} else {
return new Kita::Board( "" );
}
m_boardList->clear();
KListViewItem* previous = 0;
- for(Kita::Category* category = categoryList.first(); category; category = categoryList.next())
+ for( Kita::Category* category = categoryList.first(); category; category = categoryList.next() )
{
QPtrList<Kita::Board> board_list = category->getBoardList();
continue;
}
- KListViewItem* categoryItem = new KListViewItem(m_boardList, previous, category->name());
+ KListViewItem* categoryItem = new KListViewItem( m_boardList, previous, category->name() );
KListViewItem* previousBoard = 0;
QPtrListIterator<Kita::Board> it( board_list );
for(; *it; ++it)
{
Kita::Board* board = *it;
- previousBoard = new KListViewItem(categoryItem, previousBoard, board->name(), board->url());
+ previousBoard = new KListViewItem( categoryItem, previousBoard, board->name(), board->url() );
}
previous = categoryItem;
}
}
-QPtrList<Kita::Category> KitaBoardView::getCategoryList(const QString& html) const
+QPtrList<Kita::Category> KitaBoardView::getCategoryList( const QString& html ) const
{
QPtrList<Kita::Category> result;
- // XXX: maybe crash
- // result.setAutoDelete( true );
-
QStringList lines = QStringList::split("\n", html);
QStringList::iterator it;
for(it = lines.begin(); it != lines.end(); ++it) {
QString category_name = getCategory(*it);
if( category_name != QString::null ) {
- current_category = new Kita::Category(category_name);
- result.append(current_category);
+ current_category = new Kita::Category( category_name );
+ result.append( current_category );
} else {
Kita::Board* board = getBoard(*it);