QString favoritesConfigPath = locateLocal( "appdata", "favorites.xml" );
QFile file( favoritesConfigPath );
if ( file.open( IO_ReadOnly ) ) {
- FavoriteThreads::fromXml( QString::fromUtf8( file.readAll().data() ) );
+ QTextStream stream( &file );
+ stream.setEncoding( QTextStream::UnicodeUTF8 );
+
+ QString xml = stream.read();
+ FavoriteThreads::fromXml( xml );
}
}
KPopupMenu popup( 0 );
popup.insertItem( i18n("Open with Web Browser"), 0 );
popup.insertItem( i18n("Open with New Tab"), 1 );
- popup.insertItem( i18n("Add to Favorites"), 2 );
-
+ if( item->parent() == m_favorites ) {
+ popup.insertItem( i18n( "Remove from Favorites"), 3 );
+ } else {
+ popup.insertItem( i18n("Add to Favorites"), 2 );
+ }
+
KURL url = item->text(1);
switch( popup.exec( point ) ) {
Kita::FavoriteBoards::append( url );
refreshFavoriteBoards();
break;
+ case 3:
+ Kita::FavoriteBoards::remove( url );
+ refreshFavoriteBoards();
+ break;
default:
break;
}