Bug 132792 - warning dialog for pasting large text does not update the preferences when told not to ask again
Summary: warning dialog for pasting large text does not update the preferences when to...
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-22 11:01 UTC by Niek Beernink
Modified: 2006-08-25 02:15 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niek Beernink 2006-08-22 11:01:26 UTC
Version:           0.19+ #3130 (using KDE 3.5.4, Kubuntu Package 4:3.5.4-0ubuntu3 )
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15-25-k7

How to reproduce;

1. Select a few rows of text.
2. Paste in the input box so that you get the warning about pasting too much text.
3. Select "Do not ask again" and click on paste.
4. Settings => Configure Konversation => Warning dialogs
5. Notice that the preference for pasting large portions of text is still enabled.
6. Uncheck that warning and click apply.
7. Paste some rows of text again notice that you get the warning dialog again.

Expected result;

Konvi updates the preference in the settings page.
Comment 1 Niek Beernink 2006-08-22 14:33:42 UTC
"Automatically join channel on invite"  seems to be suffering the same problem.


Comment 2 Eike Hein 2006-08-25 02:15:54 UTC
SVN commit 576858 by hein:

Handle the tri-state "Large Paste" warning correctly in the 
"Warning Dialogs" prefs page.
BUG:132792


 M  +2 -0      ChangeLog  
 M  +1 -1      src/commit.h  
 M  +4 -6      src/ircinput.cpp  
 M  +37 -7     src/warnings_preferences.cpp  


--- trunk/extragear/network/konversation/ChangeLog #576857:576858
@@ -182,6 +182,8 @@
 - Disable input box and context menus in status, query and channel tabs on dis-
   connect, and purge nicklists in channels.
 - Make auto-reconnect pref apply at runtime.
+- Handle the tri-state "Large Paste" warning correctly in the "Warning Dialogs"
+  prefs page.
 
 Changes from 0.18 to 0.19
 We are extremely pleased to announce the immediate release of Konversation 0.19. The focus
--- trunk/extragear/network/konversation/src/commit.h #576857:576858
@@ -1,4 +1,4 @@
 // This COMMIT number is added to version string to be used as "patch level"
 #ifndef COMMIT
-#define COMMIT 3138
+#define COMMIT 3139
 #endif
--- trunk/extragear/network/konversation/src/ircinput.cpp #576857:576858
@@ -458,25 +458,23 @@
     if(text.length()>256 || lines)
     {
         doPaste=KMessageBox::warningYesNoCancel
-            (
-            0,
+            (this,
             i18n("<qt>You are attempting to paste a large portion of text (%1 bytes or %2 lines) into "
             "the chat. This can cause connection resets or flood kills. "
             "Do you really want to continue?</qt>").arg(text.length()).arg(lines+1),
             i18n("Large Paste Warning"),
             i18n("Paste"),
             i18n("&Edit..."),
-            "LargePaste"
-            );
+            "LargePaste");
     }
 
-    if(doPaste==KMessageBox::No)
+    if (doPaste==KMessageBox::No)
     {
         text=MultilineEdit::edit(this,text);
         return true;
     }
 
-    return(doPaste==KMessageBox::Yes);
+    return (doPaste==KMessageBox::Yes);
 }
 
 void IRCInput::showCompletionList(const QStringList& nicks)
--- trunk/extragear/network/konversation/src/warnings_preferences.cpp #576857:576858
@@ -58,12 +58,33 @@
   QString warningsChecked;
 
   QCheckListItem* item=static_cast<QCheckListItem*>(dialogListView->itemAtIndex(0));
-  int i=0;
+  int i = 0;
   while(item)
   {
     // save state of this item in hasChanged() list
     warningsChecked+=item->isOn();
-    config->writeEntry(item->text(2),item->isOn() ? "1" : "0");
+
+    if (item->text(2) == "LargePaste")
+    {
+        if (item->isOn())
+        {
+            config->writeEntry(item->text(2), 1);
+        }
+        else
+        {
+            QString state = config->readEntry(item->text(2));
+
+            if (!state.isEmpty() && (state == "yes" || state == "no"))
+                config->writeEntry(item->text(2), state);
+            else
+                config->writeEntry(item->text(2), "yes");
+        }
+    }
+    else
+    {
+        config->writeEntry(item->text(2),item->isOn() ? "1" : "0");
+    }
+
     item=static_cast<QCheckListItem*>(item->itemBelow());
     ++i;
   }
@@ -75,15 +96,11 @@
 void Warnings_Config::loadSettings()
 {
   QStringList dialogDefinitions;
-  //QString flagNames = "Invitation,SaveLogfileNote,ClearLogfileQuestion,CloseQueryAfterIgnore,ResumeTransfer,ReconnectDifferentServer,QuitServerTab,QuitChannelTab,QuitQueryTab,ChannelListNoServerSelected,RemoveDCCReceivedFile,HideMenuBarWarning,ChannelListWarning,LargePaste";
   QString flagNames = "Invitation,SaveLogfileNote,ClearLogfileQuestion,CloseQueryAfterIgnore,ReconnectDifferentServer,QuitServerTab,QuitChannelTab,QuitQueryTab,ChannelListNoServerSelected,RemoveDCCReceivedFile,HideMenuBarWarning,ChannelListWarning,LargePaste,IgnoreNick,UnignoreNick";
   dialogDefinitions.append(i18n("Automatically join channel on invite"));
   dialogDefinitions.append(i18n("Notice that saving logfiles will save whole file"));
   dialogDefinitions.append(i18n("Ask before deleting logfile contents"));
   dialogDefinitions.append(i18n("Ask about closing queries after ignoring the nickname"));
-  #if 0
-  dialogDefinitions.append(i18n("Ask about what to do on DCC resume"));
-  #endif
   dialogDefinitions.append(i18n("Ask before connecting to a different server in the network"));
   dialogDefinitions.append(i18n("Close server tab"));
   dialogDefinitions.append(i18n("Close channel tab"));
@@ -107,7 +124,20 @@
     item->setText(1,dialogDefinitions[i]);
     flagName = flagNames.section(",",i,i);
     item->setText(2,flagName);
-    item->setOn(config->readBoolEntry(flagName,true));
+
+    if (flagName == "LargePaste")
+    {
+        QString state = config->readEntry(flagName);
+
+        if (state == "yes" || state == "no")
+            item->setOn(false);
+        else
+            item->setOn(true);
+    }
+    else
+    {
+        item->setOn(config->readBoolEntry(flagName,true));
+    }
   }
   // remember checkbox state for hasChanged()
   m_oldWarningsChecked=currentWarningsChecked();