def okButtonPressed(self, button):
        # writing user's input data to init file
        self.persepolis_setting.setValue(
            'add_link_initialization/ip', self.ip_lineEdit.text())
        self.persepolis_setting.setValue(
            'add_link_initialization/port', self.port_spinBox.value())
        self.persepolis_setting.setValue(
            'add_link_initialization/proxy_user', self.proxy_user_lineEdit.text())
        self.persepolis_setting.setValue(
            'add_link_initialization/download_user', self.download_user_lineEdit.text())

        if self.proxy_checkBox.isChecked() == False:
            ip = None
            port = None
            proxy_user = None
            proxy_passwd = None
        else:
            ip = self.ip_lineEdit.text()
            if not(ip):
                ip = None
            port = self.port_spinBox.value()
            if not(port):
                port = None
            proxy_user = self.proxy_user_lineEdit.text()
            if not(proxy_user):
                proxy_user = None
            proxy_passwd = self.proxy_pass_lineEdit.text()
            if not(proxy_passwd):
                proxy_passwd = None

        if self.download_checkBox.isChecked() == False:
            download_user = None
            download_passwd = None
        else:
            download_user = self.download_user_lineEdit.text()
            if not(download_user):
                download_user = None
            download_passwd = self.download_pass_lineEdit.text()
            if not(download_passwd):
                download_passwd = None

        if self.limit_checkBox.isChecked() == False:
            limit = 0
        else:
            if self.limit_comboBox.currentText() == "KB/S":
                limit = str(self.limit_spinBox.value()) + str("K")
            else:
                limit = str(self.limit_spinBox.value()) + str("M")

        category = str(self.add_queue_comboBox.currentText())

        connections = self.connections_spinBox.value()
        download_path = self.download_folder_lineEdit.text()

        now_date_list = download.nowDate()

        add_link_dictionary = {'referer': None, 'header': None, 'user-agent': None, 'load-cookies': None, 'last_try_date': now_date_list, 'firs_try_date': now_date_list, 'out': None, 'final_download_path': None, 'start_hour': None, 'start_minute': None,
                               'end_hour': None, 'end_minute': None, 'ip': ip, 'port': port, 'proxy_user': proxy_user, 'proxy_passwd': proxy_passwd, 'download_user': download_user, 'download_passwd': download_passwd, 'connections': connections, 'limit': limit, 'download_path': download_path}

# finding checked links in links_table
        self.add_link_dictionary_list = []
        i = 0
        for row in range(self.links_table.rowCount()):
            item = self.links_table.item(row, 0)
            if (item.checkState() == 2):  # it means item is checked
                link = self.links_table.item(row, 1).text()
                self.add_link_dictionary_list.append(
                    add_link_dictionary.copy())
                self.add_link_dictionary_list[i]['link'] = str(link)

                flashgot_add_link_dictionary_str = self.links_table.item(
                    row, 2).text()
                flashgot_add_link_dictionary = ast.literal_eval(
                    flashgot_add_link_dictionary_str)

                if not ('referer' in flashgot_add_link_dictionary):
                    flashgot_add_link_dictionary['referer'] = None

                if not ('header' in flashgot_add_link_dictionary):
                    flashgot_add_link_dictionary['header'] = None

                if not('user-agent' in flashgot_add_link_dictionary):
                    flashgot_add_link_dictionary['user-agent'] = None

                if not('load-cookies' in flashgot_add_link_dictionary):
                    flashgot_add_link_dictionary['load-cookies'] = None

                flashgot_add_link_dictionary['out'] = self.links_table.item(
                    row, 0).text()

                for j in flashgot_add_link_dictionary.keys():
                    self.add_link_dictionary_list[i][j] = flashgot_add_link_dictionary[j]

                i = i + 1

        self.add_link_dictionary_list.reverse()
        self.callback(self.add_link_dictionary_list, category)

        self.close()
    def okButtonPressed(self, button, download_later):
        # writing user's input data to init file
        self.persepolis_setting.setValue('add_link_initialization/ip',
                                         self.ip_lineEdit.text())
        self.persepolis_setting.setValue('add_link_initialization/port',
                                         self.port_spinBox.value())
        self.persepolis_setting.setValue('add_link_initialization/proxy_user',
                                         self.proxy_user_lineEdit.text())
        self.persepolis_setting.setValue(
            'add_link_initialization/download_user',
            self.download_user_lineEdit.text())

        if self.proxy_checkBox.isChecked() == False:
            ip = None
            port = None
            proxy_user = None
            proxy_passwd = None
        else:
            ip = self.ip_lineEdit.text()
            if not (ip):
                ip = None
            port = self.port_spinBox.value()
            if not (port):
                port = None
            proxy_user = self.proxy_user_lineEdit.text()
            if not (proxy_user):
                proxy_user = None
            proxy_passwd = self.proxy_pass_lineEdit.text()
            if not (proxy_passwd):
                proxy_passwd = None

        if self.download_checkBox.isChecked() == False:
            download_user = None
            download_passwd = None
        else:
            download_user = self.download_user_lineEdit.text()
            if not (download_user):
                download_user = None
            download_passwd = self.download_pass_lineEdit.text()
            if not (download_passwd):
                download_passwd = None

        if self.limit_checkBox.isChecked() == False:
            limit = 0
        else:
            if self.limit_comboBox.currentText() == "KB/S":
                limit = str(self.limit_spinBox.value()) + str("K")
            else:
                limit = str(self.limit_spinBox.value()) + str("M")

        if self.start_checkBox.isChecked() == False:
            start_hour = None
            start_minute = None
        else:
            start_hour = str(self.start_hour_spinBox.value())
            start_minute = str(self.start_minute_spinBox.value())

        if self.end_checkBox.isChecked() == False:
            end_hour = None
            end_minute = None
        else:
            end_hour = str(self.end_hour_spinBox.value())
            end_minute = str(self.end_minute_spinBox.value())

        if self.change_name_checkBox.isChecked() == False:
            out = None
        else:
            out = str(self.change_name_lineEdit.text())

        link = self.link_lineEdit.text()

        connections = self.connections_spinBox.value()
        download_path = self.download_folder_lineEdit.text()

        if not ('referer' in self.flashgot_add_link_dictionary):
            self.flashgot_add_link_dictionary['referer'] = None

        if not ('header' in self.flashgot_add_link_dictionary):
            self.flashgot_add_link_dictionary['header'] = None

        if not ('user-agent' in self.flashgot_add_link_dictionary):
            self.flashgot_add_link_dictionary['user-agent'] = None

        if not ('load-cookies' in self.flashgot_add_link_dictionary):
            self.flashgot_add_link_dictionary['load-cookies'] = None

        final_download_path = None

        now_date_list = download.nowDate()
        self.add_link_dictionary = {
            'last_try_date': now_date_list,
            'firs_try_date': now_date_list,
            'out': out,
            'final_download_path': final_download_path,
            'start_hour': start_hour,
            'start_minute': start_minute,
            'end_hour': end_hour,
            'end_minute': end_minute,
            'link': link,
            'ip': ip,
            'port': port,
            'proxy_user': proxy_user,
            'proxy_passwd': proxy_passwd,
            'download_user': download_user,
            'download_passwd': download_passwd,
            'connections': connections,
            'limit': limit,
            'download_path': download_path
        }
        for i in self.flashgot_add_link_dictionary.keys():
            self.add_link_dictionary[i] = self.flashgot_add_link_dictionary[i]

        category = str(self.add_queue_comboBox.currentText())

        del self.flashgot_add_link_dictionary
        self.callback(self.add_link_dictionary, download_later, category)

        self.close()