Ignore:
Timestamp:
2000-08-31T00:42:59+12:00 (24 years ago)
Author:
cs025
Message:

Updated sources with most of uninstall added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsinstaller/gsProgman.cpp

    r1397 r1475  
    8080}
    8181
    82 gsProgramManager::gsProgramManager()
     82gsProgramManager::gsProgramManager(installManager &manager)
     83    : installAgent(manager)
    8384{   this->platform  = new gsPlatform();
    8485    this->connected = false;
     86}
     87
     88void gsProgramManager::logAction(string actionName, string group)
     89{   manager->writeString(actionName);
     90    manager->writeSeparator();
     91  manager->writeString(group);
     92    manager->writeString("\n");
     93}
     94
     95void gsProgramManager::logAction(string actionName, string group, string item, string parameter)
     96{   manager->writeString(actionName);
     97    manager->writeSeparator();
     98  manager->writeString(group);
     99    manager->writeSeparator();
     100  manager->writeString(item);
     101    manager->writeSeparator();
     102  manager->writeString(parameter);
     103    manager->writeString("\n");
     104}
     105
     106bool gsProgramManager::undoAction(string actionName, stringArray &params)
     107{ if (actionName == "ProgManCreateGroup")
     108    {   this->removeProgramGroup(params[0]);
     109    return true;
     110  }
     111  else if (actionName == "ProgManAddIcon")
     112  { this->removeIcon(params[0], params[1]);
     113    return true;
     114  }
     115  return false;
    85116}
    86117
     
    123154}
    124155
    125 bool gsProgramManager::addProgramGroup(const char *groupName)
     156bool gsProgramManager::addProgramGroup(string groupName)
    126157{   //CreateGroup(groupName);
    127158    char buffer[256];
     
    147178  else
    148179  { // add using program manager DDE
    149     sprintf(buffer, "[CreateGroup (%s)]", groupName);
     180    sprintf(buffer, "[CreateGroup (%s)]", groupName.c_str());
    150181    if (!DDEShellCommand(this->instance, buffer))
    151182    {   // flag error by returning false
     
    153184    }
    154185  }
     186
     187  this->logAction("ProgManCreateGroup", groupName);
    155188    return true;
    156189}
    157190
    158 bool gsProgramManager::addIcon( const char *groupName,              // group of the icon
    159                                                                 const char *iconName,                   // name of the icon
    160                                 const char *iconDestination,    // destination file of the icon
    161                                                             const char *description)            // the textual description
    162                                                                                             // of the icon (not usually displayed)
     191bool gsProgramManager::addIcon( string groupName,               // group of the icon
     192                                                                string iconName,                // name of the icon
     193                                string iconDestination, // destination file of the icon
     194                                                            string description)         // the textual description
     195                                                                                // of the icon (not usually displayed)
    163196{   bool                    reply = false;
    164197    char                    buffer[MAX_PATH];
     
    176209
    177210        SHGetPathFromIDList(pidl, buffer);
    178         fullPath    = new FilePath(4, buffer, groupName, iconName, "!.lnk");
     211        fullPath    = new FilePath(4, buffer, groupName.c_str(), iconName.c_str(), ".lnk");
    179212
    180213        // Get a pointer to the IShellLink interface.
     
    186219        // Set the path to the shortcut target, and add the
    187220        // description.
    188       psl->SetPath(iconDestination);
    189 
    190         psl->SetDescription(description);
     221      psl->SetPath(iconDestination.c_str());
     222
     223        psl->SetDescription(description.c_str());
    191224
    192225        // Query IShellLink for the IPersistFile interface for saving the
     
    214247    // ensure that the requisite group is active; the add icon command will
    215248    // use the active group.
    216     sprintf(buffer, "[ShowGroup(%s,5)]", groupName);
     249    sprintf(buffer, "[ShowGroup(%s,5)]", groupName.c_str());
    217250    if (!DDEShellCommand(this->instance, buffer))
    218251    { // TODO: articulate/determine possible errors; expand error handling
     
    221254
    222255    // and now add the item itself to the active (given) group
    223     sprintf(buffer, "[AddItem(%s,%s)]", iconDestination, iconName);
     256    sprintf(buffer, "[AddItem(%s,%s)]", iconDestination.c_str(), iconName.c_str());
    224257    if (!DDEShellCommand(this->instance, buffer))
    225258    {   // TODO: again work out what the problems could be
     
    228261    reply = true;
    229262  }
     263
     264  if (reply)
     265  { this->logAction("ProgManAddItem", groupName, iconName, iconDestination);
     266  }
    230267  return reply;
    231268}
    232269
    233 bool gsProgramManager::removeProgramGroup(const char *groupName)
     270bool gsProgramManager::removeProgramGroup(string groupName)
    234271{   //CreateGroup(groupName);
    235272    char buffer[256];
     
    255292  else
    256293  { // add using program manager DDE
    257     sprintf(buffer, "[DeleteGroup (%s)]", groupName);
     294    sprintf(buffer, "[DeleteGroup (%s)]", groupName.c_str());
    258295    if (!DDEShellCommand(this->instance, buffer))
    259296    {   // flag error by returning false
     
    264301}
    265302
    266 bool gsProgramManager::removeIcon(const char *groupName,                // group of the icon
    267                                                                     const char *iconName)                   // name of the icon
     303bool gsProgramManager::removeIcon(string groupName,             // group of the icon
     304                                                                    string iconName)                    // name of the icon
    268305{   bool                    reply = false;
    269306    char                    buffer[MAX_PATH];
     
    281318
    282319        SHGetPathFromIDList(pidl, buffer);
    283         fullPath    = new FilePath(4, buffer, groupName, iconName, "!.lnk");
     320        fullPath    = new FilePath(4, buffer, groupName.c_str(), iconName.c_str(), "!.lnk");
    284321
    285322    // TODO: delete file
     
    290327    // ensure that the requisite group is active; the add icon command will
    291328    // use the active group.
    292     sprintf(buffer, "[ShowGroup(%s,5)]", groupName);
     329    sprintf(buffer, "[ShowGroup(%s,5)]", groupName.c_str());
    293330    if (!DDEShellCommand(this->instance, buffer))
    294331    { // TODO: articulate/determine possible errors; expand error handling
     
    297334
    298335    // and now add the item itself to the active (given) group
    299     sprintf(buffer, "[DeleteItem(%s)]", iconName);
     336    sprintf(buffer, "[DeleteItem(%s)]", iconName.c_str());
    300337    if (!DDEShellCommand(this->instance, buffer))
    301338    {   // TODO: again work out what the problems could be
Note: See TracChangeset for help on using the changeset viewer.