Index: mythtv/programs/mythtv-setup/channeleditor.cpp
===================================================================
--- mythtv/programs/mythtv-setup/channeleditor.cpp	(révision 20036)
+++ mythtv/programs/mythtv-setup/channeleditor.cpp	(copie de travail)
@@ -23,7 +23,6 @@
 #include "sourceutil.h"
 
 #include "scanwizard.h"
-#include "importicons.h"
 
 ChannelWizard::ChannelWizard(int id, int default_sourceid)
     : ConfigurationWizard()
@@ -121,6 +120,9 @@
     m_currentSortMode = tr("Channel Name");
     m_sourceFilter = FILTER_ALL; // All
     m_currentHideMode = false;
+    m_currentChannelName = "";
+    m_iconWizardRunning = false;
+
 }
 
 bool ChannelEditor::Create()
@@ -207,7 +209,7 @@
     connect(m_channelList, SIGNAL(itemClicked(MythUIButtonListItem *)),
             SLOT(edit(MythUIButtonListItem *)));
     connect(scanButton, SIGNAL(Clicked()), SLOT(scan()));
-    connect(deleteButton,  SIGNAL(Clicked()), SLOT(deleteChannels()));
+    connect(deleteButton,  SIGNAL(Clicked()), SLOT(deleteChannelsMenu()));
 
     fillList();
 
@@ -238,6 +240,16 @@
         {
             del();
         }
+        else if (action == "ESCAPE")
+        {
+            if (m_iconWizardRunning)
+            {
+                iconWizard->Close();
+                m_iconWizardRunning = false;
+            }
+            else
+                handled = false;
+        }
         else
             handled = false;
     }
@@ -374,34 +386,47 @@
     }
 }
 
-void ChannelEditor::deleteChannels(void)
+void ChannelEditor::deleteChannelsMenu(void)
 {
-    const QString currentLabel = m_sourceList->GetValue();
+    QString chan_msg;
+    
+    if (m_sourceFilter == FILTER_ALL)
+    {
+        chan_msg = tr("Are you sure you would like to delete ALL channels?");
+    }
+    else if (m_sourceFilter == FILTER_UNASSIGNED)
+    {
+        chan_msg = tr("Are you sure you would like to delete all unassigned channels?");
+    }
+    else
+    {
+        chan_msg = tr("Are you sure you would like to delete the channels on %1?")
+                       .arg(m_sourceList->GetValue());
+    }
 
-    bool del_all = m_sourceFilter == FILTER_ALL;
-    bool del_nul = m_sourceFilter == FILTER_UNASSIGNED;
+    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
+    MythDialogBox *delChanMenu = new MythDialogBox(chan_msg, popupStack, "deletechannelsmenu");
+    if (delChanMenu->Create())
+    {
+        delChanMenu->SetReturnEvent(this, "deletechannelsmenu");
+ 
+        delChanMenu->AddButton(tr("Yes, delete the channels"));
+        delChanMenu->AddButton(tr("No, don't"));
+ 
+        popupStack->AddScreen(delChanMenu);
+    }
+    else
+        delete delChanMenu;
+}
 
-    QString chan_msg =
-        (del_all) ? tr("Are you sure you would like to delete ALL channels?") :
-        ((del_nul) ?
-         tr("Are you sure you would like to delete all unassigned channels?") :
-         tr("Are you sure you would like to delete the channels on %1?")
-         .arg(currentLabel));
-
-    DialogCode val = MythPopupBox::Show2ButtonPopup(
-        gContext->GetMainWindow(), "", chan_msg,
-        tr("Yes, delete the channels"),
-        tr("No, don't"), kDialogCodeButton1);
-
-    if (kDialogCodeButton0 != val)
-        return;
-
+void ChannelEditor::deleteChannels(void)
+{
     MSqlQuery query(MSqlQuery::InitCon());
-    if (del_all)
+    if (m_sourceFilter == FILTER_ALL)
     {
         query.prepare("TRUNCATE TABLE channel");
     }
-    else if (del_nul)
+    else if (m_sourceFilter == FILTER_UNASSIGNED)
     {
         query.prepare("SELECT sourceid "
                       "FROM videosource "
@@ -554,46 +579,45 @@
     // Get selected channel name from database
     QString querystr = QString("SELECT channel.name FROM channel "
                                "WHERE chanid='%1'").arg(channelID);
-    QString channelname;
+    
     MSqlQuery query(MSqlQuery::InitCon());
     query.prepare(querystr);
 
     if (query.exec() && query.next())
     {
-        channelname = query.value(0).toString();
+        m_currentChannelName = query.value(0).toString();
     }
 
-    QStringList buttons;
-    buttons.append(tr("Cancel"));
-    buttons.append(tr("Download all icons.."));
-    buttons.append(tr("Rescan for missing icons.."));
-    if (!channelname.isEmpty())
-        buttons.append(tr("Download icon for ") + channelname);
+    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
+ 
+    MythDialogBox *menuChanIcon = new MythDialogBox("Download Channel Icons", popupStack, "actionmenu");
+ 
+    if (menuChanIcon->Create())
+        popupStack->AddScreen(menuChanIcon);
 
-    int val = MythPopupBox::ShowButtonPopup(gContext->GetMainWindow(),
-                                             "", "Channel Icon Import", buttons, kDialogCodeButton2);
+    menuChanIcon->SetReturnEvent(this, "channelicons");
 
+    menuChanIcon->AddButton(tr("Cancel"));
+    menuChanIcon->AddButton(tr("Download all icons.."));
+    menuChanIcon->AddButton(tr("Rescan for missing icons.."));
+    if (!m_currentChannelName.isEmpty())
+        menuChanIcon->AddButton(tr("Download icon for ") + m_currentChannelName);
+}
+
+void ChannelEditor::channelIconDownload(bool refresh, const QString &channelname)
+{
     MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
 
-    ImportIconsWizard *iconwizard;
-    if (val == kDialogCodeButton0) // Cancel pressed
-        return;
-    else if (val == kDialogCodeButton1) // Import all icons pressed
-        iconwizard = new ImportIconsWizard(mainStack, false);
-    else if (val == kDialogCodeButton2) // Rescan for missing pressed
-        iconwizard = new ImportIconsWizard(mainStack, true);
-    else if (val == kDialogCodeButton3) // Import a single channel icon
-        iconwizard = new ImportIconsWizard(mainStack, true, channelname);
-    else
-        return;
+    iconWizard = new ImportIconsWizard(mainStack, refresh, channelname);
+    m_iconWizardRunning = true;
 
-    if (iconwizard->Create())
+    if (!iconWizard->Create())
     {
-        connect(iconwizard, SIGNAL(Exiting()), SLOT(fillList()));
-        mainStack->AddScreen(iconwizard);
+        m_iconWizardRunning = false;
+        delete iconWizard;
     }
-    else
-        delete iconwizard;
+
+    m_currentChannelName = "";
 }
 
 void ChannelEditor::customEvent(QEvent *event)
@@ -618,5 +642,26 @@
                     break;
             }
         }
+        else if (resultid == "deletechannelsmenu" && buttonnum == 0)
+        {
+            deleteChannels();
+        }
+        else if (resultid == "channelicons")
+        {
+            switch (buttonnum)
+            {
+                case 0 : // Cancel
+                    break;
+                case 1 : // Download all icons
+                    channelIconDownload(false, "");
+                    break;
+                case 2 : // Download missing icons
+                    channelIconDownload(true, "");
+                    break;
+                case 3 : // Download specific icon
+                    channelIconDownload(true, m_currentChannelName);
+                    break;
+            }
+        }
     }
 }
Index: mythtv/programs/mythtv-setup/channeleditor.h
===================================================================
--- mythtv/programs/mythtv-setup/channeleditor.h	(révision 20036)
+++ mythtv/programs/mythtv-setup/channeleditor.h	(copie de travail)
@@ -4,6 +4,7 @@
 #include "mythscreentype.h"
 
 #include "settings.h"
+#include "importicons.h"
 
 class MythUIButton;
 class MythUIButtonList;
@@ -27,6 +28,8 @@
     void scan(void);
     void transportEditor(void);
     void channelIconImport(void);
+    void channelIconDownload(bool refresh, const QString &channelname);
+    void deleteChannelsMenu(void);
     void deleteChannels(void);
     void setSortMode(MythUIButtonListItem *item);
     void setSourceID(MythUIButtonListItem *item);
@@ -47,6 +50,10 @@
 
     MythUIButtonList *m_channelList;
     MythUIButtonList *m_sourceList;
+
+    bool m_iconWizardRunning;
+    QString m_currentChannelName;
+    ImportIconsWizard *iconWizard;
 };
 
 class ChannelID;
Index: mythtv/programs/mythtv-setup/importicons.cpp
===================================================================
--- mythtv/programs/mythtv-setup/importicons.cpp	(révision 20036)
+++ mythtv/programs/mythtv-setup/importicons.cpp	(copie de travail)
@@ -35,6 +35,8 @@
     m_popupStack = GetMythMainWindow()->GetStack("popup stack");
     m_progressDialog = NULL;
 
+    m_closeDialog = false;
+
     m_tmpDir = QDir(QString("%1/icontmp").arg(GetConfDir()));
 
     if (!m_tmpDir.exists())
@@ -230,8 +232,6 @@
     }
     m_strChannelDir += "/";
 
-    bool closeDialog = false;
-
     QString querystring("SELECT chanid, name, xmltvid, callsign,"
                         "dtv_multiplex.transportid, atsc_major_chan, "
                         "atsc_minor_chan, dtv_multiplex.networkid, "
@@ -332,7 +332,7 @@
         m_progressDialog = NULL;
     }
 
-    while (!closeDialog && (m_iter != m_listEntries.end()))
+    while (!m_closeDialog && (m_iter != m_listEntries.end()))
     {
         QString message = QString("Downloading %1 / %2 : ").arg(m_nCount+1)
             .arg(m_listEntries.size()) + (*m_iter).strName;
@@ -360,7 +360,7 @@
         m_progressDialog = NULL;
     }
 
-    if (m_missingEntries.size() == 0 || closeDialog)
+    if (m_missingEntries.size() == 0 || m_closeDialog)
         return false;
 
     if (m_nMaxCount > 0)
@@ -720,6 +720,11 @@
     }
 }
 
+void ImportIconsWizard::Close()
+{
+    m_closeDialog = true;
+}
+
 void ImportIconsWizard::customEvent(QEvent *event)
 {
     if (event->type() == kMythDialogBoxCompletionEventType)
Index: mythtv/programs/mythtv-setup/importicons.h
===================================================================
--- mythtv/programs/mythtv-setup/importicons.h	(révision 20036)
+++ mythtv/programs/mythtv-setup/importicons.h	(copie de travail)
@@ -39,6 +39,7 @@
     bool Create(void);
 //    bool keyPressEvent(QKeyEvent *);
     void customEvent(QEvent *event);
+    void Close(void);
 
     struct SearchEntry               //! search entry results
     {
@@ -171,6 +172,8 @@
 
     void startDialog();
 
+    bool m_closeDialog;         //!< Set to true when we want dialog to close
+
     MythScreenStack    *m_popupStack;
     MythUIProgressDialog *m_progressDialog;
 
