config->writeEntry( "ShowAA", KitaConfig::showAA() );
config->writeEntry( "AfterShowNum", KitaConfig::afterShowNum() );
config->writeEntry( "PreShowNum", KitaConfig::preShowNum() );
+ config->writeEntry( "UsePart", KitaConfig::usePart() );
+ config->writeEntry( "PartMimeList", KitaConfig::partMimeList() );
config->setGroup( "Color" );
config->writeEntry( "Popup", KitaConfig::popupColor() );
KitaConfig::setShowAA( config->readBoolEntry( "ShowAA", false ) );
KitaConfig::setAfterShowNum( config->readNumEntry( "AfterShowNum", 100 ) );
KitaConfig::setPreShowNum( config->readNumEntry( "PreShowNum", 50 ) );
+ KitaConfig::setUsePart( config->readBoolEntry( "UsePart", true ) );
+ if ( config->hasKey( "PartMimeList" ) )
+ KitaConfig::setPartMimeList( config->readListEntry( "PartMimeList" ) );
+ else {
+ // set partMimeList default
+ QStringList list;
+ list << "image/gif" << "image/jpeg" << "image/png" << "image/x-bmp";
+ KitaConfig::setPartMimeList( list );
+ }
setFont( KitaConfig::font() );
kdDebug() << QString( "NewTab: %1, reload: %2" )
.arg( args.newTab() ? "yes" : "no" )
.arg( args.reload ? "yes" : "no" ) << endl;
- QString mimetype = KIO::NetAccess::mimetype( url );
- kdDebug() << QString( "queried MIME type: \"%1\"" ).arg( mimetype ) << endl;
- if ( mimetype.startsWith( "image/" ) )
- {
- KService::Ptr service = KServiceTypeProfile::preferredService( mimetype, "KParts/ReadOnlyPart" );
- if ( service )
- {
- QString libName = QFile::encodeName( service->library() );
- m_threadTab->showAlternativeView( url, libName, mimetype );
- return;
- }
- }
KURL datURL = Kita::ParseMisc::parseURLonly( url );
QRegExp regexp( "http://([^/]*)/([^/]*)/dat/(.*)\\.dat" );
- if ( regexp.search( datURL.url() ) == -1 )
- {
+ if ( regexp.search( datURL.url() ) == -1 ) {
+ if ( KitaConfig::usePart() ) {
+ QString mimetype = KIO::NetAccess::mimetype( url );
+ kdDebug() << QString( "queried MIME type: \"%1\"" ).arg( mimetype ) << endl;
+ if ( KitaConfig::partMimeList().find( mimetype ) != KitaConfig::partMimeList().end() ) {
+ KService::Ptr service = KServiceTypeProfile::preferredService( mimetype, "KParts/ReadOnlyPart" );
+ if ( service ) {
+ QString libName = QFile::encodeName( service->library() );
+ m_threadTab->showAlternativeView( url, libName, mimetype );
+ return;
+ }
+ }
+ }
new KRun( url );
- }
- else
- {
+ } else {
m_threadTab->showThread( url.prettyURL(), true );
}
}
bool m_showAA;
int m_afterShowNum;
int m_preShowNum;
+ bool m_usePart;
+ QStringList m_partMimeList;
KitaConfig();
virtual ~KitaConfig();
static void setAfterShowNum( int value ) { getInstance() ->m_afterShowNum = value; }
static int preShowNum() { return getInstance() ->m_preShowNum; }
static void setPreShowNum( int value ) { getInstance() ->m_preShowNum = value; }
+ static bool usePart() { return getInstance()->m_usePart; }
+ static void setUsePart( bool value ) { getInstance()->m_usePart = value; }
+ static QStringList& partMimeList() { return getInstance()->m_partMimeList; }
+ static void setPartMimeList( const QStringList value ) { getInstance()->m_partMimeList = value; }
+ static void setPartMimeList( const QString& value )
+ { getInstance()->m_partMimeList = QStringList::split( ',', value ); }
};
#endif
</size>
</property>
</widget>
- <spacer>
- <property name="name">
- <cstring>spacer1</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Fixed</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
<widget class="QToolButton">
<property name="name">
<cstring>deleteButton</cstring>
orderGroup->setButton( KitaConfig::sortOrder() );
afterShowNumSpin->setValue( KitaConfig::afterShowNum() );
preShowNumSpin->setValue( KitaConfig::preShowNum() );
+ extPartGroup->setChecked( KitaConfig::usePart() );
+ partMimeList->setText( KitaConfig::partMimeList().join( "," ) );
connect( useTabCheckBox, SIGNAL( clicked() ), SIGNAL( changed() ) );
connect( MarkTimespinBox, SIGNAL( valueChanged( int ) ), SIGNAL( changed() ) );
connect( orderGroup, SIGNAL( clicked( int ) ), SIGNAL( changed() ) );
connect( afterShowNumSpin, SIGNAL( valueChanged( int ) ), SIGNAL( changed() ) );
connect( preShowNumSpin, SIGNAL( valueChanged( int ) ), SIGNAL( changed() ) );
+#define NCC(ctl, signal) \
+ connect( ctl, SIGNAL( signal ), SIGNAL( changed() ) )
+ NCC( extPartGroup, toggled( bool ) );
+ NCC( partMimeList, textChanged( const QString& ) );
}
void UIPrefPage::apply()
KitaConfig::setSortOrder( orderGroup->id( orderGroup->selected() ) );
KitaConfig::setAfterShowNum( afterShowNumSpin->value() );
KitaConfig::setPreShowNum( preShowNumSpin->value() );
+ KitaConfig::setUsePart( extPartGroup->isChecked() );
+ KitaConfig::setPartMimeList( partMimeList->text() );
}
#include "pref.moc"
</widget>
</vbox>
</widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>extPartGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Use other Part to open external link</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>If mime type include this list ( comma separated list )</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>PartMimeList</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>partMimeList</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
<spacer>
<property name="name">
<cstring>spacer2</cstring>