nntpgrab.patch

chrashoverraid, 08/18/2011 12:17 am

Download (4 KB)

 
DialogConnect.ui (working copy)
72 72
         
73 73
        
74 74
       
75
       
76
        
77
         
78
          
79
           200
80
           0
81
          
82
         
83
         
84
          localhost
85
         
86
        
87
       
88 75
       
89 76
        
90 77
         
... ...
105 92
         
106 93
        
107 94
       
95
       
96
        
97
         
98
          
99
           200
100
           0
101
          
102
         
103
         
104
          true
105
         
106
        
107
       
108 108
      
109 109
     
110 110
     
DialogConnect.cpp (working copy)
21 21
    if (glue->utilsTestIsServerAlreadyRunning()) {
22 22
        ui->btnStartStandalone->setEnabled(false);
23 23
    }
24

                
25
    if(!gui_opts.getHostname1().isEmpty()) {
26
        ui->editHostname->addItem(gui_opts.getHostname1());
27
    }
28
    if(!gui_opts.getHostname2().isEmpty()) {
29
        ui->editHostname->addItem(gui_opts.getHostname2());
30
    }
31
    if(!gui_opts.getHostname3().isEmpty()) {
32
        ui->editHostname->addItem(gui_opts.getHostname3());
33
    }
34
    if(!gui_opts.getHostname4().isEmpty()) {
35
        ui->editHostname->addItem(gui_opts.getHostname4());
36
    }
37
    if(!gui_opts.getHostname5().isEmpty()) {
38
        ui->editHostname->addItem(gui_opts.getHostname5());
39
    }
40

                
24 41
}
25 42

                
26 43
DialogConnect::~DialogConnect()
... ...
86 103

                
87 104
void DialogConnect::on_btnConnect_clicked()
88 105
{
89
    doConnect(ui->editHostname->text(), ui->spinPort->value());
106
    // Have we seen this hostname before ?
107
    QString hostname = ui->editHostname->currentText();
108
    if(!hostname.compare(gui_opts.getHostname1())){
109
        // No need to do anything, item is already at the top of the list
110
    } else if (!hostname.compare(gui_opts.getHostname2())) {
111
        // Swap positions
112
        gui_opts.setHostname2(gui_opts.getHostname1());
113
        gui_opts.setHostname1(hostname);
114
    } else if (!hostname.compare(gui_opts.getHostname3())) {
115
        // Push items 1 and 2 one place down and set the first item to the hostname
116
        gui_opts.setHostname3(gui_opts.getHostname2());
117
        gui_opts.setHostname2(gui_opts.getHostname1());
118
        gui_opts.setHostname1(hostname);
119
    } else if (!hostname.compare(gui_opts.getHostname4())) {
120
        gui_opts.setHostname4(gui_opts.getHostname3());
121
        gui_opts.setHostname3(gui_opts.getHostname2());
122
        gui_opts.setHostname2(gui_opts.getHostname1());
123
        gui_opts.setHostname1(hostname);
124
    } else if (!hostname.compare(gui_opts.getHostname5())) {
125
        gui_opts.setHostname5(gui_opts.getHostname4());
126
        gui_opts.setHostname4(gui_opts.getHostname3());
127
        gui_opts.setHostname3(gui_opts.getHostname2());
128
        gui_opts.setHostname2(gui_opts.getHostname1());
129
        gui_opts.setHostname1(hostname);
130
    } else {
131
        // Hostname not seen at all, move all the items one place down (forget
132
        // about the last item) and put the hostname in front
133
        gui_opts.setHostname5(gui_opts.getHostname4());
134
        gui_opts.setHostname4(gui_opts.getHostname3());
135
        gui_opts.setHostname3(gui_opts.getHostname2());
136
        gui_opts.setHostname2(gui_opts.getHostname1());
137
        gui_opts.setHostname1(hostname);
138
    }
139

                
140
    doConnect(hostname, ui->spinPort->value());
90 141
}