This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[setup PATCH] OnAcceptActivation


Here at last... OnAcceptActivation!

Extracted from the bulk of Gary's changes, bugfixed (the DWL_MSGRESULT logic
was inverted), and also removing the "bumper" code in SplashPage and
SourcePage which was substituting for this functionality.

Actually, I'd like to propose the alternate name "WantActivation" - slightly
more intuitive?


Max.


2003-07-28  Max Bowsher  <maxb@ukf.net>

 Based on a patch by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>.
 * AntiVirus.cc (AntiVirusPage::OnAcceptActivation): Define.
 * AntiVirus.h (AntiVirusPage::OnAcceptActivation): Declare.
 * proppage.cc (PropertyPage::DialogProc): Call OnAcceptActivation(),
 and skip to next page in sequence if activation is refused.
 * proppage.h (PropertyPage::OnAcceptActivation): Default implementation.
 * source.cc: Don't include "AntiVirus.h".
 (SourcePage::OnBack): Remove logic subsumed by
 AntiVirusPage::OnAcceptActivation.
 * splash.cc: Don't include "AntiVirus.h" or "dialog.h".
 (SplashPage::OnNext): Remove - subsumed by
 AntiVirusPage::OnAcceptActivation.
 * splash.h (SplashPage::OnNext): Remove declaration.

Index: AntiVirus.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/AntiVirus.cc,v
retrieving revision 2.4
diff -u -p -r2.4 AntiVirus.cc
--- AntiVirus.cc 28 Jul 2003 17:47:00 -0000 2.4
+++ AntiVirus.cc 28 Jul 2003 21:26:39 -0000
@@ -101,7 +101,19 @@ AntiVirusPage::OnActivate ()
       SendMessage (GetDlgItem (IDC_LEAVE_AV), BM_SETCHECK,
      BST_CHECKED, 0);
     }
+}

+bool
+AntiVirusPage::OnAcceptActivation()
+{
+  // Check if there's an antivirus scanner to be disabled.
+  if(!KnownAVIsPresent)
+  {
+    // Nope, skip this page by "not accepting" activation.
+    return false;
+  }
+
+  return true;
 }

 long
Index: AntiVirus.h
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/AntiVirus.h,v
retrieving revision 2.2
diff -u -p -r2.2 AntiVirus.h
--- AntiVirus.h 23 Jun 2003 20:48:59 -0000 2.2
+++ AntiVirus.h 28 Jul 2003 21:26:39 -0000
@@ -41,6 +41,7 @@ public:
   bool Create ();

   virtual void OnActivate ();
+  virtual bool OnAcceptActivation();
   virtual void OnDeactivate ();
   virtual long OnNext ();
   virtual long OnBack ();
Index: proppage.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/proppage.cc,v
retrieving revision 2.4
diff -u -p -r2.4 proppage.cc
--- proppage.cc 21 Sep 2002 09:36:46 -0000 2.4
+++ proppage.cc 28 Jul 2003 22:29:57 -0000
@@ -159,7 +159,13 @@ PropertyPage::DialogProc (UINT message,
   GetOwner ()->SetButtons (PSWIZB_BACK | PSWIZB_NEXT);
        }

-     OnActivate ();
+     if(!OnAcceptActivation())
+     {
+       ::SetWindowLong (GetHWND (), DWL_MSGRESULT, -1);
+       return TRUE;
+     }
+
+     OnActivate();

      if (unattended_mode)
        {
Index: proppage.h
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/proppage.h,v
retrieving revision 2.5
diff -u -p -r2.5 proppage.h
--- proppage.h 23 Jun 2003 20:49:00 -0000 2.5
+++ proppage.h 28 Jul 2003 21:36:12 -0000
@@ -92,6 +92,10 @@ public:
   virtual void OnActivate ()
   {
   };
+  virtual bool OnAcceptActivation ()
+  {
+    return true;
+  };
   virtual void OnDeactivate ()
   {
   };
Index: source.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/source.cc,v
retrieving revision 2.14
diff -u -p -r2.14 source.cc
--- source.cc 25 Nov 2002 00:41:25 -0000 2.14
+++ source.cc 28 Jul 2003 21:39:23 -0000
@@ -33,8 +33,6 @@ static const char *cvsid =

 #include "source.h"

-#include "AntiVirus.h"
-
 #include "getopt++/BoolOption.h"

 static BoolOption DownloadOption (false, 'D', "download", "Download from
internet");
@@ -127,8 +125,6 @@ long
 SourcePage::OnBack ()
 {
   save_dialog (GetHWND ());
-  if (!AntiVirus::Show())
-      return IDD_SPLASH;
   return 0;
 }

Index: splash.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/splash.cc,v
retrieving revision 2.10
diff -u -p -r2.10 splash.cc
--- splash.cc 25 Nov 2002 00:41:25 -0000 2.10
+++ splash.cc 28 Jul 2003 21:38:37 -0000
@@ -21,8 +21,6 @@
 #include "resource.h"
 #include "cistring.h"
 #include "splash.h"
-#include "AntiVirus.h"
-#include "dialog.h"

 bool
 SplashPage::Create ()
@@ -42,12 +40,3 @@ SplashPage::OnInit ()
   // Set the font for the IDC_STATIC_WELCOME_TITLE
   SetDlgItemFont(IDC_STATIC_WELCOME_TITLE, "Ariel", 12, FW_BOLD);
 }
-
-long
-SplashPage::OnNext()
-{
-  if (!AntiVirus::Show())
-    return IDD_SOURCE;
-  return 0;
-}
-
Index: splash.h
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/splash.h,v
retrieving revision 2.5
diff -u -p -r2.5 splash.h
--- splash.h 23 Jun 2003 20:49:00 -0000 2.5
+++ splash.h 28 Jul 2003 21:38:46 -0000
@@ -33,7 +33,6 @@ public:

   bool Create ();
   virtual void OnInit ();
-  virtual long OnNext ();
   long OnUnattended ()
   {
     return 0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]