OSDN Git Service

>>976, add actions.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Wed, 14 Jul 2004 13:52:19 +0000 (13:52 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Wed, 14 Jul 2004 13:52:19 +0000 (13:52 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1239 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/part/kitathreadpart.cpp
kita/src/part/kitathreadview.cpp
kita/src/part/kitathreadview.h
kita/src/part/kitathreadviewui.rc

index 24ac6a7..dcfa79f 100644 (file)
@@ -90,6 +90,15 @@ void KitaThreadPart::setupActions()
                 SLOT(slotStopLoading()),
                 actionCollection(),
                 "threadview_stop");
+
+    new KAction(i18n("Delete"),
+                "edittrash",
+                Key_Delete,
+                m_threadview,
+                SLOT(slotDeleteButtonClicked()),
+                actionCollection(),
+                "threadview_delete");
+    
 }
 
 KParts::BrowserExtension* KitaThreadPart::browserExtension() const
index 82bf59e..b2cc67c 100644 (file)
@@ -726,17 +726,21 @@ void KitaThreadView::slotComboActivated( int index )
 
 void KitaThreadView::slotDeleteButtonClicked()
 {
-    if ( !m_datURL.isEmpty()
-        && QMessageBox::warning( this,
-                               "Kita",
-                               "Do you want to delete Log ?",
-                               QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default )
-            == QMessageBox::Ok )
-    {
-        Kita::DatManager::deleteCache( threadURL(), this );
-       emit closeThreadTab( m_datURL );
-       emit updateSubjectTab( m_datURL );
+    if( m_datURL.isEmpty() ) return;
+    int rescode = Kita::DatManager::getResponseCode( m_datURL );
+    int readNum = Kita::DatManager::getReadNum( m_datURL );
+    if( ( rescode != 200 &&  rescode != 206) || readNum >= 900 ){
+        if( QMessageBox::warning( this,
+                                  "Kita",
+                                  "Do you want to delete Log ?",
+                                  QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Default )
+            != QMessageBox::Ok ) return;
     }
+    Kita::DatManager::deleteCache( threadURL(), this );
+    emit closeThreadTab( m_datURL );
+    emit updateSubjectTab( m_datURL );
 }
 
 /*--------------------------------------------------------*/
index c53e17b..0de0f12 100644 (file)
@@ -78,6 +78,7 @@ public slots:
     void slotReloadButton();
     void slotStopLoading();        
     void focusSearchCombo();
+    void slotDeleteButtonClicked();    
     
 protected slots:
     void slotDOMNodeActivated( const DOM::Node& node );
@@ -114,7 +115,6 @@ private slots:
     void slotShowErrorDialog( const QString& input, const KURL& urlOfInput = 0 );
     void slotComboActivated( int index );
     void slotUpdateInfo();
-    void slotDeleteButtonClicked();
 
 signals:
     void datURLRedirected( const KURL& newDatURL );
index 7f37dcf..a1b0c62 100644 (file)
@@ -5,6 +5,7 @@
     <Separator/>
     <Action name="threadview_reload" />
     <Action name="threadview_stop" />
+    <Action name="threadview_delete" />
     <Separator/>
     <Action name="threadview_find" />
   </Menu>