svnno****@sourc*****
svnno****@sourc*****
2009年 7月 5日 (日) 14:22:43 JST
Revision: 2365 http://sourceforge.jp/projects/kita/svn/view?view=rev&revision=2365 Author: nogu Date: 2009-07-05 14:22:43 +0900 (Sun, 05 Jul 2009) Log Message: ----------- use isNull() and isEmpty() instead of comparing a QString to QString::null or QString() Modified Paths: -------------- kita/branches/KITA-KDE4/kita/src/bbsview.cpp kita/branches/KITA-KDE4/kita/src/htmlpart.cpp kita/branches/KITA-KDE4/kita/src/libkita/access.cpp kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.cpp kita/branches/KITA-KDE4/kita/src/libkita/cache.cpp kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.cpp kita/branches/KITA-KDE4/kita/src/libkita/threadindex.cpp kita/branches/KITA-KDE4/kita/src/mainwindow.cpp kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp kita/branches/KITA-KDE4/kita/src/threadview.cpp kita/branches/KITA-KDE4/kita/src/writetabwidget.cpp kita/branches/KITA-KDE4/kita/src/writeview.cpp Modified: kita/branches/KITA-KDE4/kita/src/bbsview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/bbsview.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/bbsview.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -182,7 +182,7 @@ const int maxNewBoard = 64; /* show new board names */ - if ( newBoards != QString::null && newBoards.count( "\n" ) < maxNewBoard ) { + if ( !newBoards.isNull() && newBoards.count( "\n" ) < maxNewBoard ) { QStringList boardList = newBoards.split( '\n' ); KMessageBox::informationList( this, @@ -191,7 +191,7 @@ } /* show moved board names */ - if ( oldBoards != QString::null ) { + if ( !oldBoards.isNull() ) { QStringList boardList = oldBoards.split( '\n' ); KMessageBox::informationList( this, @@ -200,8 +200,8 @@ boardList, "Kita" ); } - if ( ( newBoards != QString::null && newBoards.count( "\n" ) < maxNewBoard ) - || oldBoards != QString::null ) { + if ( ( !newBoards.isNull() && newBoards.count( "\n" ) < maxNewBoard ) + || !oldBoards.isNull() ) { QMessageBox mb( "kita", i18n( "Do you really want to update board list?" ), QMessageBox::Information, @@ -220,7 +220,7 @@ } if ( ret == QMessageBox::Cancel ) return false; - } else if ( newBoards == QString::null && oldBoards == QString::null ) { + } else if ( newBoards.isNull() && oldBoards.isNull() ) { QMessageBox::information( this, "Kita", i18n( "no new boards" ) ); return false; @@ -377,7 +377,7 @@ Kita::ListViewItem* categoryItem = new Kita::ListViewItem( m_boardList, "extboard" ); // categoryItem->setColor( m_textColor, m_baseColor ); // TODO - while ( ( str = stream.readLine() ) != QString::null ) { + while ( !( str = stream.readLine() ).isNull() ) { if ( ! str.isEmpty() ) { QStringList list = str.split( "<>" ); @@ -412,8 +412,8 @@ current_category.boardURLList.clear(); for ( it = lines.begin(); it != lines.end(); ++it ) { QString category_name = Kita::getCategory( *it ); - if ( category_name != QString::null ) { - if ( current_category.category_name != QString::null ) { + if ( !category_name.isNull() ) { + if ( !current_category.category_name.isNull() ) { result.append( current_category ); } current_category.category_name = category_name; @@ -424,7 +424,7 @@ if ( regexp.indexIn( ( *it ) ) != -1 ) { QString url = regexp.cap( 1 ); QString title = regexp.cap( 2 ); - if ( Kita::isBoardURL( url ) && current_category.category_name != QString::null ) { + if ( Kita::isBoardURL( url ) && !current_category.category_name.isNull() ) { current_category.boardNameList.append( title ); current_category.boardURLList.append( url ); } Modified: kita/branches/KITA-KDE4/kita/src/htmlpart.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/htmlpart.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/htmlpart.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -439,7 +439,7 @@ /* public */ bool KitaHTMLPart::gotoAnchor( const QString& anc, bool pushPosition ) { - if ( anc == QString::null ) return false; + if ( anc.isNull() ) return false; if ( !m_domtree || m_mode == HTMLPART_MODE_POPUP ) return KHTMLPart::gotoAnchor( anc ); @@ -777,7 +777,7 @@ // copy link KAction* openBrowserAct = 0; KAction* copyLinkAct = 0; - if ( url != QString::null ) { + if ( !url.isNull() ) { if ( showppm ) popupMenu.addSeparator(); showppm = true; @@ -871,7 +871,7 @@ emit mousePressed(); /* to KitaThreadView to focus this view. */ KUrl kurl; - if ( e->url().string() != QString::null ) + if ( !e->url().string().isNull() ) kurl = KUrl( Kita::BoardManager::boardURL( m_datURL ), e->url().string() ); m_pushctrl = m_pushmidbt = m_pushrightbt = false; @@ -952,7 +952,7 @@ return ; } - if ( refstr == QString::null ) return ; + if ( refstr.isNull() ) return ; /*---------------------------*/ /* show popupmenu for #write */ @@ -1135,7 +1135,7 @@ } // url - if ( str != QString::null ) str += '\n'; + if ( !str.isNull() ) str += '\n'; str += Kita::DatManager::threadURL( m_datURL ) + '/' + QString().setNum( resNum ) + '\n'; // body @@ -1283,7 +1283,7 @@ void KitaHTMLPart::slotShowResPopup( QPoint point, int refNum, int refNum2 ) { QString innerHTML = Kita::DatManager::getHtml( m_datURL, refNum, refNum2 ); - if ( innerHTML == QString::null ) return ; + if ( innerHTML.isNull() ) return ; showPopupCore( m_datURL, innerHTML, point ); } @@ -1529,7 +1529,7 @@ /* get board name */ QString boardName = Kita::BoardManager::boardName( datURL ); - if ( boardName != QString::null ) innerHTML += '[' + boardName + "] "; + if ( !boardName.isNull() ) 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(). */ @@ -1537,7 +1537,7 @@ /* get thread Name */ QString subName = Kita::DatManager::threadName( datURL ); - if ( subName != QString::null ) innerHTML += subName + "<br><br>"; + if ( !subName.isNull() ) innerHTML += subName + "<br><br>"; if ( !refNum ) refNum = refNum2 = 1; } @@ -1546,7 +1546,7 @@ if ( !refNum ) return ; innerHTML += Kita::DatManager::getHtml( datURL, refNum, refNum2 ); - if ( innerHTML != QString::null ) showPopup( datURL, innerHTML ); + if ( !innerHTML.isNull() ) showPopup( datURL, innerHTML ); } @@ -1565,7 +1565,7 @@ if ( ( refNum = Kita::stringToPositiveNum( chpt, length ) ) != -1 ) { QString innerHTML = Kita::DatManager::getHtml( m_datURL, refNum, refNum ); - if ( innerHTML != QString::null ) { + if ( !innerHTML.isNull() ) { showPopup( m_datURL, innerHTML ); startMultiPopup(); return true; Modified: kita/branches/KITA-KDE4/kita/src/libkita/access.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/access.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/libkita/access.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -49,7 +49,7 @@ // get cache path. QString cachePath = Kita::Cache::getPath( m_datURL ); - if ( cachePath == QString::null ) { + if ( cachePath.isNull() ) { return; } @@ -93,7 +93,7 @@ m_dataSize += m_threadData.length(); QString cachePath = Kita::Cache::getPath( m_datURL ); - if ( cachePath != QString::null ) { + if ( !cachePath.isNull() ) { FILE * fs = fopen( QFile::encodeName( cachePath ), "a" ); if ( !fs ) return ; @@ -282,7 +282,7 @@ ba = lineList[i]; } - if ( line2 == QString::null ) continue; + if ( line2.isNull() ) continue; /* add abone lines */ const char aboneStr[] = "abone<><><>abone<>"; Modified: kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/libkita/boardmanager.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -504,7 +504,7 @@ QStringList flist = d.entryList(filter); for ( QStringList::iterator it = flist.begin(); it != flist.end(); ++it ) { - if ( ( *it ) == QString::null ) continue; + if ( ( *it ).isNull() ) continue; QString datURL = boardURL + "dat/" + ( *it ); @@ -569,7 +569,7 @@ } QString line; - while ( ( line = stream.readLine() ) != QString::null ) { + while ( !( line = stream.readLine() ).isNull() ) { int pos = regexp.indexIn( line ); if ( pos != -1 ) { QString fname = regexp.cap( 1 ); @@ -758,8 +758,8 @@ const QRegExp exp( "/$" ); rootPath.remove( exp ); bbsPath.remove( exp ); - if ( rootPath != QString::null && rootPath.at( 0 ) != '/' ) rootPath = '/' + rootPath; - if ( bbsPath != QString::null && bbsPath.at( 0 ) != '/' ) bbsPath = '/' + bbsPath; + if ( !rootPath.isNull() && rootPath.at( 0 ) != '/' ) rootPath = '/' + rootPath; + if ( !bbsPath.isNull() && bbsPath.at( 0 ) != '/' ) bbsPath = '/' + bbsPath; return type; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/cache.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/cache.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/libkita/cache.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -54,7 +54,7 @@ QString Cache::getPath( const KUrl& url ) { QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path == QString::null ) return QString::null; + if ( path.isNull() ) return QString::null; // qDebug( "%s -> %s",url.prettyUrl().ascii(),path.ascii()); @@ -64,7 +64,7 @@ QString Cache::getIndexPath( const KUrl& url ) { QString path = getPath( url ); - if ( path == QString::null ) { + if ( path.isNull() ) { return QString::null; } else { return path + ".idx"; @@ -80,7 +80,7 @@ QString Cache::getSettingPath( const KUrl& url ) { QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path == QString::null ) return QString::null; + if ( path.isNull() ) return QString::null; return path + "SETTING.TXT"; } @@ -89,7 +89,7 @@ QString Cache::getBBSHistoryPath( const KUrl& url ) { QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path == QString::null ) return QString::null; + if ( path.isNull() ) return QString::null; return path + "BBSHISTORY"; } @@ -98,7 +98,7 @@ QString Cache::getSubjectPath( const KUrl& url ) { QString path = baseDir() + serverDir( url ) + boardDir( url ); - if ( path == QString::null ) return QString::null; + if ( path.isNull() ) return QString::null; return path + "subject.txt"; } Modified: kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/libkita/datinfo.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -225,7 +225,7 @@ See also DatInfo::slotReceiveData() */ /* private */ bool DatInfo::copyOneLineToResDat( const QString& line ) { - if ( line == QString::null ) return false; + if ( line.isNull() ) return false; /* update ReadNum */ const int num = m_thread->readNum() + 1; @@ -892,7 +892,7 @@ QString subject = QString::null; Kita::parseResDat( m_resDatVec[ num ], subject ); - if ( num == 1 && subject != QString::null ) m_thread->setThreadName( subject ); + if ( num == 1 && !subject.isNull() ) m_thread->setThreadName( subject ); if ( m_resDatVec[ num ].broken ) m_broken = true; return true; Modified: kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/libkita/kita_misc.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -179,7 +179,7 @@ QString tmpstr; tmpstr = parseSpecialChar( chpt + i, pos ); - if ( tmpstr != QString::null ) { + if ( !tmpstr.isNull() ) { text += rawData.mid( startPos, i - startPos ) + tmpstr; startPos = i + pos; i = startPos - 1; @@ -417,9 +417,9 @@ } } - if ( thread == QString::null ) return QString::null; + if ( thread.isNull() ) return QString::null; - if ( refBase != QString::null ) { + if ( !refBase.isNull() ) { if ( refBase.at( 0 ) == '-' ) refstr = '1' + refBase; else refstr = refBase; @@ -678,7 +678,7 @@ if ( num != 1 ) m_machiSubject = QString::null; ret += name + "<><>" + date + ' ' + time + " ID:" + id; - if ( host != QString::null ) ret += " HOST:" + host; + if ( !host.isNull() ) ret += " HOST:" + host; ret += "<>" + message + "<>" + m_machiSubject; nextNum = num; } @@ -746,7 +746,7 @@ name.remove( rex ); ret += name + "<>" + mail + "<>" + date + " ID:" + id; - if ( host != QString::null ) ret += " HOST:" + host; + if ( !host.isNull() ) ret += " HOST:" + host; ret += "<>" + body + "<>" + subject; return ret; @@ -1135,7 +1135,7 @@ } if ( pos > length ) return false; - if ( retlinkstr != QString::null ) DatToText( retlinkstr, linkstr ); + if ( !retlinkstr.isNull() ) DatToText( retlinkstr, linkstr ); linkurl = scheme + linkstr; linkstr = prefix + linkstr; @@ -1313,7 +1313,7 @@ bool showMailAddress = Kita::Config::showMailAddress(); bool useTableTag = Kita::Config::useStyleSheet(); - if ( m_colonstr == QString::null ) { + if ( m_colonstr.isNull() ) { m_colonstr = utf8ToUnicode( KITAUTF8_COLON ); m_colonnamestr = utf8ToUnicode( KITAUTF8_NAME ); } @@ -1335,11 +1335,11 @@ if ( showMailAddress ) { titleHTML += resdat.nameHTML; - if ( resdat.address != QString::null ) titleHTML += " [" + resdat.address + ']'; + if ( !resdat.address.isNull() ) titleHTML += " [" + resdat.address + ']'; } else { /* don't show mail address */ - if ( resdat.address == QString::null ) { + if ( resdat.address.isNull() ) { titleHTML += "<span class=\"name_noaddr\">"; titleHTML += resdat.name; @@ -1362,7 +1362,7 @@ if ( useTableTag ) titleHTML += "</td>"; /* ID */ - if ( resdat.id != QString::null ) { + if ( !resdat.id.isNull() ) { if ( useTableTag ) titleHTML += "<td class=\"res_title_id\">"; if ( resdat.id.count( "???" ) >= 1 ) titleHTML += " ID:" + resdat.id; @@ -1371,7 +1371,7 @@ } /* BE */ - if ( resdat.be != QString::null ) { + if ( !resdat.be.isNull() ) { if ( useTableTag ) titleHTML += "<td class=\"res_title_be\">"; titleHTML += " <a href=\"#bepop" + resdat.be + "\">?" + resdat.bepointmark + "</a>"; @@ -1379,7 +1379,7 @@ } /* host */ - if ( resdat.host != QString::null ) { + if ( !resdat.host.isNull() ) { if ( useTableTag ) titleHTML += "<td class=\"res_title_host\">"; titleHTML += " HOST:" + resdat.host; Modified: kita/branches/KITA-KDE4/kita/src/libkita/threadindex.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/threadindex.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/libkita/threadindex.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -104,12 +104,12 @@ /* load thread name */ QString subject = getSubjectPrivate( config ); - if ( subject == QString::null && thread->threadName() != QString::null ) { + if ( subject.isNull() && !thread->threadName().isNull() ) { subject = thread->threadName(); KConfigGroup group = config.group(""); group.writeEntry( "Subject", subject ); } - if ( subject == QString::null ) thread->setThreadName( "?" ); + if ( subject.isNull() ) thread->setThreadName( "?" ); else thread->setThreadName( subject ); /* load res number */ Modified: kita/branches/KITA-KDE4/kita/src/mainwindow.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/mainwindow.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/mainwindow.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -469,7 +469,7 @@ QStringList list; QString str; - while ( ( str = stream.readLine() ) != QString::null ) { + while ( !( str = stream.readLine() ).isNull() ) { if ( ! str.isEmpty() ) { list << str; } @@ -489,7 +489,7 @@ QStringList list; QString str; - while ( ( str = stream.readLine() ) != QString::null ) { + while ( !( str = stream.readLine() ).isNull() ) { if ( ! str.isEmpty() ) { list << str; } @@ -509,7 +509,7 @@ QStringList list; QString str; - while ( ( str = stream.readLine() ) != QString::null ) { + while ( !( str = stream.readLine() ).isNull() ) { if ( ! str.isEmpty() ) { list << str; } @@ -529,7 +529,7 @@ QStringList list; QString str; - while ( ( str = stream.readLine() ) != QString::null ) { + while ( !( str = stream.readLine() ).isNull() ) { if ( ! str.isEmpty() ) { list << str; } Modified: kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/threadtabwidget.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -63,7 +63,7 @@ KitaThreadView* currentView = isThreadView( currentWidget() ); if ( currentView ) viewMode = currentView->getViewMode(); - if ( refstr != QString::null ) { + if ( !refstr.isNull() ) { int i = refstr.indexOf( "-" ); if ( i != -1 ) jumpNum = refstr.left( i ).toInt(); else jumpNum = refstr.toInt(); Modified: kita/branches/KITA-KDE4/kita/src/threadview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadview.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/threadview.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -507,8 +507,8 @@ /* jump */ QString str = SearchCombo->currentText(); - if ( str == QString::null ) return ; - if ( str == "" ) return ; + if ( str.isNull() ) return ; + if ( str.isEmpty() ) return ; if ( str.at( 0 ) == ':' ) return ; if ( str.at( 0 ) == '?' ) return ; Modified: kita/branches/KITA-KDE4/kita/src/writetabwidget.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/writetabwidget.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/writetabwidget.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -186,8 +186,8 @@ if ( view ) { QClipboard * clipboard = QApplication::clipboard(); QString str = clipboard->text( QClipboard::Selection ); - if ( str == QString::null ) str = clipboard->text( QClipboard::Clipboard ); - if ( str != QString::null ) { + if ( str.isNull() ) str = clipboard->text( QClipboard::Clipboard ); + if ( !str.isNull() ) { QString msg = "\n> " + str.replace( '\n', "\n> " ) + '\n'; view->insertMessage( msg ); Modified: kita/branches/KITA-KDE4/kita/src/writeview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/writeview.cpp 2009-07-05 04:53:11 UTC (rev 2364) +++ kita/branches/KITA-KDE4/kita/src/writeview.cpp 2009-07-05 05:22:43 UTC (rev 2365) @@ -485,7 +485,7 @@ } else { /* get code from title */ QString title = resultTitle( response ); - if ( title == QString::null ) return K2ch_Unknown; + if ( title.isNull() ) return K2ch_Unknown; if ( title.contains( errstr ) ) return K2ch_Error; if ( title.contains( truestr ) ) return K2ch_True;