Пример #1
0
        /// <summary>
        /// Adds a recent at the top of the dropdown collection. Deletes an old
        /// one if found. Limits count to 8 recents.
        /// </summary>
        void recent_add()
        {
            ToolStripItemCollection recents = it_Recent.DropDownItems;
            ToolStripItem           it;

            bool found = false;

            for (int i = 0; i != recents.Count; ++i)
            {
                if ((it = recents[i]).Text == _pfe)
                {
                    found = true;

                    if (i != 0)
                    {
                        recents.Remove(it);
                        recents.Insert(0, it);
                    }
                    break;
                }
            }

            if (!found)
            {
                it        = new ToolStripMenuItem(_pfe);
                it.Click += Click_recent;
                recents.Insert(0, it);

                if (recents.Count > 8)                 // up to 8 recents
                {
                    recents.Remove(recents[recents.Count - 1]);
                }
            }
        }
Пример #2
0
        public override void Terminate()
        {
            if (m_host != null)
            {
                m_host.KeyProviderPool.Remove(m_prov);
                if (m_YubiSlot1.Checked)
                {
                    Properties.Settings.Default.YubikeySlot = 0;
                }
                else if (m_YubiSlot2.Checked)
                {
                    Properties.Settings.Default.YubikeySlot = 1;
                }
                else if (m_YubiSlot3.Checked)
                {
                    Properties.Settings.Default.YubikeySlot = 2;
                }


                Properties.Settings.Default.Save();

                ToolStripItemCollection tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems;
                tsMenu.Remove(m_MenuItem);
                tsMenu.Remove(m_Separator);

                m_prov = null;
                m_host = null;
            }
        }
Пример #3
0
        /// <summary>
        /// Release resources, unload.
        /// </summary>
        public override void Terminate()
        {
            base.Terminate();
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems;

            tsMenu.Remove(m_tsSeparator);
            tsMenu.Remove(m_tsmiMenuItem);
        }
        public override void Terminate()
        {
            ToolStripItemCollection tsMenu = m_host.MainWindow.EntryContextMenu.Items;

            GlobalWindowManager.WindowAdded -= global_window_manager_window_added_handler;
            tsMenu.Remove(m_tsmi_set_template_parent);
            tsMenu.Remove(m_tsmi_copy_template_string);
            m_host.MainWindow.EntryContextMenu.Opening -= entry_context_menu_opening_handler;
            EntryTemplates.EntryCreating -= entry_templates_entry_creating_handler;
        }
        public override void Terminate()
        {
            ToolStripItemCollection tsmenu = m_host.MainWindow.ToolsMenu.DropDownItems;

            m_menuItem.Click -= this.showSecurityCheckDialog;
            tsmenu.Remove(m_sep);
            tsmenu.Remove(m_menuItem);
            tsmenu.Remove(m_integ);
            return;
        }
Пример #6
0
        public override void Terminate()
        {
            // Remove all of our menu items
            ToolStripItemCollection menu = host.MainWindow.EntryContextMenu.Items;

            menu.Remove(otpDialogToolStripItem);
            menu.Remove(otpCopyToolStripItem);

            SprEngine.FilterPlaceholderHints.Remove(totpPlaceHolder);
        }
Пример #7
0
        /// <summary>
        /// Terminate plugin
        /// </summary>
        public override void Terminate()
        {
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems;

            m_tsmiMenuItem.Click -= this.OnMenuFavicon;
            m_host.MainWindow.ToolsMenu.DropDownOpened -= this.OnToolsMenuOpen;
            tsMenu.Remove(m_tsmiMenuItem);
            tsMenu.Remove(m_tsSeparator);
            Dispose();
        }
Пример #8
0
        public override void Terminate()
        {
            KeeOtp2Config.unregisterHotKey();

            // Remove all of our menu items
            ToolStripItemCollection menu = host.MainWindow.EntryContextMenu.Items;

            menu.Remove(EntryContextMenuMainItem);
            menu = host.MainWindow.ToolsMenu.DropDownItems;
            menu.Remove(ToolsMenuMainItem);
        }
Пример #9
0
        public override void Terminate()
        {
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems;

            m_tsmiMenuItem.Click  -= this.OnMenuCompare;
            m_tsmiMenuItem2.Click -= this.OnResetColors;
            tsMenu.Remove(m_tsmiMenuItem);
            tsMenu.Remove(m_tsmiMenuItem2);
            tsMenu.Remove(m_tsSeparator);
        }
        public override void Terminate()
        {
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems;

            m_tsmiMenuItem.Click -= this.OnMenuDoSomething;
            tsMenu.Remove(m_tsmiMenuItem);
            tsMenu.Remove(m_tsSeparator);

            // Remove key provider
            m_host.KeyProviderPool.Remove(m_prov);
        }
Пример #11
0
        private void RemoveFromContextMenu()
        {
            // WFT Inject is to GroupContextMenu - Remove from EntryContextMenu?
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = Window.GroupContextMenu.Items;

            tsMenu.Remove(m_groupMenuSeparator);
            //group context menu
            tsMenu.Remove(m_groupMenuKeeShareAddExportFolder);
            tsMenu.Remove(m_groupMenuKeeShareAddImportFolder);
            tsMenu.Remove(m_groupMenuKeeShareSubMenu);
        }
Пример #12
0
        /// <summary>
        /// The <c>Terminate</c> function is called by KeePass when
        /// you should free all resources, close open files/streams,
        /// etc. It is also recommended that you remove all your
        /// plugin menu items from the KeePass menu.
        /// </summary>
        public void Terminate()
        {
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = _host.MainWindow.ToolsMenu.DropDownItems;

            tsMenu.Remove(_tsSeparator);
            tsMenu.Remove(_tsmiPopup);

            // Important! Remove event handlers!
            _host.MainWindow.FileSaved  -= OnFileSaved;
            _host.MainWindow.FileOpened -= OnFileOpened;
        }
Пример #13
0
        /// <summary>
        /// The <c>Terminate</c> function is called by KeePass when
        /// you should free all resources, close open files/streams,
        /// etc. It is also recommended that you remove all your
        /// plugin menu items from the KeePass menu.
        /// </summary>
        public override void Terminate()
        {
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems;

            tsMenu.Remove(m_tsSeparator);
            tsMenu.Remove(m_tsmiPopup);
            tsMenu.Remove(m_tsmiAddGroups);
            tsMenu.Remove(m_tsmiAddEntries);

            // Important! Remove event handlers!
            m_host.MainWindow.FileSaved -= OnFileSaved;
        }
Пример #14
0
        public override void Terminate()
        {
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = pluginHost.MainWindow.ToolsMenu.DropDownItems;

            haveIBeenPwnedServiceMenuItem.Click  -= this.CheckHaveIBeenPwnedSites;
            haveIBeenPwnedUsernameMenuItem.Click -= this.CheckHaveIBeenPwnedUsernames;
            haveIBeenPwnedPasswordMenuItem.Click -= this.CheckHaveIBeenPwnedPasswords;
            haveIBeenPwnedMenuItem.DropDown.Items.Remove(haveIBeenPwnedServiceMenuItem);
            haveIBeenPwnedMenuItem.DropDown.Items.Remove(haveIBeenPwnedUsernameMenuItem);
            haveIBeenPwnedMenuItem.DropDown.Items.Remove(haveIBeenPwnedPasswordMenuItem);
            tsMenu.Remove(haveIBeenPwnedMenuItem);
            tsMenu.Remove(toolStripSeperator);
        }
        /// <summary>
        /// Free resources at closing time.
        /// </summary>
        public override void Terminate()
        {
            // Remove menu items
            ToolStripItemCollection menuItemCollection = this.host.MainWindow.ToolsMenu.DropDownItems;

            this.menuItem.Click -= this.OnMenuItemClick;
            menuItemCollection.Remove(this.menuItem);
            menuItemCollection.Remove(this.separator);

            // Unsubscribe from file opened event
            this.host.MainWindow.FileOpened -= this.OnFileOpened;

            base.Terminate();
        }
Пример #16
0
        /// <summary>
        ///     The <c>Terminate</c> function is called by KeePass when
        ///     you should free all resources, close open files/streams,
        ///     etc. It is also recommended that you remove all your
        ///     plugin menu items from the KeePass menu.
        /// </summary>
        public override void Terminate()
        {
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = this.m_host.MainWindow.ToolsMenu.DropDownItems;

            tsMenu.Remove(this.m_tsSeparator);
            tsMenu.Remove(this.m_tsmiPopup);
            tsMenu.Remove(this.m_tsmiBackupNow);
            tsMenu.Remove(this.m_tsmiAutomaticBackup);
            tsMenu.Remove(this.m_tsmiConfig);

            // Important! Remove event handlers!
            this.m_host.MainWindow.FileSaved -= this.OnFileSaved;
        }
Пример #17
0
        public override void Terminate()
        {
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems;

            tsMenu.Remove(m_tsSeparator);
            tsMenu.Remove(m_tsmiPopup);
            tsMenu.Remove(PathLogs);
            tsMenu.Remove(m_tsmiAddEntries);
            tsMenu.Remove(EncryptLogs);

            // Important! Remove event handlers!
            m_host.MainWindow.FileSaved -= OnFileSaved;
            //m_host.MainWindow.GetSelectedEntry(true).Touched -= OnSavedEntry;
        }
Пример #18
0
        /// <summary>
        /// The <c>Terminate</c> function is called by KeePass when
        /// you should free all resources, close open files/streams,
        /// etc. It is also recommended that you remove all your
        /// plugin menu items from the KeePass menu.
        /// </summary>
        public override void Terminate()
        {
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems;

            tsMenu.Remove(m_tsSeparator);
            tsMenu.Remove(m_tsmiSync);
            tsMenu.Remove(m_tsmiUpload);
            tsMenu.Remove(m_tsmiDownload);
            tsMenu.Remove(m_tsmiConfigure);

            // Important! Remove event handlers!
            m_host.MainWindow.FileSaved  -= OnFileSaved;
            m_host.MainWindow.FileOpened -= OnFileOpened;
        }
Пример #19
0
        private static void FilterUnavailableItems(ToolStripItemCollection items)
        {
            List <ToolStripItem> unavailableItems = new List <ToolStripItem>();

            foreach (ToolStripItem toolStripItem in items)
            {
                if (!toolStripItem.Available)
                {
                    unavailableItems.Add(toolStripItem);
                }
                else if (toolStripItem is ToolStripMenuItem)
                {
                    ToolStripMenuItem toolStripMenuItem = (ToolStripMenuItem)toolStripItem;
                    if (toolStripMenuItem.DropDownItems.Count > 0)
                    {
                        FilterUnavailableItems(toolStripMenuItem.DropDownItems);
                        if (toolStripMenuItem.DropDownItems.Count == 0)
                        {
                            unavailableItems.Add(toolStripItem);
                        }
                    }
                }
            }

            foreach (ToolStripItem unavailableItem in unavailableItems)
            {
                items.Remove(unavailableItem);
                unavailableItem.Dispose();
            }
        }
Пример #20
0
 public static void RemoveRange(this ToolStripItemCollection target, IEnumerable <ToolStripItem> items)
 {
     foreach (var toolStripItem in items.ToList())
     {
         target.Remove(toolStripItem);
     }
 }
Пример #21
0
        public static void RemoveItem(this ToolStripItemCollection menu, string path)
        {
            string[] parts = path.Split('/', '\\');
            ToolStripItemCollection current = menu;

            for (int i = 0; i < parts.Length; i++)
            {
                bool isLast = i == parts.Length - 1;
                if (current.ContainsKey(parts[i]))
                {
                    ToolStripItem item = current[parts[i]];
                    if (isLast)
                    {
                        current.Remove(item);
                        item.Dispose();
                    }

                    if (item is ToolStripDropDownItem mitem)
                    {
                        current = mitem.DropDownItems;
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
        }
Пример #22
0
 static void RemovePreviousItems(ToolStripItemCollection items)
 {
     // Use ToList to avoid deferred execution of NonDefaultMenus
     foreach (var item in NonDefaultMenus(items).ToList())
     {
         items.Remove(item);
     }
 }
Пример #23
0
 static void DisposePreviousItems(ToolStripItemCollection items)
 {
     foreach (var item in NonDefaultMenus(items))
     {
         items.Remove(item);
         item.Dispose();
     }
 }
        public override void Terminate()
        {
            // Remove all of our menu items
            ToolStripItemCollection tsMenu = pluginHost.MainWindow.ToolsMenu.DropDownItems;

            haveIBeenPwnedGlobalServiceMenuItem.Click  -= this.Database_CheckHaveIBeenPwnedSites;
            haveIBeenPwnedGlobalUsernameMenuItem.Click -= this.Database_CheckHaveIBeenPwnedUsernames;
            haveIBeenPwnedGlobalPasswordMenuItem.Click -= this.Database_CheckHaveIBeenPwnedPasswords;
            checkAllGlobalMenuItem.Click -= this.Database_CheckAll;
            haveIBeenPwnedGlobalMenuItem.DropDown.Items.Remove(haveIBeenPwnedGlobalServiceMenuItem);
            haveIBeenPwnedGlobalMenuItem.DropDown.Items.Remove(haveIBeenPwnedGlobalUsernameMenuItem);
            haveIBeenPwnedGlobalMenuItem.DropDown.Items.Remove(haveIBeenPwnedGlobalPasswordMenuItem);
            haveIBeenPwnedGlobalMenuItem.DropDown.Items.Remove(checkAllGlobalMenuItem);
            tsMenu.Remove(haveIBeenPwnedGlobalMenuItem);
            tsMenu.Remove(toolStripSeperatorGlobal);

            var groupContextMenu = pluginHost.MainWindow.GroupContextMenu.Items;

            haveIBeenPwnedGroupServiceMenuItem.Click  -= this.Group_CheckHaveIBeenPwnedSites;
            haveIBeenPwnedGroupUsernameMenuItem.Click -= this.Group_CheckHaveIBeenPwnedUsernames;
            haveIBeenPwnedGroupPasswordMenuItem.Click -= this.Group_CheckHaveIBeenPwnedPasswords;
            checkAllGroupMenuItem.Click -= this.Group_CheckAll;
            haveIBeenPwnedGroupMenuItem.DropDown.Items.Remove(haveIBeenPwnedGroupServiceMenuItem);
            haveIBeenPwnedGroupMenuItem.DropDown.Items.Remove(haveIBeenPwnedGroupUsernameMenuItem);
            haveIBeenPwnedGroupMenuItem.DropDown.Items.Remove(haveIBeenPwnedGroupPasswordMenuItem);
            haveIBeenPwnedGroupMenuItem.DropDown.Items.Remove(checkAllGroupMenuItem);
            groupContextMenu.Remove(haveIBeenPwnedGroupMenuItem);
            groupContextMenu.Remove(toolStripSeperatorGroup);

            var entryContextMenu = pluginHost.MainWindow.EntryContextMenu.Items;

            haveIBeenPwnedEntryServiceMenuItem.Click  -= this.Entries_CheckHaveIBeenPwnedSites;
            haveIBeenPwnedEntryUsernameMenuItem.Click -= this.Entries_CheckHaveIBeenPwnedUsernames;
            haveIBeenPwnedEntryPasswordMenuItem.Click -= this.Entries_CheckHaveIBeenPwnedPasswords;
            checkAllEntryMenuItem.Click -= this.Entries_CheckAll;
            haveIBeenPwnedEntryMenuItem.DropDown.Items.Remove(haveIBeenPwnedEntryServiceMenuItem);
            haveIBeenPwnedEntryMenuItem.DropDown.Items.Remove(haveIBeenPwnedEntryUsernameMenuItem);
            haveIBeenPwnedEntryMenuItem.DropDown.Items.Remove(haveIBeenPwnedEntryPasswordMenuItem);
            haveIBeenPwnedEntryMenuItem.DropDown.Items.Remove(checkAllEntryMenuItem);
            entryContextMenu.Remove(haveIBeenPwnedEntryMenuItem);
            entryContextMenu.Remove(toolStripSeperatorEntry);
        }
        /// <summary>
        /// Terminates this instance.
        /// </summary>
        public override void Terminate()
        {
            // Remove 'Tools' menu items
            ToolStripItemCollection tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems;

            tsMenu.Remove(m_tsSeparator1);
            tsMenu.Remove(menuDownloadFavicons);

            // Remove group context menu items
            ContextMenuStrip gcm = m_host.MainWindow.GroupContextMenu;

            gcm.Items.Remove(m_tsSeparator2);
            gcm.Items.Remove(menuDownloadGroupFavicons);

            // Remove entry context menu items
            ContextMenuStrip ecm = m_host.MainWindow.EntryContextMenu;

            ecm.Items.Remove(m_tsSeparator3);
            ecm.Items.Remove(menuDownloadEntryFavicons);
        }
Пример #26
0
        public static bool RemoveCommand(String commandId, ToolStripItemCollection items)
        {
            ToolStripItem cmd = GetCommandItem(commandId, ref items);

            if (cmd != null)
            {
                // Prevent sequential visible separators
                int iItem = items.IndexOf(cmd);

                if (iItem != -1)
                {
                    ToolStripItem nextCmd = null, prevCmd = null;

                    if (iItem > 0)
                    {
                        prevCmd = items[iItem - 1];
                    }

                    if (iItem < (items.Count - 1))
                    {
                        nextCmd = items[iItem + 1];
                    }

                    if ((nextCmd is ToolStripSeparator) &&
                        ((prevCmd == null) || (prevCmd is ToolStripSeparator)))
                    {
                        items.Remove(nextCmd);
                    }
                    else if ((prevCmd is ToolStripSeparator) && (nextCmd == null))
                    {
                        items.Remove(prevCmd);
                    }

                    items.Remove(cmd);
                }

                return(true);
            }

            return(false);
        }
        public override void Terminate()
        {
            if (CefControl != null)
            {
                CefControl.KillRpc("CefBrowser");
            }

            ToolStripItemCollection tsMenu = _mHost.MainWindow.MainMenuStrip.Items;

            tsMenu.Remove(_menuItemPlugin);

            ToolStripItemCollection pluginMenu = _menuItemPlugin.DropDown.Items;

            _menuItemChangeAllPasswords.Click -= MenuItemChangeAllPasswordsClick;
            pluginMenu.Remove(_menuItemChangeAllPasswords);

            _menuItemChangeOldEntries.Click -= MenuItemChangeOldEntriesOnClick;
            pluginMenu.Remove(_menuItemChangeOldEntries);

            _menuItemTemplateManagement.Click -= MenuItemTemplateManagementOnClick;
            pluginMenu.Remove(_menuItemTemplateManagement);

            _menuItemTemplateManagement.Click -= MenuItemTemplateManagementOnClick;
            pluginMenu.Remove(_menuItemTemplateManagement);

            _menuItemAbout.Click -= MenuItemAboutOnClick;
            pluginMenu.Remove(_menuItemAbout);

            ToolStripItemCollection templateMenu = _menuItemTemplateManagement.DropDown.Items;

            foreach (var toolStripSeparator in _helloSeparator)
            {
                pluginMenu.Remove(toolStripSeparator);
            }

            _menuItemManagePrivateTemplates.Click -= MenuItemManagePrivateTemplatesOnClick;
            templateMenu.Remove(_menuItemManagePrivateTemplates);

            _menuItemManagePublicTemplates.Click -= MenuItemManagePublicTemplatesOnClick;
            templateMenu.Remove(_menuItemManagePublicTemplates);
        }
Пример #28
0
        /// <summary>
        /// Checks recents when the dropdown opens and deletes the paths of
        /// files that don't exist on disk.
        /// </summary>
        /// <param name="sender"><c><see cref="it_Recent"/></c></param>
        /// <param name="e"></param>
        void dropdownopening_Recent(object sender, EventArgs e)
        {
            ToolStripItemCollection recents = it_Recent.DropDownItems;
            ToolStripItem           it;

            for (int i = recents.Count - 1; i != -1; --i)
            {
                if (!File.Exists((it = recents[i]).Text))
                {
                    recents.Remove(it);
                }
            }
        }
Пример #29
0
        private void cms_Dicts_Opening(object sender, CancelEventArgs e)
        {
            ToolStripItemCollection ti = null;

            ti = btn_Dicts_Groups.DropDown.Items;
            if (ti.Find("tss", true).Count() > 0)
            {
                ti.Remove(ti.Find("tss", true)[0]);
            }
            if (ti.Find("Manage_Groups", true).Count() > 0)
            {
                ti.Remove(ti.Find("Manage_Groups", true)[0]);
            }

            foreach (string s in Properties.Settings.Default.s_Groups)
            {
                ToolStripItem t = new ToolStripMenuItem();
                t.Text = s.Substring(0, s.IndexOf(";"));
                t.Name = t.Text;

                if (ti == null || ti.Find(t.Text, true).Count() == 0)
                {
                    btn_Dicts_Groups.DropDown.Items.Add(t);
                    t.Click += T_Click;
                }
            }

            if (ti != null && ti.Count > 0)
            {
                ToolStripSeparator tss = new ToolStripSeparator();
                tss.Name = "tss";
                ToolStripItem tbtn = new ToolStripMenuItem();
                tbtn.Text = "Manage Groups";
                tbtn.Name = "Manage_Groups";
                btn_Dicts_Groups.DropDown.Items.AddRange(new ToolStripItem[] { tss, tbtn });
                tbtn.Click += Tbtn_Click;
            }
        }
        private static void ReplaceItems(ToolStripItemCollection collection, IEnumerable <ToolStripItem> oldItems,
                                         IEnumerable <ToolStripItem> newItems)
        {
            int insertIndex = collection.IndexOf(oldItems.First());

            foreach (ToolStripItem itemToRemove in oldItems)
            {
                collection.Remove(itemToRemove);
            }

            foreach (ToolStripItem itemToAdd in newItems)
            {
                collection.Insert(insertIndex++, itemToAdd);
            }
        }