VERSION 5.00
Begin VB.Form frmOptions 
   Caption         =   "Options"
   ClientHeight    =   4560
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9060
   LinkTopic       =   "Form1"
   ScaleHeight     =   4560
   ScaleWidth      =   9060
   StartUpPosition =   1  'CenterOwner
   Begin VB.ListBox lstMenu 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   4560
      IntegralHeight  =   0   'False
      Left            =   0
      TabIndex        =   14
      Top             =   0
      Width           =   2175
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "Save and Close"
      Height          =   495
      Left            =   7560
      TabIndex        =   10
      Top             =   4020
      Width           =   1455
   End
   Begin VB.Frame frameMenu 
      Caption         =   "Event Notification"
      Height          =   3975
      Index           =   2
      Left            =   2220
      TabIndex        =   18
      Top             =   0
      Width           =   6795
      Begin VB.CheckBox chkEventPrompt 
         Caption         =   "Prompt to display the event"
         Height          =   255
         Left            =   360
         TabIndex        =   9
         Top             =   1560
         Width           =   4155
      End
      Begin VB.CheckBox chkEventSound 
         Caption         =   "Play a System sound for an event"
         Height          =   255
         Left            =   360
         TabIndex        =   8
         Top             =   1260
         Width           =   4515
      End
      Begin VB.CheckBox chkEvents 
         Caption         =   "Check for new events (email, appointments, etc.)"
         Height          =   255
         Left            =   180
         TabIndex        =   6
         Top             =   300
         Width           =   4155
      End
      Begin VB.TextBox txtEventDelay 
         Height          =   285
         Left            =   3600
         TabIndex        =   7
         Text            =   "txtEventDelay"
         Top             =   690
         Width           =   735
      End
      Begin VB.Label Label7 
         Caption         =   "NOTES:"
         Height          =   255
         Left            =   120
         TabIndex        =   21
         Top             =   2820
         Width           =   2415
      End
      Begin VB.Label Label6 
         Caption         =   "Select the events that you would like to phpGWShell to look for.  Also enter the interval in minutes between checks."
         Height          =   795
         Left            =   120
         TabIndex        =   20
         Top             =   3060
         Width           =   6495
      End
      Begin VB.Label Label5 
         Alignment       =   1  'Right Justify
         Caption         =   "Minutes to wait between New Event checking:"
         Height          =   195
         Left            =   180
         TabIndex        =   19
         Top             =   720
         Width           =   3375
      End
   End
   Begin VB.Frame frameMenu 
      Caption         =   "Account Options"
      Height          =   3975
      Index           =   1
      Left            =   2220
      TabIndex        =   11
      Top             =   0
      Width           =   6795
      Begin VB.TextBox txtDomain 
         Height          =   285
         Left            =   3780
         TabIndex        =   28
         Text            =   "txtDomain"
         Top             =   540
         Width           =   2295
      End
      Begin VB.CheckBox chkDomain 
         Caption         =   "Domain Required"
         Height          =   255
         Left            =   3780
         TabIndex        =   27
         Top             =   240
         Width           =   1635
      End
      Begin VB.CheckBox chkAutoLogin 
         Caption         =   "Automatically login on startup"
         Height          =   315
         Left            =   600
         TabIndex        =   5
         Top             =   1080
         Width           =   2595
      End
      Begin VB.TextBox txtPassword 
         Height          =   285
         IMEMode         =   3  'DISABLE
         Left            =   1200
         PasswordChar    =   "*"
         TabIndex        =   4
         Text            =   "txtPassword"
         Top             =   660
         Width           =   2175
      End
      Begin VB.TextBox txtLogin 
         Height          =   285
         Left            =   1200
         TabIndex        =   3
         Text            =   "txtLogin"
         Top             =   300
         Width           =   2175
      End
      Begin VB.Label Label13 
         Caption         =   "Enter the domain EXACTLY as it appears in the list on the login page."
         Height          =   495
         Left            =   3780
         TabIndex        =   29
         Top             =   900
         Width           =   2595
      End
      Begin VB.Label Label9 
         Caption         =   "NOTES:"
         Height          =   255
         Left            =   120
         TabIndex        =   23
         Top             =   2880
         Width           =   2415
      End
      Begin VB.Label Label8 
         Caption         =   $"frmOptions.frx":0000
         Height          =   795
         Left            =   120
         TabIndex        =   22
         Top             =   3120
         Width           =   6495
      End
      Begin VB.Label Label2 
         Alignment       =   1  'Right Justify
         Caption         =   "Password:"
         Height          =   195
         Left            =   180
         TabIndex        =   13
         Top             =   720
         Width           =   975
      End
      Begin VB.Label Label1 
         Alignment       =   1  'Right Justify
         Caption         =   "Login Name:"
         Height          =   195
         Left            =   180
         TabIndex        =   12
         Top             =   360
         Width           =   975
      End
   End
   Begin VB.Frame frameMenu 
      Caption         =   "General Oprions"
      Height          =   3975
      Index           =   0
      Left            =   2220
      TabIndex        =   15
      Top             =   0
      Width           =   6795
      Begin VB.TextBox txtFriendlyName 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Left            =   120
         TabIndex        =   0
         Text            =   "txtFriendlyName"
         Top             =   480
         Width           =   5775
      End
      Begin VB.TextBox txtLogoutTimeOut 
         Height          =   285
         Left            =   2940
         TabIndex        =   2
         Text            =   "txtLogoutTimeOut"
         Top             =   1560
         Width           =   735
      End
      Begin VB.TextBox txtURL 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Left            =   120
         TabIndex        =   1
         Text            =   "txtURL"
         Top             =   1140
         Width           =   5775
      End
      Begin VB.Label Label12 
         Caption         =   "Name of server:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   180
         TabIndex        =   26
         Top             =   240
         Width           =   4335
      End
      Begin VB.Label Label11 
         Caption         =   "NOTES:"
         Height          =   255
         Left            =   120
         TabIndex        =   25
         Top             =   2460
         Width           =   2415
      End
      Begin VB.Label Label10 
         Caption         =   $"frmOptions.frx":010A
         Height          =   1155
         Left            =   120
         TabIndex        =   24
         Top             =   2700
         Width           =   6495
      End
      Begin VB.Label Label4 
         Alignment       =   1  'Right Justify
         Caption         =   "Seconds to wait for logout on closing:"
         Height          =   195
         Left            =   180
         TabIndex        =   17
         Top             =   1590
         Width           =   2715
      End
      Begin VB.Label Label3 
         Caption         =   "Full URL to your PHPGroupWare:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   180
         TabIndex        =   16
         Top             =   900
         Width           =   4335
      End
   End
End
Attribute VB_Name = "frmOptions"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim lIndex As Long


Private Sub Command1_Click()
On Error Resume Next
    Dim sValue As String
    'mailto
    sValue = """%ProgramFiles%\Outlook Express\msimn.exe"" /mailurl:%1"
    Dummy = SaveLOCALRegKey("SOFTWARE\Classes\mailto\shell\open\command", "*", sValue)
    sValue = "%ProgramFiles%\Outlook Express\msimn.exe,-2"
    Dummy = SaveLOCALRegKey("SOFTWARE\Classes\mailto\DefaultIcon", "*", sValue)
    
'    'phpgw needs to handle this differently first
'    'news
'    sValue = """%ProgramFiles%\Outlook Express\msimn.exe"" /newsurl:%1"
'    Dummy = SaveLOCALRegKey("SOFTWARE\Classes\news\shell\open\command", "*", sValue)
'    sValue = "%ProgramFiles%\Outlook Express\msimn.exe,-3"
'    Dummy = SaveLOCALRegKey("SOFTWARE\Classes\news\DefaultIcon", "*", sValue)
'
'    'nntp
'    sValue = """%ProgramFiles%\Outlook Express\msimn.exe"" /newsurl:%1"
'    Dummy = SaveLOCALRegKey("SOFTWARE\Classes\news\shell\open\command", "*", sValue)
'    sValue = "%ProgramFiles%\Outlook Express\msimn.exe,-3"
'    Dummy = SaveLOCALRegKey("SOFTWARE\Classes\news\DefaultIcon", "*", sValue)
'
'    'snews
'    sValue = """%ProgramFiles%\Outlook Express\msimn.exe"" /newsurl:%1"
'    Dummy = SaveLOCALRegKey("SOFTWARE\Classes\snews\shell\open\command", "*", sValue)
'    sValue = "%ProgramFiles%\Outlook Express\msimn.exe,-3"
'    Dummy = SaveLOCALRegKey("SOFTWARE\Classes\snews\DefaultIcon", "*", sValue)

End Sub

Private Sub Form_Load()
On Error Resume Next
    Me.Icon = frmAbout.Icon
    
    lstMenu.Clear
    lstMenu.AddItem "General"
    lstMenu.ItemData(lstMenu.NewIndex) = 0
    lstMenu.AddItem "Account"
    lstMenu.ItemData(lstMenu.NewIndex) = 1
    lstMenu.AddItem "Events"
    lstMenu.ItemData(lstMenu.NewIndex) = 2
    lstMenu.ListIndex = 0
End Sub

Private Sub lstMenu_Click()
On Error Resume Next
    frameMenu(lstMenu.ItemData(lstMenu.ListIndex)).ZOrder 0
End Sub

Public Sub LoadServer(Index As Long)
    'General
    txtFriendlyName.Text = arrServers(Index).FriendlyName
    txtURL.Text = arrServers(Index).BaseURL
    txtLogoutTimeOut.Text = arrServers(Index).LogoutTimeout
    
    'Account
    txtLogin.Text = arrServers(Index).LoginID
    chkDomain.Value = Abs(arrServers(Index).DomainRequired)
    txtDomain.Text = arrServers(Index).Domain
    txtPassword.Text = arrServers(Index).Password
    chkAutoLogin.Value = Abs(arrServers(Index).AutoLogin)
    
    'Events
    chkEvents.Value = Abs(arrServers(Index).Events)
    chkEventPrompt.Value = Abs(arrServers(Index).EventPrompt)
    chkEventSound.Value = Abs(arrServers(Index).EventSound)
    txtEventDelay.Text = arrServers(Index).EventDelay
    
    lIndex = Index
End Sub

Private Sub cmdSave_Click()
On Error Resume Next
    
    If txtFriendlyName.Text = "" Then
        MsgBox "You must give this server a name to identify it.", vbCritical
        lstMenu.ListIndex = 0
        txtFriendlyName.SetFocus
        Exit Sub
    End If
    If Right(txtURL.Text, 1) <> "/" Then
        txtURL.Text = txtURL.Text & "/"
    End If
    
    If lIndex > UBound(arrServers) Then
        ReDim Preserve arrServers(lIndex)
    End If
    
    'General
    arrServers(lIndex).FriendlyName = txtFriendlyName.Text
    arrServers(lIndex).BaseURL = txtURL.Text
    arrServers(lIndex).LogoutTimeout = txtLogoutTimeOut.Text
    
    'Account
    arrServers(lIndex).LoginID = txtLogin.Text
    arrServers(lIndex).Domain = txtDomain.Text
    arrServers(lIndex).DomainRequired = chkDomain.Value
    arrServers(lIndex).Password = txtPassword.Text
    arrServers(lIndex).AutoLogin = chkAutoLogin.Value
    
    'Events
    arrServers(lIndex).Events = chkEvents.Value
    arrServers(lIndex).EventPrompt = chkEventPrompt.Value
    arrServers(lIndex).EventSound = chkEventSound.Value
    arrServers(lIndex).EventDelay = txtEventDelay.Text
    
    Unload Me
End Sub

Public Sub AddServer()
    'General
    txtFriendlyName.Text = ""
    txtURL.Text = "HTTP://server.com/phpGroupWare/"
    txtLogoutTimeOut.Text = "5"
    
    'Account
    txtLogin.Text = ""
    chkDomain.Value = 0
    txtDomain.Text = ""
    txtPassword.Text = ""
    chkAutoLogin.Value = 0
    
    'Events
    chkEvents.Value = 1
    chkEventPrompt.Value = 0
    chkEventSound.Value = 1
    txtEventDelay.Text = 10
    
    On Error GoTo HandleIt
    lIndex = UBound(arrServers) + 1
    
    Exit Sub
HandleIt:
    lIndex = 0
End Sub


